code60-transmission-server 0.1.0-staging.13 → 0.1.0-staging.16

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 (104) hide show
  1. package/INTENT.md +47 -0
  2. package/README.md +36 -345
  3. package/dist/src/acp.js +115 -0
  4. package/dist/src/contract.js +60 -0
  5. package/dist/src/engine.js +481 -0
  6. package/dist/src/main.js +70 -25
  7. package/dist/src/repository.js +94 -0
  8. package/dist/src/service.js +184 -0
  9. package/package.json +16 -35
  10. package/reference/openapi.json +423 -0
  11. package/README.engine.md +0 -463
  12. package/dist/src/broker/filesystem.js +0 -385
  13. package/dist/src/broker/index.js +0 -777
  14. package/dist/src/broker/native/README.md +0 -207
  15. package/dist/src/broker/native/build.js +0 -46
  16. package/dist/src/broker/native/command-helper.c +0 -93
  17. package/dist/src/broker/native/fs-helper.c +0 -529
  18. package/dist/src/broker/native/git-helper.c +0 -205
  19. package/dist/src/broker/policy.js +0 -149
  20. package/dist/src/broker/startup-lock.js +0 -14
  21. package/dist/src/broker/types.js +0 -11
  22. package/dist/src/cli/configure.js +0 -208
  23. package/dist/src/cli/daemon.js +0 -369
  24. package/dist/src/cli/helpers.js +0 -112
  25. package/dist/src/cli/main.js +0 -189
  26. package/dist/src/cli/runtime-build.js +0 -38
  27. package/dist/src/config/coding-policy.js +0 -4
  28. package/dist/src/config/deployment.js +0 -183
  29. package/dist/src/config/documents.js +0 -29
  30. package/dist/src/config/profile-validation.js +0 -129
  31. package/dist/src/config/schema-graph.js +0 -237
  32. package/dist/src/config/schema-loader.js +0 -185
  33. package/dist/src/config/validation-pool.js +0 -105
  34. package/dist/src/config/validation-protocol.js +0 -1
  35. package/dist/src/config/validation-worker.js +0 -106
  36. package/dist/src/config/workflow-language.js +0 -9
  37. package/dist/src/config/workflow-schema.json +0 -545
  38. package/dist/src/config/workflow-types.js +0 -1
  39. package/dist/src/config/workflow-validation.js +0 -95
  40. package/dist/src/engine/budgets.js +0 -50
  41. package/dist/src/engine/clocks.js +0 -27
  42. package/dist/src/engine/commands.js +0 -477
  43. package/dist/src/engine/contracts.js +0 -11
  44. package/dist/src/engine/drain-state.js +0 -31
  45. package/dist/src/engine/effective-permissions.js +0 -120
  46. package/dist/src/engine/instruction-pins.js +0 -205
  47. package/dist/src/engine/retries.js +0 -50
  48. package/dist/src/engine/state.js +0 -1
  49. package/dist/src/engine/timing.js +0 -23
  50. package/dist/src/engine/tool-observations.js +0 -87
  51. package/dist/src/engine/workflow-engine.js +0 -1864
  52. package/dist/src/mcp/catalog.js +0 -71
  53. package/dist/src/mcp/main.js +0 -26
  54. package/dist/src/mcp/server.js +0 -177
  55. package/dist/src/runtime/codex-app-server.js +0 -91
  56. package/dist/src/runtime/codex-executable.js +0 -50
  57. package/dist/src/runtime/containment.js +0 -82
  58. package/dist/src/runtime/engine-driver.js +0 -221
  59. package/dist/src/runtime/json-line-writer.js +0 -192
  60. package/dist/src/runtime/pinned-instruction-sources.js +0 -24
  61. package/dist/src/runtime/protocol-client.js +0 -264
  62. package/dist/src/runtime/protocol-pool.js +0 -183
  63. package/dist/src/runtime/protocol-projection.js +0 -393
  64. package/dist/src/runtime/protocol-types.js +0 -1
  65. package/dist/src/runtime/protocol-worker.js +0 -18
  66. package/dist/src/runtime/provider-bridge.js +0 -290
  67. package/dist/src/runtime/provider-credentials.js +0 -41
  68. package/dist/src/runtime/provider-transport.js +0 -406
  69. package/dist/src/runtime/runtime-broker.js +0 -213
  70. package/dist/src/runtime/workspace-instructions.js +0 -120
  71. package/dist/src/runtime/workspace-view.js +0 -74
  72. package/dist/src/server/api-contract.json +0 -11637
  73. package/dist/src/server/api-types.js +0 -1
  74. package/dist/src/server/application.js +0 -44
  75. package/dist/src/server/auth.js +0 -67
  76. package/dist/src/server/broker-handlers.js +0 -242
  77. package/dist/src/server/coding.js +0 -281
  78. package/dist/src/server/control-plane.js +0 -50
  79. package/dist/src/server/deployment.js +0 -249
  80. package/dist/src/server/errors.js +0 -22
  81. package/dist/src/server/history-handlers.js +0 -130
  82. package/dist/src/server/http.js +0 -124
  83. package/dist/src/server/paging.js +0 -56
  84. package/dist/src/server/publication.js +0 -119
  85. package/dist/src/server/tool-event-handler.js +0 -77
  86. package/dist/src/server/workspace-handlers.js +0 -34
  87. package/dist/src/storage/coordinator.js +0 -224
  88. package/dist/src/storage/startup-lock.js +0 -71
  89. package/dist/src/storage/store.js +0 -167
  90. package/dist/src/tools/check-worker.js +0 -81
  91. package/dist/src/tools/checks.js +0 -117
  92. package/dist/src/tools/command-check.js +0 -34
  93. package/dist/src/tools/commands.js +0 -312
  94. package/dist/src/tools/developer.js +0 -355
  95. package/dist/src/tools/dns.js +0 -248
  96. package/dist/src/tools/http-contract.js +0 -38
  97. package/dist/src/tools/http.js +0 -358
  98. package/dist/src/tools/index.js +0 -194
  99. package/dist/src/tools/worker-check.js +0 -73
  100. package/dist/src/workspaces/git.js +0 -227
  101. package/dist/src/workspaces/index.js +0 -937
  102. package/dist/src/workspaces/source.js +0 -295
  103. package/examples/deployment.local.json +0 -22
  104. package/scripts/postinstall.mjs +0 -26
@@ -0,0 +1,184 @@
1
+ import { DatabaseSync } from 'node:sqlite';
2
+ import { createServer } from 'node:http';
3
+ import { randomBytes, randomUUID } from 'node:crypto';
4
+ import { execFileSync, spawn } from 'node:child_process';
5
+ import { closeSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
6
+ import { homedir } from 'node:os';
7
+ import { dirname, join } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ import { setTimeout as delay } from 'node:timers/promises';
10
+ import {} from './engine.js';
11
+ import { operations } from './contract.js';
12
+ const main = fileURLToPath(new URL('./main.js', import.meta.url));
13
+ export const state = process.env.TRANSMISSION_STATE_DIR ??
14
+ join(homedir(), 'Library/Application Support/Code60 Transmission/workflows');
15
+ const addressFile = join(state, 'endpoint.json');
16
+ function atomic(path, content) {
17
+ const temp = path + '.' + randomUUID();
18
+ writeFileSync(temp, content, { mode: 0o600 });
19
+ renameSync(temp, path);
20
+ }
21
+ function address() {
22
+ return JSON.parse(readFileSync(addressFile, 'utf8'));
23
+ }
24
+ export async function call(op, args = {}, endpoint = address()) {
25
+ const resp = await fetch('http://127.0.0.1:' + endpoint.port + '/' + op, {
26
+ method: 'POST',
27
+ headers: { authorization: 'Bearer ' + endpoint.token },
28
+ body: JSON.stringify(args),
29
+ signal: AbortSignal.timeout(op === 'health' ? 2000 : 180000),
30
+ });
31
+ const body = await resp.json();
32
+ if (!resp.ok)
33
+ throw new Error(body.error ?? 'Transmission request failed.');
34
+ return body;
35
+ }
36
+ export async function dispatch(engine, op, args) {
37
+ switch (op) {
38
+ case 'start_workflow':
39
+ return engine.start(operations.start_workflow.parse(args));
40
+ case 'get_workflow':
41
+ return engine.status(operations.get_workflow.parse(args).runId);
42
+ case 'get_workflow_events': {
43
+ const a = operations.get_workflow_events.parse(args);
44
+ return { events: engine.events(a.runId, a.after) };
45
+ }
46
+ case 'get_workflow_diff': {
47
+ const a = operations.get_workflow_diff.parse(args);
48
+ return engine.diff(a.runId, a.offset);
49
+ }
50
+ case 'answer_workflow_question': {
51
+ const a = operations.answer_workflow_question.parse(args);
52
+ return engine.answer(a.runId, a.questionId, a.answer);
53
+ }
54
+ case 'send_workflow_message': {
55
+ const a = operations.send_workflow_message.parse(args);
56
+ return engine.message(a.runId, a.message);
57
+ }
58
+ case 'cancel_workflow':
59
+ return engine.cancel(operations.cancel_workflow.parse(args).runId);
60
+ default:
61
+ throw new Error('Unknown operation.');
62
+ }
63
+ }
64
+ export async function serve() {
65
+ process.umask(0o077);
66
+ mkdirSync(state, { recursive: true, mode: 0o700 });
67
+ // The OS releases the writer lock on process death. Startup races never create two execution owners.
68
+ const lock = new DatabaseSync(join(state, 'owner.sqlite'));
69
+ try {
70
+ // A reserved writer lock is sufficient and coexists with other starters'
71
+ // transient read locks. An exclusive lock can make both starters lose.
72
+ lock.exec('BEGIN IMMEDIATE');
73
+ }
74
+ catch (error) {
75
+ lock.close();
76
+ if (error.errcode === 5)
77
+ return;
78
+ throw error;
79
+ }
80
+ const { Engine } = await import('./engine.js');
81
+ const engine = new Engine(state), token = randomBytes(32).toString('hex');
82
+ let stopping = false;
83
+ async function stop() {
84
+ if (stopping)
85
+ return;
86
+ stopping = true;
87
+ server.close();
88
+ await engine.close();
89
+ rmSync(addressFile, { force: true });
90
+ lock.close();
91
+ }
92
+ const server = createServer(async (req, res) => {
93
+ res.setHeader('Content-Type', 'application/json');
94
+ if (stopping) {
95
+ res.writeHead(503).end(JSON.stringify({ error: 'Engine is stopping.' }));
96
+ return;
97
+ }
98
+ if (req.method !== 'POST' ||
99
+ req.headers.authorization !== 'Bearer ' + token) {
100
+ res.writeHead(403).end('{}');
101
+ return;
102
+ }
103
+ try {
104
+ let s = '', size = 0;
105
+ req.setEncoding('utf8');
106
+ for await (const chunk of req) {
107
+ size += Buffer.byteLength(chunk);
108
+ if (size > 16 * 1024 * 1024)
109
+ throw new Error('Workflow request too large.');
110
+ s += chunk;
111
+ }
112
+ const op = req.url?.slice(1) ?? '';
113
+ const result = op === 'health'
114
+ ? { ready: true, pid: process.pid }
115
+ : op === 'stop'
116
+ ? { stopping: true }
117
+ : await dispatch(engine, op, JSON.parse(s));
118
+ res.end(JSON.stringify(result));
119
+ if (op === 'stop')
120
+ await stop();
121
+ }
122
+ catch (error) {
123
+ res.writeHead(400).end(JSON.stringify({
124
+ error: error instanceof Error ? error.message : 'Request failed.',
125
+ }));
126
+ }
127
+ });
128
+ await new Promise((resolve, reject) => {
129
+ server.once('error', reject);
130
+ server.listen(0, '127.0.0.1', resolve);
131
+ });
132
+ const bound = server.address();
133
+ if (!bound || typeof bound === 'string')
134
+ throw new Error('Missing listener.');
135
+ atomic(addressFile, JSON.stringify({ port: bound.port, token }));
136
+ process.once('SIGTERM', () => void stop());
137
+ process.once('SIGINT', () => void stop());
138
+ }
139
+ function installLoginAgent() {
140
+ if (process.platform !== 'darwin' || process.env.TRANSMISSION_STATE_DIR)
141
+ return;
142
+ const file = join(homedir(), 'Library/LaunchAgents/com.codemanufactory.transmission.workflows.plist');
143
+ const env = Object.fromEntries(['PATH', 'CODEX_HOME', 'CODEX_PATH'].flatMap((key) => process.env[key] ? [[key, process.env[key]]] : []));
144
+ const spec = {
145
+ Label: 'com.codemanufactory.transmission.workflows',
146
+ ProgramArguments: [process.execPath, main, 'engine'],
147
+ RunAtLoad: true,
148
+ EnvironmentVariables: env,
149
+ StandardErrorPath: join(state, 'engine.log'),
150
+ };
151
+ const data = execFileSync('/usr/bin/plutil', ['-convert', 'xml1', '-o', '-', '--', '-'], { input: JSON.stringify(spec) });
152
+ mkdirSync(dirname(file), { recursive: true });
153
+ atomic(file, data);
154
+ }
155
+ export async function ensure() {
156
+ mkdirSync(state, { recursive: true, mode: 0o700 });
157
+ installLoginAgent();
158
+ try {
159
+ await call('health');
160
+ return;
161
+ }
162
+ catch { }
163
+ const log = openSync(join(state, 'engine.log'), 'a', 0o600);
164
+ try {
165
+ spawn(process.execPath, [main, 'engine'], {
166
+ detached: true,
167
+ stdio: ['ignore', log, log],
168
+ }).unref();
169
+ }
170
+ finally {
171
+ closeSync(log);
172
+ }
173
+ const until = Date.now() + 20000;
174
+ while (Date.now() < until) {
175
+ try {
176
+ await call('health');
177
+ return;
178
+ }
179
+ catch {
180
+ await delay(100);
181
+ }
182
+ }
183
+ throw new Error('Engine did not start. See ' + join(state, 'engine.log'));
184
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "code60-transmission-server",
3
- "version": "0.1.0-staging.13",
4
- "description": "Local workflow server and stdio MCP launcher for bounded coding-agent steps against Git workspaces.",
3
+ "version": "0.1.0-staging.16",
4
+ "description": "Run user-approved workflows with independent coding agents over ACP.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
7
7
  "mcp",
@@ -19,55 +19,36 @@
19
19
  "node": ">=24.22.0 <25"
20
20
  },
21
21
  "bin": {
22
- "code60-transmission-server": "dist/src/cli/main.js",
23
- "code60": "dist/src/cli/main.js"
22
+ "code60": "dist/src/main.js",
23
+ "code60-transmission-server": "dist/src/main.js"
24
24
  },
25
25
  "files": [
26
- "dist/src/**/*.js",
27
- "dist/src/**/*.json",
28
- "dist/src/broker/native/fs-helper.c",
29
- "dist/src/broker/native/git-helper.c",
30
- "dist/src/broker/native/command-helper.c",
31
- "dist/src/broker/native/README.md",
32
- "!dist/src/broker/native/.build",
33
- "!dist/src/broker/native/.build/**",
34
- "examples/deployment.local.json",
35
- "scripts/postinstall.mjs",
26
+ "dist/src",
27
+ "reference/openapi.json",
36
28
  "LICENSE",
37
29
  "README.md",
38
- "README.engine.md"
30
+ "INTENT.md"
39
31
  ],
40
32
  "scripts": {
41
- "start": "node dist/src/main.js",
42
- "build": "tsc -p tsconfig.build.json && node scripts/build-native.mjs",
33
+ "build": "tsc -p tsconfig.build.json",
43
34
  "prepack": "npm run build",
44
- "postinstall": "node scripts/postinstall.mjs",
45
- "package:macos": "bash scripts/package-macos.sh",
46
- "docs:api": "docker run --rm -p 127.0.0.1:8080:8080 -e SWAGGER_JSON=/spec/openapi.yaml -v \"$PWD/reference/workflow-engine/api:/spec:ro\" docker.swagger.io/swaggerapi/swagger-ui",
47
- "example:hello-world": "node examples/hello-world/run.mjs",
48
- "example:pull-request": "node examples/pull-request/run.mjs",
49
- "smoke:native": "node scripts/smoke-native.mjs",
50
35
  "typecheck": "tsc --noEmit",
51
36
  "test": "npm run build && vitest run",
52
- "test:pilot": "npm run build && vitest run tests/pilot",
53
- "example:coding-task": "node examples/coding-task/run.mjs",
54
- "acceptance:installed": "node scripts/acceptance/installed-coding.mjs"
37
+ "acceptance:installed": "node scripts/acceptance/installed.mjs",
38
+ "package:macos": "bash scripts/package-macos.sh",
39
+ "contracts": "npm run build && node scripts/contracts.mjs",
40
+ "contracts:check": "npm run build && node scripts/contracts.mjs --check",
41
+ "prebuild": "node -e \"require('node:fs').rmSync('dist/src',{recursive:true,force:true})\""
55
42
  },
56
43
  "dependencies": {
57
- "@agentclientprotocol/sdk": "2.7.0",
44
+ "@agentclientprotocol/codex-acp": "2.9.0",
45
+ "@agentclientprotocol/sdk": "2.9.1",
58
46
  "@modelcontextprotocol/sdk": "1.32.2",
59
- "ajv": "8.20.0",
60
- "ajv-formats": "3.0.1",
61
- "better-sqlite3": "13.2.0",
62
- "fastify": "5.12.8",
63
- "yaml": "2.9.1"
47
+ "zod": "^4.0.0"
64
48
  },
65
49
  "devDependencies": {
66
- "@types/better-sqlite3": "9.6.0",
67
50
  "@types/node": "26.6.6",
68
- "eslint": "10.15.0",
69
51
  "typescript": "6.0.3",
70
- "typescript-eslint": "8.73.0",
71
52
  "vitest": "5.1.0"
72
53
  }
73
54
  }
@@ -0,0 +1,423 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Transmission workflow service",
5
+ "version": "1"
6
+ },
7
+ "paths": {
8
+ "/start_workflow": {
9
+ "post": {
10
+ "operationId": "start_workflow",
11
+ "description": "Run the exact workflow confirmed by the user. Design ordered tasks, each with implementation instructions and an independent verification prompt. Show the project, tasks and criteria to the user and obtain confirmation before calling. Reuse the same key on reconnect.",
12
+ "security": [
13
+ {
14
+ "localToken": []
15
+ }
16
+ ],
17
+ "requestBody": {
18
+ "required": true,
19
+ "content": {
20
+ "application/json": {
21
+ "schema": {
22
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
23
+ "type": "object",
24
+ "properties": {
25
+ "repository": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "maxLength": 65536
29
+ },
30
+ "tasks": {
31
+ "minItems": 1,
32
+ "maxItems": 100,
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "properties": {
37
+ "name": {
38
+ "type": "string",
39
+ "minLength": 1,
40
+ "maxLength": 65536
41
+ },
42
+ "instructions": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "maxLength": 65536
46
+ },
47
+ "verify": {
48
+ "type": "string",
49
+ "minLength": 1,
50
+ "maxLength": 65536
51
+ },
52
+ "checks": {
53
+ "maxItems": 30,
54
+ "type": "array",
55
+ "items": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "maxLength": 65536
59
+ }
60
+ }
61
+ },
62
+ "required": [
63
+ "name",
64
+ "instructions",
65
+ "verify"
66
+ ],
67
+ "additionalProperties": false
68
+ }
69
+ },
70
+ "confirmed": {
71
+ "type": "boolean",
72
+ "const": true
73
+ },
74
+ "idempotencyKey": {
75
+ "type": "string",
76
+ "minLength": 1,
77
+ "maxLength": 256
78
+ },
79
+ "repairs": {
80
+ "default": 2,
81
+ "type": "integer",
82
+ "minimum": 0,
83
+ "maximum": 30
84
+ },
85
+ "retries": {
86
+ "default": 2,
87
+ "type": "integer",
88
+ "minimum": 0,
89
+ "maximum": 30
90
+ },
91
+ "autoApprove": {
92
+ "default": true,
93
+ "type": "boolean"
94
+ }
95
+ },
96
+ "required": [
97
+ "repository",
98
+ "tasks",
99
+ "confirmed",
100
+ "idempotencyKey"
101
+ ],
102
+ "additionalProperties": false
103
+ }
104
+ }
105
+ }
106
+ },
107
+ "responses": {
108
+ "200": {
109
+ "description": "Workflow receipt"
110
+ },
111
+ "400": {
112
+ "description": "Invalid input or workflow state"
113
+ },
114
+ "403": {
115
+ "description": "Invalid engine token"
116
+ }
117
+ }
118
+ }
119
+ },
120
+ "/get_workflow": {
121
+ "post": {
122
+ "operationId": "get_workflow",
123
+ "description": "Read the current task, a decision needing input, the accepted results and verdicts, or the reason for failure.",
124
+ "security": [
125
+ {
126
+ "localToken": []
127
+ }
128
+ ],
129
+ "requestBody": {
130
+ "required": true,
131
+ "content": {
132
+ "application/json": {
133
+ "schema": {
134
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
135
+ "type": "object",
136
+ "properties": {
137
+ "runId": {
138
+ "type": "string",
139
+ "format": "uuid",
140
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
141
+ }
142
+ },
143
+ "required": [
144
+ "runId"
145
+ ],
146
+ "additionalProperties": false
147
+ }
148
+ }
149
+ }
150
+ },
151
+ "responses": {
152
+ "200": {
153
+ "description": "Workflow receipt"
154
+ },
155
+ "400": {
156
+ "description": "Invalid input or workflow state"
157
+ },
158
+ "403": {
159
+ "description": "Invalid engine token"
160
+ }
161
+ }
162
+ }
163
+ },
164
+ "/get_workflow_events": {
165
+ "post": {
166
+ "operationId": "get_workflow_events",
167
+ "description": "Read the next page of progress, sessions, native tools and verifier feedback. Use the last sequence number as after.",
168
+ "security": [
169
+ {
170
+ "localToken": []
171
+ }
172
+ ],
173
+ "requestBody": {
174
+ "required": true,
175
+ "content": {
176
+ "application/json": {
177
+ "schema": {
178
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
179
+ "type": "object",
180
+ "properties": {
181
+ "runId": {
182
+ "type": "string",
183
+ "format": "uuid",
184
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
185
+ },
186
+ "after": {
187
+ "default": 0,
188
+ "type": "integer",
189
+ "minimum": 0,
190
+ "maximum": 9007199254740991
191
+ }
192
+ },
193
+ "required": [
194
+ "runId"
195
+ ],
196
+ "additionalProperties": false
197
+ }
198
+ }
199
+ }
200
+ },
201
+ "responses": {
202
+ "200": {
203
+ "description": "Workflow receipt"
204
+ },
205
+ "400": {
206
+ "description": "Invalid input or workflow state"
207
+ },
208
+ "403": {
209
+ "description": "Invalid engine token"
210
+ }
211
+ }
212
+ }
213
+ },
214
+ "/get_workflow_diff": {
215
+ "post": {
216
+ "operationId": "get_workflow_diff",
217
+ "description": "Read a page of the accepted patch relative to the initial working tree. Offset is in bytes; content is base64.",
218
+ "security": [
219
+ {
220
+ "localToken": []
221
+ }
222
+ ],
223
+ "requestBody": {
224
+ "required": true,
225
+ "content": {
226
+ "application/json": {
227
+ "schema": {
228
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
229
+ "type": "object",
230
+ "properties": {
231
+ "runId": {
232
+ "type": "string",
233
+ "format": "uuid",
234
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
235
+ },
236
+ "offset": {
237
+ "default": 0,
238
+ "type": "integer",
239
+ "minimum": 0,
240
+ "maximum": 9007199254740991
241
+ }
242
+ },
243
+ "required": [
244
+ "runId"
245
+ ],
246
+ "additionalProperties": false
247
+ }
248
+ }
249
+ }
250
+ },
251
+ "responses": {
252
+ "200": {
253
+ "description": "Workflow receipt"
254
+ },
255
+ "400": {
256
+ "description": "Invalid input or workflow state"
257
+ },
258
+ "403": {
259
+ "description": "Invalid engine token"
260
+ }
261
+ }
262
+ }
263
+ },
264
+ "/answer_workflow_question": {
265
+ "post": {
266
+ "operationId": "answer_workflow_question",
267
+ "description": "Answer the outstanding decision by ID. For a permission question select an offered option ID.",
268
+ "security": [
269
+ {
270
+ "localToken": []
271
+ }
272
+ ],
273
+ "requestBody": {
274
+ "required": true,
275
+ "content": {
276
+ "application/json": {
277
+ "schema": {
278
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
279
+ "type": "object",
280
+ "properties": {
281
+ "runId": {
282
+ "type": "string",
283
+ "format": "uuid",
284
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
285
+ },
286
+ "questionId": {
287
+ "type": "string",
288
+ "format": "uuid",
289
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
290
+ },
291
+ "answer": {
292
+ "type": "string",
293
+ "minLength": 1,
294
+ "maxLength": 65536
295
+ }
296
+ },
297
+ "required": [
298
+ "runId",
299
+ "questionId",
300
+ "answer"
301
+ ],
302
+ "additionalProperties": false
303
+ }
304
+ }
305
+ }
306
+ },
307
+ "responses": {
308
+ "200": {
309
+ "description": "Workflow receipt"
310
+ },
311
+ "400": {
312
+ "description": "Invalid input or workflow state"
313
+ },
314
+ "403": {
315
+ "description": "Invalid engine token"
316
+ }
317
+ }
318
+ }
319
+ },
320
+ "/send_workflow_message": {
321
+ "post": {
322
+ "operationId": "send_workflow_message",
323
+ "description": "Deliver new guidance before the current task is accepted.",
324
+ "security": [
325
+ {
326
+ "localToken": []
327
+ }
328
+ ],
329
+ "requestBody": {
330
+ "required": true,
331
+ "content": {
332
+ "application/json": {
333
+ "schema": {
334
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
335
+ "type": "object",
336
+ "properties": {
337
+ "runId": {
338
+ "type": "string",
339
+ "format": "uuid",
340
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
341
+ },
342
+ "message": {
343
+ "type": "string",
344
+ "minLength": 1,
345
+ "maxLength": 65536
346
+ }
347
+ },
348
+ "required": [
349
+ "runId",
350
+ "message"
351
+ ],
352
+ "additionalProperties": false
353
+ }
354
+ }
355
+ }
356
+ },
357
+ "responses": {
358
+ "200": {
359
+ "description": "Workflow receipt"
360
+ },
361
+ "400": {
362
+ "description": "Invalid input or workflow state"
363
+ },
364
+ "403": {
365
+ "description": "Invalid engine token"
366
+ }
367
+ }
368
+ }
369
+ },
370
+ "/cancel_workflow": {
371
+ "post": {
372
+ "operationId": "cancel_workflow",
373
+ "description": "Stop the workflow and its active agent sessions. Leave working files available for review.",
374
+ "security": [
375
+ {
376
+ "localToken": []
377
+ }
378
+ ],
379
+ "requestBody": {
380
+ "required": true,
381
+ "content": {
382
+ "application/json": {
383
+ "schema": {
384
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
385
+ "type": "object",
386
+ "properties": {
387
+ "runId": {
388
+ "type": "string",
389
+ "format": "uuid",
390
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
391
+ }
392
+ },
393
+ "required": [
394
+ "runId"
395
+ ],
396
+ "additionalProperties": false
397
+ }
398
+ }
399
+ }
400
+ },
401
+ "responses": {
402
+ "200": {
403
+ "description": "Workflow receipt"
404
+ },
405
+ "400": {
406
+ "description": "Invalid input or workflow state"
407
+ },
408
+ "403": {
409
+ "description": "Invalid engine token"
410
+ }
411
+ }
412
+ }
413
+ }
414
+ },
415
+ "components": {
416
+ "securitySchemes": {
417
+ "localToken": {
418
+ "type": "http",
419
+ "scheme": "bearer"
420
+ }
421
+ }
422
+ }
423
+ }