patchwork-os 0.2.0-beta.13.canary.278 → 0.2.0-beta.13.canary.279
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.
|
@@ -10,8 +10,8 @@ import type { WorkerLevelStore } from "./workerLevelStore.js";
|
|
|
10
10
|
* decisions track reality. Until then this exists to log "ramp would bypass /
|
|
11
11
|
* gate did queue" and to drive the dial.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The effective level drives two thresholds that mirror the live gate:
|
|
14
|
+
* compensable at L2+ → bypass; irreversible at L4+ → bypass; else → queue.
|
|
15
15
|
* The full earned level (0–4) is reported for the dial. The effective level is
|
|
16
16
|
* `min(earned, autonomyCeiling)`, floored to 0 for actions outside the worker's
|
|
17
17
|
* domain — a worker has no standing trust on things it doesn't own.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { classifyActionClass } from "./actionClass.js";
|
|
2
2
|
import { ownsAction } from "./worker.js";
|
|
3
|
+
const COMPENSABLE_AUTONOMY_LEVEL = 2;
|
|
3
4
|
const AUTONOMOUS_LEVEL = 4;
|
|
4
5
|
export function recommend(worker, toolName, params, store) {
|
|
5
6
|
const ac = classifyActionClass(toolName, params);
|
|
@@ -9,16 +10,25 @@ export function recommend(worker, toolName, params, store) {
|
|
|
9
10
|
let effectiveLevel = owned ? earnedLevel : 0;
|
|
10
11
|
if (effectiveLevel > worker.autonomyCeiling)
|
|
11
12
|
effectiveLevel = worker.autonomyCeiling;
|
|
12
|
-
const decision =
|
|
13
|
+
const decision = ac.reversibility === "compensable"
|
|
14
|
+
? effectiveLevel >= COMPENSABLE_AUTONOMY_LEVEL
|
|
15
|
+
? "bypass"
|
|
16
|
+
: "queue"
|
|
17
|
+
: effectiveLevel >= AUTONOMOUS_LEVEL
|
|
18
|
+
? "bypass"
|
|
19
|
+
: "queue";
|
|
20
|
+
const threshold = ac.reversibility === "compensable"
|
|
21
|
+
? COMPENSABLE_AUTONOMY_LEVEL
|
|
22
|
+
: AUTONOMOUS_LEVEL;
|
|
13
23
|
let reason;
|
|
14
24
|
if (!owned)
|
|
15
25
|
reason = "outside-worker-domain";
|
|
16
|
-
else if (worker.autonomyCeiling <
|
|
17
|
-
reason = `capped-by-autonomy-ceiling (L${worker.autonomyCeiling}, earned L${earnedLevel})`;
|
|
26
|
+
else if (worker.autonomyCeiling < threshold)
|
|
27
|
+
reason = `capped-by-autonomy-ceiling (L${worker.autonomyCeiling} < L${threshold}, earned L${earnedLevel})`;
|
|
18
28
|
else if (decision === "bypass")
|
|
19
|
-
reason =
|
|
29
|
+
reason = `autonomous (earned L${effectiveLevel}, threshold L${threshold})`;
|
|
20
30
|
else
|
|
21
|
-
reason = `below-autonomy (effective L${effectiveLevel})`;
|
|
31
|
+
reason = `below-autonomy (effective L${effectiveLevel} < L${threshold})`;
|
|
22
32
|
return {
|
|
23
33
|
decision,
|
|
24
34
|
classKey: ac.key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadowGate.js","sourceRoot":"","sources":["../../src/workers/shadowGate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AA+B9D,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,UAAU,SAAS,CACvB,MAAsB,EACtB,QAAgB,EAChB,MAA2C,EAC3C,KAAuB;IAEvB,MAAM,EAAE,GAAG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK;QAC3D,CAAC,CAAe,CAAC;IAEnB,IAAI,cAAc,GAAe,KA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a,KAAK,aAAa;QAChC,CAAC,CAAC,0BAA0B;QAC5B,CAAC,CAAC,gBAAgB,CAAC;IACvB,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC,KAAK;QAAE,MAAM,GAAG,uBAAuB,CAAC;SACxC,IAAI,MAAM,CAAC,eAAe,GAAG,SAAS;QACzC,MAAM,GAAG,gCAAgC,MAAM,CAAC,eAAe,OAAO,SAAS,aAAa,WAAW,GAAG,CAAC;SACxG,IAAI,QAAQ,KAAK,QAAQ;QAC5B,MAAM,GAAG,uBAAuB,cAAc,gBAAgB,SAAS,GAAG,CAAC;;QACxE,MAAM,GAAG,8BAA8B,cAAc,OAAO,SAAS,GAAG,CAAC;IAE9E,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,EAAE,CAAC,GAAG;QAChB,KAAK;QACL,WAAW;QACX,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,cAAc;QACd,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -47,8 +47,8 @@ export interface WorkerGateDecision {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Undoable → flows un-gated even when unearned. Only reversible actions are
|
|
50
|
-
* exempt from the trust requirement; compensable
|
|
51
|
-
*
|
|
50
|
+
* exempt from the trust requirement; compensable ones graduate to autonomous
|
|
51
|
+
* at L2+; irreversible ones wait for earned L4.
|
|
52
52
|
*/
|
|
53
53
|
export declare function flowsUngated(ac: ActionClass): boolean;
|
|
54
54
|
export declare function decideWorkerAction(worker: WorkerManifest, toolName: string, params: Record<string, unknown> | undefined, store: WorkerLevelStore): WorkerGateDecision;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { classifyActionClass } from "./actionClass.js";
|
|
2
2
|
import { ownsAction } from "./worker.js";
|
|
3
|
+
/**
|
|
4
|
+
* Compensable actions (git-remote, issue) unlock autonomous execution at L2.
|
|
5
|
+
* A compensating path exists (close the PR, delete the issue) so the cost of
|
|
6
|
+
* an error is bounded — a worker at L2 has demonstrated enough reliability
|
|
7
|
+
* that occasional human cleanup is acceptable. Irreversible actions (shell,
|
|
8
|
+
* messaging, http) still require L4; they skip L2/L3 in the reachable-levels
|
|
9
|
+
* set entirely, so this threshold never fires for them.
|
|
10
|
+
*/
|
|
11
|
+
const COMPENSABLE_AUTONOMY_LEVEL = 2;
|
|
12
|
+
/** Irreversible actions (and unowned/unearned anything) require full L4. */
|
|
3
13
|
const AUTONOMOUS_LEVEL = 4;
|
|
4
14
|
/**
|
|
5
15
|
* Undoable → flows un-gated even when unearned. Only reversible actions are
|
|
6
|
-
* exempt from the trust requirement; compensable
|
|
7
|
-
*
|
|
16
|
+
* exempt from the trust requirement; compensable ones graduate to autonomous
|
|
17
|
+
* at L2+; irreversible ones wait for earned L4.
|
|
8
18
|
*/
|
|
9
19
|
export function flowsUngated(ac) {
|
|
10
20
|
return ac.reversibility === "reversible";
|
|
@@ -49,23 +59,37 @@ export function decideWorkerAction(worker, toolName, params, store) {
|
|
|
49
59
|
reason: `reversible (${ac.blastTier} blast) — undoable, flows un-gated`,
|
|
50
60
|
};
|
|
51
61
|
}
|
|
52
|
-
// Compensable
|
|
62
|
+
// Compensable: autonomous at L2+. A compensating action exists, so the cost
|
|
63
|
+
// of being wrong is bounded. Workers earning L2 on vcs-remote or issue can
|
|
64
|
+
// push and open issues without per-action approval.
|
|
65
|
+
if (ac.reversibility === "compensable" &&
|
|
66
|
+
effectiveLevel >= COMPENSABLE_AUTONOMY_LEVEL) {
|
|
67
|
+
return {
|
|
68
|
+
...base,
|
|
69
|
+
action: "allow",
|
|
70
|
+
reason: `earned autonomy (L${effectiveLevel}) on compensable class — auto-allowed at L2+`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Irreversible (and compensable still below L2): autonomous only at L4.
|
|
53
74
|
if (effectiveLevel >= AUTONOMOUS_LEVEL) {
|
|
54
75
|
return {
|
|
55
76
|
...base,
|
|
56
77
|
action: "allow",
|
|
57
|
-
reason: `earned autonomy (L4) on
|
|
78
|
+
reason: `earned autonomy (L4) on ${ac.reversibility} class`,
|
|
58
79
|
};
|
|
59
80
|
}
|
|
81
|
+
const threshold = ac.reversibility === "compensable"
|
|
82
|
+
? COMPENSABLE_AUTONOMY_LEVEL
|
|
83
|
+
: AUTONOMOUS_LEVEL;
|
|
60
84
|
let reason;
|
|
61
85
|
if (!owned) {
|
|
62
86
|
reason = `${ac.reversibility} action outside the worker's owned domain — gated`;
|
|
63
87
|
}
|
|
64
|
-
else if (worker.autonomyCeiling <
|
|
65
|
-
reason = `${ac.reversibility} class capped by autonomy ceiling (L${worker.autonomyCeiling}) — always gated`;
|
|
88
|
+
else if (worker.autonomyCeiling < threshold) {
|
|
89
|
+
reason = `${ac.reversibility} class capped by autonomy ceiling (L${worker.autonomyCeiling} < L${threshold}) — always gated`;
|
|
66
90
|
}
|
|
67
91
|
else {
|
|
68
|
-
reason = `${ac.reversibility} + unearned (effective L${effectiveLevel} <
|
|
92
|
+
reason = `${ac.reversibility} + unearned (effective L${effectiveLevel} < L${threshold}) — gated for approval`;
|
|
69
93
|
}
|
|
70
94
|
return { ...base, action: "gate", reason };
|
|
71
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerGate.js","sourceRoot":"","sources":["../../src/workers/workerGate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAuB,MAAM,aAAa,CAAC;AAiD9D,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAe;IAC1C,OAAO,EAAE,CAAC,aAAa,KAAK,YAAY,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAAsB,EACtB,QAAgB,EAChB,MAA2C,EAC3C,KAAuB;IAEvB,MAAM,EAAE,GAAG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,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M,EAAE,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "patchwork-os",
|
|
3
|
-
"version": "0.2.0-beta.13.canary.
|
|
3
|
+
"version": "0.2.0-beta.13.canary.279",
|
|
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",
|