buckyos 0.7.169 → 0.7.175

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 (233) hide show
  1. package/cli/core/app.ts +2 -0
  2. package/cli/core/argv.ts +45 -239
  3. package/cli/core/command.ts +3 -35
  4. package/cli/dist/cli.mjs +2151 -673
  5. package/cli/dist/cli.mjs.map +1 -1
  6. package/cli/modules/agent.ts +3 -1
  7. package/cli/modules/app.ts +13 -2
  8. package/cli/modules/pikg.ts +70 -1
  9. package/cli/modules/runtime.ts +497 -0
  10. package/cli/modules/skill.ts +583 -161
  11. package/cli/modules/skill_lint.ts +462 -0
  12. package/cli/version.ts +1 -1
  13. package/dist/account-7a7bde6f.mjs +105 -0
  14. package/dist/account-7a7bde6f.mjs.map +1 -0
  15. package/dist/account-b12ac6b9.js +2 -0
  16. package/dist/account-b12ac6b9.js.map +1 -0
  17. package/dist/aicc-67851c41.mjs +582 -0
  18. package/dist/aicc-67851c41.mjs.map +1 -0
  19. package/dist/aicc-ccb36ef7.js +2 -0
  20. package/dist/aicc-ccb36ef7.js.map +1 -0
  21. package/dist/app-frame.cjs +1 -1
  22. package/dist/app-frame.cjs.map +1 -1
  23. package/dist/app-frame.mjs +1 -0
  24. package/dist/app-frame.mjs.map +1 -1
  25. package/dist/browser.cjs +1 -1
  26. package/dist/browser.cjs.map +1 -1
  27. package/dist/browser.d.ts +3 -1
  28. package/dist/browser.d.ts.map +1 -1
  29. package/dist/browser.mjs +223 -212
  30. package/dist/browser.mjs.map +1 -1
  31. package/dist/content.cjs +1 -1
  32. package/dist/content.cjs.map +1 -1
  33. package/dist/content.d.ts +2 -1
  34. package/dist/content.d.ts.map +1 -1
  35. package/dist/content.mjs +32 -167
  36. package/dist/content.mjs.map +1 -1
  37. package/dist/content_mime-dc80d960.js +2 -0
  38. package/dist/content_mime-dc80d960.js.map +1 -0
  39. package/dist/content_mime-e42d5f8d.mjs +335 -0
  40. package/dist/content_mime-e42d5f8d.mjs.map +1 -0
  41. package/dist/content_mime.d.ts +18 -0
  42. package/dist/content_mime.d.ts.map +1 -1
  43. package/dist/did_object_client-6a1b108a.js +2 -0
  44. package/dist/did_object_client-6a1b108a.js.map +1 -0
  45. package/dist/did_object_client-7fa36f90.mjs +87 -0
  46. package/dist/did_object_client-7fa36f90.mjs.map +1 -0
  47. package/dist/did_object_client.d.ts +39 -0
  48. package/dist/did_object_client.d.ts.map +1 -0
  49. package/dist/{executor_client-a32bc377.mjs → executor_client-c620d25c.mjs} +1794 -844
  50. package/dist/executor_client-c620d25c.mjs.map +1 -0
  51. package/dist/executor_client-d4439d54.js +13 -0
  52. package/dist/executor_client-d4439d54.js.map +1 -0
  53. package/dist/executor_client.d.ts +129 -0
  54. package/dist/executor_client.d.ts.map +1 -1
  55. package/dist/file_meta.d.ts +26 -0
  56. package/dist/file_meta.d.ts.map +1 -0
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.d.ts +3 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.mjs +228 -217
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/internal/command_args.d.ts +67 -0
  64. package/dist/internal/command_args.d.ts.map +1 -0
  65. package/dist/krpc_client-26c2dc8b.js +2 -0
  66. package/dist/krpc_client-26c2dc8b.js.map +1 -0
  67. package/dist/krpc_client-673448e5.mjs +173 -0
  68. package/dist/krpc_client-673448e5.mjs.map +1 -0
  69. package/dist/krpc_client.d.ts +5 -1
  70. package/dist/krpc_client.d.ts.map +1 -1
  71. package/dist/msg_center_client.d.ts +2 -1
  72. package/dist/msg_center_client.d.ts.map +1 -1
  73. package/dist/namelib.d.ts.map +1 -1
  74. package/dist/ndm_client.d.ts +7 -0
  75. package/dist/ndm_client.d.ts.map +1 -1
  76. package/dist/ndn.d.ts +3 -0
  77. package/dist/ndn.d.ts.map +1 -0
  78. package/dist/{namelib-b41b10cc.mjs → ndn_types-0fac2499.mjs} +3096 -2816
  79. package/dist/ndn_types-0fac2499.mjs.map +1 -0
  80. package/dist/ndn_types-5b138882.js +2 -0
  81. package/dist/ndn_types-5b138882.js.map +1 -0
  82. package/dist/ndn_types.d.ts +268 -16
  83. package/dist/ndn_types.d.ts.map +1 -1
  84. package/dist/node.cjs +1 -1
  85. package/dist/node.cjs.map +1 -1
  86. package/dist/node.d.ts +1 -1
  87. package/dist/node.d.ts.map +1 -1
  88. package/dist/node.mjs +220 -212
  89. package/dist/node.mjs.map +1 -1
  90. package/dist/object_url-8fb5a7bf.js +2 -0
  91. package/dist/object_url-8fb5a7bf.js.map +1 -0
  92. package/dist/object_url-f72c1704.mjs +412 -0
  93. package/dist/object_url-f72c1704.mjs.map +1 -0
  94. package/dist/openai-ae2978de.mjs +163 -0
  95. package/dist/openai-ae2978de.mjs.map +1 -0
  96. package/dist/openai-f560d518.js +2 -0
  97. package/dist/openai-f560d518.js.map +1 -0
  98. package/dist/provision.cjs +6 -6
  99. package/dist/provision.cjs.map +1 -1
  100. package/dist/provision.d.ts +1 -2
  101. package/dist/provision.d.ts.map +1 -1
  102. package/dist/provision.mjs +4 -31
  103. package/dist/provision.mjs.map +1 -1
  104. package/dist/repo_client.d.ts +2 -1
  105. package/dist/repo_client.d.ts.map +1 -1
  106. package/dist/site_manager-11a7a468.mjs +6410 -0
  107. package/dist/site_manager-11a7a468.mjs.map +1 -0
  108. package/dist/site_manager-334b1a51.js +2 -0
  109. package/dist/site_manager-334b1a51.js.map +1 -0
  110. package/dist/{tus_client-4f7254e9.js → tus_client-809c90ab.js} +2 -2
  111. package/dist/{tus_client-4f7254e9.js.map → tus_client-809c90ab.js.map} +1 -1
  112. package/dist/{tus_client-04080b1e.mjs → tus_client-893a3287.mjs} +2 -2
  113. package/dist/{tus_client-04080b1e.mjs.map → tus_client-893a3287.mjs.map} +1 -1
  114. package/dist/xllm/core/action_parser.d.ts +15 -0
  115. package/dist/xllm/core/action_parser.d.ts.map +1 -0
  116. package/dist/xllm/core/behavior_loop.d.ts +20 -0
  117. package/dist/xllm/core/behavior_loop.d.ts.map +1 -0
  118. package/dist/xllm/core/behavior_result.d.ts +11 -0
  119. package/dist/xllm/core/behavior_result.d.ts.map +1 -0
  120. package/dist/xllm/core/config.d.ts +62 -0
  121. package/dist/xllm/core/config.d.ts.map +1 -0
  122. package/dist/xllm/core/context_window.d.ts +15 -0
  123. package/dist/xllm/core/context_window.d.ts.map +1 -0
  124. package/dist/xllm/core/deps.d.ts +97 -0
  125. package/dist/xllm/core/deps.d.ts.map +1 -0
  126. package/dist/xllm/core/errors.d.ts +94 -0
  127. package/dist/xllm/core/errors.d.ts.map +1 -0
  128. package/dist/xllm/core/interrupt.d.ts +31 -0
  129. package/dist/xllm/core/interrupt.d.ts.map +1 -0
  130. package/dist/xllm/core/json.d.ts +11 -0
  131. package/dist/xllm/core/json.d.ts.map +1 -0
  132. package/dist/xllm/core/json_check.d.ts +17 -0
  133. package/dist/xllm/core/json_check.d.ts.map +1 -0
  134. package/dist/xllm/core/loop.d.ts +135 -0
  135. package/dist/xllm/core/loop.d.ts.map +1 -0
  136. package/dist/xllm/core/messages.d.ts +18 -0
  137. package/dist/xllm/core/messages.d.ts.map +1 -0
  138. package/dist/xllm/core/observer.d.ts +14 -0
  139. package/dist/xllm/core/observer.d.ts.map +1 -0
  140. package/dist/xllm/core/open_runtime.d.ts +22 -0
  141. package/dist/xllm/core/open_runtime.d.ts.map +1 -0
  142. package/dist/xllm/core/prepare.d.ts +54 -0
  143. package/dist/xllm/core/prepare.d.ts.map +1 -0
  144. package/dist/xllm/core/prompt.d.ts +40 -0
  145. package/dist/xllm/core/prompt.d.ts.map +1 -0
  146. package/dist/xllm/core/protocol.d.ts +15 -0
  147. package/dist/xllm/core/protocol.d.ts.map +1 -0
  148. package/dist/xllm/core/result.d.ts +12 -0
  149. package/dist/xllm/core/result.d.ts.map +1 -0
  150. package/dist/xllm/core/run.d.ts +198 -0
  151. package/dist/xllm/core/run.d.ts.map +1 -0
  152. package/dist/xllm/core/rust_text.d.ts +20 -0
  153. package/dist/xllm/core/rust_text.d.ts.map +1 -0
  154. package/dist/xllm/core/site_policy.d.ts +5 -0
  155. package/dist/xllm/core/site_policy.d.ts.map +1 -0
  156. package/dist/xllm/core/store.d.ts +60 -0
  157. package/dist/xllm/core/store.d.ts.map +1 -0
  158. package/dist/xllm/core/suspension.d.ts +13 -0
  159. package/dist/xllm/core/suspension.d.ts.map +1 -0
  160. package/dist/xllm/core/tokenizer.d.ts +8 -0
  161. package/dist/xllm/core/tokenizer.d.ts.map +1 -0
  162. package/dist/xllm/core/types.d.ts +826 -0
  163. package/dist/xllm/core/types.d.ts.map +1 -0
  164. package/dist/xllm/core/xml.d.ts +19 -0
  165. package/dist/xllm/core/xml.d.ts.map +1 -0
  166. package/dist/xllm/dev/openai.d.ts +17 -0
  167. package/dist/xllm/dev/openai.d.ts.map +1 -0
  168. package/dist/xllm/dev/scripted.d.ts +46 -0
  169. package/dist/xllm/dev/scripted.d.ts.map +1 -0
  170. package/dist/xllm/dev.d.ts +5 -0
  171. package/dist/xllm/dev.d.ts.map +1 -0
  172. package/dist/xllm/hosts/browser/store.d.ts +41 -0
  173. package/dist/xllm/hosts/browser/store.d.ts.map +1 -0
  174. package/dist/xllm/hosts/deno/deno_api.d.ts +103 -0
  175. package/dist/xllm/hosts/deno/deno_api.d.ts.map +1 -0
  176. package/dist/xllm/hosts/deno/identity.d.ts +29 -0
  177. package/dist/xllm/hosts/deno/identity.d.ts.map +1 -0
  178. package/dist/xllm/hosts/deno/index.d.ts +47 -0
  179. package/dist/xllm/hosts/deno/index.d.ts.map +1 -0
  180. package/dist/xllm/hosts/deno/native_runtime.d.ts +93 -0
  181. package/dist/xllm/hosts/deno/native_runtime.d.ts.map +1 -0
  182. package/dist/xllm/hosts/deno/native_tools.d.ts +105 -0
  183. package/dist/xllm/hosts/deno/native_tools.d.ts.map +1 -0
  184. package/dist/xllm/hosts/deno/provider.d.ts +13 -0
  185. package/dist/xllm/hosts/deno/provider.d.ts.map +1 -0
  186. package/dist/xllm/hosts/deno/store.d.ts +60 -0
  187. package/dist/xllm/hosts/deno/store.d.ts.map +1 -0
  188. package/dist/xllm/index.d.ts +48 -0
  189. package/dist/xllm/index.d.ts.map +1 -0
  190. package/dist/xllm/providers/aicc.d.ts +22 -0
  191. package/dist/xllm/providers/aicc.d.ts.map +1 -0
  192. package/dist/xllm/providers/timeout.d.ts +12 -0
  193. package/dist/xllm/providers/timeout.d.ts.map +1 -0
  194. package/dist/xllm/runtime/compress.d.ts +149 -0
  195. package/dist/xllm/runtime/compress.d.ts.map +1 -0
  196. package/dist/xllm/runtime/did_object_resources.d.ts +21 -0
  197. package/dist/xllm/runtime/did_object_resources.d.ts.map +1 -0
  198. package/dist/xllm/runtime/hints.d.ts +23 -0
  199. package/dist/xllm/runtime/hints.d.ts.map +1 -0
  200. package/dist/xllm/runtime/site.d.ts +22 -0
  201. package/dist/xllm/runtime/site.d.ts.map +1 -0
  202. package/dist/xllm/runtime/site_manager.d.ts +38 -0
  203. package/dist/xllm/runtime/site_manager.d.ts.map +1 -0
  204. package/dist/xllm/runtime/site_tools.d.ts +76 -0
  205. package/dist/xllm/runtime/site_tools.d.ts.map +1 -0
  206. package/dist/xllm/runtime/step_renderer.d.ts +54 -0
  207. package/dist/xllm/runtime/step_renderer.d.ts.map +1 -0
  208. package/dist/xllm/runtime/task_model.d.ts +64 -0
  209. package/dist/xllm/runtime/task_model.d.ts.map +1 -0
  210. package/dist/xllm/runtime/tool_result.d.ts +39 -0
  211. package/dist/xllm/runtime/tool_result.d.ts.map +1 -0
  212. package/dist/xllm/runtime/types.d.ts +99 -0
  213. package/dist/xllm/runtime/types.d.ts.map +1 -0
  214. package/dist/xllm.cjs +2 -0
  215. package/dist/xllm.cjs.map +1 -0
  216. package/dist/xllm.mjs +1167 -0
  217. package/dist/xllm.mjs.map +1 -0
  218. package/dist/xllm_deno.cjs +2 -0
  219. package/dist/xllm_deno.cjs.map +1 -0
  220. package/dist/xllm_deno.mjs +2487 -0
  221. package/dist/xllm_deno.mjs.map +1 -0
  222. package/dist/xllm_dev.cjs +2 -0
  223. package/dist/xllm_dev.cjs.map +1 -0
  224. package/dist/xllm_dev.mjs +70 -0
  225. package/dist/xllm_dev.mjs.map +1 -0
  226. package/package.json +22 -1
  227. package/src/internal/command_args.ts +268 -0
  228. package/dist/executor_client-a32bc377.mjs.map +0 -1
  229. package/dist/executor_client-e026942b.js +0 -13
  230. package/dist/executor_client-e026942b.js.map +0 -1
  231. package/dist/namelib-b41b10cc.mjs.map +0 -1
  232. package/dist/namelib-f8ff0045.js +0 -2
  233. package/dist/namelib-f8ff0045.js.map +0 -1
@@ -0,0 +1,13 @@
1
+ import type { LlmClient, ProviderConfig, SecretRef } from '../../core/types';
2
+ export declare const SESSION_TOKEN_ENV = "BUCKYOS_APPCLIENT_SESSION_TOKEN";
3
+ /**
4
+ * `SecretRef::resolve`. A `config_file` reference is re-read; the Deno host
5
+ * reads JSON configuration files (a reference into a YAML `.llm_context`
6
+ * written by Rust is a `capability` error here).
7
+ */
8
+ export declare function resolveSecret(ref: SecretRef): Promise<string>;
9
+ /** A client whose every request is refused as `credentials` (no session on this host). */
10
+ export declare function credentialsRefusedClient(message: string): LlmClient;
11
+ /** The model client of `provider` on this host. */
12
+ export declare function createLlmClient(provider: ProviderConfig): Promise<LlmClient>;
13
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/xllm/hosts/deno/provider.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAS5E,eAAO,MAAM,iBAAiB,oCAAoC,CAAA;AAElE;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBnE;AAED,0FAA0F;AAC1F,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAOnE;AAmBD,mDAAmD;AACnD,wBAAsB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CA+BlF"}
@@ -0,0 +1,60 @@
1
+ import type { LLMContextSnapshot, RunRecord, RunsDirSetting } from '../../core/types';
2
+ import type { ExportedRun, RunLock, RunStore } from '../../core/store';
3
+ /** `DEFAULT_RUNS_DIR` / `DEFAULT_LOCK_DIR`. */
4
+ export declare const DEFAULT_RUNS_DIR = "~/.xllm/runs";
5
+ export declare const DEFAULT_LOCK_DIR = "~/.xllm/locks";
6
+ /** `resolve_config_path`: `~` is the home directory, an absolute path stays, a relative one is under `baseDir`. */
7
+ export declare function resolveHostPath(raw: string, baseDir: string): string;
8
+ /**
9
+ * Where the runs of a configuration go: `runs_dir` of the `.llm_context`
10
+ * (`none` → `undefined`, a memory store), else `~/.xllm/runs`. `origin` is
11
+ * the configuration's path (relative `runs_dir` is relative to its
12
+ * directory).
13
+ */
14
+ export declare function runsDirOf(setting: RunsDirSetting | undefined, origin: string): string | undefined;
15
+ /** A held flock; `release` (or process exit) frees it. */
16
+ export declare class FileLock implements RunLock {
17
+ private readonly file;
18
+ readonly path: string;
19
+ private released;
20
+ private constructor();
21
+ /** Non-blocking (`FileLock::try_acquire`): `null` when another open file holds it. */
22
+ static tryAcquire(path: string): Promise<FileLock | null>;
23
+ release(): Promise<void>;
24
+ }
25
+ /** Some open file holds the flock at `path` (`is_run_live`). */
26
+ export declare function isLocked(path: string): Promise<boolean>;
27
+ export declare class FileRunStore implements RunStore {
28
+ readonly persistent = true;
29
+ private readonly dir;
30
+ /** `runsDir`: absolute, or relative to the current directory; `~` is the home directory. */
31
+ constructor(runsDir: string);
32
+ runsDir(): string;
33
+ runDir(runId: string): string;
34
+ /** The runs directory can be created and written (`ensure_writable`). */
35
+ ensureWritable(): Promise<void>;
36
+ createRun(): Promise<string>;
37
+ writeRecord(record: RunRecord): Promise<void>;
38
+ /** Rejects with `run_not_found`, `not_resumable` (another record version, like Rust) or `corrupted_run`. */
39
+ readRecord(runId: string): Promise<RunRecord>;
40
+ listRecords(): Promise<RunRecord[]>;
41
+ putSnapshot(runId: string, snapshot: LLMContextSnapshot): Promise<number>;
42
+ getSnapshot(runId: string, idx: number): Promise<LLMContextSnapshot>;
43
+ listSnapshots(runId: string): Promise<number[]>;
44
+ /** The run's execution lock (`<run>/.lock`), `null` when another process (or open file) holds it. */
45
+ lockRun(runId: string): Promise<FileLock | null>;
46
+ /** Some process holds the run's `.lock` (`is_run_live`). */
47
+ isRunLive(runId: string): Promise<boolean>;
48
+ /** Delete the run directory; the caller holds its lock and has nothing unreconciled in flight. */
49
+ removeRun(runId: string): Promise<void>;
50
+ /** Write a run exported from another store: same id, same snapshot indices. */
51
+ importRun(run: ExportedRun): Promise<void>;
52
+ }
53
+ /**
54
+ * `XllmDeps.lockWorkdir` of a host with a filesystem: the flock
55
+ * `<lockDir>/<blake3(workdir)[..24]>.lock`, the run id written into it.
56
+ */
57
+ export declare function workdirLocker(lockDir?: string): (workdir: string, runId: string) => Promise<RunLock | null>;
58
+ /** `XllmDeps.workdirExists`. */
59
+ export declare function workdirExists(workdir: string): Promise<boolean>;
60
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/xllm/hosts/deno/store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGrF,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAMtE,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,iBAAiB,CAAA;AAC9C,eAAO,MAAM,gBAAgB,kBAAkB,CAAA;AAE/C,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAA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E,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAepE,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAerD,qGAAqG;IACrG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAIhD,4DAA4D;IACtD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKhD,kGAAkG;IAC5F,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7C,+EAA+E;IACzE,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAcjD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAyB,aAEvC,MAAM,SAAS,MAAM,KAAG,QAAQ,OAAO,GAAG,IAAI,CAAC,CAKvE;AAED,gCAAgC;AAChC,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/D"}
@@ -0,0 +1,48 @@
1
+ export * from './core/types';
2
+ export { LLMComputeException, XllmError, asComputeError, computeErrorMessage, errorSource, infraRetrySafe, llmCorrectable, providerError, } from './core/errors';
3
+ export type { XllmErrorDetail, XllmErrorKind } from './core/errors';
4
+ export { LLMContext, SNAPSHOT_FORMAT_VERSION, stateFromRequest } from './core/loop';
5
+ export { LLMContextInterruptHandle } from './core/interrupt';
6
+ export { ToolDispatchException, allowAllPolicy, noopWorklog, resolveToolSpecs, MAX_INJECTIONS_PER_BOUNDARY } from './core/deps';
7
+ export type { CheckpointHook, LLMContextDeps, LLMResultParser, OutputValidator, PolicyEngine, StepRenderer, ToolCallCtx, ToolManager, WorklogSink, } from './core/deps';
8
+ export { ByteHeuristicTokenizer } from './core/tokenizer';
9
+ export { parseReply, validateJson } from './core/json_check';
10
+ export { DEFAULT_CONTEXT_YIELD_RATIO, DEFAULT_LLM_TIMEOUT_SECS, DEFAULT_MAX_CONSECUTIVE_ERRORS, DEFAULT_MAX_TOOL_ITERATIONS, DEFAULT_TASK_WAIT_MS, DEFAULT_TIMEOUT_SECS, MAX_IN_TOOL_WAIT_MS, computeToolsConfig, mergeConfigLayers, parseLlmContextJson, } from './core/config';
11
+ export type { MergedConfig } from './core/config';
12
+ export { TemplateEnv, assemblePrompt } from './core/prompt';
13
+ export { RUNTIME_PROTOCOL_VERSION, buildCmdManualSystemText, buildRulesSystemText, buildRuntimeProtocol, buildRuntimeProtocolFor } from './core/protocol';
14
+ export { MemoryRunStore, RUN_RECORD_VERSION, exportRun, generateRunId, importRun } from './core/store';
15
+ export type { ExportedRun, RunLock, RunStore } from './core/store';
16
+ export { extractResult } from './core/result';
17
+ export { XllmActionParser, REPORT_ARTIFACTS_KEY, reportArtifacts, splitReportResult } from './core/action_parser';
18
+ export { materializeHistory, renderStepHistory, rewritableHistory } from './core/behavior_loop';
19
+ export { charCount, rustTrim, rustTrimEnd, rustTrimStart, serdeJson } from './core/rust_text';
20
+ export { HOST_PROMPT_SECTIONS_ALL, HOST_PROMPT_SECTIONS_NONE, REFUSED_CREDENTIALS, XllmInterrupter, XllmRun, XllmTask, classifyError, inFlightCall, isTerminal, runRequest, } from './core/run';
21
+ export type { HostedTask, PreparedTask, ResumeLimits, ResumeStart, RunOutcome, StartOptions, XllmDeps } from './core/run';
22
+ export { MAX_IMAGE_ATTACHMENT_BYTES, MAX_TEXT_ATTACHMENT_BYTES } from './core/prepare';
23
+ export type { Attachment, TaskInput, TaskOverrides } from './core/prepare';
24
+ export { createSiteRuntime, SITE_RUNTIME_KIND } from './runtime/site';
25
+ export type { SiteRuntime, SiteRuntimeOptions } from './runtime/site';
26
+ export { unresolvedReason } from './runtime/types';
27
+ export type { AgentRuntime, OpenedTools, RunBinding, RunToolManager, RuntimeOpenCtx, SiteTool, SiteToolCtx, SiteToolSpec, } from './runtime/types';
28
+ export { SiteToolManager, envelopeObservation, isIdempotent } from './runtime/site_manager';
29
+ export { AGENT_TOOL_PROTOCOL_VERSION, asToolResult, observationText, toHost } from './runtime/tool_result';
30
+ export type { AgentToolResult, AgentToolStatus, ResultDedup, ResultHint } from './runtime/tool_result';
31
+ export { XmlStepRenderer, toolResultViewFromHost } from './runtime/step_renderer';
32
+ export type { HintView, ToolResultStatusView, ToolResultView, XmlStepRendererOptions } from './runtime/step_renderer';
33
+ export { LlmSummarizeCompressor, SUMMARIZE_MODEL_ALIAS, compactionTargetTokens, compress, compressHistory, compressOptions, isSummaryMessage, parseSummaryMessage, summaryMessage, summaryModel, } from './runtime/compress';
34
+ export type { CompressDeps, CompressOptions, CompressOutcome, CompressReport, CompressStrategy, CompressedSummary } from './runtime/compress';
35
+ export { HINT_NS_DEDUP, HINT_NS_ONCE, MemoryHintLedger, applyHints, renderHintBlock, renderWithHints } from './runtime/hints';
36
+ export type { HintLedger } from './runtime/hints';
37
+ export { followupGeneralHint, followupHint, inCallWaitMs, resultView, taskStateObservation, waitUntilMs, } from './runtime/task_model';
38
+ export type { RunningTaskResolver, TaskBrief, TaskFollowup, TaskResult, TaskState } from './runtime/task_model';
39
+ export { ACTION_RISKS, MAX_RESULT_BYTES, XCALL_USAGE, normalizeUri, pageText, siteTools } from './runtime/site_tools';
40
+ export type { ActionDecl, ActionRisk, CommandDecl, ResourceDecl, ResourceMatch, SiteToolsOptions, Versioned, WriteBody, } from './runtime/site_tools';
41
+ export { INDEX_TRAIT_URI, didObjectResources, renderObjectDocument } from './runtime/did_object_resources';
42
+ export type { DidObjectReader, DidObjectResourcesOptions } from './runtime/did_object_resources';
43
+ export { DIDObjectClient, DIDObjectError } from '../did_object_client';
44
+ export type { DIDObjectCard, DIDObjectClientOptions } from '../did_object_client';
45
+ export { IndexedDbRunStore, XLLM_RUNS_DB } from './hosts/browser/store';
46
+ export { AiccLlmClient, aiccProviderFailure, anyJsonObjectSchema, providerErrorFromRpc } from './providers/aicc';
47
+ export { TimeoutLlmClient } from './providers/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AAY,EACV,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,GACzG,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAC1G,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACtE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,22 @@
1
+ import type { AiccClient, AiccError } from '../../aicc_client';
2
+ import type { AiResponse, JsonValue, LlmClient, LlmInferenceRequest, ProviderFailure } from '../core/types';
3
+ import { LLMComputeException } from '../core/errors';
4
+ export declare const REFUSED_QUOTA_EXHAUSTED = "quota_exhausted";
5
+ export declare const REFUSED_QUOTA_BUDGET_EXCEEDED = "quota_budget_exceeded";
6
+ export declare const REFUSED_RESOURCE_NOT_PERMITTED = "resource_not_permitted";
7
+ export declare const REFUSED_ATTRIBUTION_UNAVAILABLE = "attribution_unavailable";
8
+ /** The service refused the caller's credentials: sign in again, then resume. */
9
+ export declare const REFUSED_CREDENTIALS = "credentials";
10
+ /** `force_json` without a schema: any JSON object (a bare `{"type":"object"}` gets `{}` from Gemini). */
11
+ export declare function anyJsonObjectSchema(): JsonValue;
12
+ /** Failure class of an AICC error, `undefined` when the error does not say. */
13
+ export declare function aiccProviderFailure(error: Partial<AiccError>): ProviderFailure | undefined;
14
+ /** A failed AICC call (a rejected kRPC call) as a provider error. */
15
+ export declare function providerErrorFromRpc(context: string, err: unknown): LLMComputeException;
16
+ /** `LlmClient` over the page's AICC client. */
17
+ export declare class AiccLlmClient implements LlmClient {
18
+ private readonly client;
19
+ constructor(client: AiccClient);
20
+ infer(req: LlmInferenceRequest): Promise<AiResponse>;
21
+ }
22
+ //# sourceMappingURL=aicc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aicc.d.ts","sourceRoot":"","sources":["../../../src/xllm/providers/aicc.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,UAAU,EAAE,SAAS,EAEtB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC3G,OAAO,EAAE,mBAAmB,EAAiB,MAAM,gBAAgB,CAAA;AAGnE,eAAO,MAAM,uBAAuB,oBAAoB,CAAA;AACxD,eAAO,MAAM,6BAA6B,0BAA0B,CAAA;AACpE,eAAO,MAAM,8BAA8B,2BAA2B,CAAA;AACtE,eAAO,MAAM,+BAA+B,4BAA4B,CAAA;AACxE,gFAAgF;AAChF,eAAO,MAAM,mBAAmB,gBAAgB,CAAA;AAIhD,yGAAyG;AACzG,wBAAgB,mBAAmB,IAAI,SAAS,CAE/C;AAMD,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,SAAS,CAQ1F;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAoBvF;AAWD,+CAA+C;AAC/C,qBAAa,aAAc,YAAW,SAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEzC,KAAK,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;CAiE3D"}
@@ -0,0 +1,12 @@
1
+ import type { AiResponse, LlmClient, LlmInferenceRequest } from '../core/types';
2
+ export declare class TimeoutLlmClient implements LlmClient {
3
+ private readonly inner;
4
+ private readonly timeoutMs;
5
+ private callCount;
6
+ private model;
7
+ constructor(inner: LlmClient, timeoutMs: number);
8
+ calls(): number;
9
+ lastModel(): string | undefined;
10
+ infer(req: LlmInferenceRequest): Promise<AiResponse>;
11
+ }
12
+ //# sourceMappingURL=timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../../src/xllm/providers/timeout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAI/E,qBAAa,gBAAiB,YAAW,SAAS;IAIpC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAa,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHzE,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,KAAK,CAAoB;gBAEJ,KAAK,EAAE,SAAS,EAAmB,SAAS,EAAE,MAAM;IAEjF,KAAK,IAAI,MAAM;IAIf,SAAS,IAAI,MAAM,GAAG,SAAS;IAIzB,KAAK,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;CAuB3D"}
@@ -0,0 +1,149 @@
1
+ import type { AiMessage, EffectiveConfig, JsonValue, LlmClient, RunLimits, Tokenizer } from '../core/types';
2
+ /** AICC alias of the summary model. */
3
+ export declare const SUMMARIZE_MODEL_ALIAS = "llm.summarize";
4
+ /** Model-written fields (assistant text, tool call arguments) reach the summarizer up to this many chars each. */
5
+ export declare const REPORT_CHARS = 4096;
6
+ /** Rendered history one summary call takes at most; a larger range is folded chunk by chunk. */
7
+ export declare const DEFAULT_SUMMARY_CHUNK_TOKENS = 100000;
8
+ /** `max_completion_tokens` of one summary call; also what a rewrite reserves for the summary block. */
9
+ export declare const SUMMARY_MAX_TOKENS = 6144;
10
+ /** Upper bound of the rendered keep_exact block. */
11
+ export declare const KEEP_EXACT_MAX_TOKENS = 2048;
12
+ export declare const MAX_FOLD_PASSES = 4;
13
+ /** A behavior step's results message (user role) belongs to the step's round. */
14
+ export declare const STEP_RESULTS_PREFIX = "<<last_step_action_results";
15
+ /** Compaction target when the window is unknown. */
16
+ export declare const DEFAULT_AUTO_COMPRESS_TARGET_TOKENS = 32768;
17
+ /** With a known window, compaction lands at 30% of it. */
18
+ export declare const DEFAULT_CONTEXT_TARGET_RATIO = 0.3;
19
+ /** What one compression aims at (`CompressOptions`). */
20
+ export interface CompressOptions {
21
+ /** Estimated tokens (the waist's estimator) the returned history should fit in. */
22
+ target_token_budget: number;
23
+ model_alias: string;
24
+ /** Appended to the summarizer's system prompt. */
25
+ extra_focus_prompt?: string;
26
+ /** A fixed line rendered after the keep_exact block (never summarized). */
27
+ note?: string;
28
+ summary_chunk_tokens: number;
29
+ }
30
+ /** `CompressOptions::new`. */
31
+ export declare function compressOptions(targetTokenBudget: number, modelAlias: string): CompressOptions;
32
+ /** The summary block: summary text plus the strings kept verbatim (omitted when none). */
33
+ export interface CompressedSummary {
34
+ summary: string;
35
+ keep_exact?: string[];
36
+ }
37
+ export type CompressStrategy = 'unchanged' | 'llm' | 'no_range';
38
+ /** What a compression did (Rust logs it as `llm_compress.completed`). */
39
+ export interface CompressReport {
40
+ /** `unchanged` (within the target) | `llm` | `no_range` (nothing between head and tail, or the system prefix alone is over the target). */
41
+ strategy: CompressStrategy;
42
+ prompt_version: string;
43
+ model_alias: string;
44
+ target_tokens: number;
45
+ tokens_before: number;
46
+ tokens_after: number;
47
+ head_messages: number;
48
+ head_tokens: number;
49
+ /** Input messages folded into the summary: `[range_start, range_end)`. */
50
+ range_start: number;
51
+ range_end: number;
52
+ range_rounds: number;
53
+ range_tokens: number;
54
+ previous_summary: boolean;
55
+ tail_rounds: number;
56
+ tail_tokens: number;
57
+ summary_calls: number;
58
+ summary_tokens: number;
59
+ keep_exact: number;
60
+ memory_candidates: number;
61
+ reached_target: boolean;
62
+ elapsed_ms: number;
63
+ }
64
+ export interface CompressOutcome {
65
+ messages: AiMessage[];
66
+ /** Input messages `[..head_end]` are kept as they are (system prefix + head). */
67
+ head_end: number;
68
+ /** Input messages `[tail_start..]` are kept as they are (raw tail). */
69
+ tail_start: number;
70
+ /** The new summary block (absent: nothing was summarized). */
71
+ summary?: CompressedSummary;
72
+ /** keep_exact entries pushed out by the cap, and the summarizer's memory candidates. */
73
+ memory_candidates: JsonValue[];
74
+ report: CompressReport;
75
+ }
76
+ /** What compression uses of the context's deps (an `LLMContextDeps` fits). */
77
+ export interface CompressDeps {
78
+ llm: LlmClient;
79
+ tokenizer?: Tokenizer;
80
+ /** Aborts the summary inferences; Rust gives them no interrupt handle (default: never aborts). */
81
+ signal?: AbortSignal;
82
+ }
83
+ export type UnitKind = 'round' | 'summary';
84
+ export interface Unit {
85
+ start: number;
86
+ end: number;
87
+ kind: UnitKind;
88
+ }
89
+ /** Compress `history` to `targetTokenBudget`; the messages only (`compress`). */
90
+ export declare function compress(history: AiMessage[], deps: CompressDeps, targetTokenBudget: number, modelAlias: string, extraFocusPrompt?: string): Promise<AiMessage[]>;
91
+ /**
92
+ * Compress `history` into `system + head + [summary] + keep_exact + note +
93
+ * raw tail` within `opts.target_token_budget` (`compress_history`).
94
+ *
95
+ * Returned as is: an empty history, one within the target, or one with
96
+ * nothing between head and tail to summarize (`no_range`). A summarizer
97
+ * failure (provider error, empty summary) rejects with its `LLMComputeException`.
98
+ */
99
+ export declare function compressHistory(history: AiMessage[], deps: CompressDeps, opts: CompressOptions): Promise<CompressOutcome>;
100
+ /** The summary block as one user message (`summary_message`). */
101
+ export declare function summaryMessage(summary: CompressedSummary, note?: string): AiMessage;
102
+ /** The summary block of a message rendered by `summaryMessage` (`parse_summary_message`). */
103
+ export declare function parseSummaryMessage(message: AiMessage): CompressedSummary | undefined;
104
+ /** A user message whose first text block opens a summary block (`is_summary_message`). */
105
+ export declare function isSummaryMessage(message: AiMessage): boolean;
106
+ /** `render_keep_exact`. */
107
+ export declare function renderKeepExact(entries: string[]): string;
108
+ /**
109
+ * Rounds and summary messages of `history` from `start` (after the system
110
+ * prefix). A round is an assistant message with its tool results (or a
111
+ * behavior step with its results message) and the user input right after
112
+ * them; leading user messages (the opening input) join the first round, and
113
+ * a user message after an assistant's final reply opens a new round.
114
+ */
115
+ export declare function segment(history: AiMessage[], start: number): Unit[];
116
+ /**
117
+ * Append new verbatim entries to `keep` (whitespace normalized, exact
118
+ * duplicates skipped); the oldest entries beyond the cap become memory
119
+ * candidates (`merge_keep_exact`).
120
+ */
121
+ export declare function mergeKeepExact(keep: string[], entries: Iterable<string>, tokenizer: Tokenizer, candidates: JsonValue[]): void;
122
+ /**
123
+ * The run's compactor (`LlmSummarizeCompressor`): summarizes with the run's
124
+ * client and appends the note that the run's files are intact. A failure
125
+ * rejects with an `XllmError` of kind `compressor`.
126
+ */
127
+ export declare class LlmSummarizeCompressor {
128
+ readonly llm: LlmClient;
129
+ readonly modelAlias: string;
130
+ readonly targetTokenBudget: number;
131
+ readonly tokenizer: Tokenizer;
132
+ /** The run's workdir, named in the note (Rust: the `dir` of `Compressor::compress`). */
133
+ readonly workdir: string;
134
+ readonly signal?: AbortSignal | undefined;
135
+ constructor(llm: LlmClient, modelAlias: string, targetTokenBudget: number, tokenizer: Tokenizer,
136
+ /** The run's workdir, named in the note (Rust: the `dir` of `Compressor::compress`). */
137
+ workdir: string, signal?: AbortSignal | undefined);
138
+ compress(history: AiMessage[]): Promise<AiMessage[]>;
139
+ }
140
+ /**
141
+ * Compaction target of a run (`compaction_target_tokens`): 30% of the
142
+ * window, at most `DEFAULT_AUTO_COMPRESS_TARGET_TOKENS` and at most half the
143
+ * yield threshold, so a compaction lands well below the line that triggered
144
+ * it. The ratios are f32 in Rust; `Math.fround` reproduces the rounding.
145
+ */
146
+ export declare function compactionTargetTokens(limits: Pick<RunLimits, 'context_window_tokens' | 'context_yield_ratio'>): number;
147
+ /** The summary model of a run (`EffectiveConfig::summary_model`): `llm.summarize` via AICC, the run's model for OpenAI. */
148
+ export declare function summaryModel(config: Pick<EffectiveConfig, 'provider' | 'model'>): string;
149
+ //# sourceMappingURL=compress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/compress.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAuB,SAAS,EAAE,SAAS,EACvG,MAAM,eAAe,CAAA;AAStB,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,kBAAkB,CAAA;AACpD,kHAAkH;AAClH,eAAO,MAAM,YAAY,OAAO,CAAA;AAChC,gGAAgG;AAChG,eAAO,MAAM,4BAA4B,SAAU,CAAA;AACnD,uGAAuG;AACvG,eAAO,MAAM,kBAAkB,OAAO,CAAA;AACtC,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,OAAO,CAAA;AAKzC,eAAO,MAAM,eAAe,IAAI,CAAA;AAMhC,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAE/D,oDAAoD;AACpD,eAAO,MAAM,mCAAmC,QAAS,CAAA;AACzD,0DAA0D;AAC1D,eAAO,MAAM,4BAA4B,MAAM,CAAA;AAoB/C,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,mFAAmF;IACnF,mBAAmB,EAAE,MAAM,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAA;IACnB,kDAAkD;IAClD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oBAAoB,EAAE,MAAM,CAAA;CAC7B;AAED,8BAA8B;AAC9B,wBAAgB,eAAe,CAAC,iBAAiB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,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EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAatH;AA0CD;;;;GAIG;AACH,qBAAa,sBAAsB;IAE/B,QAAQ,CAAC,GAAG,EAAE,SAAS;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS;IAC7B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,MAAM,CAAC;gBANP,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EACzB,SAAS,EAAE,SAAS;IAC7B,wFAAwF;IAC/E,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,yBAAa;IAGzB,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,uBAAuB,GAAG,qBAAqB,CAAC,GAAG,MAAM,CAOvH;AAED,2HAA2H;AAC3H,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG,MAAM,CAExF"}
@@ -0,0 +1,21 @@
1
+ import type { JsonValue } from '../core/types';
2
+ import type { DIDObjectClient } from '../../did_object_client';
3
+ import type { ActionRisk, ResourceDecl } from './site_tools';
4
+ export declare const INDEX_TRAIT_URI = "https://buckyos.org/traits/index@1";
5
+ /** What `didObjectResources` needs of a DID Object client. */
6
+ export type DidObjectReader = Pick<DIDObjectClient, 'card' | 'profile' | 'readProperty' | 'invoke'>;
7
+ export interface DidObjectResourcesOptions {
8
+ client: DidObjectReader;
9
+ /** Object URLs (`obj://…`) the page lets the model reach. */
10
+ roots: string[];
11
+ /** Actions above this risk are not exposed (default `read_only`). */
12
+ maxRisk?: ActionRisk;
13
+ }
14
+ /** The object document a read shows (as `render_object_document` in agent-did-object-lib). */
15
+ export declare function renderObjectDocument(canonical: string, card: {
16
+ id: string;
17
+ alsoKnownAs?: string[];
18
+ }, profile: JsonValue, summary: Record<string, JsonValue>): string;
19
+ /** Resources for `siteTools({ resources })` from the Profiles of `roots`. */
20
+ export declare function didObjectResources(options: DidObjectResourcesOptions): Promise<Record<string, ResourceDecl>>;
21
+ //# sourceMappingURL=did_object_resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did_object_resources.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/did_object_resources.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D,OAAO,KAAK,EAAc,UAAU,EAAE,YAAY,EAAiB,MAAM,cAAc,CAAA;AAEvF,eAAO,MAAM,eAAe,uCAAuC,CAAA;AAEnE,8DAA8D;AAC9D,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAA;AAEnG,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,eAAe,CAAA;IACvB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,UAAU,CAAA;CACrB;AAWD,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,OAAO,EAAE,SAAS,EACtH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,CA4B5C;AAOD,6EAA6E;AAC7E,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CA6ClH"}
@@ -0,0 +1,23 @@
1
+ import type { AgentToolResult } from './tool_result';
2
+ export declare const HINT_NS_ONCE = "once";
3
+ export declare const HINT_NS_DEDUP = "dedup";
4
+ export interface HintLedger {
5
+ seen(ns: string, key: string): boolean;
6
+ mark(ns: string, key: string): void;
7
+ clear(ns: string): void;
8
+ keys(ns: string): string[];
9
+ }
10
+ export declare class MemoryHintLedger implements HintLedger {
11
+ private readonly inner;
12
+ static seeded(ns: string, keys: Iterable<string>): MemoryHintLedger;
13
+ seen(ns: string, key: string): boolean;
14
+ mark(ns: string, key: string): void;
15
+ clear(ns: string): void;
16
+ keys(ns: string): string[];
17
+ }
18
+ /** Apply the ledger to `result` (mutated): dedup replacement, `once` filtering; returns the hint texts to show. */
19
+ export declare function applyHints(result: AgentToolResult, ledger: HintLedger): string[];
20
+ export declare function renderHintBlock(hints: string[]): string;
21
+ /** The result text with the hints after it (`<output>` / `<runtime_hints>`). */
22
+ export declare function renderWithHints(text: string, hints: string[]): string;
23
+ //# sourceMappingURL=hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/hints.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAGpD,eAAO,MAAM,YAAY,SAAS,CAAA;AAClC,eAAO,MAAM,aAAa,UAAU,CAAA;AAEpC,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;IACtC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B;AAED,qBAAa,gBAAiB,YAAW,UAAU;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IAEvD,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,gBAAgB;IAMnE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAItC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAM5B,KAAK,CAAC,EAAE,EAAE,MAAM;IAIhB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE;CAG3B;AAED,mHAAmH;AACnH,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,CAuBhF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAIvD;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAGrE"}
@@ -0,0 +1,22 @@
1
+ import type { AgentRuntime, SiteTool } from './types';
2
+ export declare const SITE_RUNTIME_KIND = "site";
3
+ export interface SiteRuntimeOptions {
4
+ /** The scene name, e.g. `aiws.wish`: part of the runtime's identity. */
5
+ scene: string;
6
+ /** The page's origin (passed in: the runtime never reads `location`). */
7
+ origin: string;
8
+ hostname: string;
9
+ /** Every tool of this scene. */
10
+ tools: Record<string, SiteTool>;
11
+ /** What `{{env.NAME}}` may read. */
12
+ env?: Record<string, string>;
13
+ /** `runtime.task_wait_ms` (in-call wait budget for tasks, M2). */
14
+ task_wait_ms?: number;
15
+ }
16
+ export interface SiteRuntime extends AgentRuntime {
17
+ readonly scene: string;
18
+ /** The scene's tools, by name. */
19
+ readonly tools: ReadonlyMap<string, SiteTool>;
20
+ }
21
+ export declare function createSiteRuntime(options: SiteRuntimeOptions): SiteRuntime;
22
+ //# sourceMappingURL=site.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/site.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAA2C,QAAQ,EAAE,MAAM,SAAS,CAAA;AAI9F,eAAO,MAAM,iBAAiB,SAAS,CAAA;AAIvC,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC/B,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAC9C;AAeD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAiG1E"}
@@ -0,0 +1,38 @@
1
+ import type { AiToolCall, JsonValue, Observation, ToolSpecLite } from '../core/types';
2
+ import type { ToolCallCtx } from '../core/deps';
3
+ import type { RunBinding, RunToolManager, SiteTool } from './types';
4
+ import type { AgentToolResult } from './tool_result';
5
+ import type { HintLedger } from './hints';
6
+ import type { RunningTaskResolver } from './task_model';
7
+ export declare function isIdempotent(tool: SiteTool, args: Record<string, JsonValue>): boolean;
8
+ /** The observation of an envelope, hints shown after its text (`map_result_to_observation_with_hints`). */
9
+ export declare function envelopeObservation(callId: string, result: AgentToolResult, hints: string[]): Observation;
10
+ export interface SiteManagerOptions {
11
+ /** The run's task backend (`XllmDeps.tasks`): pending results are waited for through it. */
12
+ tasks?: RunningTaskResolver;
13
+ /** In-call wait budget for a pending task (`runtime.task_wait_ms`). */
14
+ taskWaitMs?: number;
15
+ hints?: HintLedger;
16
+ }
17
+ export declare class SiteToolManager implements RunToolManager {
18
+ private readonly tools;
19
+ private readonly options;
20
+ private binding;
21
+ private recovering;
22
+ private readonly ledger;
23
+ private readonly taskWaitMs;
24
+ constructor(tools: Map<string, SiteTool>, options?: SiteManagerOptions);
25
+ bindRun(binding: RunBinding): void;
26
+ setRecovering(callId: string, reason: string): void;
27
+ artifacts(): string[];
28
+ has(name: string): boolean;
29
+ hintLedger(): HintLedger;
30
+ clearDedup(): void;
31
+ taskResolver(): RunningTaskResolver | undefined;
32
+ listToolSpecs(): ToolSpecLite[];
33
+ private takeRecovering;
34
+ callTool(call: AiToolCall, ctx: ToolCallCtx): Promise<Observation>;
35
+ /** A pending result: wait in the call within the budget, then the task's state. */
36
+ private waitPending;
37
+ }
38
+ //# sourceMappingURL=site_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site_manager.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/site_manager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAK/C,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAe,MAAM,SAAS,CAAA;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,cAAc,CAAA;AA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
1
+ import type { JsonValue } from '../core/types';
2
+ import type { SiteTool, SiteToolCtx } from './types';
3
+ import type { AccessLevel, JsonSchema, OptionDefinition, PositionalDefinition } from '../../internal/command_args';
4
+ export type ActionRisk = 'read_only' | 'idempotent_write' | 'write' | 'destructive' | 'admin';
5
+ export declare const ACTION_RISKS: ActionRisk[];
6
+ export declare const XCALL_USAGE = "xcall <object> <action> [--params <json>] [key=value ...] [--key=value ...]";
7
+ /** Result text cap of `read` (one page) and `exec`. */
8
+ export declare const MAX_RESULT_BYTES: number;
9
+ /** What a resource method gets: the URI as normalized, the `{name}` parameters, the query. */
10
+ export interface ResourceMatch {
11
+ uri: string;
12
+ pattern: string;
13
+ params: Record<string, string>;
14
+ query: URLSearchParams;
15
+ ctx: SiteToolCtx;
16
+ }
17
+ /** A read may return a version: `write` (and the default `edit`) gets it back as `ifVersion`. */
18
+ export interface Versioned {
19
+ content: unknown;
20
+ version?: string;
21
+ }
22
+ export interface WriteBody {
23
+ content: string;
24
+ mode: 'write' | 'new' | 'append';
25
+ ifVersion?: string;
26
+ }
27
+ export interface ActionDecl {
28
+ description: string;
29
+ risk: ActionRisk;
30
+ /** JSON Schema of the params. */
31
+ input?: JsonValue;
32
+ call(m: ResourceMatch, params: Record<string, JsonValue>): unknown;
33
+ }
34
+ export interface ResourceDecl {
35
+ description: string;
36
+ read?(m: ResourceMatch): unknown;
37
+ write?(m: ResourceMatch, body: WriteBody): unknown;
38
+ edit?(m: ResourceMatch, body: {
39
+ old_string: string;
40
+ new_string: string;
41
+ }): unknown;
42
+ actions?: Record<string, ActionDecl>;
43
+ }
44
+ /** A page command: a subset of the CLI `CommandDefinition`; `call(input)` replaces its handler. */
45
+ export interface CommandDecl {
46
+ summary: string;
47
+ description?: string;
48
+ positionals?: PositionalDefinition[];
49
+ options?: OptionDefinition[];
50
+ inputSchema?: JsonSchema;
51
+ access?: {
52
+ mode: 'fixed';
53
+ level: AccessLevel;
54
+ };
55
+ examples?: string[];
56
+ call(input: Record<string, unknown>, ctx: SiteToolCtx): unknown;
57
+ }
58
+ export interface SiteToolsOptions {
59
+ resources?: Record<string, ResourceDecl>;
60
+ commands?: Record<string, CommandDecl>;
61
+ }
62
+ /** Normalize a URI the model gave: relative paths and declared absolute origins only, no `..`, no encoded separators. */
63
+ export declare function normalizeUri(uri: string, origins: Set<string>): {
64
+ origin?: string;
65
+ segments: string[];
66
+ query: URLSearchParams;
67
+ text: string;
68
+ };
69
+ /** One page of a text by lines: `offset` is the 1-based first line. */
70
+ export declare function pageText(text: string, offset?: number, limit?: number): string;
71
+ /**
72
+ * The four basic tools over the page's resources and commands. Spread them
73
+ * into `createSiteRuntime({ tools })`, alongside named tools if wanted.
74
+ */
75
+ export declare function siteTools(options: SiteToolsOptions): Record<string, SiteTool>;
76
+ //# sourceMappingURL=site_tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site_tools.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/site_tools.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElH,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,kBAAkB,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAA;AAC7F,eAAO,MAAM,YAAY,EAAE,UAAU,EAAuE,CAAA;AAE5G,eAAO,MAAM,WAAW,gFAAgF,CAAA;AACxG,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,QAAY,CAAA;AAEzC,8FAA8F;AAC9F,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;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AAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAA;CAChE;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CACvC;AA6BD,yHAAyH;AACzH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA+B7I;AA4CD,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBzE;AA+FD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAmK7E"}
@@ -0,0 +1,54 @@
1
+ import type { AiMessage, HistorySummaryRecord, JsonValue, StepRecord } from '../core/types';
2
+ import type { StepRenderer } from '../core/deps';
3
+ export type ToolResultStatusView = 'success' | 'error' | 'pending';
4
+ export interface HintView {
5
+ text: string;
6
+ once?: string;
7
+ }
8
+ /** Rendering view of the AgentToolResult envelope in `Observation.host` (`result_view.rs`). */
9
+ export interface ToolResultView {
10
+ agent_tool_protocol?: string;
11
+ status: ToolResultStatusView;
12
+ cmd_name?: string;
13
+ cmd_args?: string;
14
+ title: string;
15
+ summary: string;
16
+ output?: string;
17
+ /** `null` and `{}` read as absent. */
18
+ detail?: JsonValue;
19
+ return_code?: number;
20
+ task_id?: string;
21
+ partial_output?: string;
22
+ pending_reason?: string;
23
+ check_after?: number;
24
+ hints: HintView[];
25
+ }
26
+ /**
27
+ * `ToolResultView::from_host`: any object host reads as a view (every field
28
+ * is optional, unknown fields are ignored); a field of the wrong type makes
29
+ * the host unreadable, as serde's deserialization does.
30
+ */
31
+ export declare function toolResultViewFromHost(host: JsonValue | undefined): ToolResultView | undefined;
32
+ export interface XmlStepRendererOptions {
33
+ /** Rust's `summary_chars` knob (default 280); no rendering path reads it there either. */
34
+ summaryChars?: number;
35
+ /** Cap on a current-behavior step's result body (default 4096 chars); `0` disables it. */
36
+ maxResultChars?: number;
37
+ /** Render `started_at_ms` / `ended_at_ms` into history records (default true). */
38
+ timestamps?: boolean;
39
+ }
40
+ /** Default renderer of the XML behavior protocol (`XmlStepRenderer`). Stateless; share one across runs. */
41
+ export declare class XmlStepRenderer implements StepRenderer {
42
+ readonly summaryChars: number;
43
+ readonly maxResultChars: number;
44
+ readonly timestamps: boolean;
45
+ constructor(options?: XmlStepRendererOptions);
46
+ /** History records without wall-clock timestamps (a byte-stable prefix; hosted runs use it). */
47
+ withoutTimestamps(): XmlStepRenderer;
48
+ render(step: StepRecord): [AiMessage, AiMessage];
49
+ renderInherited(step: StepRecord): AiMessage;
50
+ renderSummary(summary: HistorySummaryRecord): AiMessage;
51
+ renderHistory(steps: StepRecord[], currentBehavior: string, summaries: HistorySummaryRecord[]): AiMessage[];
52
+ private renderFull;
53
+ }
54
+ //# sourceMappingURL=step_renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step_renderer.d.ts","sourceRoot":"","sources":["../../../src/xllm/runtime/step_renderer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAc,oBAAoB,EAAE,SAAS,EAAe,UAAU,EAAE,MAAM,eAAe,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