@agimon-ai/po-workflow 0.0.0-alpha.2 → 0.0.0-alpha.200

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 (57) hide show
  1. package/LICENSE +95 -14
  2. package/README.md +134 -47
  3. package/dist/apiContracts.cjs +209 -36
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +209 -36
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/contract-BpzJeyjh.mjs +33 -0
  10. package/dist/contract-BpzJeyjh.mjs.map +1 -0
  11. package/dist/contract-D80yV2d-.cjs +68 -0
  12. package/dist/contract-D80yV2d-.cjs.map +1 -0
  13. package/dist/extensions/native.mjs +4580 -997
  14. package/dist/extensions/native.mjs.map +1 -1
  15. package/dist/extensions/server.cjs +20921 -3342
  16. package/dist/extensions/server.cjs.map +1 -1
  17. package/dist/extensions/server.d.mts +2 -2
  18. package/dist/extensions/server.d.mts.map +1 -1
  19. package/dist/extensions/server.mjs +20934 -3331
  20. package/dist/extensions/server.mjs.map +1 -1
  21. package/dist/extensions/web.mjs +5694 -3127
  22. package/dist/extensions/web.mjs.map +1 -1
  23. package/dist/index--C-zOl9A.d.mts +5107 -0
  24. package/dist/index--C-zOl9A.d.mts.map +1 -0
  25. package/dist/index.cjs +41 -3
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.mts +104 -3
  28. package/dist/index.d.mts.map +1 -1
  29. package/dist/index.mjs +38 -2
  30. package/dist/index.mjs.map +1 -0
  31. package/dist/po-runtime-identity.json +1 -0
  32. package/dist/workflowHost-B-B6BIeD.mjs +3969 -0
  33. package/dist/workflowHost-B-B6BIeD.mjs.map +1 -0
  34. package/dist/workflowHost-d3yIgFif.cjs +4185 -0
  35. package/dist/workflowHost-d3yIgFif.cjs.map +1 -0
  36. package/dist/workflowHost.cjs +7 -0
  37. package/dist/workflowHost.d.mts +29 -0
  38. package/dist/workflowHost.d.mts.map +1 -0
  39. package/dist/workflowHost.mjs +3 -0
  40. package/dist/workflowServices-CSHleLJo.mjs +273 -0
  41. package/dist/workflowServices-CSHleLJo.mjs.map +1 -0
  42. package/dist/workflowServices-DYXhIDVE.cjs +350 -0
  43. package/dist/workflowServices-DYXhIDVE.cjs.map +1 -0
  44. package/llms.txt +11 -10
  45. package/package.json +140 -31
  46. package/src/prompts/codemode-how-to-workflow/SKILL.md +226 -0
  47. package/src/prompts/help-how-to-workflow/SKILL.md +191 -0
  48. package/src/types/webWorkflowTerminal.ts +21 -0
  49. package/src/types/webWorkflows.ts +54 -2
  50. package/LICENSE.web +0 -29
  51. package/dist/workflowLaunchCommand-C69Nn3k5.cjs +0 -139
  52. package/dist/workflowLaunchCommand-C69Nn3k5.cjs.map +0 -1
  53. package/dist/workflowLaunchCommand-GGqimmTC.mjs +0 -122
  54. package/dist/workflowLaunchCommand-GGqimmTC.mjs.map +0 -1
  55. package/skills/workflow-recovery/SKILL.md +0 -85
  56. package/src/prompts/po-author-workflow/SKILL.md +0 -64
  57. package/src/prompts/po-use-workflow/SKILL.md +0 -21
@@ -4,7 +4,88 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
6
6
  let typebox = require("typebox");
7
+ //#region src/schemas/dynamicWorkflowSnapshot.ts
8
+ const state = typebox.Type.Union([
9
+ "pending",
10
+ "running",
11
+ "completed",
12
+ "failed",
13
+ "stopped",
14
+ "skipped"
15
+ ].map((value) => typebox.Type.Literal(value)));
16
+ const time = typebox.Type.Optional(typebox.Type.Number());
17
+ const phase = typebox.Type.Object({
18
+ key: typebox.Type.String(),
19
+ label: typebox.Type.String(),
20
+ status: state,
21
+ executionStatus: state,
22
+ startedAt: time,
23
+ finishedAt: time,
24
+ error: typebox.Type.Optional(typebox.Type.String()),
25
+ agents: typebox.Type.Array(typebox.Type.Object({
26
+ runId: typebox.Type.String(),
27
+ status: typebox.Type.Union([
28
+ "running",
29
+ "completed",
30
+ "failed",
31
+ "stopped"
32
+ ].map((value) => typebox.Type.Literal(value)))
33
+ }))
34
+ });
35
+ const shape = typebox.Type.Object({
36
+ key: typebox.Type.String(),
37
+ label: typebox.Type.String(),
38
+ kind: typebox.Type.Union([
39
+ "step",
40
+ "sequence",
41
+ "parallel",
42
+ "branch",
43
+ "foreach"
44
+ ].map((value) => typebox.Type.Literal(value))),
45
+ children: typebox.Type.Array(typebox.Type.Ref("#/$defs/Shape"))
46
+ });
47
+ const DynamicWorkflowSnapshotSchema = typebox.Type.Object({
48
+ version: typebox.Type.Literal(1),
49
+ revision: typebox.Type.Number(),
50
+ sessionId: typebox.Type.String(),
51
+ runs: typebox.Type.Array(typebox.Type.Object({
52
+ key: typebox.Type.String(),
53
+ workflowId: typebox.Type.String(),
54
+ label: typebox.Type.String(),
55
+ status: state,
56
+ executionStatus: state,
57
+ startedAt: typebox.Type.Number(),
58
+ finishedAt: time,
59
+ error: typebox.Type.Optional(typebox.Type.String()),
60
+ shape: typebox.Type.Ref("#/$defs/Shape"),
61
+ groups: typebox.Type.Array(typebox.Type.Object({
62
+ key: typebox.Type.String(),
63
+ label: typebox.Type.String(),
64
+ concurrency: typebox.Type.Optional(typebox.Type.Number()),
65
+ total: typebox.Type.Number(),
66
+ truncated: typebox.Type.Boolean(),
67
+ counts: typebox.Type.Object({
68
+ pending: typebox.Type.Number(),
69
+ running: typebox.Type.Number(),
70
+ completed: typebox.Type.Number(),
71
+ failed: typebox.Type.Number(),
72
+ stopped: typebox.Type.Number(),
73
+ skipped: typebox.Type.Number()
74
+ }),
75
+ items: typebox.Type.Array(typebox.Type.Object({
76
+ key: typebox.Type.String(),
77
+ label: typebox.Type.String(),
78
+ index: typebox.Type.Number(),
79
+ status: state,
80
+ phases: typebox.Type.Array(phase)
81
+ }))
82
+ }))
83
+ }))
84
+ }, { $defs: { Shape: shape } });
85
+ //#endregion
7
86
  //#region src/schemas/apiContracts.ts
87
+ const API_BASE_PATH = "workflow";
88
+ const OWNER_AUTHENTICATION = "owner";
8
89
  const S = typebox.Type.String();
9
90
  const N = typebox.Type.Number();
10
91
  const B = typebox.Type.Boolean();
@@ -26,8 +107,55 @@ const Step = {
26
107
  startedAt: O(S),
27
108
  endedAt: O(S)
28
109
  };
110
+ const Usage = typebox.Type.Object({
111
+ tokens: O(typebox.Type.Object({
112
+ input: N,
113
+ output: N,
114
+ cacheRead: N,
115
+ cacheWrite: N,
116
+ total: N
117
+ })),
118
+ costUsd: O(N),
119
+ toolCount: O(N)
120
+ });
121
+ const Children = typebox.Type.Array(typebox.Type.Object({
122
+ lead: S,
123
+ continuations: N,
124
+ maxContinuations: N,
125
+ criteria: typebox.Type.Array(typebox.Type.Object({
126
+ key: S,
127
+ description: S,
128
+ verifiedBy: S,
129
+ status: values([
130
+ "unchecked",
131
+ "checked",
132
+ "not-met"
133
+ ]),
134
+ feedback: O(S),
135
+ invocationId: O(S)
136
+ })),
137
+ invocations: typebox.Type.Array(typebox.Type.Object({
138
+ invocationId: S,
139
+ job: S,
140
+ state: values([
141
+ "running",
142
+ "completed",
143
+ "failed",
144
+ "interrupted"
145
+ ]),
146
+ sessionIds: typebox.Type.Array(S),
147
+ startedAt: S,
148
+ endedAt: O(S),
149
+ error: O(S),
150
+ usage: O(Usage)
151
+ }))
152
+ }));
29
153
  const Run = typebox.Type.Object({
30
154
  runKey: S,
155
+ routeKey: O(S),
156
+ runId: O(S),
157
+ ownerSessionId: O(S),
158
+ launcherSessionId: O(S),
31
159
  workspace: S,
32
160
  displayName: S,
33
161
  workflowName: O(S),
@@ -54,6 +182,7 @@ const Run = typebox.Type.Object({
54
182
  finishedAt: O(S),
55
183
  errorMessage: O(S),
56
184
  failedJob: O(S),
185
+ waiting: O(typebox.Type.Literal(true)),
57
186
  stale: O(B),
58
187
  staleReason: O(S),
59
188
  worktreeBranch: O(S),
@@ -63,6 +192,27 @@ const Run = typebox.Type.Object({
63
192
  index: O(N),
64
193
  total: O(N)
65
194
  })),
195
+ children: O(Children),
196
+ childUsage: O(typebox.Type.Object({
197
+ complete: B,
198
+ invocationCount: N,
199
+ tokensKnown: N,
200
+ costKnown: N,
201
+ toolCountKnown: N,
202
+ tokens: O(typebox.Type.Object({
203
+ input: N,
204
+ output: N,
205
+ cacheRead: N,
206
+ cacheWrite: N,
207
+ total: N
208
+ })),
209
+ costUsd: O(N),
210
+ toolCount: O(N)
211
+ })),
212
+ childStatusErrors: O(typebox.Type.Array(typebox.Type.Object({
213
+ lead: O(S),
214
+ message: S
215
+ }))),
66
216
  jobs: typebox.Type.Array(typebox.Type.Object({
67
217
  ...Step,
68
218
  phase: values([
@@ -131,17 +281,27 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
131
281
  version: 1,
132
282
  dynamic: [],
133
283
  http: [
134
- "global",
284
+ "host",
135
285
  "workspace",
136
286
  "session"
137
287
  ].flatMap((scope) => [
288
+ {
289
+ id: "workflow.catalog.refresh",
290
+ scope,
291
+ basePath: API_BASE_PATH,
292
+ path: "/catalog",
293
+ method: "GET",
294
+ authentication: OWNER_AUTHENTICATION,
295
+ description: "Refresh launchable definitions from the mounting runtime filesystem.",
296
+ responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(WorkflowCatalogSchema)
297
+ },
138
298
  {
139
299
  id: "workflow.screen",
140
300
  scope,
141
- basePath: "workflow",
301
+ basePath: API_BASE_PATH,
142
302
  path: `${root}/screen/stream`,
143
303
  method: "GET",
144
- authentication: "owner",
304
+ authentication: OWNER_AUTHENTICATION,
145
305
  description: "Follow the workflow terminal.",
146
306
  responses: {
147
307
  "200": {
@@ -159,10 +319,10 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
159
319
  {
160
320
  id: "workflow.control",
161
321
  scope,
162
- basePath: "workflow",
322
+ basePath: API_BASE_PATH,
163
323
  path: `${root}/control`,
164
324
  method: "POST",
165
- authentication: "owner",
325
+ authentication: OWNER_AUTHENTICATION,
166
326
  description: "Take or release the keyboard.",
167
327
  body: {
168
328
  required: true,
@@ -183,10 +343,10 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
183
343
  {
184
344
  id: "workflow.keys",
185
345
  scope,
186
- basePath: "workflow",
346
+ basePath: API_BASE_PATH,
187
347
  path: `${root}/keys`,
188
348
  method: "POST",
189
- authentication: "owner",
349
+ authentication: OWNER_AUTHENTICATION,
190
350
  description: "Write terminal data with the control token.",
191
351
  body: {
192
352
  required: true,
@@ -211,10 +371,10 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
211
371
  {
212
372
  id: "workflow.resize",
213
373
  scope,
214
- basePath: "workflow",
374
+ basePath: API_BASE_PATH,
215
375
  path: `${root}/resize`,
216
376
  method: "POST",
217
- authentication: "owner",
377
+ authentication: OWNER_AUTHENTICATION,
218
378
  description: "Resize the terminal.",
219
379
  body: {
220
380
  required: true,
@@ -230,20 +390,20 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
230
390
  {
231
391
  id: "workflow.delete",
232
392
  scope,
233
- basePath: "workflow",
393
+ basePath: API_BASE_PATH,
234
394
  path: root,
235
395
  method: "DELETE",
236
- authentication: "owner",
396
+ authentication: OWNER_AUTHENTICATION,
237
397
  description: "Delete a settled run and its directory.",
238
398
  responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ deleted: typebox.Type.Literal(true) }))
239
399
  },
240
400
  {
241
401
  id: "workflow.openRunDirectory",
242
402
  scope,
243
- basePath: "workflow",
403
+ basePath: API_BASE_PATH,
244
404
  path: `${root}/open-directory`,
245
405
  method: "POST",
246
- authentication: "owner",
406
+ authentication: OWNER_AUTHENTICATION,
247
407
  description: "Open the registered run folder in Finder. Local callers only.",
248
408
  responses: {
249
409
  ...(0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({ opened: typebox.Type.Literal(true) })),
@@ -260,10 +420,10 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
260
420
  {
261
421
  id: "workflow.artifacts",
262
422
  scope,
263
- basePath: "workflow",
423
+ basePath: API_BASE_PATH,
264
424
  path: `${root}/artifacts`,
265
425
  method: "GET",
266
- authentication: "owner",
426
+ authentication: OWNER_AUTHENTICATION,
267
427
  description: "List declared and discovered artifacts, or immediate children of a directory.",
268
428
  parameters: [{
269
429
  name: "directory",
@@ -291,10 +451,10 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
291
451
  {
292
452
  id: "workflow.artifact",
293
453
  scope,
294
- basePath: "workflow",
454
+ basePath: API_BASE_PATH,
295
455
  path: `${root}/artifacts/{name}`,
296
456
  method: "GET",
297
- authentication: "owner",
457
+ authentication: OWNER_AUTHENTICATION,
298
458
  description: "Read artifact metadata and text. name may contain nested path segments. raw=1 streams binary with its media type and supports byte ranges.",
299
459
  parameters: [
300
460
  {
@@ -334,25 +494,38 @@ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
334
494
  }
335
495
  }
336
496
  ]),
337
- sockets: ["global", "workspace"].flatMap((scope) => [{
338
- id: "workflow.runs",
339
- scope,
340
- service: "po.hub.v1",
341
- member: "workflow_runs",
342
- kind: "channel",
343
- direction: "server-to-client",
344
- description: "Workflow runs channel payload.",
345
- input: WorkflowRunsSchema
346
- }, {
347
- id: "workflow.catalog",
348
- scope,
349
- service: "po.hub.v1",
350
- member: "workflow_catalog",
351
- kind: "channel",
352
- direction: "server-to-client",
353
- description: "Workflow catalog channel payload.",
354
- input: WorkflowCatalogSchema
355
- }])
497
+ sockets: ["host", "workspace"].flatMap((scope) => [
498
+ {
499
+ id: "workflow.runs",
500
+ scope,
501
+ service: "po.hub",
502
+ member: "workflow_runs",
503
+ kind: "channel",
504
+ direction: "server-to-client",
505
+ description: "Workflow runs channel payload.",
506
+ input: WorkflowRunsSchema
507
+ },
508
+ {
509
+ id: "workflow.catalog",
510
+ scope,
511
+ service: "po.hub",
512
+ member: "workflow_catalog",
513
+ kind: "channel",
514
+ direction: "server-to-client",
515
+ description: "Workflow catalog channel payload.",
516
+ input: WorkflowCatalogSchema
517
+ },
518
+ {
519
+ id: "dynamic-workflow.runs",
520
+ scope,
521
+ service: "po.hub",
522
+ member: "dynamic_workflow_runs",
523
+ kind: "channel",
524
+ direction: "server-to-client",
525
+ description: "Tracked workflow state for one session, without callback source or input/output data.",
526
+ input: DynamicWorkflowSnapshotSchema
527
+ }
528
+ ])
356
529
  });
357
530
  //#endregion
358
531
  exports.apiContracts = apiContracts;
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses, type DoomHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst values = <T extends string>(items: T[]) => Type.Union(items.map((item) => Type.Literal(item)));\nconst Progress = values(['running', 'completed', 'skipped', 'failed', 'pause_requested', 'paused', 'resumed']);\nconst Step = { name: S, status: Progress, reason: O(S), group: O(S), startedAt: O(S), endedAt: O(S) };\nconst Run = Type.Object({\n runKey: S,\n workspace: S,\n displayName: S,\n workflowName: O(S),\n workflowPath: S,\n stage: values(['running', 'completed', 'error']),\n outcome: O(values(['success', 'skipped', 'failed', 'interrupted'])),\n executionState: O(values(['running', 'pause_requested', 'paused', 'resume_requested'])),\n prompt: O(S),\n startedAt: S,\n finishedAt: O(S),\n errorMessage: O(S),\n failedJob: O(S),\n stale: O(B),\n staleReason: O(S),\n worktreeBranch: O(S),\n position: O(Type.Object({ job: S, step: O(S), index: O(N), total: O(N) })),\n jobs: Type.Array(\n Type.Object({\n ...Step,\n phase: values(['pre', 'job', 'post']),\n index: O(N),\n total: O(N),\n steps: Type.Array(Type.Object(Step)),\n }),\n ),\n});\nexport const WorkflowRunsSchema = Type.Object({ runs: Type.Array(Run) });\nconst Artifact = { path: S, kind: values(['file', 'directory']), description: S, producedBy: Type.Array(S) };\nexport const WorkflowCatalogSchema = Type.Object({\n cwd: S,\n warning: O(S),\n workflows: Type.Array(\n Type.Object({\n path: S,\n relativePath: S,\n name: S,\n description: S,\n tags: Type.Array(S),\n triggers: Type.Array(S),\n inputs: Type.Array(\n Type.Object({\n name: S,\n description: O(S),\n required: O(B),\n default: O(S),\n type: O(S),\n options: O(Type.Array(S)),\n }),\n ),\n jobs: Type.Array(Type.Object({ name: S, steps: Type.Array(S) })),\n artifacts: Type.Array(Type.Object(Artifact)),\n runners: O(Type.Array(S)),\n commands: O(Type.Array(S)),\n choices: O(Type.Array(S)),\n error: O(S),\n }),\n ),\n});\nconst Screen = Type.Object({\n lines: Type.Array(S),\n capabilities: Type.Object({ readable: B, writable: B, resizable: B, reason: O(S) }),\n ended: O(B),\n});\nconst Control = Type.Object({ held: B, token: O(S), reason: O(S) });\nconst root = '/runs/{workspace}/{runKey}';\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: (['global', 'workspace', 'session'] as const).flatMap((scope): DoomHttpContract[] => [\n {\n id: 'workflow.screen',\n scope,\n basePath: 'workflow',\n path: `${root}/screen/stream`,\n method: 'GET',\n authentication: 'owner',\n description: 'Follow the workflow terminal.',\n responses: {\n '200': {\n description: 'SSE stream with JSON screen events.',\n contentType: 'text/event-stream',\n schema: S,\n events: { screen: Screen },\n },\n '404': { description: 'Run unavailable.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.control',\n scope,\n basePath: 'workflow',\n path: `${root}/control`,\n method: 'POST',\n authentication: 'owner',\n description: 'Take or release the keyboard.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ release: O(B), token: O(S) }) },\n responses: { ...jsonApiResponses(Control), '409': { description: 'Keyboard unavailable.', schema: Control } },\n },\n {\n id: 'workflow.keys',\n scope,\n basePath: 'workflow',\n path: `${root}/keys`,\n method: 'POST',\n authentication: 'owner',\n description: 'Write terminal data with the control token.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ token: S, data: S }) },\n responses: {\n '204': { description: 'Data written.' },\n '400': { description: 'Invalid request.', schema: Type.Object({ error: S }) },\n '409': { description: 'Write refused.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.resize',\n scope,\n basePath: 'workflow',\n path: `${root}/resize`,\n method: 'POST',\n authentication: 'owner',\n description: 'Resize the terminal.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ token: S, columns: N, rows: N }) },\n responses: jsonApiResponses(Type.Object({ resized: B })),\n },\n {\n id: 'workflow.delete',\n scope,\n basePath: 'workflow',\n path: root,\n method: 'DELETE',\n authentication: 'owner',\n description: 'Delete a settled run and its directory.',\n responses: jsonApiResponses(Type.Object({ deleted: Type.Literal(true) })),\n },\n {\n id: 'workflow.openRunDirectory',\n scope,\n basePath: 'workflow',\n path: `${root}/open-directory`,\n method: 'POST',\n authentication: 'owner',\n description: 'Open the registered run folder in Finder. Local callers only.',\n responses: {\n ...jsonApiResponses(Type.Object({ opened: Type.Literal(true) })),\n '403': { description: 'Local caller required.', schema: Type.Object({ error: S }) },\n '409': { description: 'Folder opening unavailable.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.artifacts',\n scope,\n basePath: 'workflow',\n path: `${root}/artifacts`,\n method: 'GET',\n authentication: 'owner',\n description: 'List declared and discovered artifacts, or immediate children of a directory.',\n parameters: [{ name: 'directory', in: 'query', required: false, schema: S }],\n responses: jsonApiResponses(\n Type.Object({\n runDir: S,\n description: S,\n artifacts: Type.Array(\n Type.Object({\n ...Artifact,\n declared: B,\n state: values(['written', 'empty', 'pending', 'unreadable']),\n size: O(N),\n modifiedAt: O(S),\n }),\n ),\n }),\n ),\n },\n {\n id: 'workflow.artifact',\n scope,\n basePath: 'workflow',\n path: `${root}/artifacts/{name}`,\n method: 'GET',\n authentication: 'owner',\n description:\n 'Read artifact metadata and text. name may contain nested path segments. raw=1 streams binary with its media type and supports byte ranges.',\n parameters: [\n { name: 'raw', in: 'query', required: false, schema: values(['0', '1']) },\n { name: 'download', in: 'query', required: false, schema: values(['0', '1']) },\n { name: 'range', in: 'header', required: false, schema: S },\n ],\n responses: {\n ...jsonApiResponses(\n Type.Union([Type.Object({ path: S, size: N, modifiedAt: S, mimeType: O(S), text: O(S), truncated: B }), S]),\n ),\n '206': { description: 'Partial raw bytes.', contentType: 'application/octet-stream', schema: S },\n '416': { description: 'Unsatisfiable byte range.' },\n },\n },\n ]),\n sockets: (['global', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'workflow.runs',\n scope,\n service: 'po.hub.v1',\n member: 'workflow_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Workflow runs channel payload.',\n input: WorkflowRunsSchema,\n },\n {\n id: 'workflow.catalog',\n scope,\n service: 'po.hub.v1',\n member: 'workflow_catalog',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Workflow catalog channel payload.',\n input: WorkflowCatalogSchema,\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,QAAQ;AACvB,MAAM,IAAIA,QAAAA,KAAK;AACf,MAAM,UAA4B,UAAeA,QAAAA,KAAK,MAAM,MAAM,KAAK,SAASA,QAAAA,KAAK,QAAQ,IAAI,CAAC,CAAC;AAEnG,MAAM,OAAO;CAAE,MAAM;CAAG,QADP,OAAO;EAAC;EAAW;EAAa;EAAW;EAAU;EAAmB;EAAU;CAAS,CACrE;CAAG,QAAQ,EAAE,CAAC;CAAG,OAAO,EAAE,CAAC;CAAG,WAAW,EAAE,CAAC;CAAG,SAAS,EAAE,CAAC;AAAE;AACpG,MAAM,MAAMA,QAAAA,KAAK,OAAO;CACtB,QAAQ;CACR,WAAW;CACX,aAAa;CACb,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V;KAAE,MAAM;KAAO,IAAI;KAAS,UAAU;KAAO,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC;IAAE;IACxE;KAAE,MAAM;KAAY,IAAI;KAAS,UAAU;KAAO,QAAQ,OAAO,CAAC,KAAK,GAAG,CAAC;IAAE;IAC7E;KAAE,MAAM;KAAS,IAAI;KAAU,UAAU;KAAO,QAAQ;IAAE;GAC5D;GACA,WAAW;IACT,IAAA,GAAGE,gCAAAA,iBAAAA,CACDF,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,OAAO;KAAE,MAAM;KAAG,MAAM;KAAG,YAAY;KAAG,UAAU,EAAE,CAAC;KAAG,MAAM,EAAE,CAAC;KAAG,WAAW;IAAE,CAAC,GAAG,CAAC,CAAC,CAC5G;IACA,OAAO;KAAE,aAAa;KAAsB,aAAa;KAA4B,QAAQ;IAAE;IAC/F,OAAO,EAAE,aAAa,4BAA4B;GACpD;EACF;CACF,CAAC;CACD,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,SAAS,UAAU,CAC7D;EACE,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,GACA;EACE,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,CACF,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"apiContracts.cjs","names":["Type","Type","defineApiContract","jsonApiResponses"],"sources":["../src/schemas/dynamicWorkflowSnapshot.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["import { Type } from 'typebox';\n\nconst state = Type.Union(\n ['pending', 'running', 'completed', 'failed', 'stopped', 'skipped'].map((value) => Type.Literal(value)),\n);\nconst time = Type.Optional(Type.Number());\nconst phase = Type.Object({\n key: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: time,\n finishedAt: time,\n error: Type.Optional(Type.String()),\n agents: Type.Array(\n Type.Object({\n runId: Type.String(),\n status: Type.Union(['running', 'completed', 'failed', 'stopped'].map((value) => Type.Literal(value))),\n }),\n ),\n});\nconst shape = Type.Object({\n key: Type.String(),\n label: Type.String(),\n kind: Type.Union(['step', 'sequence', 'parallel', 'branch', 'foreach'].map((value) => Type.Literal(value))),\n children: Type.Array(Type.Ref('#/$defs/Shape')),\n});\nexport const DynamicWorkflowSnapshotSchema = Type.Object(\n {\n version: Type.Literal(1),\n revision: Type.Number(),\n sessionId: Type.String(),\n runs: Type.Array(\n Type.Object({\n key: Type.String(),\n workflowId: Type.String(),\n label: Type.String(),\n status: state,\n executionStatus: state,\n startedAt: Type.Number(),\n finishedAt: time,\n error: Type.Optional(Type.String()),\n shape: Type.Ref('#/$defs/Shape'),\n groups: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n concurrency: Type.Optional(Type.Number()),\n total: Type.Number(),\n truncated: Type.Boolean(),\n counts: Type.Object({\n pending: Type.Number(),\n running: Type.Number(),\n completed: Type.Number(),\n failed: Type.Number(),\n stopped: Type.Number(),\n skipped: Type.Number(),\n }),\n items: Type.Array(\n Type.Object({\n key: Type.String(),\n label: Type.String(),\n index: Type.Number(),\n status: state,\n phases: Type.Array(phase),\n }),\n ),\n }),\n ),\n }),\n ),\n },\n { $defs: { Shape: shape } },\n);\n","import { defineApiContract, jsonApiResponses, type PoHttpContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nimport { DynamicWorkflowSnapshotSchema } from './dynamicWorkflowSnapshot';\n\nconst API_BASE_PATH = 'workflow';\nconst OWNER_AUTHENTICATION = 'owner';\nconst S = Type.String();\nconst N = Type.Number();\nconst B = Type.Boolean();\nconst O = Type.Optional;\nconst values = <T extends string>(items: T[]) => Type.Union(items.map((item) => Type.Literal(item)));\nconst Progress = values(['running', 'completed', 'skipped', 'failed', 'pause_requested', 'paused', 'resumed']);\nconst Step = { name: S, status: Progress, reason: O(S), group: O(S), startedAt: O(S), endedAt: O(S) };\nconst Usage = Type.Object({\n tokens: O(Type.Object({ input: N, output: N, cacheRead: N, cacheWrite: N, total: N })),\n costUsd: O(N),\n toolCount: O(N),\n});\nconst Children = Type.Array(\n Type.Object({\n lead: S,\n continuations: N,\n maxContinuations: N,\n criteria: Type.Array(\n Type.Object({\n key: S,\n description: S,\n verifiedBy: S,\n status: values(['unchecked', 'checked', 'not-met']),\n feedback: O(S),\n invocationId: O(S),\n }),\n ),\n invocations: Type.Array(\n Type.Object({\n invocationId: S,\n job: S,\n state: values(['running', 'completed', 'failed', 'interrupted']),\n sessionIds: Type.Array(S),\n startedAt: S,\n endedAt: O(S),\n error: O(S),\n usage: O(Usage),\n }),\n ),\n }),\n);\nconst Run = Type.Object({\n runKey: S,\n routeKey: O(S),\n runId: O(S),\n ownerSessionId: O(S),\n launcherSessionId: O(S),\n workspace: S,\n displayName: S,\n workflowName: O(S),\n workflowPath: S,\n stage: values(['running', 'completed', 'error']),\n outcome: O(values(['success', 'skipped', 'failed', 'interrupted'])),\n executionState: O(values(['running', 'pause_requested', 'paused', 'resume_requested'])),\n prompt: O(S),\n startedAt: S,\n finishedAt: O(S),\n errorMessage: O(S),\n failedJob: O(S),\n waiting: O(Type.Literal(true)),\n stale: O(B),\n staleReason: O(S),\n worktreeBranch: O(S),\n position: O(Type.Object({ job: S, step: O(S), index: O(N), total: O(N) })),\n children: O(Children),\n childUsage: O(\n Type.Object({\n complete: B,\n invocationCount: N,\n tokensKnown: N,\n costKnown: N,\n toolCountKnown: N,\n tokens: O(Type.Object({ input: N, output: N, cacheRead: N, cacheWrite: N, total: N })),\n costUsd: O(N),\n toolCount: O(N),\n }),\n ),\n childStatusErrors: O(Type.Array(Type.Object({ lead: O(S), message: S }))),\n jobs: Type.Array(\n Type.Object({\n ...Step,\n phase: values(['pre', 'job', 'post']),\n index: O(N),\n total: O(N),\n steps: Type.Array(Type.Object(Step)),\n }),\n ),\n});\nexport const WorkflowRunsSchema = Type.Object({ runs: Type.Array(Run) });\nconst Artifact = { path: S, kind: values(['file', 'directory']), description: S, producedBy: Type.Array(S) };\nexport const WorkflowCatalogSchema = Type.Object({\n cwd: S,\n warning: O(S),\n workflows: Type.Array(\n Type.Object({\n path: S,\n relativePath: S,\n name: S,\n description: S,\n tags: Type.Array(S),\n triggers: Type.Array(S),\n inputs: Type.Array(\n Type.Object({\n name: S,\n description: O(S),\n required: O(B),\n default: O(S),\n type: O(S),\n options: O(Type.Array(S)),\n }),\n ),\n jobs: Type.Array(Type.Object({ name: S, steps: Type.Array(S) })),\n artifacts: Type.Array(Type.Object(Artifact)),\n runners: O(Type.Array(S)),\n commands: O(Type.Array(S)),\n choices: O(Type.Array(S)),\n error: O(S),\n }),\n ),\n});\nconst Screen = Type.Object({\n lines: Type.Array(S),\n capabilities: Type.Object({ readable: B, writable: B, resizable: B, reason: O(S) }),\n ended: O(B),\n});\nconst Control = Type.Object({ held: B, token: O(S), reason: O(S) });\nconst root = '/runs/{workspace}/{runKey}';\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: (['host', 'workspace', 'session'] as const).flatMap((scope): PoHttpContract[] => [\n {\n id: 'workflow.catalog.refresh',\n scope,\n basePath: API_BASE_PATH,\n path: '/catalog',\n method: 'GET',\n authentication: OWNER_AUTHENTICATION,\n description: 'Refresh launchable definitions from the mounting runtime filesystem.',\n responses: jsonApiResponses(WorkflowCatalogSchema),\n },\n {\n id: 'workflow.screen',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/screen/stream`,\n method: 'GET',\n authentication: OWNER_AUTHENTICATION,\n description: 'Follow the workflow terminal.',\n responses: {\n '200': {\n description: 'SSE stream with JSON screen events.',\n contentType: 'text/event-stream',\n schema: S,\n events: { screen: Screen },\n },\n '404': { description: 'Run unavailable.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.control',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/control`,\n method: 'POST',\n authentication: OWNER_AUTHENTICATION,\n description: 'Take or release the keyboard.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ release: O(B), token: O(S) }) },\n responses: { ...jsonApiResponses(Control), '409': { description: 'Keyboard unavailable.', schema: Control } },\n },\n {\n id: 'workflow.keys',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/keys`,\n method: 'POST',\n authentication: OWNER_AUTHENTICATION,\n description: 'Write terminal data with the control token.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ token: S, data: S }) },\n responses: {\n '204': { description: 'Data written.' },\n '400': { description: 'Invalid request.', schema: Type.Object({ error: S }) },\n '409': { description: 'Write refused.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.resize',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/resize`,\n method: 'POST',\n authentication: OWNER_AUTHENTICATION,\n description: 'Resize the terminal.',\n body: { required: true, contentType: 'application/json', schema: Type.Object({ token: S, columns: N, rows: N }) },\n responses: jsonApiResponses(Type.Object({ resized: B })),\n },\n {\n id: 'workflow.delete',\n scope,\n basePath: API_BASE_PATH,\n path: root,\n method: 'DELETE',\n authentication: OWNER_AUTHENTICATION,\n description: 'Delete a settled run and its directory.',\n responses: jsonApiResponses(Type.Object({ deleted: Type.Literal(true) })),\n },\n {\n id: 'workflow.openRunDirectory',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/open-directory`,\n method: 'POST',\n authentication: OWNER_AUTHENTICATION,\n description: 'Open the registered run folder in Finder. Local callers only.',\n responses: {\n ...jsonApiResponses(Type.Object({ opened: Type.Literal(true) })),\n '403': { description: 'Local caller required.', schema: Type.Object({ error: S }) },\n '409': { description: 'Folder opening unavailable.', schema: Type.Object({ error: S }) },\n },\n },\n {\n id: 'workflow.artifacts',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/artifacts`,\n method: 'GET',\n authentication: OWNER_AUTHENTICATION,\n description: 'List declared and discovered artifacts, or immediate children of a directory.',\n parameters: [{ name: 'directory', in: 'query', required: false, schema: S }],\n responses: jsonApiResponses(\n Type.Object({\n runDir: S,\n description: S,\n artifacts: Type.Array(\n Type.Object({\n ...Artifact,\n declared: B,\n state: values(['written', 'empty', 'pending', 'unreadable']),\n size: O(N),\n modifiedAt: O(S),\n }),\n ),\n }),\n ),\n },\n {\n id: 'workflow.artifact',\n scope,\n basePath: API_BASE_PATH,\n path: `${root}/artifacts/{name}`,\n method: 'GET',\n authentication: OWNER_AUTHENTICATION,\n description:\n 'Read artifact metadata and text. name may contain nested path segments. raw=1 streams binary with its media type and supports byte ranges.',\n parameters: [\n { name: 'raw', in: 'query', required: false, schema: values(['0', '1']) },\n { name: 'download', in: 'query', required: false, schema: values(['0', '1']) },\n { name: 'range', in: 'header', required: false, schema: S },\n ],\n responses: {\n ...jsonApiResponses(\n Type.Union([Type.Object({ path: S, size: N, modifiedAt: S, mimeType: O(S), text: O(S), truncated: B }), S]),\n ),\n '206': { description: 'Partial raw bytes.', contentType: 'application/octet-stream', schema: S },\n '416': { description: 'Unsatisfiable byte range.' },\n },\n },\n ]),\n sockets: (['host', 'workspace'] as const).flatMap((scope) => [\n {\n id: 'workflow.runs',\n scope,\n service: 'po.hub',\n member: 'workflow_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Workflow runs channel payload.',\n input: WorkflowRunsSchema,\n },\n {\n id: 'workflow.catalog',\n scope,\n service: 'po.hub',\n member: 'workflow_catalog',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Workflow catalog channel payload.',\n input: WorkflowCatalogSchema,\n },\n {\n id: 'dynamic-workflow.runs',\n scope,\n service: 'po.hub',\n member: 'dynamic_workflow_runs',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Tracked workflow state for one session, without callback source or input/output data.',\n input: DynamicWorkflowSnapshotSchema,\n },\n ]),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAEA,MAAM,QAAQA,QAAAA,KAAK,MACjB;CAAC;CAAW;CAAW;CAAa;CAAU;CAAW;AAAS,CAAC,CAAC,KAAK,UAAUA,QAAAA,KAAK,QAAQ,KAAK,CAAC,CACxG;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R,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;EACA;GACE,IAAI;GACJ;GACA,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;CACF,CAAC;AACH,CAAC"}
@@ -6,7 +6,7 @@ export declare const apiContracts: {
6
6
  schemas?: Record<string, boolean | object> | undefined;
7
7
  http: {
8
8
  id: string;
9
- scope: "global" | "session" | "workspace";
9
+ scope: "host" | "session" | "workspace";
10
10
  basePath?: string | undefined;
11
11
  path: string;
12
12
  method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
@@ -34,7 +34,7 @@ export declare const apiContracts: {
34
34
  }[];
35
35
  sockets: {
36
36
  id: string;
37
- scope: "global" | "session" | "workspace";
37
+ scope: "host" | "session" | "workspace";
38
38
  description: string;
39
39
  availability?: string | undefined;
40
40
  service: string;
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBA6Ea"}
1
+ {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAsIa"}