@krischoichoi/channel-harness 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/lib/access/controller.d.ts +37 -0
- package/lib/access/controller.d.ts.map +1 -0
- package/lib/access/controller.js +51 -0
- package/lib/access/controller.js.map +1 -0
- package/lib/access/decision.d.ts +18 -0
- package/lib/access/decision.d.ts.map +1 -0
- package/lib/access/decision.js +2 -0
- package/lib/access/decision.js.map +1 -0
- package/lib/access/resolver.d.ts +41 -0
- package/lib/access/resolver.d.ts.map +1 -0
- package/lib/access/resolver.js +31 -0
- package/lib/access/resolver.js.map +1 -0
- package/lib/agent-manager.d.ts +314 -0
- package/lib/agent-manager.d.ts.map +1 -0
- package/lib/agent-manager.js +603 -0
- package/lib/agent-manager.js.map +1 -0
- package/lib/agent-router.d.ts +37 -0
- package/lib/agent-router.d.ts.map +1 -0
- package/lib/agent-router.js +33 -0
- package/lib/agent-router.js.map +1 -0
- package/lib/bind-support.d.ts +23 -0
- package/lib/bind-support.d.ts.map +1 -0
- package/lib/bind-support.js +63 -0
- package/lib/bind-support.js.map +1 -0
- package/lib/binding-store.d.ts +104 -0
- package/lib/binding-store.d.ts.map +1 -0
- package/lib/binding-store.js +354 -0
- package/lib/binding-store.js.map +1 -0
- package/lib/bridge.d.ts +248 -0
- package/lib/bridge.d.ts.map +1 -0
- package/lib/bridge.js +961 -0
- package/lib/bridge.js.map +1 -0
- package/lib/channel-label.d.ts +46 -0
- package/lib/channel-label.d.ts.map +1 -0
- package/lib/channel-label.js +89 -0
- package/lib/channel-label.js.map +1 -0
- package/lib/channel-session-factory.d.ts +76 -0
- package/lib/channel-session-factory.d.ts.map +1 -0
- package/lib/channel-session-factory.js +187 -0
- package/lib/channel-session-factory.js.map +1 -0
- package/lib/commands/bind.d.ts +21 -0
- package/lib/commands/bind.d.ts.map +1 -0
- package/lib/commands/bind.js +91 -0
- package/lib/commands/bind.js.map +1 -0
- package/lib/commands/help.d.ts +15 -0
- package/lib/commands/help.d.ts.map +1 -0
- package/lib/commands/help.js +89 -0
- package/lib/commands/help.js.map +1 -0
- package/lib/commands/index.d.ts +122 -0
- package/lib/commands/index.d.ts.map +1 -0
- package/lib/commands/index.js +63 -0
- package/lib/commands/index.js.map +1 -0
- package/lib/commands/locale.d.ts +9 -0
- package/lib/commands/locale.d.ts.map +1 -0
- package/lib/commands/locale.js +27 -0
- package/lib/commands/locale.js.map +1 -0
- package/lib/commands/mirror.d.ts +14 -0
- package/lib/commands/mirror.d.ts.map +1 -0
- package/lib/commands/mirror.js +44 -0
- package/lib/commands/mirror.js.map +1 -0
- package/lib/commands/model.d.ts +20 -0
- package/lib/commands/model.d.ts.map +1 -0
- package/lib/commands/model.js +106 -0
- package/lib/commands/model.js.map +1 -0
- package/lib/commands/models.d.ts +14 -0
- package/lib/commands/models.d.ts.map +1 -0
- package/lib/commands/models.js +67 -0
- package/lib/commands/models.js.map +1 -0
- package/lib/commands/new.d.ts +14 -0
- package/lib/commands/new.d.ts.map +1 -0
- package/lib/commands/new.js +37 -0
- package/lib/commands/new.js.map +1 -0
- package/lib/commands/status.d.ts +12 -0
- package/lib/commands/status.d.ts.map +1 -0
- package/lib/commands/status.js +30 -0
- package/lib/commands/status.js.map +1 -0
- package/lib/commands/stop.d.ts +16 -0
- package/lib/commands/stop.d.ts.map +1 -0
- package/lib/commands/stop.js +27 -0
- package/lib/commands/stop.js.map +1 -0
- package/lib/commands/version.d.ts +25 -0
- package/lib/commands/version.d.ts.map +1 -0
- package/lib/commands/version.js +57 -0
- package/lib/commands/version.js.map +1 -0
- package/lib/config.d.ts +119 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +60 -0
- package/lib/config.js.map +1 -0
- package/lib/debug-logger.d.ts +8 -0
- package/lib/debug-logger.d.ts.map +1 -0
- package/lib/debug-logger.js +32 -0
- package/lib/debug-logger.js.map +1 -0
- package/lib/dsh-home.d.ts +12 -0
- package/lib/dsh-home.d.ts.map +1 -0
- package/lib/dsh-home.js +31 -0
- package/lib/dsh-home.js.map +1 -0
- package/lib/failure-display.d.ts +10 -0
- package/lib/failure-display.d.ts.map +1 -0
- package/lib/failure-display.js +42 -0
- package/lib/failure-display.js.map +1 -0
- package/lib/file-provider.d.ts +96 -0
- package/lib/file-provider.d.ts.map +1 -0
- package/lib/file-provider.js +44 -0
- package/lib/file-provider.js.map +1 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +31 -0
- package/lib/index.js.map +1 -0
- package/lib/interactions/index.d.ts +13 -0
- package/lib/interactions/index.d.ts.map +1 -0
- package/lib/interactions/index.js +13 -0
- package/lib/interactions/index.js.map +1 -0
- package/lib/interactions/question-backend.d.ts +133 -0
- package/lib/interactions/question-backend.d.ts.map +1 -0
- package/lib/interactions/question-backend.js +37 -0
- package/lib/interactions/question-backend.js.map +1 -0
- package/lib/interactions/question-presenter.d.ts +68 -0
- package/lib/interactions/question-presenter.d.ts.map +1 -0
- package/lib/interactions/question-presenter.js +425 -0
- package/lib/interactions/question-presenter.js.map +1 -0
- package/lib/interactions/question-renderer.d.ts +37 -0
- package/lib/interactions/question-renderer.d.ts.map +1 -0
- package/lib/interactions/question-renderer.js +79 -0
- package/lib/interactions/question-renderer.js.map +1 -0
- package/lib/interactions/question-state.d.ts +106 -0
- package/lib/interactions/question-state.d.ts.map +1 -0
- package/lib/interactions/question-state.js +99 -0
- package/lib/interactions/question-state.js.map +1 -0
- package/lib/interactions/question-text-answer.d.ts +37 -0
- package/lib/interactions/question-text-answer.d.ts.map +1 -0
- package/lib/interactions/question-text-answer.js +70 -0
- package/lib/interactions/question-text-answer.js.map +1 -0
- package/lib/interactions/question-waterfall-backend.d.ts +42 -0
- package/lib/interactions/question-waterfall-backend.d.ts.map +1 -0
- package/lib/interactions/question-waterfall-backend.js +162 -0
- package/lib/interactions/question-waterfall-backend.js.map +1 -0
- package/lib/lifecycle.d.ts +36 -0
- package/lib/lifecycle.d.ts.map +1 -0
- package/lib/lifecycle.js +303 -0
- package/lib/lifecycle.js.map +1 -0
- package/lib/loggable-error.d.ts +10 -0
- package/lib/loggable-error.d.ts.map +1 -0
- package/lib/loggable-error.js +32 -0
- package/lib/loggable-error.js.map +1 -0
- package/lib/message-converter.d.ts +64 -0
- package/lib/message-converter.d.ts.map +1 -0
- package/lib/message-converter.js +191 -0
- package/lib/message-converter.js.map +1 -0
- package/lib/model-selection.d.ts +54 -0
- package/lib/model-selection.d.ts.map +1 -0
- package/lib/model-selection.js +116 -0
- package/lib/model-selection.js.map +1 -0
- package/lib/outbox/binding-resolver.d.ts +23 -0
- package/lib/outbox/binding-resolver.d.ts.map +1 -0
- package/lib/outbox/binding-resolver.js +38 -0
- package/lib/outbox/binding-resolver.js.map +1 -0
- package/lib/outbox/capabilities.d.ts +48 -0
- package/lib/outbox/capabilities.d.ts.map +1 -0
- package/lib/outbox/capabilities.js +35 -0
- package/lib/outbox/capabilities.js.map +1 -0
- package/lib/outbox/index.d.ts +14 -0
- package/lib/outbox/index.d.ts.map +1 -0
- package/lib/outbox/index.js +14 -0
- package/lib/outbox/index.js.map +1 -0
- package/lib/outbox/service.d.ts +48 -0
- package/lib/outbox/service.d.ts.map +1 -0
- package/lib/outbox/service.js +74 -0
- package/lib/outbox/service.js.map +1 -0
- package/lib/outbox/target.d.ts +17 -0
- package/lib/outbox/target.d.ts.map +1 -0
- package/lib/outbox/target.js +15 -0
- package/lib/outbox/target.js.map +1 -0
- package/lib/outbox/tool-send.d.ts +19 -0
- package/lib/outbox/tool-send.d.ts.map +1 -0
- package/lib/outbox/tool-send.js +77 -0
- package/lib/outbox/tool-send.js.map +1 -0
- package/lib/outbox/types.d.ts +42 -0
- package/lib/outbox/types.d.ts.map +1 -0
- package/lib/outbox/types.js +30 -0
- package/lib/outbox/types.js.map +1 -0
- package/lib/plugin.d.ts +27 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +47 -0
- package/lib/plugin.js.map +1 -0
- package/lib/reply-context-store.d.ts +69 -0
- package/lib/reply-context-store.d.ts.map +1 -0
- package/lib/reply-context-store.js +75 -0
- package/lib/reply-context-store.js.map +1 -0
- package/lib/reply-router.d.ts +138 -0
- package/lib/reply-router.d.ts.map +1 -0
- package/lib/reply-router.js +674 -0
- package/lib/reply-router.js.map +1 -0
- package/lib/session-router.d.ts +49 -0
- package/lib/session-router.d.ts.map +1 -0
- package/lib/session-router.js +45 -0
- package/lib/session-router.js.map +1 -0
- package/lib/workspace-resolver.d.ts +67 -0
- package/lib/workspace-resolver.d.ts.map +1 -0
- package/lib/workspace-resolver.js +102 -0
- package/lib/workspace-resolver.js.map +1 -0
- package/package.json +103 -0
package/lib/bridge.d.ts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { type Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { ChannelAdapter, ChannelLogger, ChannelEvent } from '@krischoichoi/channel-core';
|
|
4
|
+
import type { Config } from './config.js';
|
|
5
|
+
import type { SessionBindingStore } from './binding-store.js';
|
|
6
|
+
import type { AgentManager } from './agent-manager.js';
|
|
7
|
+
import type { AgentRouter } from './agent-router.js';
|
|
8
|
+
import type { ChannelWorkspaceResolver } from './workspace-resolver.js';
|
|
9
|
+
import { type SaveImageHook } from './message-converter.js';
|
|
10
|
+
import { type ChannelAttachmentProvider } from './file-provider.js';
|
|
11
|
+
import { ReplyContextStore } from './reply-context-store.js';
|
|
12
|
+
import type { ChannelOutboxService } from './outbox/service.js';
|
|
13
|
+
import { type ChannelCommandDependencies } from './commands/index.js';
|
|
14
|
+
import { ChannelModelSelectionController } from './model-selection.js';
|
|
15
|
+
import type { ChannelAccessPolicyResolver } from './access/resolver.js';
|
|
16
|
+
import type { ChannelQuestionPresenter } from './interactions/question-presenter.js';
|
|
17
|
+
export interface ChannelHarnessBridgeOptions {
|
|
18
|
+
config: Config;
|
|
19
|
+
bindingStore: SessionBindingStore;
|
|
20
|
+
agentManager: AgentManager;
|
|
21
|
+
agentRouter: AgentRouter;
|
|
22
|
+
getAdapter(channelId: string): ChannelAdapter | undefined;
|
|
23
|
+
replyContexts: ReplyContextStore;
|
|
24
|
+
logger: ChannelLogger;
|
|
25
|
+
/** Fail-closed Access Gate resolver. */
|
|
26
|
+
accessResolver: ChannelAccessPolicyResolver;
|
|
27
|
+
/**
|
|
28
|
+
* Namespaced logger for access decisions (namespace
|
|
29
|
+
* `channel-access`). Falls back to `logger` when not provided. Never logs
|
|
30
|
+
* message body / challenge codes / raw payload / tokens.
|
|
31
|
+
*/
|
|
32
|
+
accessLogger?: ChannelLogger;
|
|
33
|
+
/** Optional attachment-commit seam (WX5 real image path). */
|
|
34
|
+
saveImage?: SaveImageHook;
|
|
35
|
+
/** Optional generic-file extension. Absent keeps ordinary file placeholders. */
|
|
36
|
+
fileProvider?: ChannelAttachmentProvider;
|
|
37
|
+
/**
|
|
38
|
+
* The Cordis context on which the official `commands` registry is mounted.
|
|
39
|
+
* `ctx.commands.execute` is the official command dispatcher.
|
|
40
|
+
*/
|
|
41
|
+
ctx: Context;
|
|
42
|
+
/**
|
|
43
|
+
* Bridge hook the channel commands need (`startNewSession` + optional
|
|
44
|
+
* model-selection controller; absent -> the bridge owns a default instance).
|
|
45
|
+
*/
|
|
46
|
+
commandDeps: Omit<ChannelCommandDependencies, 'modelSelection' | 'listCommands' | 'findCommand' | 'locale' | 'llm' | 'versionInfo'> & {
|
|
47
|
+
modelSelection?: ChannelModelSelectionController;
|
|
48
|
+
listCommands?: ChannelCommandDependencies['listCommands'];
|
|
49
|
+
findCommand?: ChannelCommandDependencies['findCommand'];
|
|
50
|
+
locale?: ChannelCommandDependencies['locale'];
|
|
51
|
+
llm?: ChannelCommandDependencies['llm'];
|
|
52
|
+
versionInfo?: ChannelCommandDependencies['versionInfo'];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Resolves a channel conversation to a Session working directory and (when
|
|
56
|
+
* applicable) a Harness `WorkspaceRegistry` member.
|
|
57
|
+
*/
|
|
58
|
+
workspaceResolver: ChannelWorkspaceResolver;
|
|
59
|
+
/**
|
|
60
|
+
* Optional durable outbox. Presence enables the Model-facing
|
|
61
|
+
* `send_channel_message` tool. Absent -> no proactive send tool.
|
|
62
|
+
*/
|
|
63
|
+
outbox?: ChannelOutboxService;
|
|
64
|
+
/**
|
|
65
|
+
* Optional question interaction presenter (the channel composes an answerer
|
|
66
|
+
* on the official `user-questions/request` waterfall). Absent when the
|
|
67
|
+
* user-questions feature is disabled or the userQuestions service was not
|
|
68
|
+
* probed.
|
|
69
|
+
*/
|
|
70
|
+
questionPresenter?: ChannelQuestionPresenter;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Error historically raised when a Workspace attach failed inside fresh Session
|
|
74
|
+
* creation. Workspace attach is now non-fatal: the freshly-created session is
|
|
75
|
+
* kept (grouped as ungrouped) and the binding + followup continue, so the
|
|
76
|
+
* bridge no longer produces this error.
|
|
77
|
+
*
|
|
78
|
+
* @deprecated Workspace attachment failures are non-fatal and no longer raise
|
|
79
|
+
* this error. Retained as a public export for compatibility with existing
|
|
80
|
+
* imports; do not add new uses.
|
|
81
|
+
*/
|
|
82
|
+
export declare class ChannelWorkspaceAttachError extends Error {
|
|
83
|
+
readonly sessionId: string;
|
|
84
|
+
readonly workspaceId: string;
|
|
85
|
+
readonly cwd: string;
|
|
86
|
+
readonly channelId: string;
|
|
87
|
+
readonly accountId: string;
|
|
88
|
+
constructor(input: {
|
|
89
|
+
sessionId: string;
|
|
90
|
+
workspaceId: string;
|
|
91
|
+
cwd: string;
|
|
92
|
+
channelId: string;
|
|
93
|
+
accountId: string;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export declare class ChannelHarnessBridge {
|
|
97
|
+
private readonly options;
|
|
98
|
+
private readonly sessionFactory;
|
|
99
|
+
private readonly commandDisposers;
|
|
100
|
+
private readonly modelSelectionDisposers;
|
|
101
|
+
private commandSetupsDisposed;
|
|
102
|
+
/** Thin view over Harness's session/default model semantics. */
|
|
103
|
+
private readonly modelSelection;
|
|
104
|
+
/** Normalized command deps handed to every agent setup. */
|
|
105
|
+
private readonly commandDeps;
|
|
106
|
+
/** Per-conversation generation counters, invalidated by /stop (spec §6). */
|
|
107
|
+
private readonly conversationGenerations;
|
|
108
|
+
/** Pure fail-closed access decision engine. No I/O. */
|
|
109
|
+
private readonly accessController;
|
|
110
|
+
constructor(options: ChannelHarnessBridgeOptions);
|
|
111
|
+
/** Per-conversation promise chains; entries self-clean on settle. */
|
|
112
|
+
private readonly chains;
|
|
113
|
+
/**
|
|
114
|
+
* Per-conversation serialization. Each canonical key has an owning promise
|
|
115
|
+
* chain; `fn` is appended onto the previous entry for that key so it starts
|
|
116
|
+
* only after the prior one settles, while distinct keys run in parallel. The
|
|
117
|
+
* returned promise resolves only after THIS operation has been handled; the
|
|
118
|
+
* chain entry absorbs errors (logged, never rethrown) so ONE failing message
|
|
119
|
+
* never poisons the conversation chain, while this call still surfaces THIS
|
|
120
|
+
* operation's error to its await-er (preserving prior rejection semantics).
|
|
121
|
+
*/
|
|
122
|
+
private enqueueSelf;
|
|
123
|
+
/**
|
|
124
|
+
* Append work onto the per-conversation chain WITHOUT awaiting its
|
|
125
|
+
* completion (used by the /stop stop barrier — spec §9). The returned
|
|
126
|
+
* promise never rejects.
|
|
127
|
+
*/
|
|
128
|
+
private enqueueConversation;
|
|
129
|
+
handleChannelEvent(event: ChannelEvent): Promise<void>;
|
|
130
|
+
/** Apply the contract's only identity normalization before any side effect. */
|
|
131
|
+
private normalizeInboundIdentity;
|
|
132
|
+
private normalizeInteractionIdentity;
|
|
133
|
+
/** Interaction admission reuses Security Gate semantics; the click is activation. */
|
|
134
|
+
private enforceInteractionAccessGate;
|
|
135
|
+
private dropInteraction;
|
|
136
|
+
/**
|
|
137
|
+
* One-time Agent-scoped command and model-hook setup. Installed onto an
|
|
138
|
+
* Agent's scoped context by every create/resolve and by the Session
|
|
139
|
+
* factory's recreate (borrow + create) so a fresh, resumed OR recreated
|
|
140
|
+
* session gets the channel commands and channel hooks before any driving
|
|
141
|
+
* happens. Harness still resolves the Session model at creation/resume.
|
|
142
|
+
* Channel images are NOT rewritten here: the inbound converter hands raw
|
|
143
|
+
* images to the Harness Attachment Store and the official image
|
|
144
|
+
* pipeline owns model-capability projection (vision variant / text-only
|
|
145
|
+
* deterministic placeholder), so the Agent-scoped history keeps the
|
|
146
|
+
* original ImageBlock.
|
|
147
|
+
*/
|
|
148
|
+
private commandSetup;
|
|
149
|
+
/** Release this bridge's Agent-scoped command and model-hook registrations. */
|
|
150
|
+
disposeCommandSetups(): Promise<void>;
|
|
151
|
+
private conversationKey;
|
|
152
|
+
/** Conversation identity of an inbound event, as a bindable SessionKeyInput. */
|
|
153
|
+
private conversationInput;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the durable session behind an existing binding is MISSING — the
|
|
156
|
+
* stale condition behind both the EXPLICIT stale-binding repair (/new) and
|
|
157
|
+
* the loud SessionNotFoundError for every other request. A live agent is
|
|
158
|
+
* never stale (live-first: no persistence probe), and without a mounted
|
|
159
|
+
* sessionPersistence there is no durable identity to lose (ephemeral
|
|
160
|
+
* deployments recreate instead). One ATOMIC probe decides all three cases
|
|
161
|
+
* (live capability resolved once — no canResume/exists TOCTOU across a
|
|
162
|
+
* persistence HMR).
|
|
163
|
+
*/
|
|
164
|
+
private isDurableSessionMissing;
|
|
165
|
+
/** Bindings without the field predate the stable policy; fail closed. */
|
|
166
|
+
private bindingDurability;
|
|
167
|
+
/**
|
|
168
|
+
* FAIL-CLOSED Access Gate. Returns the validated policy only when the
|
|
169
|
+
* message is admitted. `undefined` means DROP with NO side effect (agent /
|
|
170
|
+
* command / session / binding / workspace / generation / /stop fast path).
|
|
171
|
+
*
|
|
172
|
+
* Order:
|
|
173
|
+
* 1. Reserved claim suppression (/dsh-claim never reaches anything).
|
|
174
|
+
* 2. Identity validation: sender + conversation ids.
|
|
175
|
+
* 3. Resolve policy (missing/invalid -> drop, fail closed).
|
|
176
|
+
* 4. Authorize (security gate) + activate (activation gate).
|
|
177
|
+
*
|
|
178
|
+
* Logging follows the `channel-access` logger convention: minimal fields
|
|
179
|
+
* (channel / account / conversationType / reason), never message body,
|
|
180
|
+
* challenge code, raw payload or tokens.
|
|
181
|
+
*/
|
|
182
|
+
private enforceAccessGate;
|
|
183
|
+
/** Log a fail-closed inbound drop with minimal plan-§42 fields. */
|
|
184
|
+
private dropInbound;
|
|
185
|
+
/**
|
|
186
|
+
* Queued (serialized) message handling for one conversation. Captures the
|
|
187
|
+
* generation at ENQUEUE time; /stop bumps it, so this callback drops out at
|
|
188
|
+
* either generation check and can never re-wake a stopped agent (spec §7).
|
|
189
|
+
*/
|
|
190
|
+
private handleQueuedMessage;
|
|
191
|
+
/**
|
|
192
|
+
* /stop FAST PATH (spec §4–§10). Runs OUTSIDE the serial chain:
|
|
193
|
+
* ① bump the generation FIRST (synchronous, before any await) so every
|
|
194
|
+
* queued/stale message on this conversation is invalidated;
|
|
195
|
+
* ② cancel the live agent — preferably by executing the registered /stop
|
|
196
|
+
* command (lifecycle recorded, behavior owned by the handler), with a
|
|
197
|
+
* direct `agent.cancel({ kind: 'user' })` fallback;
|
|
198
|
+
* ③ acknowledge immediately (never wait for `whenIdle`);
|
|
199
|
+
* ④ enqueue a fire-and-forget STOP BARRIER that, after prior chain work
|
|
200
|
+
* converges, re-cancels the LATEST binding's agent (covers the /new race,
|
|
201
|
+
* spec §9).
|
|
202
|
+
*/
|
|
203
|
+
private handleImmediateStop;
|
|
204
|
+
/** Generation helpers (spec §6). */
|
|
205
|
+
private generationOf;
|
|
206
|
+
private bumpGeneration;
|
|
207
|
+
private isGenerationCurrent;
|
|
208
|
+
/**
|
|
209
|
+
* Build the converter's per-message image hook: the official Harness
|
|
210
|
+
* attachment seam stays the sole authority for the durable image ref, and
|
|
211
|
+
* — best-effort — the same bytes are MIRRORED into the private channel
|
|
212
|
+
* asset store under the harness attachment id (the model-visible
|
|
213
|
+
* `sha256:…`), so `send_channel_message` can resolve the image for
|
|
214
|
+
* outbound sends (issue #7). A mirror failure never breaks delivery: the
|
|
215
|
+
* ref is already committed and the converter falls back exactly as before.
|
|
216
|
+
*/
|
|
217
|
+
private saveImageHook;
|
|
218
|
+
/**
|
|
219
|
+
* Build the converter's optional file/audio/video store hook. Absent
|
|
220
|
+
* `fileProvider` -> no hook -> the converter keeps `[file: name]`
|
|
221
|
+
* placeholders (unchanged fallback). The hook binds the current binding's
|
|
222
|
+
* session + event identity so a stored asset is correctly session-ACL'd.
|
|
223
|
+
*/
|
|
224
|
+
private fileStoreHook;
|
|
225
|
+
/** Log the adapter-to-asset-store boundary once for every binary inbound part. */
|
|
226
|
+
private logInboundBinaryAvailability;
|
|
227
|
+
private attachmentLogFields;
|
|
228
|
+
/**
|
|
229
|
+
* The `commandDeps.startNewSession` implementation. Resolves the
|
|
230
|
+
* conversation from the CURRENT binding of the invoking agent (the session id
|
|
231
|
+
* IS the agent id), then asks the Session factory to mint a NEW session id
|
|
232
|
+
* (never a copy of the old one). The factory also attaches the new session to
|
|
233
|
+
* the same channel Workspace and registers its binding. The OLD agent is NOT
|
|
234
|
+
* disposed here; the bridge's post-command retire handles that. If the
|
|
235
|
+
* factory throws, the old binding stays untouched.
|
|
236
|
+
*/
|
|
237
|
+
startNewSession(agent: Agent): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Deliver a command-plane notice directly through the channel adapter — never
|
|
240
|
+
* through ReplyRouter and never as an assistant/model message.
|
|
241
|
+
*/
|
|
242
|
+
private sendCommandNotice;
|
|
243
|
+
/** Render a settled CommandResult to the channel (success/error text). */
|
|
244
|
+
private renderCommandResult;
|
|
245
|
+
/** Build the outbound ChannelTarget from the inbound conversation + message. */
|
|
246
|
+
private targetForEvent;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brid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