takomi 2.1.37 → 2.1.39

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 (90) hide show
  1. package/.agents/plugins/marketplace.json +32 -0
  2. package/.pi/agents/architect.md +4 -2
  3. package/.pi/agents/designer.md +2 -0
  4. package/.pi/agents/orchestrator.md +4 -0
  5. package/.pi/prompts/design-prompt.md +3 -1
  6. package/.pi/prompts/genesis-prompt.md +2 -0
  7. package/.pi/prompts/takomi-prompt.md +6 -3
  8. package/.pi/takomi/policies/subagent-routing.md +9 -1
  9. package/.pi/takomi/policies/takomi-lifecycle-routing.md +3 -1
  10. package/README.md +27 -5
  11. package/assets/.agent/skills/takomi-flow/SKILL.md +235 -0
  12. package/assets/.agent/workflows/README.md +3 -3
  13. package/assets/.agent/workflows/mode-architect.md +7 -5
  14. package/assets/.agent/workflows/vibe-design.md +3 -1
  15. package/assets/.agent/workflows/vibe-genesis.md +2 -0
  16. package/assets/Takomi-Agents/custom_modes.yaml +1253 -1252
  17. package/assets/Takomi-Agents/vibe-architect.yaml +11 -6
  18. package/assets/Takomi-Agents/vibe-orchestrator.yaml +2 -2
  19. package/docs/features/TakomiFlow_Portable_Plugin.md +78 -0
  20. package/docs/takomi-flow-onboarding.md +76 -0
  21. package/docs/takomi-flow-public-distribution.md +94 -0
  22. package/package.json +19 -2
  23. package/plugins/takomi-codex/.codex-plugin/plugin.json +37 -0
  24. package/plugins/takomi-codex/assets/composer-icon.png +0 -0
  25. package/plugins/takomi-codex/assets/logo-dark.png +0 -0
  26. package/plugins/takomi-codex/assets/logo.png +0 -0
  27. package/plugins/takomi-codex/scripts/takomi-board.ps1 +197 -0
  28. package/plugins/takomi-codex/scripts/takomi-detect.ps1 +125 -0
  29. package/plugins/takomi-codex/scripts/takomi-doctor.ps1 +88 -0
  30. package/plugins/takomi-codex/scripts/takomi-harness.ps1 +52 -0
  31. package/plugins/takomi-codex/scripts/takomi-pi-dispatch.ps1 +93 -0
  32. package/plugins/takomi-codex/scripts/takomi-policy.ps1 +108 -0
  33. package/plugins/takomi-codex/skills/takomi-codex/SKILL.md +194 -0
  34. package/plugins/takomi-flow/.codex-plugin/plugin.json +36 -0
  35. package/plugins/takomi-flow/.mcp.json +11 -0
  36. package/plugins/takomi-flow/assets/capabilities.json +171 -0
  37. package/plugins/takomi-flow/assets/collection.schema.json +29 -0
  38. package/plugins/takomi-flow/assets/composer-icon.png +0 -0
  39. package/plugins/takomi-flow/assets/examples.json +94 -0
  40. package/plugins/takomi-flow/assets/logo-dark.png +0 -0
  41. package/plugins/takomi-flow/assets/logo.png +0 -0
  42. package/plugins/takomi-flow/assets/request.schema.json +67 -0
  43. package/plugins/takomi-flow/assets/result.schema.json +45 -0
  44. package/plugins/takomi-flow/assets/templates/image-request.json +13 -0
  45. package/plugins/takomi-flow/assets/templates/video-request.json +15 -0
  46. package/plugins/takomi-flow/package.json +38 -0
  47. package/plugins/takomi-flow/pnpm-lock.yaml +813 -0
  48. package/plugins/takomi-flow/references/flow-provider-contract.md +326 -0
  49. package/plugins/takomi-flow/scripts/lib/agent-plan.mjs +130 -0
  50. package/plugins/takomi-flow/scripts/lib/api.mjs +113 -0
  51. package/plugins/takomi-flow/scripts/lib/args.mjs +57 -0
  52. package/plugins/takomi-flow/scripts/lib/audit.mjs +65 -0
  53. package/plugins/takomi-flow/scripts/lib/browser.mjs +39 -0
  54. package/plugins/takomi-flow/scripts/lib/capabilities.mjs +11 -0
  55. package/plugins/takomi-flow/scripts/lib/collect.mjs +53 -0
  56. package/plugins/takomi-flow/scripts/lib/commands.mjs +175 -0
  57. package/plugins/takomi-flow/scripts/lib/doctor.mjs +77 -0
  58. package/plugins/takomi-flow/scripts/lib/examples.mjs +17 -0
  59. package/plugins/takomi-flow/scripts/lib/flow-outcome.mjs +90 -0
  60. package/plugins/takomi-flow/scripts/lib/flow-ui.mjs +165 -0
  61. package/plugins/takomi-flow/scripts/lib/generation.mjs +90 -0
  62. package/plugins/takomi-flow/scripts/lib/inspect.mjs +81 -0
  63. package/plugins/takomi-flow/scripts/lib/mcp-prompts.mjs +39 -0
  64. package/plugins/takomi-flow/scripts/lib/mcp-resources.mjs +16 -0
  65. package/plugins/takomi-flow/scripts/lib/mcp-tools.mjs +150 -0
  66. package/plugins/takomi-flow/scripts/lib/media.mjs +78 -0
  67. package/plugins/takomi-flow/scripts/lib/observe.mjs +54 -0
  68. package/plugins/takomi-flow/scripts/lib/paths.mjs +37 -0
  69. package/plugins/takomi-flow/scripts/lib/playwright-loader.mjs +23 -0
  70. package/plugins/takomi-flow/scripts/lib/prompts.mjs +72 -0
  71. package/plugins/takomi-flow/scripts/lib/report.mjs +141 -0
  72. package/plugins/takomi-flow/scripts/lib/request-validator.mjs +58 -0
  73. package/plugins/takomi-flow/scripts/lib/request.mjs +55 -0
  74. package/plugins/takomi-flow/scripts/lib/resource-files.mjs +69 -0
  75. package/plugins/takomi-flow/scripts/lib/result.mjs +31 -0
  76. package/plugins/takomi-flow/scripts/lib/review.mjs +44 -0
  77. package/plugins/takomi-flow/scripts/lib/selftest.mjs +153 -0
  78. package/plugins/takomi-flow/scripts/lib/settings-plan.mjs +39 -0
  79. package/plugins/takomi-flow/scripts/lib/templates.mjs +37 -0
  80. package/plugins/takomi-flow/scripts/lib/trusted-chrome.mjs +67 -0
  81. package/plugins/takomi-flow/scripts/lib/workflow.mjs +56 -0
  82. package/plugins/takomi-flow/scripts/mcp-server.mjs +18 -0
  83. package/plugins/takomi-flow/scripts/mcp-smoke.mjs +142 -0
  84. package/plugins/takomi-flow/scripts/takomi-flow.mjs +17 -0
  85. package/plugins/takomi-flow/skills/takomi-flow/SKILL.md +235 -0
  86. package/plugins/takomi-flow/skills/takomi-flow/agents/openai.yaml +7 -0
  87. package/scripts/install-takomi-flow.ps1 +85 -0
  88. package/src/pi-takomi-core/orchestration.ts +1 -1
  89. package/src/pi-takomi-core/workflows.ts +4 -4
  90. package/src/skills-catalog.js +11 -7
@@ -0,0 +1,67 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
3
+ import fs from 'node:fs';
4
+ import { spawn } from 'node:child_process';
5
+ import { ensureDir, FLOW_URL } from './paths.mjs';
6
+
7
+ export function defaultTrustedProfileDir() {
8
+ return path.join(os.homedir(), '.takomi-flow', 'trusted-chrome-profile');
9
+ }
10
+
11
+ export function launchTrustedChrome(args = {}) {
12
+ const port = Number.parseInt(args.port || '9222', 10) || 9222;
13
+ const userDataDir = ensureDir(path.resolve(args.profileDir || defaultTrustedProfileDir()));
14
+ const executable = args.chromePath || findChromeExecutable();
15
+ const chromeArgs = [
16
+ `--remote-debugging-port=${port}`,
17
+ `--user-data-dir=${userDataDir}`,
18
+ '--no-first-run',
19
+ '--new-window',
20
+ args.url || FLOW_URL,
21
+ ];
22
+ if (args.printCommand) {
23
+ return result({ executable, chromeArgs, port, userDataDir, launched: false });
24
+ }
25
+ const child = spawn(executable, chromeArgs, {
26
+ detached: true,
27
+ stdio: 'ignore',
28
+ windowsHide: false,
29
+ });
30
+ child.unref();
31
+ return result({ executable, chromeArgs, port, userDataDir, launched: true, processId: child.pid });
32
+ }
33
+
34
+ function result(data) {
35
+ return {
36
+ schemaVersion: 1,
37
+ status: 'ok',
38
+ cdpUrl: `http://127.0.0.1:${data.port}`,
39
+ loginUrl: data.chromeArgs[data.chromeArgs.length - 1],
40
+ userDataDir: data.userDataDir,
41
+ executable: data.executable,
42
+ args: data.chromeArgs,
43
+ launched: data.launched,
44
+ processId: data.processId,
45
+ nextActions: [
46
+ 'Log into Google Flow manually in the opened Chrome window.',
47
+ `After login, use --cdp-url http://127.0.0.1:${data.port} with observe, smoke, workflow, or generate.`,
48
+ 'Keep this Chrome window open while TakomiFlow attaches to it.',
49
+ ],
50
+ };
51
+ }
52
+
53
+ function findChromeExecutable() {
54
+ const candidates = process.platform === 'win32' ? [
55
+ path.join(process.env.PROGRAMFILES || 'C:\\Program Files', 'Google', 'Chrome', 'Application', 'chrome.exe'),
56
+ path.join(process.env['PROGRAMFILES(X86)'] || 'C:\\Program Files (x86)', 'Google', 'Chrome', 'Application', 'chrome.exe'),
57
+ path.join(process.env.LOCALAPPDATA || '', 'Google', 'Chrome', 'Application', 'chrome.exe'),
58
+ ] : [
59
+ '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
60
+ '/usr/bin/google-chrome',
61
+ '/usr/bin/google-chrome-stable',
62
+ '/usr/bin/chromium-browser',
63
+ ];
64
+ const found = candidates.find(candidate => candidate && fs.existsSync(candidate));
65
+ if (!found) throw new Error('Could not find Chrome. Pass --chrome-path <path-to-chrome>.');
66
+ return found;
67
+ }
@@ -0,0 +1,56 @@
1
+ import { createPreparedRequest } from './request.mjs';
2
+ import { validateRequestFile } from './request-validator.mjs';
3
+ import { generateFromRequest } from './generation.mjs';
4
+ import { createSettingsPlan } from './settings-plan.mjs';
5
+
6
+ export async function runWorkflow(args = {}) {
7
+ const { request, requestPath } = createPreparedRequest(args);
8
+ const validation = validateRequestFile(requestPath);
9
+ const result = {
10
+ schemaVersion: 1,
11
+ status: validation.status === 'ok' ? 'prepared' : 'failed',
12
+ requestPath,
13
+ request,
14
+ settingsPlan: createSettingsPlan(request),
15
+ validation,
16
+ generation: null,
17
+ nextActions: nextActions(args, validation),
18
+ };
19
+ if (validation.status !== 'ok' || !args.submit) return result;
20
+ if (!args.allowBrowser) {
21
+ result.status = 'blocked';
22
+ result.nextActions = ['Set allowBrowser=true to permit opening Flow for generation.'];
23
+ return result;
24
+ }
25
+ result.generation = await generateFromRequest({
26
+ request: requestPath,
27
+ profileDir: args.profileDir,
28
+ browserChannel: args.browserChannel,
29
+ cdpUrl: args.cdpUrl,
30
+ headless: Boolean(args.headless),
31
+ });
32
+ result.status = result.generation.status;
33
+ result.nextActions = afterGeneration(result.generation);
34
+ return result;
35
+ }
36
+
37
+ function nextActions(args, validation) {
38
+ if (validation.status !== 'ok') return ['Fix request validation errors before opening Flow.'];
39
+ if (!args.submit) {
40
+ return [
41
+ 'Review the prepared request file.',
42
+ 'Run generate with explicit spend approval when ready.',
43
+ ];
44
+ }
45
+ if (!args.allowBrowser) return ['Set allowBrowser=true to permit opening Flow for generation.'];
46
+ return ['Generation was requested; TakomiFlow will still enforce the spend guard.'];
47
+ }
48
+
49
+ function afterGeneration(generation) {
50
+ const actions = [];
51
+ if (generation.manualActions?.length) actions.push(...generation.manualActions);
52
+ if (generation.errors?.length) actions.push('Review generation errors in run metadata.');
53
+ if (generation.assets?.length) actions.push('Run assets/report to catalog downloads and create a handoff.');
54
+ if (!actions.length) actions.push('Inspect the run metadata and screenshots.');
55
+ return actions;
56
+ }
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { registerPrompts } from './lib/mcp-prompts.mjs';
5
+ import { registerResources } from './lib/mcp-resources.mjs';
6
+ import { registerTools } from './lib/mcp-tools.mjs';
7
+
8
+ const server = new McpServer({
9
+ name: 'takomi-flow',
10
+ version: '0.1.0',
11
+ });
12
+
13
+ registerTools(server);
14
+ registerResources(server);
15
+ registerPrompts(server);
16
+
17
+ const transport = new StdioServerTransport();
18
+ await server.connect(transport);
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
6
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
7
+
8
+ const client = new Client({ name: 'takomi-flow-smoke', version: '0.1.0' });
9
+ const reviewRunDir = path.join(os.tmpdir(), 'takomi-flow-mcp-smoke-review');
10
+ const transport = new StdioClientTransport({
11
+ command: 'node',
12
+ args: ['scripts/mcp-server.mjs'],
13
+ });
14
+
15
+ try {
16
+ prepareReviewRun(reviewRunDir);
17
+ await client.connect(transport);
18
+ const tools = await client.listTools();
19
+ const capabilities = await client.callTool({
20
+ name: 'takomi_flow_capabilities',
21
+ arguments: {},
22
+ });
23
+ const audit = await client.callTool({
24
+ name: 'takomi_flow_audit',
25
+ arguments: { outputDir: 'C:/Users/johno/.takomi-flow/runs', limit: 3 },
26
+ });
27
+ const examples = await client.callTool({
28
+ name: 'takomi_flow_examples',
29
+ arguments: { name: 'cinematic-video' },
30
+ });
31
+ const plan = await client.callTool({
32
+ name: 'takomi_flow_plan',
33
+ arguments: {
34
+ kind: 'video',
35
+ prompt: 'MCP smoke test planned video prompt',
36
+ variations: 2,
37
+ extractFrames: 2,
38
+ },
39
+ });
40
+ const workflow = await client.callTool({
41
+ name: 'takomi_flow_workflow',
42
+ arguments: {
43
+ kind: 'image',
44
+ prompt: 'MCP smoke test image prompt',
45
+ variations: 1,
46
+ outputDir: 'C:/Users/johno/.takomi-flow/runs',
47
+ },
48
+ });
49
+ const observeBlocked = await client.callTool({
50
+ name: 'takomi_flow_observe',
51
+ arguments: { allowBrowser: false },
52
+ });
53
+ const runs = await client.callTool({
54
+ name: 'takomi_flow_runs',
55
+ arguments: { outputDir: 'C:/Users/johno/.takomi-flow/runs', limit: 3 },
56
+ });
57
+ const report = await client.callTool({
58
+ name: 'takomi_flow_report',
59
+ arguments: {
60
+ outputDir: 'C:/Users/johno/.takomi-flow/runs',
61
+ limit: 3,
62
+ reportPath: 'C:/Users/johno/.takomi-flow/runs/mcp-smoke-report.md',
63
+ },
64
+ });
65
+ const review = await client.callTool({
66
+ name: 'takomi_flow_review',
67
+ arguments: { run: reviewRunDir, frames: 0 },
68
+ });
69
+ const collect = await client.callTool({
70
+ name: 'takomi_flow_collect',
71
+ arguments: {
72
+ run: reviewRunDir,
73
+ targetDir: path.join(reviewRunDir, 'collected'),
74
+ frames: 0,
75
+ },
76
+ });
77
+ const resources = await client.listResources();
78
+ const contract = await client.readResource({ uri: 'takomi-flow://contract' });
79
+ const examplesResource = await client.readResource({ uri: 'takomi-flow://examples' });
80
+ const requestSchema = await client.readResource({ uri: 'takomi-flow://schemas/request' });
81
+ const resultSchema = await client.readResource({ uri: 'takomi-flow://schemas/result' });
82
+ const collectionSchema = await client.readResource({ uri: 'takomi-flow://schemas/collection' });
83
+ const prompts = await client.listPrompts();
84
+ const videoPrompt = await client.getPrompt({
85
+ name: 'takomi_flow_video_workflow',
86
+ arguments: { topic: 'test video', variations: '1' },
87
+ });
88
+ const reviewPrompt = await client.getPrompt({
89
+ name: 'takomi_flow_review_workflow',
90
+ arguments: { run: reviewRunDir, frames: '2' },
91
+ });
92
+ const collectPrompt = await client.getPrompt({
93
+ name: 'takomi_flow_collect_workflow',
94
+ arguments: { run: reviewRunDir, targetDir: path.join(reviewRunDir, 'collected') },
95
+ });
96
+ console.log(JSON.stringify({
97
+ status: 'ok',
98
+ toolCount: tools.tools.length,
99
+ toolNames: tools.tools.map(tool => tool.name),
100
+ capabilitiesStatus: capabilities.structuredContent?.provider || 'unknown',
101
+ auditStatus: audit.structuredContent?.status || 'unknown',
102
+ examplesStatus: examples.structuredContent?.example?.name || 'unknown',
103
+ planStatus: plan.structuredContent?.status || 'unknown',
104
+ workflowStatus: workflow.structuredContent?.status || 'unknown',
105
+ observeBlockedStatus: observeBlocked.structuredContent?.status || 'unknown',
106
+ runsStatus: runs.structuredContent?.schemaVersion || 'unknown',
107
+ reportStatus: report.structuredContent?.status || 'unknown',
108
+ reviewStatus: review.structuredContent?.status || 'unknown',
109
+ collectStatus: collect.structuredContent?.status || 'unknown',
110
+ resourceCount: resources.resources.length,
111
+ contractBytes: contract.contents?.[0]?.text?.length || 0,
112
+ examplesBytes: examplesResource.contents?.[0]?.text?.length || 0,
113
+ requestSchemaBytes: requestSchema.contents?.[0]?.text?.length || 0,
114
+ resultSchemaBytes: resultSchema.contents?.[0]?.text?.length || 0,
115
+ collectionSchemaBytes: collectionSchema.contents?.[0]?.text?.length || 0,
116
+ promptCount: prompts.prompts.length,
117
+ videoPromptMessages: videoPrompt.messages?.length || 0,
118
+ reviewPromptMessages: reviewPrompt.messages?.length || 0,
119
+ collectPromptMessages: collectPrompt.messages?.length || 0,
120
+ }, null, 2));
121
+ } finally {
122
+ await client.close();
123
+ }
124
+
125
+ function prepareReviewRun(runDir) {
126
+ const downloadsDir = path.join(runDir, 'downloads');
127
+ fs.mkdirSync(downloadsDir, { recursive: true });
128
+ const assetPath = path.join(downloadsDir, 'sample.png');
129
+ fs.writeFileSync(assetPath, 'takomi-flow-smoke-image');
130
+ fs.writeFileSync(path.join(runDir, 'run.json'), `${JSON.stringify({
131
+ schemaVersion: 1,
132
+ status: 'downloaded',
133
+ runId: 'mcp-smoke-review',
134
+ command: 'mcp-smoke',
135
+ kind: 'image',
136
+ assets: [assetPath],
137
+ screenshots: [],
138
+ errors: [],
139
+ manualActions: [],
140
+ metadataPath: path.join(runDir, 'run.json'),
141
+ }, null, 2)}\n`);
142
+ }
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { parseArgs, printUsage } from './lib/args.mjs';
3
+ import { handleCommand } from './lib/commands.mjs';
4
+
5
+ const args = parseArgs(process.argv.slice(2));
6
+ const command = args._[0];
7
+
8
+ try {
9
+ if (!command || args.help) {
10
+ printUsage();
11
+ } else {
12
+ await handleCommand(command, args);
13
+ }
14
+ } catch (error) {
15
+ console.error(`[TakomiFlow] ${error.message}`);
16
+ process.exitCode = 1;
17
+ }
@@ -0,0 +1,235 @@
1
+ ---
2
+ name: takomi-flow
3
+ description: "Use when Codex needs to operate Google Flow as a reusable agent tool through safe browser automation: bootstrap/login a persistent Flow profile, smoke-check access without spending credits, prepare image or video generation request files, run guarded Flow generations, download assets, inspect results, or integrate Flow assets into a video pipeline. Trigger for TakomiFlow, Flow browser provider, use Google Flow credits, Flow automation, generate with Flow, or agent-first Flow workflows."
4
+ ---
5
+
6
+ # TakomiFlow
7
+
8
+ TakomiFlow is an agent-first workflow for using Google Flow through visible browser automation. Treat it as a local tool layer for Codex agents, not as an unofficial API.
9
+
10
+ ## Runtime Choice
11
+
12
+ Use this skill as the single TakomiFlow entrypoint.
13
+
14
+ 1. If the active harness is Codex and the user approves plugin installation or repair, install or reuse the global Codex plugin and then prefer its MCP tools.
15
+ 2. If the plugin already exists, verify it with `doctor` and use MCP tools when the session exposes them.
16
+ 3. If MCP is unavailable, use the TakomiFlow CLI directly.
17
+ 4. If the harness is not Codex or does not support plugins, keep using this skill as the workflow guide and call the CLI when shell access exists.
18
+ 5. If there is no shell access, provide the exact commands as a handoff checklist and stop.
19
+
20
+ Never install, update, or write to global plugin locations without telling the user what path will be changed and getting approval.
21
+
22
+ ## Install Or Repair The Plugin
23
+
24
+ Only follow this path when the user asks to install/repair TakomiFlow or agrees after you detect that the Codex plugin is missing.
25
+
26
+ 1. Check for an existing user plugin:
27
+
28
+ ```powershell
29
+ Test-Path "$HOME\plugins\takomi-flow"
30
+ Test-Path "$HOME\.agents\plugins\marketplace.json"
31
+ ```
32
+
33
+ 2. If the plugin exists, inspect it:
34
+
35
+ ```powershell
36
+ node "$HOME\plugins\takomi-flow\scripts\takomi-flow.mjs" doctor
37
+ ```
38
+
39
+ If this works, do not reinstall unless the user asked to update or repair.
40
+
41
+ 3. If missing, locate or get the VibeCode Protocol Suite:
42
+
43
+ ```powershell
44
+ git clone https://github.com/JStaRFilms/VibeCode-Protocol-Suite "$HOME\Source\VibeCode-Protocol-Suite"
45
+ ```
46
+
47
+ 4. Install the plugin globally for the current user:
48
+
49
+ ```powershell
50
+ cd "$HOME\Source\VibeCode-Protocol-Suite"
51
+ .\scripts\install-takomi-flow.ps1 -InstallDependencies
52
+ ```
53
+
54
+ This copies/registers the plugin at:
55
+
56
+ ```text
57
+ ~/plugins/takomi-flow
58
+ ~/.agents/plugins/marketplace.json
59
+ ```
60
+
61
+ 5. Verify:
62
+
63
+ ```powershell
64
+ node "$HOME\plugins\takomi-flow\scripts\takomi-flow.mjs" doctor
65
+ ```
66
+
67
+ If Git is unavailable, ask the user to download the VibeCode Protocol Suite ZIP and run the installer from the extracted repo. MCP is optional; the CLI works without MCP.
68
+
69
+ ## Agent Tool Surface
70
+
71
+ Prefer MCP tools when they are available in the active Codex session. Use the CLI commands as the stable fallback.
72
+
73
+ MCP tools:
74
+
75
+ - `takomi_flow_capabilities`
76
+ - `takomi_flow_doctor`
77
+ - `takomi_flow_audit`
78
+ - `takomi_flow_examples`
79
+ - `takomi_flow_template`
80
+ - `takomi_flow_prepare`
81
+ - `takomi_flow_workflow`
82
+ - `takomi_flow_validate`
83
+ - `takomi_flow_observe`
84
+ - `takomi_flow_generate`
85
+ - `takomi_flow_selftest`
86
+ - `takomi_flow_inspect`
87
+ - `takomi_flow_latest`
88
+ - `takomi_flow_runs`
89
+ - `takomi_flow_assets`
90
+ - `takomi_flow_review`
91
+ - `takomi_flow_collect`
92
+ - `takomi_flow_report`
93
+
94
+ MCP resources:
95
+
96
+ - `takomi-flow://contract`
97
+ - `takomi-flow://capabilities`
98
+ - `takomi-flow://examples`
99
+ - `takomi-flow://schemas/request`
100
+ - `takomi-flow://schemas/result`
101
+ - `takomi-flow://schemas/collection`
102
+ - `takomi-flow://templates/video`
103
+ - `takomi-flow://templates/image`
104
+
105
+ MCP prompts:
106
+
107
+ - `takomi_flow_video_workflow`
108
+ - `takomi_flow_image_workflow`
109
+ - `takomi_flow_review_workflow`
110
+ - `takomi_flow_collect_workflow`
111
+
112
+ Browser-opening MCP tools require `allowBrowser=true`. Generation still requires request `allowSpend=true` or `TAKOMI_FLOW_ALLOW_SPEND=true` before it can submit.
113
+
114
+ ## Core Rules
115
+
116
+ - Use public Flow UI automation only.
117
+ - Do not bypass captchas, login challenges, quotas, safety checks, rate limits, or hidden endpoints.
118
+ - Prefer headed mode first so the user can handle Google login, consent, quota, and safety prompts.
119
+ - Never submit a paid generation unless the user explicitly requested it and `allowSpend` or `TAKOMI_FLOW_ALLOW_SPEND=true` is set.
120
+ - Keep credentials out of prompts, logs, metadata, and project files.
121
+ - Store run artifacts in a predictable folder and report the exact result paths.
122
+
123
+ ## Commands
124
+
125
+ From the plugin root:
126
+
127
+ ```bash
128
+ node scripts/takomi-flow.mjs bootstrap
129
+ node scripts/takomi-flow.mjs bootstrap --browser-channel chrome
130
+ node scripts/takomi-flow.mjs trusted-chrome
131
+ node scripts/takomi-flow.mjs doctor
132
+ node scripts/takomi-flow.mjs audit
133
+ node scripts/takomi-flow.mjs selftest
134
+ node scripts/takomi-flow.mjs capabilities
135
+ node scripts/takomi-flow.mjs examples
136
+ node scripts/takomi-flow.mjs observe
137
+ node scripts/takomi-flow.mjs smoke
138
+ node scripts/takomi-flow.mjs template --kind video
139
+ node scripts/takomi-flow.mjs prepare --kind video --prompt "cinematic AI lab scene" --variations 2
140
+ node scripts/takomi-flow.mjs workflow --kind video --prompt "cinematic AI lab scene" --variations 2
141
+ node scripts/takomi-flow.mjs validate --request output/takomi-flow/requests/<file>.json
142
+ node scripts/takomi-flow.mjs generate --request output/takomi-flow/requests/<file>.json
143
+ node scripts/takomi-flow.mjs inspect --run output/takomi-flow/<runId>/run.json
144
+ node scripts/takomi-flow.mjs latest --output-dir output/takomi-flow
145
+ node scripts/takomi-flow.mjs runs --output-dir output/takomi-flow --limit 10
146
+ node scripts/takomi-flow.mjs assets --run output/takomi-flow/<runId>/run.json --frames 4
147
+ node scripts/takomi-flow.mjs review --run output/takomi-flow/<runId>/run.json --frames 4
148
+ node scripts/takomi-flow.mjs collect --run output/takomi-flow/<runId>/run.json --target-dir output/pipeline-assets --frames 4 --include-frames
149
+ node scripts/takomi-flow.mjs report --run output/takomi-flow/<runId>/run.json
150
+ node scripts/takomi-flow.mjs report --output-dir output/takomi-flow --limit 10
151
+ ```
152
+
153
+ Important defaults:
154
+
155
+ - Profile dir: `%USERPROFILE%\.takomi-flow\browser-profile`
156
+ - Output dir: `%USERPROFILE%\.takomi-flow\runs`
157
+ - Browser channel: real Chrome by default on Windows/macOS when available
158
+ - Headed mode: enabled by default
159
+ - Spend guard: disabled by default
160
+
161
+ ## Workflow
162
+
163
+ 1. First-run/runtime detection:
164
+ - Run `doctor` first when the installation state is unknown.
165
+ - Check whether `http://127.0.0.1:9222/json/version` is already reachable.
166
+ - If the CDP endpoint is reachable, reuse it with `--cdp-url http://127.0.0.1:9222`.
167
+ - If the CDP endpoint is not reachable, launch `trusted-chrome`.
168
+ - If MCP tools are unavailable, use CLI commands from this plugin root.
169
+ - If the harness has no MCP support, TakomiFlow still works through shell commands.
170
+ 2. Bootstrap login:
171
+ - Prefer `trusted-chrome` for Google login because Google may reject Playwright-launched browsers.
172
+ - Log into Google Flow manually in the opened trusted Chrome window.
173
+ - Keep that Chrome window open and use `--cdp-url http://127.0.0.1:9222` for observe/generate.
174
+ - A signed-in dashboard should show project cards and a `New project` button during `observe`.
175
+ - The project editor prompt textbox currently contains `What do you want to create?`.
176
+ - Prefer video durations `4`, `6`, `8`, or `10` seconds to avoid a Flow follow-up question.
177
+ - Use `bootstrap` only when Google accepts the launched browser.
178
+ - Ask the user to log into Google Flow manually in the opened browser.
179
+ - Do not automate credential entry.
180
+ 3. Doctor check:
181
+ - Run `doctor` before browser work when reliability matters.
182
+ - Report missing Playwright, FFmpeg, profile, or output path issues.
183
+ 4. Readiness audit:
184
+ - Run `audit` when an agent needs safe next actions and gated actions in one payload.
185
+ - Treat missing profile as a login/bootstrap gate, not a script failure.
186
+ 5. Self-test:
187
+ - Run `selftest` after install, after edits, or before trusting TakomiFlow in a new project.
188
+ - Confirm no-spend request preparation, validation, spend guard behavior, and media extraction work.
189
+ 6. Capability discovery:
190
+ - Run `capabilities` when an agent needs supported kinds, modes, request fields, variations, aspect ratios, outputs, and safety rules.
191
+ - Run `examples` or read `takomi-flow://examples` when an agent needs known-good request patterns.
192
+ 7. Observe Flow UI:
193
+ - Run `observe` after bootstrap to capture current Flow controls, text inputs, buttons, screenshots, and manual-action state without submitting generation.
194
+ - Use observation output before changing selectors.
195
+ 8. Smoke check:
196
+ - Run `smoke` to open Flow and save status metadata/screenshots.
197
+ - Confirm no generation was submitted.
198
+ 9. Prepare request:
199
+ - Use `template --kind video` or `template --kind image` when an agent needs a known-good request skeleton.
200
+ - Use `takomi-flow://schemas/request` when an agent needs a machine-readable request shape.
201
+ - Use `takomi-flow://schemas/result` and `takomi-flow://schemas/collection` to consume run metadata and collected outputs.
202
+ - Use `prepare` to create a JSON request for image or video generation.
203
+ - Use `workflow` when an agent should prepare, validate, and optionally submit from one call.
204
+ - Include prompt, variations, aspect ratio, duration, model/mode hints, and output folder.
205
+ - Read `settingsPlan` to see which requested Flow options are automatic versus selector-dependent.
206
+ 10. Validate request:
207
+ - Run `validate --request <file>` before `generate`.
208
+ - Fix failed source assets, invalid kinds, or malformed request JSON before opening Flow.
209
+ - Treat spend-guard warnings as expected unless the user explicitly approved spending credits.
210
+ 11. Generate:
211
+ - Run `generate` only when spend is explicitly allowed.
212
+ - Expect Flow to ask for credit approval; approve only when `allowSpend=true` or the user explicitly approved spending.
213
+ - Stop for manual intervention if the UI asks for login, captcha, quota, safety, or consent.
214
+ - Preserve `settingsPlan` in the run metadata so downstream agents can see requested options.
215
+ 12. Inspect:
216
+ - Read `run.json`, `status.json`, screenshots, and downloaded assets.
217
+ - Record and report `projectUrl` for every created Flow project so future runs can reuse or inspect it.
218
+ - Prefer `runs`, `inspect`, or `latest` for agent-readable summaries.
219
+ - Use `assets --frames 4` to catalog downloaded images/videos and extract review frames.
220
+ - Use `review --frames 4` to combine inspect, asset cataloging, frame extraction, and Markdown report creation.
221
+ - Use `collect` to copy reviewed outputs into a downstream project folder with a manifest.
222
+ - Use `report` to write a Markdown handoff for a single run or recent history.
223
+ - Report successes, errors, and manual next steps.
224
+
225
+ ## Request Shape
226
+
227
+ Read `references/flow-provider-contract.md` before modifying scripts or integrating TakomiFlow into another project.
228
+
229
+ ## Integration Guidance
230
+
231
+ - For a project pipeline, call TakomiFlow as an external provider and pass prompt/settings by JSON file.
232
+ - Keep Flow-specific selectors isolated in `scripts/lib/flow-ui.mjs`.
233
+ - Keep generation follow-up polling, credit approval, and completion/failure detection in `scripts/lib/flow-outcome.mjs`.
234
+ - Keep request/result parsing stable so other agents can use it without reading script internals.
235
+ - If a file approaches 200 lines, split it before adding more responsibilities.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "TakomiFlow"
3
+ short_description: "Safe Google Flow browser automation."
4
+ default_prompt: "Use $takomi-flow to bootstrap, smoke-check, prepare, or run a guarded Google Flow asset generation workflow."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,85 @@
1
+ param(
2
+ [string]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path,
3
+ [string]$UserHome = $HOME,
4
+ [switch]$InstallDependencies,
5
+ [switch]$NoCopy
6
+ )
7
+
8
+ $ErrorActionPreference = 'Stop'
9
+
10
+ function Write-Step($Message) {
11
+ Write-Host "[takomi-flow] $Message"
12
+ }
13
+
14
+ function Copy-Plugin($Source, $Destination) {
15
+ if ($NoCopy) {
16
+ Write-Step "Skipping copy because -NoCopy was set."
17
+ return
18
+ }
19
+ if (Test-Path -LiteralPath $Destination) {
20
+ Remove-Item -LiteralPath $Destination -Recurse -Force
21
+ }
22
+ New-Item -ItemType Directory -Force -Path (Split-Path -Parent $Destination) | Out-Null
23
+ Copy-Item -LiteralPath $Source -Destination $Destination -Recurse
24
+ $nodeModules = Join-Path $Destination 'node_modules'
25
+ if (Test-Path -LiteralPath $nodeModules) {
26
+ Remove-Item -LiteralPath $nodeModules -Recurse -Force
27
+ }
28
+ }
29
+
30
+ function Ensure-Marketplace($MarketplacePath) {
31
+ New-Item -ItemType Directory -Force -Path (Split-Path -Parent $MarketplacePath) | Out-Null
32
+ if (Test-Path -LiteralPath $MarketplacePath) {
33
+ $payload = Get-Content -LiteralPath $MarketplacePath -Raw | ConvertFrom-Json
34
+ } else {
35
+ $payload = [ordered]@{
36
+ name = 'jstarfilmsstudios'
37
+ interface = @{ displayName = 'J StaR Films Studios' }
38
+ plugins = @()
39
+ }
40
+ }
41
+ $entry = [ordered]@{
42
+ name = 'takomi-flow'
43
+ source = @{ source = 'local'; path = './plugins/takomi-flow' }
44
+ policy = @{ installation = 'AVAILABLE'; authentication = 'ON_INSTALL' }
45
+ category = 'Productivity'
46
+ }
47
+ $plugins = @($payload.plugins | Where-Object { $_.name -ne 'takomi-flow' })
48
+ $payload.plugins = @($plugins + $entry)
49
+ $payload | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $MarketplacePath -Encoding UTF8
50
+ }
51
+
52
+ function Install-NodeDeps($PluginPath) {
53
+ if (-not $InstallDependencies) {
54
+ Write-Step "Skipping dependency install. Run with -InstallDependencies when needed."
55
+ return
56
+ }
57
+ Push-Location $PluginPath
58
+ try {
59
+ if (Get-Command pnpm -ErrorAction SilentlyContinue) {
60
+ pnpm install
61
+ } else {
62
+ npm install
63
+ }
64
+ } finally {
65
+ Pop-Location
66
+ }
67
+ }
68
+
69
+ $sourcePlugin = Join-Path $RepoRoot 'plugins/takomi-flow'
70
+ $targetPlugin = Join-Path $UserHome 'plugins/takomi-flow'
71
+ $marketplace = Join-Path $UserHome '.agents/plugins/marketplace.json'
72
+
73
+ if (-not (Test-Path -LiteralPath $sourcePlugin)) {
74
+ throw "TakomiFlow source plugin was not found: $sourcePlugin"
75
+ }
76
+
77
+ Write-Step "Source: $sourcePlugin"
78
+ Write-Step "Target: $targetPlugin"
79
+ Copy-Plugin $sourcePlugin $targetPlugin
80
+ Ensure-Marketplace $marketplace
81
+ Install-NodeDeps $targetPlugin
82
+
83
+ Write-Step "Registered marketplace: $marketplace"
84
+ Write-Step "First run: node $targetPlugin/scripts/takomi-flow.mjs doctor"
85
+ Write-Step "Trusted Chrome: node $targetPlugin/scripts/takomi-flow.mjs trusted-chrome"
@@ -181,7 +181,7 @@ function describeWorkflowPhase(workflow?: OrchestratorTask["workflow"]): string
181
181
  case "vibe-genesis":
182
182
  return "Product framing and blueprint generation";
183
183
  case "vibe-design":
184
- return "Design planning and interaction definition";
184
+ return "UI/UX design, visual system, and interaction definition";
185
185
  case "vibe-build":
186
186
  return "Implementation and delivery";
187
187
  default:
@@ -1,14 +1,14 @@
1
1
  import type { TakomiWorkflowId, WorkflowDefinition } from "./types";
2
2
 
3
- const VIBE_GENESIS_PLAYBOOK = `Genesis fallback summary: author the project foundation in markdown, with PRD, FR issues, coding guidelines, and a clean handoff. For broad projects, Genesis may also create the orchestration session that carries the work into Design and Build. The runtime should prefer .pi/prompts/genesis-prompt.md; this string exists only as a compatibility fallback.`;
4
- const VIBE_DESIGN_PLAYBOOK = `Design fallback summary: define the visual system, mockups, and builder constraints in markdown. The runtime should prefer .pi/prompts/design-prompt.md; this string exists only as a compatibility fallback.`;
3
+ const VIBE_GENESIS_PLAYBOOK = `Genesis fallback summary: author the project foundation in markdown, with PRD, FR issues, coding guidelines, architecture decisions, data models, API contracts, implementation strategy, and a clean handoff. For broad projects, Genesis may also create the orchestration session that carries the work into UI/UX Design and Build. The runtime should prefer .pi/prompts/genesis-prompt.md; this string exists only as a compatibility fallback.`;
4
+ const VIBE_DESIGN_PLAYBOOK = `Design fallback summary: define UI/UX only: visual system, user journeys, interaction flows, mockups, accessibility expectations, and frontend builder constraints in markdown. Technical architecture, data models, and API contracts belong in Genesis or Architect planning. The runtime should prefer .pi/prompts/design-prompt.md; this string exists only as a compatibility fallback.`;
5
5
  const VIBE_BUILD_PLAYBOOK = `Build fallback summary: implement the approved plan with FR-driven work, strict verification, mockup adherence, and explicit handoff reporting. The runtime should prefer .pi/prompts/build-prompt.md; this string exists only as a compatibility fallback.`;
6
6
  export const WORKFLOWS: Record<TakomiWorkflowId, WorkflowDefinition> = {
7
7
  "vibe-genesis": {
8
8
  id: "vibe-genesis",
9
9
  stage: "genesis",
10
10
  title: "Vibe Genesis",
11
- purpose: "Initialize a project with markdown blueprints and a clean handoff into design or build. See .pi/prompts/genesis-prompt.md for the canonical behavior.",
11
+ purpose: "Initialize a project with markdown blueprints, technical planning, and a clean handoff into UI/UX Design or Build. See .pi/prompts/genesis-prompt.md for the canonical behavior.",
12
12
  preferredRole: "architect",
13
13
  preferredAgent: "architect",
14
14
  nextStage: "design",
@@ -18,7 +18,7 @@ export const WORKFLOWS: Record<TakomiWorkflowId, WorkflowDefinition> = {
18
18
  id: "vibe-design",
19
19
  stage: "design",
20
20
  title: "Vibe Design",
21
- purpose: "Define the visual system, sitemap, mockups, and builder constraints before implementation begins. See .pi/prompts/design-prompt.md for the canonical behavior.",
21
+ purpose: "Define UI/UX only: visual system, user journeys, interaction flows, mockups, accessibility expectations, and frontend builder constraints before implementation begins. See .pi/prompts/design-prompt.md for the canonical behavior.",
22
22
  preferredRole: "design",
23
23
  preferredAgent: "designer",
24
24
  preferredModelHint: "Prefer Gemini 3.1 Pro Preview or another strong design-capable model actually available in Pi.",