@crewx/sdk 0.9.0-rc.41 → 0.9.0-rc.43

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.
package/dist/paths.d.ts CHANGED
@@ -3,3 +3,4 @@ export declare function resolveDefaultAgentsYaml(): {
3
3
  yamlPath: string;
4
4
  dir: string;
5
5
  };
6
+ export declare function resolveWorkflowTemplatesPath(override?: string): string;
@@ -0,0 +1,48 @@
1
+ export type WiStatus = 'draft' | 'approved' | 'in-progress' | 'done' | 'cancelled';
2
+ export interface WiCreateInput {
3
+ title: string;
4
+ assignee?: string;
5
+ body?: string;
6
+ board?: string;
7
+ source?: string;
8
+ depends_on?: string[];
9
+ }
10
+ export interface WiBatchCreateInput {
11
+ board: string;
12
+ source?: string;
13
+ items: Array<{
14
+ key?: string;
15
+ title: string;
16
+ assignee?: string;
17
+ depends_on?: string[];
18
+ body: string;
19
+ }>;
20
+ }
21
+ export interface WiCreatedSummary {
22
+ wi_id: string;
23
+ title: string;
24
+ status: WiStatus;
25
+ priority?: string;
26
+ assignee?: string;
27
+ depends_on: string[];
28
+ blocks: string[];
29
+ date?: string;
30
+ board?: string;
31
+ source: string;
32
+ screens: string[];
33
+ path: string;
34
+ mtime: number;
35
+ }
36
+ export interface WiCreatedDetail {
37
+ summary: WiCreatedSummary;
38
+ frontmatter: Record<string, unknown>;
39
+ body: string;
40
+ }
41
+ export interface WiBatchCreateResult {
42
+ created: WiCreatedDetail[];
43
+ }
44
+ export declare class WiCreateError extends Error {
45
+ constructor(message: string);
46
+ }
47
+ export declare function createWorkInstruction(workspacePath: string, input: WiCreateInput): Promise<WiCreatedDetail>;
48
+ export declare function createWorkInstructionBatch(workspacePath: string, input: WiBatchCreateInput): Promise<WiBatchCreateResult>;
@@ -0,0 +1,20 @@
1
+ export type WiSelectableStatus = 'draft' | 'approved' | 'in-progress' | 'done' | 'cancelled';
2
+ export interface WiSummary {
3
+ wi_id: string;
4
+ status: WiSelectableStatus;
5
+ depends_on?: string[];
6
+ }
7
+ export type SelectNextWiResult = {
8
+ pick: string;
9
+ } | {
10
+ blocked: true;
11
+ reason: string;
12
+ } | {
13
+ cycle: string[];
14
+ } | {
15
+ done: true;
16
+ };
17
+ export declare function selectNextWi(wis: WiSummary[], opts: {
18
+ batch: string[];
19
+ exclude?: string[];
20
+ }): SelectNextWiResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/sdk",
3
- "version": "0.9.0-rc.41",
3
+ "version": "0.9.0-rc.43",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"
@@ -50,6 +50,11 @@
50
50
  "import": "./dist/repository/index.js",
51
51
  "require": "./dist/repository/index.js"
52
52
  },
53
+ "./desktop": {
54
+ "types": "./dist/desktop/index.d.ts",
55
+ "import": "./dist/desktop/index.js",
56
+ "require": "./dist/desktop/index.js"
57
+ },
53
58
  "./package.json": "./package.json"
54
59
  },
55
60
  "browser": {
@@ -60,7 +65,9 @@
60
65
  "./dist/layout/loader.js": false,
61
66
  "./dist/esm/layout/loader.js": false,
62
67
  "./dist/repository/index.js": false,
63
- "./dist/esm/repository/index.js": false
68
+ "./dist/esm/repository/index.js": false,
69
+ "./dist/desktop/index.js": false,
70
+ "./dist/esm/desktop/index.js": false
64
71
  },
65
72
  "files": [
66
73
  "dist",
@@ -0,0 +1,65 @@
1
+ # workflows/wi-default-flow.yaml
2
+ workflows:
3
+ wi-default-flow:
4
+ metadata:
5
+ name: "WI Default Loop"
6
+ description: "Default flow for running a WI on a work board (min: human verify)"
7
+
8
+ state:
9
+ wi_id: ""
10
+ wi_content: ""
11
+ assignee: ""
12
+ execute_result: ""
13
+
14
+ nodes:
15
+ start_gate:
16
+ type: approval
17
+ description: "Approve before starting the WI"
18
+ assignee: "@crewx_pm"
19
+ on_approve: execute
20
+ on_reject: done
21
+ ui:
22
+ label: "Start"
23
+
24
+ execute:
25
+ type: agent_task
26
+ description: "Run the WI with the assigned agent"
27
+ agent: "{{assignee}}"
28
+ mode: execute
29
+ input: |
30
+ Run this WI.
31
+ WI ID: {{wi_id}}
32
+ Instruction:
33
+ {{wi_content}}
34
+ After finishing, summarize changed files, verify results, remaining issues.
35
+ output: execute_result
36
+ next: accept_gate
37
+ ui:
38
+ label: "Execute"
39
+
40
+ accept_gate:
41
+ type: approval
42
+ description: "Review and accept the WI result (human verify)"
43
+ assignee: "@crewx_pm"
44
+ on_approve: cleanup
45
+ on_reject: execute
46
+ ui:
47
+ label: "Review"
48
+
49
+ cleanup:
50
+ type: agent_task
51
+ description: "Mark the WI done and clean up handoff items"
52
+ agent: crewx
53
+ mode: execute
54
+ input: |
55
+ Complete WI {{wi_id}}: mark done, record memory if needed, commit,
56
+ report worktree/branch cleanup needs.
57
+ next: done
58
+ ui:
59
+ label: "Complete"
60
+
61
+ done:
62
+ type: end
63
+ description: "The WI loop is done"
64
+ ui:
65
+ label: "Done"
@@ -0,0 +1,140 @@
1
+ workflows:
2
+ wi-plan-flow:
3
+ metadata:
4
+ name: "WI Plan Flow"
5
+ description: "Turn a one-line board goal into a gated batch of draft WIs."
6
+ timeout: 1800
7
+ max_iterations: 8
8
+ state:
9
+ board_id: ""
10
+ goal: ""
11
+ source: "manual"
12
+ research_notes: ""
13
+ plan_batch: {}
14
+ materialize_result: {}
15
+ plan_feedback: ""
16
+ cancelled_items: []
17
+ nodes:
18
+ research:
19
+ type: agent_task
20
+ agent: planner
21
+ mode: query
22
+ input: |
23
+ Research the board goal and constraints before planning WIs.
24
+
25
+ Board: {{board_id}}
26
+ Goal: {{goal}}
27
+ Source: {{source}}
28
+
29
+ Previously cancelled draft items that must not be suggested again:
30
+ {{cancelled_items}}
31
+ output: research_notes
32
+ next: draft_plan
33
+
34
+ draft_plan:
35
+ type: agent_task
36
+ agent: planner
37
+ mode: query
38
+ input: |
39
+ Produce JSON only. Do not create files.
40
+
41
+ Board: {{board_id}}
42
+ Goal: {{goal}}
43
+ Source: {{source}}
44
+ Research:
45
+ {{research_notes}}
46
+
47
+ Rejection feedback from the previous gate, if any:
48
+ {{plan_feedback}}
49
+
50
+ Avoid re-suggesting cancelled draft items:
51
+ {{cancelled_items}}
52
+
53
+ Give every item a short unique "key" (e.g. "c1", "c2") — WI ids do
54
+ not exist yet at plan time, so cross-item dependencies must
55
+ reference the depending-on item's "key", never a WI id.
56
+
57
+ Required JSON shape:
58
+ {
59
+ "board": "{{board_id}}",
60
+ "source": "{{source}}",
61
+ "count": 2,
62
+ "titles": ["..."],
63
+ "change_note": "required when plan_feedback is non-empty",
64
+ "alternatives": ["..."],
65
+ "items": [
66
+ { "key": "c1", "title": "...", "assignee": "developer", "depends_on": [], "body": "..." },
67
+ { "key": "c2", "title": "...", "assignee": "developer", "depends_on": ["c1"], "body": "..." }
68
+ ]
69
+ }
70
+ output: plan_batch
71
+ output_format: json
72
+ output_schema:
73
+ type: object
74
+ required: [board, count, titles, alternatives, items]
75
+ properties:
76
+ board:
77
+ type: string
78
+ source:
79
+ type: string
80
+ count:
81
+ type: number
82
+ titles:
83
+ type: array
84
+ items:
85
+ type: string
86
+ change_note:
87
+ type: string
88
+ alternatives:
89
+ type: array
90
+ minItems: 1
91
+ items:
92
+ type: string
93
+ items:
94
+ type: array
95
+ minItems: 1
96
+ items:
97
+ type: object
98
+ required: [key, title, body]
99
+ properties:
100
+ key:
101
+ type: string
102
+ description: "Short unique local id (e.g. c1). Referenced by other items' depends_on — not a WI id."
103
+ title:
104
+ type: string
105
+ assignee:
106
+ type: string
107
+ depends_on:
108
+ type: array
109
+ items:
110
+ type: string
111
+ description: "References to other items' key, not WI ids."
112
+ body:
113
+ type: string
114
+ next: plan_gate
115
+
116
+ plan_gate:
117
+ type: approval
118
+ description: |
119
+ Review the draft WI batch.
120
+
121
+ Count/titles/change note preview:
122
+ {{plan_batch}}
123
+
124
+ Approve to create draft WI files. Reject with a reason to revise the plan.
125
+ assignee: "@crewx_pm"
126
+ on_approve: materialize
127
+ on_reject: draft_plan
128
+
129
+ materialize:
130
+ type: skill_task
131
+ skill: wi
132
+ args: ["create-batch"]
133
+ stdin: "{{plan_batch}}"
134
+ output: materialize_result
135
+ output_format: json
136
+ next: done
137
+
138
+ done:
139
+ type: end
140
+ description: "Draft WI batch materialized."