patchwork-os 1.2.0-beta.3.canary.896 → 1.2.0-beta.3.canary.898
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/commands/policyExplain.d.ts +2 -0
- package/dist/commands/policyExplain.js +9 -1
- package/dist/commands/policyExplain.js.map +1 -1
- package/dist/commands/recipe.d.ts +8 -3
- package/dist/commands/recipe.js +28 -5
- package/dist/commands/recipe.js.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/privacy/boundaryReceipts.d.ts +14 -0
- package/dist/privacy/boundaryReceipts.js +3 -0
- package/dist/privacy/boundaryReceipts.js.map +1 -1
- package/dist/recipeRoutes.js +19 -2
- package/dist/recipeRoutes.js.map +1 -1
- package/dist/recipes/haltCategory.d.ts +9 -0
- package/dist/recipes/haltCategory.js +25 -0
- package/dist/recipes/haltCategory.js.map +1 -1
- package/dist/recipes/schemaGenerator.js +33 -8
- package/dist/recipes/schemaGenerator.js.map +1 -1
- package/dist/recipes/simulation/policyProjection.d.ts +26 -0
- package/dist/recipes/simulation/policyProjection.js +62 -0
- package/dist/recipes/simulation/policyProjection.js.map +1 -0
- package/dist/recipes/simulation/simulate.d.ts +12 -5
- package/dist/recipes/simulation/simulate.js +75 -19
- package/dist/recipes/simulation/simulate.js.map +1 -1
- package/dist/recipes/simulation/types.d.ts +63 -12
- package/dist/recipes/simulation/types.js +13 -4
- package/dist/recipes/simulation/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Design constraints baked into the shape (from the 2026-06-04 investigation,
|
|
10
10
|
* `docs/counterfactual-sim-engine-investigation.md`):
|
|
11
|
-
* - `gatedOnRecipeSteps` is a first-class
|
|
12
|
-
* imply an approval gate that
|
|
13
|
-
*
|
|
11
|
+
* - `gatedOnRecipeSteps` is a first-class field so a consumer can never
|
|
12
|
+
* imply an approval gate that the runtime would not apply — nor hide one
|
|
13
|
+
* it would. Since v3 it is COMPUTED from the effective policy (the same
|
|
14
|
+
* `computeEffectivePolicy` both runners consult per step), never a
|
|
15
|
+
* constant; `null` when the policy could not be evaluated.
|
|
14
16
|
* - cost carries an explicit `basis` and is never a precise dollar figure or
|
|
15
17
|
* `$0` — at static fidelity USD is genuinely not projectable.
|
|
16
18
|
* - conditional branches resolve to `"undetermined"`, never a faked
|
|
@@ -25,8 +27,15 @@
|
|
|
25
27
|
* and the `taken`/`skipped` branch outcomes (alongside the existing
|
|
26
28
|
* `undetermined`). All additions are additive/back-compatible — a static report
|
|
27
29
|
* is still a valid v2 report.
|
|
30
|
+
*
|
|
31
|
+
* v3: the approval projection is the RUNTIME's verdict, not a tier guess.
|
|
32
|
+
* `gatedOnRecipeSteps` becomes `boolean | null` and is computed;
|
|
33
|
+
* `ApprovalProjection` gains `verdict` / `consultsApproval` and its
|
|
34
|
+
* `wouldRequireApproval` now means "the runner would hold this step for a
|
|
35
|
+
* human" (`null` when unknown); `approvals` gains `basis`, `profile` and
|
|
36
|
+
* `trigger`. A meaning change, hence the bump.
|
|
28
37
|
*/
|
|
29
|
-
export declare const SIMULATION_SCHEMA_VERSION =
|
|
38
|
+
export declare const SIMULATION_SCHEMA_VERSION = 3;
|
|
30
39
|
export type RiskTier = "low" | "medium" | "high";
|
|
31
40
|
/**
|
|
32
41
|
* Side-effect class for a single step, derived from registry metadata
|
|
@@ -64,15 +73,45 @@ export interface SimulationStep {
|
|
|
64
73
|
*/
|
|
65
74
|
mockedFrom?: "history" | "synthesized";
|
|
66
75
|
}
|
|
67
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* The effective-policy verdict for one step, as `computeEffectivePolicy`
|
|
78
|
+
* returns it, or `"unknown"` when it was not evaluated (a nested-recipe or
|
|
79
|
+
* compound step, or a report built with no policy input).
|
|
80
|
+
*/
|
|
81
|
+
export type StepPolicyVerdict = "ALLOW" | "HUMAN_APPROVAL_REQUIRED" | "REFUSED" | "unknown";
|
|
82
|
+
/** Per-step approval projection — what the runtime WOULD do with this step. */
|
|
68
83
|
export interface ApprovalProjection {
|
|
69
84
|
stepId: string;
|
|
70
85
|
tool?: string;
|
|
71
86
|
tier: RiskTier;
|
|
72
|
-
/**
|
|
73
|
-
|
|
87
|
+
/**
|
|
88
|
+
* True when the runner would hold this step for a human
|
|
89
|
+
* (`verdict === "HUMAN_APPROVAL_REQUIRED"`); false when it would not;
|
|
90
|
+
* `null` when the verdict is unknown.
|
|
91
|
+
*/
|
|
92
|
+
wouldRequireApproval: boolean | null;
|
|
93
|
+
/** The effective-policy verdict for this step. */
|
|
94
|
+
verdict: StepPolicyVerdict;
|
|
95
|
+
/** True when the runner consults the approval gate for this step at all. */
|
|
96
|
+
consultsApproval?: boolean;
|
|
74
97
|
reason: string;
|
|
75
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Per-step effective-policy facts handed to the pure transform. Built by
|
|
101
|
+
* `projectRecipePolicy` from `computeEffectivePolicy` — the transform never
|
|
102
|
+
* derives a verdict itself.
|
|
103
|
+
*/
|
|
104
|
+
export interface SimulationPolicy {
|
|
105
|
+
profile: "governed" | "compat";
|
|
106
|
+
/** The trigger the runtime evaluates (a top-level chained run is "manual"). */
|
|
107
|
+
trigger: string;
|
|
108
|
+
/** Keyed by plan step id. A step absent here was not evaluated. */
|
|
109
|
+
steps: Map<string, {
|
|
110
|
+
final: Exclude<StepPolicyVerdict, "unknown">;
|
|
111
|
+
consultsApproval: boolean;
|
|
112
|
+
reason: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
76
115
|
/** A conditional branch surfaced by the engine. */
|
|
77
116
|
export interface BranchProjection {
|
|
78
117
|
stepId: string;
|
|
@@ -173,16 +212,28 @@ export interface RecipeSimulationReport {
|
|
|
173
212
|
/** "chained" recipes have a real DAG; "flat" recipes are a linear list. */
|
|
174
213
|
topology: "chained" | "flat";
|
|
175
214
|
/**
|
|
176
|
-
* CRITICAL honesty field.
|
|
177
|
-
*
|
|
178
|
-
*
|
|
215
|
+
* CRITICAL honesty field. True when the runtime consults the approval gate
|
|
216
|
+
* for at least one of this recipe's steps under the current profile,
|
|
217
|
+
* approval-gate setting and trigger; false when it consults it for none;
|
|
218
|
+
* `null` when the effective policy could not be evaluated. Computed from
|
|
219
|
+
* `computeEffectivePolicy`, never a constant.
|
|
179
220
|
*/
|
|
180
|
-
gatedOnRecipeSteps: boolean;
|
|
221
|
+
gatedOnRecipeSteps: boolean | null;
|
|
181
222
|
steps: SimulationStep[];
|
|
182
223
|
summary: SimulationSummary;
|
|
183
224
|
risk: RunRiskSummary;
|
|
184
225
|
approvals: {
|
|
185
|
-
gatedOnRecipeSteps: boolean;
|
|
226
|
+
gatedOnRecipeSteps: boolean | null;
|
|
227
|
+
/**
|
|
228
|
+
* `"effective-policy"`: verdicts come from `computeEffectivePolicy`.
|
|
229
|
+
* `"unavailable"`: the policy could not be evaluated; verdicts are
|
|
230
|
+
* `"unknown"` and nothing is claimed either way.
|
|
231
|
+
*/
|
|
232
|
+
basis: "effective-policy" | "unavailable";
|
|
233
|
+
/** Governance profile the verdicts were computed under. */
|
|
234
|
+
profile?: "governed" | "compat";
|
|
235
|
+
/** Trigger the verdicts were computed for. */
|
|
236
|
+
trigger?: string;
|
|
186
237
|
projected: ApprovalProjection[];
|
|
187
238
|
note: string;
|
|
188
239
|
};
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Design constraints baked into the shape (from the 2026-06-04 investigation,
|
|
10
10
|
* `docs/counterfactual-sim-engine-investigation.md`):
|
|
11
|
-
* - `gatedOnRecipeSteps` is a first-class
|
|
12
|
-
* imply an approval gate that
|
|
13
|
-
*
|
|
11
|
+
* - `gatedOnRecipeSteps` is a first-class field so a consumer can never
|
|
12
|
+
* imply an approval gate that the runtime would not apply — nor hide one
|
|
13
|
+
* it would. Since v3 it is COMPUTED from the effective policy (the same
|
|
14
|
+
* `computeEffectivePolicy` both runners consult per step), never a
|
|
15
|
+
* constant; `null` when the policy could not be evaluated.
|
|
14
16
|
* - cost carries an explicit `basis` and is never a precise dollar figure or
|
|
15
17
|
* `$0` — at static fidelity USD is genuinely not projectable.
|
|
16
18
|
* - conditional branches resolve to `"undetermined"`, never a faked
|
|
@@ -25,6 +27,13 @@
|
|
|
25
27
|
* and the `taken`/`skipped` branch outcomes (alongside the existing
|
|
26
28
|
* `undetermined`). All additions are additive/back-compatible — a static report
|
|
27
29
|
* is still a valid v2 report.
|
|
30
|
+
*
|
|
31
|
+
* v3: the approval projection is the RUNTIME's verdict, not a tier guess.
|
|
32
|
+
* `gatedOnRecipeSteps` becomes `boolean | null` and is computed;
|
|
33
|
+
* `ApprovalProjection` gains `verdict` / `consultsApproval` and its
|
|
34
|
+
* `wouldRequireApproval` now means "the runner would hold this step for a
|
|
35
|
+
* human" (`null` when unknown); `approvals` gains `basis`, `profile` and
|
|
36
|
+
* `trigger`. A meaning change, hence the bump.
|
|
28
37
|
*/
|
|
29
|
-
export const SIMULATION_SCHEMA_VERSION =
|
|
38
|
+
export const SIMULATION_SCHEMA_VERSION = 3;
|
|
30
39
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/recipes/simulation/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/recipes/simulation/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchwork-os",
|
|
3
|
-
"version": "1.2.0-beta.3.canary.
|
|
3
|
+
"version": "1.2.0-beta.3.canary.898",
|
|
4
4
|
"description": "Your personal AI runtime, local-first. Patchwork OS gives any AI model a consistent set of tools, YAML recipes, a delegation policy with approval queue, and a durable trace memory — all on your machine, all under your policy.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|