@agentstorm/platform-protocol 0.2.5

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 (97) hide show
  1. package/LICENSE +671 -0
  2. package/README.md +12 -0
  3. package/dist/agent-attention-notification.d.ts +43 -0
  4. package/dist/agent-attention-notification.js +141 -0
  5. package/dist/agent-deep-link.d.ts +8 -0
  6. package/dist/agent-deep-link.js +49 -0
  7. package/dist/agent-labels.d.ts +7 -0
  8. package/dist/agent-labels.js +11 -0
  9. package/dist/agent-lifecycle.d.ts +3 -0
  10. package/dist/agent-lifecycle.js +8 -0
  11. package/dist/agent-state-bucket.d.ts +14 -0
  12. package/dist/agent-state-bucket.js +41 -0
  13. package/dist/agent-title-limits.d.ts +2 -0
  14. package/dist/agent-title-limits.js +2 -0
  15. package/dist/agent-types.d.ts +451 -0
  16. package/dist/agent-types.js +22 -0
  17. package/dist/binary-frames/demux.d.ts +11 -0
  18. package/dist/binary-frames/demux.js +23 -0
  19. package/dist/binary-frames/file-transfer.d.ts +51 -0
  20. package/dist/binary-frames/file-transfer.js +108 -0
  21. package/dist/binary-frames/index.d.ts +4 -0
  22. package/dist/binary-frames/index.js +4 -0
  23. package/dist/binary-frames/terminal.d.ts +35 -0
  24. package/dist/binary-frames/terminal.js +100 -0
  25. package/dist/branch-slug.d.ts +14 -0
  26. package/dist/branch-slug.js +49 -0
  27. package/dist/browser-automation/capabilities.d.ts +7 -0
  28. package/dist/browser-automation/capabilities.js +31 -0
  29. package/dist/browser-automation/rpc-schemas.d.ts +1112 -0
  30. package/dist/browser-automation/rpc-schemas.js +462 -0
  31. package/dist/chat/rpc-schemas.d.ts +158 -0
  32. package/dist/chat/rpc-schemas.js +103 -0
  33. package/dist/chat/types.d.ts +30 -0
  34. package/dist/chat/types.js +22 -0
  35. package/dist/client-capabilities.d.ts +11 -0
  36. package/dist/client-capabilities.js +25 -0
  37. package/dist/connection-offer.d.ts +36 -0
  38. package/dist/connection-offer.js +53 -0
  39. package/dist/daemon-endpoints.d.ts +47 -0
  40. package/dist/daemon-endpoints.js +201 -0
  41. package/dist/error-utils.d.ts +11 -0
  42. package/dist/error-utils.js +27 -0
  43. package/dist/forge-manifest.d.ts +66 -0
  44. package/dist/forge-manifest.js +92 -0
  45. package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
  46. package/dist/generated/validation/ws-outbound.aot.js +65207 -0
  47. package/dist/git-remote.d.ts +33 -0
  48. package/dist/git-remote.js +94 -0
  49. package/dist/host-connection-schema.d.ts +11 -0
  50. package/dist/host-connection-schema.js +9 -0
  51. package/dist/literal-union.d.ts +2 -0
  52. package/dist/literal-union.js +2 -0
  53. package/dist/loop/rpc-schemas.d.ts +636 -0
  54. package/dist/loop/rpc-schemas.js +163 -0
  55. package/dist/messages.d.ts +40580 -0
  56. package/dist/messages.js +4999 -0
  57. package/dist/paseo-config-schema.d.ts +138 -0
  58. package/dist/paseo-config-schema.js +98 -0
  59. package/dist/path-utils.d.ts +2 -0
  60. package/dist/path-utils.js +16 -0
  61. package/dist/provider-config.d.ts +126 -0
  62. package/dist/provider-config.js +110 -0
  63. package/dist/provider-icon-names.d.ts +5 -0
  64. package/dist/provider-icon-names.js +52 -0
  65. package/dist/provider-manifest.d.ts +35 -0
  66. package/dist/provider-manifest.js +254 -0
  67. package/dist/schedule/cadence.d.ts +6 -0
  68. package/dist/schedule/cadence.js +28 -0
  69. package/dist/schedule/cron-expression.d.ts +13 -0
  70. package/dist/schedule/cron-expression.js +97 -0
  71. package/dist/schedule/rpc-schemas.d.ts +624 -0
  72. package/dist/schedule/rpc-schemas.js +155 -0
  73. package/dist/schedule/types.d.ts +222 -0
  74. package/dist/schedule/types.js +78 -0
  75. package/dist/terminal-activity.d.ts +21 -0
  76. package/dist/terminal-activity.js +25 -0
  77. package/dist/terminal-input-mode.d.ts +30 -0
  78. package/dist/terminal-input-mode.js +180 -0
  79. package/dist/terminal-key-input.d.ts +13 -0
  80. package/dist/terminal-key-input.js +210 -0
  81. package/dist/terminal-profiles.d.ts +6 -0
  82. package/dist/terminal-profiles.js +28 -0
  83. package/dist/terminal-snapshot.d.ts +3 -0
  84. package/dist/terminal-snapshot.js +178 -0
  85. package/dist/terminal-stream-protocol.d.ts +2 -0
  86. package/dist/terminal-stream-protocol.js +2 -0
  87. package/dist/terminal-subscription-key.d.ts +2 -0
  88. package/dist/terminal-subscription-key.js +9 -0
  89. package/dist/tool-call-display.d.ts +11 -0
  90. package/dist/tool-call-display.js +135 -0
  91. package/dist/tool-name-normalization.d.ts +9 -0
  92. package/dist/tool-name-normalization.js +82 -0
  93. package/dist/validation/ws-outbound-schema-metadata.d.ts +7570 -0
  94. package/dist/validation/ws-outbound-schema-metadata.js +3 -0
  95. package/dist/validation/ws-outbound.d.ts +12 -0
  96. package/dist/validation/ws-outbound.js +8 -0
  97. package/package.json +32 -0
@@ -0,0 +1,254 @@
1
+ import { z } from "zod";
2
+ const CLAUDE_MODES = [
3
+ {
4
+ id: "plan",
5
+ label: "Plan Mode",
6
+ description: "Analyze the codebase without executing tools or edits",
7
+ icon: "ShieldEllipsis",
8
+ colorTier: "planning",
9
+ },
10
+ {
11
+ id: "default",
12
+ label: "Always Ask",
13
+ description: "Prompts for permission the first time a tool is used",
14
+ icon: "Shield",
15
+ colorTier: "safe",
16
+ },
17
+ {
18
+ id: "acceptEdits",
19
+ label: "Accept File Edits",
20
+ description: "Automatically approves edit-focused tools without prompting",
21
+ icon: "ShieldPlus",
22
+ colorTier: "moderate",
23
+ },
24
+ {
25
+ id: "auto",
26
+ label: "Auto mode",
27
+ description: "Uses a model classifier to review permission prompts automatically",
28
+ icon: "ShieldCheck",
29
+ colorTier: "moderate",
30
+ },
31
+ {
32
+ id: "bypassPermissions",
33
+ label: "Bypass",
34
+ description: "Skip all permission prompts (use with caution)",
35
+ icon: "ShieldOff",
36
+ colorTier: "dangerous",
37
+ isUnattended: true,
38
+ },
39
+ ];
40
+ const CODEX_MODES = [
41
+ {
42
+ id: "auto",
43
+ label: "Default Permissions",
44
+ description: "Edit files and run commands with Codex's default approval flow.",
45
+ icon: "Shield",
46
+ colorTier: "moderate",
47
+ },
48
+ {
49
+ id: "auto-review",
50
+ label: "Auto-review",
51
+ description: "Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the auto-reviewer subagent.",
52
+ icon: "ShieldCheck",
53
+ colorTier: "moderate",
54
+ },
55
+ {
56
+ id: "full-access",
57
+ label: "Full Access",
58
+ description: "Edit files, run commands, and access the network without additional prompts.",
59
+ icon: "ShieldOff",
60
+ colorTier: "dangerous",
61
+ isUnattended: true,
62
+ },
63
+ ];
64
+ const COPILOT_MODES = [
65
+ {
66
+ id: "https://agentclientprotocol.com/protocol/session-modes#agent",
67
+ label: "Agent",
68
+ description: "Default agent mode for conversational interactions",
69
+ icon: "Shield",
70
+ colorTier: "moderate",
71
+ },
72
+ {
73
+ id: "https://agentclientprotocol.com/protocol/session-modes#plan",
74
+ label: "Plan",
75
+ description: "Plan mode for creating and executing multi-step plans",
76
+ icon: "ShieldEllipsis",
77
+ colorTier: "planning",
78
+ },
79
+ {
80
+ id: "allow-all",
81
+ label: "Allow All",
82
+ description: "Automatically approves all Copilot tool, path, and URL requests.",
83
+ icon: "ShieldOff",
84
+ colorTier: "dangerous",
85
+ isUnattended: true,
86
+ },
87
+ ];
88
+ const OPENCODE_MODES = [
89
+ {
90
+ id: "build",
91
+ label: "Build",
92
+ description: "Allows edits and tool execution for implementation work",
93
+ icon: "Shield",
94
+ colorTier: "moderate",
95
+ },
96
+ {
97
+ id: "plan",
98
+ label: "Plan",
99
+ description: "Read-only planning mode that avoids file edits",
100
+ icon: "ShieldEllipsis",
101
+ colorTier: "planning",
102
+ },
103
+ ];
104
+ export const OMP_MODES = [
105
+ {
106
+ id: "full",
107
+ label: "Full Access",
108
+ description: "Launches OMP with yolo approval mode so tools run without prompts.",
109
+ icon: "ShieldOff",
110
+ colorTier: "dangerous",
111
+ isUnattended: true,
112
+ },
113
+ {
114
+ id: "write",
115
+ label: "Write Approval",
116
+ description: "Launches OMP with write approval mode — reads are free, writes require approval.",
117
+ icon: "ShieldAlert",
118
+ colorTier: "moderate",
119
+ },
120
+ {
121
+ id: "ask",
122
+ label: "Always Ask",
123
+ description: "Launches OMP with always-ask approval mode for write and exec tools.",
124
+ icon: "ShieldCheck",
125
+ colorTier: "safe",
126
+ },
127
+ ];
128
+ const MOCK_LOAD_TEST_MODES = [
129
+ {
130
+ id: "load-test",
131
+ label: "Load Test",
132
+ description: "Streams repeated markdown, reasoning, and tool calls for app stress testing",
133
+ icon: "ShieldOff",
134
+ colorTier: "dangerous",
135
+ },
136
+ ];
137
+ const MOCK_SLOW_MODES = [
138
+ {
139
+ id: "default",
140
+ label: "Default",
141
+ description: "Dev-only mode for the mock slow provider",
142
+ icon: "ShieldOff",
143
+ colorTier: "dangerous",
144
+ },
145
+ ];
146
+ export const AGENT_PROVIDER_DEFINITIONS = [
147
+ {
148
+ id: "claude",
149
+ label: "Claude",
150
+ description: "Anthropic's multi-tool assistant with MCP support, streaming, and deep reasoning",
151
+ defaultModeId: "auto",
152
+ modes: CLAUDE_MODES,
153
+ voice: {
154
+ enabled: true,
155
+ defaultModeId: "default",
156
+ defaultModel: "haiku",
157
+ },
158
+ },
159
+ {
160
+ id: "codex",
161
+ label: "Codex",
162
+ description: "OpenAI's Codex workspace agent with sandbox controls and optional network access",
163
+ defaultModeId: "auto-review",
164
+ modes: CODEX_MODES,
165
+ voice: {
166
+ enabled: true,
167
+ defaultModeId: "auto",
168
+ defaultModel: "gpt-5.4-mini",
169
+ },
170
+ },
171
+ {
172
+ id: "copilot",
173
+ label: "Copilot",
174
+ description: "GitHub Copilot via Agent Client Protocol with dynamic modes and session support",
175
+ defaultModeId: "https://agentclientprotocol.com/protocol/session-modes#agent",
176
+ modes: COPILOT_MODES,
177
+ },
178
+ {
179
+ id: "opencode",
180
+ label: "OpenCode",
181
+ description: "Open-source coding assistant with multi-provider model support",
182
+ // No static default: OpenCode users can rename or delete any agent,
183
+ // including "build". Leaving this unset means the daemon and OpenCode
184
+ // itself decide (see normalizeOpenCodeModeId in opencode-agent.ts).
185
+ defaultModeId: null,
186
+ modes: OPENCODE_MODES,
187
+ voice: {
188
+ enabled: true,
189
+ defaultModeId: "build",
190
+ },
191
+ },
192
+ {
193
+ id: "pi",
194
+ label: "Pi",
195
+ description: "Minimal terminal-based coding agent with multi-provider LLM support",
196
+ defaultModeId: null,
197
+ modes: [],
198
+ },
199
+ {
200
+ id: "omp",
201
+ label: "Oh My Pi",
202
+ description: "Multi-provider coding agent with native approvals, host tools, and subagents",
203
+ enabledByDefault: false,
204
+ defaultModeId: "full",
205
+ modes: OMP_MODES,
206
+ },
207
+ ];
208
+ export const DEV_AGENT_PROVIDER_DEFINITIONS = [
209
+ {
210
+ id: "mock",
211
+ label: "Mock Load Test",
212
+ description: "Development-only provider that emits synthetic agent traffic for performance tests",
213
+ defaultModeId: "load-test",
214
+ modes: MOCK_LOAD_TEST_MODES,
215
+ },
216
+ {
217
+ id: "mock-slow",
218
+ label: "Mock Slow Provider",
219
+ description: "Dev-only: hangs during model discovery to test loading and timeout UI",
220
+ defaultModeId: "default",
221
+ modes: MOCK_SLOW_MODES,
222
+ },
223
+ ];
224
+ export function getAgentProviderDefinition(provider, definitions = [
225
+ ...AGENT_PROVIDER_DEFINITIONS,
226
+ ...DEV_AGENT_PROVIDER_DEFINITIONS,
227
+ ]) {
228
+ const definition = definitions.find((entry) => entry.id === provider);
229
+ if (!definition) {
230
+ throw new Error(`Unknown agent provider: ${provider}`);
231
+ }
232
+ return definition;
233
+ }
234
+ export const BUILTIN_PROVIDER_IDS = AGENT_PROVIDER_DEFINITIONS.map((d) => d.id);
235
+ export const AGENT_PROVIDER_IDS = BUILTIN_PROVIDER_IDS;
236
+ export const AgentProviderSchema = z.string();
237
+ export function isValidAgentProvider(value, validIds = BUILTIN_PROVIDER_IDS) {
238
+ return Array.isArray(validIds) ? validIds.includes(value) : new Set(validIds).has(value);
239
+ }
240
+ export function getUnattendedModeId(provider, definitions = [
241
+ ...AGENT_PROVIDER_DEFINITIONS,
242
+ ...DEV_AGENT_PROVIDER_DEFINITIONS,
243
+ ]) {
244
+ const definition = definitions.find((entry) => entry.id === provider);
245
+ return definition?.modes.find((mode) => mode.isUnattended)?.id;
246
+ }
247
+ export function getModeVisuals(provider, modeId, definitions) {
248
+ const definition = definitions.find((entry) => entry.id === provider);
249
+ const mode = definition?.modes.find((m) => m.id === modeId);
250
+ if (!mode)
251
+ return undefined;
252
+ return { icon: mode.icon, colorTier: mode.colorTier };
253
+ }
254
+ //# sourceMappingURL=provider-manifest.js.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Convert an exact rolling interval to an equivalent five-field cron cadence.
3
+ * Returns null when cron's calendar boundaries would change the interval.
4
+ */
5
+ export declare function everyMsToFiveFieldCron(everyMs: number): string | null;
6
+ //# sourceMappingURL=cadence.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Convert an exact rolling interval to an equivalent five-field cron cadence.
3
+ * Returns null when cron's calendar boundaries would change the interval.
4
+ */
5
+ export function everyMsToFiveFieldCron(everyMs) {
6
+ const minutes = everyMs / 60000;
7
+ if (!Number.isInteger(minutes) || minutes <= 0) {
8
+ return null;
9
+ }
10
+ if (minutes < 60 && 60 % minutes === 0) {
11
+ return `*/${minutes} * * * *`;
12
+ }
13
+ if (minutes === 60) {
14
+ return "0 * * * *";
15
+ }
16
+ if (minutes % 60 !== 0) {
17
+ return null;
18
+ }
19
+ const hours = minutes / 60;
20
+ if (hours < 24 && 24 % hours === 0) {
21
+ return `0 */${hours} * * *`;
22
+ }
23
+ if (hours === 24) {
24
+ return "0 0 * * *";
25
+ }
26
+ return null;
27
+ }
28
+ //# sourceMappingURL=cadence.js.map
@@ -0,0 +1,13 @@
1
+ export interface CronFieldMatcher {
2
+ matches(value: number): boolean;
3
+ }
4
+ export interface ParsedCronExpression {
5
+ minute: CronFieldMatcher;
6
+ hour: CronFieldMatcher;
7
+ dayOfMonth: CronFieldMatcher;
8
+ month: CronFieldMatcher;
9
+ dayOfWeek: CronFieldMatcher;
10
+ }
11
+ export declare function parseCronExpression(expression: string): ParsedCronExpression;
12
+ export declare function validateCronExpression(expression: string): string | null;
13
+ //# sourceMappingURL=cron-expression.d.ts.map
@@ -0,0 +1,97 @@
1
+ const CRON_FIELD_BOUNDS = [
2
+ { min: 0, max: 59, name: "minute" },
3
+ { min: 0, max: 23, name: "hour" },
4
+ { min: 1, max: 31, name: "day-of-month" },
5
+ { min: 1, max: 12, name: "month" },
6
+ { min: 0, max: 6, name: "day-of-week" },
7
+ ];
8
+ function createRange(start, end, step) {
9
+ const values = [];
10
+ for (let value = start; value <= end; value += step) {
11
+ values.push(value);
12
+ }
13
+ return values;
14
+ }
15
+ function parseStepPart(part, bounds) {
16
+ const stepParts = part.split("/");
17
+ if (stepParts.length > 2) {
18
+ throw new Error(`Invalid cron ${bounds.name} step`);
19
+ }
20
+ const [base, stepSource] = stepParts;
21
+ const normalizedStep = stepSource?.trim();
22
+ const step = normalizedStep === undefined ? 1 : Number.parseInt(normalizedStep, 10);
23
+ if (!Number.isInteger(step) ||
24
+ step <= 0 ||
25
+ (normalizedStep !== undefined && String(step) !== normalizedStep)) {
26
+ throw new Error(`Invalid cron ${bounds.name} step`);
27
+ }
28
+ return { base, step };
29
+ }
30
+ function parseField(source, bounds) {
31
+ const trimmed = source.trim();
32
+ if (!trimmed) {
33
+ throw new Error(`Invalid cron ${bounds.name} field`);
34
+ }
35
+ const allowed = new Set();
36
+ for (const rawPart of trimmed.split(",")) {
37
+ const part = rawPart.trim();
38
+ if (!part) {
39
+ throw new Error(`Invalid cron ${bounds.name} field`);
40
+ }
41
+ const { base, step } = parseStepPart(part, bounds);
42
+ if (base === "*") {
43
+ for (const value of createRange(bounds.min, bounds.max, step)) {
44
+ allowed.add(value);
45
+ }
46
+ continue;
47
+ }
48
+ const rangeMatch = base.match(/^(\d+)-(\d+)$/);
49
+ if (rangeMatch) {
50
+ const start = Number.parseInt(rangeMatch[1], 10);
51
+ const end = Number.parseInt(rangeMatch[2], 10);
52
+ if (start > end || start < bounds.min || end > bounds.max) {
53
+ throw new Error(`Invalid cron ${bounds.name} range`);
54
+ }
55
+ for (const value of createRange(start, end, step)) {
56
+ allowed.add(value);
57
+ }
58
+ continue;
59
+ }
60
+ if (!/^\d+$/.test(base)) {
61
+ throw new Error(`Invalid cron ${bounds.name} value`);
62
+ }
63
+ const value = Number.parseInt(base, 10);
64
+ if (!Number.isInteger(value) || value < bounds.min || value > bounds.max) {
65
+ throw new Error(`Invalid cron ${bounds.name} value`);
66
+ }
67
+ allowed.add(value);
68
+ }
69
+ return {
70
+ matches(value) {
71
+ return allowed.has(value);
72
+ },
73
+ };
74
+ }
75
+ export function parseCronExpression(expression) {
76
+ const parts = expression.trim().split(/\s+/);
77
+ if (parts.length !== 5) {
78
+ throw new Error("Cron expressions must have 5 fields");
79
+ }
80
+ return {
81
+ minute: parseField(parts[0], CRON_FIELD_BOUNDS[0]),
82
+ hour: parseField(parts[1], CRON_FIELD_BOUNDS[1]),
83
+ dayOfMonth: parseField(parts[2], CRON_FIELD_BOUNDS[2]),
84
+ month: parseField(parts[3], CRON_FIELD_BOUNDS[3]),
85
+ dayOfWeek: parseField(parts[4], CRON_FIELD_BOUNDS[4]),
86
+ };
87
+ }
88
+ export function validateCronExpression(expression) {
89
+ try {
90
+ parseCronExpression(expression);
91
+ return null;
92
+ }
93
+ catch (error) {
94
+ return error instanceof Error ? error.message : "Invalid cron expression";
95
+ }
96
+ }
97
+ //# sourceMappingURL=cron-expression.js.map