import type * as plugins from './plugins.js'; import { type TControllerSessionId } from '../dist_ts_interfaces/index.js'; import type { IControllerResourceAttachmentEntryDocument, IControllerResourceDocument } from './interfaces.projects.js'; /** * Reading helpers for a resource's attachment set. * * A resource may be attached to several subjects at once and every attached subject may use it. * Concurrent use is serialized by the attachment revision each caller observed and by browser view * ownership, not prevented: a second chat attaching does not take the resource away from the * first. Every gate therefore asks "does the set contain an entry matching my subject", which is * exactly as strong per subject as the single-slot equality it replaces. */ export declare const resourceAttachmentEntryKey: (entryArg: IControllerResourceAttachmentEntryDocument) => string; export declare const cloneResourceAttachmentEntry: (entryArg: IControllerResourceAttachmentEntryDocument) => IControllerResourceAttachmentEntryDocument; export declare const isSessionAttachmentEntry: (entryArg: IControllerResourceAttachmentEntryDocument) => entryArg is IControllerResourceAttachmentEntryDocument & { id: TControllerSessionId; }; export declare const resourceSessionEntries: (resourceArg: Pick) => Array; export declare const resourceTerminalEntries: (resourceArg: Pick) => IControllerResourceAttachmentEntryDocument[]; export declare const isResourceAttached: (resourceArg: Pick) => boolean; /** The entry for one conversation, ignoring its exact identity. */ export declare const findSessionAttachment: (resourceArg: Pick, sessionIdArg: TControllerSessionId) => (IControllerResourceAttachmentEntryDocument & { id: TControllerSessionId; }) | undefined; /** The entry for one conversation at its exact managed identity, which is what the gates need. */ export declare const hasExactSessionAttachment: (resourceArg: Pick, sessionIdArg: TControllerSessionId, sessionIdentityIdArg: string | undefined) => boolean; /** The entry for one terminal conversation: the terminal *and* the conversation must match. */ export declare const hasExactTerminalAttachment: (resourceArg: Pick, resourceIdArg: string, agentSessionIdArg: string | undefined) => boolean; /** * The conversations attached to a resource as BrowserRuntime names them, which is what its * attachment binding is built from and what every acting identity is checked against. * * Every session entry is its own conversation. A terminal entry contributes the conversation that * *owns* the terminal — the coding agent's own chat, a `claude` session — and never the terminal * itself, which is a process rather than a conversation; a plain shell terminal names no * conversation and contributes nothing. The result is de-duplicated, because a conversation * attached both directly and through its own terminal, or through two of its terminals, is one * member and the runtime rejects a repeated member outright. */ export declare const resourceBrowserSessionIds: (resourceArg: Pick) => plugins.browserRuntime.TQualifiedBrowserSessionId[]; /** * Whether an acting conversation is a member of that set, asked against the exact projection the * runtime was given so a gate and the binding can never disagree. A `claude` acting id is a * terminal's own conversation and is therefore matched by the terminal entry carrying it. */ export declare const hasBrowserSessionMember: (resourceArg: Pick, sessionIdArg: plugins.browserRuntime.TQualifiedBrowserSessionId) => boolean; export declare const hasSessionAttachmentOfHarness: (resourceArg: Pick, harnessIdArg: TControllerSessionId["harnessId"]) => boolean; export declare const withoutResourceAttachment: (resourceArg: Pick, entryKeyArg: string) => IControllerResourceAttachmentEntryDocument[]; /** * Applies a committed attachment intent to a set. `add` is idempotent — re-attaching a subject * that is already present refreshes nothing and changes nothing — and `replace` removes and adds * in one step so a Move never leaves the resource momentarily unattached. */ export declare const applyResourceAttachmentIntent: (attachmentsArg: readonly IControllerResourceAttachmentEntryDocument[], pendingArg: { op: "add" | "remove" | "replace"; entry?: IControllerResourceAttachmentEntryDocument; replaces?: IControllerResourceAttachmentEntryDocument; }) => IControllerResourceAttachmentEntryDocument[];