@pixelml/agenticflow-cli 1.5.3 → 1.6.1

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.
@@ -1,30 +1,24 @@
1
1
  /**
2
- * Pure translator: CompanyBlueprint → MAS workforce graph (skeleton).
3
- *
4
- * Converts a Paperclip-era blueprint (agent role slots + starter tasks) into
5
- * a MINIMAL VALID AgenticFlow workforce graph that the user can then fill in
6
- * with real agents via the UI or follow-up CLI commands.
7
- *
8
- * Why a skeleton, not a full agent graph:
9
- * MAS `agent` nodes require a real `agent_id` (verified 400 on live attempt
10
- * 2026-04-14). The CLI cannot synthesize agents during init without either
11
- * creating real agent entities (heavyweight: N API calls, model/prompt picks)
12
- * or matching against marketplace templates (requires a search flow).
13
- * A skeleton avoids the chicken-and-egg: deploy succeeds, user knows exactly
14
- * what to wire next.
15
- *
16
- * What the skeleton contains:
17
- * - One `trigger` node carrying the full blueprint metadata (slots, tasks,
18
- * goal) so downstream tooling can materialize agents later.
19
- * - One `output` node that echoes the message from the triggering run.
20
- * - A `next_step` edge from trigger → output.
21
- *
22
- * What callers of this translator should then do:
23
- * 1. POST the workforce (metadata only).
24
- * 2. PUT the skeleton schema from this translator.
25
- * 3. Surface `next_steps` in the response telling the user:
26
- * "Open the UI, add one Agent node per slot in trigger.input.planned_agents,
27
- * connect them from the trigger, and publish."
2
+ * CompanyBlueprint → MAS workforce deploy.
3
+ *
4
+ * Two modes:
5
+ *
6
+ * 1. SKELETON (original, `blueprintToWorkforce`)
7
+ * Produces a minimal trigger+output graph with blueprint metadata on the
8
+ * trigger. User fills in agent nodes afterwards. Fast, no agent creation,
9
+ * safe for --dry-run.
10
+ *
11
+ * 2. FULL DEPLOY (new, `blueprintToAgentSpecs` + `buildAgentWiredGraph`)
12
+ * Produces agent-create specs AND a graph stub parameterised by
13
+ * {slotRole agentId}. Caller creates the agents, then feeds the map
14
+ * into `buildAgentWiredGraph` to produce a fully-wired graph ready for
15
+ * PUT /schema.
16
+ *
17
+ * The two-phase design exists because MAS `agent` nodes require a real
18
+ * `agent_id` (the backend 400s otherwise), so we can't one-shot the graph
19
+ * without first materialising agents. Splitting keeps the pure translator
20
+ * pure and leaves the side-effectful agent-creation to the CLI command which
21
+ * can handle error-rollback.
28
22
  */
29
23
  import type { CompanyBlueprint, AgentSlot } from "./company-blueprints.js";
30
24
  import type { WorkforceSchema } from "@pixelml/agenticflow-sdk";
@@ -48,4 +42,53 @@ export declare function blueprintToWorkforce(blueprint: CompanyBlueprint, option
48
42
  name?: string;
49
43
  description?: string;
50
44
  }): BlueprintTranslation;
45
+ /**
46
+ * Create-payload specification for one agent slot.
47
+ * Caller passes each to `client.agents.create()`, then maps the returned
48
+ * agent ids back into `buildAgentWiredGraph()`.
49
+ */
50
+ export interface AgentSpec {
51
+ /** Stable slot identifier (= slot.role) used as the map key. */
52
+ slotKey: string;
53
+ /** The body to POST to /v1/agents/. Includes project_id, name, tools, etc. */
54
+ body: Record<string, unknown>;
55
+ /** Reference to the source slot, for graph wiring + failure reporting. */
56
+ slot: AgentSlot;
57
+ }
58
+ /**
59
+ * Build N agent-create payloads from a blueprint. Each agent:
60
+ * - `name` prefixed with workforce name for identification
61
+ * - `system_prompt` derived from slot.title + slot.description + blueprint goal
62
+ * - `model` defaulted (overridable via options.model)
63
+ * - `tools: []` (user attaches MCPs/tools afterwards)
64
+ *
65
+ * `project_id` is REQUIRED — caller supplies from `af bootstrap > auth.project_id`.
66
+ */
67
+ export declare function blueprintToAgentSpecs(blueprint: CompanyBlueprint, options: {
68
+ projectId: string;
69
+ workforceName: string;
70
+ model?: string;
71
+ includeOptionalSlots?: boolean;
72
+ }): AgentSpec[];
73
+ /**
74
+ * Build a full workforce graph that references real agent_ids.
75
+ *
76
+ * Shape:
77
+ * trigger ──► coordinator_agent ──► worker_agent_1
78
+ * ├─► worker_agent_2
79
+ * ├─► worker_agent_3
80
+ * └─► output (from coordinator)
81
+ *
82
+ * The first non-optional slot (typically "ceo") becomes the coordinator.
83
+ * Coordinator receives the trigger event, and all other agents receive
84
+ * their handoff from the coordinator. `output` listens on the coordinator.
85
+ *
86
+ * `agentIdBySlot` MUST contain an id for every slot in `specs` — callers
87
+ * produce this map by creating agents and pairing the returned ids back
88
+ * with `spec.slotKey`.
89
+ */
90
+ export declare function buildAgentWiredGraph(blueprint: CompanyBlueprint, specs: AgentSpec[], agentIdBySlot: Record<string, string>): {
91
+ nodes: WorkforceSchema["nodes"][number][];
92
+ edges: WorkforceSchema["edges"][number][];
93
+ };
51
94
  //# sourceMappingURL=blueprint-to-workforce.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-to-workforce.d.ts","sourceRoot":"","sources":["../../src/cli/blueprint-to-workforce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1C,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1C,+EAA+E;IAC/E,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED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,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,0EAA0E;IAC1E,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,EAAE;IACP,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GACA,SAAS,EAAE,CAiBb;AAuBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC;IAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;CAAE,CAgF1F"}
@@ -1,30 +1,24 @@
1
1
  /**
2
- * Pure translator: CompanyBlueprint → MAS workforce graph (skeleton).
2
+ * CompanyBlueprint → MAS workforce deploy.
3
3
  *
4
- * Converts a Paperclip-era blueprint (agent role slots + starter tasks) into
5
- * a MINIMAL VALID AgenticFlow workforce graph that the user can then fill in
6
- * with real agents via the UI or follow-up CLI commands.
4
+ * Two modes:
7
5
  *
8
- * Why a skeleton, not a full agent graph:
9
- * MAS `agent` nodes require a real `agent_id` (verified 400 on live attempt
10
- * 2026-04-14). The CLI cannot synthesize agents during init without either
11
- * creating real agent entities (heavyweight: N API calls, model/prompt picks)
12
- * or matching against marketplace templates (requires a search flow).
13
- * A skeleton avoids the chicken-and-egg: deploy succeeds, user knows exactly
14
- * what to wire next.
6
+ * 1. SKELETON (original, `blueprintToWorkforce`)
7
+ * Produces a minimal trigger+output graph with blueprint metadata on the
8
+ * trigger. User fills in agent nodes afterwards. Fast, no agent creation,
9
+ * safe for --dry-run.
15
10
  *
16
- * What the skeleton contains:
17
- * - One `trigger` node carrying the full blueprint metadata (slots, tasks,
18
- * goal) so downstream tooling can materialize agents later.
19
- * - One `output` node that echoes the message from the triggering run.
20
- * - A `next_step` edge from trigger → output.
11
+ * 2. FULL DEPLOY (new, `blueprintToAgentSpecs` + `buildAgentWiredGraph`)
12
+ * Produces agent-create specs AND a graph stub parameterised by
13
+ * {slotRole agentId}. Caller creates the agents, then feeds the map
14
+ * into `buildAgentWiredGraph` to produce a fully-wired graph ready for
15
+ * PUT /schema.
21
16
  *
22
- * What callers of this translator should then do:
23
- * 1. POST the workforce (metadata only).
24
- * 2. PUT the skeleton schema from this translator.
25
- * 3. Surface `next_steps` in the response telling the user:
26
- * "Open the UI, add one Agent node per slot in trigger.input.planned_agents,
27
- * connect them from the trigger, and publish."
17
+ * The two-phase design exists because MAS `agent` nodes require a real
18
+ * `agent_id` (the backend 400s otherwise), so we can't one-shot the graph
19
+ * without first materialising agents. Splitting keeps the pure translator
20
+ * pure and leaves the side-effectful agent-creation to the CLI command which
21
+ * can handle error-rollback.
28
22
  */
29
23
  /** Stable, URL-safe node name for an AgentSlot. */
30
24
  export function slotToNodeName(slot) {
@@ -94,4 +88,143 @@ export function blueprintToWorkforce(blueprint, options = {}) {
94
88
  suggested_next_steps,
95
89
  };
96
90
  }
91
+ /**
92
+ * Build N agent-create payloads from a blueprint. Each agent:
93
+ * - `name` prefixed with workforce name for identification
94
+ * - `system_prompt` derived from slot.title + slot.description + blueprint goal
95
+ * - `model` defaulted (overridable via options.model)
96
+ * - `tools: []` (user attaches MCPs/tools afterwards)
97
+ *
98
+ * `project_id` is REQUIRED — caller supplies from `af bootstrap > auth.project_id`.
99
+ */
100
+ export function blueprintToAgentSpecs(blueprint, options) {
101
+ const model = options.model ?? "agenticflow/gemini-2.0-flash";
102
+ const slots = options.includeOptionalSlots
103
+ ? blueprint.agents
104
+ : blueprint.agents.filter((s) => !s.optional);
105
+ return slots.map((slot) => ({
106
+ slotKey: slot.role,
107
+ slot,
108
+ body: {
109
+ name: `${options.workforceName} — ${slot.title}`,
110
+ project_id: options.projectId,
111
+ tools: [],
112
+ model,
113
+ description: `${slot.role} for "${blueprint.name}" workforce`,
114
+ system_prompt: buildSystemPrompt(blueprint, slot),
115
+ },
116
+ }));
117
+ }
118
+ function buildSystemPrompt(blueprint, slot) {
119
+ return [
120
+ `You are the ${slot.title} for "${blueprint.name}".`,
121
+ ``,
122
+ `YOUR ROLE: ${slot.description}`,
123
+ ``,
124
+ `TEAM GOAL: ${blueprint.goal}`,
125
+ ``,
126
+ slot.suggestedTemplate
127
+ ? `REFERENCE: Behave like the AgenticFlow marketplace template "${slot.suggestedTemplate}" for this role.`
128
+ : null,
129
+ ``,
130
+ `OPERATING RULES:`,
131
+ `- Stay in your role; do not do work outside ${slot.role} scope.`,
132
+ `- When you need input from another role, name the role in your response rather than acting for them.`,
133
+ `- Produce concrete, structured output the downstream node in the workforce can act on.`,
134
+ ]
135
+ .filter((l) => l !== null)
136
+ .join("\n");
137
+ }
138
+ /**
139
+ * Build a full workforce graph that references real agent_ids.
140
+ *
141
+ * Shape:
142
+ * trigger ──► coordinator_agent ──► worker_agent_1
143
+ * ├─► worker_agent_2
144
+ * ├─► worker_agent_3
145
+ * └─► output (from coordinator)
146
+ *
147
+ * The first non-optional slot (typically "ceo") becomes the coordinator.
148
+ * Coordinator receives the trigger event, and all other agents receive
149
+ * their handoff from the coordinator. `output` listens on the coordinator.
150
+ *
151
+ * `agentIdBySlot` MUST contain an id for every slot in `specs` — callers
152
+ * produce this map by creating agents and pairing the returned ids back
153
+ * with `spec.slotKey`.
154
+ */
155
+ export function buildAgentWiredGraph(blueprint, specs, agentIdBySlot) {
156
+ if (specs.length === 0) {
157
+ throw new Error("No agent specs provided to buildAgentWiredGraph");
158
+ }
159
+ const coordinatorSpec = specs[0];
160
+ const coordinatorId = agentIdBySlot[coordinatorSpec.slotKey];
161
+ if (!coordinatorId) {
162
+ throw new Error(`Missing agent_id for coordinator slot "${coordinatorSpec.slotKey}"`);
163
+ }
164
+ const coordinatorNodeName = slotToNodeName(coordinatorSpec.slot);
165
+ const GRID_X = 320;
166
+ const GRID_Y = 180;
167
+ const nodes = [
168
+ {
169
+ name: "trigger",
170
+ type: "trigger",
171
+ position: { x: 0, y: GRID_Y },
172
+ input: {},
173
+ meta: {
174
+ source_blueprint: blueprint.id,
175
+ blueprint_name: blueprint.name,
176
+ blueprint_goal: blueprint.goal,
177
+ starter_tasks: blueprint.starterTasks,
178
+ },
179
+ },
180
+ {
181
+ name: coordinatorNodeName,
182
+ type: "agent",
183
+ position: { x: GRID_X, y: GRID_Y },
184
+ input: { agent_id: coordinatorId },
185
+ meta: {
186
+ role: coordinatorSpec.slot.role,
187
+ title: coordinatorSpec.slot.title,
188
+ is_coordinator: true,
189
+ },
190
+ },
191
+ ];
192
+ // Worker agent nodes, laid out to the right of the coordinator, stacked vertically
193
+ specs.slice(1).forEach((spec, i) => {
194
+ const nodeName = slotToNodeName(spec.slot);
195
+ const agentId = agentIdBySlot[spec.slotKey];
196
+ if (!agentId) {
197
+ throw new Error(`Missing agent_id for slot "${spec.slotKey}"`);
198
+ }
199
+ nodes.push({
200
+ name: nodeName,
201
+ type: "agent",
202
+ position: { x: GRID_X * 2, y: i * GRID_Y },
203
+ input: { agent_id: agentId },
204
+ meta: { role: spec.slot.role, title: spec.slot.title },
205
+ });
206
+ });
207
+ // Output node listens on the coordinator's result
208
+ nodes.push({
209
+ name: "output",
210
+ type: "output",
211
+ position: { x: GRID_X * 3, y: GRID_Y },
212
+ input: { message: `${blueprint.name} team response` },
213
+ });
214
+ const edges = [
215
+ // trigger → coordinator
216
+ { source_node_name: "trigger", target_node_name: coordinatorNodeName, connection_type: "next_step" },
217
+ // coordinator → output
218
+ { source_node_name: coordinatorNodeName, target_node_name: "output", connection_type: "next_step" },
219
+ ];
220
+ // coordinator → each worker agent (fan-out)
221
+ for (const spec of specs.slice(1)) {
222
+ edges.push({
223
+ source_node_name: coordinatorNodeName,
224
+ target_node_name: slotToNodeName(spec.slot),
225
+ connection_type: "next_step",
226
+ });
227
+ }
228
+ return { nodes, edges };
229
+ }
97
230
  //# sourceMappingURL=blueprint-to-workforce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint-to-workforce.js","sourceRoot":"","sources":["../../src/cli/blueprint-to-workforce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAqBH,mDAAmD;AACnD,MAAM,UAAU,cAAc,CAAC,IAAe;IAC5C,OAAO,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,SAA2B,EAC3B,UAAmD,EAAE;IAErD,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC;IACrD,MAAM,oBAAoB,GAAG,OAAO,CAAC,WAAW,IAAI,SAAS,CAAC,WAAW,CAAC;IAE1E,sEAAsE;IACtE,4EAA4E;IAC5E,2BAA2B;IAC3B,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpD,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,kBAAkB,EAAE,IAAI,CAAC,iBAAiB,IAAI,IAAI;QAClD,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,kBAAkB,EAAE,cAAc,CAAC,IAAI,CAAC;KACzC,CAAC,CAAC,CAAC;IAEJ,MAAM,KAAK,GAAuC;QAChD;YACE,IAAI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AAS,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,WAAW,EAAE;QACpG,uBAAuB;QACvB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE;KACpG,CAAC;IACF,4CAA4C;IAC5C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC;YACT,gBAAgB,EAAE,mBAAmB;YACrC,gBAAgB,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3C,eAAe,EAAE,WAAW;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,SAAS,EAAE,cAAc,EAoJrC,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,cAAc,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAInE"}
1
+ {"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,eAAO,MAAM,SAAS,EAAE,cAAc,EAqLrC,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,cAAc,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAInE"}
@@ -5,6 +5,39 @@
5
5
  * and displayed after upgrade.
6
6
  */
7
7
  export const CHANGELOG = [
8
+ {
9
+ version: "1.6.1",
10
+ date: "2026-04-14",
11
+ highlights: [
12
+ "Playbook freshness pass — three onboarding playbooks (`first-touch`, `amazon-seller`, `company-from-scratch`) now lead with `af workforce init` (v1.6 native deploy) and show the deprecated `af paperclip init` path as a secondary option with a sunset date",
13
+ "`deploy-to-paperclip` playbook got a prominent `⚠️ DEPRECATED` header pointing at `af playbook migrate-from-paperclip` and the sunset 2026-10-14",
14
+ "`amazon-seller` playbook expanded: shows `--include-optional-slots` to create all 5 agents, attach-MCP-per-agent recipe pointing at `mcp-client-quirks`, and smoke-run/publish commands",
15
+ "Verified: all 6 blueprints translate cleanly through `--dry-run` (node/edge math correct). Full e2e `content-studio` deploy creates + wires + validates + tears down cleanly",
16
+ ],
17
+ for_ai: [
18
+ "When `af bootstrap --json` returns workforces=0 and the user wants a team, the FIRST thing to show them is `af workforce init --blueprint <id> --dry-run --json` — the playbooks now lead with this, no longer with paperclip",
19
+ "For Amazon Singapore sellers, run `af playbook amazon-seller` — it shows the one-command native deploy path first, with `--include-optional-slots` for the full 5-agent team",
20
+ "`af playbook deploy-to-paperclip` now explicitly flags itself deprecated and points at `migrate-from-paperclip` — follow that path unless the user has an existing Paperclip instance",
21
+ ],
22
+ },
23
+ {
24
+ version: "1.6.0",
25
+ date: "2026-04-14",
26
+ highlights: [
27
+ "`af workforce init --blueprint <slug>` now deploys a RUNNABLE TEAM by default — creates one real agent per non-optional blueprint slot, then wires them into a DAG (trigger → coordinator → worker agents → output). Previously it produced a skeleton the user had to finish manually",
28
+ "Atomic rollback on failure: if workforce init fails at any step, every agent created so far is deleted and the workforce is removed. No orphans",
29
+ "`--skeleton-only` preserves the v1.5 behavior for users who want to wire agents manually (e.g. re-use existing agents rather than auto-create)",
30
+ "`--model` flag lets you pick the model for all auto-created agents (default: agenticflow/gemini-2.0-flash). `--include-optional-slots` fills every slot, not just the required ones",
31
+ "`--dry-run` shows both the agent-create plan AND the graph shape without touching the workspace — preview the full team before committing",
32
+ ],
33
+ for_ai: [
34
+ "NEW DEFAULT FLOW: `af workforce init --blueprint amazon-seller --name \"My Team\" --json` gives you a fully runnable workforce in one command. Returns {workforce_id, agents:[{slot_role, agent_id, title}], node_count, edge_count, next_steps}",
35
+ "Each auto-created agent starts with tools:[] — attach MCP clients or tools with `af agent update --agent-id <id> --patch --body '{\"mcp_clients\":[...]}'` after init",
36
+ "If init fails, the error details carry `rolled_back_agents` and `rolled_back_workforce` so you know what was undone. If rollback itself fails, `rollback_errors` lists what needs manual cleanup",
37
+ "Use `--dry-run` first to preview: you'll see the model per slot, a preview of each agent's system prompt, and the estimated node/edge count — no side effects",
38
+ "Set `--project-id` explicitly if your shell doesn't have AGENTICFLOW_PROJECT_ID — full init needs it for agent creation (server doesn't auto-inject for agent endpoints)",
39
+ ],
40
+ },
8
41
  {
9
42
  version: "1.5.3",
10
43
  date: "2026-04-14",
@@ -1 +1 @@
1
- {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,CAAC,MAAM,SAAS,GAAqB;IACzC;QACE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACV,kPAAkP;YAClP,kOAAkO;YAClO,oPAAoP;SACrP;QACD,MAAM,EAAE;YACN,mMAAmM;YACnM,gMAAgM;YAChM,wOAAwO;SACzO;KACF;IACD;QACE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACV,8PAA8P;YAC9P,2JAA2J;YAC3J,0KAA0K;YAC1K,uNAAuN;YACvN,2RAA2R;YAC3R,sKAAsK;SACvK;QACD,MA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+GAA+G;YAC/G,qFAAqF;YACrF,6EAA6E;YAC7E,qEAAqE;YACrE,oHAAoH;YACpH,wGAAwG;YACxG,mGAAmG;SACpG;KACF;IACD;QACE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACV,gEAAgE;YAChE,uEAAuE;YACvE,mDAAmD;YACnD,4CAA4C;SAC7C;QACD,MAAM,EAAE;YACN,6CAA6C;YAC7C,6DAA6D;SAC9D;KACF;IACD;QACE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACV,kCAAkC;YAClC,6CAA6C;YAC7C,qCAAqC;SACtC;QACD,MAAM,EAAE;YACN,0CAA0C;SAC3C;KACF;CACF,CAAC;AAEF,MAAM,UAAU,kBAAkB;IAChC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;IAC9D,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
1
+ {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/cli/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,CAAC,MAAM,SAAS,GAAqB;IACzC;QACE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE;YACV,gQAAgQ;YAChQ,kJAAkJ;YAClJ,yLAAyL;YACzL,8KAA8K;SAC/K;QACD,MAAM,EAAE;YACN,+NAA+N;YAC/N,8KAA8K;YAC9K,uLAAuL;SACxL;KACF;IACD;QACE,OAAO,EAA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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;IAC9D,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAi8BpC,wBAAgB,aAAa,IAAI,OAAO,CAs2KvC;AAED,wBAAsB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB3D"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAi8BpC,wBAAgB,aAAa,IAAI,OAAO,CAu/KvC;AAED,wBAAsB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB3D"}
package/dist/cli/main.js CHANGED
@@ -4604,54 +4604,181 @@ export function createProgram() {
4604
4604
  // Blueprint-based native init -----------------------------------------
4605
4605
  workforceCmd
4606
4606
  .command("init")
4607
- .description("Deploy a blueprint as an AgenticFlow-native workforce (no Paperclip). " +
4608
- "Translates the blueprint's agent slots into MAS nodes + edges, then PUTs the graph.")
4607
+ .description("Deploy a blueprint as an AgenticFlow-native workforce. Default behavior " +
4608
+ "(v1.6+): creates a real agent per non-optional blueprint slot, then wires " +
4609
+ "them into a runnable DAG. Use --skeleton-only for the old v1.5 behavior " +
4610
+ "(trigger + output + blueprint metadata, no agents).")
4609
4611
  .requiredOption("--blueprint <slug>", "Blueprint id (run `af paperclip blueprints` to list)")
4610
4612
  .option("--name <name>", "Workforce name (defaults to blueprint name)")
4611
4613
  .option("--workspace-id <id>", "Workspace ID (overrides env)")
4612
- .option("--dry-run", "Show the graph that would be deployed without writing")
4614
+ .option("--project-id <id>", "Project ID to use for agent creation (defaults to env / client config)")
4615
+ .option("--model <model>", "Model to use for all agent slots (default: agenticflow/gemini-2.0-flash). Pass --include-optional-slots to fill every slot", "agenticflow/gemini-2.0-flash")
4616
+ .option("--include-optional-slots", "Also create agents for slots marked optional in the blueprint")
4617
+ .option("--skeleton-only", "Create a skeleton (trigger + output + blueprint metadata) WITHOUT materializing agents. The v1.5 behavior; use when you plan to wire agents yourself")
4618
+ .option("--dry-run", "Show the graph + agent specs that would be created without writing")
4613
4619
  .action(async (opts) => {
4614
- const { blueprintToWorkforce } = await import("./blueprint-to-workforce.js");
4620
+ const { blueprintToWorkforce, blueprintToAgentSpecs, buildAgentWiredGraph } = await import("./blueprint-to-workforce.js");
4615
4621
  const blueprint = getBlueprint(opts.blueprint);
4616
4622
  if (!blueprint) {
4617
4623
  fail("invalid_option_value", `Unknown blueprint id: ${opts.blueprint}`, "Run `af paperclip blueprints` to see available ids.");
4618
4624
  }
4619
- const translated = blueprintToWorkforce(blueprint, { name: opts.name });
4625
+ // ── Skeleton-only fast path (v1.5 behavior preserved) ────────────────
4626
+ if (opts.skeletonOnly) {
4627
+ const translated = blueprintToWorkforce(blueprint, { name: opts.name });
4628
+ if (opts.dryRun) {
4629
+ printResult({
4630
+ schema: "agenticflow.dry_run.v1",
4631
+ valid: true,
4632
+ target: "workforce.init",
4633
+ mode: "skeleton",
4634
+ blueprint: blueprint.id,
4635
+ workforce: translated.workforce,
4636
+ node_count: translated.nodes.length,
4637
+ edge_count: translated.edges.length,
4638
+ nodes: translated.nodes,
4639
+ edges: translated.edges,
4640
+ });
4641
+ return;
4642
+ }
4643
+ const client = buildClient(program.opts());
4644
+ await run(async () => {
4645
+ const created = (await client.workforces.create(translated.workforce, { workspaceId: opts.workspaceId }));
4646
+ const workforceId = created["id"];
4647
+ if (!workforceId)
4648
+ throw new Error("Workforce create did not return an id.");
4649
+ await client.workforces.putSchema(workforceId, { nodes: translated.nodes, edges: translated.edges }, { workspaceId: opts.workspaceId });
4650
+ return {
4651
+ schema: "agenticflow.workforce.init.v1",
4652
+ workforce_id: workforceId,
4653
+ blueprint: blueprint.id,
4654
+ mode: "skeleton",
4655
+ node_count: translated.nodes.length,
4656
+ edge_count: translated.edges.length,
4657
+ skeleton: true,
4658
+ next_steps: translated.suggested_next_steps,
4659
+ };
4660
+ });
4661
+ return;
4662
+ }
4663
+ // ── Full deploy path (v1.6+ default) ─────────────────────────────────
4664
+ // Resolve project_id (required for agent create — server doesn't auto-inject on agents)
4665
+ // Build the client eagerly so we can read its auth-config-derived projectId
4666
+ // (auth.json > env > flag). Callers that override with --project-id win.
4667
+ const fullClient = buildClient(program.opts());
4668
+ const projectId = opts.projectId ??
4669
+ program.opts().projectId ??
4670
+ process.env["AGENTICFLOW_PROJECT_ID"] ??
4671
+ fullClient.sdk.projectId;
4672
+ if (!projectId) {
4673
+ fail("missing_required_option", "Full workforce init requires a project_id for agent creation.", "Pass --project-id <id>, set AGENTICFLOW_PROJECT_ID, or run `af bootstrap --json` and copy `auth.project_id`. Alternatively use --skeleton-only to skip agent materialization.");
4674
+ }
4675
+ const workforceName = opts.name ?? blueprint.name;
4676
+ const specs = blueprintToAgentSpecs(blueprint, {
4677
+ projectId: projectId,
4678
+ workforceName,
4679
+ model: opts.model,
4680
+ includeOptionalSlots: Boolean(opts.includeOptionalSlots),
4681
+ });
4620
4682
  if (opts.dryRun) {
4621
- printResult({
4683
+ // Show plan without side effects
4684
+ const plan = {
4622
4685
  schema: "agenticflow.dry_run.v1",
4623
4686
  valid: true,
4624
4687
  target: "workforce.init",
4688
+ mode: "full",
4625
4689
  blueprint: blueprint.id,
4626
- workforce: translated.workforce,
4627
- node_count: translated.nodes.length,
4628
- edge_count: translated.edges.length,
4629
- nodes: translated.nodes,
4630
- edges: translated.edges,
4631
- });
4690
+ workforce: { name: workforceName, description: blueprint.description },
4691
+ agents_to_create: specs.map((s) => ({
4692
+ slot_role: s.slotKey,
4693
+ title: s.slot.title,
4694
+ model: s.body["model"],
4695
+ preview_system_prompt: s.body["system_prompt"].slice(0, 120) + "…",
4696
+ })),
4697
+ estimated_node_count: specs.length + 2, // + trigger + output
4698
+ estimated_edge_count: specs.length + 1, // trigger→coordinator + coordinator→{workers,output}
4699
+ };
4700
+ printResult(plan);
4632
4701
  return;
4633
4702
  }
4634
- const client = buildClient(program.opts());
4635
- await run(async () => {
4636
- const created = (await client.workforces.create(translated.workforce, { workspaceId: opts.workspaceId }));
4637
- const workforceId = created["id"];
4638
- if (!workforceId) {
4703
+ const client = fullClient;
4704
+ // Track created IDs so we can roll back on failure
4705
+ let workforceId = null;
4706
+ const createdAgentIds = [];
4707
+ try {
4708
+ // 1. Create the workforce shell (metadata only)
4709
+ const wfCreated = (await client.workforces.create({ name: workforceName, description: blueprint.description }, { workspaceId: opts.workspaceId, projectId: projectId }));
4710
+ workforceId = wfCreated["id"];
4711
+ if (!workforceId)
4639
4712
  throw new Error("Workforce create did not return an id.");
4640
- }
4641
- await client.workforces.putSchema(workforceId, { nodes: translated.nodes, edges: translated.edges }, { workspaceId: opts.workspaceId });
4642
- return {
4713
+ // 2. Create agents serially (easier error handling than parallel; N is small — 3-5)
4714
+ const agentIdBySlot = {};
4715
+ for (const spec of specs) {
4716
+ const agent = (await client.agents.create(spec.body));
4717
+ const agentId = agent["id"];
4718
+ if (!agentId)
4719
+ throw new Error(`Agent create for slot "${spec.slotKey}" did not return an id.`);
4720
+ createdAgentIds.push(agentId);
4721
+ agentIdBySlot[spec.slotKey] = agentId;
4722
+ }
4723
+ // 3. Build the fully-wired graph + PUT schema
4724
+ const graph = buildAgentWiredGraph(blueprint, specs, agentIdBySlot);
4725
+ await client.workforces.putSchema(workforceId, graph, { workspaceId: opts.workspaceId });
4726
+ // 4. Return structured deploy report
4727
+ printResult({
4643
4728
  schema: "agenticflow.workforce.init.v1",
4644
4729
  workforce_id: workforceId,
4645
4730
  blueprint: blueprint.id,
4646
- node_count: translated.nodes.length,
4647
- edge_count: translated.edges.length,
4648
- skeleton: true,
4649
- next_steps: translated.suggested_next_steps.concat([
4650
- `af workforce schema --workforce-id ${workforceId} --json # inspect current graph`,
4651
- `af workforce run --workforce-id ${workforceId} --trigger-data '{}' # smoke-test the skeleton`,
4652
- ]),
4731
+ mode: "full",
4732
+ node_count: graph.nodes.length,
4733
+ edge_count: graph.edges.length,
4734
+ skeleton: false,
4735
+ agents: specs.map((s) => ({
4736
+ slot_role: s.slotKey,
4737
+ agent_id: agentIdBySlot[s.slotKey],
4738
+ title: s.slot.title,
4739
+ })),
4740
+ next_steps: [
4741
+ `af workforce schema --workforce-id ${workforceId} --json # inspect the wired graph`,
4742
+ `af workforce run --workforce-id ${workforceId} --trigger-data '{"message":"..."}' # smoke-test`,
4743
+ `af workforce publish --workforce-id ${workforceId} --json # mint a public URL`,
4744
+ `Each agent was created blank-tools; attach MCP clients or tools via 'af agent update --agent-id <id> --patch --body '{"mcp_clients":[...]}' as needed`,
4745
+ ],
4746
+ });
4747
+ }
4748
+ catch (err) {
4749
+ // Atomic rollback: delete any agents + workforce created so far, then re-throw
4750
+ const rollbackErrors = [];
4751
+ for (const agentId of createdAgentIds) {
4752
+ try {
4753
+ await client.agents.delete(agentId);
4754
+ }
4755
+ catch (rbErr) {
4756
+ rollbackErrors.push(`agent ${agentId}: ${rbErr instanceof Error ? rbErr.message : String(rbErr)}`);
4757
+ }
4758
+ }
4759
+ if (workforceId) {
4760
+ try {
4761
+ await client.workforces.delete(workforceId, { workspaceId: opts.workspaceId });
4762
+ }
4763
+ catch (rbErr) {
4764
+ rollbackErrors.push(`workforce ${workforceId}: ${rbErr instanceof Error ? rbErr.message : String(rbErr)}`);
4765
+ }
4766
+ }
4767
+ const message = err instanceof Error ? err.message : String(err);
4768
+ const details = {
4769
+ rolled_back_agents: createdAgentIds,
4770
+ rolled_back_workforce: workforceId,
4653
4771
  };
4654
- });
4772
+ if (rollbackErrors.length > 0)
4773
+ details["rollback_errors"] = rollbackErrors;
4774
+ if (err instanceof APIError && err.payload !== null && err.payload !== undefined) {
4775
+ details["payload"] = err.payload;
4776
+ details["status_code"] = err.statusCode;
4777
+ }
4778
+ fail("workforce_init_failed", `Workforce init failed: ${message}`, rollbackErrors.length > 0
4779
+ ? "Rollback partially failed — check rollback_errors and delete stray resources manually."
4780
+ : "All resources created so far were rolled back. Fix the underlying issue and retry.", details);
4781
+ }
4655
4782
  });
4656
4783
  // triggers (SDK-based)
4657
4784
  // ═════════════════════════════════════════════════════════════════