@vibesdotdev/agent-execution 0.0.0-stage → 1.0.0-rc.2

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 (191) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +53 -2
  3. package/dist/code-session/agent-code-session.consumer.descriptor.d.ts +68 -0
  4. package/dist/code-session/agent-code-session.consumer.descriptor.d.ts.map +1 -0
  5. package/dist/code-session/agent-code-session.consumer.descriptor.js +31 -0
  6. package/dist/code-session/agent-code-session.consumer.descriptor.js.map +1 -0
  7. package/dist/code-session/agent-code-session.consumer.plugin.d.ts +18 -0
  8. package/dist/code-session/agent-code-session.consumer.plugin.d.ts.map +1 -0
  9. package/dist/code-session/agent-code-session.consumer.plugin.js +47 -0
  10. package/dist/code-session/agent-code-session.consumer.plugin.js.map +1 -0
  11. package/dist/code-session/agent-code-session.descriptor.d.ts +163 -0
  12. package/dist/code-session/agent-code-session.descriptor.d.ts.map +1 -0
  13. package/dist/code-session/agent-code-session.descriptor.js +129 -0
  14. package/dist/code-session/agent-code-session.descriptor.js.map +1 -0
  15. package/dist/code-session/agent-code-session.impl.consumer.d.ts +224 -0
  16. package/dist/code-session/agent-code-session.impl.consumer.d.ts.map +1 -0
  17. package/dist/code-session/agent-code-session.impl.consumer.js +2131 -0
  18. package/dist/code-session/agent-code-session.impl.consumer.js.map +1 -0
  19. package/dist/code-session/agent-code-session.kind.d.ts +15 -0
  20. package/dist/code-session/agent-code-session.kind.d.ts.map +1 -0
  21. package/dist/code-session/agent-code-session.kind.js +17 -0
  22. package/dist/code-session/agent-code-session.kind.js.map +1 -0
  23. package/dist/code-session/agent-code-session.plugin.d.ts +17 -0
  24. package/dist/code-session/agent-code-session.plugin.d.ts.map +1 -0
  25. package/dist/code-session/agent-code-session.plugin.js +28 -0
  26. package/dist/code-session/agent-code-session.plugin.js.map +1 -0
  27. package/dist/code-session/billing/gates.d.ts +52 -0
  28. package/dist/code-session/billing/gates.d.ts.map +1 -0
  29. package/dist/code-session/billing/gates.js +75 -0
  30. package/dist/code-session/billing/gates.js.map +1 -0
  31. package/dist/code-session/client/index.d.ts +2 -0
  32. package/dist/code-session/client/index.d.ts.map +1 -0
  33. package/dist/code-session/client/index.js +2 -0
  34. package/dist/code-session/client/index.js.map +1 -0
  35. package/dist/code-session/client/resolve.d.ts +20 -0
  36. package/dist/code-session/client/resolve.d.ts.map +1 -0
  37. package/dist/code-session/client/resolve.js +145 -0
  38. package/dist/code-session/client/resolve.js.map +1 -0
  39. package/dist/code-session/docs/agent-code-session.docs.descriptor.d.ts +4 -0
  40. package/dist/code-session/docs/agent-code-session.docs.descriptor.d.ts.map +1 -0
  41. package/dist/code-session/docs/agent-code-session.docs.descriptor.js +109 -0
  42. package/dist/code-session/docs/agent-code-session.docs.descriptor.js.map +1 -0
  43. package/dist/code-session/git-credential.d.ts +87 -0
  44. package/dist/code-session/git-credential.d.ts.map +1 -0
  45. package/dist/code-session/git-credential.js +107 -0
  46. package/dist/code-session/git-credential.js.map +1 -0
  47. package/dist/code-session/host-target.d.ts +76 -0
  48. package/dist/code-session/host-target.d.ts.map +1 -0
  49. package/dist/code-session/host-target.js +81 -0
  50. package/dist/code-session/host-target.js.map +1 -0
  51. package/dist/code-session/index.d.ts +20 -0
  52. package/dist/code-session/index.d.ts.map +1 -0
  53. package/dist/code-session/index.js +20 -0
  54. package/dist/code-session/index.js.map +1 -0
  55. package/dist/code-session/interfaces/code-session.d.ts +448 -0
  56. package/dist/code-session/interfaces/code-session.d.ts.map +1 -0
  57. package/dist/code-session/interfaces/code-session.js +373 -0
  58. package/dist/code-session/interfaces/code-session.js.map +1 -0
  59. package/dist/code-session/operation-lease.d.ts +48 -0
  60. package/dist/code-session/operation-lease.d.ts.map +1 -0
  61. package/dist/code-session/operation-lease.js +73 -0
  62. package/dist/code-session/operation-lease.js.map +1 -0
  63. package/dist/code-session/remote-setup-custody.d.ts +59 -0
  64. package/dist/code-session/remote-setup-custody.d.ts.map +1 -0
  65. package/dist/code-session/remote-setup-custody.js +78 -0
  66. package/dist/code-session/remote-setup-custody.js.map +1 -0
  67. package/dist/code-session/remote-workspace-fs.d.ts +119 -0
  68. package/dist/code-session/remote-workspace-fs.d.ts.map +1 -0
  69. package/dist/code-session/remote-workspace-fs.js +257 -0
  70. package/dist/code-session/remote-workspace-fs.js.map +1 -0
  71. package/dist/code-session/session-metadata.d.ts +40 -0
  72. package/dist/code-session/session-metadata.d.ts.map +1 -0
  73. package/dist/code-session/session-metadata.js +69 -0
  74. package/dist/code-session/session-metadata.js.map +1 -0
  75. package/dist/code-session-relay/agent-code-session-relay.descriptor.d.ts +78 -0
  76. package/dist/code-session-relay/agent-code-session-relay.descriptor.d.ts.map +1 -0
  77. package/dist/code-session-relay/agent-code-session-relay.descriptor.js +38 -0
  78. package/dist/code-session-relay/agent-code-session-relay.descriptor.js.map +1 -0
  79. package/dist/code-session-relay/agent-code-session-relay.impl.d.ts +120 -0
  80. package/dist/code-session-relay/agent-code-session-relay.impl.d.ts.map +1 -0
  81. package/dist/code-session-relay/agent-code-session-relay.impl.js +1392 -0
  82. package/dist/code-session-relay/agent-code-session-relay.impl.js.map +1 -0
  83. package/dist/code-session-relay/agent-code-session-relay.plugin.d.ts +14 -0
  84. package/dist/code-session-relay/agent-code-session-relay.plugin.d.ts.map +1 -0
  85. package/dist/code-session-relay/agent-code-session-relay.plugin.js +25 -0
  86. package/dist/code-session-relay/agent-code-session-relay.plugin.js.map +1 -0
  87. package/dist/code-session-relay/index.d.ts +13 -0
  88. package/dist/code-session-relay/index.d.ts.map +1 -0
  89. package/dist/code-session-relay/index.js +13 -0
  90. package/dist/code-session-relay/index.js.map +1 -0
  91. package/dist/code-session-relay/relay-dial.d.ts +72 -0
  92. package/dist/code-session-relay/relay-dial.d.ts.map +1 -0
  93. package/dist/code-session-relay/relay-dial.js +177 -0
  94. package/dist/code-session-relay/relay-dial.js.map +1 -0
  95. package/dist/index.d.ts +10 -0
  96. package/dist/index.d.ts.map +1 -0
  97. package/dist/index.js +10 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/sandbox/agent-sandbox.consumer.descriptor.d.ts +35 -0
  100. package/dist/sandbox/agent-sandbox.consumer.descriptor.d.ts.map +1 -0
  101. package/dist/sandbox/agent-sandbox.consumer.descriptor.js +19 -0
  102. package/dist/sandbox/agent-sandbox.consumer.descriptor.js.map +1 -0
  103. package/dist/sandbox/agent-sandbox.consumer.plugin.d.ts +9 -0
  104. package/dist/sandbox/agent-sandbox.consumer.plugin.d.ts.map +1 -0
  105. package/dist/sandbox/agent-sandbox.consumer.plugin.js +33 -0
  106. package/dist/sandbox/agent-sandbox.consumer.plugin.js.map +1 -0
  107. package/dist/sandbox/agent-sandbox.descriptor.d.ts +76 -0
  108. package/dist/sandbox/agent-sandbox.descriptor.d.ts.map +1 -0
  109. package/dist/sandbox/agent-sandbox.descriptor.js +57 -0
  110. package/dist/sandbox/agent-sandbox.descriptor.js.map +1 -0
  111. package/dist/sandbox/agent-sandbox.impl.consumer.d.ts +15 -0
  112. package/dist/sandbox/agent-sandbox.impl.consumer.d.ts.map +1 -0
  113. package/dist/sandbox/agent-sandbox.impl.consumer.js +23 -0
  114. package/dist/sandbox/agent-sandbox.impl.consumer.js.map +1 -0
  115. package/dist/sandbox/agent-sandbox.kind.d.ts +14 -0
  116. package/dist/sandbox/agent-sandbox.kind.d.ts.map +1 -0
  117. package/dist/sandbox/agent-sandbox.kind.js +16 -0
  118. package/dist/sandbox/agent-sandbox.kind.js.map +1 -0
  119. package/dist/sandbox/agent-sandbox.plugin.d.ts +15 -0
  120. package/dist/sandbox/agent-sandbox.plugin.d.ts.map +1 -0
  121. package/dist/sandbox/agent-sandbox.plugin.js +25 -0
  122. package/dist/sandbox/agent-sandbox.plugin.js.map +1 -0
  123. package/dist/sandbox/client/resolve.d.ts +21 -0
  124. package/dist/sandbox/client/resolve.d.ts.map +1 -0
  125. package/dist/sandbox/client/resolve.js +103 -0
  126. package/dist/sandbox/client/resolve.js.map +1 -0
  127. package/dist/sandbox/docs/agent-sandbox.docs.descriptor.d.ts +4 -0
  128. package/dist/sandbox/docs/agent-sandbox.docs.descriptor.d.ts.map +1 -0
  129. package/dist/sandbox/docs/agent-sandbox.docs.descriptor.js +75 -0
  130. package/dist/sandbox/docs/agent-sandbox.docs.descriptor.js.map +1 -0
  131. package/dist/sandbox/index.d.ts +15 -0
  132. package/dist/sandbox/index.d.ts.map +1 -0
  133. package/dist/sandbox/index.js +14 -0
  134. package/dist/sandbox/index.js.map +1 -0
  135. package/dist/sandbox/interfaces/sandbox.d.ts +61 -0
  136. package/dist/sandbox/interfaces/sandbox.d.ts.map +1 -0
  137. package/dist/sandbox/interfaces/sandbox.js +54 -0
  138. package/dist/sandbox/interfaces/sandbox.js.map +1 -0
  139. package/dist/schemas/code-session-resolution.d.ts +20 -0
  140. package/dist/schemas/code-session-resolution.d.ts.map +1 -0
  141. package/dist/schemas/code-session-resolution.js +11 -0
  142. package/dist/schemas/code-session-resolution.js.map +1 -0
  143. package/dist/schemas/session-operation.d.ts +73 -0
  144. package/dist/schemas/session-operation.d.ts.map +1 -0
  145. package/dist/schemas/session-operation.js +47 -0
  146. package/dist/schemas/session-operation.js.map +1 -0
  147. package/dist/schemas/voice.d.ts +87 -0
  148. package/dist/schemas/voice.d.ts.map +1 -0
  149. package/dist/schemas/voice.js +70 -0
  150. package/dist/schemas/voice.js.map +1 -0
  151. package/dist/voice/agent-voice.consumer.descriptor.d.ts +43 -0
  152. package/dist/voice/agent-voice.consumer.descriptor.d.ts.map +1 -0
  153. package/dist/voice/agent-voice.consumer.descriptor.js +20 -0
  154. package/dist/voice/agent-voice.consumer.descriptor.js.map +1 -0
  155. package/dist/voice/agent-voice.consumer.plugin.d.ts +4 -0
  156. package/dist/voice/agent-voice.consumer.plugin.d.ts.map +1 -0
  157. package/dist/voice/agent-voice.consumer.plugin.js +13 -0
  158. package/dist/voice/agent-voice.consumer.plugin.js.map +1 -0
  159. package/dist/voice/agent-voice.descriptor.d.ts +82 -0
  160. package/dist/voice/agent-voice.descriptor.d.ts.map +1 -0
  161. package/dist/voice/agent-voice.descriptor.js +79 -0
  162. package/dist/voice/agent-voice.descriptor.js.map +1 -0
  163. package/dist/voice/agent-voice.impl.consumer.d.ts +35 -0
  164. package/dist/voice/agent-voice.impl.consumer.d.ts.map +1 -0
  165. package/dist/voice/agent-voice.impl.consumer.js +50 -0
  166. package/dist/voice/agent-voice.impl.consumer.js.map +1 -0
  167. package/dist/voice/agent-voice.kind.d.ts +67 -0
  168. package/dist/voice/agent-voice.kind.d.ts.map +1 -0
  169. package/dist/voice/agent-voice.kind.js +26 -0
  170. package/dist/voice/agent-voice.kind.js.map +1 -0
  171. package/dist/voice/agent-voice.plugin.d.ts +4 -0
  172. package/dist/voice/agent-voice.plugin.d.ts.map +1 -0
  173. package/dist/voice/agent-voice.plugin.js +18 -0
  174. package/dist/voice/agent-voice.plugin.js.map +1 -0
  175. package/dist/voice/client.d.ts +38 -0
  176. package/dist/voice/client.d.ts.map +1 -0
  177. package/dist/voice/client.js +29 -0
  178. package/dist/voice/client.js.map +1 -0
  179. package/dist/voice/index.d.ts +14 -0
  180. package/dist/voice/index.d.ts.map +1 -0
  181. package/dist/voice/index.js +14 -0
  182. package/dist/voice/index.js.map +1 -0
  183. package/dist/voice/pipeline.d.ts +66 -0
  184. package/dist/voice/pipeline.d.ts.map +1 -0
  185. package/dist/voice/pipeline.js +330 -0
  186. package/dist/voice/pipeline.js.map +1 -0
  187. package/dist/voice/session.d.ts +29 -0
  188. package/dist/voice/session.d.ts.map +1 -0
  189. package/dist/voice/session.js +78 -0
  190. package/dist/voice/session.js.map +1 -0
  191. package/package.json +279 -4
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VIBES DEV LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial
12
+ portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
16
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,54 @@
1
- # Temporary Holding Version
1
+ # @vibesdotdev/agent-execution
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Runtime contracts for persistent code sessions, sandbox execution, voice turns,
4
+ and fleet-host code-session relays. See [SPEC.md](SPEC.md) for ownership.
5
+
6
+ ## Code sessions
7
+
8
+ Compose `./code-session/plugin` for the universal kind and
9
+ `./code-session/consumer.plugin` on consumer hosts. Consumer startup activates
10
+ the `code-session-custody` semantic `runtime/client`. The compatible
11
+ `remoteSetupCustody(runtime)` helper uses `tryGetVibesClient` after activation.
12
+ Disposal cancels retained remote setups and reports unconfirmed cleanup with
13
+ typed, value-free refusals. Resolver options and descriptors are schema-admitted,
14
+ including throwing getters and proxies.
15
+
16
+ Consumer Git commits reject failed add, staged inspection, commit and hash
17
+ lookup stages with stable typed refusals containing only operation/exit-code
18
+ facts. Git output and caught causes stay out of public failures. Existing staged
19
+ changes, scoped commits and author handling remain supported.
20
+
21
+ Explicit teardown can also report `code-session-cleanup-unconfirmed`.
22
+ The recoverable cleanup contract retains durable authorization outside the
23
+ workspace until removal is confirmed, then publishes the terminal tombstone.
24
+ Legacy relay metadata without an operation identity is adopted before the
25
+ workspace moves. Once adopted, pending cleanup refuses ordinary session work.
26
+ Failed moves retain durable authorization for retry after
27
+ runtime recreation, including reclaiming an expired lease after abrupt owner
28
+ loss. Acquisition publishes a fully prepared lease atomically; interrupted
29
+ preparation cannot block recovery. Initial adoption uses the same lease and
30
+ rereads the durable record before publication. Delayed adopters preserve the
31
+ authoritative cleanup state, and retired holders cannot publish operation records
32
+ or release a successor's lease.
33
+ Successful cleanup leaves an idempotent terminal tombstone.
34
+ The [relay contract](src/code-session-relay/SPEC.md) owns recovery after partial
35
+ deletion and restart. Relay clone and push preserve complete credential leases
36
+ for the canonical Git owner's remote, operation and expiry checks. The binding
37
+ adapter preserves the acting-user header on forwarded broker requests.
38
+
39
+ ## Voice
40
+
41
+ Compose `./voice/plugin` for the universal kind and semantic client, then
42
+ `./voice/consumer.plugin` for local resolution. Consumer loaders stay in that
43
+ explicit subpath. Resolve `VoiceClient` from `./voice/client` using
44
+ `getVibesClient('agent-voice', runtime)`. Sessions belong to that runtime and
45
+ close when it disposes. `./voice/agent-voice` keeps the compatible
46
+ `ConsumerAgentVoice` and `VoiceSession` entrypoints. Inject STT, agent and TTS
47
+ stages; their unknown results pass through the pipeline's schemas.
48
+
49
+ ## Verification
50
+
51
+ Run rules, lint, `bun run check`, `bun run test`, and `bun run build`.
52
+ The no-emit project includes source and tests; the build project emits production
53
+ artifacts only. Unit tests run in-process; publish preflight owns packed-artifact
54
+ and external consumer proof.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Consumer `agent/code-session` descriptor instance.
3
+ *
4
+ * Backed by a persistent, profile-owned code-session workspace + git
5
+ * CLI + long-lived `Bun.spawn` handles on a platform Host (see
6
+ * `agent-code-session.impl.consumer.ts`). `priority: 100` (consumer default),
7
+ * `trustLevel: '2b'` — a code session is inherently FS-writable (it edits a
8
+ * cloned repo), so it sits at the writable tier.
9
+ */
10
+ declare const consumerCodeSessionDescriptor: {
11
+ id: string;
12
+ kind: "agent/code-session";
13
+ name: string;
14
+ priority: number;
15
+ surfaces: ("agent" | "worker" | "direct")[];
16
+ timeoutMs: number;
17
+ memoryLimit: number;
18
+ trustLevel: "0" | "1" | "3" | "2a" | "2b";
19
+ os: ("linux" | "macos" | "windows")[];
20
+ arch: ("x64" | "arm64")[];
21
+ runtimeConfig: {
22
+ environmentName?: string | undefined;
23
+ node?: string | undefined;
24
+ bun?: string | undefined;
25
+ setupScript?: string | undefined;
26
+ };
27
+ exposedPorts: string[];
28
+ allowInteractiveShell: boolean;
29
+ billingGates: {
30
+ feature: string;
31
+ deniedMessage: string;
32
+ }[];
33
+ description?: string | undefined;
34
+ tags?: string[] | undefined;
35
+ hardware?: string[] | undefined;
36
+ enabled?: boolean | undefined;
37
+ capabilityId?: string | undefined;
38
+ requiredContext?: string[] | undefined;
39
+ optionalContext?: string[] | undefined;
40
+ config?: unknown;
41
+ retention?: string | {
42
+ reason: string;
43
+ maxAgeDays?: number | undefined;
44
+ maxEntries?: number | undefined;
45
+ maxBytes?: number | undefined;
46
+ cascadeFrom?: string | undefined;
47
+ ageField?: string | undefined;
48
+ enforcedBy?: string | undefined;
49
+ } | undefined;
50
+ hostTarget?: {
51
+ kind: "cloud";
52
+ } | {
53
+ kind: "host";
54
+ hostId: string;
55
+ } | {
56
+ kind: "provisioned";
57
+ adapter: string;
58
+ region?: string | undefined;
59
+ size?: string | undefined;
60
+ image?: string | undefined;
61
+ repo?: string | undefined;
62
+ branch?: string | undefined;
63
+ ttlHours?: number | undefined;
64
+ providerConfig?: Record<string, unknown> | undefined;
65
+ } | undefined;
66
+ };
67
+ export default consumerCodeSessionDescriptor;
68
+ //# sourceMappingURL=agent-code-session.consumer.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.consumer.descriptor.d.ts","sourceRoot":"","sources":["../../src/code-session/agent-code-session.consumer.descriptor.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBjC,CAAC;AAEH,eAAe,6BAA6B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { createAgentCodeSessionDescriptor } from "./agent-code-session.descriptor.js";
2
+ /**
3
+ * Consumer `agent/code-session` descriptor instance.
4
+ *
5
+ * Backed by a persistent, profile-owned code-session workspace + git
6
+ * CLI + long-lived `Bun.spawn` handles on a platform Host (see
7
+ * `agent-code-session.impl.consumer.ts`). `priority: 100` (consumer default),
8
+ * `trustLevel: '2b'` — a code session is inherently FS-writable (it edits a
9
+ * cloned repo), so it sits at the writable tier.
10
+ */
11
+ const consumerCodeSessionDescriptor = createAgentCodeSessionDescriptor({
12
+ id: 'agent-code-session-bun',
13
+ name: 'Agent Code Session — Bun on Host',
14
+ description: 'Consumer persistent code session. Clones a repo under the active Vibes profile, runs long-lived processes via Bun.spawn, and performs git ops via the git CLI on a platform Host.',
15
+ hardware: ['consumer'],
16
+ os: ['linux'],
17
+ arch: ['x64'],
18
+ priority: 100,
19
+ // Per-call ceiling. The tool's timeoutMs is clamped to this. 30 minutes covers
20
+ // a sequential package test run; the native-tool wrapper still defaults to 60s
21
+ // unless the caller raises timeoutMs.
22
+ timeoutMs: 1_800_000,
23
+ memoryLimit: 1024,
24
+ trustLevel: '2b',
25
+ hostTarget: { kind: 'host', hostId: 'local' },
26
+ runtimeConfig: {},
27
+ exposedPorts: [],
28
+ allowInteractiveShell: false
29
+ });
30
+ export default consumerCodeSessionDescriptor;
31
+ //# sourceMappingURL=agent-code-session.consumer.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.consumer.descriptor.js","sourceRoot":"","sources":["../../src/code-session/agent-code-session.consumer.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;;;;;;;GAQG;AACH,MAAM,6BAA6B,GAAG,gCAAgC,CAAC;IACtE,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,kCAAkC;IACxC,WAAW,EACV,mLAAmL;IACpL,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,EAAE,EAAE,CAAC,OAAO,CAAC;IACb,IAAI,EAAE,CAAC,KAAK,CAAC;IACb,QAAQ,EAAE,GAAG;IACb,+EAA+E;IAC/E,+EAA+E;IAC/E,sCAAsC;IACtC,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAC7C,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,EAAE;IAChB,qBAAqB,EAAE,KAAK;CAC5B,CAAC,CAAC;AAEH,eAAe,6BAA6B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Agent Code Session — consumer (Bun-on-a-Host) impl plugin.
3
+ *
4
+ * Loader-only sub-plugin: registers the consumer `agent/code-session`
5
+ * descriptor + the consumer impl loader (the `*.impl.consumer.js` static edge)
6
+ * against the `agent/code-session` kind declared by `@vibesdotdev/agent-execution/code-session`.
7
+ *
8
+ * Split out of the kind-declaring plugin so the universal plugin carries NO
9
+ * `*.impl.consumer.*` import — cloud apps load the universal plugin (to declare
10
+ * the kind for the cloudflare adapter) without dragging the Node-only consumer
11
+ * impl (node:crypto, runtime-environment-bun, Bun.spawn) into the workerd
12
+ * bundle. Compose this plugin ONLY in a consumer-scope vibes.config (host
13
+ * daemon / CLI agent build); cloud configs must NOT import it. Mirrors the
14
+ * disjoint-loader shape of the provider-owned cloud plugin.
15
+ */
16
+ export declare const agentCodeSessionConsumerPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
17
+ export default agentCodeSessionConsumerPlugin;
18
+ //# sourceMappingURL=agent-code-session.consumer.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.consumer.plugin.d.ts","sourceRoot":"","sources":["../../src/code-session/agent-code-session.consumer.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,eAAO,MAAM,8BAA8B,6CA6BzC,CAAC;AAEH,eAAe,8BAA8B,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Agent Code Session — consumer (Bun-on-a-Host) impl plugin.
3
+ *
4
+ * Loader-only sub-plugin: registers the consumer `agent/code-session`
5
+ * descriptor + the consumer impl loader (the `*.impl.consumer.js` static edge)
6
+ * against the `agent/code-session` kind declared by `@vibesdotdev/agent-execution/code-session`.
7
+ *
8
+ * Split out of the kind-declaring plugin so the universal plugin carries NO
9
+ * `*.impl.consumer.*` import — cloud apps load the universal plugin (to declare
10
+ * the kind for the cloudflare adapter) without dragging the Node-only consumer
11
+ * impl (node:crypto, runtime-environment-bun, Bun.spawn) into the workerd
12
+ * bundle. Compose this plugin ONLY in a consumer-scope vibes.config (host
13
+ * daemon / CLI agent build); cloud configs must NOT import it. Mirrors the
14
+ * disjoint-loader shape of the provider-owned cloud plugin.
15
+ */
16
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel';
17
+ import { runtimeRpcExecutionPlugin } from '@vibesdotdev/kernel-rpc/execution';
18
+ import consumerCodeSessionDescriptor from "./agent-code-session.consumer.descriptor.js";
19
+ import { getVibesClient, runtimeClientPlugin } from '@vibesdotdev/kernel/client';
20
+ import { remoteSetupCustodyDescriptor } from "./remote-setup-custody.js";
21
+ export const agentCodeSessionConsumerPlugin = createRuntimePlugin({
22
+ id: 'agent-code-session-consumer',
23
+ name: 'Agent Code Session — Bun on Host (consumer impl)',
24
+ description: 'Consumer persistent code session for the agent/code-session kind. Clones a repo under the active Vibes profile, runs long-lived processes via Bun.spawn, performs git ops via the git CLI. Consumer-scope only — not loaded by cloud apps.',
25
+ dependencies: ['agent-code-session'],
26
+ descriptors: [consumerCodeSessionDescriptor],
27
+ loaders: [
28
+ loader(consumerCodeSessionDescriptor.id, { kind: 'agent/code-session', scope: 'consumer' }, () => import("./agent-code-session.impl.consumer.js"))
29
+ ],
30
+ async onRegister(runtime) {
31
+ // A remote spawn is acquired through the runtime-owned `execution-wire`
32
+ // client (kernel-rpc). The consumer impl resolves it synchronously at
33
+ // dispatch, so the plugin that owns the impl also composes its owner.
34
+ await runtime.registerPlugin(runtimeRpcExecutionPlugin);
35
+ if (!runtime.hasKind('runtime/client'))
36
+ await runtime.registerPlugin(runtimeClientPlugin);
37
+ runtime.registerDescriptor('runtime/client', remoteSetupCustodyDescriptor);
38
+ runtime.registerLoader('runtime/client', remoteSetupCustodyDescriptor.id, async () => ({ impl: (await import("./remote-setup-custody.js")).RemoteSetupCustodyClient }));
39
+ await getVibesClient(remoteSetupCustodyDescriptor.id, runtime);
40
+ },
41
+ onDispose(runtime) {
42
+ return runtime.query('runtime/client')
43
+ .withId(remoteSetupCustodyDescriptor.id).peek?.()?.dispose();
44
+ }
45
+ });
46
+ export default agentCodeSessionConsumerPlugin;
47
+ //# sourceMappingURL=agent-code-session.consumer.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.consumer.plugin.js","sourceRoot":"","sources":["../../src/code-session/agent-code-session.consumer.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,6BAA6B,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAiC,MAAM,2BAA2B,CAAC;AAExG,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC;IACjE,EAAE,EAAE,6BAA6B;IACjC,IAAI,EAAE,kDAAkD;IACx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contract from a one-shot throwaway exec into a *persistent*
6
+ * workspace bound to `{repository, hostTarget, runtimeConfig}`:
7
+ *
8
+ * one-shot agent/sandbox → persistent agent/code-session
9
+ * ────────────────────── ─────────────────────────────
10
+ * run snippet, capture, clone repo once, then attach/run/edit/commit
11
+ * tear down workspace across many calls; workspace survives until
12
+ * an explicit teardown; long-lived procs +
13
+ * exposed ports + a preview URL.
14
+ *
15
+ * Why a kind: the *how* of a persistent workspace is scope-specific — a
16
+ * consumer Host runs a profile-owned workspace + long-lived `Bun.spawn`
17
+ * handles, cloud runs a per-session Cloudflare Sandbox — but the lifecycle
18
+ * contract (initialize → attach → runCommand → read/write/patch → git → expose
19
+ * port → teardown) is universal. Build mode's code-session tools call one kind
20
+ * regardless of where the bytes run.
21
+ *
22
+ * The descriptor mirrors `AgentSandboxDescriptorSchema` (same trust ladder,
23
+ * priority, timeout/memory ceilings) and adds the session-binding fields.
24
+ */
25
+ import * as z from 'zod/v4';
26
+ /** Surfaces a code session can be addressed through (mirrors agent/sandbox). */
27
+ export declare const CodeSessionSurfaceSchema: z.ZodEnum<{
28
+ agent: "agent";
29
+ worker: "worker";
30
+ direct: "direct";
31
+ }>;
32
+ export type CodeSessionSurface = z.infer<typeof CodeSessionSurfaceSchema>;
33
+ /**
34
+ * A billing gate this execution surface requires BEFORE a session may start.
35
+ * Each gate is a billing feature slug checked via the account billing client
36
+ * (`checkQuota(feature) → allowed`), plus the operator-facing message to
37
+ * surface on denial. The RESOLVED descriptor's gates are enforced by the
38
+ * platform route — so a surface declares its own billing posture here rather
39
+ * than the endpoint growing a `hostTarget.kind` conditional.
40
+ *
41
+ * `feature` values are `@vibesdotdev/account` FEATURE_SLUGS (a stable public
42
+ * contract — the descriptor declares the slug string rather than importing the
43
+ * account package, keeping the runtime tier billing-agnostic). A composition
44
+ * point that imports both (platform-web) guards them against drift.
45
+ */
46
+ export declare const CodeSessionBillingGateSchema: z.ZodObject<{
47
+ feature: z.ZodString;
48
+ deniedMessage: z.ZodString;
49
+ }, z.core.$strip>;
50
+ export type CodeSessionBillingGate = z.infer<typeof CodeSessionBillingGateSchema>;
51
+ /**
52
+ * Trust ladder, aligned with the agent capability-tier values. A code session
53
+ * is inherently FS-writable (it edits a repo), so it sits at the same tier as
54
+ * the writable sandbox (`'2b'`+).
55
+ */
56
+ export declare const CodeSessionTrustLevelSchema: z.ZodEnum<{
57
+ 0: "0";
58
+ 1: "1";
59
+ 3: "3";
60
+ "2a": "2a";
61
+ "2b": "2b";
62
+ }>;
63
+ export type CodeSessionTrustLevel = z.infer<typeof CodeSessionTrustLevelSchema>;
64
+ /** Lowest trust level at which a code session (writable repo workspace) may run. */
65
+ export declare const CODE_SESSION_MIN_TRUST_LEVEL: CodeSessionTrustLevel;
66
+ /**
67
+ * Runtime toolchain pinning for the session workspace. Advisory on consumer
68
+ * (uses whatever's on the Host PATH unless a version manager is present);
69
+ * the cloud adapter pins exact images.
70
+ */
71
+ export declare const CodeSessionRuntimeConfigSchema: z.ZodObject<{
72
+ environmentName: z.ZodOptional<z.ZodString>;
73
+ node: z.ZodOptional<z.ZodString>;
74
+ bun: z.ZodOptional<z.ZodString>;
75
+ setupScript: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ export type CodeSessionRuntimeConfig = z.infer<typeof CodeSessionRuntimeConfigSchema>;
78
+ export declare const AgentCodeSessionDescriptorSchema: z.ZodObject<{
79
+ id: z.ZodString;
80
+ description: z.ZodOptional<z.ZodString>;
81
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ hardware: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
+ enabled: z.ZodOptional<z.ZodBoolean>;
84
+ capabilityId: z.ZodOptional<z.ZodString>;
85
+ requiredContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ optionalContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
+ config: z.ZodOptional<z.ZodUnknown>;
88
+ retention: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
89
+ maxAgeDays: z.ZodOptional<z.ZodNumber>;
90
+ maxEntries: z.ZodOptional<z.ZodNumber>;
91
+ maxBytes: z.ZodOptional<z.ZodNumber>;
92
+ cascadeFrom: z.ZodOptional<z.ZodString>;
93
+ ageField: z.ZodOptional<z.ZodString>;
94
+ reason: z.ZodString;
95
+ enforcedBy: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strip>]>>;
97
+ kind: z.ZodLiteral<"agent/code-session">;
98
+ name: z.ZodDefault<z.ZodString>;
99
+ priority: z.ZodDefault<z.ZodNumber>;
100
+ surfaces: z.ZodDefault<z.ZodArray<z.ZodEnum<{
101
+ agent: "agent";
102
+ worker: "worker";
103
+ direct: "direct";
104
+ }>>>;
105
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
106
+ memoryLimit: z.ZodDefault<z.ZodNumber>;
107
+ trustLevel: z.ZodDefault<z.ZodEnum<{
108
+ 0: "0";
109
+ 1: "1";
110
+ 3: "3";
111
+ "2a": "2a";
112
+ "2b": "2b";
113
+ }>>;
114
+ os: z.ZodArray<z.ZodEnum<{
115
+ linux: "linux";
116
+ macos: "macos";
117
+ windows: "windows";
118
+ }>>;
119
+ arch: z.ZodArray<z.ZodEnum<{
120
+ x64: "x64";
121
+ arm64: "arm64";
122
+ }>>;
123
+ hostTarget: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
124
+ kind: z.ZodLiteral<"cloud">;
125
+ }, z.core.$strip>, z.ZodObject<{
126
+ kind: z.ZodLiteral<"host">;
127
+ hostId: z.ZodString;
128
+ }, z.core.$strip>, z.ZodObject<{
129
+ kind: z.ZodLiteral<"provisioned">;
130
+ adapter: z.ZodString;
131
+ region: z.ZodOptional<z.ZodString>;
132
+ size: z.ZodOptional<z.ZodString>;
133
+ image: z.ZodOptional<z.ZodString>;
134
+ repo: z.ZodOptional<z.ZodString>;
135
+ branch: z.ZodOptional<z.ZodString>;
136
+ ttlHours: z.ZodOptional<z.ZodNumber>;
137
+ providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
138
+ }, z.core.$strip>], "kind">>;
139
+ runtimeConfig: z.ZodDefault<z.ZodObject<{
140
+ environmentName: z.ZodOptional<z.ZodString>;
141
+ node: z.ZodOptional<z.ZodString>;
142
+ bun: z.ZodOptional<z.ZodString>;
143
+ setupScript: z.ZodOptional<z.ZodString>;
144
+ }, z.core.$strip>>;
145
+ exposedPorts: z.ZodDefault<z.ZodArray<z.ZodString>>;
146
+ allowInteractiveShell: z.ZodDefault<z.ZodBoolean>;
147
+ billingGates: z.ZodDefault<z.ZodArray<z.ZodObject<{
148
+ feature: z.ZodString;
149
+ deniedMessage: z.ZodString;
150
+ }, z.core.$strip>>>;
151
+ }, z.core.$strip>;
152
+ export type AgentCodeSessionDescriptor = z.infer<typeof AgentCodeSessionDescriptorSchema>;
153
+ /**
154
+ * Author an `agent/code-session` descriptor without restating the `kind`.
155
+ * Mirrors `createAgentSandboxDescriptor`.
156
+ */
157
+ export declare function createAgentCodeSessionDescriptor(options: Omit<Partial<AgentCodeSessionDescriptor>, 'kind' | 'os' | 'arch'> & {
158
+ id: string;
159
+ os: AgentCodeSessionDescriptor['os'];
160
+ arch: AgentCodeSessionDescriptor['arch'];
161
+ }): AgentCodeSessionDescriptor;
162
+ export default AgentCodeSessionDescriptorSchema;
163
+ //# sourceMappingURL=agent-code-session.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.descriptor.d.ts","sourceRoot":"","sources":["../../src/code-session/agent-code-session.descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,gFAAgF;AAChF,eAAO,MAAM,wBAAwB;;;;EAAwC,CAAC;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B;;;iBAKvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;;EAAsC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,oFAAoF;AACpF,eAAO,MAAM,4BAA4B,EAAE,qBAA4B,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B;;;;;iBASzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6C3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F;;;GAGG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,GAAG;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAC;CACzC,GACC,0BAA0B,CAK5B;AAED,eAAe,gCAAgC,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Agent Code Session Descriptor Schema (WS3)
3
+ *
4
+ * Defines the `agent/code-session` runtime kind. A code session EXTENDS the
5
+ * `agent/sandbox` contract from a one-shot throwaway exec into a *persistent*
6
+ * workspace bound to `{repository, hostTarget, runtimeConfig}`:
7
+ *
8
+ * one-shot agent/sandbox → persistent agent/code-session
9
+ * ────────────────────── ─────────────────────────────
10
+ * run snippet, capture, clone repo once, then attach/run/edit/commit
11
+ * tear down workspace across many calls; workspace survives until
12
+ * an explicit teardown; long-lived procs +
13
+ * exposed ports + a preview URL.
14
+ *
15
+ * Why a kind: the *how* of a persistent workspace is scope-specific — a
16
+ * consumer Host runs a profile-owned workspace + long-lived `Bun.spawn`
17
+ * handles, cloud runs a per-session Cloudflare Sandbox — but the lifecycle
18
+ * contract (initialize → attach → runCommand → read/write/patch → git → expose
19
+ * port → teardown) is universal. Build mode's code-session tools call one kind
20
+ * regardless of where the bytes run.
21
+ *
22
+ * The descriptor mirrors `AgentSandboxDescriptorSchema` (same trust ladder,
23
+ * priority, timeout/memory ceilings) and adds the session-binding fields.
24
+ */
25
+ import * as z from 'zod/v4';
26
+ import { RuntimeDescriptorSchema } from '@vibesdotdev/kernel/schemas/descriptor';
27
+ import { SessionHostTargetSchema } from "./host-target.js";
28
+ /** Surfaces a code session can be addressed through (mirrors agent/sandbox). */
29
+ export const CodeSessionSurfaceSchema = z.enum(['agent', 'worker', 'direct']);
30
+ /**
31
+ * A billing gate this execution surface requires BEFORE a session may start.
32
+ * Each gate is a billing feature slug checked via the account billing client
33
+ * (`checkQuota(feature) → allowed`), plus the operator-facing message to
34
+ * surface on denial. The RESOLVED descriptor's gates are enforced by the
35
+ * platform route — so a surface declares its own billing posture here rather
36
+ * than the endpoint growing a `hostTarget.kind` conditional.
37
+ *
38
+ * `feature` values are `@vibesdotdev/account` FEATURE_SLUGS (a stable public
39
+ * contract — the descriptor declares the slug string rather than importing the
40
+ * account package, keeping the runtime tier billing-agnostic). A composition
41
+ * point that imports both (platform-web) guards them against drift.
42
+ */
43
+ export const CodeSessionBillingGateSchema = z.object({
44
+ /** Account billing feature slug (e.g. 'build-mode-access', 'sandbox-uptime-minutes'). */
45
+ feature: z.string().min(1),
46
+ /** 403 message when this gate denies (e.g. 'Code mode requires the Plus plan or higher'). */
47
+ deniedMessage: z.string().min(1)
48
+ });
49
+ /**
50
+ * Trust ladder, aligned with the agent capability-tier values. A code session
51
+ * is inherently FS-writable (it edits a repo), so it sits at the same tier as
52
+ * the writable sandbox (`'2b'`+).
53
+ */
54
+ export const CodeSessionTrustLevelSchema = z.enum(['0', '1', '2a', '2b', '3']);
55
+ /** Lowest trust level at which a code session (writable repo workspace) may run. */
56
+ export const CODE_SESSION_MIN_TRUST_LEVEL = '2b';
57
+ /**
58
+ * Runtime toolchain pinning for the session workspace. Advisory on consumer
59
+ * (uses whatever's on the Host PATH unless a version manager is present);
60
+ * the cloud adapter pins exact images.
61
+ */
62
+ export const CodeSessionRuntimeConfigSchema = z.object({
63
+ /** Friendly environment label recorded for resume/UI. */
64
+ environmentName: z.string().optional(),
65
+ /** Node major (e.g. '20', '22'); undefined = Host default. */
66
+ node: z.string().optional(),
67
+ /** Bun version (e.g. '1.3'); undefined = Host default. */
68
+ bun: z.string().optional(),
69
+ /** Optional shell setup script run once after clone before the session is exposed. */
70
+ setupScript: z.string().optional()
71
+ });
72
+ export const AgentCodeSessionDescriptorSchema = RuntimeDescriptorSchema.extend({
73
+ kind: z.literal('agent/code-session'),
74
+ /** Human label for selectors/logs. */
75
+ name: z.string().default('Agent Code Session'),
76
+ /**
77
+ * Selection priority when multiple impls match the scope. Consumer defaults
78
+ * to 100, cloud sibling to 110 (disjoint hardware, so priority is only a
79
+ * defensive tie-breaker).
80
+ */
81
+ priority: z.number().int().default(100),
82
+ /** Surfaces this session can be reached through. */
83
+ surfaces: z.array(CodeSessionSurfaceSchema).default(['agent', 'worker', 'direct']),
84
+ /** Wall-clock budget for a single `runCommand` before it is aborted. */
85
+ timeoutMs: z.number().int().positive().default(300_000),
86
+ /** Soft memory ceiling for session processes, in megabytes. */
87
+ memoryLimit: z.number().int().positive().default(1024),
88
+ /** Trust ceiling for this session (gates writable-FS / network). */
89
+ trustLevel: CodeSessionTrustLevelSchema.default('2b'),
90
+ /**
91
+ * Operating systems this impl declares. The resolver keeps a candidate only
92
+ * when this list includes the requested OS. Omission does not become linux.
93
+ */
94
+ os: z.array(z.enum(['linux', 'macos', 'windows'])).min(1),
95
+ /**
96
+ * CPU architectures this impl declares. Omission does not become x64.
97
+ */
98
+ arch: z.array(z.enum(['x64', 'arm64'])).min(1),
99
+ /** Where the session executes (cloud CF Sandbox vs platform Host). */
100
+ hostTarget: SessionHostTargetSchema.optional(),
101
+ /** Toolchain pinning for the workspace. */
102
+ runtimeConfig: CodeSessionRuntimeConfigSchema.default({}),
103
+ /** Ports the session may expose for preview (string spec, e.g. '5173'). */
104
+ exposedPorts: z.array(z.string()).default([]),
105
+ /** Whether an interactive shell is allowed in this session. */
106
+ allowInteractiveShell: z.boolean().default(false),
107
+ /**
108
+ * Billing gates enforced BEFORE a session starts on this surface. The route
109
+ * enforces whatever the RESOLVED descriptor declares — so a new execution
110
+ * surface gates itself here instead of the endpoint growing a `hostTarget`
111
+ * conditional. Empty (the default) = FREE: a session that runs on the user's
112
+ * OWN hardware (a fleet host / consumer Host) is rated zero, so it carries no
113
+ * entitlement gate. The cloud descriptor declares the build-mode + sandbox
114
+ * quota gates because it runs on OUR metered compute.
115
+ */
116
+ billingGates: z.array(CodeSessionBillingGateSchema).default([])
117
+ });
118
+ /**
119
+ * Author an `agent/code-session` descriptor without restating the `kind`.
120
+ * Mirrors `createAgentSandboxDescriptor`.
121
+ */
122
+ export function createAgentCodeSessionDescriptor(options) {
123
+ return AgentCodeSessionDescriptorSchema.parse({
124
+ ...options,
125
+ kind: 'agent/code-session'
126
+ });
127
+ }
128
+ export default AgentCodeSessionDescriptorSchema;
129
+ //# sourceMappingURL=agent-code-session.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-code-session.descriptor.js","sourceRoot":"","sources":["../../src/code-session/agent-code-session.descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,u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