@claudexor/schema 2.1.3 → 3.0.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.
- package/dist/agent-capabilities.d.ts +32 -24
- package/dist/agent-capabilities.d.ts.map +1 -1
- package/dist/agent-capabilities.js +20 -11
- package/dist/agent-capabilities.js.map +1 -1
- package/dist/apply-eligibility.d.ts +166 -0
- package/dist/apply-eligibility.d.ts.map +1 -1
- package/dist/apply-eligibility.js +63 -2
- package/dist/apply-eligibility.js.map +1 -1
- package/dist/attachment.d.ts +5 -5
- package/dist/budget.d.ts +4 -4
- package/dist/config.d.ts +59 -41
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +16 -6
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +6 -6
- package/dist/control-operation-responses.d.ts +190 -97
- package/dist/control-operation-responses.d.ts.map +1 -1
- package/dist/control-operation-responses.js +14 -1
- package/dist/control-operation-responses.js.map +1 -1
- package/dist/control-run-detail.d.ts +347 -215
- package/dist/control-run-detail.d.ts.map +1 -1
- package/dist/control-run-detail.js +34 -7
- package/dist/control-run-detail.js.map +1 -1
- package/dist/control-thread-apply.d.ts +5 -5
- package/dist/control-trust.d.ts +6 -6
- package/dist/control.d.ts +769 -306
- package/dist/control.d.ts.map +1 -1
- package/dist/control.js +164 -61
- package/dist/control.js.map +1 -1
- package/dist/credential-profile.d.ts +400 -1
- package/dist/credential-profile.d.ts.map +1 -1
- package/dist/credential-profile.js +109 -4
- package/dist/credential-profile.js.map +1 -1
- package/dist/decision.d.ts +78 -14
- package/dist/decision.d.ts.map +1 -1
- package/dist/decision.js +53 -20
- package/dist/decision.js.map +1 -1
- package/dist/delivery.d.ts +3 -3
- package/dist/delivery.js +1 -1
- package/dist/delivery.js.map +1 -1
- package/dist/events.d.ts +32 -6
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +45 -11
- package/dist/events.js.map +1 -1
- package/dist/gate.d.ts +4 -4
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +2 -2
- package/dist/gate.js.map +1 -1
- package/dist/harness.d.ts +137 -47
- package/dist/harness.d.ts.map +1 -1
- package/dist/harness.js +65 -16
- package/dist/harness.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/operation.d.ts +66 -7
- package/dist/operation.d.ts.map +1 -1
- package/dist/operation.js +29 -2
- package/dist/operation.js.map +1 -1
- package/dist/output-schema.d.ts +40 -0
- package/dist/output-schema.d.ts.map +1 -0
- package/dist/output-schema.js +109 -0
- package/dist/output-schema.js.map +1 -0
- package/dist/plan.d.ts +206 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +107 -0
- package/dist/plan.js.map +1 -0
- package/dist/primitives.d.ts +14 -10
- package/dist/primitives.d.ts.map +1 -1
- package/dist/primitives.js +14 -11
- package/dist/primitives.js.map +1 -1
- package/dist/project.d.ts +75 -0
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +17 -0
- package/dist/project.js.map +1 -1
- package/dist/quota.d.ts +119 -0
- package/dist/quota.d.ts.map +1 -1
- package/dist/quota.js +22 -0
- package/dist/quota.js.map +1 -1
- package/dist/raw.d.ts +4 -4
- package/dist/readiness.d.ts +14 -7
- package/dist/readiness.d.ts.map +1 -1
- package/dist/run-strategy.d.ts +17 -0
- package/dist/run-strategy.d.ts.map +1 -0
- package/dist/run-strategy.js +47 -0
- package/dist/run-strategy.js.map +1 -0
- package/dist/setup.d.ts +160 -160
- package/dist/status-projection.d.ts +78 -0
- package/dist/status-projection.d.ts.map +1 -0
- package/dist/status-projection.js +171 -0
- package/dist/status-projection.js.map +1 -0
- package/dist/task.d.ts +48 -316
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +3 -60
- package/dist/task.js.map +1 -1
- package/dist/telemetry.d.ts +89 -89
- package/dist/thread.d.ts +167 -32
- package/dist/thread.d.ts.map +1 -1
- package/dist/thread.js +92 -28
- package/dist/thread.js.map +1 -1
- package/dist/tool-ref.d.ts +1 -1
- package/generated/AgentCapabilityCatalog.schema.json +4 -6
- package/generated/ApplyEligibility.schema.json +1 -1
- package/generated/BudgetLease.schema.json +1 -2
- package/generated/ConformanceReport.schema.json +1 -2
- package/generated/ContinuityDisclosure.schema.json +74 -0
- package/generated/ControlApplyRequest.schema.json +1 -2
- package/generated/ControlCredentialProfileUpdateRequest.schema.json +20 -0
- package/generated/ControlCredentialProfileUpdateResponse.schema.json +142 -0
- package/generated/ControlCredentialProfilesResponse.schema.json +126 -2
- package/generated/ControlDeliveryResponse.schema.json +0 -1
- package/generated/ControlHandshakeResponse.schema.json +31 -3
- package/generated/ControlHarnessListResponse.schema.json +11 -6
- package/generated/ControlHarnessSettingsPatch.schema.json +4 -0
- package/generated/ControlOperationCatalog.schema.json +16 -1
- package/generated/ControlOperationDescriptor.schema.json +15 -0
- package/generated/ControlProject.schema.json +35 -0
- package/generated/ControlProjectListResponse.schema.json +35 -0
- package/generated/ControlProjectOutputsResponse.schema.json +57 -0
- package/generated/ControlQueuedRunInfo.schema.json +2 -11
- package/generated/ControlQuotaResponse.schema.json +42 -0
- package/generated/ControlRunAgainDraft.schema.json +37 -35
- package/generated/ControlRunDecisionRequest.schema.json +0 -1
- package/generated/ControlRunDetail.schema.json +292 -213
- package/generated/ControlRunListResponse.schema.json +88 -27
- package/generated/ControlRunStartRequest.schema.json +37 -35
- package/generated/ControlRunStartResponse.schema.json +2 -11
- package/generated/ControlRunSummary.schema.json +88 -27
- package/generated/ControlSettingsSnapshot.schema.json +6 -11
- package/generated/ControlSettingsUpdateRequest.schema.json +5 -10
- package/generated/ControlThread.schema.json +21 -3
- package/generated/ControlThreadApplyResponse.schema.json +0 -1
- package/generated/ControlThreadCreateRequest.schema.json +12 -3
- package/generated/ControlThreadDetail.schema.json +174 -16
- package/generated/ControlThreadListResponse.schema.json +60 -3
- package/generated/ControlThreadTurnRequest.schema.json +40 -34
- package/generated/ControlThreadUpdateRequest.schema.json +19 -0
- package/generated/DecisionRecord.schema.json +73 -33
- package/generated/GateResult.schema.json +1 -2
- package/generated/GlobalConfig.schema.json +7 -12
- package/generated/HarnessManifest.schema.json +11 -6
- package/generated/HarnessStatusDto.schema.json +11 -6
- package/generated/LaneCheckpoint.schema.json +59 -0
- package/generated/McpRunHandleResult.schema.json +234 -0
- package/generated/McpRunToolResult.schema.json +124 -2
- package/generated/RoutePrimaryDivergedPayload.schema.json +56 -0
- package/generated/RunEvent.schema.json +9 -5
- package/generated/RunTelemetry.schema.json +2 -4
- package/generated/TaskContract.schema.json +3 -135
- package/generated/Thread.schema.json +21 -3
- package/generated/ThreadTurn.schema.json +88 -0
- package/package.json +2 -2
- package/dist/control-spec.d.ts +0 -603
- package/dist/control-spec.d.ts.map +0 -1
- package/dist/control-spec.js +0 -87
- package/dist/control-spec.js.map +0 -1
- package/dist/orchestrate.d.ts +0 -556
- package/dist/orchestrate.d.ts.map +0 -1
- package/dist/orchestrate.js +0 -356
- package/dist/orchestrate.js.map +0 -1
- package/dist/spec.d.ts +0 -678
- package/dist/spec.d.ts.map +0 -1
- package/dist/spec.js +0 -186
- package/dist/spec.js.map +0 -1
- package/generated/ControlSpecAnswersRequest.schema.json +0 -74
- package/generated/ControlSpecQuestionsRequest.schema.json +0 -209
- package/generated/ControlSpecSession.schema.json +0 -261
- package/generated/ControlSpecSessionListResponse.schema.json +0 -273
- package/generated/OrchestrateContract.schema.json +0 -119
- package/generated/OrchestratePlan.schema.json +0 -264
- package/generated/OrchestratePlanProgress.schema.json +0 -164
- package/generated/SessionReboundLineage.schema.json +0 -73
- package/generated/SpecPack.schema.json +0 -483
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RunApplyState } from "./control.js";
|
|
3
|
+
import type { RunOutcomeFacts, RunReason } from "./decision.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE single status-projection owner (v3 axes, D8/D18): every surface — CLI,
|
|
6
|
+
* control-api, MCP, ACP, macOS — projects run state through these helpers.
|
|
7
|
+
* Nobody re-derives labels, exit codes, stop reasons, terminal sets, or
|
|
8
|
+
* needs-decision from raw fields (INV-134: one presentational owner per
|
|
9
|
+
* fact; codex plan-review finding 7).
|
|
10
|
+
*/
|
|
11
|
+
/** Job/run lifecycle: how far the PROCESS got. Outcome quality lives on the
|
|
12
|
+
* independent axes in RunOutcomeFacts — "blocked" is not a lifecycle. */
|
|
13
|
+
export declare const RunLifecycle: z.ZodEnum<["queued", "running", "succeeded", "failed", "cancelled", "interrupted"]>;
|
|
14
|
+
export type RunLifecycle = z.infer<typeof RunLifecycle>;
|
|
15
|
+
export declare const TERMINAL_LIFECYCLES: ReadonlySet<RunLifecycle>;
|
|
16
|
+
export declare function isTerminalLifecycle(state: string): boolean;
|
|
17
|
+
/** Process exit policy: the LIFECYCLE is the exit code. A finished run with
|
|
18
|
+
* open review findings exits 0 — "Done · needs review" is done; whether the
|
|
19
|
+
* result may be APPLIED is applyEligibility's answer, never the exit code. */
|
|
20
|
+
export declare function processExitCode(lifecycle: string): number;
|
|
21
|
+
/** The D8 user-facing label for a terminal run (English-only, INV-141). */
|
|
22
|
+
export declare function runOutcomeLabel(facts: RunOutcomeFacts): string;
|
|
23
|
+
/**
|
|
24
|
+
* THE single owner of the server-owned OUTCOME BANNER (D18): the one honest
|
|
25
|
+
* headline a surface shows above any model prose, so free-text from the harness
|
|
26
|
+
* can never outrank the arbitrated truth. It folds the terminal outcome quality
|
|
27
|
+
* (runOutcomeLabel) together with the delivery/apply state (RunApplyState) into
|
|
28
|
+
* one line — e.g. "Candidate ready — NOT APPLIED", "Applied", "Needs review".
|
|
29
|
+
*
|
|
30
|
+
* The delivery suffix ("— NOT APPLIED") is only appended when there is actually
|
|
31
|
+
* something to apply (`hasApplyableChange` — an unapplied patch candidate);
|
|
32
|
+
* answer/plan/report runs carry no apply affordance, so their banner is the
|
|
33
|
+
* outcome quality alone. Null while the run is not terminal (no honest headline
|
|
34
|
+
* yet). Every surface — CLI print, control-api ControlRunDetail, macOS Outcome
|
|
35
|
+
* tab — renders THIS, never its own.
|
|
36
|
+
*/
|
|
37
|
+
export declare function outcomeBanner(facts: RunOutcomeFacts | null, delivery: {
|
|
38
|
+
applyState: RunApplyState;
|
|
39
|
+
hasApplyableChange: boolean;
|
|
40
|
+
}): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* THE single owner of the continuity disclosure line (INV-137). Every surface
|
|
43
|
+
* — CLI print, macOS turn card, ACP — renders continuity through this helper
|
|
44
|
+
* so the phrasing never diverges. Returns null for the cases with nothing to
|
|
45
|
+
* disclose (a fresh first turn, or a plain in-lane native resume that carried
|
|
46
|
+
* no packet); a lane switch or a hydrated gap always yields a visible line.
|
|
47
|
+
*/
|
|
48
|
+
export declare function continuityLabel(disclosure: {
|
|
49
|
+
kind: "native_resume" | "packet" | "fresh";
|
|
50
|
+
packetTurns?: number;
|
|
51
|
+
summarized?: boolean;
|
|
52
|
+
laneSwitchedFrom?: {
|
|
53
|
+
harness: string;
|
|
54
|
+
profileId?: string | null;
|
|
55
|
+
} | null;
|
|
56
|
+
}): string | null;
|
|
57
|
+
/** True when a terminal run is waiting on a human decision: finished work
|
|
58
|
+
* whose review blocked or checks failed, with no valid operator decision
|
|
59
|
+
* recorded yet. The ONE producer of the needs-me/inbox signal. */
|
|
60
|
+
export declare function needsDecision(facts: RunOutcomeFacts, hasValidOperatorDecision: boolean): boolean;
|
|
61
|
+
/** ACP stop-reason projection (3-bucket collapse, unchanged semantics). */
|
|
62
|
+
export declare function acpStopReason(lifecycle: string): "cancelled" | "refusal" | "end_turn";
|
|
63
|
+
/** Build a full RunOutcomeFacts from a lifecycle + optional partial axes,
|
|
64
|
+
* filling the honest defaults (no_changes-neutral, checks not_configured,
|
|
65
|
+
* review not_run, reason null). The ONE constructor used by terminal writers
|
|
66
|
+
* that don't already hold a facts record (executor-forced terminals, budget
|
|
67
|
+
* stops, failure-only terminals). */
|
|
68
|
+
export declare function makeOutcomeFacts(lifecycle: RunOutcomeFacts["lifecycle"], partial?: Partial<Omit<RunOutcomeFacts, "lifecycle">>): RunOutcomeFacts;
|
|
69
|
+
/** Coarse RunReason for a run that has NO decision.facts to project (a
|
|
70
|
+
* pre-arbitration failure: plan/readonly/enqueue/harness crash). Keyed on the
|
|
71
|
+
* typed failure category + lifecycle so a surface still shows an honest reason.
|
|
72
|
+
* Runs WITH a decision project decision.facts directly; this is the fallback. */
|
|
73
|
+
export declare function reasonFromFailureCategory(lifecycle: RunOutcomeFacts["lifecycle"], category: string | null | undefined): RunReason | null;
|
|
74
|
+
/** Derive RunOutcomeFacts for a decision-less terminal from its typed failure
|
|
75
|
+
* category + lifecycle. summarizeRun uses this ONLY when decision.facts is
|
|
76
|
+
* absent; it lives next to the projection owner so no surface re-derives. */
|
|
77
|
+
export declare function outcomeFactsFromFailure(lifecycle: RunOutcomeFacts["lifecycle"], category: string | null | undefined): RunOutcomeFacts;
|
|
78
|
+
//# sourceMappingURL=status-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-projection.d.ts","sourceRoot":"","sources":["../src/status-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhE;;;;;;GAMG;AAEH;yEACyE;AACzE,eAAO,MAAM,YAAY,qFAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,YAAY,CAK/C,CAAC;AAEZ,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;8EAE8E;AAC9E,wBAAgB,eAAe,CAAC,SAAS,EA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,uBAAuB,CACrC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,EACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,eAAe,CAEjB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* THE single status-projection owner (v3 axes, D8/D18): every surface — CLI,
|
|
4
|
+
* control-api, MCP, ACP, macOS — projects run state through these helpers.
|
|
5
|
+
* Nobody re-derives labels, exit codes, stop reasons, terminal sets, or
|
|
6
|
+
* needs-decision from raw fields (INV-134: one presentational owner per
|
|
7
|
+
* fact; codex plan-review finding 7).
|
|
8
|
+
*/
|
|
9
|
+
/** Job/run lifecycle: how far the PROCESS got. Outcome quality lives on the
|
|
10
|
+
* independent axes in RunOutcomeFacts — "blocked" is not a lifecycle. */
|
|
11
|
+
export const RunLifecycle = z
|
|
12
|
+
.enum(["queued", "running", "succeeded", "failed", "cancelled", "interrupted"])
|
|
13
|
+
.describe("Run lifecycle: queued, running, then exactly one of succeeded / failed / cancelled / interrupted. Outcome quality (checks, review, delivery) is orthogonal.");
|
|
14
|
+
export const TERMINAL_LIFECYCLES = new Set([
|
|
15
|
+
"succeeded",
|
|
16
|
+
"failed",
|
|
17
|
+
"cancelled",
|
|
18
|
+
"interrupted",
|
|
19
|
+
]);
|
|
20
|
+
export function isTerminalLifecycle(state) {
|
|
21
|
+
return TERMINAL_LIFECYCLES.has(state);
|
|
22
|
+
}
|
|
23
|
+
/** Process exit policy: the LIFECYCLE is the exit code. A finished run with
|
|
24
|
+
* open review findings exits 0 — "Done · needs review" is done; whether the
|
|
25
|
+
* result may be APPLIED is applyEligibility's answer, never the exit code. */
|
|
26
|
+
export function processExitCode(lifecycle) {
|
|
27
|
+
return lifecycle === "succeeded" ? 0 : 1;
|
|
28
|
+
}
|
|
29
|
+
/** The D8 user-facing label for a terminal run (English-only, INV-141). */
|
|
30
|
+
export function runOutcomeLabel(facts) {
|
|
31
|
+
switch (facts.lifecycle) {
|
|
32
|
+
case "failed":
|
|
33
|
+
return facts.reason ? `Failed (${facts.reason.replaceAll("_", " ")})` : "Failed";
|
|
34
|
+
case "cancelled":
|
|
35
|
+
return "Cancelled";
|
|
36
|
+
case "interrupted":
|
|
37
|
+
return "Interrupted";
|
|
38
|
+
case "succeeded":
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
return "Working";
|
|
42
|
+
}
|
|
43
|
+
if (facts.review === "blocked" || facts.checks === "failed")
|
|
44
|
+
return "Needs review";
|
|
45
|
+
if (facts.review === "not_run" || facts.checks === "not_configured") {
|
|
46
|
+
return "Done · not verified";
|
|
47
|
+
}
|
|
48
|
+
return "Done";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* THE single owner of the server-owned OUTCOME BANNER (D18): the one honest
|
|
52
|
+
* headline a surface shows above any model prose, so free-text from the harness
|
|
53
|
+
* can never outrank the arbitrated truth. It folds the terminal outcome quality
|
|
54
|
+
* (runOutcomeLabel) together with the delivery/apply state (RunApplyState) into
|
|
55
|
+
* one line — e.g. "Candidate ready — NOT APPLIED", "Applied", "Needs review".
|
|
56
|
+
*
|
|
57
|
+
* The delivery suffix ("— NOT APPLIED") is only appended when there is actually
|
|
58
|
+
* something to apply (`hasApplyableChange` — an unapplied patch candidate);
|
|
59
|
+
* answer/plan/report runs carry no apply affordance, so their banner is the
|
|
60
|
+
* outcome quality alone. Null while the run is not terminal (no honest headline
|
|
61
|
+
* yet). Every surface — CLI print, control-api ControlRunDetail, macOS Outcome
|
|
62
|
+
* tab — renders THIS, never its own.
|
|
63
|
+
*/
|
|
64
|
+
export function outcomeBanner(facts, delivery) {
|
|
65
|
+
if (!facts)
|
|
66
|
+
return null; // not terminal — no honest headline yet
|
|
67
|
+
if (facts.lifecycle !== "succeeded")
|
|
68
|
+
return runOutcomeLabel(facts);
|
|
69
|
+
switch (delivery.applyState) {
|
|
70
|
+
case "applied":
|
|
71
|
+
return "Applied";
|
|
72
|
+
case "applied_review_blocked":
|
|
73
|
+
return "Applied · review blocked";
|
|
74
|
+
case "reverted":
|
|
75
|
+
return "Reverted — changes rolled back";
|
|
76
|
+
case "not_applied":
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
const needsReview = facts.review === "blocked" || facts.checks === "failed";
|
|
80
|
+
const unverified = facts.review === "not_run" || facts.checks === "not_configured";
|
|
81
|
+
// Nothing to apply (answer / plan / report / no changes): the quality alone.
|
|
82
|
+
if (!delivery.hasApplyableChange) {
|
|
83
|
+
if (needsReview)
|
|
84
|
+
return "Needs review";
|
|
85
|
+
if (unverified)
|
|
86
|
+
return "Done · not verified";
|
|
87
|
+
return "Done";
|
|
88
|
+
}
|
|
89
|
+
// A patch candidate exists but has NOT been applied — always disclose that.
|
|
90
|
+
if (needsReview)
|
|
91
|
+
return "Needs review — NOT APPLIED";
|
|
92
|
+
if (unverified)
|
|
93
|
+
return "Candidate ready · not verified — NOT APPLIED";
|
|
94
|
+
return "Candidate ready — NOT APPLIED";
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* THE single owner of the continuity disclosure line (INV-137). Every surface
|
|
98
|
+
* — CLI print, macOS turn card, ACP — renders continuity through this helper
|
|
99
|
+
* so the phrasing never diverges. Returns null for the cases with nothing to
|
|
100
|
+
* disclose (a fresh first turn, or a plain in-lane native resume that carried
|
|
101
|
+
* no packet); a lane switch or a hydrated gap always yields a visible line.
|
|
102
|
+
*/
|
|
103
|
+
export function continuityLabel(disclosure) {
|
|
104
|
+
if (disclosure.kind !== "packet")
|
|
105
|
+
return null;
|
|
106
|
+
const turns = disclosure.packetTurns ?? 0;
|
|
107
|
+
const noun = turns === 1 ? "turn" : "turns";
|
|
108
|
+
let line = `continued with thread context · ${turns} ${noun}`;
|
|
109
|
+
if (disclosure.summarized)
|
|
110
|
+
line += " (older turns condensed)";
|
|
111
|
+
if (disclosure.laneSwitchedFrom)
|
|
112
|
+
line += ` · switched from ${disclosure.laneSwitchedFrom.harness}`;
|
|
113
|
+
return line;
|
|
114
|
+
}
|
|
115
|
+
/** True when a terminal run is waiting on a human decision: finished work
|
|
116
|
+
* whose review blocked or checks failed, with no valid operator decision
|
|
117
|
+
* recorded yet. The ONE producer of the needs-me/inbox signal. */
|
|
118
|
+
export function needsDecision(facts, hasValidOperatorDecision) {
|
|
119
|
+
return (facts.lifecycle === "succeeded" &&
|
|
120
|
+
(facts.review === "blocked" || facts.checks === "failed") &&
|
|
121
|
+
!hasValidOperatorDecision);
|
|
122
|
+
}
|
|
123
|
+
/** ACP stop-reason projection (3-bucket collapse, unchanged semantics). */
|
|
124
|
+
export function acpStopReason(lifecycle) {
|
|
125
|
+
if (lifecycle === "cancelled")
|
|
126
|
+
return "cancelled";
|
|
127
|
+
if (lifecycle === "failed" || lifecycle === "interrupted")
|
|
128
|
+
return "refusal";
|
|
129
|
+
return "end_turn";
|
|
130
|
+
}
|
|
131
|
+
/** Build a full RunOutcomeFacts from a lifecycle + optional partial axes,
|
|
132
|
+
* filling the honest defaults (no_changes-neutral, checks not_configured,
|
|
133
|
+
* review not_run, reason null). The ONE constructor used by terminal writers
|
|
134
|
+
* that don't already hold a facts record (executor-forced terminals, budget
|
|
135
|
+
* stops, failure-only terminals). */
|
|
136
|
+
export function makeOutcomeFacts(lifecycle, partial = {}) {
|
|
137
|
+
return {
|
|
138
|
+
lifecycle,
|
|
139
|
+
noChanges: partial.noChanges ?? false,
|
|
140
|
+
checks: partial.checks ?? "not_configured",
|
|
141
|
+
review: partial.review ?? "not_run",
|
|
142
|
+
reason: partial.reason ?? null,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** Coarse RunReason for a run that has NO decision.facts to project (a
|
|
146
|
+
* pre-arbitration failure: plan/readonly/enqueue/harness crash). Keyed on the
|
|
147
|
+
* typed failure category + lifecycle so a surface still shows an honest reason.
|
|
148
|
+
* Runs WITH a decision project decision.facts directly; this is the fallback. */
|
|
149
|
+
export function reasonFromFailureCategory(lifecycle, category) {
|
|
150
|
+
if (lifecycle === "cancelled")
|
|
151
|
+
return "user_cancelled";
|
|
152
|
+
if (lifecycle === "interrupted")
|
|
153
|
+
return "crash_interrupted";
|
|
154
|
+
if (lifecycle !== "failed")
|
|
155
|
+
return null;
|
|
156
|
+
switch (category) {
|
|
157
|
+
case "budget":
|
|
158
|
+
return "budget_exhausted";
|
|
159
|
+
case "cancelled":
|
|
160
|
+
return "user_cancelled";
|
|
161
|
+
default:
|
|
162
|
+
return "harness_failed";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** Derive RunOutcomeFacts for a decision-less terminal from its typed failure
|
|
166
|
+
* category + lifecycle. summarizeRun uses this ONLY when decision.facts is
|
|
167
|
+
* absent; it lives next to the projection owner so no surface re-derives. */
|
|
168
|
+
export function outcomeFactsFromFailure(lifecycle, category) {
|
|
169
|
+
return makeOutcomeFacts(lifecycle, { reason: reasonFromFailureCategory(lifecycle, category) });
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=status-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-projection.js","sourceRoot":"","sources":["../src/status-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AAEH;yEACyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;KAC9E,QAAQ,CACP,6JAA6J,CAC9J,CAAC;AAGJ,MAAM,CAAC,MAAM,mBAAmB,GAA8B,IAAI,GAAG,CAAC;IACpE,WAAW;IACX,QAAQ;IACR,WAAW;IACX,aAAa;CACL,CAAC,CAAC;AAEZ,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,mBAAmB,CAAC,GAAG,CAAC,KAAqB,CAAC,CAAC;AACxD,CAAC;A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