@fabric-harness/sdk 6.1.0 → 6.3.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/NOTICE +1 -1
- package/README.md +9 -9
- package/connector-spec/channel.md +2 -2
- package/connector-spec/sandbox.md +1 -1
- package/connector-spec/tooling.md +1 -1
- package/connector-spec/voice-telephony.md +1 -1
- package/dist/action.d.ts +2 -2
- package/dist/action.js +1 -1
- package/dist/agent-route.d.ts +76 -0
- package/dist/agent-route.d.ts.map +1 -0
- package/dist/agent-route.js +78 -0
- package/dist/agent-route.js.map +1 -0
- package/dist/agent-router.d.ts +128 -0
- package/dist/agent-router.d.ts.map +1 -0
- package/dist/agent-router.js +193 -0
- package/dist/agent-router.js.map +1 -0
- package/dist/ai-gateway.d.ts +1 -1
- package/dist/ai-gateway.js +1 -1
- package/dist/attachment-store.d.ts +3 -3
- package/dist/attachment-store.js +2 -2
- package/dist/channel.d.ts +3 -3
- package/dist/channel.js +2 -2
- package/dist/conversation-projection.d.ts +2 -2
- package/dist/conversation-projection.js +2 -2
- package/dist/conversation-stream.d.ts +5 -5
- package/dist/conversation-stream.js +1 -1
- package/dist/cost-budget.d.ts +3 -3
- package/dist/cost-budget.js +1 -1
- package/dist/delivered-message.d.ts +3 -3
- package/dist/error.js +2 -2
- package/dist/error.js.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.js +1 -1
- package/dist/filesystem-source.d.ts +3 -3
- package/dist/filesystem-source.js +1 -1
- package/dist/governed-voice.d.ts +55 -0
- package/dist/governed-voice.d.ts.map +1 -0
- package/dist/governed-voice.js +357 -0
- package/dist/governed-voice.js.map +1 -0
- package/dist/history.d.ts +3 -3
- package/dist/history.js +3 -3
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/langfuse.d.ts +2 -2
- package/dist/local-confinement.d.ts +31 -0
- package/dist/local-confinement.d.ts.map +1 -0
- package/dist/local-confinement.js +297 -0
- package/dist/local-confinement.js.map +1 -0
- package/dist/loop.d.ts +10 -0
- package/dist/loop.d.ts.map +1 -1
- package/dist/loop.js.map +1 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +2 -0
- package/dist/mcp.js.map +1 -1
- package/dist/model-pricing.d.ts +7 -4
- package/dist/model-pricing.d.ts.map +1 -1
- package/dist/model-pricing.js +8 -7
- package/dist/model-pricing.js.map +1 -1
- package/dist/model.d.ts +44 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +123 -13
- package/dist/model.js.map +1 -1
- package/dist/persistent-agent.d.ts +1 -1
- package/dist/pi-loop-runtime.d.ts.map +1 -1
- package/dist/pi-loop-runtime.js +2 -6
- package/dist/pi-loop-runtime.js.map +1 -1
- package/dist/policied-sandbox.js +5 -5
- package/dist/policied-sandbox.js.map +1 -1
- package/dist/policy.d.ts +1 -1
- package/dist/rate-limiter.d.ts +2 -2
- package/dist/rate-limiter.js +2 -2
- package/dist/retrieval.d.ts +1 -1
- package/dist/sandbox-ref.d.ts +2 -2
- package/dist/sandbox-ref.d.ts.map +1 -1
- package/dist/sandbox-ref.js +9 -6
- package/dist/sandbox-ref.js.map +1 -1
- package/dist/sandbox.d.ts +10 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +28 -12
- package/dist/sandbox.js.map +1 -1
- package/dist/session-memory.d.ts +4 -3
- package/dist/session-memory.d.ts.map +1 -1
- package/dist/session-memory.js +4 -3
- package/dist/session-memory.js.map +1 -1
- package/dist/session.d.ts +19 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +76 -6
- package/dist/session.js.map +1 -1
- package/dist/skill-definition.d.ts +40 -0
- package/dist/skill-definition.d.ts.map +1 -0
- package/dist/skill-definition.js +37 -0
- package/dist/skill-definition.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/strict.d.ts +12 -3
- package/dist/strict.d.ts.map +1 -1
- package/dist/strict.js +6 -1
- package/dist/strict.js.map +1 -1
- package/dist/submission-runner.d.ts +1 -1
- package/dist/submission-runner.d.ts.map +1 -1
- package/dist/submission-runner.js +15 -1
- package/dist/submission-runner.js.map +1 -1
- package/dist/submission-state.d.ts +3 -3
- package/dist/submission-state.js +3 -3
- package/dist/submission-store.d.ts +4 -4
- package/dist/submission-store.js +2 -2
- package/dist/suspending-sandbox.js +3 -3
- package/dist/suspending-sandbox.js.map +1 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/testing.js.map +1 -1
- package/dist/tool-execution.d.ts +11 -0
- package/dist/tool-execution.d.ts.map +1 -0
- package/dist/tool-execution.js +36 -0
- package/dist/tool-execution.js.map +1 -0
- package/dist/tools.d.ts +6 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +5 -0
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/vercel-ai-gateway.d.ts +4 -4
- package/dist/vercel-ai-gateway.js +4 -4
- package/dist/voice-openai-realtime.d.ts +2 -2
- package/dist/voice-openai-realtime.d.ts.map +1 -1
- package/dist/voice-openai-realtime.js +48 -41
- package/dist/voice-openai-realtime.js.map +1 -1
- package/dist/voice-pipeline.d.ts +3 -0
- package/dist/voice-pipeline.d.ts.map +1 -1
- package/dist/voice-pipeline.js +71 -23
- package/dist/voice-pipeline.js.map +1 -1
- package/dist/voice-stt-cartesia.d.ts +1 -0
- package/dist/voice-stt-cartesia.d.ts.map +1 -1
- package/dist/voice-stt-cartesia.js +8 -1
- package/dist/voice-stt-cartesia.js.map +1 -1
- package/dist/voice-stt-deepgram.d.ts +1 -0
- package/dist/voice-stt-deepgram.d.ts.map +1 -1
- package/dist/voice-stt-deepgram.js +8 -1
- package/dist/voice-stt-deepgram.js.map +1 -1
- package/dist/voice-stt.d.ts +2 -0
- package/dist/voice-stt.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.d.ts +1 -0
- package/dist/voice-tts-cartesia.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.js +2 -1
- package/dist/voice-tts-cartesia.js.map +1 -1
- package/dist/voice-tts-elevenlabs.d.ts +1 -0
- package/dist/voice-tts-elevenlabs.d.ts.map +1 -1
- package/dist/voice-tts-elevenlabs.js +4 -1
- package/dist/voice-tts-elevenlabs.js.map +1 -1
- package/dist/voice-tts.d.ts +2 -0
- package/dist/voice-tts.d.ts.map +1 -1
- package/dist/voice-ws-client.d.ts +6 -4
- package/dist/voice-ws-client.d.ts.map +1 -1
- package/dist/voice-ws-client.js +11 -6
- package/dist/voice-ws-client.js.map +1 -1
- package/dist/voice-ws-shared.d.ts +10 -3
- package/dist/voice-ws-shared.d.ts.map +1 -1
- package/dist/voice-ws-shared.js +45 -9
- package/dist/voice-ws-shared.js.map +1 -1
- package/dist/voice.d.ts +6 -7
- package/dist/voice.d.ts.map +1 -1
- package/dist/webhook-subscription.d.ts +1 -1
- package/dist/ws-client.d.ts +1 -1
- package/package.json +14 -4
- package/types/markdown.d.ts +35 -0
package/dist/session.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GovernedVoiceOptions, type GovernedVoiceSession } from "./governed-voice.js";
|
|
1
2
|
import type { SandboxEnv } from "./sandbox.js";
|
|
2
3
|
import type { FabricFs } from "./filesystem.js";
|
|
3
4
|
import type { SandboxRef, SerializedSandboxRef } from "./sandbox-ref.js";
|
|
@@ -12,6 +13,7 @@ import type { ApprovalCallback, ArtifactCreateOptions, ArtifactRef, CheckpointCr
|
|
|
12
13
|
export declare function generateAffinityKey(agentId: string, sessionId: string): string;
|
|
13
14
|
export declare function isValidAffinityKey(key: string): boolean;
|
|
14
15
|
export interface FabricSession {
|
|
16
|
+
voice(options: GovernedVoiceOptions): Promise<GovernedVoiceSession>;
|
|
15
17
|
readonly id: string;
|
|
16
18
|
readonly agent: FabricAgent;
|
|
17
19
|
readonly sandbox: Promise<SandboxEnv>;
|
|
@@ -181,8 +183,10 @@ export declare class StubFabricSession implements FabricSession {
|
|
|
181
183
|
private ownedSandboxRefId;
|
|
182
184
|
private readonly costBudget;
|
|
183
185
|
private readonly skillCache;
|
|
186
|
+
private effectivePackagedSkillsCache;
|
|
184
187
|
constructor(agent: FabricAgent, id: string, options?: SessionOptions);
|
|
185
188
|
private getDurableRuntime;
|
|
189
|
+
voice(options: GovernedVoiceOptions): Promise<GovernedVoiceSession>;
|
|
186
190
|
prompt<TResult = string>(text: string, promptOptions?: PromptOptions<TResult>): Promise<TResult>;
|
|
187
191
|
stream<TResult = string>(text: string, options?: PromptOptions<TResult>): AsyncGenerator<FabricEvent, TResult, void>;
|
|
188
192
|
skill<TResult = string>(name: string, options?: SkillOptions<TResult>): Promise<TResult>;
|
|
@@ -222,6 +226,21 @@ export declare class StubFabricSession implements FabricSession {
|
|
|
222
226
|
private clampBashToolInput;
|
|
223
227
|
private resolveTools;
|
|
224
228
|
private activateSkillForTool;
|
|
229
|
+
/**
|
|
230
|
+
* Packaged directories the `read` tool can serve.
|
|
231
|
+
*
|
|
232
|
+
* A skill carrying `packaged` advertises its files to the model at
|
|
233
|
+
* activation time (see `formatPackagedSkillResourceList`). Those paths are
|
|
234
|
+
* only readable if the directory is also registered here, so registered
|
|
235
|
+
* skills contribute their own directories on top of the explicit
|
|
236
|
+
* `packagedSkills` option. Without this, an imported or `defineSkill()`
|
|
237
|
+
* skill would advertise resources that every `read` call reports missing.
|
|
238
|
+
*
|
|
239
|
+
* The explicit option wins on `id` collision: it is the caller's deliberate
|
|
240
|
+
* registration, and silently shadowing it with a skill-carried directory
|
|
241
|
+
* would change which bytes a known path returns.
|
|
242
|
+
*/
|
|
243
|
+
private effectivePackagedSkills;
|
|
225
244
|
private resolveSkill;
|
|
226
245
|
private resolveRole;
|
|
227
246
|
private memoryFallback;
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,KAAK,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAiC9G,OAAO,KAAK,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAW/D,OAAO,KAAK,EACV,gBAAgB,EAGhB,qBAAqB,EACrB,WAAW,EAEX,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAEhB,WAAW,EAEX,WAAW,EAGX,aAAa,EAGb,WAAW,EACX,YAAY,EAGZ,cAAc,EAEd,YAAY,EACZ,WAAW,EACX,eAAe,EAEf,YAAY,EACZ,WAAW,EACZ,MAAM,YAAY,CAAC;AAiCpB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQ9E;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEvD;AAoBD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;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c,EAAE,MAAM,CAAA;CAAE,GAC9C,qBAAqB,GAAG,SAAS,CAwBnC"}
|
package/dist/session.js
CHANGED
|
@@ -3,6 +3,8 @@ import { CostBudgetTracker } from "./cost-budget.js";
|
|
|
3
3
|
import { inMemorySessionMemory } from "./session-memory.js";
|
|
4
4
|
import { FabricError } from "./error.js";
|
|
5
5
|
import { abandonToolOnAbort } from "./abort.js";
|
|
6
|
+
import { executeTool } from "./tool-execution.js";
|
|
7
|
+
import { openGovernedVoice } from "./governed-voice.js";
|
|
6
8
|
import { dynamicStateEntriesForTool, unwrapDynamicToolResult } from "./dynamic-agent.js";
|
|
7
9
|
import { approvalGrantFromJson, approvalGrantFromState, approvalGrantToJson, approvalInputDigest, createApprovalGrant, sameApprovalOperation, } from "./approval.js";
|
|
8
10
|
import { SessionHistory, buildModelMessagesFromHistory, findTrailingDanglingToolCalls, findTrailingUnfinishedTasks, } from "./history.js";
|
|
@@ -114,6 +116,7 @@ export class StubFabricSession {
|
|
|
114
116
|
ownedSandboxRefId;
|
|
115
117
|
costBudget;
|
|
116
118
|
skillCache = new Map();
|
|
119
|
+
effectivePackagedSkillsCache = null;
|
|
117
120
|
constructor(agent, id, options = {}) {
|
|
118
121
|
this.agent = agent;
|
|
119
122
|
this.id = id;
|
|
@@ -134,6 +137,30 @@ export class StubFabricSession {
|
|
|
134
137
|
this.durableRuntime = Promise.resolve(factory({ sessionId: this.id, ...(this.agent.id ? { agentId: this.agent.id } : {}) }));
|
|
135
138
|
return this.durableRuntime;
|
|
136
139
|
}
|
|
140
|
+
async voice(options) {
|
|
141
|
+
if (this.options.sessionRuntime)
|
|
142
|
+
throw new Error('Open voice in an activity or server runtime, not a durable workflow');
|
|
143
|
+
await this.ensureData();
|
|
144
|
+
const sandbox = await this.sandbox;
|
|
145
|
+
return openGovernedVoice(options, {
|
|
146
|
+
sessionId: this.id,
|
|
147
|
+
tenantId: this.options.tenantId ?? '',
|
|
148
|
+
actorId: this.options.actor?.principal?.id ?? '',
|
|
149
|
+
store: this.store,
|
|
150
|
+
execute: async (call, tools, signal) => {
|
|
151
|
+
const result = await this.executeToolCalls([call], new Map(tools.map(tool => [tool.name, tool])), sandbox, undefined, this.options.approvalTimeoutMs, this.options.onApproval, undefined, signal, async (name, output) => {
|
|
152
|
+
const safe = await options.prepareToolOutput(name, output);
|
|
153
|
+
const json = JSON.stringify(safe ?? null);
|
|
154
|
+
if (json.length > 65_536)
|
|
155
|
+
throw new Error('Voice tool output too large');
|
|
156
|
+
return JSON.parse(json);
|
|
157
|
+
});
|
|
158
|
+
if (!result[0])
|
|
159
|
+
throw new Error('Voice tool did not settle');
|
|
160
|
+
return result[0];
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
137
164
|
async prompt(text, promptOptions = {}) {
|
|
138
165
|
const ambientSignal = promptOptions.signal === undefined ? currentSubmissionContext()?.signal : undefined;
|
|
139
166
|
const options = ambientSignal
|
|
@@ -371,6 +398,9 @@ export class StubFabricSession {
|
|
|
371
398
|
? { affinityKey: sessionData.affinityKey }
|
|
372
399
|
: {}),
|
|
373
400
|
text,
|
|
401
|
+
...(options.submission?.message !== undefined
|
|
402
|
+
? { delivery: options.submission.message }
|
|
403
|
+
: {}),
|
|
374
404
|
messages,
|
|
375
405
|
tools,
|
|
376
406
|
sandbox,
|
|
@@ -1374,7 +1404,7 @@ export class StubFabricSession {
|
|
|
1374
1404
|
const scoped = createScopedSandboxEnv(env, this.options.cwd);
|
|
1375
1405
|
return wrapWithPolicy(scoped, this.options.policy, this.options.bypassPolicyEnforcement);
|
|
1376
1406
|
}
|
|
1377
|
-
async executeToolCalls(calls, tools, sandbox, callPolicy, approvalTimeoutMs, approvalHandler, attribution, signal) {
|
|
1407
|
+
async executeToolCalls(calls, tools, sandbox, callPolicy, approvalTimeoutMs, approvalHandler, attribution, signal, prepareOutput) {
|
|
1378
1408
|
const results = [];
|
|
1379
1409
|
const policy = callPolicy ?? this.options.policy;
|
|
1380
1410
|
for (const call of calls) {
|
|
@@ -1554,7 +1584,7 @@ export class StubFabricSession {
|
|
|
1554
1584
|
const input = call.tool === "bash" ? this.clampBashToolInput(call.input, policy) : call.input;
|
|
1555
1585
|
const startedAt = Date.now();
|
|
1556
1586
|
const submission = currentSubmissionContext();
|
|
1557
|
-
const execute = () => Promise.resolve(tool
|
|
1587
|
+
const execute = () => Promise.resolve(executeTool(tool, input, {
|
|
1558
1588
|
sandbox,
|
|
1559
1589
|
toolCallId,
|
|
1560
1590
|
...(signal ? { signal } : {}),
|
|
@@ -1579,7 +1609,12 @@ export class StubFabricSession {
|
|
|
1579
1609
|
const rawOutput = await abandonToolOnAbort(approvedSandboxCalls.reduceRight((next, approvedCall) => () => runWithSandboxPolicyApproval(sandbox, approvedCall, next), execute), signal);
|
|
1580
1610
|
const dynamicOutput = unwrapDynamicToolResult(rawOutput);
|
|
1581
1611
|
const hookOutput = unwrapHookToolRunResult(dynamicOutput.output);
|
|
1582
|
-
|
|
1612
|
+
if (prepareOutput && dynamicOutput.stateWrites.length) {
|
|
1613
|
+
throw new Error('Voice tools must commit domain state through governed application actions');
|
|
1614
|
+
}
|
|
1615
|
+
const output = prepareOutput
|
|
1616
|
+
? await abandonToolOnAbort(() => prepareOutput(call.tool, hookOutput.output), signal)
|
|
1617
|
+
: hookOutput.output;
|
|
1583
1618
|
const durationMs = Date.now() - startedAt;
|
|
1584
1619
|
await this.recordToolResult({
|
|
1585
1620
|
tool: call.tool,
|
|
@@ -1603,7 +1638,7 @@ export class StubFabricSession {
|
|
|
1603
1638
|
});
|
|
1604
1639
|
}
|
|
1605
1640
|
catch (error) {
|
|
1606
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1641
|
+
const message = prepareOutput ? 'Voice tool rejected or failed' : error instanceof Error ? error.message : String(error);
|
|
1607
1642
|
results.push({
|
|
1608
1643
|
tool: call.tool,
|
|
1609
1644
|
input: call.input,
|
|
@@ -1820,7 +1855,7 @@ export class StubFabricSession {
|
|
|
1820
1855
|
const commandToolOptions = this.options.resolveSecret
|
|
1821
1856
|
? { resolveSecret: this.options.resolveSecret }
|
|
1822
1857
|
: {};
|
|
1823
|
-
for (const tool of createBuiltinTools(sandbox, this.
|
|
1858
|
+
for (const tool of createBuiltinTools(sandbox, this.effectivePackagedSkills()))
|
|
1824
1859
|
tools.set(tool.name, tool);
|
|
1825
1860
|
for (const tool of createCommandTools(this.options.commands ?? [], commandToolOptions))
|
|
1826
1861
|
tools.set(tool.name, tool);
|
|
@@ -1864,6 +1899,41 @@ export class StubFabricSession {
|
|
|
1864
1899
|
this.skillCache.set(name, content);
|
|
1865
1900
|
return content;
|
|
1866
1901
|
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Packaged directories the `read` tool can serve.
|
|
1904
|
+
*
|
|
1905
|
+
* A skill carrying `packaged` advertises its files to the model at
|
|
1906
|
+
* activation time (see `formatPackagedSkillResourceList`). Those paths are
|
|
1907
|
+
* only readable if the directory is also registered here, so registered
|
|
1908
|
+
* skills contribute their own directories on top of the explicit
|
|
1909
|
+
* `packagedSkills` option. Without this, an imported or `defineSkill()`
|
|
1910
|
+
* skill would advertise resources that every `read` call reports missing.
|
|
1911
|
+
*
|
|
1912
|
+
* The explicit option wins on `id` collision: it is the caller's deliberate
|
|
1913
|
+
* registration, and silently shadowing it with a skill-carried directory
|
|
1914
|
+
* would change which bytes a known path returns.
|
|
1915
|
+
*/
|
|
1916
|
+
effectivePackagedSkills() {
|
|
1917
|
+
if (this.effectivePackagedSkillsCache !== null) {
|
|
1918
|
+
return this.effectivePackagedSkillsCache;
|
|
1919
|
+
}
|
|
1920
|
+
const explicit = this.options.packagedSkills;
|
|
1921
|
+
const carried = (this.options.skills ?? []).flatMap((skill) => skill.packaged ? [skill.packaged] : []);
|
|
1922
|
+
if (carried.length === 0) {
|
|
1923
|
+
this.effectivePackagedSkillsCache = explicit;
|
|
1924
|
+
return explicit;
|
|
1925
|
+
}
|
|
1926
|
+
const merged = { ...(explicit ?? {}) };
|
|
1927
|
+
const claimed = new Set(Object.values(merged).map((directory) => directory.id));
|
|
1928
|
+
for (const directory of carried) {
|
|
1929
|
+
if (claimed.has(directory.id))
|
|
1930
|
+
continue;
|
|
1931
|
+
claimed.add(directory.id);
|
|
1932
|
+
merged[directory.id] = directory;
|
|
1933
|
+
}
|
|
1934
|
+
this.effectivePackagedSkillsCache = merged;
|
|
1935
|
+
return merged;
|
|
1936
|
+
}
|
|
1867
1937
|
resolveSkill(name) {
|
|
1868
1938
|
const normalized = normalizeSkillReference(name);
|
|
1869
1939
|
return this.options.skills?.find((skill) => {
|
|
@@ -1968,7 +2038,7 @@ export class StubFabricSession {
|
|
|
1968
2038
|
try {
|
|
1969
2039
|
const authorization = await this.authorizeRecoveredToolCall(call, toolName, tool, toolCallId);
|
|
1970
2040
|
const submission = currentSubmissionContext();
|
|
1971
|
-
const execute = () => Promise.resolve(tool
|
|
2041
|
+
const execute = () => Promise.resolve(executeTool(tool, call.data?.input, {
|
|
1972
2042
|
sandbox,
|
|
1973
2043
|
toolCallId,
|
|
1974
2044
|
...(signal ? { signal } : {}),
|