takomi 2.1.2 → 2.1.4

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 (52) hide show
  1. package/.pi/README.md +124 -124
  2. package/.pi/agents/architect.md +15 -15
  3. package/.pi/agents/coder.md +14 -14
  4. package/.pi/agents/designer.md +17 -17
  5. package/.pi/agents/orchestrator.md +22 -22
  6. package/.pi/agents/reviewer.md +16 -16
  7. package/.pi/extensions/oauth-router/README.md +125 -125
  8. package/.pi/extensions/oauth-router/commands.ts +380 -380
  9. package/.pi/extensions/oauth-router/config.ts +200 -200
  10. package/.pi/extensions/oauth-router/index.ts +41 -41
  11. package/.pi/extensions/oauth-router/oauth-flow.ts +154 -154
  12. package/.pi/extensions/oauth-router/oauth-store.ts +121 -121
  13. package/.pi/extensions/oauth-router/package.json +14 -14
  14. package/.pi/extensions/oauth-router/policies.ts +27 -27
  15. package/.pi/extensions/oauth-router/provider.ts +492 -492
  16. package/.pi/extensions/oauth-router/scripts/vibe-verify.py +98 -98
  17. package/.pi/extensions/oauth-router/state.ts +174 -174
  18. package/.pi/extensions/oauth-router/types.ts +153 -153
  19. package/.pi/extensions/takomi-runtime/command-text.ts +130 -130
  20. package/.pi/extensions/takomi-runtime/commands.ts +179 -179
  21. package/.pi/extensions/takomi-runtime/context-panel.ts +282 -282
  22. package/.pi/extensions/takomi-runtime/index.ts +1288 -1288
  23. package/.pi/extensions/takomi-runtime/profile.ts +114 -114
  24. package/.pi/extensions/takomi-runtime/routing-policy.ts +105 -105
  25. package/.pi/extensions/takomi-runtime/shared.ts +511 -492
  26. package/.pi/extensions/takomi-runtime/subagent-controller.ts +364 -364
  27. package/.pi/extensions/takomi-runtime/subagent-render.ts +501 -501
  28. package/.pi/extensions/takomi-runtime/subagent-types.ts +90 -83
  29. package/.pi/extensions/takomi-runtime/ui.ts +133 -133
  30. package/.pi/extensions/takomi-subagents/agent-aliases.ts +18 -18
  31. package/.pi/extensions/takomi-subagents/agents.ts +113 -113
  32. package/.pi/extensions/takomi-subagents/delegation-plan.ts +95 -95
  33. package/.pi/extensions/takomi-subagents/dispatch-helpers.ts +26 -26
  34. package/.pi/extensions/takomi-subagents/dispatch.ts +306 -215
  35. package/.pi/extensions/takomi-subagents/index.ts +76 -75
  36. package/.pi/extensions/takomi-subagents/live-updates.ts +136 -83
  37. package/.pi/extensions/takomi-subagents/native-render.ts +5 -142
  38. package/.pi/extensions/takomi-subagents/pi-subagents-engine.ts +228 -0
  39. package/.pi/extensions/takomi-subagents/tool-runner.ts +209 -209
  40. package/.pi/themes/takomi-noir.json +81 -81
  41. package/package.json +59 -59
  42. package/src/cli.js +14 -0
  43. package/src/doctor.js +87 -84
  44. package/src/pi-harness.js +355 -351
  45. package/src/pi-installer.js +193 -171
  46. package/src/pi-takomi-core/index.ts +4 -4
  47. package/src/pi-takomi-core/orchestration.ts +402 -402
  48. package/src/pi-takomi-core/routing.ts +93 -93
  49. package/src/pi-takomi-core/types.ts +173 -173
  50. package/src/pi-takomi-core/workflows.ts +299 -299
  51. package/src/skills-installer.js +101 -101
  52. package/src/update-check.js +140 -0
@@ -1,179 +1,179 @@
1
- import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@mariozechner/pi-coding-agent";
2
- import type {
3
- TakomiLaunchMode,
4
- TakomiRole,
5
- TakomiWorkflowId,
6
- VibeLifecycleStage,
7
- } from "../../../src/pi-takomi-core";
8
- import { commandHelp, completions, statusText, workflowPrompt } from "./command-text";
9
- import type { TakomiSubagentController } from "./subagent-types";
10
- import { installTakomiRoutingPolicy } from "./routing-policy";
11
-
12
- export type TakomiRuntimeCommandState = {
13
- enabled: boolean;
14
- autoOrch: boolean;
15
- launchMode: TakomiLaunchMode;
16
- planMode: boolean;
17
- role: TakomiRole;
18
- stage?: VibeLifecycleStage;
19
- workflow?: TakomiWorkflowId;
20
- activeSessionId?: string;
21
- subagentsEnabled: boolean;
22
- };
23
-
24
- type RegisterTakomiCommandOptions = {
25
- getState(): TakomiRuntimeCommandState;
26
- updateState(ctx: ExtensionContext, mutator: () => void, message?: string | (() => string)): Promise<void>;
27
- resetRuntime(ctx: ExtensionCommandContext): Promise<void>;
28
- setStageAndWorkflow(stage: VibeLifecycleStage, options?: { preserveRole?: boolean }): void;
29
- createPlanSession(ctx: ExtensionCommandContext, title?: string): Promise<string>;
30
- hasGenesisArtifacts(cwd: string): Promise<boolean>;
31
- subagentController: TakomiSubagentController;
32
- };
33
-
34
- export function registerTakomiCommands(pi: ExtensionAPI, options: RegisterTakomiCommandOptions): void {
35
- async function handleStage(ctx: ExtensionCommandContext, stage: VibeLifecycleStage, prompt?: string): Promise<void> {
36
- await options.updateState(ctx, () => {
37
- options.getState().enabled = true;
38
- options.setStageAndWorkflow(stage, { preserveRole: stage === "genesis" && options.getState().role === "orchestrator" });
39
- options.getState().planMode = stage !== "build";
40
- }, workflowPrompt(stage, prompt));
41
- }
42
-
43
- async function handleMode(ctx: ExtensionCommandContext, mode?: string): Promise<void> {
44
- if (mode !== "direct" && mode !== "orchestrate" && mode !== "review") {
45
- ctx.ui.notify("Usage: /takomi mode <direct|orchestrate|review>", "warning");
46
- return;
47
- }
48
- const hasGenesis = await options.hasGenesisArtifacts(ctx.cwd);
49
- await options.updateState(ctx, () => {
50
- const state = options.getState();
51
- state.enabled = true;
52
- if (mode === "direct") {
53
- state.autoOrch = false;
54
- state.planMode = false;
55
- state.role = "general";
56
- } else if (mode === "orchestrate") {
57
- state.autoOrch = true;
58
- state.planMode = true;
59
- state.role = "orchestrator";
60
- state.stage = hasGenesis ? "build" : "genesis";
61
- state.workflow = hasGenesis ? "vibe-build" : "vibe-genesis";
62
- } else {
63
- state.autoOrch = false;
64
- state.planMode = true;
65
- state.launchMode = "manual";
66
- state.role = "review";
67
- }
68
- }, () => `Takomi mode set to ${mode}`);
69
- }
70
-
71
- async function handleGate(ctx: ExtensionCommandContext, gate?: string): Promise<void> {
72
- if (gate !== "auto" && gate !== "review") {
73
- ctx.ui.notify("Usage: /takomi gate <auto|review>", "warning");
74
- return;
75
- }
76
- await options.updateState(ctx, () => {
77
- const state = options.getState();
78
- state.enabled = true;
79
- state.launchMode = gate === "review" ? "manual" : "auto";
80
- state.autoOrch = gate === "auto";
81
- }, () => `Takomi execution gate set to ${gate}`);
82
- }
83
-
84
- async function handleRouting(ctx: ExtensionCommandContext, body?: string): Promise<void> {
85
- if (!body?.trim()) {
86
- ctx.ui.notify("Usage: /takomi routing <policy text>\nTip: paste the policy after the command, or say: Update Takomi routing logic: \"\"\"...\"\"\"", "warning");
87
- return;
88
- }
89
- try {
90
- const result = await installTakomiRoutingPolicy(ctx.cwd, body);
91
- const detected = result.detectedDefaults.length ? `\n\nDetected defaults:\n- ${result.detectedDefaults.join("\n- ")}` : "\n\nNo model names were auto-detected; saved policy only.";
92
- ctx.ui.notify(`Takomi routing policy updated.\n\nPolicy: ${result.policyPath}\nSettings: ${result.settingsPath}${detected}`, "info");
93
- } catch (error) {
94
- ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
95
- }
96
- }
97
-
98
- async function handleSubagents(ctx: ExtensionCommandContext, action?: string): Promise<void> {
99
- const controller = options.subagentController;
100
- if (action === "on" || action === "off") {
101
- await options.updateState(ctx, () => {
102
- options.getState().subagentsEnabled = action === "on";
103
- }, `Takomi subagents ${action}`);
104
- return;
105
- }
106
- if (action === "status" || !action) {
107
- ctx.ui.notify(statusText(options.getState(), controller), controller.hasRuns() ? "info" : "warning");
108
- return;
109
- }
110
- if (action === "expand" || action === "fullscreen") {
111
- ctx.ui.setToolsExpanded(true);
112
- ctx.ui.notify("Expanded native tool results for Takomi subagent output.", "info");
113
- return;
114
- }
115
- if (action === "collapse") {
116
- ctx.ui.setToolsExpanded(false);
117
- ctx.ui.notify("Collapsed native tool results.", "info");
118
- return;
119
- }
120
- if (action === "toggle") {
121
- const expanded = !ctx.ui.getToolsExpanded();
122
- ctx.ui.setToolsExpanded(expanded);
123
- ctx.ui.notify(`${expanded ? "Expanded" : "Collapsed"} native tool results.`, "info");
124
- return;
125
- }
126
- if (action === "next" || action === "prev") {
127
- ctx.ui.notify("Takomi now uses Pi's native inline result UI. Subagent navigation is handled by the transcript/tool results.", "info");
128
- return;
129
- }
130
- ctx.ui.notify("Usage: /takomi subagents <on|off|status|expand|collapse|toggle>", "warning");
131
- }
132
-
133
- pi.registerCommand("takomi", {
134
- description: "Takomi lifecycle entrypoint",
135
- getArgumentCompletions: completions,
136
- handler: async (args, ctx) => {
137
- const [subcommand = "", ...rest] = args.trim().split(/\s+/).filter(Boolean);
138
- const tail = rest.join(" ");
139
- if (!subcommand) {
140
- await options.updateState(ctx, () => {
141
- options.getState().enabled = true;
142
- }, commandHelp());
143
- return;
144
- }
145
- if (subcommand === "genesis") return handleStage(ctx, "genesis", tail);
146
- if (subcommand === "design") return handleStage(ctx, "design", tail);
147
- if (subcommand === "build") return handleStage(ctx, "build", tail);
148
- if (subcommand === "plan" || subcommand === "kickoff" || subcommand === "lifecycle" || subcommand === "autoorch") {
149
- const summary = await options.createPlanSession(ctx, tail || undefined);
150
- ctx.ui.notify(summary, "info");
151
- return;
152
- }
153
- if (subcommand === "mode") return handleMode(ctx, rest[0]);
154
- if (subcommand === "gate") return handleGate(ctx, rest[0]);
155
- if (subcommand === "routing" || subcommand === "route" || subcommand === "models") return handleRouting(ctx, tail);
156
- if (subcommand === "subagents" || subcommand === "subagent") return handleSubagents(ctx, rest[0]);
157
- if (subcommand === "status") {
158
- ctx.ui.notify(statusText(options.getState(), options.subagentController), "info");
159
- return;
160
- }
161
- if (subcommand === "reset") return options.resetRuntime(ctx);
162
- ctx.ui.notify(commandHelp(), "warning");
163
- },
164
- });
165
-
166
- pi.registerCommand("takomi-status", {
167
- description: "Show Takomi lifecycle, gate, session, and subagent status",
168
- handler: async (_args, ctx) => {
169
- ctx.ui.notify(statusText(options.getState(), options.subagentController), "info");
170
- },
171
- });
172
-
173
- pi.registerCommand("takomi-reset", {
174
- description: "Reset Takomi runtime state to defaults",
175
- handler: async (_args, ctx) => {
176
- await options.resetRuntime(ctx);
177
- },
178
- });
179
- }
1
+ import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext } from "@mariozechner/pi-coding-agent";
2
+ import type {
3
+ TakomiLaunchMode,
4
+ TakomiRole,
5
+ TakomiWorkflowId,
6
+ VibeLifecycleStage,
7
+ } from "../../../src/pi-takomi-core";
8
+ import { commandHelp, completions, statusText, workflowPrompt } from "./command-text";
9
+ import type { TakomiSubagentController } from "./subagent-types";
10
+ import { installTakomiRoutingPolicy } from "./routing-policy";
11
+
12
+ export type TakomiRuntimeCommandState = {
13
+ enabled: boolean;
14
+ autoOrch: boolean;
15
+ launchMode: TakomiLaunchMode;
16
+ planMode: boolean;
17
+ role: TakomiRole;
18
+ stage?: VibeLifecycleStage;
19
+ workflow?: TakomiWorkflowId;
20
+ activeSessionId?: string;
21
+ subagentsEnabled: boolean;
22
+ };
23
+
24
+ type RegisterTakomiCommandOptions = {
25
+ getState(): TakomiRuntimeCommandState;
26
+ updateState(ctx: ExtensionContext, mutator: () => void, message?: string | (() => string)): Promise<void>;
27
+ resetRuntime(ctx: ExtensionCommandContext): Promise<void>;
28
+ setStageAndWorkflow(stage: VibeLifecycleStage, options?: { preserveRole?: boolean }): void;
29
+ createPlanSession(ctx: ExtensionCommandContext, title?: string): Promise<string>;
30
+ hasGenesisArtifacts(cwd: string): Promise<boolean>;
31
+ subagentController: TakomiSubagentController;
32
+ };
33
+
34
+ export function registerTakomiCommands(pi: ExtensionAPI, options: RegisterTakomiCommandOptions): void {
35
+ async function handleStage(ctx: ExtensionCommandContext, stage: VibeLifecycleStage, prompt?: string): Promise<void> {
36
+ await options.updateState(ctx, () => {
37
+ options.getState().enabled = true;
38
+ options.setStageAndWorkflow(stage, { preserveRole: stage === "genesis" && options.getState().role === "orchestrator" });
39
+ options.getState().planMode = stage !== "build";
40
+ }, workflowPrompt(stage, prompt));
41
+ }
42
+
43
+ async function handleMode(ctx: ExtensionCommandContext, mode?: string): Promise<void> {
44
+ if (mode !== "direct" && mode !== "orchestrate" && mode !== "review") {
45
+ ctx.ui.notify("Usage: /takomi mode <direct|orchestrate|review>", "warning");
46
+ return;
47
+ }
48
+ const hasGenesis = await options.hasGenesisArtifacts(ctx.cwd);
49
+ await options.updateState(ctx, () => {
50
+ const state = options.getState();
51
+ state.enabled = true;
52
+ if (mode === "direct") {
53
+ state.autoOrch = false;
54
+ state.planMode = false;
55
+ state.role = "general";
56
+ } else if (mode === "orchestrate") {
57
+ state.autoOrch = true;
58
+ state.planMode = true;
59
+ state.role = "orchestrator";
60
+ state.stage = hasGenesis ? "build" : "genesis";
61
+ state.workflow = hasGenesis ? "vibe-build" : "vibe-genesis";
62
+ } else {
63
+ state.autoOrch = false;
64
+ state.planMode = true;
65
+ state.launchMode = "manual";
66
+ state.role = "review";
67
+ }
68
+ }, () => `Takomi mode set to ${mode}`);
69
+ }
70
+
71
+ async function handleGate(ctx: ExtensionCommandContext, gate?: string): Promise<void> {
72
+ if (gate !== "auto" && gate !== "review") {
73
+ ctx.ui.notify("Usage: /takomi gate <auto|review>", "warning");
74
+ return;
75
+ }
76
+ await options.updateState(ctx, () => {
77
+ const state = options.getState();
78
+ state.enabled = true;
79
+ state.launchMode = gate === "review" ? "manual" : "auto";
80
+ state.autoOrch = gate === "auto";
81
+ }, () => `Takomi execution gate set to ${gate}`);
82
+ }
83
+
84
+ async function handleRouting(ctx: ExtensionCommandContext, body?: string): Promise<void> {
85
+ if (!body?.trim()) {
86
+ ctx.ui.notify("Usage: /takomi routing <policy text>\nTip: paste the policy after the command, or say: Update Takomi routing logic: \"\"\"...\"\"\"", "warning");
87
+ return;
88
+ }
89
+ try {
90
+ const result = await installTakomiRoutingPolicy(ctx.cwd, body);
91
+ const detected = result.detectedDefaults.length ? `\n\nDetected defaults:\n- ${result.detectedDefaults.join("\n- ")}` : "\n\nNo model names were auto-detected; saved policy only.";
92
+ ctx.ui.notify(`Takomi routing policy updated.\n\nPolicy: ${result.policyPath}\nSettings: ${result.settingsPath}${detected}`, "info");
93
+ } catch (error) {
94
+ ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
95
+ }
96
+ }
97
+
98
+ async function handleSubagents(ctx: ExtensionCommandContext, action?: string): Promise<void> {
99
+ const controller = options.subagentController;
100
+ if (action === "on" || action === "off") {
101
+ await options.updateState(ctx, () => {
102
+ options.getState().subagentsEnabled = action === "on";
103
+ }, `Takomi subagents ${action}`);
104
+ return;
105
+ }
106
+ if (action === "status" || !action) {
107
+ ctx.ui.notify(statusText(options.getState(), controller), controller.hasRuns() ? "info" : "warning");
108
+ return;
109
+ }
110
+ if (action === "expand" || action === "fullscreen") {
111
+ ctx.ui.setToolsExpanded(true);
112
+ ctx.ui.notify("Expanded native tool results for Takomi subagent output.", "info");
113
+ return;
114
+ }
115
+ if (action === "collapse") {
116
+ ctx.ui.setToolsExpanded(false);
117
+ ctx.ui.notify("Collapsed native tool results.", "info");
118
+ return;
119
+ }
120
+ if (action === "toggle") {
121
+ const expanded = !ctx.ui.getToolsExpanded();
122
+ ctx.ui.setToolsExpanded(expanded);
123
+ ctx.ui.notify(`${expanded ? "Expanded" : "Collapsed"} native tool results.`, "info");
124
+ return;
125
+ }
126
+ if (action === "next" || action === "prev") {
127
+ ctx.ui.notify("Takomi now uses Pi's native inline result UI. Subagent navigation is handled by the transcript/tool results.", "info");
128
+ return;
129
+ }
130
+ ctx.ui.notify("Usage: /takomi subagents <on|off|status|expand|collapse|toggle>", "warning");
131
+ }
132
+
133
+ pi.registerCommand("takomi", {
134
+ description: "Takomi lifecycle entrypoint",
135
+ getArgumentCompletions: completions,
136
+ handler: async (args, ctx) => {
137
+ const [subcommand = "", ...rest] = args.trim().split(/\s+/).filter(Boolean);
138
+ const tail = rest.join(" ");
139
+ if (!subcommand) {
140
+ await options.updateState(ctx, () => {
141
+ options.getState().enabled = true;
142
+ }, commandHelp());
143
+ return;
144
+ }
145
+ if (subcommand === "genesis") return handleStage(ctx, "genesis", tail);
146
+ if (subcommand === "design") return handleStage(ctx, "design", tail);
147
+ if (subcommand === "build") return handleStage(ctx, "build", tail);
148
+ if (subcommand === "plan" || subcommand === "kickoff" || subcommand === "lifecycle" || subcommand === "autoorch") {
149
+ const summary = await options.createPlanSession(ctx, tail || undefined);
150
+ ctx.ui.notify(summary, "info");
151
+ return;
152
+ }
153
+ if (subcommand === "mode") return handleMode(ctx, rest[0]);
154
+ if (subcommand === "gate") return handleGate(ctx, rest[0]);
155
+ if (subcommand === "routing" || subcommand === "route" || subcommand === "models") return handleRouting(ctx, tail);
156
+ if (subcommand === "subagents" || subcommand === "subagent") return handleSubagents(ctx, rest[0]);
157
+ if (subcommand === "status") {
158
+ ctx.ui.notify(statusText(options.getState(), options.subagentController), "info");
159
+ return;
160
+ }
161
+ if (subcommand === "reset") return options.resetRuntime(ctx);
162
+ ctx.ui.notify(commandHelp(), "warning");
163
+ },
164
+ });
165
+
166
+ pi.registerCommand("takomi-status", {
167
+ description: "Show Takomi lifecycle, gate, session, and subagent status",
168
+ handler: async (_args, ctx) => {
169
+ ctx.ui.notify(statusText(options.getState(), options.subagentController), "info");
170
+ },
171
+ });
172
+
173
+ pi.registerCommand("takomi-reset", {
174
+ description: "Reset Takomi runtime state to defaults",
175
+ handler: async (_args, ctx) => {
176
+ await options.resetRuntime(ctx);
177
+ },
178
+ });
179
+ }