intentdna 1.9.0 → 1.9.3
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +227 -87
- package/dist/cli/commands/run-lifecycle.d.ts +61 -11
- package/dist/cli/commands/run-lifecycle.js +184 -50
- package/dist/cli/commands/run-observer.d.ts +15 -0
- package/dist/cli/commands/run-observer.js +210 -0
- package/dist/cli/commands/run.d.ts +16 -20
- package/dist/cli/commands/run.js +461 -659
- package/dist/cli/commands/sync.js +16 -12
- package/dist/cli/index.js +14 -5
- package/dist/compiler/compile.d.ts +1 -0
- package/dist/compiler/compile.js +1 -1
- package/dist/compiler/controller.d.ts +16 -0
- package/dist/compiler/controller.js +693 -0
- package/dist/compiler/input-resolver.d.ts +2 -0
- package/dist/compiler/input-resolver.js +22 -6
- package/dist/hooks/cli.d.ts +45 -0
- package/dist/hooks/cli.js +263 -31
- package/dist/hooks/host-event.d.ts +57 -0
- package/dist/hooks/host-event.js +187 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/protocol.d.ts +7 -0
- package/dist/hooks/schema.d.ts +1 -0
- package/dist/hooks/schema.js +89 -1
- package/dist/hooks/state.d.ts +23 -1
- package/dist/hooks/state.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/tools-run.d.ts +4 -0
- package/dist/mcp/tools-run.js +419 -0
- package/dist/mcp/tools-state.d.ts +1 -1
- package/dist/mcp/tools-state.js +13 -241
- package/dist/runtime/artifact-store.d.ts +146 -0
- package/dist/runtime/artifact-store.js +1436 -0
- package/dist/runtime/canonical-attempt-outcome.d.ts +12 -0
- package/dist/runtime/canonical-attempt-outcome.js +195 -0
- package/dist/runtime/canonical-json.d.ts +10 -0
- package/dist/runtime/canonical-json.js +105 -0
- package/dist/runtime/canonical-run-application.d.ts +93 -0
- package/dist/runtime/canonical-run-application.js +229 -0
- package/dist/runtime/canonical-run-service.d.ts +454 -0
- package/dist/runtime/canonical-run-service.js +4760 -0
- package/dist/runtime/canonical-runtime-composition.d.ts +22 -0
- package/dist/runtime/canonical-runtime-composition.js +34 -0
- package/dist/runtime/canonical-runtime-projection.d.ts +3 -0
- package/dist/runtime/canonical-runtime-projection.js +4 -0
- package/dist/runtime/canonical-target-compiler.d.ts +46 -0
- package/dist/runtime/canonical-target-compiler.js +514 -0
- package/dist/runtime/claude-agent-identity.d.ts +2 -0
- package/dist/runtime/claude-agent-identity.js +21 -0
- package/dist/runtime/executable-run-plan.d.ts +328 -0
- package/dist/runtime/executable-run-plan.js +1485 -0
- package/dist/runtime/execution-authority.d.ts +83 -0
- package/dist/runtime/execution-authority.js +98 -0
- package/dist/runtime/handoff-resolver.js +4 -1
- package/dist/runtime/harness-pull-adapter.d.ts +146 -0
- package/dist/runtime/harness-pull-adapter.js +315 -0
- package/dist/runtime/index.d.ts +39 -14
- package/dist/runtime/index.js +29 -7
- package/dist/runtime/local-execution-authority.d.ts +194 -0
- package/dist/runtime/local-execution-authority.js +2897 -0
- package/dist/runtime/local-execution-reconciliation.d.ts +20 -0
- package/dist/runtime/local-execution-reconciliation.js +107 -0
- package/dist/runtime/local-execution-supervisor-script.d.ts +7 -0
- package/dist/runtime/local-execution-supervisor-script.js +793 -0
- package/dist/runtime/local-provider-sandbox.d.ts +42 -0
- package/dist/runtime/local-provider-sandbox.js +154 -0
- package/dist/runtime/local-verifier-execution.d.ts +24 -0
- package/dist/runtime/local-verifier-execution.js +290 -0
- package/dist/runtime/local-windows-execution-supervisor-script.d.ts +6 -0
- package/dist/runtime/local-windows-execution-supervisor-script.js +788 -0
- package/dist/runtime/plan-store.d.ts +30 -0
- package/dist/runtime/plan-store.js +231 -0
- package/dist/runtime/process-tree.d.ts +9 -0
- package/dist/runtime/process-tree.js +97 -24
- package/dist/runtime/providers/codex.js +2 -2
- package/dist/runtime/push-driver.d.ts +184 -0
- package/dist/runtime/push-driver.js +1002 -0
- package/dist/runtime/result-store.d.ts +34 -3
- package/dist/runtime/result-store.js +1073 -2
- package/dist/runtime/run-binding.d.ts +68 -0
- package/dist/runtime/run-binding.js +278 -0
- package/dist/runtime/run-contracts.d.ts +575 -0
- package/dist/runtime/run-contracts.js +58 -7
- package/dist/runtime/run-controller.d.ts +1 -6
- package/dist/runtime/run-controller.js +0 -41
- package/dist/runtime/run-store.d.ts +85 -7
- package/dist/runtime/run-store.js +2528 -186
- package/dist/runtime/skill-adapter.d.ts +18 -7
- package/dist/runtime/skill-adapter.js +100 -742
- package/dist/runtime/structured-output-validator.d.ts +44 -0
- package/dist/runtime/structured-output-validator.js +171 -0
- package/dist/runtime/verifier-command-binding.d.ts +22 -0
- package/dist/runtime/verifier-command-binding.js +162 -0
- package/dist/runtime/verifier.d.ts +46 -6
- package/dist/runtime/verifier.js +355 -53
- package/dist/runtime/windows-job-keeper.d.ts +47 -0
- package/dist/runtime/windows-job-keeper.js +231 -0
- package/dist/runtime/worker-executor.d.ts +17 -1
- package/dist/runtime/worker-executor.js +26 -5
- package/dist/runtime/workflow-plan-adapter.d.ts +19 -0
- package/dist/runtime/workflow-plan-adapter.js +502 -6
- package/dist/runtime/workflow-runtime-manifest.d.ts +1 -0
- package/dist/runtime/workflow-runtime-manifest.js +5 -0
- package/dist/runtime/workspace-isolation.d.ts +29 -2
- package/dist/runtime/workspace-isolation.js +488 -11
- package/dist/runtime/workspace-observation.d.ts +44 -0
- package/dist/runtime/workspace-observation.js +216 -0
- package/dist/schema/controller-registry.d.ts +0 -7
- package/dist/schema/controller-registry.js +0 -8
- package/dist/schema/types.d.ts +84 -10
- package/dist/schema/types.js +2 -0
- package/dist/schema/validate.js +151 -1
- package/dist/schema/validators/controllers.d.ts +1 -1
- package/dist/schema/validators/controllers.js +126 -41
- package/dist/schema/workflow-authoring-contract.js +2 -0
- package/dist/schema/yaml-parser.js +1 -1
- package/dist/templates/flutter-rewrite-new.dna.yaml +1 -0
- package/dist/templates/flutter-rewrite.dna.yaml +87 -60
- package/dist/templates/safe-refactoring.dna.yaml +1 -0
- package/native/windows-job-keeper/README.md +80 -0
- package/native/windows-job-keeper/bin/aarch64/intentdna-windows-job-keeper.exe +0 -0
- package/native/windows-job-keeper/bin/x86_64/intentdna-windows-job-keeper.exe +0 -0
- package/native/windows-job-keeper/keeper.c +979 -0
- package/native/windows-job-keeper/manifest.json +33 -0
- package/package.json +6 -2
- package/scripts/build-windows-job-keeper.mjs +172 -0
- package/scripts/verify-windows-job-keeper.mjs +184 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RunView } from "./canonical-run-service.js";
|
|
2
|
+
import type { LocalAttemptExecutionAuthority, LocalExecutionAuthorityBinding, LocalPreparedExecutionHandle } from "./local-execution-authority.js";
|
|
3
|
+
import type { CanonicalResultDigest } from "./run-contracts.js";
|
|
4
|
+
export type LocalPreparationReconciliationResult = {
|
|
5
|
+
readonly kind: "bound";
|
|
6
|
+
readonly preparation: LocalPreparedExecutionHandle;
|
|
7
|
+
readonly binding: LocalExecutionAuthorityBinding;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "retired_never_launched";
|
|
10
|
+
readonly preparation: LocalPreparedExecutionHandle;
|
|
11
|
+
readonly reason: "run_terminal" | "run_cancelling" | "attempt_terminal" | "attempt_replaced" | "higher_claim" | "different_executor";
|
|
12
|
+
readonly attestation_digest: CanonicalResultDigest;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: "retained";
|
|
15
|
+
readonly preparation: LocalPreparedExecutionHandle;
|
|
16
|
+
readonly reason: "current_unattached" | "missing_ledger_state" | "inconsistent_ledger_state";
|
|
17
|
+
};
|
|
18
|
+
export declare function reconcileLocalExecutionPreparations(authority: LocalAttemptExecutionAuthority, view: RunView, options?: {
|
|
19
|
+
readonly now?: () => Date;
|
|
20
|
+
}): Promise<readonly LocalPreparationReconciliationResult[]>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalizeJson } from "./canonical-json.js";
|
|
3
|
+
function reconciliationFailureDigest(preparation, reason) {
|
|
4
|
+
return `sha256:${createHash("sha256")
|
|
5
|
+
.update(canonicalizeJson({
|
|
6
|
+
schema_version: "intentdna.local_preparation_reconciliation.v1",
|
|
7
|
+
preparation_digest: preparation.preparation_digest,
|
|
8
|
+
reason,
|
|
9
|
+
}), "utf8")
|
|
10
|
+
.digest("hex")}`;
|
|
11
|
+
}
|
|
12
|
+
function preparationMatchesView(preparation, view) {
|
|
13
|
+
return preparation.run_id === view.run.run_id;
|
|
14
|
+
}
|
|
15
|
+
function classifyUncommitted(inspection, view) {
|
|
16
|
+
const preparation = inspection.handle;
|
|
17
|
+
const attempt = view.attempts.find((candidate) => candidate.attempt_id === preparation.attempt_id);
|
|
18
|
+
const activation = view.activations.find((candidate) => candidate.activation_id === preparation.activation_id);
|
|
19
|
+
const claims = view.claims.filter((candidate) => candidate.attempt_id === preparation.attempt_id);
|
|
20
|
+
if (attempt === undefined || activation === undefined)
|
|
21
|
+
return "missing_ledger_state";
|
|
22
|
+
if (attempt.run_id !== preparation.run_id
|
|
23
|
+
|| attempt.step_id !== preparation.step_id
|
|
24
|
+
|| attempt.activation_id !== preparation.activation_id
|
|
25
|
+
|| activation.run_id !== preparation.run_id
|
|
26
|
+
|| activation.step_id !== preparation.step_id) {
|
|
27
|
+
return "inconsistent_ledger_state";
|
|
28
|
+
}
|
|
29
|
+
if (view.run.terminal !== null)
|
|
30
|
+
return "run_terminal";
|
|
31
|
+
if (view.run.status === "cancelling")
|
|
32
|
+
return "run_cancelling";
|
|
33
|
+
if (attempt.executor !== null) {
|
|
34
|
+
if (attempt.executor.kind !== "worker"
|
|
35
|
+
|| attempt.executor.worker_session_id !== preparation.worker_session_id) {
|
|
36
|
+
return "different_executor";
|
|
37
|
+
}
|
|
38
|
+
return "inconsistent_ledger_state";
|
|
39
|
+
}
|
|
40
|
+
if (attempt.phase === "terminal")
|
|
41
|
+
return "attempt_terminal";
|
|
42
|
+
if (activation.current_attempt_id !== preparation.attempt_id)
|
|
43
|
+
return "attempt_replaced";
|
|
44
|
+
if (claims.length === 0)
|
|
45
|
+
return "missing_ledger_state";
|
|
46
|
+
if (claims.some((claim) => claim.run_id !== preparation.run_id
|
|
47
|
+
|| claim.step_id !== preparation.step_id
|
|
48
|
+
|| claim.activation_id !== preparation.activation_id)) {
|
|
49
|
+
return "inconsistent_ledger_state";
|
|
50
|
+
}
|
|
51
|
+
const claim = claims.reduce((latest, candidate) => (candidate.claim_epoch > latest.claim_epoch ? candidate : latest));
|
|
52
|
+
if (claim.claim_epoch > preparation.execution_claim_epoch)
|
|
53
|
+
return "higher_claim";
|
|
54
|
+
if (claim.claim_epoch < preparation.execution_claim_epoch)
|
|
55
|
+
return "inconsistent_ledger_state";
|
|
56
|
+
return "current_unattached";
|
|
57
|
+
}
|
|
58
|
+
export async function reconcileLocalExecutionPreparations(authority, view, options = {}) {
|
|
59
|
+
const now = options.now ?? (() => new Date());
|
|
60
|
+
const results = [];
|
|
61
|
+
for (const inspection of authority.listPreparedExecutions()) {
|
|
62
|
+
const preparation = inspection.handle;
|
|
63
|
+
if (!preparationMatchesView(preparation, view)) {
|
|
64
|
+
results.push({ kind: "retained", preparation, reason: "missing_ledger_state" });
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const attempt = view.attempts.find((candidate) => candidate.attempt_id === preparation.attempt_id);
|
|
68
|
+
if (attempt?.run_id === preparation.run_id
|
|
69
|
+
&& attempt.step_id === preparation.step_id
|
|
70
|
+
&& attempt.activation_id === preparation.activation_id
|
|
71
|
+
&& attempt.executor?.kind === "worker"
|
|
72
|
+
&& attempt.executor.worker_session_id === preparation.worker_session_id
|
|
73
|
+
&& attempt.started_at !== null) {
|
|
74
|
+
results.push({
|
|
75
|
+
kind: "bound",
|
|
76
|
+
preparation,
|
|
77
|
+
binding: authority.bindExecution(preparation, { started_at: attempt.started_at }),
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const reason = classifyUncommitted(inspection, view);
|
|
82
|
+
if (reason === "current_unattached"
|
|
83
|
+
|| reason === "missing_ledger_state"
|
|
84
|
+
|| reason === "inconsistent_ledger_state") {
|
|
85
|
+
results.push({ kind: "retained", preparation, reason });
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const attestation = await authority.attestNeverLaunched({
|
|
89
|
+
run_id: preparation.run_id,
|
|
90
|
+
step_id: preparation.step_id,
|
|
91
|
+
activation_id: preparation.activation_id,
|
|
92
|
+
attempt_id: preparation.attempt_id,
|
|
93
|
+
execution_claim_epoch: preparation.execution_claim_epoch,
|
|
94
|
+
executor: { kind: "worker", worker_session_id: preparation.worker_session_id },
|
|
95
|
+
started_at: inspection.created_at,
|
|
96
|
+
failure_idempotency_key: reconciliationFailureDigest(preparation, reason),
|
|
97
|
+
requested_at: now().toISOString(),
|
|
98
|
+
});
|
|
99
|
+
results.push({
|
|
100
|
+
kind: "retired_never_launched",
|
|
101
|
+
preparation,
|
|
102
|
+
reason,
|
|
103
|
+
attestation_digest: attestation.attestation_digest,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained CommonJS supervisor written into the private authority root.
|
|
3
|
+
* Keeping the child runtime dependency-free lets source tests and compiled CLI
|
|
4
|
+
* builds use the exact same protocol.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LOCAL_EXECUTION_SUPERVISOR_SOURCE: string;
|
|
7
|
+
export declare const LOCAL_EXECUTION_SUPERVISOR_DIGEST: `sha256:${string}`;
|