@sixb/agent 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +31 -2
- package/dist/abort.d.ts +6 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/agent-prompt.d.ts +126 -0
- package/dist/agent-prompt.d.ts.map +1 -0
- package/dist/agent-runtime/errors.d.ts +13 -0
- package/dist/agent-runtime/errors.d.ts.map +1 -0
- package/dist/agent-runtime/preflight.d.ts +18 -0
- package/dist/agent-runtime/preflight.d.ts.map +1 -0
- package/dist/agent-runtime/profile.d.ts +14 -0
- package/dist/agent-runtime/profile.d.ts.map +1 -0
- package/dist/artifacts/layout-check/layout-check.d.ts +87 -0
- package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -0
- package/dist/artifacts/materialize.d.ts +115 -0
- package/dist/artifacts/materialize.d.ts.map +1 -0
- package/dist/artifacts/publish-tool.d.ts +86 -0
- package/dist/artifacts/publish-tool.d.ts.map +1 -0
- package/dist/ask-parent-tool.d.ts +36 -0
- package/dist/ask-parent-tool.d.ts.map +1 -0
- package/dist/attachments.d.ts +109 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/child-files.d.ts +91 -0
- package/dist/child-files.d.ts.map +1 -0
- package/dist/child-questions.d.ts +24 -0
- package/dist/child-questions.d.ts.map +1 -0
- package/dist/computer-runner.d.ts +74 -0
- package/dist/computer-runner.d.ts.map +1 -0
- package/dist/context-budget.d.ts +34 -0
- package/dist/context-budget.d.ts.map +1 -0
- package/dist/context-compaction.d.ts +148 -0
- package/dist/context-compaction.d.ts.map +1 -0
- package/dist/context-guard.d.ts +69 -0
- package/dist/context-guard.d.ts.map +1 -0
- package/dist/conversation-memory.d.ts +21 -0
- package/dist/conversation-memory.d.ts.map +1 -0
- package/dist/conversation-messages.d.ts +33 -0
- package/dist/conversation-messages.d.ts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution-plan.d.ts +38 -0
- package/dist/execution-plan.d.ts.map +1 -0
- package/dist/failure.d.ts +14 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/family-mailbox.d.ts +60 -0
- package/dist/family-mailbox.d.ts.map +1 -0
- package/dist/file-ref.d.ts +6 -0
- package/dist/file-ref.d.ts.map +1 -0
- package/dist/image-attachments.d.ts +34 -0
- package/dist/image-attachments.d.ts.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14387 -0
- package/dist/index.js.map +72 -0
- package/dist/inline-images.d.ts +28 -0
- package/dist/inline-images.d.ts.map +1 -0
- package/dist/message-authors.d.ts +34 -0
- package/dist/message-authors.d.ts.map +1 -0
- package/dist/message-times.d.ts +9 -0
- package/dist/message-times.d.ts.map +1 -0
- package/dist/model-adapters.d.ts +59 -0
- package/dist/model-adapters.d.ts.map +1 -0
- package/dist/model-lines.d.ts +16 -0
- package/dist/model-lines.d.ts.map +1 -0
- package/dist/prompt-cache.d.ts +28 -0
- package/dist/prompt-cache.d.ts.map +1 -0
- package/dist/requester.d.ts +15 -0
- package/dist/requester.d.ts.map +1 -0
- package/dist/run-agent-turn.d.ts +93 -0
- package/dist/run-agent-turn.d.ts.map +1 -0
- package/dist/run-child.d.ts +77 -0
- package/dist/run-child.d.ts.map +1 -0
- package/dist/run-conversation-turn.d.ts +42 -0
- package/dist/run-conversation-turn.d.ts.map +1 -0
- package/dist/run-credential.d.ts +22 -0
- package/dist/run-credential.d.ts.map +1 -0
- package/dist/run-environment.d.ts +145 -0
- package/dist/run-environment.d.ts.map +1 -0
- package/dist/run-fate.d.ts +15 -0
- package/dist/run-fate.d.ts.map +1 -0
- package/dist/run-files-lock.d.ts +16 -0
- package/dist/run-files-lock.d.ts.map +1 -0
- package/dist/run-sandbox.d.ts +60 -0
- package/dist/run-sandbox.d.ts.map +1 -0
- package/dist/run-subagent.d.ts +65 -0
- package/dist/run-subagent.d.ts.map +1 -0
- package/dist/run-workflow-agent-node.d.ts +46 -0
- package/dist/run-workflow-agent-node.d.ts.map +1 -0
- package/dist/sandbox-api-context.d.ts +34 -0
- package/dist/sandbox-api-context.d.ts.map +1 -0
- package/dist/sandbox-file-registry.d.ts +9 -0
- package/dist/sandbox-file-registry.d.ts.map +1 -0
- package/dist/sandbox-files.d.ts +71 -0
- package/dist/sandbox-files.d.ts.map +1 -0
- package/dist/sandbox-handle.d.ts +15 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-readiness.d.ts +8 -0
- package/dist/sandbox-readiness.d.ts.map +1 -0
- package/dist/skills/built-in.d.ts +15 -0
- package/dist/skills/built-in.d.ts.map +1 -0
- package/dist/subagent-context.d.ts +50 -0
- package/dist/subagent-context.d.ts.map +1 -0
- package/dist/subagent-continuation.d.ts +33 -0
- package/dist/subagent-continuation.d.ts.map +1 -0
- package/dist/subagent-inbox.d.ts +53 -0
- package/dist/subagent-inbox.d.ts.map +1 -0
- package/dist/subagent-tools.d.ts +293 -0
- package/dist/subagent-tools.d.ts.map +1 -0
- package/dist/thread-context.d.ts +17 -0
- package/dist/thread-context.d.ts.map +1 -0
- package/dist/tools/attachments.d.ts +11 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/bash.d.ts +68 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/model-spec.d.ts +9 -0
- package/dist/tools/model-spec.d.ts.map +1 -0
- package/dist/tools/read.d.ts +43 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/result-media.d.ts +65 -0
- package/dist/tools/result-media.d.ts.map +1 -0
- package/dist/tools/result-output.d.ts +18 -0
- package/dist/tools/result-output.d.ts.map +1 -0
- package/dist/tools/tool-files.d.ts +59 -0
- package/dist/tools/tool-files.d.ts.map +1 -0
- package/dist/tools/tool-outputs.d.ts +63 -0
- package/dist/tools/tool-outputs.d.ts.map +1 -0
- package/dist/tools/view-file.d.ts +40 -0
- package/dist/tools/view-file.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/turn-runtime.d.ts +19 -0
- package/dist/turn-runtime.d.ts.map +1 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workflow-input-attachments.d.ts +18 -0
- package/dist/workflow-input-attachments.d.ts.map +1 -0
- package/package.json +59 -4
- package/src/abort.ts +40 -0
- package/src/agent-prompt.ts +860 -0
- package/src/agent-runtime/errors.ts +44 -0
- package/src/agent-runtime/preflight.ts +314 -0
- package/src/agent-runtime/profile.ts +23 -0
- package/src/artifacts/layout-check/check.cjs +478 -0
- package/src/artifacts/layout-check/layout-check.ts +460 -0
- package/src/artifacts/materialize.ts +380 -0
- package/src/artifacts/publish-tool.ts +700 -0
- package/src/ask-parent-tool.ts +100 -0
- package/src/attachments.ts +1041 -0
- package/src/child-files.ts +535 -0
- package/src/child-questions.ts +42 -0
- package/src/computer-runner.ts +336 -0
- package/src/context-budget.ts +177 -0
- package/src/context-compaction.ts +1349 -0
- package/src/context-guard.ts +826 -0
- package/src/conversation-memory.ts +45 -0
- package/src/conversation-messages.ts +86 -0
- package/src/errors.ts +85 -0
- package/src/execution-plan.ts +70 -0
- package/src/failure.ts +82 -0
- package/src/family-mailbox.ts +189 -0
- package/src/file-ref.ts +18 -0
- package/src/image-attachments.ts +322 -0
- package/src/index.ts +54 -0
- package/src/inline-images.ts +69 -0
- package/src/message-authors.ts +77 -0
- package/src/message-times.ts +24 -0
- package/src/model-adapters.ts +273 -0
- package/src/model-lines.ts +28 -0
- package/src/prompt-cache.ts +40 -0
- package/src/requester.ts +21 -0
- package/src/run-agent-turn.ts +509 -0
- package/src/run-child.ts +344 -0
- package/src/run-conversation-turn.ts +272 -0
- package/src/run-credential.ts +55 -0
- package/src/run-environment.ts +1216 -0
- package/src/run-fate.ts +51 -0
- package/src/run-files-lock.ts +118 -0
- package/src/run-sandbox.ts +63 -0
- package/src/run-subagent.ts +433 -0
- package/src/run-workflow-agent-node.ts +344 -0
- package/src/sandbox-api-context.ts +237 -0
- package/src/sandbox-file-registry.ts +26 -0
- package/src/sandbox-files.ts +326 -0
- package/src/sandbox-handle.ts +19 -0
- package/src/sandbox-readiness.ts +22 -0
- package/src/skills/built-in.ts +183 -0
- package/src/skills/sixb-artifacts/SKILL.md +95 -0
- package/src/skills/sixb-artifacts/canvas.md +104 -0
- package/src/skills/sixb-artifacts/document.md +63 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/first-job.html +42 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/region.html +29 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/shared.css +35 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/welcome.html +31 -0
- package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/canvas.json +107 -0
- package/src/skills/sixb-artifacts/examples/canvas/retro/canvas.json +158 -0
- package/src/skills/sixb-artifacts/examples/document/incident-report/document.md +35 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/document.md +41 -0
- package/src/skills/sixb-artifacts/examples/document/operations-review/figures/restorations.svg +1 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/index.html +169 -0
- package/src/skills/sixb-artifacts/examples/page/collections-desk/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/data/dispatch.json +234 -0
- package/src/skills/sixb-artifacts/examples/page/dispatch-board/index.html +245 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/data/plan.json +53 -0
- package/src/skills/sixb-artifacts/examples/page/fleet-planner/index.html +462 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/data/service.json +276 -0
- package/src/skills/sixb-artifacts/examples/page/service-explorer/index.html +549 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/queries/overdue.json +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/workbook.json +30 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Inventory.csv +13 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Spend.csv +6 -0
- package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/workbook.json +47 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Quarters.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Regions.csv +5 -0
- package/src/skills/sixb-artifacts/examples/sheet/service-metrics/workbook.json +78 -0
- package/src/skills/sixb-artifacts/examples/slides/launch-plan/index.html +63 -0
- package/src/skills/sixb-artifacts/examples/slides/q3-review/index.html +133 -0
- package/src/skills/sixb-artifacts/file.md +17 -0
- package/src/skills/sixb-artifacts/page.md +215 -0
- package/src/skills/sixb-artifacts/queries.md +66 -0
- package/src/skills/sixb-artifacts/references.md +68 -0
- package/src/skills/sixb-artifacts/sheet.md +223 -0
- package/src/skills/sixb-artifacts/slides.md +137 -0
- package/src/skills/sixb-memory/SKILL.md +68 -0
- package/src/skills/text-assets.d.ts +25 -0
- package/src/subagent-context.ts +182 -0
- package/src/subagent-continuation.ts +56 -0
- package/src/subagent-inbox.ts +101 -0
- package/src/subagent-tools.ts +1671 -0
- package/src/thread-context.ts +31 -0
- package/src/tools/attachments.ts +28 -0
- package/src/tools/bash.ts +233 -0
- package/src/tools/model-spec.ts +27 -0
- package/src/tools/read.ts +262 -0
- package/src/tools/result-media.ts +351 -0
- package/src/tools/result-output.ts +46 -0
- package/src/tools/tool-files.ts +204 -0
- package/src/tools/tool-outputs.ts +464 -0
- package/src/tools/view-file.ts +155 -0
- package/src/turn-runtime.ts +33 -0
- package/src/types.ts +91 -0
- package/src/workflow-input-attachments.ts +140 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-context.d.ts","sourceRoot":"","sources":["../src/subagent-context.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAsB,MAAM,mBAAmB,CAA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C;IACT,QAAQ,CAAC,aAAa,EAAE,6BAA6B,CAAA;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B,CAAC,CAqCD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,GAAG,KAAK,GAAG,SAAS,CAchG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentMessagePart } from "@sixb/core";
|
|
2
|
+
import type { AgentTurnHistory } from "@sixb/core/internal/agents";
|
|
3
|
+
import type { AgentMessageRecord, SubagentRunRecord } from "@sixb/core/storage";
|
|
4
|
+
import { type SentSettings } from "./agent-prompt";
|
|
5
|
+
/**
|
|
6
|
+
* What a child run reads of its thread (`AgentChildContext`): its latest checkpoint and the
|
|
7
|
+
* messages after it, its task when the checkpoint summarized it, and the paused run it continues.
|
|
8
|
+
*/
|
|
9
|
+
export interface SubagentHistory extends AgentTurnHistory {
|
|
10
|
+
/** The thread's first message, when a checkpoint summarized it: its requests keep it as it is. */
|
|
11
|
+
readonly task?: AgentMessageRecord;
|
|
12
|
+
/** The run of the thread that paused on its held calls, when this run continues it. */
|
|
13
|
+
readonly paused?: SubagentRunRecord;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The message a continuation starts with: how each of its calls ended, as its own, or its parent's
|
|
17
|
+
* answer to its question; the messages its parent sent that the paused run never read; what came
|
|
18
|
+
* back to its new sandbox, and when it continues. It stays in
|
|
19
|
+
* the thread, so a later continuation replays the same bytes.
|
|
20
|
+
*
|
|
21
|
+
* A child whose workspace is kept finds it as it left it, and is told nothing about it here. If
|
|
22
|
+
* its files turn out lost, its system prompt says so, as a turn's does.
|
|
23
|
+
*/
|
|
24
|
+
export declare function continuationTrigger(input: {
|
|
25
|
+
/** The outcomes as the child reads them, without their caller, or the answer's `mail` part. */
|
|
26
|
+
readonly goesOnWith: readonly AgentMessagePart[];
|
|
27
|
+
readonly paused: SubagentRunRecord;
|
|
28
|
+
/** Whether the sandbox provider keeps the child's workspace while it pauses. */
|
|
29
|
+
readonly keepsWorkspace: boolean;
|
|
30
|
+
readonly createdAt: Date;
|
|
31
|
+
readonly settings: SentSettings;
|
|
32
|
+
}): readonly AgentMessagePart[];
|
|
33
|
+
//# sourceMappingURL=subagent-continuation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-continuation.d.ts","sourceRoot":"","sources":["../src/subagent-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQrE;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,kGAAkG;IAClG,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAA;IAClC,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;CACpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,+FAA+F;IAC/F,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAA;IAChD,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;CAChC,GAAG,SAAS,gBAAgB,EAAE,CAS9B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type AgentMailPart, type AgentMessage } from "@sixb/core";
|
|
2
|
+
import type { SubagentRunRecord } from "@sixb/core/storage";
|
|
3
|
+
import type { QuestionRef } from "./child-questions";
|
|
4
|
+
import type { ChildMailbox, UnreadChildMail } from "./family-mailbox";
|
|
5
|
+
/** Messages the child read, and where it read them: after how many of its steps. */
|
|
6
|
+
export interface SubagentDelivery {
|
|
7
|
+
readonly afterSteps: number;
|
|
8
|
+
readonly parts: readonly AgentMailPart[];
|
|
9
|
+
}
|
|
10
|
+
/** How its parent replied to the child's question: its answer, or none before its turn ended. */
|
|
11
|
+
export type ParentReply = {
|
|
12
|
+
readonly kind: "answer";
|
|
13
|
+
readonly text: string;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: "deferred";
|
|
16
|
+
readonly questionId: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* What a child's parent sent it, read at each of its step boundaries (`take`) from its side of the
|
|
20
|
+
* turn's mailbox, and the questions it asks its parent (`ask`). What it read is the child's to
|
|
21
|
+
* record: its thread keeps each delivery where the model read it, and each question as its tool
|
|
22
|
+
* call. What it never read when it pauses is returned by `close`, for the run that continues it.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SubagentInbox {
|
|
25
|
+
#private;
|
|
26
|
+
private readonly mailbox;
|
|
27
|
+
private readonly run;
|
|
28
|
+
constructor(mailbox: ChildMailbox, run: SubagentRunRecord);
|
|
29
|
+
/** What the child read, in order. */
|
|
30
|
+
get deliveries(): readonly SubagentDelivery[];
|
|
31
|
+
/** The question its parent's turn ended without answering: the child pauses on it. */
|
|
32
|
+
get deferred(): QuestionRef | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Ask the parent and wait for its reply, bounded by `signal`: the child's own cancel and its
|
|
35
|
+
* parent's. Its id names the child's model call and tool call, so the parent lists it once.
|
|
36
|
+
*/
|
|
37
|
+
ask(question: string, callId: string, signal: AbortSignal): Promise<ParentReply>;
|
|
38
|
+
/**
|
|
39
|
+
* The messages that came since the last read, as the user message the child reads after
|
|
40
|
+
* `afterSteps` of its steps; none when nothing came. `afterAnswer` when the child just answered:
|
|
41
|
+
* it is told to write its result again in full.
|
|
42
|
+
*/
|
|
43
|
+
take(afterSteps: number, options?: {
|
|
44
|
+
readonly afterAnswer?: boolean;
|
|
45
|
+
}): AgentMessage | undefined;
|
|
46
|
+
/** Stop reading, as the child stops: what it never read, for the run that continues it. */
|
|
47
|
+
close(): readonly UnreadChildMail[];
|
|
48
|
+
}
|
|
49
|
+
/** A message from the parent, as the child's thread keeps it where the child read it. */
|
|
50
|
+
export declare function mailPart(mail: UnreadChildMail, options?: {
|
|
51
|
+
readonly afterAnswer?: boolean;
|
|
52
|
+
}): AgentMailPart;
|
|
53
|
+
//# sourceMappingURL=subagent-inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-inbox.d.ts","sourceRoot":"","sources":["../src/subagent-inbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAA;AACxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAErE,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAA;CACzC;AAED,iGAAiG;AACjG,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9D;;;;;GAKG;AACH,qBAAa,aAAa;;IAOtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,OAAO,EAAE,YAAY,EACrB,GAAG,EAAE,iBAAiB;IAGzC,qCAAqC;IACrC,IAAI,UAAU,IAAI,SAAS,gBAAgB,EAAE,CAE5C;IAED,sFAAsF;IACtF,IAAI,QAAQ,IAAI,WAAW,GAAG,SAAS,CAEtC;IAED;;;OAGG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAkBtF;;;;OAIG;IACH,IAAI,CACF,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAO,GAC/C,YAAY,GAAG,SAAS;IAQ3B,2FAA2F;IAC3F,KAAK,IAAI,SAAS,eAAe,EAAE;CAGpC;AAED,yFAAyF;AACzF,wBAAgB,QAAQ,CACtB,IAAI,EAAE,eAAe,EACrB,OAAO,GAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/C,aAAa,CASf"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { type AgentReasoning, type LanguageModelRef, type LanguageModelTier } from "@sixb/core";
|
|
2
|
+
import { type AgentChildApprovalAwaiting, type AgentRunDelegation, type AgentRunSession } from "@sixb/core/internal/agents";
|
|
3
|
+
import { type ModelTool } from "@sixb/core/models";
|
|
4
|
+
import type { ConversationAgentRunRecord, SubagentRunRecord } from "@sixb/core/storage";
|
|
5
|
+
import { type InstalledChildFile } from "./child-files";
|
|
6
|
+
import { type QuestionRef } from "./child-questions";
|
|
7
|
+
import { FamilyMailbox } from "./family-mailbox";
|
|
8
|
+
import type { TurnChildren } from "./run-agent-turn";
|
|
9
|
+
import type { AgentRunFiles, AgentRunSettings } from "./types";
|
|
10
|
+
/**
|
|
11
|
+
* How long a wait for children goes without reading their runs when nothing woke it. A child's
|
|
12
|
+
* question and its end wake it at once, through the turn's mailbox; this bounds an end recorded
|
|
13
|
+
* outside the runner, which nothing here hears: an API cancel of a child still queued, or a repair
|
|
14
|
+
* pass ending one whose own end could not be recorded. Five seconds keeps such a wait short beside
|
|
15
|
+
* the minutes a child works, and a wait reads storage 12 times a minute.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CHILD_WAIT_RECHECK_MS = 5000;
|
|
18
|
+
/**
|
|
19
|
+
* How often a wait reads a run another turn's mailbox hears, which nothing wakes it for: a child
|
|
20
|
+
* of an earlier turn, or of an earlier attempt of this resume, still stopping. Both are rare and
|
|
21
|
+
* short, so a short poll costs little.
|
|
22
|
+
*/
|
|
23
|
+
export declare const OTHER_TURN_RECHECK_MS = 250;
|
|
24
|
+
export interface SpawnSubagentInput {
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly task: string;
|
|
27
|
+
readonly model?: LanguageModelRef | LanguageModelTier;
|
|
28
|
+
readonly reasoning?: AgentReasoning;
|
|
29
|
+
/** At most this many steps, fewer than the project's limit. */
|
|
30
|
+
readonly maxSteps?: number;
|
|
31
|
+
/** Files and directories in the parent's sandbox, copied into the child's at the same paths. */
|
|
32
|
+
readonly files?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export interface SpawnSubagentOutput {
|
|
35
|
+
readonly runId: string;
|
|
36
|
+
readonly status: SubagentRunRecord["status"];
|
|
37
|
+
readonly model: LanguageModelRef;
|
|
38
|
+
}
|
|
39
|
+
export interface MessageSubagentInput {
|
|
40
|
+
readonly key: string;
|
|
41
|
+
readonly text: string;
|
|
42
|
+
}
|
|
43
|
+
export interface MessageSubagentOutput {
|
|
44
|
+
readonly runId: string;
|
|
45
|
+
readonly status: "queued" | "running";
|
|
46
|
+
/**
|
|
47
|
+
* When the child reads it: before its first step while it is queued, else before its next.
|
|
48
|
+
* `answer`: it answers the question the child waits on, now or, once it continues, first.
|
|
49
|
+
*/
|
|
50
|
+
readonly delivery: "first-step" | "next-step" | "answer";
|
|
51
|
+
/** The child of an earlier turn, paused on its question, that this answer continues. */
|
|
52
|
+
readonly continues?: string;
|
|
53
|
+
}
|
|
54
|
+
/** A message the parent sent a child this turn. */
|
|
55
|
+
interface SentMessage {
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly text: string;
|
|
58
|
+
}
|
|
59
|
+
export interface WaitForSubagentsInput {
|
|
60
|
+
readonly runIds: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
export interface WaitedSubagentResult {
|
|
63
|
+
readonly runId: string;
|
|
64
|
+
/**
|
|
65
|
+
* `queued` or `running`: the turn is about to end, so the Agent answers without it.
|
|
66
|
+
* `awaiting_approval`: it paused on calls that wait for the user, and continues once they decide,
|
|
67
|
+
* unless a new message sets the calls aside or the turn is stopped instead.
|
|
68
|
+
*/
|
|
69
|
+
readonly status: SubagentRunRecord["status"] | "awaiting_approval" | "awaiting_answer";
|
|
70
|
+
readonly text?: string;
|
|
71
|
+
/** The question it waits on: answer it with `message_agent` and its key. */
|
|
72
|
+
readonly question?: QuestionRef;
|
|
73
|
+
readonly error?: {
|
|
74
|
+
readonly code: string;
|
|
75
|
+
readonly message: string;
|
|
76
|
+
};
|
|
77
|
+
/** The last text a child its step limit stopped wrote: what it found so far, or where it was. */
|
|
78
|
+
readonly partialAnswer?: string;
|
|
79
|
+
/** Calls it made that wait for the user's approval. */
|
|
80
|
+
readonly awaitingApproval?: readonly AgentChildApprovalAwaiting[];
|
|
81
|
+
/**
|
|
82
|
+
* What it wrote under `out/`, by path there, and where each is in the parent's sandbox this
|
|
83
|
+
* turn. The first result that lists them holds them as files, which later turns find in
|
|
84
|
+
* `$SIXB_ATTACHMENTS` by their `logicalPath`, `<key>/<path>`.
|
|
85
|
+
*/
|
|
86
|
+
readonly files?: readonly {
|
|
87
|
+
readonly path: string;
|
|
88
|
+
readonly sandboxPath: string;
|
|
89
|
+
readonly sizeBytes: number;
|
|
90
|
+
readonly mediaType?: string;
|
|
91
|
+
}[];
|
|
92
|
+
/** Why its files are not listed: they did not come back, could not be copied, or wait. */
|
|
93
|
+
readonly filesNote?: string;
|
|
94
|
+
/** What this turn sent it that it has not read: a paused child reads it if it continues. */
|
|
95
|
+
readonly unread?: readonly SentMessage[];
|
|
96
|
+
/**
|
|
97
|
+
* What it answered before a message of yours came, which its `text`, written after, replaces.
|
|
98
|
+
* Set when it answered again.
|
|
99
|
+
*/
|
|
100
|
+
readonly earlierAnswer?: string;
|
|
101
|
+
/** Why its `text` does not account for your last message, when it did not answer again. */
|
|
102
|
+
readonly answerNote?: string;
|
|
103
|
+
}
|
|
104
|
+
/** A question a child waits on, with the key to answer it by. */
|
|
105
|
+
export interface WaitedQuestion extends QuestionRef {
|
|
106
|
+
readonly key: string;
|
|
107
|
+
readonly runId: string;
|
|
108
|
+
}
|
|
109
|
+
export interface WaitForSubagentsOutput {
|
|
110
|
+
readonly results: readonly WaitedSubagentResult[];
|
|
111
|
+
/** Every question a child of this turn waits on: `wait_agent` returns as soon as one comes. */
|
|
112
|
+
readonly questions?: readonly WaitedQuestion[];
|
|
113
|
+
/** The files no earlier result held, in the order of `results`. */
|
|
114
|
+
readonly files: readonly InstalledChildFile[];
|
|
115
|
+
/** Why what the children published is not all in `$SIXB_ARTIFACTS`. */
|
|
116
|
+
readonly artifactsError?: string;
|
|
117
|
+
}
|
|
118
|
+
/** What a turn offers the children it spawns. */
|
|
119
|
+
export interface TurnDelegation {
|
|
120
|
+
/** The project's language models, from the turn's plan. */
|
|
121
|
+
readonly models: AgentRunDelegation;
|
|
122
|
+
/** The project tools each child gets. */
|
|
123
|
+
readonly toolNames: readonly string[];
|
|
124
|
+
}
|
|
125
|
+
/** Run-scoped boundary used by the parent Agent's framework-owned delegation tools. */
|
|
126
|
+
export declare class SubagentCoordinator {
|
|
127
|
+
#private;
|
|
128
|
+
/** What the turn offers its children: the project's language models, and its tools. */
|
|
129
|
+
private readonly delegation;
|
|
130
|
+
private readonly context;
|
|
131
|
+
private readonly parentRun;
|
|
132
|
+
/** The turn's session, through which it reaches its children's runs. */
|
|
133
|
+
private readonly session;
|
|
134
|
+
/**
|
|
135
|
+
* Run a child this turn spawned or continues, in the turn's own runner, on the turn's mailbox:
|
|
136
|
+
* it claims the child's run, opens its session and environment, and records its fate.
|
|
137
|
+
* Starting a run already running is a no-op.
|
|
138
|
+
*/
|
|
139
|
+
private readonly startChild;
|
|
140
|
+
private readonly models;
|
|
141
|
+
constructor(
|
|
142
|
+
/** What the turn offers its children: the project's language models, and its tools. */
|
|
143
|
+
delegation: TurnDelegation, context: AgentRunSettings, parentRun: ConversationAgentRunRecord,
|
|
144
|
+
/** The turn's session, through which it reaches its children's runs. */
|
|
145
|
+
session: AgentRunSession,
|
|
146
|
+
/**
|
|
147
|
+
* Run a child this turn spawned or continues, in the turn's own runner, on the turn's mailbox:
|
|
148
|
+
* it claims the child's run, opens its session and environment, and records its fate.
|
|
149
|
+
* Starting a run already running is a no-op.
|
|
150
|
+
*/
|
|
151
|
+
startChild: (run: SubagentRunRecord, family: FamilyMailbox) => void);
|
|
152
|
+
/** The turn ended: it sends its children nothing more. */
|
|
153
|
+
close(): void;
|
|
154
|
+
/**
|
|
155
|
+
* How the turn hears its children's questions: those of earlier turns' children still paused on
|
|
156
|
+
* one, read after the conversation; those it has not read, before its answer ends it; and the
|
|
157
|
+
* pause, before its end, of each child still waiting on one. And how a pausing turn waits for
|
|
158
|
+
* those still at work.
|
|
159
|
+
*/
|
|
160
|
+
turnChildren(): Promise<TurnChildren>;
|
|
161
|
+
/** The parent's environment, started after its tools are defined and before any of them runs. */
|
|
162
|
+
attach(runFiles: AgentRunFiles): void;
|
|
163
|
+
/**
|
|
164
|
+
* When this turn resumes a paused one, continue each child that paused on its held calls: the
|
|
165
|
+
* next run of its thread, under this turn and the same key, with the paused child's model, task
|
|
166
|
+
* and files, and this turn's mode. The outcomes of its calls start the run. Admitting
|
|
167
|
+
* it again finds it, so a retry of this turn, under its own id, admits its own.
|
|
168
|
+
*/
|
|
169
|
+
continuePausedChildren(signal: AbortSignal): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Remove from a paused child's thread what the runs after its pause did under an earlier attempt
|
|
172
|
+
* of this resume, which failed: this turn continues the paused child again, as a retried turn
|
|
173
|
+
* replays from its trigger. A run still stopping is waited for: its lease ends it if nothing else
|
|
174
|
+
* does.
|
|
175
|
+
*/
|
|
176
|
+
private clearDeadAttempts;
|
|
177
|
+
/**
|
|
178
|
+
* The children this turn continues: those its trigger, a resume, reported as continuing, as the
|
|
179
|
+
* model reads it. The approvals, not the message, say which calls are the child's and that this
|
|
180
|
+
* message reported them, and the child must still be paused on them.
|
|
181
|
+
*/
|
|
182
|
+
private pausedChildrenToContinue;
|
|
183
|
+
createTools(): Promise<readonly ModelTool[]>;
|
|
184
|
+
/**
|
|
185
|
+
* Send a child a message, through the turn's mailbox. Its id names this turn, the model call and
|
|
186
|
+
* the tool call in it, so a replay of the call is the same message and the child reads it once,
|
|
187
|
+
* while two calls never share one, whatever ids the provider gives its tool calls.
|
|
188
|
+
*/
|
|
189
|
+
message(input: MessageSubagentInput, callId: string, signal: AbortSignal): Promise<MessageSubagentOutput>;
|
|
190
|
+
/** The latest child under `key` of this conversation's turns, this one's included. */
|
|
191
|
+
private latestChildUnder;
|
|
192
|
+
/**
|
|
193
|
+
* The child paused on its question that a message under `key` would continue: the latest run of
|
|
194
|
+
* the latest thread under the key, or, past the continuations of it that failed or were stopped,
|
|
195
|
+
* the run they continued, so their failure does not hide the question. A later spawn under the
|
|
196
|
+
* key replaces it.
|
|
197
|
+
*/
|
|
198
|
+
private pausedOnQuestion;
|
|
199
|
+
/** Whether a continuation went on with its parent's answer, as its trigger says. */
|
|
200
|
+
private continuesAfterAnswer;
|
|
201
|
+
private subagentRun;
|
|
202
|
+
/**
|
|
203
|
+
* The children of this conversation still paused on their question, each with it: one indexed
|
|
204
|
+
* read, which finds none in a conversation that has none, then one per key that has some.
|
|
205
|
+
*/
|
|
206
|
+
waitingQuestions(): Promise<readonly WaitedQuestion[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Continue a child paused on its question, as a child of this turn under the same key, with this
|
|
209
|
+
* message as the answer it reads first. Admissions go one at a time, so a second answer in the
|
|
210
|
+
* same step finds the first one's continuation and is refused.
|
|
211
|
+
*/
|
|
212
|
+
private answerPaused;
|
|
213
|
+
/**
|
|
214
|
+
* The question a child paused on, from its thread: the last message of the run that paused, its
|
|
215
|
+
* work since its last delivery. Only one `awaiting_answer` has one.
|
|
216
|
+
*/
|
|
217
|
+
private deferredQuestionOf;
|
|
218
|
+
/**
|
|
219
|
+
* The questions of the turn's children still at work that the model has not read, marked read:
|
|
220
|
+
* its answer would otherwise end the turn without them.
|
|
221
|
+
*/
|
|
222
|
+
unreadQuestions(): Promise<readonly WaitedQuestion[]>;
|
|
223
|
+
/**
|
|
224
|
+
* Before the turn records its end, while it still runs: tell each child still waiting on its
|
|
225
|
+
* question that the turn ends without an answer, then wait for each to pause on it. The turn's end cancels the children still at work, so a child it told and that has not
|
|
226
|
+
* paused yet would be stopped; while the turn runs, the repair pass leaves its children alone.
|
|
227
|
+
*/
|
|
228
|
+
deferOpenQuestions(signal: AbortSignal): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Wait until none of the turn's children is queued or running: a pausing turn's end cancels those
|
|
231
|
+
* still at work, and one that holds a call pauses by itself meanwhile.
|
|
232
|
+
*/
|
|
233
|
+
settleChildren(signal: AbortSignal): Promise<void>;
|
|
234
|
+
/** The open questions of the turn's children still at work, each with the child's key. */
|
|
235
|
+
private askingChildren;
|
|
236
|
+
spawn(input: SpawnSubagentInput, signal: AbortSignal): Promise<SpawnSubagentOutput>;
|
|
237
|
+
private admitInTurn;
|
|
238
|
+
/**
|
|
239
|
+
* What admission will answer, read before the files the child is handed: the child already
|
|
240
|
+
* spawned with this key, else nothing once checked that the turn may spawn another.
|
|
241
|
+
*/
|
|
242
|
+
private admissionOf;
|
|
243
|
+
/**
|
|
244
|
+
* The run of this turn that continues `paused` in its thread: its model, task and files, this
|
|
245
|
+
* turn's mode, and a trigger of what it goes on with (the outcomes of its calls, or
|
|
246
|
+
* its parent's answer), what came back to its sandbox and when it continues.
|
|
247
|
+
*/
|
|
248
|
+
private continuationOf;
|
|
249
|
+
/** A child asks no less than its turn, dates as its requester does, and ends with the turn. */
|
|
250
|
+
private childSpec;
|
|
251
|
+
/**
|
|
252
|
+
* Admit a child of this turn. A spawned child works in a thread of its own, which starts with its
|
|
253
|
+
* task and its files; a continuation goes into its thread with the outcomes it continues with.
|
|
254
|
+
*/
|
|
255
|
+
private admit;
|
|
256
|
+
wait(input: WaitForSubagentsInput, signal: AbortSignal): Promise<WaitForSubagentsOutput>;
|
|
257
|
+
/**
|
|
258
|
+
* What became of what this turn sent an ended child, from its thread, which holds each message
|
|
259
|
+
* it read: those it did not read, and, when one came as it answered, the answer it gave before.
|
|
260
|
+
* A failed child's failure is what the parent acts on.
|
|
261
|
+
*/
|
|
262
|
+
private messagesTo;
|
|
263
|
+
/**
|
|
264
|
+
* What a child its step limit stopped wrote last, from its thread: its failure says it did not
|
|
265
|
+
* finish, and its parent decides whether this is enough.
|
|
266
|
+
*/
|
|
267
|
+
private partialAnswerOf;
|
|
268
|
+
/**
|
|
269
|
+
* The run a child of an earlier turn is waited for as: its thread's latest, the one that continues
|
|
270
|
+
* it when this turn resumes its pause; else `runId` itself.
|
|
271
|
+
*/
|
|
272
|
+
private continuedChildId;
|
|
273
|
+
/** Which parents of these children are earlier turns of this turn's conversation. */
|
|
274
|
+
private earlierTurnsOf;
|
|
275
|
+
/**
|
|
276
|
+
* Copy what each finished child wrote under `out/` into the parent's sandbox, once, and install
|
|
277
|
+
* what the children published in its `$SIXB_ARTIFACTS`, as the parent's own. A result holds at
|
|
278
|
+
* most the attachment limits of new files, a child's whole or not at all; a child that does not
|
|
279
|
+
* fit, or whose files cannot be copied, says so, and its files come with a later wait.
|
|
280
|
+
*/
|
|
281
|
+
private deliverFiles;
|
|
282
|
+
private runFiles;
|
|
283
|
+
/** A spawn may ask for fewer steps than the project allows, never more. */
|
|
284
|
+
private resolveMaxSteps;
|
|
285
|
+
private resolveModel;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Built from each model's configured definition, never from its provider catalog: the guide is in
|
|
289
|
+
* every turn's tools, so it stays the same for the process and catalog I/O cannot fail a turn.
|
|
290
|
+
*/
|
|
291
|
+
export declare function renderSubagentModelGuide(models: AgentRunDelegation): string;
|
|
292
|
+
export {};
|
|
293
|
+
//# sourceMappingURL=subagent-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-tools.d.ts","sourceRoot":"","sources":["../src/subagent-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,cAAc,EAGnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,0BAA0B,EAG/B,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAQrB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAML,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,0BAA0B,EAE1B,iBAAiB,EAElB,MAAM,oBAAoB,CAAA;AAK3B,OAAO,EAEL,KAAK,kBAAkB,EAIxB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAsB,KAAK,WAAW,EAAwB,MAAM,mBAAmB,CAAA;AAC9F,OAAO,EAAwB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,OAAQ,CAAA;AAC1C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAgBxC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,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C,QAAQ;IAOhB,2EAA2E;IAC3E,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,YAAY;CAuBrB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CA0C3E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentThreadModelContextMessage, type AgentTurnHistory } from "@sixb/core/internal/agents";
|
|
2
|
+
import type { AgentContextCheckpointRecord, AgentMessageRecord } from "@sixb/core/storage";
|
|
3
|
+
export interface LoadedAgentThreadModelContext {
|
|
4
|
+
readonly checkpoint: AgentContextCheckpointRecord | null;
|
|
5
|
+
readonly retainedMessages: readonly AgentMessageRecord[];
|
|
6
|
+
readonly modelMessages: readonly AgentThreadModelContextMessage[];
|
|
7
|
+
/** The history it was built from, as the session answered it. */
|
|
8
|
+
readonly history: AgentTurnHistory;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The retained tail with its checkpoint, projected for the model. A child's run reads its thread
|
|
12
|
+
* without `historyReadable`: `sixb history` prints only a conversation's.
|
|
13
|
+
*/
|
|
14
|
+
export declare function agentThreadModelContext(history: AgentTurnHistory, options?: {
|
|
15
|
+
readonly historyReadable?: boolean;
|
|
16
|
+
}): LoadedAgentThreadModelContext;
|
|
17
|
+
//# sourceMappingURL=thread-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-context.d.ts","sourceRoot":"","sources":["../src/thread-context.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EAEtB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE1F,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,UAAU,EAAE,4BAA4B,GAAG,IAAI,CAAA;IACxD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACxD,QAAQ,CAAC,aAAa,EAAE,SAAS,8BAA8B,EAAE,CAAA;IACjE,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CACnC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE;IAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,6BAA6B,CAQ/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AgentToolAttachments } from "@sixb/core";
|
|
2
|
+
import type { AgentRunFileStore } from "@sixb/core/internal/agents";
|
|
3
|
+
import type { WorkflowIOSnapshot } from "@sixb/core/internal/workflows";
|
|
4
|
+
type AttachmentBlobStorage = Pick<AgentRunFileStore, "stat" | "open">;
|
|
5
|
+
/** A workflow AI task's attachments: the files of its input, by their path such as `input.pdf`. */
|
|
6
|
+
export declare function workflowInputToolAttachments(input: {
|
|
7
|
+
readonly input: WorkflowIOSnapshot;
|
|
8
|
+
readonly blobStorage: AttachmentBlobStorage;
|
|
9
|
+
}): AgentToolAttachments;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/tools/attachments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAwB,MAAM,YAAY,CAAA;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAGvE,KAAK,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAErE,mGAAmG;AACnG,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAC5C,GAAG,oBAAoB,CASvB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CommandResult } from "@sixb/core";
|
|
2
|
+
import type { ModelTool } from "@sixb/core/models";
|
|
3
|
+
import type { AgentSandboxHandle } from "../sandbox-handle";
|
|
4
|
+
export declare const BASH_TOOL_SPEC: {
|
|
5
|
+
readonly name: "bash";
|
|
6
|
+
readonly description: "Run a Bash command in the agent run sandbox.";
|
|
7
|
+
readonly inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
command: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
cwd: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
timeoutMs: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: string[];
|
|
22
|
+
additionalProperties: false;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
interface BashToolInput {
|
|
26
|
+
readonly command: string;
|
|
27
|
+
readonly cwd?: string;
|
|
28
|
+
readonly timeoutMs?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface BashToolOutput extends CommandResult {
|
|
31
|
+
readonly stdoutTruncated: boolean;
|
|
32
|
+
readonly stderrTruncated: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build the bash tool from a resolver that yields the sandbox on demand. The
|
|
36
|
+
* resolver is awaited on the first command, not at tool-construction time, so
|
|
37
|
+
* sandbox creation can run concurrently with the model's first response instead
|
|
38
|
+
* of blocking the turn. A resolver rejection surfaces as a failed command.
|
|
39
|
+
*
|
|
40
|
+
* Its output holds the command's streams whole: the run's tools save an output too large for the
|
|
41
|
+
* context to a file and keep {@link keptCommandOutput} of it (see tool-outputs.ts).
|
|
42
|
+
*/
|
|
43
|
+
export declare function createBashTool(resolveSandbox: () => Promise<AgentSandboxHandle>): ModelTool<BashToolInput>;
|
|
44
|
+
/**
|
|
45
|
+
* What a command's message part keeps of an output saved to a file: each stream within
|
|
46
|
+
* 20,000 characters, as the app, the TUI and `sixb history` show it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function keptCommandOutput(output: CommandResult): BashToolOutput;
|
|
49
|
+
interface TruncateResult {
|
|
50
|
+
readonly text: string;
|
|
51
|
+
readonly truncated: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Fit a command's stdout under `maxChars`, preferring to keep it valid JSON.
|
|
55
|
+
*
|
|
56
|
+
* The agent's commands (and any `jq` pretty-printing it adds) mostly produce JSON API responses. We
|
|
57
|
+
* compress in the order the field recommends — reformat first, drop data only if we must:
|
|
58
|
+
* 1. Under budget already → leave it untouched.
|
|
59
|
+
* 2. Valid JSON → re-serialize compact; whitespace alone often brings it under budget with zero
|
|
60
|
+
* data loss (compact JSON is also fewer tokens and no worse for model comprehension).
|
|
61
|
+
* 3. Still oversized JSON array → keep the largest whole-element prefix that fits, as a bare array
|
|
62
|
+
* (same shape the caller expects, still valid JSON, just fewer rows).
|
|
63
|
+
* 4. Oversized JSON object → return a valid JSON preview that tells the agent to narrow the call.
|
|
64
|
+
* 5. Oversized non-JSON → middle-truncate the text.
|
|
65
|
+
*/
|
|
66
|
+
export declare function compressStdout(text: string, maxChars: number): TruncateResult;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=bash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAM3D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;CAiBjB,CAAA;AAEV,UAAU,aAAa;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,GAChD,SAAS,CAAC,aAAa,CAAC,CAqB1B;AAmCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAEvE;AAiBD,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAe7E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentToolSpec } from "@sixb/core/internal/agents";
|
|
2
|
+
/**
|
|
3
|
+
* Describe exactly the tools a conversational model receives, in its order, without starting its
|
|
4
|
+
* sandbox. A conversation publishes artifacts once its run executes in a thread.
|
|
5
|
+
*/
|
|
6
|
+
export declare function agentModelToolSpecs(projectTools: readonly AgentToolSpec[], options?: {
|
|
7
|
+
readonly publishes?: boolean;
|
|
8
|
+
}): readonly AgentToolSpec[];
|
|
9
|
+
//# sourceMappingURL=model-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-spec.d.ts","sourceRoot":"","sources":["../../src/tools/model-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAS/D;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,SAAS,aAAa,EAAE,EACtC,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7C,SAAS,aAAa,EAAE,CAU1B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ModelTool } from "@sixb/core/models";
|
|
2
|
+
import { type AgentSandboxHandle } from "../sandbox-handle";
|
|
3
|
+
export declare const READ_TOOL_SPEC: {
|
|
4
|
+
readonly name: "read";
|
|
5
|
+
readonly description: "Read a UTF-8 text file relative to the sandbox working directory. Returns at most 2,000 lines or 50 KiB and includes nextOffset when more content remains. Prefer this over bash for reading files.";
|
|
6
|
+
readonly inputSchema: {
|
|
7
|
+
type: string;
|
|
8
|
+
properties: {
|
|
9
|
+
path: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
offset: {
|
|
14
|
+
type: string;
|
|
15
|
+
minimum: number;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
limit: {
|
|
19
|
+
type: string;
|
|
20
|
+
minimum: number;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
required: string[];
|
|
25
|
+
additionalProperties: false;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export interface ReadToolInput {
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly offset?: number;
|
|
31
|
+
readonly limit?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ReadToolOutput {
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly content: string;
|
|
36
|
+
readonly startLine: number;
|
|
37
|
+
readonly endLine: number;
|
|
38
|
+
readonly truncated: boolean;
|
|
39
|
+
readonly nextOffset?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Build the bounded UTF-8 file reader from the run's lazy sandbox resolver. */
|
|
42
|
+
export declare function createReadTool(resolveSandbox: () => Promise<AgentSandboxHandle>): ModelTool<ReadToolInput>;
|
|
43
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGzE,OAAO,EAAE,KAAK,kBAAkB,EAAe,MAAM,mBAAmB,CAAA;AAOxE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;CAsBjB,CAAA;AAEV,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,GAChD,SAAS,CAAC,aAAa,CAAC,CAqD1B"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { FileRef, JsonValue } from "@sixb/core";
|
|
2
|
+
import type { AgentRunFileStore, PrepareModelStepInput, PrepareModelStepResult } from "@sixb/core/internal/agents";
|
|
3
|
+
import type { AgentMessageRecord } from "@sixb/core/storage";
|
|
4
|
+
import { type PreparedAgentAttachmentContext, prepareAgentToolFileProjection } from "../attachments";
|
|
5
|
+
import { type InlineImageBudget } from "../inline-images";
|
|
6
|
+
import { type AgentToolModelOutput } from "./result-output";
|
|
7
|
+
/** Whether the images a tool's results return reach the model after its step. */
|
|
8
|
+
export type SuppliesToolFiles = (toolName: string) => boolean;
|
|
9
|
+
/** An image a step's tool returned, not projected yet. */
|
|
10
|
+
interface ToolFileCandidate {
|
|
11
|
+
readonly toolCallId: string;
|
|
12
|
+
readonly fileRef: FileRef;
|
|
13
|
+
}
|
|
14
|
+
interface ToolFileProjectionInput {
|
|
15
|
+
readonly blobStorage: AgentRunFileStore;
|
|
16
|
+
readonly signal: AbortSignal;
|
|
17
|
+
/** Test seam; production uses the bounded attachment projector. */
|
|
18
|
+
readonly projectFile?: typeof prepareAgentToolFileProjection;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Move tool-created images into a user message after their step without changing their durable
|
|
22
|
+
* result. The message is derived from the step's results alone, so a later turn derives the same
|
|
23
|
+
* one from the stored trace ({@link replayToolFiles}) and its request keeps the prefix. Its images
|
|
24
|
+
* take what the request's inline image budget has left, after the history's.
|
|
25
|
+
*/
|
|
26
|
+
export declare class AgentToolResultMediaBridge {
|
|
27
|
+
private readonly input;
|
|
28
|
+
constructor(input: Omit<ToolFileProjectionInput, "signal"> & {
|
|
29
|
+
readonly suppliesToolFiles: SuppliesToolFiles;
|
|
30
|
+
readonly inlineImages: InlineImageBudget;
|
|
31
|
+
readonly sandboxPathForFileRef?: (fileRef: FileRef) => string | undefined | Promise<string | undefined>;
|
|
32
|
+
});
|
|
33
|
+
toModelOutput(input: {
|
|
34
|
+
readonly output: JsonValue;
|
|
35
|
+
readonly signal: AbortSignal;
|
|
36
|
+
}): Promise<AgentToolModelOutput>;
|
|
37
|
+
readonly prepareStep: ({ stepIndex, messages, model, signal, }: PrepareModelStepInput) => Promise<PrepareModelStepResult | undefined>;
|
|
38
|
+
}
|
|
39
|
+
/** The key of a stored step's tool-files message: its message and its first local tool call. */
|
|
40
|
+
export declare function toolFilesStepKey(messageId: string, partIndex: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* The images each stored step's tools returned, by {@link toolFilesStepKey}, not projected yet:
|
|
43
|
+
* {@link allocateInlineImages} projects them as far as the request's budget goes.
|
|
44
|
+
*/
|
|
45
|
+
export declare function replayToolFiles(input: {
|
|
46
|
+
readonly messages: readonly AgentMessageRecord[];
|
|
47
|
+
readonly suppliesToolFiles: SuppliesToolFiles;
|
|
48
|
+
readonly supportsImages: boolean;
|
|
49
|
+
}): ReadonlyMap<string, readonly ToolFileCandidate[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Spend the request's inline image budget on the history, in thread order, oldest first: each user
|
|
52
|
+
* message's attachments, then the images after each step of the turn that answered it. Images are
|
|
53
|
+
* projected only while the budget is open, a few at a time; what does not fit reads as metadata.
|
|
54
|
+
* The run's own steps then take what is left, in the order a later replay walks them, so every
|
|
55
|
+
* turn takes the same decisions. Images are never stored: their bytes are projected again from
|
|
56
|
+
* their blobs, which is deterministic.
|
|
57
|
+
*/
|
|
58
|
+
export declare function allocateInlineImages(input: ToolFileProjectionInput & {
|
|
59
|
+
readonly messages: readonly AgentMessageRecord[];
|
|
60
|
+
readonly attachments: PreparedAgentAttachmentContext;
|
|
61
|
+
readonly toolFiles: ReadonlyMap<string, readonly ToolFileCandidate[]>;
|
|
62
|
+
readonly budget: InlineImageBudget;
|
|
63
|
+
}): Promise<PreparedAgentAttachmentContext>;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=result-media.d.ts.map
|