@vibesdotdev/integrations-grok 0.0.0-stage → 1.0.0-rc.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 (201) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +43 -2
  3. package/dist/ai/index.d.ts +5 -0
  4. package/dist/ai/index.d.ts.map +1 -0
  5. package/dist/ai/index.js +5 -0
  6. package/dist/ai/index.js.map +1 -0
  7. package/dist/ai/metadata/provider-models/grok/grok-grok-3-mini.json +18 -0
  8. package/dist/ai/metadata/provider-models/grok/grok-grok-3.json +18 -0
  9. package/dist/ai/metadata/provider-models/grok/grok-grok-4-5.json +18 -0
  10. package/dist/ai/metadata/provider-models/grok/grok-grok-4-6.json +18 -0
  11. package/dist/ai/metadata/provider-models/grok/grok-grok-4-7.json +18 -0
  12. package/dist/ai/metadata/provider-models/grok/grok-grok-4-fast.json +18 -0
  13. package/dist/ai/metadata/provider-models/grok/grok-grok-4.json +18 -0
  14. package/dist/ai/metadata/provider-models/grok/grok-grok-code-fast.json +18 -0
  15. package/dist/ai/metadata/provider-models/grok/grok-grok-composer-2-5-fast.json +18 -0
  16. package/dist/ai/metadata/providers/grok.json +8 -0
  17. package/dist/ai/provider.consumer.plugin.d.ts +6 -0
  18. package/dist/ai/provider.consumer.plugin.d.ts.map +1 -0
  19. package/dist/ai/provider.consumer.plugin.js +28 -0
  20. package/dist/ai/provider.consumer.plugin.js.map +1 -0
  21. package/dist/ai/provider.plugin.d.ts +3 -0
  22. package/dist/ai/provider.plugin.d.ts.map +1 -0
  23. package/dist/ai/provider.plugin.js +3 -0
  24. package/dist/ai/provider.plugin.js.map +1 -0
  25. package/dist/ai/provider.shared.plugin.d.ts +6 -0
  26. package/dist/ai/provider.shared.plugin.d.ts.map +1 -0
  27. package/dist/ai/provider.shared.plugin.js +128 -0
  28. package/dist/ai/provider.shared.plugin.js.map +1 -0
  29. package/dist/ai/providers/cloud/frontier/grok/config/config.grok.descriptor.d.ts +4194 -0
  30. package/dist/ai/providers/cloud/frontier/grok/config/config.grok.descriptor.d.ts.map +1 -0
  31. package/dist/ai/providers/cloud/frontier/grok/config/config.grok.descriptor.js +15 -0
  32. package/dist/ai/providers/cloud/frontier/grok/config/config.grok.descriptor.js.map +1 -0
  33. package/dist/ai/providers/cloud/frontier/grok/config/schemas/index.d.ts +67 -0
  34. package/dist/ai/providers/cloud/frontier/grok/config/schemas/index.d.ts.map +1 -0
  35. package/dist/ai/providers/cloud/frontier/grok/config/schemas/index.js +70 -0
  36. package/dist/ai/providers/cloud/frontier/grok/config/schemas/index.js.map +1 -0
  37. package/dist/ai/providers/cloud/frontier/grok/index.d.ts +5 -0
  38. package/dist/ai/providers/cloud/frontier/grok/index.d.ts.map +1 -0
  39. package/dist/ai/providers/cloud/frontier/grok/index.js +4 -0
  40. package/dist/ai/providers/cloud/frontier/grok/index.js.map +1 -0
  41. package/dist/ai/providers/cloud/frontier/grok/provider.grok.descriptor.d.ts +183 -0
  42. package/dist/ai/providers/cloud/frontier/grok/provider.grok.descriptor.d.ts.map +1 -0
  43. package/dist/ai/providers/cloud/frontier/grok/provider.grok.descriptor.js +114 -0
  44. package/dist/ai/providers/cloud/frontier/grok/provider.grok.descriptor.js.map +1 -0
  45. package/dist/ai/providers/grok/detection/index.d.ts +2 -0
  46. package/dist/ai/providers/grok/detection/index.d.ts.map +1 -0
  47. package/dist/ai/providers/grok/detection/index.js +2 -0
  48. package/dist/ai/providers/grok/detection/index.js.map +1 -0
  49. package/dist/ai/providers/grok/detection/system.d.ts +11 -0
  50. package/dist/ai/providers/grok/detection/system.d.ts.map +1 -0
  51. package/dist/ai/providers/grok/detection/system.js +78 -0
  52. package/dist/ai/providers/grok/detection/system.js.map +1 -0
  53. package/dist/ai/providers/grok/docs/ai.providers.grok.docs.descriptor.d.ts +4 -0
  54. package/dist/ai/providers/grok/docs/ai.providers.grok.docs.descriptor.d.ts.map +1 -0
  55. package/dist/ai/providers/grok/docs/ai.providers.grok.docs.descriptor.js +21 -0
  56. package/dist/ai/providers/grok/docs/ai.providers.grok.docs.descriptor.js.map +1 -0
  57. package/dist/ai/providers/grok/grok-agent/budget.d.ts +14 -0
  58. package/dist/ai/providers/grok/grok-agent/budget.d.ts.map +1 -0
  59. package/dist/ai/providers/grok/grok-agent/budget.js +23 -0
  60. package/dist/ai/providers/grok/grok-agent/budget.js.map +1 -0
  61. package/dist/ai/providers/grok/grok-agent/connection.d.ts +36 -0
  62. package/dist/ai/providers/grok/grok-agent/connection.d.ts.map +1 -0
  63. package/dist/ai/providers/grok/grok-agent/connection.js +137 -0
  64. package/dist/ai/providers/grok/grok-agent/connection.js.map +1 -0
  65. package/dist/ai/providers/grok/grok-agent/failures.d.ts +12 -0
  66. package/dist/ai/providers/grok/grok-agent/failures.d.ts.map +1 -0
  67. package/dist/ai/providers/grok/grok-agent/failures.js +47 -0
  68. package/dist/ai/providers/grok/grok-agent/failures.js.map +1 -0
  69. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.descriptor.d.ts +29 -0
  70. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.descriptor.d.ts.map +1 -0
  71. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.descriptor.js +18 -0
  72. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.descriptor.js.map +1 -0
  73. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.impl.d.ts +32 -0
  74. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.impl.d.ts.map +1 -0
  75. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.impl.js +113 -0
  76. package/dist/ai/providers/grok/grok-agent/grok-agent.spec.impl.js.map +1 -0
  77. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.descriptor.d.ts +13 -0
  78. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.descriptor.d.ts.map +1 -0
  79. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.descriptor.js +11 -0
  80. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.descriptor.js.map +1 -0
  81. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.d.ts +39 -0
  82. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.d.ts.map +1 -0
  83. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.js +79 -0
  84. package/dist/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.js.map +1 -0
  85. package/dist/ai/providers/grok/grok-agent/protocol.d.ts +117 -0
  86. package/dist/ai/providers/grok/grok-agent/protocol.d.ts.map +1 -0
  87. package/dist/ai/providers/grok/grok-agent/protocol.js +84 -0
  88. package/dist/ai/providers/grok/grok-agent/protocol.js.map +1 -0
  89. package/dist/ai/providers/grok/grok-agent/runtime-execution.d.ts +14 -0
  90. package/dist/ai/providers/grok/grok-agent/runtime-execution.d.ts.map +1 -0
  91. package/dist/ai/providers/grok/grok-agent/runtime-execution.js +42 -0
  92. package/dist/ai/providers/grok/grok-agent/runtime-execution.js.map +1 -0
  93. package/dist/ai/providers/grok/grok-agent/session.d.ts +12 -0
  94. package/dist/ai/providers/grok/grok-agent/session.d.ts.map +1 -0
  95. package/dist/ai/providers/grok/grok-agent/session.js +140 -0
  96. package/dist/ai/providers/grok/grok-agent/session.js.map +1 -0
  97. package/dist/ai/providers/grok/grok-build.request.d.ts +7 -0
  98. package/dist/ai/providers/grok/grok-build.request.d.ts.map +1 -0
  99. package/dist/ai/providers/grok/grok-build.request.js +11 -0
  100. package/dist/ai/providers/grok/grok-build.request.js.map +1 -0
  101. package/dist/ai/providers/grok/grok-build.transport.descriptor.d.ts +13 -0
  102. package/dist/ai/providers/grok/grok-build.transport.descriptor.d.ts.map +1 -0
  103. package/dist/ai/providers/grok/grok-build.transport.descriptor.js +11 -0
  104. package/dist/ai/providers/grok/grok-build.transport.descriptor.js.map +1 -0
  105. package/dist/ai/providers/grok/grok-build.transport.impl.consumer.d.ts +23 -0
  106. package/dist/ai/providers/grok/grok-build.transport.impl.consumer.d.ts.map +1 -0
  107. package/dist/ai/providers/grok/grok-build.transport.impl.consumer.js +115 -0
  108. package/dist/ai/providers/grok/grok-build.transport.impl.consumer.js.map +1 -0
  109. package/dist/ai/providers/grok/grok-prompt-file.d.ts +16 -0
  110. package/dist/ai/providers/grok/grok-prompt-file.d.ts.map +1 -0
  111. package/dist/ai/providers/grok/grok-prompt-file.js +43 -0
  112. package/dist/ai/providers/grok/grok-prompt-file.js.map +1 -0
  113. package/dist/ai/providers/grok/grok-refusals.d.ts +149 -0
  114. package/dist/ai/providers/grok/grok-refusals.d.ts.map +1 -0
  115. package/dist/ai/providers/grok/grok-refusals.js +159 -0
  116. package/dist/ai/providers/grok/grok-refusals.js.map +1 -0
  117. package/dist/ai/providers/grok/grok-sandbox-signal.d.ts +30 -0
  118. package/dist/ai/providers/grok/grok-sandbox-signal.d.ts.map +1 -0
  119. package/dist/ai/providers/grok/grok-sandbox-signal.js +46 -0
  120. package/dist/ai/providers/grok/grok-sandbox-signal.js.map +1 -0
  121. package/dist/ai/providers/grok/grok-subscription.d.ts +116 -0
  122. package/dist/ai/providers/grok/grok-subscription.d.ts.map +1 -0
  123. package/dist/ai/providers/grok/grok-subscription.js +473 -0
  124. package/dist/ai/providers/grok/grok-subscription.js.map +1 -0
  125. package/dist/ai/providers/grok/grok.provider.impl.d.ts +47 -0
  126. package/dist/ai/providers/grok/grok.provider.impl.d.ts.map +1 -0
  127. package/dist/ai/providers/grok/grok.provider.impl.js +202 -0
  128. package/dist/ai/providers/grok/grok.provider.impl.js.map +1 -0
  129. package/dist/ai/providers/grok/index.d.ts +3 -0
  130. package/dist/ai/providers/grok/index.d.ts.map +1 -0
  131. package/dist/ai/providers/grok/index.js +3 -0
  132. package/dist/ai/providers/grok/index.js.map +1 -0
  133. package/dist/ai/providers/grok/recommendations.d.ts +23 -0
  134. package/dist/ai/providers/grok/recommendations.d.ts.map +1 -0
  135. package/dist/ai/providers/grok/recommendations.js +21 -0
  136. package/dist/ai/providers/grok/recommendations.js.map +1 -0
  137. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.descriptor.d.ts +32 -0
  138. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.descriptor.d.ts.map +1 -0
  139. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.descriptor.js +21 -0
  140. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.descriptor.js.map +1 -0
  141. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.impl.d.ts +36 -0
  142. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.impl.d.ts.map +1 -0
  143. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.impl.js +78 -0
  144. package/dist/ai/specs/grok-build-exec/grok-build-exec.spec.impl.js.map +1 -0
  145. package/dist/ai/specs/grok-messages.d.ts +20 -0
  146. package/dist/ai/specs/grok-messages.d.ts.map +1 -0
  147. package/dist/ai/specs/grok-messages.js +79 -0
  148. package/dist/ai/specs/grok-messages.js.map +1 -0
  149. package/dist/external/external.plugin.d.ts +3 -0
  150. package/dist/external/external.plugin.d.ts.map +1 -0
  151. package/dist/external/external.plugin.js +23 -0
  152. package/dist/external/external.plugin.js.map +1 -0
  153. package/dist/external/grok-build/index.d.ts +162 -0
  154. package/dist/external/grok-build/index.d.ts.map +1 -0
  155. package/dist/external/grok-build/index.js +7 -0
  156. package/dist/external/grok-build/index.js.map +1 -0
  157. package/dist/external/grok-build/manifest.d.ts +6 -0
  158. package/dist/external/grok-build/manifest.d.ts.map +1 -0
  159. package/dist/external/grok-build/manifest.js +91 -0
  160. package/dist/external/grok-build/manifest.js.map +1 -0
  161. package/dist/external/grok-build-presets.d.ts +210 -0
  162. package/dist/external/grok-build-presets.d.ts.map +1 -0
  163. package/dist/external/grok-build-presets.js +46 -0
  164. package/dist/external/grok-build-presets.js.map +1 -0
  165. package/dist/external/grok-subscription.operation.descriptors.d.ts +57 -0
  166. package/dist/external/grok-subscription.operation.descriptors.d.ts.map +1 -0
  167. package/dist/external/grok-subscription.operation.descriptors.js +22 -0
  168. package/dist/external/grok-subscription.operation.descriptors.js.map +1 -0
  169. package/dist/external/grok-subscription.operations.d.ts +4 -0
  170. package/dist/external/grok-subscription.operations.d.ts.map +1 -0
  171. package/dist/external/grok-subscription.operations.js +73 -0
  172. package/dist/external/grok-subscription.operations.js.map +1 -0
  173. package/dist/external/index.d.ts +3 -0
  174. package/dist/external/index.d.ts.map +1 -0
  175. package/dist/external/index.js +3 -0
  176. package/dist/external/index.js.map +1 -0
  177. package/dist/index.d.ts +2 -0
  178. package/dist/index.d.ts.map +1 -0
  179. package/dist/index.js +2 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/outcome.d.ts +9 -0
  182. package/dist/outcome.d.ts.map +1 -0
  183. package/dist/outcome.js +8 -0
  184. package/dist/outcome.js.map +1 -0
  185. package/dist/schemas/health.d.ts +20 -0
  186. package/dist/schemas/health.d.ts.map +1 -0
  187. package/dist/schemas/health.js +17 -0
  188. package/dist/schemas/health.js.map +1 -0
  189. package/dist/schemas/output.d.ts +8 -0
  190. package/dist/schemas/output.d.ts.map +1 -0
  191. package/dist/schemas/output.js +10 -0
  192. package/dist/schemas/output.js.map +1 -0
  193. package/dist/schemas/refusal.d.ts +6 -0
  194. package/dist/schemas/refusal.d.ts.map +1 -0
  195. package/dist/schemas/refusal.js +6 -0
  196. package/dist/schemas/refusal.js.map +1 -0
  197. package/dist/schemas/subscription.d.ts +42 -0
  198. package/dist/schemas/subscription.d.ts.map +1 -0
  199. package/dist/schemas/subscription.js +36 -0
  200. package/dist/schemas/subscription.js.map +1 -0
  201. package/package.json +104 -4
@@ -0,0 +1,39 @@
1
+ import type { RuntimeRef } from '@vibesdotdev/kernel';
2
+ import type { AITransportInterface, TransportCallOptions } from '@vibesdotdev/ai/transports/interfaces';
3
+ import type { WireRequest, WireResponseChunk } from '@vibesdotdev/ai/specs/interfaces';
4
+ import { type GrokAgentBudget } from './budget.ts';
5
+ import type { GrokAgentConnection } from './connection.ts';
6
+ /** What a transport hands its connector for one call. */
7
+ export interface GrokAgentConnectRequest {
8
+ readonly runtime: RuntimeRef;
9
+ readonly signal: AbortSignal | undefined;
10
+ /** The caller's declared deadline, shared by the handshake and the turn. */
11
+ readonly budget: GrokAgentBudget;
12
+ }
13
+ /**
14
+ * Runs the session program from the Grok agent spec against one ACP process.
15
+ * The process is spawned by the consumer execution runtime, one per call, and
16
+ * is stopped (SIGTERM, grace, SIGKILL, joined) when the call ends however it
17
+ * ends. This transport does not accept API credentials.
18
+ */
19
+ export declare class GrokAgentTransport implements AITransportInterface {
20
+ private readonly connect;
21
+ readonly descriptor: {
22
+ id: string;
23
+ kind: "ai/transport";
24
+ name: string;
25
+ description: string;
26
+ scopes: ("cloud" | "consumer")[];
27
+ bidirectional: boolean;
28
+ cancellable: boolean;
29
+ enabled: boolean;
30
+ tags?: string[] | undefined;
31
+ };
32
+ constructor(connect: (request: GrokAgentConnectRequest) => Promise<GrokAgentConnection>);
33
+ send(request: WireRequest, options: TransportCallOptions): AsyncIterable<WireResponseChunk>;
34
+ /** One session on one connection: its chunks, then the outcome that tells `send` whether it failed. */
35
+ private run;
36
+ /** The call's budget and its connected agent. */
37
+ private start;
38
+ }
39
+ //# sourceMappingURL=grok-agent.transport.impl.consumer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-agent.transport.impl.consumer.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACX,oBAAoB,EACpB,oBAAoB,EACpB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAIvF,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAK3D,yDAAyD;AACzD,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;CACjC;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,oBAAoB;IAGlD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,QAAQ,CAAC,UAAU;;;;;;;;;;MAAc;gBAEJ,OAAO,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,mBAAmB,CAAC;IAEjG,IAAI,CACV,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,oBAAoB,GAC3B,aAAa,CAAC,iBAAiB,CAAC;IAiBnC,uGAAuG;YACxF,GAAG;IA2BlB,iDAAiD;YACnC,KAAK;CAKnB"}
@@ -0,0 +1,79 @@
1
+ import * as z from 'zod/v4';
2
+ import { settle } from "../../../../outcome.js";
3
+ import { grokRefusal } from "../grok-refusals.js";
4
+ import { createGrokAgentBudget } from "./budget.js";
5
+ import { grokAgentFailure } from "./failures.js";
6
+ import descriptor from "./grok-agent.transport.descriptor.js";
7
+ /**
8
+ * Runs the session program from the Grok agent spec against one ACP process.
9
+ * The process is spawned by the consumer execution runtime, one per call, and
10
+ * is stopped (SIGTERM, grace, SIGKILL, joined) when the call ends however it
11
+ * ends. This transport does not accept API credentials.
12
+ */
13
+ export class GrokAgentTransport {
14
+ connect;
15
+ descriptor = descriptor;
16
+ constructor(connect) {
17
+ this.connect = connect;
18
+ }
19
+ async *send(request, options) {
20
+ if (options.auth && options.auth.kind !== 'none') {
21
+ yield { kind: 'error', error: grokRefusal('credentials-not-accepted') };
22
+ yield { kind: 'end' };
23
+ return;
24
+ }
25
+ const program = readProgram(request.body);
26
+ if (!program) {
27
+ yield { kind: 'error', error: grokRefusal('agent-session-missing', { details: { stage: 'program' } }) };
28
+ yield { kind: 'end' };
29
+ return;
30
+ }
31
+ const outcome = yield* this.run(program, options);
32
+ if (!outcome.ok)
33
+ yield { kind: 'error', error: grokAgentFailure(outcome.cause, 'prompt') };
34
+ yield { kind: 'end' };
35
+ }
36
+ /** One session on one connection: its chunks, then the outcome that tells `send` whether it failed. */
37
+ async *run(program, options) {
38
+ const started = await settle(() => this.start(options));
39
+ if (!started.ok)
40
+ return started;
41
+ const { connection, budget } = started.value;
42
+ const turn = program(connection, options, budget)[Symbol.asyncIterator]();
43
+ let outcome = { ok: true, value: undefined };
44
+ try {
45
+ for (;;) {
46
+ const step = await settle(() => turn.next());
47
+ if (!step.ok) {
48
+ outcome = step;
49
+ break;
50
+ }
51
+ if (step.value.done)
52
+ break;
53
+ yield step.value.value;
54
+ }
55
+ }
56
+ finally {
57
+ // The child is always stopped; a stop that cannot be confirmed is a failure of the call, never a silent success.
58
+ const closed = await settle(() => connection.close());
59
+ if (!closed.ok && outcome.ok)
60
+ outcome = closed;
61
+ }
62
+ return outcome;
63
+ }
64
+ /** The call's budget and its connected agent. */
65
+ async start(options) {
66
+ const budget = createGrokAgentBudget(options.runtime, options.timeoutMs);
67
+ const connection = await this.connect({ runtime: options.runtime, signal: options.signal, budget });
68
+ return { connection, budget };
69
+ }
70
+ }
71
+ /** The spec attaches its session program to the request body in process; it never crosses a wire. */
72
+ const SessionBodySchema = z.object({
73
+ sessionProgram: z.custom((program) => program instanceof Function)
74
+ });
75
+ function readProgram(body) {
76
+ const parsed = SessionBodySchema.safeParse(body);
77
+ return parsed.success ? parsed.data.sessionProgram : null;
78
+ }
79
+ //# sourceMappingURL=grok-agent.transport.impl.consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-agent.transport.impl.consumer.js","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/grok-agent.transport.impl.consumer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAg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D;IACzC,KAAK,CAAC,KAAK,CAAC,OAA6B;QAChD,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACzE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACpG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAC/B,CAAC;CACD;AAED,qGAAqG;AACrG,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,CAA0B,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,YAAY,QAAQ,CAAC;CAC3F,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,IAAyB;IAC7C,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Grok's documented ACP channel: `grok agent stdio` speaks JSON-RPC 2.0 over
3
+ * newline-delimited stdin/stdout. The CLI owns the session token.
4
+ *
5
+ * Only the ACP protocol lives here: the JSON-RPC peer (framing, correlation,
6
+ * lifecycle) is `@vibesdotdev/external/jsonrpc`, and every value below is read
7
+ * from what the child wrote, so each is parsed by a schema at this boundary.
8
+ */
9
+ import * as z from 'zod/v4';
10
+ import type { JsonValue } from '@vibesdotdev/kernel/schemas/json';
11
+ export type { JsonValue };
12
+ export type JsonObject = {
13
+ [key: string]: JsonValue;
14
+ };
15
+ /**
16
+ * The declared bounds of one agent turn. Nothing the child writes grows past
17
+ * them: a line over the cap fails the client, and each accumulator below fails
18
+ * the turn typed (`agent-output-too-large`) instead of growing.
19
+ */
20
+ export declare const GROK_AGENT_LIMITS: {
21
+ /** One stdout line: the largest single `session/update` the client will buffer. */
22
+ readonly maxLineBytes: 2097152;
23
+ /** Characters of assistant text one turn may stream. */
24
+ readonly maxTextChars: 4194304;
25
+ /** Characters of thinking one turn may stream. */
26
+ readonly maxThinkingChars: 4194304;
27
+ /** Distinct tool calls one turn may report. */
28
+ readonly maxToolCalls: 256;
29
+ /** Serialized bytes (id, name, arguments) of all tool calls one turn may report. */
30
+ readonly maxToolBytes: 1048576;
31
+ /** Between SIGTERM and SIGKILL when the client stops the agent. */
32
+ readonly graceMs: 2000;
33
+ /** Characters of request prompt the session will send. */
34
+ readonly maxPromptChars: 4194304;
35
+ };
36
+ export declare const GrokAgentInitializeResultSchema: z.ZodObject<{
37
+ authMethods: z.ZodCatch<z.ZodOptional<z.ZodArray<z.ZodCatch<z.ZodObject<{
38
+ id: z.ZodCatch<z.ZodOptional<z.ZodString>>;
39
+ }, z.core.$loose>>>>>;
40
+ }, z.core.$loose>;
41
+ export type GrokAgentInitializeResult = z.infer<typeof GrokAgentInitializeResultSchema>;
42
+ export type GrokAgentPromptBlock = {
43
+ type: 'text';
44
+ text: string;
45
+ };
46
+ export declare const GrokAgentSessionCreatedSchema: z.ZodObject<{
47
+ sessionId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
48
+ }, z.core.$loose>;
49
+ /** The turn's answer. A missing or malformed `stopReason` is a protocol failure, never a guessed `end_turn`. */
50
+ export declare const GrokAgentPromptResultSchema: z.ZodObject<{
51
+ stopReason: z.ZodString;
52
+ }, z.core.$loose>;
53
+ /**
54
+ * A streamed `session/update` payload; fields of an unexpected type read as
55
+ * absent. `rawInput` is JSON by construction (it came out of `JSON.parse`), so
56
+ * it is carried as a value and its serialized size is what is bounded.
57
+ */
58
+ export declare const GrokAgentUpdateSchema: z.ZodObject<{
59
+ sessionUpdate: z.ZodCatch<z.ZodOptional<z.ZodString>>;
60
+ content: z.ZodCatch<z.ZodOptional<z.ZodObject<{
61
+ text: z.ZodCatch<z.ZodOptional<z.ZodString>>;
62
+ }, z.core.$loose>>>;
63
+ toolCallId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
64
+ title: z.ZodCatch<z.ZodOptional<z.ZodString>>;
65
+ kind: z.ZodCatch<z.ZodOptional<z.ZodString>>;
66
+ status: z.ZodCatch<z.ZodOptional<z.ZodString>>;
67
+ rawInput: z.ZodCatch<z.ZodOptional<z.ZodCustom<JsonObject, JsonObject>>>;
68
+ }, z.core.$loose>;
69
+ export type GrokAgentUpdate = z.infer<typeof GrokAgentUpdateSchema>;
70
+ export declare const GrokAgentUpdateNotificationSchema: z.ZodObject<{
71
+ update: z.ZodObject<{
72
+ sessionUpdate: z.ZodCatch<z.ZodOptional<z.ZodString>>;
73
+ content: z.ZodCatch<z.ZodOptional<z.ZodObject<{
74
+ text: z.ZodCatch<z.ZodOptional<z.ZodString>>;
75
+ }, z.core.$loose>>>;
76
+ toolCallId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
77
+ title: z.ZodCatch<z.ZodOptional<z.ZodString>>;
78
+ kind: z.ZodCatch<z.ZodOptional<z.ZodString>>;
79
+ status: z.ZodCatch<z.ZodOptional<z.ZodString>>;
80
+ rawInput: z.ZodCatch<z.ZodOptional<z.ZodCustom<JsonObject, JsonObject>>>;
81
+ }, z.core.$loose>;
82
+ }, z.core.$loose>;
83
+ export interface GrokAgentToolCall {
84
+ id: string;
85
+ name: string;
86
+ arguments: JsonObject;
87
+ result?: string;
88
+ }
89
+ export type GrokAgentRecord = {
90
+ type: 'text-delta';
91
+ delta: string;
92
+ } | {
93
+ type: 'thinking-delta';
94
+ delta: string;
95
+ } | {
96
+ type: 'result';
97
+ stopReason: string;
98
+ toolCalls: GrokAgentToolCall[];
99
+ };
100
+ /** The records the spec decodes back out of the transport's ndjson stream. */
101
+ export declare const GrokAgentRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
102
+ type: z.ZodLiteral<"text-delta">;
103
+ delta: z.ZodString;
104
+ }, z.core.$loose>, z.ZodObject<{
105
+ type: z.ZodLiteral<"thinking-delta">;
106
+ delta: z.ZodString;
107
+ }, z.core.$loose>, z.ZodObject<{
108
+ type: z.ZodLiteral<"result">;
109
+ stopReason: z.ZodString;
110
+ toolCalls: z.ZodArray<z.ZodObject<{
111
+ id: z.ZodString;
112
+ name: z.ZodString;
113
+ arguments: z.ZodCustom<JsonObject, JsonObject>;
114
+ result: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$loose>>;
116
+ }, z.core.$loose>], "type">;
117
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC7B,mFAAmF;;IAEnF,wDAAwD;;IAExD,kDAAkD;;IAElD,+CAA+C;;IAE/C,oFAAoF;;IAEpF,mEAAmE;;IAEnE,0DAA0D;;CAEjD,CAAC;AAYX,eAAO,MAAM,+BAA+B;;;;iBAE1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,eAAO,MAAM,6BAA6B;;iBAExC,CAAC;AAEH,gHAAgH;AAChH,eAAO,MAAM,2BAA2B;;iBAEtC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAWhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,iCAAiC;;;;;;;;;;;;iBAAmD,CAAC;AAElG,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,UAAU,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GACxB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAAC;AAE1E,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;2BAiBhC,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Grok's documented ACP channel: `grok agent stdio` speaks JSON-RPC 2.0 over
3
+ * newline-delimited stdin/stdout. The CLI owns the session token.
4
+ *
5
+ * Only the ACP protocol lives here: the JSON-RPC peer (framing, correlation,
6
+ * lifecycle) is `@vibesdotdev/external/jsonrpc`, and every value below is read
7
+ * from what the child wrote, so each is parsed by a schema at this boundary.
8
+ */
9
+ import * as z from 'zod/v4';
10
+ /**
11
+ * The declared bounds of one agent turn. Nothing the child writes grows past
12
+ * them: a line over the cap fails the client, and each accumulator below fails
13
+ * the turn typed (`agent-output-too-large`) instead of growing.
14
+ */
15
+ export const GROK_AGENT_LIMITS = {
16
+ /** One stdout line: the largest single `session/update` the client will buffer. */
17
+ maxLineBytes: 2_097_152,
18
+ /** Characters of assistant text one turn may stream. */
19
+ maxTextChars: 4_194_304,
20
+ /** Characters of thinking one turn may stream. */
21
+ maxThinkingChars: 4_194_304,
22
+ /** Distinct tool calls one turn may report. */
23
+ maxToolCalls: 256,
24
+ /** Serialized bytes (id, name, arguments) of all tool calls one turn may report. */
25
+ maxToolBytes: 1_048_576,
26
+ /** Between SIGTERM and SIGKILL when the client stops the agent. */
27
+ graceMs: 2_000,
28
+ /** Characters of request prompt the session will send. */
29
+ maxPromptChars: 4_194_304
30
+ };
31
+ /** ACP stop reasons are a closed vocabulary of snake_case words; anything else is not the agent's. */
32
+ const StopReasonSchema = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
33
+ /**
34
+ * A JSON object, as the child wrote it. It is JSON by construction (it came out of
35
+ * `JSON.parse`), so it is carried as a value and never walked: re-walking a hostile,
36
+ * deeply nested value is exactly the recursion the line cap exists to bound.
37
+ */
38
+ const JsonObjectSchema = z.custom((value) => z.looseObject({}).safeParse(value).success);
39
+ export const GrokAgentInitializeResultSchema = z.looseObject({
40
+ authMethods: z.array(z.looseObject({ id: z.string().optional().catch(undefined) }).catch({})).optional().catch(undefined)
41
+ });
42
+ export const GrokAgentSessionCreatedSchema = z.looseObject({
43
+ sessionId: z.string().min(1).max(256).optional().catch(undefined)
44
+ });
45
+ /** The turn's answer. A missing or malformed `stopReason` is a protocol failure, never a guessed `end_turn`. */
46
+ export const GrokAgentPromptResultSchema = z.looseObject({
47
+ stopReason: StopReasonSchema
48
+ });
49
+ /**
50
+ * A streamed `session/update` payload; fields of an unexpected type read as
51
+ * absent. `rawInput` is JSON by construction (it came out of `JSON.parse`), so
52
+ * it is carried as a value and its serialized size is what is bounded.
53
+ */
54
+ export const GrokAgentUpdateSchema = z.looseObject({
55
+ sessionUpdate: z.string().optional().catch(undefined),
56
+ content: z
57
+ .looseObject({ text: z.string().optional().catch(undefined) })
58
+ .optional()
59
+ .catch(undefined),
60
+ toolCallId: z.string().optional().catch(undefined),
61
+ title: z.string().optional().catch(undefined),
62
+ kind: z.string().optional().catch(undefined),
63
+ status: z.string().optional().catch(undefined),
64
+ rawInput: JsonObjectSchema.optional().catch(undefined)
65
+ });
66
+ export const GrokAgentUpdateNotificationSchema = z.looseObject({ update: GrokAgentUpdateSchema });
67
+ /** The records the spec decodes back out of the transport's ndjson stream. */
68
+ export const GrokAgentRecordSchema = z.discriminatedUnion('type', [
69
+ z.looseObject({ type: z.literal('text-delta'), delta: z.string() }),
70
+ z.looseObject({ type: z.literal('thinking-delta'), delta: z.string() }),
71
+ z.looseObject({
72
+ type: z.literal('result'),
73
+ stopReason: StopReasonSchema,
74
+ toolCalls: z
75
+ .array(z.looseObject({
76
+ id: z.string(),
77
+ name: z.string(),
78
+ arguments: JsonObjectSchema,
79
+ result: z.string().optional()
80
+ }))
81
+ .max(GROK_AGENT_LIMITS.maxToolCalls)
82
+ })
83
+ ]);
84
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAM5B;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,mFAAmF;IACnF,YAAY,EAAE,SAAS;IACvB,wDAAwD;IACxD,YAAY,EAAE,SAAS;IACvB,kDAAkD;IAClD,gBAAgB,EAAE,SAAS;IAC3B,+CAA+C;IAC/C,YAAY,EAAE,GAAG;IACjB,oFAAoF;IACpF,YAAY,EAAE,SAAS;IACvB,mEAAmE;IACnE,OAAO,EAAE,KAAK;IACd,0DAA0D;IAC1D,cAAc,EAAE,SAAS;CAChB,CAAC;AAEX,sGAAsG;AACtG,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,gBAAgB,G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AAM,EAAE,CAAC,QAAQ,EAAE;SAC7B,CAAC,CACF;aACA,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC;KACrC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { RuntimeRef } from '@vibesdotdev/kernel';
2
+ import { GrokAgentTransport } from './grok-agent.transport.impl.consumer.ts';
3
+ /**
4
+ * The agent runs under a declared posture, never Grok's defaults: a read-only
5
+ * sandbox for filesystem and network, and `dontAsk` so a tool that would need
6
+ * the user's approval is denied instead of asked. This is the posture the
7
+ * `grok-build` fallback also runs under. A host whose sandbox cannot be applied
8
+ * makes Grok refuse to start (it fails closed), which surfaces as
9
+ * `agent-connect-failed`, never as an agent running without its protections.
10
+ */
11
+ export declare const GROK_AGENT_ARGS: readonly ["--no-auto-update", "--sandbox", "read-only", "--permission-mode", "dontAsk", "agent", "stdio"];
12
+ /** Spawn `grok agent stdio` inside the dedicated subscription profile. */
13
+ export declare function createRuntimeGrokAgentTransport(runtime: RuntimeRef): GrokAgentTransport;
14
+ //# sourceMappingURL=runtime-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-execution.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/runtime-execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,2GAQlB,CAAC;AAEX,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAqBvF"}
@@ -0,0 +1,42 @@
1
+ import { prepareGrokSubscription } from "../grok-subscription.js";
2
+ import { GrokAgentConnection } from "./connection.js";
3
+ import { GrokAgentTransport } from "./grok-agent.transport.impl.consumer.js";
4
+ /**
5
+ * The agent runs under a declared posture, never Grok's defaults: a read-only
6
+ * sandbox for filesystem and network, and `dontAsk` so a tool that would need
7
+ * the user's approval is denied instead of asked. This is the posture the
8
+ * `grok-build` fallback also runs under. A host whose sandbox cannot be applied
9
+ * makes Grok refuse to start (it fails closed), which surfaces as
10
+ * `agent-connect-failed`, never as an agent running without its protections.
11
+ */
12
+ export const GROK_AGENT_ARGS = [
13
+ '--no-auto-update',
14
+ '--sandbox',
15
+ 'read-only',
16
+ '--permission-mode',
17
+ 'dontAsk',
18
+ 'agent',
19
+ 'stdio'
20
+ ];
21
+ /** Spawn `grok agent stdio` inside the dedicated subscription profile. */
22
+ export function createRuntimeGrokAgentTransport(runtime) {
23
+ return new GrokAgentTransport((request) => GrokAgentConnection.open({
24
+ runtime,
25
+ budget: request.budget,
26
+ signal: request.signal,
27
+ spawn: async () => {
28
+ const session = await prepareGrokSubscription(runtime);
29
+ return session.execution.spawn({
30
+ command: session.command,
31
+ args: [...GROK_AGENT_ARGS],
32
+ cwd: session.home,
33
+ env: session.env,
34
+ envMode: 'replace',
35
+ stdin: 'pipe',
36
+ stdout: 'pipe',
37
+ stderr: 'pipe'
38
+ });
39
+ }
40
+ }));
41
+ }
42
+ //# sourceMappingURL=runtime-execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-execution.js","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/runtime-execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,mBAAmB;IACnB,SAAS;IACT,OAAO;IACP,OAAO;CACE,CAAC;AAEX,0EAA0E;AAC1E,MAAM,UAAU,+BAA+B,CAAC,OAAmB;IAClE,OAAO,IAAI,kBAAkB,CAAC,CAAC,OAAO,EAAE,EAAE,CACzC,mBAAmB,CAAC,IAAI,CAAC;QACxB,OAAO;QACP,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,KAAK,EAAE,KAAK,IAAI,EAAE;YACjB,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;YACvD,OAAO,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC;gBAC1B,GAAG,EAAE,OAAO,CAAC,IAAI;gBACjB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,MAAM;aACd,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CACF,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { TransportCallOptions } from '@vibesdotdev/ai/transports/interfaces';
2
+ import type { WireResponseChunk } from '@vibesdotdev/ai/specs/interfaces';
3
+ import type { GrokAgentBudget } from './budget.ts';
4
+ import type { GrokAgentConnection } from './connection.ts';
5
+ import { type GrokAgentPromptBlock } from './protocol.ts';
6
+ export interface GrokAgentWireBody {
7
+ cwd: string;
8
+ prompt: GrokAgentPromptBlock[];
9
+ }
10
+ export type GrokAgentSessionProgram = (connection: GrokAgentConnection, options: TransportCallOptions, budget: GrokAgentBudget) => AsyncIterable<WireResponseChunk>;
11
+ export declare function createGrokAgentSessionProgram(body: GrokAgentWireBody): GrokAgentSessionProgram;
12
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAI1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAKN,KAAK,oBAAoB,EAIzB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,iBAAiB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,uBAAuB,GAAG,CACrC,UAAU,EAAE,mBAAmB,EAC/B,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,eAAe,KACnB,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAEtC,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,iBAAiB,GAAG,uBAAuB,CAE9F"}
@@ -0,0 +1,140 @@
1
+ import { settle } from "../../../../outcome.js";
2
+ import { grokRefusal } from "../grok-refusals.js";
3
+ import { grokAgentFailure } from "./failures.js";
4
+ import { GROK_AGENT_LIMITS, GrokAgentPromptResultSchema, GrokAgentSessionCreatedSchema, GrokAgentUpdateNotificationSchema } from "./protocol.js";
5
+ export function createGrokAgentSessionProgram(body) {
6
+ return (connection, options, budget) => runGrokAgentSession(connection, body, options, budget);
7
+ }
8
+ const NOTHING_BUFFERED_MARK = Symbol('nothing-buffered');
9
+ /** Already settled, so racing it behind a settled promise loses: what is buffered is taken first, and a pending read means nothing is. */
10
+ const NOTHING_BUFFERED = Promise.resolve(NOTHING_BUFFERED_MARK);
11
+ /**
12
+ * One ACP turn on one connection, streamed as it arrives.
13
+ *
14
+ * A caller abort sends `session/cancel` and ends the turn; the deadline is the
15
+ * caller's; everything the agent writes is bounded; a permission request is
16
+ * refused (the client answered `-32601`) and stops the turn typed.
17
+ */
18
+ async function* runGrokAgentSession(connection, body, options, budget) {
19
+ const { client } = connection;
20
+ if (options.signal?.aborted)
21
+ throw grokRefusal('generation-cancelled', { details: { stage: 'session' } });
22
+ const created = await typed('session', () => client.requestParsed('session/new', { cwd: body.cwd || '.', mcpServers: [] }, GrokAgentSessionCreatedSchema, { signal: options.signal, deadlineMs: budget.remaining('session/new') }));
23
+ const sessionId = created.sessionId;
24
+ if (!sessionId)
25
+ throw grokRefusal('agent-session-missing', { details: { stage: 'session' } });
26
+ const turnStop = new AbortController();
27
+ connection.onPermissionRequest(() => turnStop.abort());
28
+ const signal = options.signal ? AbortSignal.any([options.signal, turnStop.signal]) : turnStop.signal;
29
+ const turn = settle(() => client.requestParsed('session/prompt', { sessionId, prompt: body.prompt }, GrokAgentPromptResultSchema, {
30
+ signal,
31
+ deadlineMs: budget.remaining('session/prompt'),
32
+ onAbort: () => client.notify('session/cancel', { sessionId })
33
+ }));
34
+ const accumulator = new TurnAccumulator();
35
+ const iterator = client.notifications()[Symbol.asyncIterator]();
36
+ // One read at a time. `read` is the queue's own promise (settled the moment an item is buffered); `reading` observes it.
37
+ let read = iterator.next();
38
+ let reading = settle(() => read);
39
+ let answer;
40
+ for (;;) {
41
+ const step = await Promise.race([
42
+ reading.then((taken) => ({ kind: 'update', taken })),
43
+ turn.then((settled) => ({ kind: 'answer', answer: settled }))
44
+ ]);
45
+ if (step.kind === 'answer') {
46
+ answer = step.answer;
47
+ break;
48
+ }
49
+ // The queue ending (with the client's own failure, or because it closed) is also what the turn settles with.
50
+ if (!step.taken.ok || step.taken.value.done) {
51
+ answer = await turn;
52
+ break;
53
+ }
54
+ yield* accumulator.absorb(step.taken.value.value);
55
+ read = iterator.next();
56
+ reading = settle(() => read);
57
+ }
58
+ // The agent's updates precede its answer on the wire, so they are already queued: take them, and wait for nothing more.
59
+ // Racing the queue's own promise ahead of an already-settled one takes what is buffered and loses to nothing pending.
60
+ for (;;) {
61
+ const taken = await settle(() => Promise.race([read, NOTHING_BUFFERED]));
62
+ if (!taken.ok || taken.value === NOTHING_BUFFERED_MARK || taken.value.done)
63
+ break;
64
+ yield* accumulator.absorb(taken.value.value);
65
+ read = iterator.next();
66
+ }
67
+ if (connection.permissionRequested) {
68
+ throw grokRefusal('agent-permission-refused', {
69
+ details: { stage: 'prompt' },
70
+ cause: !answer.ok ? answer.cause : undefined
71
+ });
72
+ }
73
+ if (!answer.ok)
74
+ throw grokAgentFailure(answer.cause, 'prompt');
75
+ yield record({ type: 'result', stopReason: answer.value.stopReason, toolCalls: accumulator.toolCalls() });
76
+ }
77
+ /** Run one request and report any failure as this package's typed refusal for `stage`. */
78
+ async function typed(stage, work) {
79
+ const outcome = await settle(() => work());
80
+ if (outcome.ok)
81
+ return outcome.value;
82
+ throw grokAgentFailure(outcome.cause, stage);
83
+ }
84
+ /** What one turn has streamed so far, with every total bounded by `GROK_AGENT_LIMITS`. */
85
+ class TurnAccumulator {
86
+ #textChars = 0;
87
+ #thinkingChars = 0;
88
+ #toolBytes = 0;
89
+ #tools = new Map();
90
+ /** The records one `session/update` produces; a notification that is not a readable update fails the turn typed. */
91
+ *absorb(notification) {
92
+ if (notification.method !== 'session/update')
93
+ return;
94
+ const parsed = GrokAgentUpdateNotificationSchema.safeParse(notification.params);
95
+ if (!parsed.success)
96
+ throw grokRefusal('agent-record-invalid', { details: { stage: 'prompt', method: 'session/update' } });
97
+ const update = parsed.data.update;
98
+ const chunk = update.content?.text;
99
+ if (update.sessionUpdate === 'agent_message_chunk' && chunk) {
100
+ this.#textChars += chunk.length;
101
+ if (this.#textChars > GROK_AGENT_LIMITS.maxTextChars)
102
+ throw tooLarge('text');
103
+ yield record({ type: 'text-delta', delta: chunk });
104
+ }
105
+ if (update.sessionUpdate === 'agent_thought_chunk' && chunk) {
106
+ this.#thinkingChars += chunk.length;
107
+ if (this.#thinkingChars > GROK_AGENT_LIMITS.maxThinkingChars)
108
+ throw tooLarge('thinking');
109
+ yield record({ type: 'thinking-delta', delta: chunk });
110
+ }
111
+ if (update.sessionUpdate === 'tool_call' || update.sessionUpdate === 'tool_call_update')
112
+ this.#absorbTool(update);
113
+ }
114
+ toolCalls() {
115
+ return [...this.#tools.values()].map((entry) => entry.call);
116
+ }
117
+ #absorbTool(update) {
118
+ const id = update.toolCallId ?? update.title ?? 'tool';
119
+ const existing = this.#tools.get(id);
120
+ if (!existing && this.#tools.size >= GROK_AGENT_LIMITS.maxToolCalls)
121
+ throw tooLarge('tool-calls');
122
+ const call = existing?.call ?? { id, name: update.title || update.kind || 'tool', arguments: {} };
123
+ if (update.title)
124
+ call.name = update.title;
125
+ if (update.rawInput)
126
+ call.arguments = update.rawInput;
127
+ const bytes = call.id.length + call.name.length + JSON.stringify(call.arguments).length;
128
+ this.#toolBytes += bytes - (existing?.bytes ?? 0);
129
+ if (this.#toolBytes > GROK_AGENT_LIMITS.maxToolBytes)
130
+ throw tooLarge('tool-bytes');
131
+ this.#tools.set(id, { call, bytes });
132
+ }
133
+ }
134
+ function tooLarge(what) {
135
+ return grokRefusal('agent-output-too-large', { details: { stage: 'prompt', what } });
136
+ }
137
+ function record(value) {
138
+ return { kind: 'ndjson-record', data: JSON.stringify(value) };
139
+ }
140
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../../../src/ai/providers/grok/grok-agent/session.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAgB,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAuB,MAAM,eAAe,CAAC;AACtE,OAAO,EACN,iBAAiB,EACjB,2BAA2B,EAC3B,6BAA6B,EAC7B,iCAAiC,EAKjC,MAAM,eAAe,CAAC;AAavB,MAAM,UAAU,6BAA6B,CAAC,IAAuB;IACpE,OAAO,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAChG,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AAI,MAAM,CAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACrH,IAAI,MAAM,CAAC,KAAK;YAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3C,IAAI,MAAM,CAAC,QAAQ;YAAE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QACxF,IAAI,CAAC,UAAU,IAAI,KAAK,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;QAClD,IAAI,IAAI,CAAC,UAAU,GAAG,iBAAiB,CAAC,YAAY;YAAE,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;CACD;AAED,SAAS,QAAQ,CAAC,IAAY;IAC7B,OAAO,WAAW,CAAC,wBAAwB,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,MAAM,CAAC,KAAsB;IACrC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as z from 'zod/v4';
2
+ export declare const GrokBuildRequestSchema: z.ZodObject<{
3
+ prompt: z.ZodString;
4
+ model: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strict>;
6
+ export type GrokBuildRequest = z.infer<typeof GrokBuildRequestSchema>;
7
+ //# sourceMappingURL=grok-build.request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-build.request.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/grok/grok-build.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,sBAAsB;;;kBAQzB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as z from 'zod/v4';
2
+ export const GrokBuildRequestSchema = z
3
+ .object({
4
+ prompt: z.string().min(1),
5
+ model: z
6
+ .string()
7
+ .regex(/^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$/)
8
+ .optional()
9
+ })
10
+ .strict();
11
+ //# sourceMappingURL=grok-build.request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-build.request.js","sourceRoot":"","sources":["../../../../src/ai/providers/grok/grok-build.request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACrC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,KAAK,EAAE,CAAC;SACN,MAAM,EAAE;SACR,KAAK,CAAC,gCAAgC,CAAC;SACvC,QAAQ,EAAE;CACZ,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ id: string;
3
+ kind: "ai/transport";
4
+ name: string;
5
+ description: string;
6
+ scopes: ("cloud" | "consumer")[];
7
+ bidirectional: boolean;
8
+ cancellable: boolean;
9
+ enabled: boolean;
10
+ tags?: string[] | undefined;
11
+ };
12
+ export default _default;
13
+ //# sourceMappingURL=grok-build.transport.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grok-build.transport.descriptor.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/grok/grok-build.transport.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,wBASG"}