@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.
Files changed (240) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -2
  3. package/dist/abort.d.ts +6 -0
  4. package/dist/abort.d.ts.map +1 -0
  5. package/dist/agent-prompt.d.ts +126 -0
  6. package/dist/agent-prompt.d.ts.map +1 -0
  7. package/dist/agent-runtime/errors.d.ts +13 -0
  8. package/dist/agent-runtime/errors.d.ts.map +1 -0
  9. package/dist/agent-runtime/preflight.d.ts +18 -0
  10. package/dist/agent-runtime/preflight.d.ts.map +1 -0
  11. package/dist/agent-runtime/profile.d.ts +14 -0
  12. package/dist/agent-runtime/profile.d.ts.map +1 -0
  13. package/dist/artifacts/layout-check/layout-check.d.ts +87 -0
  14. package/dist/artifacts/layout-check/layout-check.d.ts.map +1 -0
  15. package/dist/artifacts/materialize.d.ts +115 -0
  16. package/dist/artifacts/materialize.d.ts.map +1 -0
  17. package/dist/artifacts/publish-tool.d.ts +86 -0
  18. package/dist/artifacts/publish-tool.d.ts.map +1 -0
  19. package/dist/ask-parent-tool.d.ts +36 -0
  20. package/dist/ask-parent-tool.d.ts.map +1 -0
  21. package/dist/attachments.d.ts +109 -0
  22. package/dist/attachments.d.ts.map +1 -0
  23. package/dist/child-files.d.ts +91 -0
  24. package/dist/child-files.d.ts.map +1 -0
  25. package/dist/child-questions.d.ts +24 -0
  26. package/dist/child-questions.d.ts.map +1 -0
  27. package/dist/computer-runner.d.ts +74 -0
  28. package/dist/computer-runner.d.ts.map +1 -0
  29. package/dist/context-budget.d.ts +34 -0
  30. package/dist/context-budget.d.ts.map +1 -0
  31. package/dist/context-compaction.d.ts +148 -0
  32. package/dist/context-compaction.d.ts.map +1 -0
  33. package/dist/context-guard.d.ts +69 -0
  34. package/dist/context-guard.d.ts.map +1 -0
  35. package/dist/conversation-memory.d.ts +21 -0
  36. package/dist/conversation-memory.d.ts.map +1 -0
  37. package/dist/conversation-messages.d.ts +33 -0
  38. package/dist/conversation-messages.d.ts.map +1 -0
  39. package/dist/errors.d.ts +46 -0
  40. package/dist/errors.d.ts.map +1 -0
  41. package/dist/execution-plan.d.ts +38 -0
  42. package/dist/execution-plan.d.ts.map +1 -0
  43. package/dist/failure.d.ts +14 -0
  44. package/dist/failure.d.ts.map +1 -0
  45. package/dist/family-mailbox.d.ts +60 -0
  46. package/dist/family-mailbox.d.ts.map +1 -0
  47. package/dist/file-ref.d.ts +6 -0
  48. package/dist/file-ref.d.ts.map +1 -0
  49. package/dist/image-attachments.d.ts +34 -0
  50. package/dist/image-attachments.d.ts.map +1 -0
  51. package/dist/index.d.ts +35 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +14387 -0
  54. package/dist/index.js.map +72 -0
  55. package/dist/inline-images.d.ts +28 -0
  56. package/dist/inline-images.d.ts.map +1 -0
  57. package/dist/message-authors.d.ts +34 -0
  58. package/dist/message-authors.d.ts.map +1 -0
  59. package/dist/message-times.d.ts +9 -0
  60. package/dist/message-times.d.ts.map +1 -0
  61. package/dist/model-adapters.d.ts +59 -0
  62. package/dist/model-adapters.d.ts.map +1 -0
  63. package/dist/model-lines.d.ts +16 -0
  64. package/dist/model-lines.d.ts.map +1 -0
  65. package/dist/prompt-cache.d.ts +28 -0
  66. package/dist/prompt-cache.d.ts.map +1 -0
  67. package/dist/requester.d.ts +15 -0
  68. package/dist/requester.d.ts.map +1 -0
  69. package/dist/run-agent-turn.d.ts +93 -0
  70. package/dist/run-agent-turn.d.ts.map +1 -0
  71. package/dist/run-child.d.ts +77 -0
  72. package/dist/run-child.d.ts.map +1 -0
  73. package/dist/run-conversation-turn.d.ts +42 -0
  74. package/dist/run-conversation-turn.d.ts.map +1 -0
  75. package/dist/run-credential.d.ts +22 -0
  76. package/dist/run-credential.d.ts.map +1 -0
  77. package/dist/run-environment.d.ts +145 -0
  78. package/dist/run-environment.d.ts.map +1 -0
  79. package/dist/run-fate.d.ts +15 -0
  80. package/dist/run-fate.d.ts.map +1 -0
  81. package/dist/run-files-lock.d.ts +16 -0
  82. package/dist/run-files-lock.d.ts.map +1 -0
  83. package/dist/run-sandbox.d.ts +60 -0
  84. package/dist/run-sandbox.d.ts.map +1 -0
  85. package/dist/run-subagent.d.ts +65 -0
  86. package/dist/run-subagent.d.ts.map +1 -0
  87. package/dist/run-workflow-agent-node.d.ts +46 -0
  88. package/dist/run-workflow-agent-node.d.ts.map +1 -0
  89. package/dist/sandbox-api-context.d.ts +34 -0
  90. package/dist/sandbox-api-context.d.ts.map +1 -0
  91. package/dist/sandbox-file-registry.d.ts +9 -0
  92. package/dist/sandbox-file-registry.d.ts.map +1 -0
  93. package/dist/sandbox-files.d.ts +71 -0
  94. package/dist/sandbox-files.d.ts.map +1 -0
  95. package/dist/sandbox-handle.d.ts +15 -0
  96. package/dist/sandbox-handle.d.ts.map +1 -0
  97. package/dist/sandbox-readiness.d.ts +8 -0
  98. package/dist/sandbox-readiness.d.ts.map +1 -0
  99. package/dist/skills/built-in.d.ts +15 -0
  100. package/dist/skills/built-in.d.ts.map +1 -0
  101. package/dist/subagent-context.d.ts +50 -0
  102. package/dist/subagent-context.d.ts.map +1 -0
  103. package/dist/subagent-continuation.d.ts +33 -0
  104. package/dist/subagent-continuation.d.ts.map +1 -0
  105. package/dist/subagent-inbox.d.ts +53 -0
  106. package/dist/subagent-inbox.d.ts.map +1 -0
  107. package/dist/subagent-tools.d.ts +293 -0
  108. package/dist/subagent-tools.d.ts.map +1 -0
  109. package/dist/thread-context.d.ts +17 -0
  110. package/dist/thread-context.d.ts.map +1 -0
  111. package/dist/tools/attachments.d.ts +11 -0
  112. package/dist/tools/attachments.d.ts.map +1 -0
  113. package/dist/tools/bash.d.ts +68 -0
  114. package/dist/tools/bash.d.ts.map +1 -0
  115. package/dist/tools/model-spec.d.ts +9 -0
  116. package/dist/tools/model-spec.d.ts.map +1 -0
  117. package/dist/tools/read.d.ts +43 -0
  118. package/dist/tools/read.d.ts.map +1 -0
  119. package/dist/tools/result-media.d.ts +65 -0
  120. package/dist/tools/result-media.d.ts.map +1 -0
  121. package/dist/tools/result-output.d.ts +18 -0
  122. package/dist/tools/result-output.d.ts.map +1 -0
  123. package/dist/tools/tool-files.d.ts +59 -0
  124. package/dist/tools/tool-files.d.ts.map +1 -0
  125. package/dist/tools/tool-outputs.d.ts +63 -0
  126. package/dist/tools/tool-outputs.d.ts.map +1 -0
  127. package/dist/tools/view-file.d.ts +40 -0
  128. package/dist/tools/view-file.d.ts.map +1 -0
  129. package/dist/tsconfig.json +5 -0
  130. package/dist/turn-runtime.d.ts +19 -0
  131. package/dist/turn-runtime.d.ts.map +1 -0
  132. package/dist/types.d.ts +83 -0
  133. package/dist/types.d.ts.map +1 -0
  134. package/dist/workflow-input-attachments.d.ts +18 -0
  135. package/dist/workflow-input-attachments.d.ts.map +1 -0
  136. package/package.json +59 -4
  137. package/src/abort.ts +40 -0
  138. package/src/agent-prompt.ts +860 -0
  139. package/src/agent-runtime/errors.ts +44 -0
  140. package/src/agent-runtime/preflight.ts +314 -0
  141. package/src/agent-runtime/profile.ts +23 -0
  142. package/src/artifacts/layout-check/check.cjs +478 -0
  143. package/src/artifacts/layout-check/layout-check.ts +460 -0
  144. package/src/artifacts/materialize.ts +380 -0
  145. package/src/artifacts/publish-tool.ts +700 -0
  146. package/src/ask-parent-tool.ts +100 -0
  147. package/src/attachments.ts +1041 -0
  148. package/src/child-files.ts +535 -0
  149. package/src/child-questions.ts +42 -0
  150. package/src/computer-runner.ts +336 -0
  151. package/src/context-budget.ts +177 -0
  152. package/src/context-compaction.ts +1349 -0
  153. package/src/context-guard.ts +826 -0
  154. package/src/conversation-memory.ts +45 -0
  155. package/src/conversation-messages.ts +86 -0
  156. package/src/errors.ts +85 -0
  157. package/src/execution-plan.ts +70 -0
  158. package/src/failure.ts +82 -0
  159. package/src/family-mailbox.ts +189 -0
  160. package/src/file-ref.ts +18 -0
  161. package/src/image-attachments.ts +322 -0
  162. package/src/index.ts +54 -0
  163. package/src/inline-images.ts +69 -0
  164. package/src/message-authors.ts +77 -0
  165. package/src/message-times.ts +24 -0
  166. package/src/model-adapters.ts +273 -0
  167. package/src/model-lines.ts +28 -0
  168. package/src/prompt-cache.ts +40 -0
  169. package/src/requester.ts +21 -0
  170. package/src/run-agent-turn.ts +509 -0
  171. package/src/run-child.ts +344 -0
  172. package/src/run-conversation-turn.ts +272 -0
  173. package/src/run-credential.ts +55 -0
  174. package/src/run-environment.ts +1216 -0
  175. package/src/run-fate.ts +51 -0
  176. package/src/run-files-lock.ts +118 -0
  177. package/src/run-sandbox.ts +63 -0
  178. package/src/run-subagent.ts +433 -0
  179. package/src/run-workflow-agent-node.ts +344 -0
  180. package/src/sandbox-api-context.ts +237 -0
  181. package/src/sandbox-file-registry.ts +26 -0
  182. package/src/sandbox-files.ts +326 -0
  183. package/src/sandbox-handle.ts +19 -0
  184. package/src/sandbox-readiness.ts +22 -0
  185. package/src/skills/built-in.ts +183 -0
  186. package/src/skills/sixb-artifacts/SKILL.md +95 -0
  187. package/src/skills/sixb-artifacts/canvas.md +104 -0
  188. package/src/skills/sixb-artifacts/document.md +63 -0
  189. package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/first-job.html +42 -0
  190. package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/region.html +29 -0
  191. package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/shared.css +35 -0
  192. package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/boards/welcome.html +31 -0
  193. package/src/skills/sixb-artifacts/examples/canvas/onboarding-flow/canvas.json +107 -0
  194. package/src/skills/sixb-artifacts/examples/canvas/retro/canvas.json +158 -0
  195. package/src/skills/sixb-artifacts/examples/document/incident-report/document.md +35 -0
  196. package/src/skills/sixb-artifacts/examples/document/operations-review/document.md +41 -0
  197. package/src/skills/sixb-artifacts/examples/document/operations-review/figures/restorations.svg +1 -0
  198. package/src/skills/sixb-artifacts/examples/page/collections-desk/index.html +169 -0
  199. package/src/skills/sixb-artifacts/examples/page/collections-desk/queries/overdue.json +13 -0
  200. package/src/skills/sixb-artifacts/examples/page/dispatch-board/data/dispatch.json +234 -0
  201. package/src/skills/sixb-artifacts/examples/page/dispatch-board/index.html +245 -0
  202. package/src/skills/sixb-artifacts/examples/page/fleet-planner/data/plan.json +53 -0
  203. package/src/skills/sixb-artifacts/examples/page/fleet-planner/index.html +462 -0
  204. package/src/skills/sixb-artifacts/examples/page/service-explorer/data/service.json +276 -0
  205. package/src/skills/sixb-artifacts/examples/page/service-explorer/index.html +549 -0
  206. package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/queries/overdue.json +13 -0
  207. package/src/skills/sixb-artifacts/examples/sheet/overdue-invoices/workbook.json +30 -0
  208. package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Inventory.csv +13 -0
  209. package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/sheets/Spend.csv +6 -0
  210. package/src/skills/sixb-artifacts/examples/sheet/parts-inventory/workbook.json +47 -0
  211. package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Quarters.csv +5 -0
  212. package/src/skills/sixb-artifacts/examples/sheet/service-metrics/sheets/Regions.csv +5 -0
  213. package/src/skills/sixb-artifacts/examples/sheet/service-metrics/workbook.json +78 -0
  214. package/src/skills/sixb-artifacts/examples/slides/launch-plan/index.html +63 -0
  215. package/src/skills/sixb-artifacts/examples/slides/q3-review/index.html +133 -0
  216. package/src/skills/sixb-artifacts/file.md +17 -0
  217. package/src/skills/sixb-artifacts/page.md +215 -0
  218. package/src/skills/sixb-artifacts/queries.md +66 -0
  219. package/src/skills/sixb-artifacts/references.md +68 -0
  220. package/src/skills/sixb-artifacts/sheet.md +223 -0
  221. package/src/skills/sixb-artifacts/slides.md +137 -0
  222. package/src/skills/sixb-memory/SKILL.md +68 -0
  223. package/src/skills/text-assets.d.ts +25 -0
  224. package/src/subagent-context.ts +182 -0
  225. package/src/subagent-continuation.ts +56 -0
  226. package/src/subagent-inbox.ts +101 -0
  227. package/src/subagent-tools.ts +1671 -0
  228. package/src/thread-context.ts +31 -0
  229. package/src/tools/attachments.ts +28 -0
  230. package/src/tools/bash.ts +233 -0
  231. package/src/tools/model-spec.ts +27 -0
  232. package/src/tools/read.ts +262 -0
  233. package/src/tools/result-media.ts +351 -0
  234. package/src/tools/result-output.ts +46 -0
  235. package/src/tools/tool-files.ts +204 -0
  236. package/src/tools/tool-outputs.ts +464 -0
  237. package/src/tools/view-file.ts +155 -0
  238. package/src/turn-runtime.ts +33 -0
  239. package/src/types.ts +91 -0
  240. package/src/workflow-input-attachments.ts +140 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-media.d.ts","sourceRoot":"","sources":["../../src/tools/result-media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAML,KAAK,8BAA8B,EACnC,8BAA8B,EAE/B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,KAAK,oBAAoB,EAAgC,MAAM,iBAAiB,CAAA;AAKzF,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;AAE7D,0DAA0D;AAC1D,UAAU,iBAAiB;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AASD,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;IACvC,QAAQ,CAAC,MAAM,EAAE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EAAE,CAAA;IAChD,QAAQ,CAAC,WAAW,EAAE,8BAA8B,CAAA;IACpD,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC,CAAA;IACrE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;CACnC,GACA,OAAO,CAAC,8BAA8B,CAAC,CAuDzC"}
@@ -0,0 +1,18 @@
1
+ import type { FileRef, JsonValue } from "@sixb/core";
2
+ import { type AgentRunFileStore } from "@sixb/core/internal/agents";
3
+ export type AgentToolModelOutput = {
4
+ readonly type: "text";
5
+ readonly value: string;
6
+ } | {
7
+ readonly type: "json";
8
+ readonly value: JsonValue;
9
+ };
10
+ /** Convert a durable Sixb tool result into bounded, provider-safe model-facing output. */
11
+ export declare function agentToolResultToModelOutput(input: {
12
+ readonly output: JsonValue;
13
+ readonly blobStorage: AgentRunFileStore;
14
+ readonly signal?: AbortSignal;
15
+ readonly sandboxPathForFileRef?: (fileRef: FileRef) => string | undefined | Promise<string | undefined>;
16
+ readonly imageOmissionNote?: string;
17
+ }): Promise<AgentToolModelOutput>;
18
+ //# sourceMappingURL=result-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-output.d.ts","sourceRoot":"","sources":["../../src/tools/result-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,4BAA4B,CAAA;AAGtF,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAA;AAExD,0FAA0F;AAC1F,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,qBAAqB,CAAC,EAAE,CAC/B,OAAO,EAAE,OAAO,KACb,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CACpC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4BhC"}
@@ -0,0 +1,59 @@
1
+ import type { AgentToolFile, AgentToolFiles } from "@sixb/core";
2
+ import { AGENT_FILE_MAX_BYTES, type AgentRunFileStore, type AgentToolCallFile } from "@sixb/core/internal/agents";
3
+ import type { AgentSandboxHandle } from "../sandbox-handle";
4
+ export { AGENT_FILE_MAX_BYTES };
5
+ interface CreateAgentToolFilesInput {
6
+ readonly toolName: string;
7
+ readonly toolCallId: string;
8
+ readonly signal: AbortSignal;
9
+ readonly blobStorage: AgentRunFileStore;
10
+ readonly resolveSandbox: () => Promise<AgentSandboxHandle>;
11
+ readonly onPublished?: (file: AgentToolFile) => void;
12
+ /** Shared across every tool call in one run so parallel publishers cannot oversubscribe it. */
13
+ readonly budget?: AgentFileBudget;
14
+ /** Test seam; production allows {@link AGENT_FILE_MAX_BYTES}. */
15
+ readonly fileMaxBytes?: number;
16
+ }
17
+ /** Atomic byte budget shared by every file publisher in one agent run. */
18
+ export declare class AgentFileBudget {
19
+ #private;
20
+ readonly maxBytes: number;
21
+ constructor(maxBytes?: number);
22
+ get reservedBytes(): number;
23
+ reserve(bytes: number, toolName: string): AgentFileReservation;
24
+ add(bytes: number, toolName: string): void;
25
+ release(bytes: number): void;
26
+ /** Counts content's bytes when no reservation holds the same digest yet, and nothing after. */
27
+ holdContent(digest: string, sizeBytes: number, toolName: string): void;
28
+ releaseContent(digest: string): void;
29
+ }
30
+ declare class AgentFileReservation {
31
+ #private;
32
+ private readonly budget;
33
+ private readonly toolName;
34
+ constructor(budget: AgentFileBudget, bytes: number, toolName: string);
35
+ add(bytes: number): void;
36
+ /** Reserves bytes whose SHA-256 is `digest`, unless the run already counts the same content. */
37
+ addContent(digest: string, sizeBytes: number): void;
38
+ release(): void;
39
+ }
40
+ /**
41
+ * The file publisher of one of the harness's own tool calls: each file is stored as a project
42
+ * tool's is, counted against the run's budget, and copied into the sandbox at its path.
43
+ */
44
+ export declare function createAgentToolFiles(input: CreateAgentToolFilesInput): AgentToolFiles;
45
+ /**
46
+ * Copy the files a project tool stored into the sandbox, at the paths it was told, each counted
47
+ * against the run's budget as the harness's own tools' files are. The call stored no more than the
48
+ * budget had left when it started.
49
+ */
50
+ export declare function installAgentToolFiles(input: {
51
+ readonly toolName: string;
52
+ readonly files: readonly AgentToolCallFile[];
53
+ readonly blobStorage: AgentRunFileStore;
54
+ readonly resolveSandbox: () => Promise<AgentSandboxHandle>;
55
+ readonly budget: AgentFileBudget;
56
+ readonly signal: AbortSignal;
57
+ readonly onPublished?: (file: AgentToolFile) => void;
58
+ }): Promise<void>;
59
+ //# sourceMappingURL=tool-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-files.d.ts","sourceRoot":"","sources":["../../src/tools/tool-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAyB,cAAc,EAAE,MAAM,YAAY,CAAA;AAEtF,OAAO,EACL,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAG/B,UAAU,yBAAyB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM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,EAAE,yBAAyB,GAAG,cAAc,CAyBrF;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC1D,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAA;CACrD,GAAG,OAAO,CAAC,IAAI,CAAC,CAehB"}
@@ -0,0 +1,63 @@
1
+ import { type AgentRunFileStore, type AgentToolCallFile } from "@sixb/core/internal/agents";
2
+ import { type ModelTool } from "@sixb/core/models";
3
+ import type { AgentMessageRecord } from "@sixb/core/storage";
4
+ import { type AgentSandboxHandle } from "../sandbox-handle";
5
+ import { AgentFileBudget } from "./tool-files";
6
+ /**
7
+ * Past this, a tool's output reaches the model as a preview, and the whole of it as a file in the
8
+ * sandbox that the agent reads in pieces or searches: one result then never takes more than a few
9
+ * KB of the context, and nothing past a cap is lost.
10
+ */
11
+ export declare const TOOL_OUTPUT_FILE_MIN_BYTES: number;
12
+ /** Where saved outputs go, in the context directory: `$SIXB_TOOL_OUTPUTS_DIR`. */
13
+ export declare const TOOL_OUTPUTS_DIRECTORY = "tool-outputs";
14
+ /**
15
+ * What one run may save, apart from the run's file budget that published artifacts and
16
+ * file-returning tools take: saving gives way first, its outputs left to the copy their message
17
+ * keeps. Identical outputs count once.
18
+ */
19
+ export declare const TOOL_OUTPUTS_MAX_BYTES: number;
20
+ /**
21
+ * The run's tools, each saving an output too large for the context: stored as a file of its run,
22
+ * like a tool's own files, and copied into the sandbox at `tool-outputs/<call id>-<digest>.txt`.
23
+ * The model reads a preview with that path; the call's message part keeps a bounded copy of the
24
+ * output and the stored file as its `outputFile` ({@link fileOf}), which every later run writes
25
+ * back ({@link restoreSavedToolOutputs}). Saving that fails leaves the output as the part keeps it.
26
+ */
27
+ export declare class ToolOutputFiles {
28
+ #private;
29
+ private readonly input;
30
+ constructor(input: {
31
+ readonly sandbox: () => Promise<AgentSandboxHandle>;
32
+ readonly blobStorage: Pick<AgentRunFileStore, "put">;
33
+ /** Test seam; production holds {@link TOOL_OUTPUTS_MAX_BYTES}, never the run's own budget. */
34
+ readonly budget?: AgentFileBudget;
35
+ });
36
+ wrap(tools: readonly ModelTool[]): ModelTool[];
37
+ /** The stored file of a call whose output was saved, for its message part. */
38
+ fileOf(toolCallId: string): AgentToolCallFile | undefined;
39
+ private saving;
40
+ private save;
41
+ }
42
+ /**
43
+ * The outputs a history saved, to write back: the newest within
44
+ * {@link RESTORED_OUTPUTS_MAX_BYTES}, by the size they declare, listed oldest first so that a
45
+ * later one at the same path is written last. Only a file of the shape the harness names is: the
46
+ * stored messages are a runner's, or a fork's copy of them.
47
+ */
48
+ export declare function savedToolOutputFiles(messages: readonly AgentMessageRecord[]): AgentToolCallFile[];
49
+ /**
50
+ * Write the saved outputs back into a run's sandbox: those it does not hold already, as a
51
+ * workspace that persists does, read from the store a few at a time, oldest first. A file is read
52
+ * no further than the size it declares, so the bytes read stay within what
53
+ * {@link savedToolOutputFiles} counted; one that cannot be read, or holds more, is left out.
54
+ */
55
+ export declare function restoreSavedToolOutputs(input: {
56
+ readonly handle: AgentSandboxHandle;
57
+ readonly files: readonly AgentToolCallFile[];
58
+ readonly blobStorage: Pick<AgentRunFileStore, "open">;
59
+ readonly signal: AbortSignal;
60
+ }): Promise<void>;
61
+ /** The path a tool result's text names when it is the preview of a saved output. */
62
+ export declare function savedToolOutputPath(text: string): string | undefined;
63
+ //# sourceMappingURL=tool-outputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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E,kBAAkB,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC5C,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAA;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAoCD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,40 @@
1
+ import type { AgentToolFiles, JsonValue } from "@sixb/core";
2
+ import type { ModelTool } from "@sixb/core/models";
3
+ import type { PreparedAgentAttachmentContext } from "../attachments";
4
+ import type { AgentSandboxFileRegistry } from "../sandbox-file-registry";
5
+ import type { AgentSandboxHandle } from "../sandbox-handle";
6
+ import type { AgentToolModelOutput } from "./result-output";
7
+ export declare const VIEW_FILE_TOOL_SPEC: {
8
+ readonly name: "view_file";
9
+ readonly description: "Inspect a file in the current run sandbox. Use this for historical attachments and files created by bash. Paths must stay inside the working directory or the run's context directory. Images are prepared for visual input when supported; other formats return bounded text or metadata.";
10
+ readonly inputSchema: {
11
+ type: string;
12
+ properties: {
13
+ path: {
14
+ type: string;
15
+ minLength: number;
16
+ };
17
+ };
18
+ required: string[];
19
+ additionalProperties: false;
20
+ };
21
+ };
22
+ interface ViewFileInput {
23
+ readonly path: string;
24
+ }
25
+ export declare function createViewFileTool(input: {
26
+ readonly resolveSandbox: () => Promise<AgentSandboxHandle>;
27
+ readonly attachments: PreparedAgentAttachmentContext;
28
+ readonly registry: AgentSandboxFileRegistry;
29
+ readonly filesForToolCall: (options: {
30
+ readonly toolCallId: string;
31
+ readonly signal: AbortSignal;
32
+ }) => AgentToolFiles;
33
+ readonly toolResultToModelOutput: (input: {
34
+ readonly output: JsonValue;
35
+ readonly signal: AbortSignal;
36
+ readonly toolCallId: string;
37
+ }) => AgentToolModelOutput | Promise<AgentToolModelOutput>;
38
+ }): ModelTool<ViewFileInput>;
39
+ export {};
40
+ //# sourceMappingURL=view-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-file.d.ts","sourceRoot":"","sources":["../../src/tools/view-file.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAW,SAAS,EAAE,MAAM,YAAY,CAAA;AAGpE,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAA;AAExE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAK3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAUtB,CAAA;AAEV,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,QAAQ,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAC1D,QAAQ,CAAC,WAAW,EAAE,8BAA8B,CAAA;IACpD,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAA;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE;QACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;QAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;KAC7B,KAAK,cAAc,CAAA;IACpB,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE;QACxC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;QAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;QAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAC5B,KAAK,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;CAC3D,GAAG,SAAS,CAAC,aAAa,CAAC,CAiD3B"}
@@ -0,0 +1,5 @@
1
+ // Written by scripts/build-package.ts, and published on purpose.
2
+ // Bun applies the nearest tsconfig paths map to every import it resolves, node_modules
3
+ // included. An empty map here keeps a consumer's aliases from sending a module in this
4
+ // directory back into a second copy of its own source.
5
+ { "compilerOptions": { "paths": {} } }
@@ -0,0 +1,19 @@
1
+ export interface AgentTurnRuntime {
2
+ /** Worker shutdown, queue-lease loss, and user cancellation. */
3
+ readonly sourceSignal: AbortSignal;
4
+ /** The run's signal: `sourceSignal`, and the run's end. */
5
+ readonly signal: AbortSignal;
6
+ /** Surface lost ownership or cancellation before another durable action. */
7
+ readonly assertCanContinue: () => void;
8
+ /** End the run: aborts `signal`, so a tool call that outlived it stops calling models. */
9
+ dispose(): void;
10
+ }
11
+ /**
12
+ * The run's signal, shared by its compaction and its answer. A run has no time or step limit: it
13
+ * ends when the model answers, when it is cancelled, or when its runner loses it. Its model records
14
+ * each call itself, so a call that could not be admitted or recorded fails where it was made.
15
+ */
16
+ export declare function createAgentTurnRuntime(input: {
17
+ readonly signal: AbortSignal;
18
+ }): AgentTurnRuntime;
19
+ //# sourceMappingURL=turn-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-runtime.d.ts","sourceRoot":"","sources":["../src/turn-runtime.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAA;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAA;IACtC,0FAA0F;IAC1F,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAAG,gBAAgB,CAchG"}
@@ -0,0 +1,83 @@
1
+ import type { AuthorizablePrincipal } from "@sixb/core";
2
+ import type { AgentRunFileStore, AgentSystemPromptSize, AgentToolCallFile, RunModelLoopInput } from "@sixb/core/internal/agents";
3
+ import type { ModelTool } from "@sixb/core/models";
4
+ import type { PreparedAgentAttachmentContext } from "./attachments";
5
+ import type { AgentRequester } from "./requester";
6
+ import type { BeforeFinalizeOptions } from "./run-sandbox";
7
+ import type { AgentSandboxHandle } from "./sandbox-handle";
8
+ import type { AgentFileBudget } from "./tools/tool-files";
9
+ /**
10
+ * What every run of a project shares, whichever runner runs it: its settings. A run reaches the
11
+ * project through its session, never through storage, the project's SDK or its definitions.
12
+ */
13
+ export interface AgentRunSettings {
14
+ /** The project id. */
15
+ readonly id: string;
16
+ /** The Sixb API origin the run's commands call, through their environment's credentialed address. */
17
+ readonly apiBaseUrl: string;
18
+ /** How many children one conversation turn may have queued or running at once. */
19
+ readonly subagentConcurrencyPerRun: number;
20
+ /** Whether a child keeps its workspace between runs: its environment can be resumed. */
21
+ readonly keepsChildWorkspaces: boolean;
22
+ /** Project locale and time zone, for runs that do not carry the requester's own. */
23
+ readonly locale: string;
24
+ readonly timeZone: string;
25
+ }
26
+ /** A run's settings, with who it works for and where its files are stored. */
27
+ export interface AgentExecutionContext extends AgentRunSettings {
28
+ readonly authorPrincipal?: AuthorizablePrincipal;
29
+ /**
30
+ * Who the run works for; absent when no principal started its chain of executions, or in a
31
+ * shared thread, where each user message names its author instead.
32
+ */
33
+ readonly requester?: AgentRequester;
34
+ readonly blobStorage: AgentRunFileStore;
35
+ }
36
+ export interface AgentTurnContext {
37
+ /** Environment-owned failure (for example lost source credentials), not user cancellation. */
38
+ readonly environmentFailureSignal?: AbortSignal;
39
+ /** Persistent environments must confirm cleanup/save before any terminal write. */
40
+ readonly beforeFinalize?: (options?: BeforeFinalizeOptions) => Promise<void>;
41
+ readonly id: string;
42
+ readonly authorPrincipal?: AuthorizablePrincipal;
43
+ readonly blobStorage: AgentRunFileStore;
44
+ /** The Sixb API the run's commands call, when this turn was created through a run environment. */
45
+ readonly apiBaseUrl?: string;
46
+ readonly tools: readonly ModelTool[];
47
+ /** The stored file of a call whose output was too large for the context, for its message. */
48
+ readonly outputFileOf?: (toolCallId: string) => AgentToolCallFile | undefined;
49
+ readonly prepareStep?: RunModelLoopInput["prepareStep"];
50
+ /** Complete worker-owned system prompt, derived from the mode and provisioned runtime. */
51
+ readonly systemPrompt: string;
52
+ /** The same prompt with each section's bytes, for each step to record what its request sent. */
53
+ readonly systemPromptSize?: AgentSystemPromptSize;
54
+ /** Where the run's context files are, as the agent names them: its reads of them are named. */
55
+ readonly contextDirectory?: string;
56
+ /** Time zone and locale of runs that captured none, used to date their user messages. */
57
+ readonly projectTimeZone: string;
58
+ readonly projectLocale: string;
59
+ /** Prepared by the run's environment, which materializes the files in its context directory. */
60
+ readonly attachmentContext?: PreparedAgentAttachmentContext;
61
+ /**
62
+ * The concurrently provisioning sandbox, exposed so the turn can fail if it rejects. Resolved
63
+ * value is irrelevant here (the sandbox tools consume the handle); only its rejection matters.
64
+ */
65
+ readonly sandboxReady?: Promise<AgentSandboxHandle>;
66
+ }
67
+ /**
68
+ * A run's sandbox and its stored files, as its framework tools use them: a parent hands files to
69
+ * its children and gets theirs back, a child returns what it wrote.
70
+ */
71
+ export interface AgentRunFiles {
72
+ sandbox(): Promise<AgentSandboxHandle>;
73
+ readonly blobStorage: AgentRunFileStore;
74
+ /** Shared with every other file the run stores. */
75
+ readonly budget: AgentFileBudget;
76
+ /**
77
+ * Install the latest version of each artifact these runs published in the thread in the run's
78
+ * `$SIXB_ARTIFACTS`; nothing for a run that installs no artifacts. Throws, naming them, when
79
+ * some could not be installed.
80
+ */
81
+ installArtifactsFrom(runIds: readonly string[], signal: AbortSignal): Promise<void>;
82
+ }
83
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.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;IAChC;;;;OAIG;IACH,oBAAoB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpF"}
@@ -0,0 +1,18 @@
1
+ import type { FileRef } from "@sixb/core";
2
+ import type { AgentRunFileStore } from "@sixb/core/internal/agents";
3
+ import type { WorkflowIOSnapshot } from "@sixb/core/internal/workflows";
4
+ import type { PreparedAgentAttachmentContext } from "./attachments";
5
+ /** Materialize nested FileRefs from a workflow input into the headless task sandbox. */
6
+ export declare function prepareWorkflowInputAttachments(input: {
7
+ readonly input: WorkflowIOSnapshot;
8
+ readonly blobStorage: AgentRunFileStore;
9
+ /** Where the run's files go: the input's files are materialized in it. */
10
+ readonly contextDirectory: string;
11
+ readonly signal?: AbortSignal;
12
+ }): Promise<PreparedAgentAttachmentContext>;
13
+ /** Every FileRef in a workflow input, keyed by its path such as `input.documents[0]`. */
14
+ export declare function workflowInputFileRefs(input: WorkflowIOSnapshot): readonly {
15
+ readonly path: string;
16
+ readonly fileRef: FileRef;
17
+ }[];
18
+ //# sourceMappingURL=workflow-input-attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-input-attachments.d.ts","sourceRoot":"","sources":["../src/workflow-input-attachments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAA;AAKnE,wFAAwF;AACxF,wBAAsB,+BAA+B,CAAC,KAAK,EAAE;IAC3D,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAA;IAClC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAA;IACvC,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAmD1C;AAED,yFAAyF;AACzF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,kBAAkB,GACxB,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,CAIjE"}
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@sixb/agent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "The Sixb agent harness: one loop, prompt and tools for every runner",
5
+ "keywords": [
6
+ "sixb",
7
+ "agent"
8
+ ],
9
+ "homepage": "https://sixb.ai",
10
+ "bugs": {
11
+ "url": "https://github.com/sixb-ai/sixb/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/sixb-ai/sixb.git",
16
+ "directory": "packages/agent"
17
+ },
18
+ "author": "Sixb contributors",
19
+ "type": "module",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "bun": "./src/index.ts",
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.js"
28
+ }
29
+ },
30
+ "scripts": {
31
+ "build": "bun ../../scripts/build-package.ts",
32
+ "typecheck": "tsc --noEmit",
33
+ "test": "bun test",
34
+ "test:e2e": "bun ../../scripts/ci-guard.ts --stall 120 --max 300 bun test ./tests/layout-check.e2e.ts",
35
+ "prepack": "bun run build"
36
+ },
37
+ "peerDependencies": {
38
+ "@sixb/core": "0.2.0"
39
+ },
40
+ "devDependencies": {
41
+ "@sixb/core": "0.2.0",
42
+ "@types/bun": "latest",
43
+ "typescript": "^5.7.0"
44
+ },
45
+ "license": "MIT",
46
+ "engines": {
47
+ "bun": ">=1.4.2"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "files": [
53
+ "dist",
54
+ "src",
55
+ "README.md",
56
+ "LICENSE"
57
+ ],
58
+ "dependencies": {
59
+ "@sixb/cli-core": "^0.2.0"
60
+ }
61
+ }
package/src/abort.ts ADDED
@@ -0,0 +1,40 @@
1
+ export const NEVER_ABORTED_SIGNAL = new AbortController().signal
2
+
3
+ /** Await a promise while allowing a signal to stop waiting for providers without cancellation. */
4
+ export function waitForAbort<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {
5
+ if (!signal) return promise
6
+ signal.throwIfAborted()
7
+ return new Promise<T>((resolve, reject) => {
8
+ const onAbort = (): void => reject(signal.reason)
9
+ signal.addEventListener("abort", onAbort, { once: true })
10
+ promise.then(
11
+ (value) => {
12
+ signal.removeEventListener("abort", onAbort)
13
+ resolve(value)
14
+ },
15
+ (error) => {
16
+ signal.removeEventListener("abort", onAbort)
17
+ reject(error)
18
+ }
19
+ )
20
+ })
21
+ }
22
+
23
+ /** Wait `ms`, or until `wake` settles, or until the signal aborts, rejecting with its reason. */
24
+ export function delay(ms: number, signal: AbortSignal, wake?: Promise<void>): Promise<void> {
25
+ signal.throwIfAborted()
26
+ return new Promise((resolve, reject) => {
27
+ const timer = setTimeout(finish, ms)
28
+ void wake?.then(finish)
29
+ function finish(): void {
30
+ clearTimeout(timer)
31
+ signal.removeEventListener("abort", abort)
32
+ resolve()
33
+ }
34
+ function abort(): void {
35
+ clearTimeout(timer)
36
+ reject(signal.reason)
37
+ }
38
+ signal.addEventListener("abort", abort, { once: true })
39
+ })
40
+ }