@theokit/sdk 5.12.0 → 5.13.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 (139) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/{agent-IG7BP6GN.js → agent-5DSDDH7K.js} +5 -5
  3. package/dist/{agent-IG7BP6GN.js.map → agent-5DSDDH7K.js.map} +1 -1
  4. package/dist/{agent-CVzDy_Oj.d.ts → agent-DSMuwADp.d.ts} +9 -2
  5. package/dist/{agent-BVKIUP7F.cjs → agent-WOMRT3KX.cjs} +6 -6
  6. package/dist/{agent-BVKIUP7F.cjs.map → agent-WOMRT3KX.cjs.map} +1 -1
  7. package/dist/{agent-Cn0sphpA.d.cts → agent-iW5kPpfT.d.cts} +9 -2
  8. package/dist/{chunk-XJ4C4NFX.js → chunk-2PRGRYEQ.js} +61 -47
  9. package/dist/chunk-2PRGRYEQ.js.map +1 -0
  10. package/dist/{chunk-HN4IKB6X.cjs → chunk-2XWAYCFM.cjs} +15 -13
  11. package/dist/chunk-2XWAYCFM.cjs.map +1 -0
  12. package/dist/{chunk-VVGFZQZC.js → chunk-3LMVJTNJ.js} +9 -5
  13. package/dist/chunk-3LMVJTNJ.js.map +1 -0
  14. package/dist/{chunk-IO4RI5ZJ.cjs → chunk-47EACDOC.cjs} +4 -4
  15. package/dist/{chunk-IO4RI5ZJ.cjs.map → chunk-47EACDOC.cjs.map} +1 -1
  16. package/dist/{chunk-LSWHDOCL.cjs → chunk-4UYHP6NF.cjs} +64 -48
  17. package/dist/chunk-4UYHP6NF.cjs.map +1 -0
  18. package/dist/{chunk-ZLFFDPXC.js → chunk-73IITAF7.js} +36 -14
  19. package/dist/chunk-73IITAF7.js.map +1 -0
  20. package/dist/{chunk-XRPMZ7TO.js → chunk-CYWOJA6B.js} +6 -4
  21. package/dist/chunk-CYWOJA6B.js.map +1 -0
  22. package/dist/{chunk-AQW54OWQ.js → chunk-DFBWYETS.js} +5 -3
  23. package/dist/chunk-DFBWYETS.js.map +1 -0
  24. package/dist/{chunk-YOVZMN4P.cjs → chunk-DVP3YMDA.cjs} +3 -3
  25. package/dist/{chunk-YOVZMN4P.cjs.map → chunk-DVP3YMDA.cjs.map} +1 -1
  26. package/dist/{chunk-BRWI4HLK.cjs → chunk-FLDHYF5C.cjs} +13 -3
  27. package/dist/chunk-FLDHYF5C.cjs.map +1 -0
  28. package/dist/{chunk-BJ7BPLQK.js → chunk-JX4LB6XO.js} +124 -13
  29. package/dist/chunk-JX4LB6XO.js.map +1 -0
  30. package/dist/{chunk-Q6WT5535.cjs → chunk-KL7ZUMK3.cjs} +161 -50
  31. package/dist/chunk-KL7ZUMK3.cjs.map +1 -0
  32. package/dist/{chunk-FEAWEBWN.cjs → chunk-PDOXYXWX.cjs} +6 -4
  33. package/dist/chunk-PDOXYXWX.cjs.map +1 -0
  34. package/dist/{chunk-EEK7S77K.js → chunk-QGDPMM3C.js} +13 -3
  35. package/dist/chunk-QGDPMM3C.js.map +1 -0
  36. package/dist/{chunk-ZWLFHSON.cjs → chunk-R35ZJAYT.cjs} +38 -15
  37. package/dist/chunk-R35ZJAYT.cjs.map +1 -0
  38. package/dist/{chunk-4YD2WI57.cjs → chunk-R427EOZE.cjs} +19 -15
  39. package/dist/chunk-R427EOZE.cjs.map +1 -0
  40. package/dist/{chunk-TLVI2OQK.cjs → chunk-SETHRLQS.cjs} +18 -2
  41. package/dist/chunk-SETHRLQS.cjs.map +1 -0
  42. package/dist/{chunk-BO3PV3OP.js → chunk-TDED5XES.js} +18 -3
  43. package/dist/chunk-TDED5XES.js.map +1 -0
  44. package/dist/{chunk-4GUFNDZR.js → chunk-XOYNB3YN.js} +3 -3
  45. package/dist/{chunk-4GUFNDZR.js.map → chunk-XOYNB3YN.js.map} +1 -1
  46. package/dist/{chunk-NJBJ3CUG.js → chunk-ZTP6ZACR.js} +3 -3
  47. package/dist/{chunk-NJBJ3CUG.js.map → chunk-ZTP6ZACR.js.map} +1 -1
  48. package/dist/{compact-session-3U2JYTVG.js → compact-session-5HMX6KYT.js} +3 -3
  49. package/dist/{compact-session-3U2JYTVG.js.map → compact-session-5HMX6KYT.js.map} +1 -1
  50. package/dist/{compact-session-NM56BREJ.cjs → compact-session-B7P6EU3Z.cjs} +12 -12
  51. package/dist/{compact-session-NM56BREJ.cjs.map → compact-session-B7P6EU3Z.cjs.map} +1 -1
  52. package/dist/{cron-BWDYetbq.d.cts → cron-BvxrLW5J.d.cts} +1 -1
  53. package/dist/{cron-CHn-F0fC.d.ts → cron-DdKzwJqK.d.ts} +1 -1
  54. package/dist/cron.cjs +5 -5
  55. package/dist/cron.d.cts +2 -2
  56. package/dist/cron.d.ts +2 -2
  57. package/dist/cron.js +4 -4
  58. package/dist/eval.cjs +9 -9
  59. package/dist/eval.js +4 -4
  60. package/dist/{executor-HKHT4CWS.cjs → executor-5QL5AXIZ.cjs} +18 -15
  61. package/dist/executor-5QL5AXIZ.cjs.map +1 -0
  62. package/dist/{executor-3D2UDJHW.js → executor-THUXNAFR.js} +6 -3
  63. package/dist/executor-THUXNAFR.js.map +1 -0
  64. package/dist/generate-object-A5F576IT.cjs +20 -0
  65. package/dist/{generate-object-XBWD2PU7.cjs.map → generate-object-A5F576IT.cjs.map} +1 -1
  66. package/dist/{generate-object-S7MNVF2V.js → generate-object-TBDOBBYW.js} +4 -4
  67. package/dist/{generate-object-S7MNVF2V.js.map → generate-object-TBDOBBYW.js.map} +1 -1
  68. package/dist/generate-object.d.ts +14 -1
  69. package/dist/index.cjs +43 -43
  70. package/dist/index.d.cts +30 -4
  71. package/dist/index.d.ts +30 -4
  72. package/dist/index.js +13 -13
  73. package/dist/{inject-session-THABTKJY.js → inject-session-75L3NCNL.js} +3 -3
  74. package/dist/{inject-session-THABTKJY.js.map → inject-session-75L3NCNL.js.map} +1 -1
  75. package/dist/{inject-session-JVTZNQF6.cjs → inject-session-WOH7TPDX.cjs} +4 -4
  76. package/dist/{inject-session-JVTZNQF6.cjs.map → inject-session-WOH7TPDX.cjs.map} +1 -1
  77. package/dist/internal/providers/discovery.d.ts +2 -2
  78. package/dist/internal/providers/trust-gate.d.ts +35 -0
  79. package/dist/internal/runtime/plugin-loader/manifest-entry-import.d.ts +17 -0
  80. package/dist/internal/runtime/plugin-loader/workspace-plugin-trust.d.ts +16 -0
  81. package/dist/internal/structured-output-helpers.d.ts +5 -2
  82. package/dist/sandbox/bwrap.d.cts +10 -8
  83. package/dist/sandbox/bwrap.d.ts +10 -8
  84. package/dist/sandbox/deny-read.d.cts +24 -0
  85. package/dist/sandbox/deny-read.d.ts +24 -0
  86. package/dist/sandbox/index.cjs +198 -46
  87. package/dist/sandbox/index.cjs.map +1 -1
  88. package/dist/sandbox/index.d.cts +2 -1
  89. package/dist/sandbox/index.d.ts +2 -1
  90. package/dist/sandbox/index.js +184 -36
  91. package/dist/sandbox/index.js.map +1 -1
  92. package/dist/sandbox/linux-sandbox.d.cts +40 -5
  93. package/dist/sandbox/linux-sandbox.d.ts +40 -5
  94. package/dist/sandbox/local-sandbox.d.cts +3 -1
  95. package/dist/sandbox/local-sandbox.d.ts +3 -1
  96. package/dist/sandbox/seccomp-delivery.d.cts +49 -0
  97. package/dist/sandbox/seccomp-delivery.d.ts +49 -0
  98. package/dist/sandbox/shell-escape.d.cts +14 -2
  99. package/dist/sandbox/shell-escape.d.ts +14 -2
  100. package/dist/sandbox/types.d.cts +45 -0
  101. package/dist/sandbox/types.d.ts +45 -0
  102. package/dist/stream-object-AS4YYM4B.cjs +20 -0
  103. package/dist/{stream-object-TEEK3CAX.cjs.map → stream-object-AS4YYM4B.cjs.map} +1 -1
  104. package/dist/stream-object-EKM4WGTI.js +7 -0
  105. package/dist/{stream-object-R6SMYV4R.js.map → stream-object-EKM4WGTI.js.map} +1 -1
  106. package/dist/stream-object.d.ts +14 -1
  107. package/dist/subagents-loader.d.cts +1 -1
  108. package/dist/subagents-loader.d.ts +1 -1
  109. package/dist/types/agent.d.ts +8 -1
  110. package/dist/workflow-as-tool.d.ts +39 -5
  111. package/dist/workflow-errors.d.ts +16 -0
  112. package/dist/workflow.cjs +31 -23
  113. package/dist/workflow.d.cts +54 -4
  114. package/dist/workflow.d.ts +54 -4
  115. package/dist/workflow.js +2 -2
  116. package/docs/error-codes.md +16 -13
  117. package/docs/harness-capability-map.md +51 -5
  118. package/package.json +1 -1
  119. package/dist/chunk-4YD2WI57.cjs.map +0 -1
  120. package/dist/chunk-AQW54OWQ.js.map +0 -1
  121. package/dist/chunk-BJ7BPLQK.js.map +0 -1
  122. package/dist/chunk-BO3PV3OP.js.map +0 -1
  123. package/dist/chunk-BRWI4HLK.cjs.map +0 -1
  124. package/dist/chunk-EEK7S77K.js.map +0 -1
  125. package/dist/chunk-FEAWEBWN.cjs.map +0 -1
  126. package/dist/chunk-HN4IKB6X.cjs.map +0 -1
  127. package/dist/chunk-LSWHDOCL.cjs.map +0 -1
  128. package/dist/chunk-Q6WT5535.cjs.map +0 -1
  129. package/dist/chunk-TLVI2OQK.cjs.map +0 -1
  130. package/dist/chunk-VVGFZQZC.js.map +0 -1
  131. package/dist/chunk-XJ4C4NFX.js.map +0 -1
  132. package/dist/chunk-XRPMZ7TO.js.map +0 -1
  133. package/dist/chunk-ZLFFDPXC.js.map +0 -1
  134. package/dist/chunk-ZWLFHSON.cjs.map +0 -1
  135. package/dist/executor-3D2UDJHW.js.map +0 -1
  136. package/dist/executor-HKHT4CWS.cjs.map +0 -1
  137. package/dist/generate-object-XBWD2PU7.cjs +0 -20
  138. package/dist/stream-object-R6SMYV4R.js +0 -7
  139. package/dist/stream-object-TEEK3CAX.cjs +0 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,73 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#783](https://github.com/usetheokit/theokit-sdk/pull/783) [`a390f10`](https://github.com/usetheokit/theokit-sdk/commit/a390f101a28e7207fdff9b50891b1defcb89bcde) Thanks [@usetheodev](https://github.com/usetheodev)! - The manifest plugin entry of a trusted workspace plugin folder is now imported. A folder under `<cwd>/.theokit/plugins/<folder>/` whose `PLUGIN.md` names an `entry` used to be listed by `agent.plugins.list()` and never imported, so the tools its `register` adds never reached a run. With `local.settingSources` including `"plugins"`, `Agent.create` now imports that entry and registers its default export, which must be a `kind: "general"` plugin, alongside `AgentOptions.plugins`.
8
+
9
+ Trust is by the folder's absolute realpath, in a trust record of its own: `~/.theokit/plugins/trusted-workspace-plugins.json`, a JSON array of folder realpaths, read on every `Agent.create`. The provider trust list (`trusted-providers.json`, `THEOKIT_TRUSTED_PROVIDERS`) does not authorize a workspace folder, so a repository you cloned cannot get its code run by naming a folder after a provider you trust. A relative entry is discarded with a warning, and a record that is not a valid JSON array trusts nothing. An untrusted folder is listed, never imported, and diagnosed once per process with the realpath to add. Plugins found under a foreign root (`compatSources`, such as `.claude/plugins`) are never imported, and neither `agent.reload()` nor a manifest without an `entry` imports anything. A changed entry needs a process restart, since Node caches the module.
10
+
11
+ The provider trust gate is now read on every `Agent.create` too: a provider plugin trusted between two creates is imported by the second, and each provider is still imported at most once per process. The untrusted-provider warning no longer says to restart.
12
+
13
+ A trusted entry that cannot be used fails `Agent.create` with a `ConfigurationError` naming the plugin: `plugin_entry_import_failed` when the module throws on import (the thrown error is the `cause`), and `plugin_entry_shape` when its default export is not a general plugin with a `name` and a `register` function.
14
+
15
+ - [#801](https://github.com/usetheokit/theokit-sdk/pull/801) [`bcac0e7`](https://github.com/usetheokit/theokit-sdk/commit/bcac0e702d99bb7e2a491c5c96e5f14b051cef2c) Thanks [@usetheodev](https://github.com/usetheodev)! - Add `denyReadPaths` to the `@theokit/sdk/sandbox` backends (`LinuxSandbox`, `createSandboxBackend`, `interactiveWrapCommand`, `wrapCommandForSandbox` and `buildBwrapArgv`) so a `workspace-write` or `read-only` shell cannot read named absolute paths. A directory is masked with `--tmpfs` and reads as empty, a file with `--ro-bind /dev/null` and reads as permission denied; the mask is placed after the writable binds, so it also hides a path inside the workspace or `/tmp`. A masked file still appears in the listing of its directory. A list that cannot be honoured throws instead of running unconfined: `TypeError` for a relative or missing path, a path that contains the workspace, `/tmp` or `/`, or any list under `danger-full-access`, and `SandboxNotAvailableError` when bubblewrap is absent. Without the option nothing changes.
16
+
17
+ - [#805](https://github.com/usetheokit/theokit-sdk/pull/805) [`742f101`](https://github.com/usetheokit/theokit-sdk/commit/742f101d28034188070b0da822cdee414fdefbde) Thanks [@usetheodev](https://github.com/usetheodev)! - A custom `SandboxBackend` can now release what it holds with `dispose()` (a no-op by default, safe to call twice) and state its egress with an optional `networkPolicy` of type `SandboxNetworkPolicy`; `LocalSandbox` declares `unrestricted` and `LinuxSandbox` declares `none` when the network is unshared (`usetheokit/theokit#1130`). `@theokit/sdk/sandbox` also exports `shellEscapePosix`, so a command line built outside a backend subclass can quote its arguments (`usetheokit/theokit#1131`).
18
+
19
+ - [#793](https://github.com/usetheokit/theokit-sdk/pull/793) [`2e5c1e4`](https://github.com/usetheokit/theokit-sdk/commit/2e5c1e4e8c04509606e4c3b96191a96751b1b73b) Thanks [@usetheodev](https://github.com/usetheodev)! - `Agent.generateObject` and `Agent.streamObject` accept `withheldBuiltinTools` and `memory`, forwarded to the transient agent each call creates. Pass `withheldBuiltinTools: ["shell"]` and `memory: { enabled: false }` for a JSON-only step that must hold no shell and write no transcript; the `output` tool stays available. With `structuringModel`, the reasoning-phase agent receives the same options. Without them nothing changes: the transient agent holds `shell` and writes a transcript as before.
20
+
21
+ - [#791](https://github.com/usetheokit/theokit-sdk/pull/791) [`3fba608`](https://github.com/usetheokit/theokit-sdk/commit/3fba60809c872395bc26525ad8bdad6655caefc0) Thanks [@usetheodev](https://github.com/usetheodev)! - A model can now continue a suspended workflow run. `workflowAsTool` used to raise `WorkflowToolError`
22
+ for a run that suspended and never handed the model the run id, and no tool called `Workflow.resume`.
23
+ Its spec gains an opt-in `reportSuspended`: a suspended run then returns
24
+ `{"status":"suspended","runId":"…","stepId":"…"}`, ids only, never the suspended payload. The new
25
+ `workflowResumeTool(workflow, { name, description, reportSuspended? })`, exported from
26
+ `@theokit/sdk/workflow`, resumes that run by id with an optional payload validated against the suspend
27
+ step's schema, and returns the run's output. The run id stays the same across resumes, so a second
28
+ suspension is told apart by its `stepId`. Without the opt-in a suspended run still raises. The tool
29
+ resumes any run id it is given: who may approve a run is the host's decision. The default snapshot
30
+ store is in memory and process-local.
31
+
32
+ `Workflow.resume`, and so the resume tool, now refuses a run id whose snapshot was written by a
33
+ workflow of another name with the typed `WorkflowResumeWorkflowMismatchError` and leaves the snapshot
34
+ for the workflow that suspended it. Before, a workflow sharing the suspended step id ran its own tail on
35
+ the other workflow's input. A report's `stepId` is `null` for a run that carries no step result.
36
+
37
+ ### Patch Changes
38
+
39
+ - [#781](https://github.com/usetheokit/theokit-sdk/pull/781) [`c300464`](https://github.com/usetheokit/theokit-sdk/commit/c3004649223dcddb5582746977a622f0aef03d09) Thanks [@usetheodev](https://github.com/usetheodev)! - A local run cancelled while its MCP servers start up no longer starts the MCP servers after the one whose handshake was in progress. Until now every remaining server was still initialized, and each stdio server spawned its child process, after the cancel. The handshake already in progress still finishes, and the run still closes every MCP client it owns.
40
+
41
+ - [#785](https://github.com/usetheokit/theokit-sdk/pull/785) [`4a9ab1c`](https://github.com/usetheokit/theokit-sdk/commit/4a9ab1c608fdb2903837054ed59ad3976e2e2906) Thanks [@usetheodev](https://github.com/usetheodev)! - The seccomp temp-dir cleanup of `seccompPathForArch` and `restrictedSeccompPath` no longer cuts off a host's shutdown handler registered with `process.once`: it runs first, removes its directory, and leaves the ending to the host. The directory is now gone before the host's handler starts; a process with no handler of its own still ends by the signal. One order is not covered: a host that itself prepends a `once` handler (`process.prependOnceListener`) after the first sandboxed command runs before the cleanup and is not counted, so the signal is raised again while its shutdown runs.
42
+
43
+ ## 5.12.1
44
+
45
+ ### Patch Changes
46
+
47
+ - [#773](https://github.com/usetheokit/theokit-sdk/pull/773) [`ecfabd8`](https://github.com/usetheokit/theokit-sdk/commit/ecfabd8639da45573bb4283a2b6b0a6c98daf97a) Thanks [@usetheodev](https://github.com/usetheodev)! - Security: a command confined by `LinuxSandbox` or `interactiveWrapCommand` can no longer weaken the
48
+ seccomp filter that later confined commands load. The filter used to be read from a temp file under
49
+ `/tmp`, which `workspace-write` commands can write, so one command could replace it with an
50
+ allow-all program. Both wraps now pipe the program to bubblewrap from memory, and no file holds it.
51
+
52
+ `wrapCommandForSandbox` takes a new optional `seccompProgram` (the program's bytes, a positive
53
+ multiple of 8; a `TypeError` otherwise). It wins over `seccompPath` when both are given.
54
+
55
+ `seccompPath`, `restrictedSeccompPath` and `seccompPathForArch` are deprecated in favour of
56
+ `seccompProgram`, and keep working. A `seccompPath` that `restrictedSeccompPath` or
57
+ `seccompPathForArch` returned is now piped from the bytes the process wrote, so a sandbox started
58
+ without the filter (a network-open one mounts `/tmp` writable) can replace the file without effect.
59
+ For any other path the wrap binds the filter's directory read-only, or the file where the directory
60
+ is a writable root or contains one. That is only a partial fix: the bind guards the file only from
61
+ the command that loads it, a temp dir nested inside a writable root can still be swapped by renaming
62
+ an ancestor, and where only the file is bound its parent can be renamed. Code that reads the
63
+ helper's file itself is not covered either.
64
+
65
+ The piped wrap passes the program, bubblewrap's arguments and the command to `/bin/sh` as
66
+ positional arguments, so each is shell-escaped once. Every sandbox wrap also writes a backslash that
67
+ precedes a quote, a backslash or the end of a word outside the single quotes, so the wrap parses to
68
+ the same words under fish as under sh. Before, when the PTY's `$SHELL` was fish, a command containing
69
+ `\'` could end the quoting early and run its tail in the host shell, outside bubblewrap.
70
+
3
71
  ## 5.12.0
4
72
 
5
73
  ### Minor Changes
@@ -1,6 +1,6 @@
1
- export { Agent } from './chunk-BJ7BPLQK.js';
1
+ export { Agent } from './chunk-JX4LB6XO.js';
2
2
  import './chunk-HWMGR3HA.js';
3
- import './chunk-4GUFNDZR.js';
3
+ import './chunk-XOYNB3YN.js';
4
4
  import './chunk-K2BQQ445.js';
5
5
  import './chunk-2C24NSNV.js';
6
6
  import './chunk-HJ2LV464.js';
@@ -10,7 +10,7 @@ import './chunk-H73MEMQB.js';
10
10
  import './chunk-QK2ERTO3.js';
11
11
  import './chunk-DF77RBF4.js';
12
12
  import './chunk-AB4OPJLD.js';
13
- import './chunk-XJ4C4NFX.js';
13
+ import './chunk-2PRGRYEQ.js';
14
14
  import './chunk-5AR6O7GW.js';
15
15
  import './chunk-2XC6KDJM.js';
16
16
  import './chunk-ZJAYFSVI.js';
@@ -58,5 +58,5 @@ import './chunk-5IUDICRK.js';
58
58
  import './chunk-Q7GYMXVC.js';
59
59
  import './chunk-TNFOU6SB.js';
60
60
  import './chunk-3OY6H3I7.js';
61
- //# sourceMappingURL=agent-IG7BP6GN.js.map
62
- //# sourceMappingURL=agent-IG7BP6GN.js.map
61
+ //# sourceMappingURL=agent-5DSDDH7K.js.map
62
+ //# sourceMappingURL=agent-5DSDDH7K.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-IG7BP6GN.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-5DSDDH7K.js"}
@@ -1614,7 +1614,14 @@ interface AgentOptions {
1614
1614
  *
1615
1615
  * - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
1616
1616
  * file-discovered plugin providers (under `.theokit/plugins/`) are active.
1617
- * Plugin sources must also be active via `local.settingSources`.
1617
+ * Plugin sources must also be active via `local.settingSources`. A folder
1618
+ * under `<cwd>/.theokit/plugins/` whose `PLUGIN.md` names an `entry` has
1619
+ * that entry imported and its default export (a `kind: "general"` plugin)
1620
+ * registered, but only when the folder's absolute realpath is listed in
1621
+ * `~/.theokit/plugins/trusted-workspace-plugins.json` (a JSON array, read on
1622
+ * each `Agent.create`). The provider trust list never authorizes a workspace
1623
+ * folder. An untrusted folder is listed and never imported; foreign roots
1624
+ * are never imported.
1618
1625
  * - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
1619
1626
  * `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
1620
1627
  * the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
@@ -2055,4 +2062,4 @@ interface ListResult<T> {
2055
2062
  nextCursor?: string;
2056
2063
  }
2057
2064
 
2058
- export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type MemoryProvider as l, type PreToolCallDecision as m, type ActiveMemoryPassArgs as n, type ActiveMemoryPassResult as o, type AgentSubagentDescription as p, type AgentToolDescription as q, type BudgetCheck as r, type BudgetTotal as s, type BudgetUsageEvent as t, type BuiltinToolName as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
2065
+ export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkQ6WT5535_cjs = require('./chunk-Q6WT5535.cjs');
3
+ var chunkKL7ZUMK3_cjs = require('./chunk-KL7ZUMK3.cjs');
4
4
  require('./chunk-L7JPXZ2C.cjs');
5
- require('./chunk-YOVZMN4P.cjs');
5
+ require('./chunk-DVP3YMDA.cjs');
6
6
  require('./chunk-BUUUWQMB.cjs');
7
7
  require('./chunk-CWQPQTUZ.cjs');
8
8
  require('./chunk-7YUPSBDV.cjs');
@@ -12,7 +12,7 @@ require('./chunk-GHX4P3V2.cjs');
12
12
  require('./chunk-RS7YQR4X.cjs');
13
13
  require('./chunk-SDZ4XDWS.cjs');
14
14
  require('./chunk-6OCJWGVD.cjs');
15
- require('./chunk-LSWHDOCL.cjs');
15
+ require('./chunk-4UYHP6NF.cjs');
16
16
  require('./chunk-SXH37C7X.cjs');
17
17
  require('./chunk-YJNYDJ2T.cjs');
18
18
  require('./chunk-NP362THY.cjs');
@@ -65,7 +65,7 @@ require('./chunk-RNXXYF22.cjs');
65
65
 
66
66
  Object.defineProperty(exports, "Agent", {
67
67
  enumerable: true,
68
- get: function () { return chunkQ6WT5535_cjs.Agent; }
68
+ get: function () { return chunkKL7ZUMK3_cjs.Agent; }
69
69
  });
70
- //# sourceMappingURL=agent-BVKIUP7F.cjs.map
71
- //# sourceMappingURL=agent-BVKIUP7F.cjs.map
70
+ //# sourceMappingURL=agent-WOMRT3KX.cjs.map
71
+ //# sourceMappingURL=agent-WOMRT3KX.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-BVKIUP7F.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"agent-WOMRT3KX.cjs"}
@@ -1614,7 +1614,14 @@ interface AgentOptions {
1614
1614
  *
1615
1615
  * - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
1616
1616
  * file-discovered plugin providers (under `.theokit/plugins/`) are active.
1617
- * Plugin sources must also be active via `local.settingSources`.
1617
+ * Plugin sources must also be active via `local.settingSources`. A folder
1618
+ * under `<cwd>/.theokit/plugins/` whose `PLUGIN.md` names an `entry` has
1619
+ * that entry imported and its default export (a `kind: "general"` plugin)
1620
+ * registered, but only when the folder's absolute realpath is listed in
1621
+ * `~/.theokit/plugins/trusted-workspace-plugins.json` (a JSON array, read on
1622
+ * each `Agent.create`). The provider trust list never authorizes a workspace
1623
+ * folder. An untrusted folder is listed and never imported; foreign roots
1624
+ * are never imported.
1618
1625
  * - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
1619
1626
  * `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
1620
1627
  * the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
@@ -2055,4 +2062,4 @@ interface ListResult<T> {
2055
2062
  nextCursor?: string;
2056
2063
  }
2057
2064
 
2058
- export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type MemoryProvider as l, type PreToolCallDecision as m, type ActiveMemoryPassArgs as n, type ActiveMemoryPassResult as o, type AgentSubagentDescription as p, type AgentToolDescription as q, type BudgetCheck as r, type BudgetTotal as s, type BudgetUsageEvent as t, type BuiltinToolName as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
2065
+ export { type RecordSessionSummaryArgs as $, type AgentOptions as A, type BuiltinToolName as B, type CloudOptions as C, type CreateSkillSpec as D, type HookApprovalRequest as E, type HookName as F, type GetAgentOptions as G, type HookApprovalGate as H, type InlineSkill as I, type LlmCallContext as J, type MemoryProviderAgentRef as K, type LocalOptions as L, type MemorySettings as M, type MemoryProviderFactory as N, type MemoryProviderHandle as O, type Plugin as P, type MemoryProviderInitOptions as Q, type PluginContext as R, type SystemPromptResolver as S, type PluginHookDisposer as T, type PostAssistantReplyContext as U, type PostToolCallContext as V, type PreToolCallContext as W, type PreUserSendContext as X, type PreUserSendResult as Y, type ProviderTransform as Z, type ProviderTransformContext as _, type AgentDefinition as a, type SessionLifecycleContext as a0, type SessionRecord as a1, type SessionStore as a2, type SettingSource as a3, Skill as a4, type SkillsResolver as a5, type SkillsResolverContext as a6, type SystemPromptContext as a7, type SystemPromptMemoryFact as a8, type TelemetrySettings as a9, type ToolCallSummary as aa, type ToolContext as ab, type ToolResultTransformContext as ac, type TransformContext as ad, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type Skill$1 as k, type BudgetTracker as l, type MemoryProvider as m, type PreToolCallDecision as n, type ActiveMemoryPassArgs as o, type ActiveMemoryPassResult as p, type AgentSubagentDescription as q, type AgentToolDescription as r, type BudgetCheck as s, type BudgetTotal as t, type BudgetUsageEvent as u, type CloudEnv as v, type CloudRepo as w, type CompatSource as x, type CompatSourceAdapter as y, type CompatSurface as z };
@@ -20,55 +20,62 @@ import { join } from 'path';
20
20
  import { pathToFileURL } from 'url';
21
21
  import { createRequire } from 'module';
22
22
 
23
- var discoveryState = globalSingleton("theokit-sdk.providers.discovered", () => ({
24
- done: false
25
- }));
26
- function pluginsRoot() {
27
- return join(homedir(), ".theokit", "plugins", "model-providers");
28
- }
29
23
  function trustFilePath() {
30
24
  return join(homedir(), ".theokit", "plugins", "trusted-providers.json");
31
25
  }
32
- function loadTrustedNames() {
33
- const trusted = /* @__PURE__ */ new Set();
34
- const path = trustFilePath();
35
- if (existsSync(path)) {
36
- try {
37
- const parsed = JSON.parse(readFileSync(path, "utf-8"));
38
- if (Array.isArray(parsed)) {
39
- let discarded = 0;
40
- for (const name of parsed) {
41
- if (typeof name === "string" && name.length > 0) trusted.add(name);
42
- else discarded += 1;
43
- }
44
- if (discarded > 0) {
45
- diag(
46
- `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
47
- `
48
- );
49
- }
50
- } else {
51
- diag(
52
- `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
53
- `
54
- );
55
- }
56
- } catch {
57
- diag(
58
- `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
59
- `
60
- );
61
- }
62
- }
26
+ function readTrustedNames() {
27
+ const trusted = new Set(readTrustArray(trustFilePath(), PROVIDER_TRUST));
63
28
  for (const name of (process.env.THEOKIT_TRUSTED_PROVIDERS ?? "").split(",")) {
64
29
  const trimmed = name.trim();
65
30
  if (trimmed.length > 0) trusted.add(trimmed);
66
31
  }
67
32
  return trusted;
68
33
  }
34
+ var PROVIDER_TRUST = {
35
+ subject: "provider plugins",
36
+ entries: "plugin-name strings"
37
+ };
38
+ function readTrustArray(path, shape) {
39
+ if (!existsSync(path)) return [];
40
+ let parsed;
41
+ try {
42
+ parsed = JSON.parse(readFileSync(path, "utf-8"));
43
+ } catch {
44
+ diag(
45
+ `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO ${shape.subject} (fail-closed)
46
+ `
47
+ );
48
+ return [];
49
+ }
50
+ if (!Array.isArray(parsed)) {
51
+ diag(
52
+ `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO ${shape.subject} (fail-closed)
53
+ `
54
+ );
55
+ return [];
56
+ }
57
+ const names = parsed.filter(
58
+ (name) => typeof name === "string" && name.length > 0
59
+ );
60
+ const discarded = parsed.length - names.length;
61
+ if (discarded > 0) {
62
+ diag(
63
+ `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be ${shape.entries})
64
+ `
65
+ );
66
+ }
67
+ return names;
68
+ }
69
+
70
+ // src/internal/providers/discovery.ts
71
+ var discoveryState = globalSingleton("theokit-sdk.providers.discovered", () => ({
72
+ loaded: /* @__PURE__ */ new Set(),
73
+ warned: /* @__PURE__ */ new Set()
74
+ }));
75
+ function pluginsRoot() {
76
+ return join(homedir(), ".theokit", "plugins", "model-providers");
77
+ }
69
78
  async function discoverProviderPlugins() {
70
- if (discoveryState.done) return;
71
- discoveryState.done = true;
72
79
  const root = pluginsRoot();
73
80
  if (!existsSync(root)) return;
74
81
  let entries;
@@ -77,18 +84,25 @@ async function discoverProviderPlugins() {
77
84
  } catch {
78
85
  return;
79
86
  }
80
- const trusted = loadTrustedNames();
87
+ const trusted = readTrustedNames();
81
88
  for (const entry of entries) {
89
+ if (discoveryState.loaded.has(entry)) continue;
82
90
  if (!trusted.has(entry)) {
83
- diag(
84
- `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
85
- `
86
- );
91
+ warnUntrusted(entry);
87
92
  continue;
88
93
  }
94
+ discoveryState.loaded.add(entry);
89
95
  await loadOne(join(root, entry), entry);
90
96
  }
91
97
  }
98
+ function warnUntrusted(entry) {
99
+ if (discoveryState.warned.has(entry)) return;
100
+ discoveryState.warned.add(entry);
101
+ diag(
102
+ `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated).
103
+ `
104
+ );
105
+ }
92
106
  async function loadOne(dir, entryName) {
93
107
  for (const ext of ["index.mjs", "index.js"]) {
94
108
  const indexPath = join(dir, ext);
@@ -3481,6 +3495,6 @@ async function autoCompactIfNeeded(opts) {
3481
3495
  }
3482
3496
  }
3483
3497
 
3484
- export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CircuitBreaker, DEFAULT_PRE_COMPACT_TIMEOUT_MS, abortError, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, inferApiMode, isCompactSummary, isFixtureApiKey, mapOllamaHttpError, mapOllamaTransportError, mergeExplicitApiKey, normalizeUsage, parseSseStream, presentProviderCredentialEnvVars, readErrorResponseBody, relayStream, renderToolResultContentText, resolveProviderChain, resolveRunProvider, resolveSummarizerRoute, shouldAutoCompact, shouldUseFixtureMode, shouldUseRealLocalRuntime, tryFirstEvent, validateApiKeyShape };
3485
- //# sourceMappingURL=chunk-XJ4C4NFX.js.map
3486
- //# sourceMappingURL=chunk-XJ4C4NFX.js.map
3498
+ export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CircuitBreaker, DEFAULT_PRE_COMPACT_TIMEOUT_MS, abortError, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, inferApiMode, isCompactSummary, isFixtureApiKey, mapOllamaHttpError, mapOllamaTransportError, mergeExplicitApiKey, normalizeUsage, parseSseStream, presentProviderCredentialEnvVars, readErrorResponseBody, readTrustArray, relayStream, renderToolResultContentText, resolveProviderChain, resolveRunProvider, resolveSummarizerRoute, shouldAutoCompact, shouldUseFixtureMode, shouldUseRealLocalRuntime, trustFilePath, tryFirstEvent, validateApiKeyShape };
3499
+ //# sourceMappingURL=chunk-2PRGRYEQ.js.map
3500
+ //# sourceMappingURL=chunk-2PRGRYEQ.js.map