intentdna 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +227 -87
  4. package/dist/cli/commands/run-lifecycle.d.ts +61 -11
  5. package/dist/cli/commands/run-lifecycle.js +184 -50
  6. package/dist/cli/commands/run-observer.d.ts +15 -0
  7. package/dist/cli/commands/run-observer.js +210 -0
  8. package/dist/cli/commands/run.d.ts +16 -20
  9. package/dist/cli/commands/run.js +461 -659
  10. package/dist/cli/commands/sync.js +16 -12
  11. package/dist/cli/index.js +14 -5
  12. package/dist/compiler/compile.d.ts +1 -0
  13. package/dist/compiler/compile.js +1 -1
  14. package/dist/compiler/controller.d.ts +16 -0
  15. package/dist/compiler/controller.js +693 -0
  16. package/dist/compiler/input-resolver.d.ts +2 -0
  17. package/dist/compiler/input-resolver.js +22 -6
  18. package/dist/hooks/cli.d.ts +45 -0
  19. package/dist/hooks/cli.js +263 -31
  20. package/dist/hooks/host-event.d.ts +57 -0
  21. package/dist/hooks/host-event.js +187 -0
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/index.js +1 -0
  24. package/dist/hooks/protocol.d.ts +7 -0
  25. package/dist/hooks/schema.d.ts +1 -0
  26. package/dist/hooks/schema.js +89 -1
  27. package/dist/hooks/state.d.ts +23 -1
  28. package/dist/hooks/state.js +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/mcp/index.js +2 -0
  32. package/dist/mcp/tools-run.d.ts +4 -0
  33. package/dist/mcp/tools-run.js +419 -0
  34. package/dist/mcp/tools-state.d.ts +1 -1
  35. package/dist/mcp/tools-state.js +13 -241
  36. package/dist/runtime/artifact-store.d.ts +146 -0
  37. package/dist/runtime/artifact-store.js +1436 -0
  38. package/dist/runtime/canonical-attempt-outcome.d.ts +12 -0
  39. package/dist/runtime/canonical-attempt-outcome.js +195 -0
  40. package/dist/runtime/canonical-json.d.ts +10 -0
  41. package/dist/runtime/canonical-json.js +105 -0
  42. package/dist/runtime/canonical-run-application.d.ts +93 -0
  43. package/dist/runtime/canonical-run-application.js +229 -0
  44. package/dist/runtime/canonical-run-service.d.ts +454 -0
  45. package/dist/runtime/canonical-run-service.js +4760 -0
  46. package/dist/runtime/canonical-runtime-composition.d.ts +22 -0
  47. package/dist/runtime/canonical-runtime-composition.js +34 -0
  48. package/dist/runtime/canonical-runtime-projection.d.ts +3 -0
  49. package/dist/runtime/canonical-runtime-projection.js +4 -0
  50. package/dist/runtime/canonical-target-compiler.d.ts +46 -0
  51. package/dist/runtime/canonical-target-compiler.js +514 -0
  52. package/dist/runtime/claude-agent-identity.d.ts +2 -0
  53. package/dist/runtime/claude-agent-identity.js +21 -0
  54. package/dist/runtime/executable-run-plan.d.ts +328 -0
  55. package/dist/runtime/executable-run-plan.js +1485 -0
  56. package/dist/runtime/execution-authority.d.ts +83 -0
  57. package/dist/runtime/execution-authority.js +98 -0
  58. package/dist/runtime/handoff-resolver.js +4 -1
  59. package/dist/runtime/harness-pull-adapter.d.ts +146 -0
  60. package/dist/runtime/harness-pull-adapter.js +315 -0
  61. package/dist/runtime/index.d.ts +39 -14
  62. package/dist/runtime/index.js +29 -7
  63. package/dist/runtime/local-execution-authority.d.ts +194 -0
  64. package/dist/runtime/local-execution-authority.js +2877 -0
  65. package/dist/runtime/local-execution-reconciliation.d.ts +20 -0
  66. package/dist/runtime/local-execution-reconciliation.js +107 -0
  67. package/dist/runtime/local-execution-supervisor-script.d.ts +7 -0
  68. package/dist/runtime/local-execution-supervisor-script.js +793 -0
  69. package/dist/runtime/local-provider-sandbox.d.ts +42 -0
  70. package/dist/runtime/local-provider-sandbox.js +154 -0
  71. package/dist/runtime/local-verifier-execution.d.ts +24 -0
  72. package/dist/runtime/local-verifier-execution.js +290 -0
  73. package/dist/runtime/local-windows-execution-supervisor-script.d.ts +6 -0
  74. package/dist/runtime/local-windows-execution-supervisor-script.js +771 -0
  75. package/dist/runtime/plan-store.d.ts +30 -0
  76. package/dist/runtime/plan-store.js +231 -0
  77. package/dist/runtime/process-tree.d.ts +9 -0
  78. package/dist/runtime/process-tree.js +97 -24
  79. package/dist/runtime/push-driver.d.ts +184 -0
  80. package/dist/runtime/push-driver.js +1002 -0
  81. package/dist/runtime/result-store.d.ts +34 -3
  82. package/dist/runtime/result-store.js +1073 -2
  83. package/dist/runtime/run-binding.d.ts +68 -0
  84. package/dist/runtime/run-binding.js +278 -0
  85. package/dist/runtime/run-contracts.d.ts +575 -0
  86. package/dist/runtime/run-contracts.js +58 -7
  87. package/dist/runtime/run-controller.d.ts +1 -6
  88. package/dist/runtime/run-controller.js +0 -41
  89. package/dist/runtime/run-store.d.ts +85 -7
  90. package/dist/runtime/run-store.js +2528 -186
  91. package/dist/runtime/skill-adapter.d.ts +18 -7
  92. package/dist/runtime/skill-adapter.js +100 -742
  93. package/dist/runtime/structured-output-validator.d.ts +44 -0
  94. package/dist/runtime/structured-output-validator.js +171 -0
  95. package/dist/runtime/verifier-command-binding.d.ts +22 -0
  96. package/dist/runtime/verifier-command-binding.js +162 -0
  97. package/dist/runtime/verifier.d.ts +46 -6
  98. package/dist/runtime/verifier.js +355 -53
  99. package/dist/runtime/windows-job-keeper.d.ts +47 -0
  100. package/dist/runtime/windows-job-keeper.js +231 -0
  101. package/dist/runtime/worker-executor.d.ts +17 -1
  102. package/dist/runtime/worker-executor.js +26 -5
  103. package/dist/runtime/workflow-plan-adapter.d.ts +19 -0
  104. package/dist/runtime/workflow-plan-adapter.js +502 -6
  105. package/dist/runtime/workflow-runtime-manifest.d.ts +1 -0
  106. package/dist/runtime/workflow-runtime-manifest.js +5 -0
  107. package/dist/runtime/workspace-isolation.d.ts +29 -2
  108. package/dist/runtime/workspace-isolation.js +488 -11
  109. package/dist/runtime/workspace-observation.d.ts +44 -0
  110. package/dist/runtime/workspace-observation.js +216 -0
  111. package/dist/schema/controller-registry.d.ts +0 -7
  112. package/dist/schema/controller-registry.js +0 -8
  113. package/dist/schema/types.d.ts +84 -10
  114. package/dist/schema/types.js +2 -0
  115. package/dist/schema/validate.js +151 -1
  116. package/dist/schema/validators/controllers.d.ts +1 -1
  117. package/dist/schema/validators/controllers.js +126 -41
  118. package/dist/schema/workflow-authoring-contract.js +2 -0
  119. package/dist/schema/yaml-parser.js +1 -1
  120. package/dist/templates/flutter-rewrite-new.dna.yaml +1 -0
  121. package/dist/templates/flutter-rewrite.dna.yaml +87 -60
  122. package/dist/templates/safe-refactoring.dna.yaml +1 -0
  123. package/native/windows-job-keeper/README.md +80 -0
  124. package/native/windows-job-keeper/bin/aarch64/intentdna-windows-job-keeper.exe +0 -0
  125. package/native/windows-job-keeper/bin/x86_64/intentdna-windows-job-keeper.exe +0 -0
  126. package/native/windows-job-keeper/keeper.c +979 -0
  127. package/native/windows-job-keeper/manifest.json +33 -0
  128. package/package.json +5 -1
  129. package/scripts/build-windows-job-keeper.mjs +172 -0
  130. package/scripts/verify-windows-job-keeper.mjs +184 -0
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Targets: claude-md, soul-md, cursorrules, system-prompt
12
12
  */
13
- import { resolve, dirname } from "node:path";
13
+ import { resolve, dirname, relative, sep } from "node:path";
14
14
  import { readFile, writeFile as writeFileAsync, stat, mkdir, readdir, unlink, rm } from "node:fs/promises";
15
15
  import { createHash } from "node:crypto";
16
16
  import { createInterface } from "node:readline";
@@ -959,6 +959,12 @@ export async function runSync(opts) {
959
959
  const workflows = cascadedForSkills.workflows;
960
960
  const controllers = cascadedForSkills.controllers;
961
961
  const roles = cascadedForSkills.roles;
962
+ const skillDnaSources = opts.files.map((file) => {
963
+ const projectRelative = relative(projectDir, file);
964
+ return projectRelative === "" || projectRelative === ".." || projectRelative.startsWith(`..${sep}`)
965
+ ? file
966
+ : projectRelative.split(sep).join("/");
967
+ });
962
968
  // Step 8: Generate project-root .mcp.json only for Claude Code skills.
963
969
  if (skillSurface === "claude_code") {
964
970
  const mcpDeps = {};
@@ -986,21 +992,19 @@ export async function runSync(opts) {
986
992
  const result = compileWorkflow(wfDef, { workflow_key: name });
987
993
  if (result.ok) {
988
994
  const workflowVariables = variableScopes.forNamespace(variableScopes.workflowNamespaces.get(name) ?? "");
989
- skillResults.push(compileWorkflowToSkill(result.plan, roles, ir, workflowVariables, { surface: skillSurface }));
995
+ skillResults.push(compileWorkflowToSkill(result.plan, roles, ir, workflowVariables, {
996
+ surface: skillSurface,
997
+ dnaSources: skillDnaSources,
998
+ }));
990
999
  }
991
1000
  }
992
- if (skillSurface === "claude_code") {
993
- for (const [name, controllerDef] of Object.entries(controllers)) {
994
- const controllerKind = getControllerKindMetadata(controllerDef.kind);
995
- if (controllerKind?.supportsSkillGeneration) {
996
- const controllerVariables = variableScopes.forNamespace(variableScopes.controllerNamespaces.get(name) ?? "");
997
- skillResults.push(compileControllerToSkill(name, controllerDef, controllerVariables, workflows));
998
- }
1001
+ for (const [name, controllerDef] of Object.entries(controllers)) {
1002
+ const controllerKind = getControllerKindMetadata(controllerDef.kind);
1003
+ if (controllerKind?.supportsSkillGeneration) {
1004
+ const controllerVariables = variableScopes.forNamespace(variableScopes.controllerNamespaces.get(name) ?? "");
1005
+ skillResults.push(compileControllerToSkill(name, controllerDef, controllerVariables, workflows, { surface: skillSurface, dnaSources: skillDnaSources }));
999
1006
  }
1000
1007
  }
1001
- else if (Object.keys(controllers).length > 0) {
1002
- process.stderr.write("codex_cli unsupported: controller_skill_projection\n");
1003
- }
1004
1008
  if (skillResults.length > 0) {
1005
1009
  let written = skillResults.flatMap((result) => {
1006
1010
  const files = [resolve(opts.skillsDir, result.dirName, "SKILL.md")];
package/dist/cli/index.js CHANGED
@@ -190,6 +190,7 @@ Examples:
190
190
  dna run inspect <run-id>
191
191
  dna run resume <run-id>
192
192
  dna run cancel <run-id> --reason "operator request"
193
+ dna run close <run-id> --reason "legacy runtime retired"
193
194
  dna compile my.dna.json --context work
194
195
  dna show my.dna.json --context work
195
196
  dna evolve my_dna_id Preview marker changes without persisting
@@ -282,21 +283,25 @@ Boundaries:
282
283
  quickstart: `Usage: dna quickstart [asset] [--asset <name>] [--sync-target <target>] [--project-dir <path>] [--json]\n\nShows the shortest local route for getting value without Online or Supabase: choose a workflow asset, initialize local dna, preview sync, sync the harness, run in the harness, package/sign/verify local evidence, then inspect sync status.\n\nOptions:\n --asset <name> Workflow asset to start from (default prefers ${WORKFLOW_ASSET_IDS.default})\n --sync-target <target> Runtime surface such as codex or claude for suggested commands\n --project-dir <path> Read organization state and project-local assets from another project directory\n --json Print a concise intentdna.local_quickstart.v1 packet\n\nBoundaries:\n - quickstart is read-only guidance; it does not initialize, sync, run workflows, sign reports, upload reports, or deploy anything\n - local dna/dna-hook remain runtime truth\n - Online, marketplace, and Supabase do not execute workflows or make allow/warn/block/validate decisions\n - MCP remains hidden transport\n`,
283
284
  context: `Usage: dna context <index|search|doc> [query|id] [files...]\n\nSubcommands:\n index List explicitly declared planning-only advisory context sources\n search <query> Search source metadata\n doc <id> Read a local file/doc source body\n`,
284
285
  run: `Usage:
285
- dna run [start] --dna <file> --workflow <name> --task <id> [options]
286
+ dna run [start] --dna <file> (--workflow <name> | --controller <name>) --task <id> [options]
286
287
  dna run asset-refinery --var source_packet=<path> --var candidate_path=<path> [--dry-run]
287
288
  dna run status <run-id> [--json] [--project-dir <path>]
288
289
  dna run inspect <run-id> [--json] [--project-dir <path>]
289
290
  dna run resume <run-id> [--json] [--project-dir <path>]
290
291
  dna run cancel <run-id> [--reason <text>] [--json] [--project-dir <path>]
292
+ dna run close <run-id> [--reason <text>] [--json] [--project-dir <path>]
291
293
 
292
294
  Actions:
293
295
  start Create a durable run and execute until terminal (default)
294
296
  status Read the durable run summary
295
297
  inspect Read attempts, worker sessions, handoffs, events, and results
296
- resume Resume from durable task/attempt/result state
297
- cancel Persist durable cancellation intent
298
+ resume Resume a canonical run; legacy ledgers are rejected
299
+ cancel Persist cancellation intent for a legacy run
300
+ close Terminalize a legacy run without migrating it
298
301
 
299
302
  Options:
303
+ --workflow <name> Run one workflow target; mutually exclusive with --controller
304
+ --controller <name> Run one controller target; mutually exclusive with --workflow
300
305
  --run-id <id> Explicit run id; lifecycle actions also accept a positional id
301
306
  --var <key=value> Set a workflow variable; repeat for multiple values
302
307
  --dry-run Print the compiled Controller plan without starting a run
@@ -308,7 +313,7 @@ Options:
308
313
  --max-budget <usd> Claude budget per Step attempt (default: 5)
309
314
  --permission-mode <mode> Claude permission mode (default: default)
310
315
  --agents <dir> Project agent output directory (default: .claude/agents)
311
- --reason <text> Cancellation reason
316
+ --reason <text> Cancellation or closure reason
312
317
  --json Print lifecycle output as JSON
313
318
  --project-dir <path> Read/write the project-scoped runtime in another directory
314
319
  `,
@@ -472,6 +477,7 @@ async function main() {
472
477
  options: {
473
478
  dna: { type: "string", multiple: true },
474
479
  workflow: { type: "string", short: "w" },
480
+ controller: { type: "string" },
475
481
  task: { type: "string", short: "t" },
476
482
  context: { type: "string", short: "c" },
477
483
  var: { type: "string", multiple: true },
@@ -500,6 +506,7 @@ async function main() {
500
506
  "inspect",
501
507
  "resume",
502
508
  "cancel",
509
+ "close",
503
510
  ]);
504
511
  const actionCandidate = runPositionals[0] ?? "";
505
512
  const runAction = runActions.has(actionCandidate)
@@ -535,6 +542,7 @@ async function main() {
535
542
  }
536
543
  let dnaFiles = runValues.dna ?? runPositionals;
537
544
  let workflowName = runValues.workflow;
545
+ const controllerName = runValues.controller;
538
546
  let taskId = runValues.task;
539
547
  if (runAction === "start"
540
548
  && !runValues.dna
@@ -555,7 +563,7 @@ async function main() {
555
563
  }
556
564
  dnaFiles = [template.path];
557
565
  taskId ??= template.name;
558
- if (!workflowName) {
566
+ if (!workflowName && !controllerName) {
559
567
  const { loadDNA } = await import("../compiler/index.js");
560
568
  const dna = await loadDNA(template.path);
561
569
  const workflowNames = Object.keys(dna.workflows ?? {});
@@ -575,6 +583,7 @@ async function main() {
575
583
  runId: optionRunId ?? positionalRunId,
576
584
  dnaFiles,
577
585
  workflowName,
586
+ controllerName,
578
587
  taskId,
579
588
  context: runValues.context,
580
589
  vars: Object.keys(vars).length > 0 ? vars : undefined,
@@ -10,6 +10,7 @@
10
10
  import type { ConstraintIR } from "../schema/types.js";
11
11
  import type { ActivatedDNA } from "./activate.js";
12
12
  import type { CascadedDNA } from "./cascade.js";
13
+ export declare function resolvePostCheckCommand(check: string): string;
13
14
  /**
14
15
  * Compile activated DNA into a Constraint IR.
15
16
  */
@@ -206,7 +206,7 @@ function compileAdvisoryContext(cascaded) {
206
206
  injections,
207
207
  };
208
208
  }
209
- function resolvePostCheckCommand(check) {
209
+ export function resolvePostCheckCommand(check) {
210
210
  const normalized = check.trim();
211
211
  const builtins = {
212
212
  vitest_run: "npm test",
@@ -0,0 +1,16 @@
1
+ import type { ControllerDef } from "../schema/types.js";
2
+ import { type ExecutableRunPlanPayload, type Sha256Digest } from "../runtime/executable-run-plan.js";
3
+ export type ControllerPlanCompilerErrorCode = "invalid_controller_program" | "invalid_component_plan" | "invalid_controller_route";
4
+ export declare class ControllerPlanCompilerError extends Error {
5
+ readonly code: ControllerPlanCompilerErrorCode;
6
+ constructor(code: ControllerPlanCompilerErrorCode, message: string);
7
+ }
8
+ export interface CompileControllerPlanOptions {
9
+ readonly controller_key: string;
10
+ readonly controller: ControllerDef;
11
+ readonly diagnosis_plan: ExecutableRunPlanPayload;
12
+ readonly fix_plan: ExecutableRunPlanPayload;
13
+ readonly source_provenance: ExecutableRunPlanPayload["source_provenance"];
14
+ }
15
+ export declare function compileControllerPlan(options: CompileControllerPlanOptions): ExecutableRunPlanPayload;
16
+ export type ControllerPlanDigest = Sha256Digest;