@agentdock/wire 0.4.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 (82) hide show
  1. package/README.md +152 -0
  2. package/dist/agentCapabilities.d.ts +30 -0
  3. package/dist/agentCapabilities.d.ts.map +1 -0
  4. package/dist/agentCapabilities.js +103 -0
  5. package/dist/agentCapabilities.js.map +1 -0
  6. package/dist/agentInstallGuide.d.ts +15 -0
  7. package/dist/agentInstallGuide.d.ts.map +1 -0
  8. package/dist/agentInstallGuide.js +63 -0
  9. package/dist/agentInstallGuide.js.map +1 -0
  10. package/dist/agentModels.d.ts +23 -0
  11. package/dist/agentModels.d.ts.map +1 -0
  12. package/dist/agentModels.js +77 -0
  13. package/dist/agentModels.js.map +1 -0
  14. package/dist/controlLevel.d.ts +12 -0
  15. package/dist/controlLevel.d.ts.map +1 -0
  16. package/dist/controlLevel.js +11 -0
  17. package/dist/controlLevel.js.map +1 -0
  18. package/dist/envelope.d.ts +582 -0
  19. package/dist/envelope.d.ts.map +1 -0
  20. package/dist/envelope.js +64 -0
  21. package/dist/envelope.js.map +1 -0
  22. package/dist/events.d.ts +441 -0
  23. package/dist/events.d.ts.map +1 -0
  24. package/dist/events.js +88 -0
  25. package/dist/events.js.map +1 -0
  26. package/dist/index.d.ts +38 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +42 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/interactionEvents.d.ts +182 -0
  31. package/dist/interactionEvents.d.ts.map +1 -0
  32. package/dist/interactionEvents.js +92 -0
  33. package/dist/interactionEvents.js.map +1 -0
  34. package/dist/legacyProtocol.d.ts +385 -0
  35. package/dist/legacyProtocol.d.ts.map +1 -0
  36. package/dist/legacyProtocol.js +30 -0
  37. package/dist/legacyProtocol.js.map +1 -0
  38. package/dist/machine.d.ts +45 -0
  39. package/dist/machine.d.ts.map +1 -0
  40. package/dist/machine.js +28 -0
  41. package/dist/machine.js.map +1 -0
  42. package/dist/messageMeta.d.ts +49 -0
  43. package/dist/messageMeta.d.ts.map +1 -0
  44. package/dist/messageMeta.js +33 -0
  45. package/dist/messageMeta.js.map +1 -0
  46. package/dist/messages.d.ts +1843 -0
  47. package/dist/messages.d.ts.map +1 -0
  48. package/dist/messages.js +35 -0
  49. package/dist/messages.js.map +1 -0
  50. package/dist/pairing.d.ts +133 -0
  51. package/dist/pairing.d.ts.map +1 -0
  52. package/dist/pairing.js +115 -0
  53. package/dist/pairing.js.map +1 -0
  54. package/dist/rpc.d.ts +340 -0
  55. package/dist/rpc.d.ts.map +1 -0
  56. package/dist/rpc.js +115 -0
  57. package/dist/rpc.js.map +1 -0
  58. package/dist/sessionResult.d.ts +40 -0
  59. package/dist/sessionResult.d.ts.map +1 -0
  60. package/dist/sessionResult.js +23 -0
  61. package/dist/sessionResult.js.map +1 -0
  62. package/dist/spawnError.d.ts +40 -0
  63. package/dist/spawnError.d.ts.map +1 -0
  64. package/dist/spawnError.js +31 -0
  65. package/dist/spawnError.js.map +1 -0
  66. package/dist/stats.d.ts +1213 -0
  67. package/dist/stats.d.ts.map +1 -0
  68. package/dist/stats.js +79 -0
  69. package/dist/stats.js.map +1 -0
  70. package/dist/sync.d.ts +721 -0
  71. package/dist/sync.d.ts.map +1 -0
  72. package/dist/sync.js +62 -0
  73. package/dist/sync.js.map +1 -0
  74. package/dist/team.d.ts +1557 -0
  75. package/dist/team.d.ts.map +1 -0
  76. package/dist/team.js +93 -0
  77. package/dist/team.js.map +1 -0
  78. package/dist/utils.d.ts +2 -0
  79. package/dist/utils.d.ts.map +1 -0
  80. package/dist/utils.js +2 -0
  81. package/dist/utils.js.map +1 -0
  82. package/package.json +40 -0
package/dist/rpc.js ADDED
@@ -0,0 +1,115 @@
1
+ import { z } from 'zod';
2
+ import { SessionMessageSchema } from './messages.js';
3
+ export const RpcMethod = z.enum([
4
+ 'spawn-session',
5
+ 'stop-session',
6
+ 'abort',
7
+ 'switch-mode',
8
+ 'approve-permission',
9
+ 'deny-permission',
10
+ 'answer-question',
11
+ 'shutdown-daemon',
12
+ 'get-messages',
13
+ 'get-stats',
14
+ 'get-team-stats',
15
+ 'start-invite',
16
+ 'get-machine-info',
17
+ 'get-agent-settings',
18
+ 'set-agent-settings',
19
+ ]);
20
+ /**
21
+ * Session-scoped RPC methods — registered by `agentbox start` (CLI process).
22
+ * These operate on a specific session and require the CLI to be running.
23
+ */
24
+ export const SESSION_RPC_METHODS = [
25
+ 'answer-question',
26
+ 'approve-permission',
27
+ 'deny-permission',
28
+ 'abort',
29
+ 'stop-session',
30
+ ];
31
+ /**
32
+ * Machine-scoped RPC methods — registered by the persistent daemon only.
33
+ * These are account/machine-level operations independent of any session.
34
+ */
35
+ export const MACHINE_RPC_METHODS = [
36
+ 'start-invite',
37
+ 'get-machine-info',
38
+ 'get-agent-settings',
39
+ 'set-agent-settings',
40
+ ];
41
+ /**
42
+ * All RPC methods that must be registered for Web UI to function.
43
+ * Daemon registers MACHINE_RPC_METHODS; CLI registers SESSION_RPC_METHODS.
44
+ *
45
+ * @deprecated Use SESSION_RPC_METHODS or MACHINE_RPC_METHODS directly.
46
+ */
47
+ export const DAEMON_REQUIRED_RPC_METHODS = [
48
+ ...SESSION_RPC_METHODS,
49
+ ...MACHINE_RPC_METHODS,
50
+ ];
51
+ export const RpcCallSchema = z.object({
52
+ method: z.string().min(1),
53
+ params: z.unknown(),
54
+ timeout: z.number().int().positive().default(30000),
55
+ });
56
+ export const RpcResultSchema = z.discriminatedUnion('ok', [
57
+ z.object({ ok: z.literal(true), result: z.unknown() }),
58
+ z.object({ ok: z.literal(false), error: z.string() }),
59
+ ]);
60
+ export const SpawnSessionParamsSchema = z.object({
61
+ cli: z.enum(['claude', 'copilot', 'opencode', 'codex', 'gemini', 'qwen']),
62
+ cwd: z.string().min(1),
63
+ prompt: z.string().optional(),
64
+ permissionMode: z
65
+ .enum(['default', 'acceptEdits', 'bypassPermissions', 'plan', 'read-only', 'safe-yolo', 'yolo'])
66
+ .default('default'),
67
+ env: z.record(z.string()).optional(),
68
+ model: z.string().optional(),
69
+ baseUrl: z.string().url().optional(),
70
+ /** System prompt text appended to the agent's built-in system prompt. */
71
+ appendSystemPrompt: z.string().optional(),
72
+ /** Restrict agent to only these tools (Claude CLI --allowedTools). */
73
+ allowedTools: z.array(z.string()).optional(),
74
+ /** Deny agent from using these tools (Claude CLI --disallowedTools). */
75
+ disallowedTools: z.array(z.string()).optional(),
76
+ /** MCP server config JSON string (Claude CLI --mcp-config). */
77
+ mcpConfig: z.string().optional(),
78
+ /** Resume a previous session by ID (Claude CLI --resume). */
79
+ resumeSessionId: z.string().optional(),
80
+ /** Server session ID to reuse (skip creating new session on resume). */
81
+ serverSessionId: z.string().optional(),
82
+ /** Maximum conversation turns before auto-stop (Claude CLI --max-turns). */
83
+ maxTurns: z.number().int().positive().optional(),
84
+ });
85
+ // ── Get Messages (session history sync) ─────────────────────────────
86
+ export const GetMessagesParamsSchema = z.object({
87
+ sessionId: z.string().min(1),
88
+ fromSeq: z.number().int().nonnegative().optional(),
89
+ limit: z.number().int().positive().default(100),
90
+ });
91
+ export const GetMessagesResponseSchema = z.object({
92
+ messages: z.array(SessionMessageSchema),
93
+ total: z.number(),
94
+ hasMore: z.boolean(),
95
+ });
96
+ // ── Get Machine Info (daemon environment) ───────────────────────────
97
+ export const MachineInfoResponseSchema = z.object({
98
+ homedir: z.string(),
99
+ recentCwds: z.array(z.string()),
100
+ availableAgents: z.array(z.string()),
101
+ });
102
+ // ── Agent Settings (proxy + env per agent) ──────────────────────────
103
+ export const AgentEnvConfigSchema = z.object({
104
+ httpProxy: z.string().optional(),
105
+ httpsProxy: z.string().optional(),
106
+ customEnv: z.record(z.string()).optional(),
107
+ });
108
+ export const AgentSettingsSchema = z.object({
109
+ claude: AgentEnvConfigSchema.optional(),
110
+ copilot: AgentEnvConfigSchema.optional(),
111
+ codex: AgentEnvConfigSchema.optional(),
112
+ gemini: AgentEnvConfigSchema.optional(),
113
+ opencode: AgentEnvConfigSchema.optional(),
114
+ });
115
+ //# sourceMappingURL=rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9B,eAAe;IACf,cAAc;IACd,OAAO;IACP,aAAa;IACb,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,WAAW;IACX,gBAAgB;IAChB,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;CACrB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,OAAO;IACP,cAAc;CACyC,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc;IACd,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;CACmC,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,GAAG,mBAAmB;IACtB,GAAG,mBAAmB;CACiC,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACpD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB,CAAC,IAAI,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AAM,EAAE,CAAC;IAC/B,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACrC,CAAC,CAAC;AAEH,uEAAuE;AAEvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACvC,OAAO,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACxC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACtC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Session result schema — data from Claude's `result` event.
3
+ *
4
+ * Emitted once per conversation turn, contains token usage, cost, and timing.
5
+ */
6
+ import { z } from 'zod';
7
+ export declare const SessionResultSchema: z.ZodObject<{
8
+ /** Total cost in USD for this turn. */
9
+ totalCostUsd: z.ZodOptional<z.ZodNumber>;
10
+ /** Input token count. */
11
+ inputTokens: z.ZodOptional<z.ZodNumber>;
12
+ /** Output token count. */
13
+ outputTokens: z.ZodOptional<z.ZodNumber>;
14
+ /** Duration in milliseconds. */
15
+ durationMs: z.ZodOptional<z.ZodNumber>;
16
+ /** Claude-internal session ID. */
17
+ cliSessionId: z.ZodOptional<z.ZodString>;
18
+ /** Whether the result represents an error. */
19
+ isError: z.ZodOptional<z.ZodBoolean>;
20
+ /** Number of conversation turns. */
21
+ numTurns: z.ZodOptional<z.ZodNumber>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ inputTokens?: number | undefined;
24
+ outputTokens?: number | undefined;
25
+ totalCostUsd?: number | undefined;
26
+ durationMs?: number | undefined;
27
+ cliSessionId?: string | undefined;
28
+ isError?: boolean | undefined;
29
+ numTurns?: number | undefined;
30
+ }, {
31
+ inputTokens?: number | undefined;
32
+ outputTokens?: number | undefined;
33
+ totalCostUsd?: number | undefined;
34
+ durationMs?: number | undefined;
35
+ cliSessionId?: string | undefined;
36
+ isError?: boolean | undefined;
37
+ numTurns?: number | undefined;
38
+ }>;
39
+ export type SessionResult = z.infer<typeof SessionResultSchema>;
40
+ //# sourceMappingURL=sessionResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionResult.d.ts","sourceRoot":"","sources":["../src/sessionResult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;IAC9B,uCAAuC;;IAEvC,yBAAyB;;IAEzB,0BAA0B;;IAE1B,gCAAgC;;IAEhC,kCAAkC;;IAElC,8CAA8C;;IAE9C,oCAAoC;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Session result schema — data from Claude's `result` event.
3
+ *
4
+ * Emitted once per conversation turn, contains token usage, cost, and timing.
5
+ */
6
+ import { z } from 'zod';
7
+ export const SessionResultSchema = z.object({
8
+ /** Total cost in USD for this turn. */
9
+ totalCostUsd: z.number().optional(),
10
+ /** Input token count. */
11
+ inputTokens: z.number().int().nonnegative().optional(),
12
+ /** Output token count. */
13
+ outputTokens: z.number().int().nonnegative().optional(),
14
+ /** Duration in milliseconds. */
15
+ durationMs: z.number().nonnegative().optional(),
16
+ /** Claude-internal session ID. */
17
+ cliSessionId: z.string().optional(),
18
+ /** Whether the result represents an error. */
19
+ isError: z.boolean().optional(),
20
+ /** Number of conversation turns. */
21
+ numTurns: z.number().int().nonnegative().optional(),
22
+ });
23
+ //# sourceMappingURL=sessionResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionResult.js","sourceRoot":"","sources":["../src/sessionResult.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,uCAAuC;IACvC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,yBAAyB;IACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACtD,0BAA0B;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACvD,gCAAgC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC/C,kCAAkC;IAClC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,8CAA8C;IAC9C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B,oCAAoC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Structured spawn errors for agent CLI processes.
3
+ *
4
+ * Replaces opaque stderr dumps with actionable, machine-readable errors.
5
+ * Lives in wire so the web UI can render structured error cards.
6
+ */
7
+ import { z } from 'zod';
8
+ export declare const SpawnErrorCodeSchema: z.ZodEnum<["agent-not-found", "agent-version-too-old", "agent-spawn-failed", "agent-spawn-timeout"]>;
9
+ export type SpawnErrorCode = z.infer<typeof SpawnErrorCodeSchema>;
10
+ export declare const SpawnErrorSchema: z.ZodObject<{
11
+ code: z.ZodEnum<["agent-not-found", "agent-version-too-old", "agent-spawn-failed", "agent-spawn-timeout"]>;
12
+ /** User-facing message, e.g. "Claude CLI not found". */
13
+ message: z.ZodString;
14
+ /** Actionable detail, e.g. "Install: npm i -g @anthropic-ai/claude-code". */
15
+ detail: z.ZodString;
16
+ agentType: z.ZodEnum<["claude", "copilot", "codex", "gemini", "opencode", "custom"]>;
17
+ platform: z.ZodEnum<["darwin", "linux", "win32"]>;
18
+ detectedVersion: z.ZodOptional<z.ZodString>;
19
+ minVersion: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ code: "agent-not-found" | "agent-version-too-old" | "agent-spawn-failed" | "agent-spawn-timeout";
22
+ message: string;
23
+ agentType: "custom" | "claude" | "copilot" | "opencode" | "codex" | "gemini";
24
+ platform: "darwin" | "linux" | "win32";
25
+ detail: string;
26
+ detectedVersion?: string | undefined;
27
+ minVersion?: string | undefined;
28
+ }, {
29
+ code: "agent-not-found" | "agent-version-too-old" | "agent-spawn-failed" | "agent-spawn-timeout";
30
+ message: string;
31
+ agentType: "custom" | "claude" | "copilot" | "opencode" | "codex" | "gemini";
32
+ platform: "darwin" | "linux" | "win32";
33
+ detail: string;
34
+ detectedVersion?: string | undefined;
35
+ minVersion?: string | undefined;
36
+ }>;
37
+ export type SpawnError = z.infer<typeof SpawnErrorSchema>;
38
+ /** Create a SpawnError object. */
39
+ export declare function createSpawnError(fields: SpawnError): SpawnError;
40
+ //# sourceMappingURL=spawnError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawnError.d.ts","sourceRoot":"","sources":["../src/spawnError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB,sGAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;IAE3B,wDAAwD;;IAExD,6EAA6E;;;;;;;;;;;;;;;;;;;;;;EAM7E,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,kCAAkC;AAClC,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAE/D"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Structured spawn errors for agent CLI processes.
3
+ *
4
+ * Replaces opaque stderr dumps with actionable, machine-readable errors.
5
+ * Lives in wire so the web UI can render structured error cards.
6
+ */
7
+ import { z } from 'zod';
8
+ import { AgentTypeSchema } from './messageMeta.js';
9
+ import { PlatformSchema } from './machine.js';
10
+ export const SpawnErrorCodeSchema = z.enum([
11
+ 'agent-not-found',
12
+ 'agent-version-too-old',
13
+ 'agent-spawn-failed',
14
+ 'agent-spawn-timeout',
15
+ ]);
16
+ export const SpawnErrorSchema = z.object({
17
+ code: SpawnErrorCodeSchema,
18
+ /** User-facing message, e.g. "Claude CLI not found". */
19
+ message: z.string(),
20
+ /** Actionable detail, e.g. "Install: npm i -g @anthropic-ai/claude-code". */
21
+ detail: z.string(),
22
+ agentType: AgentTypeSchema,
23
+ platform: PlatformSchema,
24
+ detectedVersion: z.string().optional(),
25
+ minVersion: z.string().optional(),
26
+ });
27
+ /** Create a SpawnError object. */
28
+ export function createSpawnError(fields) {
29
+ return SpawnErrorSchema.parse(fields);
30
+ }
31
+ //# sourceMappingURL=spawnError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawnError.js","sourceRoot":"","sources":["../src/spawnError.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,iBAAiB;IACjB,uBAAuB;IACvB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,oBAAoB;IAC1B,wDAAwD;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,6EAA6E;IAC7E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,cAAc;IACxB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAIH,kCAAkC;AAClC,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,OAAO,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC"}