@noodleseed/one 0.156.0 → 0.158.0

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 (80) hide show
  1. package/README.md +8 -5
  2. package/dist/commands/import.d.ts.map +1 -1
  3. package/dist/commands/import.js +4 -0
  4. package/dist/commands/import.js.map +1 -1
  5. package/dist/commands/local-readiness.d.ts.map +1 -1
  6. package/dist/commands/local-readiness.js +8 -0
  7. package/dist/commands/local-readiness.js.map +1 -1
  8. package/dist/commands/project-setup.d.ts.map +1 -1
  9. package/dist/commands/project-setup.js +83 -47
  10. package/dist/commands/project-setup.js.map +1 -1
  11. package/dist/first-run.d.ts +1 -0
  12. package/dist/first-run.d.ts.map +1 -1
  13. package/dist/first-run.js +119 -46
  14. package/dist/first-run.js.map +1 -1
  15. package/dist/import-scaffold.d.ts +5 -0
  16. package/dist/import-scaffold.d.ts.map +1 -0
  17. package/dist/import-scaffold.js +41 -0
  18. package/dist/import-scaffold.js.map +1 -0
  19. package/dist/mcp-import.d.ts.map +1 -1
  20. package/dist/mcp-import.js +18 -15
  21. package/dist/mcp-import.js.map +1 -1
  22. package/dist/openapi-import.d.ts.map +1 -1
  23. package/dist/openapi-import.js +68 -43
  24. package/dist/openapi-import.js.map +1 -1
  25. package/dist/plugin-mode/plugin-operation-contract.d.ts +142 -3
  26. package/dist/plugin-mode/plugin-operation-contract.d.ts.map +1 -1
  27. package/dist/plugin-mode/plugin-operation-contract.js +13 -2
  28. package/dist/plugin-mode/plugin-operation-contract.js.map +1 -1
  29. package/dist/plugin-mode/plugin-operation-tools.d.ts.map +1 -1
  30. package/dist/plugin-mode/plugin-operation-tools.js +27 -8
  31. package/dist/plugin-mode/plugin-operation-tools.js.map +1 -1
  32. package/dist/project-bootstrap-install.d.ts +14 -0
  33. package/dist/project-bootstrap-install.d.ts.map +1 -0
  34. package/dist/project-bootstrap-install.js +73 -0
  35. package/dist/project-bootstrap-install.js.map +1 -0
  36. package/dist/project-bootstrap-launch.d.ts +27 -0
  37. package/dist/project-bootstrap-launch.d.ts.map +1 -0
  38. package/dist/project-bootstrap-launch.js +64 -0
  39. package/dist/project-bootstrap-launch.js.map +1 -0
  40. package/dist/project-bootstrap-process.d.ts +19 -0
  41. package/dist/project-bootstrap-process.d.ts.map +1 -0
  42. package/dist/project-bootstrap-process.js +60 -0
  43. package/dist/project-bootstrap-process.js.map +1 -0
  44. package/dist/project-bootstrap-report.d.ts +55 -0
  45. package/dist/project-bootstrap-report.d.ts.map +1 -0
  46. package/dist/project-bootstrap-report.js +30 -0
  47. package/dist/project-bootstrap-report.js.map +1 -0
  48. package/dist/project-bootstrap-state.d.ts +87 -0
  49. package/dist/project-bootstrap-state.d.ts.map +1 -0
  50. package/dist/project-bootstrap-state.js +125 -0
  51. package/dist/project-bootstrap-state.js.map +1 -0
  52. package/dist/project-bootstrap.d.ts +36 -0
  53. package/dist/project-bootstrap.d.ts.map +1 -0
  54. package/dist/project-bootstrap.js +243 -0
  55. package/dist/project-bootstrap.js.map +1 -0
  56. package/dist/project-scaffold-templates.d.ts +1 -1
  57. package/dist/project-scaffold-templates.d.ts.map +1 -1
  58. package/dist/project-scaffold-templates.js +17 -12
  59. package/dist/project-scaffold-templates.js.map +1 -1
  60. package/dist/project-toolchain.d.ts +13 -0
  61. package/dist/project-toolchain.d.ts.map +1 -0
  62. package/dist/project-toolchain.js +73 -0
  63. package/dist/project-toolchain.js.map +1 -0
  64. package/dist/project.d.ts +2 -0
  65. package/dist/project.d.ts.map +1 -1
  66. package/dist/project.js +40 -9
  67. package/dist/project.js.map +1 -1
  68. package/dist/widget-scaffold-template.d.ts.map +1 -1
  69. package/dist/widget-scaffold-template.js +5 -10
  70. package/dist/widget-scaffold-template.js.map +1 -1
  71. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +2 -2
  72. package/node_modules/@noodle-borg/agent-kit/dist/plugin-bootstrap-skill.js +2 -1
  73. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +3 -2
  74. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  75. package/node_modules/@noodle-borg/assistant-gateway/package.json +1 -1
  76. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-bootstrap-authoring.js +1 -1
  77. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-bootstrap-pre-auth.js +26 -4
  78. package/node_modules/@noodle-borg/service/package.json +1 -1
  79. package/node_modules/@noodleseed/assistant/package.json +1 -1
  80. package/package.json +2 -2
@@ -0,0 +1,14 @@
1
+ import { type ProjectPackageManager } from './project-toolchain.js';
2
+ /** Inspect dependency metadata only; never read dotenv files or return raw parse errors. */
3
+ export declare function readBootstrapManifest(project: string): {
4
+ packageManager?: string | undefined;
5
+ dependencies?: Record<string, string> | undefined;
6
+ devDependencies?: Record<string, string> | undefined;
7
+ scripts?: Record<string, string> | undefined;
8
+ } | undefined;
9
+ export declare function bootstrapLockfiles(project: string): string[];
10
+ export declare function bootstrapDependencyFingerprint(project: string): string;
11
+ /** The dependency must be installed in this project, not discovered through a parent/global fallback. */
12
+ export declare function installedBootstrapCli(project: string, version: string): string | undefined;
13
+ export declare function hasCompletedBootstrapLock(project: string, manager: ProjectPackageManager): boolean;
14
+ //# sourceMappingURL=project-bootstrap-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-install.d.ts","sourceRoot":"","sources":["../src/project-bootstrap-install.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AASvF,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM;;;;;cAYpD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAa5D;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAWtE;AAED,yGAAyG;AACzG,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAe1F;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAIT"}
@@ -0,0 +1,73 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { lstatSync, readFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { z } from 'zod';
5
+ import { PROJECT_LOCKFILES } from './project-toolchain.js';
6
+ const manifestSchema = z.object({
7
+ packageManager: z.string().optional(),
8
+ dependencies: z.record(z.string(), z.string()).optional(),
9
+ devDependencies: z.record(z.string(), z.string()).optional(),
10
+ scripts: z.record(z.string(), z.string()).optional(),
11
+ });
12
+ /** Inspect dependency metadata only; never read dotenv files or return raw parse errors. */
13
+ export function readBootstrapManifest(project) {
14
+ const file = join(project, 'package.json');
15
+ try {
16
+ const stat = lstatSync(file);
17
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 1024 * 1024)
18
+ throw new Error();
19
+ return manifestSchema.parse(JSON.parse(readFileSync(file, 'utf8')));
20
+ }
21
+ catch (error) {
22
+ if (error.code === 'ENOENT')
23
+ return undefined;
24
+ throw new Error('Project package.json is unreadable or invalid; preserve and repair it before setup.');
25
+ }
26
+ }
27
+ export function bootstrapLockfiles(project) {
28
+ return Object.keys(PROJECT_LOCKFILES).filter((name) => {
29
+ try {
30
+ const stat = lstatSync(join(project, name));
31
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 8 * 1024 * 1024)
32
+ throw new Error();
33
+ return true;
34
+ }
35
+ catch (error) {
36
+ if (error.code === 'ENOENT')
37
+ return false;
38
+ throw new Error('Project lockfile is unreadable or unsafe; preserve and repair it before setup.');
39
+ }
40
+ });
41
+ }
42
+ export function bootstrapDependencyFingerprint(project) {
43
+ const hash = createHash('sha256');
44
+ readBootstrapManifest(project);
45
+ for (const name of ['package.json', ...bootstrapLockfiles(project).sort()]) {
46
+ hash
47
+ .update(name)
48
+ .update('\0')
49
+ .update(readFileSync(join(project, name)))
50
+ .update('\0');
51
+ }
52
+ return hash.digest('hex');
53
+ }
54
+ /** The dependency must be installed in this project, not discovered through a parent/global fallback. */
55
+ export function installedBootstrapCli(project, version) {
56
+ const root = join(project, 'node_modules/@noodleseed/one');
57
+ try {
58
+ const raw = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
59
+ if (raw.name !== '@noodleseed/one' ||
60
+ raw.version !== version ||
61
+ raw.bin?.noodle !== 'dist/bin.js')
62
+ return undefined;
63
+ const bin = join(root, 'dist/bin.js');
64
+ return lstatSync(bin).isFile() ? bin : undefined;
65
+ }
66
+ catch {
67
+ return undefined;
68
+ }
69
+ }
70
+ export function hasCompletedBootstrapLock(project, manager) {
71
+ return bootstrapLockfiles(project).some((name) => PROJECT_LOCKFILES[name] === manager && lstatSync(join(project, name)).size > 0);
72
+ }
73
+ //# sourceMappingURL=project-bootstrap-install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-install.js","sourceRoot":"","sources":["../src/project-bootstrap-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAA8B,MAAM,wBAAwB,CAAC;AAEvF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACzD,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAA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,EAAE,aAAa,CAAC,CAAC;QACtC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAe,EACf,OAA8B;IAE9B,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,IAAI,CACrC,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CACzF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { spawn } from 'node:child_process';
2
+ import type { AgentTarget } from '@noodle-borg/agent-kit';
3
+ export type BootstrapLaunchTarget = AgentTarget | 'none';
4
+ type LaunchResult = {
5
+ readonly ok: true;
6
+ } | {
7
+ readonly ok: false;
8
+ readonly code: 'missing_executable' | 'command_failed';
9
+ };
10
+ type LaunchChild = Pick<ReturnType<typeof spawn>, 'once'>;
11
+ type LaunchSpawn = (command: string, args: string[], options: {
12
+ cwd: string;
13
+ env: NodeJS.ProcessEnv;
14
+ stdio: 'inherit';
15
+ }) => LaunchChild;
16
+ export declare function isRunningCodingAgent(env: NodeJS.ProcessEnv): boolean;
17
+ /** Offered only after a new project passes; cancelling keeps the ready project intact. */
18
+ export declare function chooseBootstrapAgent(agents: readonly AgentTarget[], env: NodeJS.ProcessEnv): Promise<BootstrapLaunchTarget>;
19
+ export declare function assertBootstrapLaunchAllowed(target: BootstrapLaunchTarget, agents: readonly AgentTarget[], interactive: boolean, env: NodeJS.ProcessEnv, install: boolean): void;
20
+ export declare function bootstrapLaunchCommand(target: AgentTarget): {
21
+ command: string;
22
+ args: string[];
23
+ };
24
+ /** Explicit interactive handoff. No install, shell, saved-session reuse, model or permission override. */
25
+ export declare function launchBootstrapAgent(target: AgentTarget, project: string, env: NodeJS.ProcessEnv, spawnAgent?: LaunchSpawn): Promise<LaunchResult>;
26
+ export {};
27
+ //# sourceMappingURL=project-bootstrap-launch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-launch.d.ts","sourceRoot":"","sources":["../src/project-bootstrap-launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG,MAAM,CAAC;AACzD,KAAK,YAAY,GACb;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,gBAAgB,CAAA;CAAE,CAAC;AACnF,KAAK,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1D,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,KAC/D,WAAW,CAAC;AAEjB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAEpE;AAED,0FAA0F;AAC1F,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,OAAO,CAAC,qBAAqB,CAAC,CA4BhC;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,WAAW,EAAE,OAAO,EACpB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,OAAO,EAAE,OAAO,GACf,IAAI,CAkBN;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAO/F;AAED,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,UAAU,GAAE,WAAmB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAavB"}
@@ -0,0 +1,64 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { commandOnPath } from './agent-command-context.js';
3
+ import { confirm, select } from './prompts.js';
4
+ export function isRunningCodingAgent(env) {
5
+ return Boolean(env.NOODLE_PLUGIN_HOST || env.CODEX_THREAD_ID || env.CLAUDECODE);
6
+ }
7
+ /** Offered only after a new project passes; cancelling keeps the ready project intact. */
8
+ export async function chooseBootstrapAgent(agents, env) {
9
+ const detected = agents.filter((target) => commandOnPath(target === 'codex' ? 'codex' : 'claude', env));
10
+ if (!detected.length)
11
+ return 'none';
12
+ try {
13
+ const choices = [
14
+ ...detected.map((target) => ({
15
+ value: target,
16
+ label: target === 'codex' ? 'Codex' : 'Claude Code',
17
+ })),
18
+ { value: 'none', label: 'Not now' },
19
+ ];
20
+ const choice = await select('Local checks passed. Start a fresh coding-agent session?', choices, { initial: choices.length - 1 });
21
+ if (choice === 'none')
22
+ return 'none';
23
+ return (await confirm('Start the selected installed agent in this project with its normal permissions?', { initial: false }))
24
+ ? choice
25
+ : 'none';
26
+ }
27
+ catch {
28
+ return 'none';
29
+ }
30
+ }
31
+ export function assertBootstrapLaunchAllowed(target, agents, interactive, env, install) {
32
+ if (target === 'none')
33
+ return;
34
+ if (!interactive)
35
+ throw new Error('Fresh agent launch requires an interactive terminal; omit --launch in JSON/CI.');
36
+ if (isRunningCodingAgent(env))
37
+ throw new Error('Do not launch recursively from a running agent; read the new project context or start a fresh session yourself.');
38
+ if (!agents.includes(target))
39
+ throw new Error('Fresh agent launch requires its generated context; include the selected --agents target.');
40
+ if (!install)
41
+ throw new Error('Fresh agent launch requires completed local verification; remove --no-install.');
42
+ }
43
+ export function bootstrapLaunchCommand(target) {
44
+ return {
45
+ command: target === 'codex' ? 'codex' : 'claude',
46
+ args: [
47
+ 'Read AGENTS.md, the Noodle project skill and its routed references, and the generated project README before doing anything. Local synthetic starter checks have passed; the real customer application and hosted deployment are not verified. Do not read secrets or assume production permissions. Ask me which existing application and end-user workflow to integrate, then reuse the maintained recipes and their acceptance tests.',
48
+ ],
49
+ };
50
+ }
51
+ /** Explicit interactive handoff. No install, shell, saved-session reuse, model or permission override. */
52
+ export function launchBootstrapAgent(target, project, env, spawnAgent = spawn) {
53
+ const command = bootstrapLaunchCommand(target);
54
+ return new Promise((resolve) => {
55
+ const child = spawnAgent(command.command, command.args, {
56
+ cwd: project,
57
+ env,
58
+ stdio: 'inherit',
59
+ });
60
+ child.once('error', () => resolve({ ok: false, code: 'missing_executable' }));
61
+ child.once('close', (code) => resolve(code === 0 ? { ok: true } : { ok: false, code: 'command_failed' }));
62
+ });
63
+ }
64
+ //# sourceMappingURL=project-bootstrap-launch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-launch.js","sourceRoot":"","sources":["../src/project-bootstrap-launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAa/C,MAAM,UAAU,oBAAoB,CAAC,GAAsB;IACzD,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC,eAAe,I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,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAC3E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type BootstrapProcessCode = 'command_failed' | 'command_timeout' | 'missing_executable' | 'cancelled';
2
+ export type BootstrapProcessResult = {
3
+ readonly ok: true;
4
+ readonly stdout: string;
5
+ } | {
6
+ readonly ok: false;
7
+ readonly code: BootstrapProcessCode;
8
+ readonly stdout: '';
9
+ };
10
+ export interface BootstrapProcessOptions {
11
+ readonly cwd: string;
12
+ readonly env: NodeJS.ProcessEnv;
13
+ readonly timeoutMs?: number;
14
+ readonly maxOutputBytes?: number;
15
+ }
16
+ export type BootstrapExecutor = (command: string, args: readonly string[], options: BootstrapProcessOptions) => Promise<BootstrapProcessResult>;
17
+ /** No shell, bounded output/time, and no failed stdout/stderr reflected into recovery data. */
18
+ export declare const runBootstrapProcess: BootstrapExecutor;
19
+ //# sourceMappingURL=project-bootstrap-process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-process.d.ts","sourceRoot":"","sources":["../src/project-bootstrap-process.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,iBAAiB,GACjB,oBAAoB,GACpB,WAAW,CAAC;AAChB,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC9C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAA;CAAE,CAAC;AACrF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AACD,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,uBAAuB,KAC7B,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAErC,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,EAAE,iBAuD9B,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { spawn } from 'node:child_process';
2
+ /** No shell, bounded output/time, and no failed stdout/stderr reflected into recovery data. */
3
+ export const runBootstrapProcess = (command, args, options) => new Promise((resolve) => {
4
+ const child = spawn(command, [...args], {
5
+ cwd: options.cwd,
6
+ env: options.env,
7
+ detached: true,
8
+ stdio: ['ignore', 'pipe', 'pipe'],
9
+ });
10
+ let done = false;
11
+ let stopped;
12
+ let output = '';
13
+ let bytes = 0;
14
+ let force;
15
+ const kill = (signal) => {
16
+ if (child.pid !== undefined) {
17
+ // Signal only the process group we created, including ordinary child processes.
18
+ try {
19
+ process.kill(-child.pid, signal);
20
+ }
21
+ catch { }
22
+ }
23
+ };
24
+ const stop = (code) => {
25
+ if (stopped || done)
26
+ return;
27
+ stopped = code;
28
+ kill('SIGTERM');
29
+ force = setTimeout(() => kill('SIGKILL'), 1_000);
30
+ };
31
+ const timer = setTimeout(() => stop('command_timeout'), options.timeoutMs ?? 180_000);
32
+ const interrupt = () => stop('cancelled');
33
+ process.once('SIGINT', interrupt);
34
+ process.once('SIGTERM', interrupt);
35
+ const finish = (result) => {
36
+ if (done)
37
+ return;
38
+ done = true;
39
+ clearTimeout(timer);
40
+ if (force)
41
+ clearTimeout(force);
42
+ process.removeListener('SIGINT', interrupt);
43
+ process.removeListener('SIGTERM', interrupt);
44
+ resolve(result);
45
+ };
46
+ const capture = (chunk, stdout) => {
47
+ bytes += chunk.byteLength;
48
+ if (bytes > (options.maxOutputBytes ?? 1024 * 1024))
49
+ stop('command_failed');
50
+ else if (stdout && !stopped)
51
+ output += chunk.toString('utf8');
52
+ };
53
+ child.stdout?.on('data', (chunk) => capture(chunk, true));
54
+ child.stderr?.on('data', (chunk) => capture(chunk, false));
55
+ child.once('error', () => finish({ ok: false, code: 'missing_executable', stdout: '' }));
56
+ child.once('close', (code) => finish(code === 0 && !stopped
57
+ ? { ok: true, stdout: output }
58
+ : { ok: false, code: stopped ?? 'command_failed', stdout: '' }));
59
+ });
60
+ //# sourceMappingURL=project-bootstrap-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-process.js","sourceRoot":"","sources":["../src/project-bootstrap-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAsB3C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAC/E,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACtC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IACH,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,OAAyC,CAAC;IAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAgD,CAAC;IACrD,MAAM,IAAI,GAAG,CAAC,MAAsB,EAAE,EAAE;QACtC,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAC5B,gFAAgF;YAChF,IAAI,CAAC;gBACH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KAAK,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,IAAI,GAAG,IAAI,CAAC;YAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACvE,IAAI,MAAM,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC,CAAC;IACF,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACzF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAC3B,MAAM,CACJ,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO;QACpB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;QAC9B,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,CACjE,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import type { NextCommand } from './commands/output.js';
3
+ /** Shared, bounded progress projection: no customer values, child logs, or arbitrary commands. */
4
+ export declare const bootstrapStatusSchema: z.ZodObject<{
5
+ ready: z.ZodBoolean;
6
+ packageManager: z.ZodEnum<{
7
+ npm: "npm";
8
+ pnpm: "pnpm";
9
+ yarn: "yarn";
10
+ }>;
11
+ completed: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
12
+ context: "context";
13
+ behavior: "behavior";
14
+ validate: "validate";
15
+ install: "install";
16
+ scaffold: "scaffold";
17
+ types: "types";
18
+ launch: "launch";
19
+ }>>>;
20
+ failed: z.ZodOptional<z.ZodObject<{
21
+ stage: z.ZodEnum<{
22
+ context: "context";
23
+ behavior: "behavior";
24
+ validate: "validate";
25
+ install: "install";
26
+ scaffold: "scaffold";
27
+ types: "types";
28
+ launch: "launch";
29
+ }>;
30
+ code: z.ZodEnum<{
31
+ command_failed: "command_failed";
32
+ cancelled: "cancelled";
33
+ missing_executable: "missing_executable";
34
+ command_timeout: "command_timeout";
35
+ context_invalid: "context_invalid";
36
+ verification_failed: "verification_failed";
37
+ dependency_mismatch: "dependency_mismatch";
38
+ configuration_conflict: "configuration_conflict";
39
+ package_manager_unsupported: "package_manager_unsupported";
40
+ }>;
41
+ }, z.core.$strict>>;
42
+ restartRequired: z.ZodBoolean;
43
+ proof: z.ZodEnum<{
44
+ unverified: "unverified";
45
+ "local-synthetic": "local-synthetic";
46
+ }>;
47
+ }, z.core.$strip>;
48
+ export type BootstrapStatus = z.infer<typeof bootstrapStatusSchema>;
49
+ export interface BootstrapReport extends BootstrapStatus {
50
+ readonly resumeCommand: string;
51
+ readonly nextSteps: readonly NextCommand[];
52
+ }
53
+ /** A zero exit code alone is not the CLI's machine-readable success contract. */
54
+ export declare function bootstrapJsonSucceeded(stdout: string): boolean;
55
+ //# sourceMappingURL=project-bootstrap-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-report.d.ts","sourceRoot":"","sources":["../src/project-bootstrap-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,kGAAkG;AAClG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB/B,CAAC;AACJ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,SAAS,WAAW,EAAE,CAAC;CAC5C;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAO9D"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { BOOTSTRAP_STAGES, bootstrapFailureSchema } from './project-bootstrap-state.js';
3
+ /** Shared, bounded progress projection: no customer values, child logs, or arbitrary commands. */
4
+ export const bootstrapStatusSchema = z
5
+ .object({
6
+ ready: z.boolean(),
7
+ packageManager: z.enum(['npm', 'pnpm', 'yarn']),
8
+ completed: z.array(z.enum(BOOTSTRAP_STAGES)).max(BOOTSTRAP_STAGES.length).readonly(),
9
+ failed: bootstrapFailureSchema.optional(),
10
+ restartRequired: z.boolean(),
11
+ proof: z.enum(['local-synthetic', 'unverified']),
12
+ })
13
+ .refine((status) => new Set(status.completed).size === status.completed.length &&
14
+ (!status.failed || !status.completed.includes(status.failed.stage)) &&
15
+ (status.ready
16
+ ? status.proof === 'local-synthetic' &&
17
+ ['scaffold', 'install', 'validate', 'behavior', 'types'].every((stage) => status.completed.some((value) => value === stage)) &&
18
+ !status.failed
19
+ : status.proof === 'unverified'));
20
+ /** A zero exit code alone is not the CLI's machine-readable success contract. */
21
+ export function bootstrapJsonSucceeded(stdout) {
22
+ try {
23
+ const value = JSON.parse(stdout);
24
+ return typeof value === 'object' && value !== null && 'ok' in value && value.ok === true;
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ }
30
+ //# sourceMappingURL=project-bootstrap-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootst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EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,CAClD;YACD,CAAC,MAAM,CAAC,MAAM;QAChB,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,CACrC,CAAC;AAOJ,iFAAiF;AACjF,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,IAAI,CAAC;QACH,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { z } from 'zod';
2
+ export declare const BOOTSTRAP_STAGES: readonly ["scaffold", "install", "context", "validate", "behavior", "types", "launch"];
3
+ export type BootstrapStage = (typeof BOOTSTRAP_STAGES)[number];
4
+ export declare const bootstrapFailureSchema: z.ZodObject<{
5
+ stage: z.ZodEnum<{
6
+ context: "context";
7
+ behavior: "behavior";
8
+ validate: "validate";
9
+ install: "install";
10
+ scaffold: "scaffold";
11
+ types: "types";
12
+ launch: "launch";
13
+ }>;
14
+ code: z.ZodEnum<{
15
+ command_failed: "command_failed";
16
+ cancelled: "cancelled";
17
+ missing_executable: "missing_executable";
18
+ command_timeout: "command_timeout";
19
+ context_invalid: "context_invalid";
20
+ verification_failed: "verification_failed";
21
+ dependency_mismatch: "dependency_mismatch";
22
+ configuration_conflict: "configuration_conflict";
23
+ package_manager_unsupported: "package_manager_unsupported";
24
+ }>;
25
+ }, z.core.$strict>;
26
+ declare const stateSchema: z.ZodObject<{
27
+ schemaVersion: z.ZodLiteral<1>;
28
+ cliVersion: z.ZodString;
29
+ packageManager: z.ZodEnum<{
30
+ npm: "npm";
31
+ pnpm: "pnpm";
32
+ yarn: "yarn";
33
+ }>;
34
+ managerVersion: z.ZodOptional<z.ZodString>;
35
+ launchedAgent: z.ZodOptional<z.ZodEnum<{
36
+ codex: "codex";
37
+ "claude-code": "claude-code";
38
+ }>>;
39
+ completed: z.ZodArray<z.ZodEnum<{
40
+ context: "context";
41
+ behavior: "behavior";
42
+ validate: "validate";
43
+ install: "install";
44
+ scaffold: "scaffold";
45
+ types: "types";
46
+ launch: "launch";
47
+ }>>;
48
+ inProgress: z.ZodOptional<z.ZodEnum<{
49
+ context: "context";
50
+ behavior: "behavior";
51
+ validate: "validate";
52
+ install: "install";
53
+ scaffold: "scaffold";
54
+ types: "types";
55
+ launch: "launch";
56
+ }>>;
57
+ failed: z.ZodOptional<z.ZodObject<{
58
+ stage: z.ZodEnum<{
59
+ context: "context";
60
+ behavior: "behavior";
61
+ validate: "validate";
62
+ install: "install";
63
+ scaffold: "scaffold";
64
+ types: "types";
65
+ launch: "launch";
66
+ }>;
67
+ code: z.ZodEnum<{
68
+ command_failed: "command_failed";
69
+ cancelled: "cancelled";
70
+ missing_executable: "missing_executable";
71
+ command_timeout: "command_timeout";
72
+ context_invalid: "context_invalid";
73
+ verification_failed: "verification_failed";
74
+ dependency_mismatch: "dependency_mismatch";
75
+ configuration_conflict: "configuration_conflict";
76
+ package_manager_unsupported: "package_manager_unsupported";
77
+ }>;
78
+ }, z.core.$strict>>;
79
+ dependencyFingerprint: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strict>;
81
+ export type BootstrapState = Readonly<Omit<z.infer<typeof stateSchema>, 'completed'>> & {
82
+ readonly completed: readonly BootstrapStage[];
83
+ };
84
+ export declare function readBootstrapState(project: string): BootstrapState | undefined;
85
+ export declare function writeBootstrapState(project: string, state: BootstrapState): void;
86
+ export {};
87
+ //# sourceMappingURL=project-bootstrap-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-state.d.ts","sourceRoot":"","sources":["../src/project-bootstrap-state.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,wFAQnB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;kBAajC,CAAC;AAKH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqBd,CAAC;AACJ,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC,GAAG;IACtF,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;CAC/C,CAAC;AAgBF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CA4B9E;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAgBhF"}
@@ -0,0 +1,125 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { z } from 'zod';
5
+ export const BOOTSTRAP_STAGES = [
6
+ 'scaffold',
7
+ 'install',
8
+ 'context',
9
+ 'validate',
10
+ 'behavior',
11
+ 'types',
12
+ 'launch',
13
+ ];
14
+ const stageSchema = z.enum(BOOTSTRAP_STAGES);
15
+ export const bootstrapFailureSchema = z.strictObject({
16
+ stage: stageSchema,
17
+ code: z.enum([
18
+ 'command_failed',
19
+ 'command_timeout',
20
+ 'missing_executable',
21
+ 'context_invalid',
22
+ 'verification_failed',
23
+ 'dependency_mismatch',
24
+ 'configuration_conflict',
25
+ 'package_manager_unsupported',
26
+ 'cancelled',
27
+ ]),
28
+ });
29
+ const versionSchema = z
30
+ .string()
31
+ .max(128)
32
+ .regex(/^\d+\.\d+\.\d+(?:[-+][\w.+-]+)?$/);
33
+ const stateSchema = z
34
+ .object({
35
+ schemaVersion: z.literal(1),
36
+ cliVersion: versionSchema,
37
+ packageManager: z.enum(['npm', 'pnpm', 'yarn']),
38
+ managerVersion: versionSchema.optional(),
39
+ launchedAgent: z.enum(['codex', 'claude-code']).optional(),
40
+ completed: z.array(stageSchema).max(BOOTSTRAP_STAGES.length),
41
+ inProgress: stageSchema.optional(),
42
+ failed: bootstrapFailureSchema.optional(),
43
+ dependencyFingerprint: z
44
+ .string()
45
+ .regex(/^[a-f0-9]{64}$/)
46
+ .optional(),
47
+ })
48
+ .strict()
49
+ .refine((state) => new Set(state.completed).size === state.completed.length &&
50
+ (!state.inProgress || !state.completed.includes(state.inProgress)) &&
51
+ (!state.failed || !state.completed.includes(state.failed.stage)));
52
+ const MAX_STATE_BYTES = 16 * 1024;
53
+ const stateError = () => new Error('Bootstrap state is unreadable or not owned by this setup format.');
54
+ function stateDirectory(project) {
55
+ const path = join(project, '.noodle');
56
+ try {
57
+ const stat = lstatSync(path);
58
+ if (!stat.isDirectory() || stat.isSymbolicLink())
59
+ throw stateError();
60
+ }
61
+ catch (error) {
62
+ if (error.code !== 'ENOENT')
63
+ throw stateError();
64
+ }
65
+ return path;
66
+ }
67
+ export function readBootstrapState(project) {
68
+ let descriptor;
69
+ try {
70
+ const path = join(stateDirectory(project), 'setup.json');
71
+ try {
72
+ descriptor = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
73
+ }
74
+ catch (error) {
75
+ if (error.code === 'ENOENT')
76
+ return undefined;
77
+ throw stateError();
78
+ }
79
+ const stat = fstatSync(descriptor);
80
+ if (!stat.isFile() || stat.size > MAX_STATE_BYTES)
81
+ throw stateError();
82
+ const buffer = Buffer.alloc(MAX_STATE_BYTES + 1);
83
+ let length = 0;
84
+ while (length < buffer.length) {
85
+ const count = readSync(descriptor, buffer, length, buffer.length - length, length);
86
+ if (count === 0)
87
+ break;
88
+ length += count;
89
+ }
90
+ if (length > MAX_STATE_BYTES)
91
+ throw stateError();
92
+ const parsed = stateSchema.safeParse(JSON.parse(buffer.subarray(0, length).toString('utf8')));
93
+ if (!parsed.success)
94
+ throw stateError();
95
+ return parsed.data;
96
+ }
97
+ catch {
98
+ throw stateError();
99
+ }
100
+ finally {
101
+ if (descriptor !== undefined)
102
+ closeSync(descriptor);
103
+ }
104
+ }
105
+ export function writeBootstrapState(project, state) {
106
+ const parsed = stateSchema.safeParse(state);
107
+ if (!parsed.success)
108
+ throw stateError();
109
+ // A malformed/unowned existing record is never treated as permission to replace it.
110
+ readBootstrapState(project);
111
+ const directory = stateDirectory(project);
112
+ mkdirSync(directory, { recursive: true, mode: 0o700 });
113
+ const temporary = join(directory, `.setup-${randomBytes(12).toString('hex')}.tmp`);
114
+ try {
115
+ writeFileSync(temporary, `${JSON.stringify(parsed.data)}\n`, { mode: 0o600, flag: 'wx' });
116
+ renameSync(temporary, join(directory, 'setup.json'));
117
+ }
118
+ catch {
119
+ throw stateError();
120
+ }
121
+ finally {
122
+ rmSync(temporary, { force: true });
123
+ }
124
+ }
125
+ //# sourceMappingURL=project-bootstrap-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-bootstrap-state.js","sourceRoot":"","sources":["../src/project-bootstrap-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU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