@osovv/vv-opencode 2.0.1 → 2.1.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 (296) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +87 -86
  3. package/dist/commands/completion.js +0 -1
  4. package/dist/commands/completion.js.map +1 -1
  5. package/dist/commands/doctor.js +6 -9
  6. package/dist/commands/doctor.js.map +1 -1
  7. package/dist/commands/init.d.ts +2 -1
  8. package/dist/commands/init.js +7 -12
  9. package/dist/commands/init.js.map +1 -1
  10. package/dist/commands/install.d.ts +4 -0
  11. package/dist/commands/install.js +40 -37
  12. package/dist/commands/install.js.map +1 -1
  13. package/dist/commands/launch.d.ts +2 -1
  14. package/dist/commands/launch.js +18 -14
  15. package/dist/commands/launch.js.map +1 -1
  16. package/dist/commands/patch-provider.d.ts +225 -307
  17. package/dist/commands/patch-provider.js +92 -296
  18. package/dist/commands/patch-provider.js.map +1 -1
  19. package/dist/commands/status.js +7 -10
  20. package/dist/commands/status.js.map +1 -1
  21. package/dist/commands/sync.d.ts +4 -0
  22. package/dist/commands/sync.js +38 -35
  23. package/dist/commands/sync.js.map +1 -1
  24. package/dist/index.d.ts +25 -5
  25. package/dist/index.js +73 -34
  26. package/dist/index.js.map +1 -1
  27. package/dist/lib/agent-tool-catalog.d.ts +1 -1
  28. package/dist/lib/agent-tool-catalog.js +3 -6
  29. package/dist/lib/agent-tool-catalog.js.map +1 -1
  30. package/dist/lib/agent-tool-contract.d.ts +22 -13
  31. package/dist/lib/agent-tool-contract.js +20 -20
  32. package/dist/lib/agent-tool-contract.js.map +1 -1
  33. package/dist/lib/analytics/types.d.ts +7 -1
  34. package/dist/lib/analytics/types.js +2 -2
  35. package/dist/lib/analytics/types.js.map +1 -1
  36. package/dist/lib/config-layers.d.ts +28 -6
  37. package/dist/lib/config-layers.js +268 -73
  38. package/dist/lib/config-layers.js.map +1 -1
  39. package/dist/lib/managed-agents.d.ts +24 -2
  40. package/dist/lib/managed-agents.js +45 -15
  41. package/dist/lib/managed-agents.js.map +1 -1
  42. package/dist/lib/model-roles.d.ts +5 -0
  43. package/dist/lib/model-roles.js +22 -1
  44. package/dist/lib/model-roles.js.map +1 -1
  45. package/dist/lib/opencode/agent-registrations.d.ts +4 -4
  46. package/dist/lib/opencode/agent-registrations.js +386 -197
  47. package/dist/lib/opencode/agent-registrations.js.map +1 -1
  48. package/dist/lib/opencode/inspection.d.ts +13 -13
  49. package/dist/lib/opencode/inspection.js +69 -106
  50. package/dist/lib/opencode/inspection.js.map +1 -1
  51. package/dist/lib/opencode/model-overrides.d.ts +2 -2
  52. package/dist/lib/opencode/model-overrides.js +192 -47
  53. package/dist/lib/opencode/model-overrides.js.map +1 -1
  54. package/dist/lib/opencode/paths.d.ts +6 -2
  55. package/dist/lib/opencode/paths.js +12 -11
  56. package/dist/lib/opencode/paths.js.map +1 -1
  57. package/dist/lib/opencode/plugin-registration.d.ts +10 -11
  58. package/dist/lib/opencode/plugin-registration.js +76 -138
  59. package/dist/lib/opencode/plugin-registration.js.map +1 -1
  60. package/dist/lib/opencode/shared-utils.d.ts +47 -3
  61. package/dist/lib/opencode/shared-utils.js +346 -15
  62. package/dist/lib/opencode/shared-utils.js.map +1 -1
  63. package/dist/lib/opencode.d.ts +5 -6
  64. package/dist/lib/opencode.js +10 -10
  65. package/dist/lib/opencode.js.map +1 -1
  66. package/dist/lib/vvoc-config.js +4 -4
  67. package/dist/lib/vvoc-config.js.map +1 -1
  68. package/dist/lib/vvoc-paths.d.ts +7 -0
  69. package/dist/lib/vvoc-paths.js +15 -1
  70. package/dist/lib/vvoc-paths.js.map +1 -1
  71. package/dist/lib/vvoc-preset-registry.d.ts +38 -50
  72. package/dist/lib/vvoc-preset-registry.js +38 -48
  73. package/dist/lib/vvoc-preset-registry.js.map +1 -1
  74. package/dist/plugins/analytics/index.d.ts +20 -14
  75. package/dist/plugins/analytics/index.js +281 -133
  76. package/dist/plugins/analytics/index.js.map +1 -1
  77. package/dist/plugins/guardian/index.d.ts +63 -42
  78. package/dist/plugins/guardian/index.js +217 -759
  79. package/dist/plugins/guardian/index.js.map +1 -1
  80. package/dist/plugins/hashline-edit/index.d.ts +145 -31
  81. package/dist/plugins/hashline-edit/index.js +679 -244
  82. package/dist/plugins/hashline-edit/index.js.map +1 -1
  83. package/dist/plugins/hashline-edit/schemas.d.ts +1 -1
  84. package/dist/plugins/hashline-edit/schemas.js +3 -3
  85. package/dist/plugins/hashline-edit/schemas.js.map +1 -1
  86. package/dist/plugins/model-roles/index.d.ts +18 -4
  87. package/dist/plugins/model-roles/index.js +44 -181
  88. package/dist/plugins/model-roles/index.js.map +1 -1
  89. package/dist/plugins/peak-hours/index.d.ts +23 -23
  90. package/dist/plugins/peak-hours/index.js +211 -180
  91. package/dist/plugins/peak-hours/index.js.map +1 -1
  92. package/dist/plugins/secrets-redaction/deep.js +35 -51
  93. package/dist/plugins/secrets-redaction/deep.js.map +1 -1
  94. package/dist/plugins/secrets-redaction/index.d.ts +96 -8
  95. package/dist/plugins/secrets-redaction/index.js +290 -102
  96. package/dist/plugins/secrets-redaction/index.js.map +1 -1
  97. package/dist/plugins/secrets-redaction/session.d.ts +9 -0
  98. package/dist/plugins/secrets-redaction/session.js +21 -4
  99. package/dist/plugins/secrets-redaction/session.js.map +1 -1
  100. package/dist/plugins/secrets-redaction/stream.d.ts +92 -0
  101. package/dist/plugins/secrets-redaction/stream.js +772 -0
  102. package/dist/plugins/secrets-redaction/stream.js.map +1 -0
  103. package/dist/plugins/spec-guard/index.d.ts +49 -18
  104. package/dist/plugins/spec-guard/index.js +231 -129
  105. package/dist/plugins/spec-guard/index.js.map +1 -1
  106. package/dist/plugins/system-context-injection/index.d.ts +10 -4
  107. package/dist/plugins/system-context-injection/index.js +271 -78
  108. package/dist/plugins/system-context-injection/index.js.map +1 -1
  109. package/dist/plugins/tool-history-compaction/index.d.ts +26 -4
  110. package/dist/plugins/tool-history-compaction/index.js +170 -32
  111. package/dist/plugins/tool-history-compaction/index.js.map +1 -1
  112. package/dist/plugins/tool-history-compaction/transform.d.ts +47 -16
  113. package/dist/plugins/tool-history-compaction/transform.js +173 -55
  114. package/dist/plugins/tool-history-compaction/transform.js.map +1 -1
  115. package/dist/plugins/web-tools/fetch-service.d.ts +51 -13
  116. package/dist/plugins/web-tools/fetch-service.js +106 -75
  117. package/dist/plugins/web-tools/fetch-service.js.map +1 -1
  118. package/dist/plugins/web-tools/index.d.ts +58 -16
  119. package/dist/plugins/web-tools/index.js +202 -91
  120. package/dist/plugins/web-tools/index.js.map +1 -1
  121. package/dist/plugins/web-tools/media-loader.d.ts +3 -3
  122. package/dist/plugins/web-tools/media-loader.js +3 -3
  123. package/dist/plugins/web-tools/media-loader.js.map +1 -1
  124. package/dist/plugins/web-tools/providers/native-fetch.d.ts +2 -2
  125. package/dist/plugins/web-tools/providers/native-fetch.js +1 -1
  126. package/dist/plugins/web-tools/providers/native-fetch.js.map +1 -1
  127. package/dist/plugins/web-tools/providers/spider.d.ts +2 -2
  128. package/dist/plugins/web-tools/providers/spider.js +1 -1
  129. package/dist/plugins/web-tools/providers/spider.js.map +1 -1
  130. package/dist/plugins/web-tools/providers/zai.d.ts +2 -2
  131. package/dist/plugins/web-tools/providers/zai.js +1 -1
  132. package/dist/plugins/web-tools/providers/zai.js.map +1 -1
  133. package/dist/plugins/web-tools/schemas.d.ts +1 -1
  134. package/dist/plugins/web-tools/schemas.js +3 -3
  135. package/dist/plugins/web-tools/schemas.js.map +1 -1
  136. package/dist/plugins/web-tools/search-service.d.ts +81 -12
  137. package/dist/plugins/web-tools/search-service.js +104 -57
  138. package/dist/plugins/web-tools/search-service.js.map +1 -1
  139. package/dist/plugins/workflow/authorization.d.ts +44 -10
  140. package/dist/plugins/workflow/authorization.js +113 -73
  141. package/dist/plugins/workflow/authorization.js.map +1 -1
  142. package/dist/plugins/workflow/cancellation.d.ts +86 -0
  143. package/dist/plugins/workflow/cancellation.js +202 -0
  144. package/dist/plugins/workflow/cancellation.js.map +1 -0
  145. package/dist/plugins/workflow/checkpoints.d.ts +7 -1
  146. package/dist/plugins/workflow/checkpoints.js +141 -21
  147. package/dist/plugins/workflow/checkpoints.js.map +1 -1
  148. package/dist/plugins/workflow/delegated.d.ts +14 -0
  149. package/dist/plugins/workflow/delegated.js +6 -5
  150. package/dist/plugins/workflow/delegated.js.map +1 -1
  151. package/dist/plugins/workflow/host.d.ts +81 -0
  152. package/dist/plugins/workflow/host.js +189 -0
  153. package/dist/plugins/workflow/host.js.map +1 -0
  154. package/dist/plugins/workflow/index.d.ts +69 -4
  155. package/dist/plugins/workflow/index.js +1391 -1026
  156. package/dist/plugins/workflow/index.js.map +1 -1
  157. package/dist/plugins/workflow/recovery.d.ts +3 -5
  158. package/dist/plugins/workflow/recovery.js +18 -33
  159. package/dist/plugins/workflow/recovery.js.map +1 -1
  160. package/dist/plugins/workflow/repair.d.ts +31 -5
  161. package/dist/plugins/workflow/repair.js +116 -48
  162. package/dist/plugins/workflow/repair.js.map +1 -1
  163. package/dist/plugins/workflow/results.d.ts +31 -31
  164. package/dist/plugins/workflow/results.js +4 -4
  165. package/dist/plugins/workflow/results.js.map +1 -1
  166. package/dist/plugins/workflow/schemas.d.ts +3 -3
  167. package/dist/plugins/workflow/schemas.js +5 -5
  168. package/dist/plugins/workflow/schemas.js.map +1 -1
  169. package/dist/plugins/workflow/system-instruction.md +4 -0
  170. package/dist/plugins/workflow/tooling.d.ts +6 -0
  171. package/dist/plugins/workflow/tooling.js +3 -1
  172. package/dist/plugins/workflow/tooling.js.map +1 -1
  173. package/dist/runtime/auxiliary.d.ts +13 -0
  174. package/dist/runtime/auxiliary.js +108 -0
  175. package/dist/runtime/auxiliary.js.map +1 -0
  176. package/dist/runtime/client.d.ts +88 -0
  177. package/dist/runtime/client.js +174 -0
  178. package/dist/runtime/client.js.map +1 -0
  179. package/dist/runtime/context-inspection-contract.d.ts +397 -0
  180. package/dist/runtime/context-inspection-contract.js +622 -0
  181. package/dist/runtime/context-inspection-contract.js.map +1 -0
  182. package/dist/runtime/context-inspection.d.ts +52 -0
  183. package/dist/runtime/context-inspection.js +324 -0
  184. package/dist/runtime/context-inspection.js.map +1 -0
  185. package/dist/runtime/context.d.ts +192 -0
  186. package/dist/runtime/context.js +1246 -0
  187. package/dist/runtime/context.js.map +1 -0
  188. package/dist/runtime/coordination.d.ts +40 -0
  189. package/dist/runtime/coordination.js +87 -0
  190. package/dist/runtime/coordination.js.map +1 -0
  191. package/dist/runtime/model-registry.d.ts +34 -0
  192. package/dist/runtime/model-registry.js +227 -0
  193. package/dist/runtime/model-registry.js.map +1 -0
  194. package/dist/runtime/permissions.d.ts +20 -0
  195. package/dist/runtime/permissions.js +250 -0
  196. package/dist/runtime/permissions.js.map +1 -0
  197. package/dist/runtime/snapshot-config.d.ts +80 -0
  198. package/dist/runtime/snapshot-config.js +268 -0
  199. package/dist/runtime/snapshot-config.js.map +1 -0
  200. package/dist/runtime/snapshot-store.d.ts +25 -0
  201. package/dist/runtime/snapshot-store.js +519 -0
  202. package/dist/runtime/snapshot-store.js.map +1 -0
  203. package/dist/runtime/snapshots.d.ts +59 -0
  204. package/dist/runtime/snapshots.js +721 -0
  205. package/dist/runtime/snapshots.js.map +1 -0
  206. package/dist/runtime/types.d.ts +713 -0
  207. package/dist/runtime/types.js +190 -0
  208. package/dist/runtime/types.js.map +1 -0
  209. package/dist/tui/analytics/indicator.d.ts +25 -26
  210. package/dist/tui/analytics/indicator.js +66 -74
  211. package/dist/tui/analytics/indicator.js.map +1 -1
  212. package/dist/tui/branding/footer.d.ts +7 -12
  213. package/dist/tui/branding/footer.js +16 -24
  214. package/dist/tui/branding/footer.js.map +1 -1
  215. package/dist/tui/context/analyze.d.ts +20 -9
  216. package/dist/tui/context/analyze.js +295 -257
  217. package/dist/tui/context/analyze.js.map +1 -1
  218. package/dist/tui/context/collect.d.ts +29 -3
  219. package/dist/tui/context/collect.js +450 -66
  220. package/dist/tui/context/collect.js.map +1 -1
  221. package/dist/tui/context/plugin.d.ts +21 -7
  222. package/dist/tui/context/plugin.js +65 -70
  223. package/dist/tui/context/plugin.js.map +1 -1
  224. package/dist/tui/context/types.d.ts +174 -43
  225. package/dist/tui/context/types.js +25 -19
  226. package/dist/tui/context/types.js.map +1 -1
  227. package/dist/tui/context/view.d.ts +33 -7
  228. package/dist/tui/context/view.js +136 -81
  229. package/dist/tui/context/view.js.map +1 -1
  230. package/dist/tui/peak-hours/banner.d.ts +13 -11
  231. package/dist/tui/peak-hours/banner.js +48 -80
  232. package/dist/tui/peak-hours/banner.js.map +1 -1
  233. package/dist/tui/policy.d.ts +69 -0
  234. package/dist/tui/policy.js +169 -0
  235. package/dist/tui/policy.js.map +1 -0
  236. package/dist/tui.d.ts +3 -8
  237. package/dist/tui.js +72 -68
  238. package/dist/tui.js.map +1 -1
  239. package/package.json +19 -15
  240. package/schemas/vvoc/v3.json +1 -1
  241. package/server.js +3 -5
  242. package/templates/agents/enhancer.md +10 -5
  243. package/templates/agents/guardian.md +10 -4
  244. package/templates/agents/investigator.md +4 -2
  245. package/templates/agents/vv-code-reviewer.md +4 -2
  246. package/templates/agents/vv-spec-reviewer.md +4 -2
  247. package/templates/skills/vv-execute/references/tool-contracts.md +1 -1
  248. package/tui.js +3 -5
  249. package/dist/plugins/analytics/v2.d.ts +0 -21
  250. package/dist/plugins/analytics/v2.js +0 -133
  251. package/dist/plugins/analytics/v2.js.map +0 -1
  252. package/dist/plugins/guardian/v2.d.ts +0 -13
  253. package/dist/plugins/guardian/v2.js +0 -204
  254. package/dist/plugins/guardian/v2.js.map +0 -1
  255. package/dist/plugins/hashline-edit/v2.d.ts +0 -12
  256. package/dist/plugins/hashline-edit/v2.js +0 -145
  257. package/dist/plugins/hashline-edit/v2.js.map +0 -1
  258. package/dist/plugins/model-roles/v2.d.ts +0 -24
  259. package/dist/plugins/model-roles/v2.js +0 -274
  260. package/dist/plugins/model-roles/v2.js.map +0 -1
  261. package/dist/plugins/peak-hours/v2.d.ts +0 -12
  262. package/dist/plugins/peak-hours/v2.js +0 -99
  263. package/dist/plugins/peak-hours/v2.js.map +0 -1
  264. package/dist/plugins/secrets-redaction/v2.d.ts +0 -19
  265. package/dist/plugins/secrets-redaction/v2.js +0 -138
  266. package/dist/plugins/secrets-redaction/v2.js.map +0 -1
  267. package/dist/plugins/spec-guard/v2.d.ts +0 -12
  268. package/dist/plugins/spec-guard/v2.js +0 -139
  269. package/dist/plugins/spec-guard/v2.js.map +0 -1
  270. package/dist/plugins/system-context-injection/agent-contexts.d.ts +0 -5
  271. package/dist/plugins/system-context-injection/agent-contexts.js +0 -164
  272. package/dist/plugins/system-context-injection/agent-contexts.js.map +0 -1
  273. package/dist/plugins/system-context-injection/v2.d.ts +0 -13
  274. package/dist/plugins/system-context-injection/v2.js +0 -60
  275. package/dist/plugins/system-context-injection/v2.js.map +0 -1
  276. package/dist/plugins/tool-history-compaction/v2.d.ts +0 -11
  277. package/dist/plugins/tool-history-compaction/v2.js +0 -56
  278. package/dist/plugins/tool-history-compaction/v2.js.map +0 -1
  279. package/dist/plugins/v2-runtime/config-watcher.d.ts +0 -26
  280. package/dist/plugins/v2-runtime/config-watcher.js +0 -111
  281. package/dist/plugins/v2-runtime/config-watcher.js.map +0 -1
  282. package/dist/plugins/v2-runtime/index.d.ts +0 -50
  283. package/dist/plugins/v2-runtime/index.js +0 -114
  284. package/dist/plugins/v2-runtime/index.js.map +0 -1
  285. package/dist/plugins/v2-runtime/location-config.d.ts +0 -51
  286. package/dist/plugins/v2-runtime/location-config.js +0 -91
  287. package/dist/plugins/v2-runtime/location-config.js.map +0 -1
  288. package/dist/plugins/v2-runtime/setup.d.ts +0 -48
  289. package/dist/plugins/v2-runtime/setup.js +0 -174
  290. package/dist/plugins/v2-runtime/setup.js.map +0 -1
  291. package/dist/plugins/web-tools/v2.d.ts +0 -11
  292. package/dist/plugins/web-tools/v2.js +0 -99
  293. package/dist/plugins/web-tools/v2.js.map +0 -1
  294. package/dist/plugins/workflow/v2.d.ts +0 -76
  295. package/dist/plugins/workflow/v2.js +0 -283
  296. package/dist/plugins/workflow/v2.js.map +0 -1
@@ -0,0 +1,108 @@
1
+ // FILE: src/runtime/auxiliary.ts
2
+ // VERSION: 2.0.0
3
+ // START_MODULE_CONTRACT
4
+ // PURPOSE: Provide snapshot-bound auxiliary generation for titles and Guardian inference through an explicitly bound native child session and native session.generate.
5
+ // SCOPE: Family-bound auxiliary child creation (explicit agent/model binding, not a fork that copies the parent agent), awaited snapshot-qualified switchModel, title-result short-circuit, retention of native title message content, recursion/deadlock guard, and fail-closed refusal when no family policy is bound. Never calls the stateless experimental generate API and never invents a model.
6
+ // DEPENDS: [src/runtime/model-registry.ts, src/runtime/types.ts]
7
+ // LINKS: [M-NATIVE-RUNTIME, V-M-NATIVE-RUNTIME]
8
+ // ROLE: RUNTIME
9
+ // MAP_MODE: EXPORTS
10
+ // END_MODULE_CONTRACT
11
+ //
12
+ // START_MODULE_MAP
13
+ // AuxiliaryServiceDeps - Injectable native boundaries for snapshot-bound auxiliary generation.
14
+ // createAuxiliaryService - Build the snapshot-bound auxiliary service consumed by title and Guardian.
15
+ // END_MODULE_MAP
16
+ //
17
+ // START_CHANGE_SUMMARY
18
+ // LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-002 attempt 5 - Auxiliary children are created by the runtime as real imported parented sessions carrying host-owned workload metadata; this service records kind/role for that import.]
19
+ // END_CHANGE_SUMMARY
20
+ import { primarySelection, qualifySelection } from "./model-registry.js";
21
+ import { SnapshotUnboundError, } from "./types.js";
22
+ const TITLE_INSTRUCTION = "Generate a short, specific title for this session from the conversation above.";
23
+ /** Build a title prompt from retained native messages plus a stable instruction. */
24
+ function titlePrompt(messages) {
25
+ if (messages === undefined || messages.length === 0)
26
+ return TITLE_INSTRUCTION;
27
+ const transcript = messages
28
+ .slice(-8)
29
+ .map((message) => `${message.role}: ${message.text}`)
30
+ .join("\n");
31
+ return `${transcript}\n\n${TITLE_INSTRUCTION}`;
32
+ }
33
+ /**
34
+ * Build the snapshot-bound auxiliary service. Bound work runs on a verified
35
+ * lineage child of the family root whose model is the family's captured,
36
+ * family-qualified selection; unbound work refuses to fabricate a model.
37
+ */
38
+ export function createAuxiliaryService(deps) {
39
+ const children = new Map();
40
+ const active = new Set();
41
+ async function boundChild(capture, kind, role) {
42
+ const base = role === undefined ? primarySelection(capture) : capture.roleModels[role];
43
+ if (base === undefined)
44
+ return undefined;
45
+ const selection = qualifySelection(capture, base);
46
+ const cacheKey = `${capture.familyId}\u0000${kind}`;
47
+ let child = children.get(cacheKey);
48
+ if (child === undefined) {
49
+ const created = await deps.session.create({
50
+ parentID: capture.familyId,
51
+ locationDirectory: capture.location.directory,
52
+ title: `vvoc ${kind}`,
53
+ kind,
54
+ ...(role === undefined ? {} : { role }),
55
+ model: selection,
56
+ });
57
+ children.set(cacheKey, created.sessionID);
58
+ child = created.sessionID;
59
+ }
60
+ await deps.session.switchModel({ sessionID: child, model: selection });
61
+ return child;
62
+ }
63
+ async function generateBound(capture, kind, prompt, role) {
64
+ const child = await boundChild(capture, kind, role);
65
+ if (child === undefined)
66
+ return undefined;
67
+ return deps.session.generate({ sessionID: child, prompt });
68
+ }
69
+ const service = {
70
+ async title(event) {
71
+ // A host-supplied title always wins; the plugin never overrides it.
72
+ if (typeof event.result === "string" && event.result.length > 0)
73
+ return event.result;
74
+ const capture = await deps.policy(event.sessionID);
75
+ if (capture === undefined)
76
+ return undefined;
77
+ // Guard the whole family against a bound generate recursively re-entering title work.
78
+ if (active.has(capture.familyId))
79
+ return undefined;
80
+ active.add(capture.familyId);
81
+ try {
82
+ const generated = await generateBound(capture, "title", titlePrompt(event.messages), event.role);
83
+ return generated?.text;
84
+ }
85
+ finally {
86
+ active.delete(capture.familyId);
87
+ }
88
+ },
89
+ async generate(input) {
90
+ const capture = await deps.policy(input.sessionID);
91
+ if (capture === undefined) {
92
+ throw new SnapshotUnboundError("Auxiliary generation requires a bound family snapshot; refusing stateless generation.");
93
+ }
94
+ if (active.has(capture.familyId)) {
95
+ throw new SnapshotUnboundError("Auxiliary generation is already running for this family.");
96
+ }
97
+ active.add(capture.familyId);
98
+ try {
99
+ return await generateBound(capture, input.kind, input.prompt, input.role);
100
+ }
101
+ finally {
102
+ active.delete(capture.familyId);
103
+ }
104
+ },
105
+ };
106
+ return service;
107
+ }
108
+ //# sourceMappingURL=auxiliary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auxiliary.js","sourceRoot":"","sources":["../../src/runtime/auxiliary.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,iBAAiB;AACjB,wBAAwB;AACxB,yKAAyK;AACzK,0YAA0Y;AAC1Y,mEAAmE;AACnE,kDAAkD;AAClD,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,iGAAiG;AACjG,wGAAwG;AACxG,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,kOAAkO;AAClO,qBAAqB;AAErB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EACL,oBAAoB,GAKrB,MAAM,YAAY,CAAC;AASpB,MAAM,iBAAiB,GACrB,gFAAgF,CAAC;AAEnF,oFAAoF;AACpF,SAAS,WAAW,CAAC,QAA4D;IAC/E,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAC9E,MAAM,UAAU,GAAG,QAAQ;SACxB,KAAK,CAAC,CAAC,CAAC,CAAC;SACT,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;SACpD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,GAAG,UAAU,OAAO,iBAAiB,EAAE,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAA0B;IAC/D,MAAM,QAAQ,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M,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,MAAM,IAAI,oBAAoB,CAC5B,uFAAuF,CACxF,CAAC;YACJ,CAAC;YACD,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,oBAAoB,CAAC,0DAA0D,CAAC,CAAC;YAC7F,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC7B,IAAI,CAAC;gBACH,OAAO,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5E,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { type OpenCodeClient } from "@opencode/client";
2
+ import { type RuntimeClient, type RuntimeContext, type RuntimeDeps, type RuntimeRpcRegistration } from "./types.js";
3
+ /** Method name of the instance challenge. */
4
+ export declare const NATIVE_RUNTIME_CHALLENGE_METHOD = "instance";
5
+ /** Stable prefix for the per-runtime challenge RPC id. */
6
+ export declare const NATIVE_RUNTIME_CHALLENGE_PREFIX = "vvoc.native-runtime";
7
+ /** Unique challenge RPC id for one runtime instance; distinct contexts never collide. */
8
+ export declare function nativeRuntimeChallengeID(instanceId: string): string;
9
+ /**
10
+ * Portable RPC definition used to prove the discovered service is the loading
11
+ * plugin instance. The id is derived from the per-runtime instance identity so
12
+ * two live runtimes in one host register distinct RPC channels. JSON Schema
13
+ * keeps the foundation dependency-free; fields are decoded at the checked
14
+ * boundary instead of being cast.
15
+ */
16
+ export declare function createNativeRuntimeChallenge(instanceId: string): {
17
+ readonly id: string;
18
+ readonly methods: {
19
+ readonly instance: {
20
+ readonly input: {
21
+ readonly type: "object";
22
+ readonly properties: {
23
+ readonly nonce: {
24
+ readonly type: "string";
25
+ };
26
+ };
27
+ readonly required: readonly ["nonce"];
28
+ readonly additionalProperties: false;
29
+ };
30
+ readonly output: {
31
+ readonly type: "object";
32
+ readonly properties: {
33
+ readonly nonce: {
34
+ readonly type: "string";
35
+ };
36
+ readonly instance: {
37
+ readonly type: "string";
38
+ };
39
+ readonly location: {
40
+ readonly type: "string";
41
+ };
42
+ };
43
+ readonly required: readonly ["nonce", "instance", "location"];
44
+ readonly additionalProperties: false;
45
+ };
46
+ };
47
+ };
48
+ readonly events: {};
49
+ };
50
+ export interface ChallengeRequest {
51
+ readonly nonce: string;
52
+ }
53
+ export interface ChallengeResponse {
54
+ readonly nonce: string;
55
+ readonly instance: string;
56
+ readonly location: string;
57
+ }
58
+ /** Decode untrusted challenge input without casting. */
59
+ export declare function decodeChallengeRequest(value: unknown): ChallengeRequest | undefined;
60
+ /** Decode untrusted challenge output without casting. */
61
+ export declare function decodeChallengeResponse(value: unknown): ChallengeResponse | undefined;
62
+ /** Release a registration while swallowing teardown errors. */
63
+ export declare function disposeQuietly(registration: RuntimeRpcRegistration | undefined): Promise<void>;
64
+ /** Default native discovery/header/client implementation. */
65
+ export declare const nativeRuntimeDeps: RuntimeDeps<OpenCodeClient>;
66
+ /** Authenticated client plus a dispose handle for its RPC registration. */
67
+ export interface NativeClientAcquisition<Client extends RuntimeClient> {
68
+ readonly client: Client;
69
+ readonly dispose: () => Promise<void>;
70
+ }
71
+ /** Inputs required to discover, authenticate, and challenge a client. */
72
+ export interface NativeClientAcquisitionOptions<Client extends RuntimeClient> {
73
+ readonly context: RuntimeContext;
74
+ readonly deps: RuntimeDeps<Client>;
75
+ /** Random per-runtime instance identity returned by the challenge handler. */
76
+ readonly instanceId: string;
77
+ /** Runtime lifetime cancellation; aborts an in-flight challenge. */
78
+ readonly lifetimeSignal?: AbortSignal | undefined;
79
+ /** Random per-call nonce source; deterministic in tests. */
80
+ readonly nextNonce?: (() => string) | undefined;
81
+ }
82
+ /**
83
+ * Discover the already-running service, authenticate with native registration
84
+ * headers, and prove the endpoint is this loading plugin instance through a
85
+ * random RPC challenge. Fails closed on missing/wrong registration, version, or
86
+ * instance/location mismatch, and releases the RPC registration on any failure.
87
+ */
88
+ export declare function acquireNativeClient<Client extends RuntimeClient>(options: NativeClientAcquisitionOptions<Client>): Promise<NativeClientAcquisition<Client>>;
@@ -0,0 +1,174 @@
1
+ // FILE: src/runtime/client.ts
2
+ // VERSION: 1.0.0
3
+ // START_MODULE_CONTRACT
4
+ // PURPOSE: Authenticate the full native client for a plugin instance using only native discovery, native registration headers, and a random same-instance RPC challenge.
5
+ // SCOPE: The challenge RPC definition and its response decoders, credential-safe discovery/authentication, one-shot plugin-instance proof against the plugin's exact location, the default native dependencies, and release of the RPC registration on failure or teardown. Never calls ensure/stop and never parses credentials from logs.
6
+ // DEPENDS: [@opencode/client, @opencode/client/service, @opencode/plugin, node:crypto, src/runtime/types.ts]
7
+ // LINKS: [M-NATIVE-RUNTIME, V-M-NATIVE-RUNTIME]
8
+ // ROLE: RUNTIME
9
+ // MAP_MODE: EXPORTS
10
+ // END_MODULE_CONTRACT
11
+ //
12
+ // START_MODULE_MAP
13
+ // NATIVE_RUNTIME_CHALLENGE_METHOD - Method name of the instance challenge.
14
+ // NATIVE_RUNTIME_CHALLENGE_PREFIX - Stable prefix for the per-runtime challenge RPC id.
15
+ // nativeRuntimeChallengeID - Build the unique challenge RPC id for one runtime instance.
16
+ // createNativeRuntimeChallenge - Build the per-runtime challenge RPC definition so distinct contexts do not collide.
17
+ // ChallengeRequest - Decoded challenge input carrying the random nonce.
18
+ // ChallengeResponse - Decoded challenge output carrying the instance identity and location.
19
+ // decodeChallengeRequest - Decode untrusted challenge input without casting.
20
+ // decodeChallengeResponse - Decode untrusted challenge output without casting.
21
+ // disposeQuietly - Release a registration while swallowing teardown errors.
22
+ // nativeRuntimeDeps - Default native discovery/header/client implementation.
23
+ // NativeClientAcquisition - Authenticated client plus a dispose handle for its RPC registration.
24
+ // NativeClientAcquisitionOptions - Inputs required to discover, authenticate, and challenge a client.
25
+ // acquireNativeClient - Discover, authenticate, challenge, and return the full native client.
26
+ // END_MODULE_MAP
27
+ //
28
+ // START_CHANGE_SUMMARY
29
+ // LAST_CHANGE: [C-OPENCODE-V2-NATIVE T-001 - Made the challenge RPC id per-runtime so distinct plugin contexts register without collision.]
30
+ // END_CHANGE_SUMMARY
31
+ import { randomBytes } from "node:crypto";
32
+ import { OpenCode } from "@opencode/client";
33
+ import { Service } from "@opencode/client/service";
34
+ import { Rpc } from "@opencode/plugin";
35
+ import { RuntimeChallengeError, RuntimeUnavailableError, SUPPORTED_SERVICE_VERSION, } from "./types.js";
36
+ /** Method name of the instance challenge. */
37
+ export const NATIVE_RUNTIME_CHALLENGE_METHOD = "instance";
38
+ /** Stable prefix for the per-runtime challenge RPC id. */
39
+ export const NATIVE_RUNTIME_CHALLENGE_PREFIX = "vvoc.native-runtime";
40
+ /** Unique challenge RPC id for one runtime instance; distinct contexts never collide. */
41
+ export function nativeRuntimeChallengeID(instanceId) {
42
+ return `${NATIVE_RUNTIME_CHALLENGE_PREFIX}.${instanceId}`;
43
+ }
44
+ /**
45
+ * Portable RPC definition used to prove the discovered service is the loading
46
+ * plugin instance. The id is derived from the per-runtime instance identity so
47
+ * two live runtimes in one host register distinct RPC channels. JSON Schema
48
+ * keeps the foundation dependency-free; fields are decoded at the checked
49
+ * boundary instead of being cast.
50
+ */
51
+ export function createNativeRuntimeChallenge(instanceId) {
52
+ return Rpc.define({
53
+ id: nativeRuntimeChallengeID(instanceId),
54
+ methods: {
55
+ instance: {
56
+ input: {
57
+ type: "object",
58
+ properties: { nonce: { type: "string" } },
59
+ required: ["nonce"],
60
+ additionalProperties: false,
61
+ },
62
+ output: {
63
+ type: "object",
64
+ properties: {
65
+ nonce: { type: "string" },
66
+ instance: { type: "string" },
67
+ location: { type: "string" },
68
+ },
69
+ required: ["nonce", "instance", "location"],
70
+ additionalProperties: false,
71
+ },
72
+ },
73
+ },
74
+ events: {},
75
+ });
76
+ }
77
+ function isRecord(value) {
78
+ return typeof value === "object" && value !== null;
79
+ }
80
+ /** Decode untrusted challenge input without casting. */
81
+ export function decodeChallengeRequest(value) {
82
+ if (!isRecord(value) || typeof value.nonce !== "string")
83
+ return undefined;
84
+ return { nonce: value.nonce };
85
+ }
86
+ /** Decode untrusted challenge output without casting. */
87
+ export function decodeChallengeResponse(value) {
88
+ if (!isRecord(value))
89
+ return undefined;
90
+ if (typeof value.nonce !== "string" ||
91
+ typeof value.instance !== "string" ||
92
+ typeof value.location !== "string") {
93
+ return undefined;
94
+ }
95
+ return { nonce: value.nonce, instance: value.instance, location: value.location };
96
+ }
97
+ // END_BLOCK_CHALLENGE_DECODING
98
+ /** Release a registration while swallowing teardown errors. */
99
+ export async function disposeQuietly(registration) {
100
+ if (registration === undefined)
101
+ return;
102
+ try {
103
+ await registration.dispose();
104
+ }
105
+ catch {
106
+ // Teardown must never mask the acquisition outcome or stop the host.
107
+ }
108
+ }
109
+ // START_BLOCK_NATIVE_DEPS
110
+ /** Default native discovery/header/client implementation. */
111
+ export const nativeRuntimeDeps = {
112
+ serviceVersion: SUPPORTED_SERVICE_VERSION,
113
+ discoverService: (options) => Service.discover({ version: options.version }),
114
+ serviceHeaders: (endpoint) => Service.headers(endpoint),
115
+ makeClient: ({ baseUrl, headers }) => OpenCode.make({ baseUrl, headers }),
116
+ };
117
+ function defaultNonce() {
118
+ return randomBytes(16).toString("hex");
119
+ }
120
+ /**
121
+ * Discover the already-running service, authenticate with native registration
122
+ * headers, and prove the endpoint is this loading plugin instance through a
123
+ * random RPC challenge. Fails closed on missing/wrong registration, version, or
124
+ * instance/location mismatch, and releases the RPC registration on any failure.
125
+ */
126
+ export async function acquireNativeClient(options) {
127
+ const { context, deps, instanceId } = options;
128
+ const nextNonce = options.nextNonce ?? defaultNonce;
129
+ const challenge = createNativeRuntimeChallenge(instanceId);
130
+ const registration = await context.rpc.register(challenge, {
131
+ [NATIVE_RUNTIME_CHALLENGE_METHOD]: async (input) => {
132
+ const request = decodeChallengeRequest(input);
133
+ return {
134
+ nonce: request?.nonce ?? "",
135
+ instance: instanceId,
136
+ location: context.location.directory,
137
+ };
138
+ },
139
+ });
140
+ try {
141
+ const endpoint = await deps.discoverService({ version: deps.serviceVersion });
142
+ if (endpoint === undefined)
143
+ throw new RuntimeUnavailableError();
144
+ const headers = deps.serviceHeaders(endpoint);
145
+ const client = deps.makeClient({ baseUrl: endpoint.url, headers });
146
+ const nonce = nextNonce();
147
+ let response;
148
+ try {
149
+ response = await client.rpc(challenge)[NATIVE_RUNTIME_CHALLENGE_METHOD]({ nonce }, {
150
+ location: { directory: context.location.directory },
151
+ ...(options.lifetimeSignal === undefined ? {} : { signal: options.lifetimeSignal }),
152
+ });
153
+ }
154
+ catch (cause) {
155
+ throw new RuntimeChallengeError("the challenge call failed", { cause });
156
+ }
157
+ const decoded = decodeChallengeResponse(response);
158
+ if (decoded === undefined)
159
+ throw new RuntimeChallengeError("the response was not a valid challenge payload");
160
+ if (decoded.nonce !== nonce)
161
+ throw new RuntimeChallengeError("the nonce was not echoed");
162
+ if (decoded.instance !== instanceId)
163
+ throw new RuntimeChallengeError("the plugin instance did not match");
164
+ if (decoded.location !== context.location.directory)
165
+ throw new RuntimeChallengeError("the location did not match");
166
+ return { client, dispose: () => disposeQuietly(registration) };
167
+ }
168
+ catch (error) {
169
+ await disposeQuietly(registration);
170
+ throw error;
171
+ }
172
+ }
173
+ // END_BLOCK_CLIENT_ACQUISITION
174
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/runtime/client.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iBAAiB;AACjB,wBAAwB;AACxB,2KAA2K;AAC3K,8UAA8U;AAC9U,+GAA+G;AAC/G,kDAAkD;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