patchwork-os 0.2.0-beta.13.canary.265 → 0.2.0-beta.13.canary.266
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/package.json +1 -1
- package/dist/workers/actionClass.d.ts +0 -31
- package/dist/workers/actionClass.js +0 -137
- package/dist/workers/actionClass.js.map +0 -1
- package/dist/workers/graduation.d.ts +0 -52
- package/dist/workers/graduation.js +0 -86
- package/dist/workers/graduation.js.map +0 -1
- package/dist/workers/shadowGate.d.ts +0 -30
- package/dist/workers/shadowGate.js +0 -32
- package/dist/workers/shadowGate.js.map +0 -1
- package/dist/workers/shadowRun.d.ts +0 -38
- package/dist/workers/shadowRun.js +0 -44
- package/dist/workers/shadowRun.js.map +0 -1
- package/dist/workers/trustLevel.d.ts +0 -77
- package/dist/workers/trustLevel.js +0 -91
- package/dist/workers/trustLevel.js.map +0 -1
- package/dist/workers/worker.d.ts +0 -41
- package/dist/workers/worker.js +0 -77
- package/dist/workers/worker.js.map +0 -1
- package/dist/workers/workerLevelStore.d.ts +0 -33
- package/dist/workers/workerLevelStore.js +0 -87
- package/dist/workers/workerLevelStore.js.map +0 -1
- package/templates/workers/dependency-upkeep.worker.yaml +0 -18
- package/templates/workers/release-notes.worker.yaml +0 -17
- package/templates/workers/test-guardian.worker.yaml +0 -18
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.266",
|
|
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",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type RiskTier } from "../riskTier.js";
|
|
2
|
-
/**
|
|
3
|
-
* Worker trust is scoped per (worker × action-class), never globally. An
|
|
4
|
-
* action-class is the unit that accumulates evidence. It is intentionally
|
|
5
|
-
* COARSE enough to graduate (a worker touches only a handful) yet keyed on
|
|
6
|
-
* blast-tier so that a rarer, higher-blast action in the same domain is a
|
|
7
|
-
* DISTINCT, less-trusted class — competence on routine `git status` can never
|
|
8
|
-
* transfer to `git push --force`. (worker-ramp-v0)
|
|
9
|
-
*/
|
|
10
|
-
export type Reversibility = "reversible" | "compensable" | "irreversible";
|
|
11
|
-
export interface ActionClass {
|
|
12
|
-
/** Stable identity: `${domain}:${reversibility}:${blastTier}`. */
|
|
13
|
-
key: string;
|
|
14
|
-
domain: string;
|
|
15
|
-
reversibility: Reversibility;
|
|
16
|
-
blastTier: RiskTier;
|
|
17
|
-
/**
|
|
18
|
-
* Brand/reputational exposure — a DISTINCT gating dimension from safety blast
|
|
19
|
-
* radius (cf. Arts & Media: low safety risk, high reputational risk). An
|
|
20
|
-
* externally-visible action (outbound message, public PR/push, issue) whose
|
|
21
|
-
* failure damages reputation rather than (or as well as) systems. Folds into
|
|
22
|
-
* the failure weight so reputational mistakes demote trust harder.
|
|
23
|
-
*/
|
|
24
|
-
brandExposed: boolean;
|
|
25
|
-
}
|
|
26
|
-
export declare function classifyActionClass(toolName: string, _params?: Record<string, unknown>): ActionClass;
|
|
27
|
-
export declare function outcomeWeight(actionClass: ActionClass, good: boolean): number;
|
|
28
|
-
/** Which ramp rungs are reachable for a class. Irreversible classes skip the
|
|
29
|
-
* safety-net rungs L2/L3 (no compensating action exists), so they must clear a
|
|
30
|
-
* higher bar to reach L4. */
|
|
31
|
-
export declare function reachableLevels(actionClass: ActionClass): number[];
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { classifyTool } from "../riskTier.js";
|
|
2
|
-
/**
|
|
3
|
-
* Tool → capability domain. Coarse on purpose. Unknown tools fall to "other"
|
|
4
|
-
* (treated as irreversible — conservative: an unrecognised side effect is
|
|
5
|
-
* assumed unrecoverable until proven otherwise).
|
|
6
|
-
*/
|
|
7
|
-
const DOMAIN_BY_TOOL = {
|
|
8
|
-
// version control — read
|
|
9
|
-
getGitStatus: "vcs-read",
|
|
10
|
-
getGitDiff: "vcs-read",
|
|
11
|
-
getGitLog: "vcs-read",
|
|
12
|
-
gitBlame: "vcs-read",
|
|
13
|
-
gitListBranches: "vcs-read",
|
|
14
|
-
// version control — local mutations (reversible: reset/reflog/restore)
|
|
15
|
-
gitAdd: "vcs-local",
|
|
16
|
-
gitCommit: "vcs-local",
|
|
17
|
-
gitCheckout: "vcs-local",
|
|
18
|
-
gitStash: "vcs-local",
|
|
19
|
-
// version control — remote / shared history
|
|
20
|
-
gitPush: "vcs-remote",
|
|
21
|
-
githubCreatePR: "vcs-remote",
|
|
22
|
-
githubMergePR: "vcs-remote",
|
|
23
|
-
// filesystem
|
|
24
|
-
editText: "fs-write",
|
|
25
|
-
searchAndReplace: "fs-write",
|
|
26
|
-
createFile: "fs-write",
|
|
27
|
-
formatDocument: "fs-write",
|
|
28
|
-
getBufferContent: "fs-read",
|
|
29
|
-
findFiles: "fs-read",
|
|
30
|
-
// shell
|
|
31
|
-
runCommand: "shell",
|
|
32
|
-
runInTerminal: "shell",
|
|
33
|
-
sendTerminalCommand: "shell",
|
|
34
|
-
// outbound messaging
|
|
35
|
-
slackPostMessage: "messaging",
|
|
36
|
-
// generic network
|
|
37
|
-
sendHttpRequest: "http",
|
|
38
|
-
WebFetch: "http",
|
|
39
|
-
// issue trackers
|
|
40
|
-
githubCreateIssue: "issue",
|
|
41
|
-
createLinearIssue: "issue",
|
|
42
|
-
addLinearComment: "issue",
|
|
43
|
-
updateLinearIssue: "issue",
|
|
44
|
-
// CI / tests
|
|
45
|
-
runTests: "ci",
|
|
46
|
-
githubActions: "ci",
|
|
47
|
-
// dependency intel (read-only)
|
|
48
|
-
auditDependencies: "deps-read",
|
|
49
|
-
getSecurityAdvisories: "deps-read",
|
|
50
|
-
// recipe-tool ids — RecipeRunLog records THESE (not the MCP names), so the
|
|
51
|
-
// shadow dial attributes recipe-run steps by them. git.*/github.list_* are
|
|
52
|
-
// reads; file.* writes; slack/http are outbound. (worker-ramp-v0 dogfood)
|
|
53
|
-
"git.log_since": "vcs-read",
|
|
54
|
-
"git.stale_branches": "vcs-read",
|
|
55
|
-
"github.list_commits": "vcs-read",
|
|
56
|
-
"github.list_prs": "vcs-read",
|
|
57
|
-
"github.list_issues": "vcs-read",
|
|
58
|
-
"file.read": "fs-read",
|
|
59
|
-
"file.write": "fs-write",
|
|
60
|
-
"file.append": "fs-write",
|
|
61
|
-
"slack.post_message": "messaging",
|
|
62
|
-
"http.post": "http",
|
|
63
|
-
"linear.list_issues": "issue",
|
|
64
|
-
"sentry.get_issue": "issue",
|
|
65
|
-
"diagnostics.get": "fs-read",
|
|
66
|
-
};
|
|
67
|
-
/** Domain → reversibility. The middle ramp rungs (L2/L3) only exist for a class
|
|
68
|
-
* whose reversibility is not "irreversible", so this is load-bearing. */
|
|
69
|
-
const REVERSIBILITY_BY_DOMAIN = {
|
|
70
|
-
"vcs-read": "reversible",
|
|
71
|
-
"vcs-local": "reversible", // reset / reflog / restore
|
|
72
|
-
"vcs-remote": "compensable", // force-push back / close PR — lossy, possible
|
|
73
|
-
"fs-write": "reversible", // transactions + WriteEffectLedger
|
|
74
|
-
"fs-read": "reversible",
|
|
75
|
-
shell: "irreversible", // arbitrary side effects — assume unrecoverable
|
|
76
|
-
messaging: "irreversible", // a sent message can't be unsent reliably
|
|
77
|
-
http: "irreversible", // a POST may not be undoable
|
|
78
|
-
issue: "compensable", // close / delete the created issue
|
|
79
|
-
ci: "reversible", // re-runnable, no durable side effect
|
|
80
|
-
"deps-read": "reversible",
|
|
81
|
-
other: "irreversible",
|
|
82
|
-
};
|
|
83
|
-
/** Domains whose actions are externally visible — failure is reputational. */
|
|
84
|
-
const BRAND_EXPOSED_DOMAINS = new Set([
|
|
85
|
-
"messaging",
|
|
86
|
-
"vcs-remote",
|
|
87
|
-
"issue",
|
|
88
|
-
"http",
|
|
89
|
-
]);
|
|
90
|
-
export function classifyActionClass(toolName, _params) {
|
|
91
|
-
const domain = DOMAIN_BY_TOOL[toolName] ?? "other";
|
|
92
|
-
const reversibility = REVERSIBILITY_BY_DOMAIN[domain] ?? "irreversible";
|
|
93
|
-
const blastTier = classifyTool(toolName);
|
|
94
|
-
return {
|
|
95
|
-
key: `${domain}:${reversibility}:${blastTier}`,
|
|
96
|
-
domain,
|
|
97
|
-
reversibility,
|
|
98
|
-
blastTier,
|
|
99
|
-
brandExposed: BRAND_EXPOSED_DOMAINS.has(domain),
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const BLAST_MULTIPLIER = {
|
|
103
|
-
low: 2,
|
|
104
|
-
medium: 5,
|
|
105
|
-
high: 12,
|
|
106
|
-
};
|
|
107
|
-
const REVERSIBILITY_MULTIPLIER = {
|
|
108
|
-
reversible: 1,
|
|
109
|
-
compensable: 1.5,
|
|
110
|
-
irreversible: 3,
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Evidence weight for one outcome. A routine success is low-information
|
|
114
|
-
* (weight 1 → the posterior climbs slowly). A failure is weighted by
|
|
115
|
-
* blast-tier × reversibility, so a high-blast irreversible failure is high
|
|
116
|
-
* information and craters the posterior (instant demote). This is the entire
|
|
117
|
-
* anti-trust-transfer-grinding defence: count alone never graduates a risky
|
|
118
|
-
* class, and one catastrophic outcome dominates a thousand trivial ones.
|
|
119
|
-
*/
|
|
120
|
-
const BRAND_MULTIPLIER = 1.5;
|
|
121
|
-
export function outcomeWeight(actionClass, good) {
|
|
122
|
-
if (good)
|
|
123
|
-
return 1;
|
|
124
|
-
const brand = actionClass.brandExposed ? BRAND_MULTIPLIER : 1;
|
|
125
|
-
return (BLAST_MULTIPLIER[actionClass.blastTier] *
|
|
126
|
-
REVERSIBILITY_MULTIPLIER[actionClass.reversibility] *
|
|
127
|
-
brand);
|
|
128
|
-
}
|
|
129
|
-
/** Which ramp rungs are reachable for a class. Irreversible classes skip the
|
|
130
|
-
* safety-net rungs L2/L3 (no compensating action exists), so they must clear a
|
|
131
|
-
* higher bar to reach L4. */
|
|
132
|
-
export function reachableLevels(actionClass) {
|
|
133
|
-
return actionClass.reversibility === "irreversible"
|
|
134
|
-
? [0, 1, 4]
|
|
135
|
-
: [0, 1, 2, 3, 4];
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=actionClass.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actionClass.js","sourceRoot":"","sources":["../../src/workers/actionClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AA6B7D;;;;GAIG;AACH,MAAM,cAAc,GAA2B;IAC7C,yBAAyB;IACzB,YAAY,EAAE,UAAU;IACxB,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,UAAU;IACpB,eAAe,EAAE,UAAU;IAC3B,uEAAuE;IACvE,MAAM,EAAE,WAAW;IACnB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,WAAW;IACrB,4CAA4C;IAC5C,OAAO,EAAE,YAAY;IACrB,cAAc,EAAE,YAAY;IAC5B,aAAa,EAAE,YAAY;IAC3B,aAAa;IACb,QAAQ,EAAE,UAAU;IACpB,gBAAgB,EAAE,UAAU;IAC5B,UAAU,EAAE,UAAU;IACtB,cAAc,EAAE,UAAU;IAC1B,gBAAgB,EAAE,SAAS;IAC3B,SAAS,EAAE,SAAS;IACpB,QAAQ;IACR,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,OAAO;IACtB,mBAAmB,EAAE,OAAO;IAC5B,qBAAqB;IACrB,gBAAgB,EAAE,WAAW;IAC7B,kBAAkB;IAClB,eAAe,EAAE,MAAM;IACvB,QAAQ,EAAE,MAAM;IAChB,iBAAiB;IACjB,iBAAiB,EAAE,OAAO;IAC1B,iBAAiB,EAAE,OAAO;IAC1B,gBA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 @@
|
|
|
1
|
-
import { type Posterior, type TrustLevel } from "./trustLevel.js";
|
|
2
|
-
/**
|
|
3
|
-
* Folds outcomes into a (worker × action-class) trust state and decides
|
|
4
|
-
* promotions/demotions with the asymmetry + hysteresis the ramp requires:
|
|
5
|
-
* - DEMOTE is instant and can jump multiple rungs (one catastrophic outcome
|
|
6
|
-
* craters the posterior; we honor it immediately, even mid-dwell);
|
|
7
|
-
* - PROMOTE is gated by dwell-time (real elapsed time since the last level
|
|
8
|
-
* change) AND a post-demote cooldown, and climbs only to the NEXT reachable
|
|
9
|
-
* rung — so reaching L4 needs both sustained evidence and sustained time.
|
|
10
|
-
* Every level change emits an event — the promotion/demotion log is the
|
|
11
|
-
* compliance/audit artifact.
|
|
12
|
-
*/
|
|
13
|
-
export interface Outcome {
|
|
14
|
-
toolName: string;
|
|
15
|
-
good: boolean;
|
|
16
|
-
/** epoch ms (passed in — the runtime has no Date.now() in pure code). */
|
|
17
|
-
at: number;
|
|
18
|
-
params?: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export interface ClassTrustState {
|
|
21
|
-
classKey: string;
|
|
22
|
-
posterior: Posterior;
|
|
23
|
-
prior: Posterior;
|
|
24
|
-
level: TrustLevel;
|
|
25
|
-
/** epoch ms of the last level change (drives dwell). */
|
|
26
|
-
lastChangeAt: number;
|
|
27
|
-
/** epoch ms before which promotions are blocked (post-demote cooldown). */
|
|
28
|
-
demoteUntil: number;
|
|
29
|
-
observations: number;
|
|
30
|
-
}
|
|
31
|
-
export interface GraduationConfig {
|
|
32
|
-
dwellMs: number;
|
|
33
|
-
demoteCooldownMs: number;
|
|
34
|
-
k?: number;
|
|
35
|
-
minEvidenceForGraduation?: number;
|
|
36
|
-
}
|
|
37
|
-
export declare const DEFAULT_GRADUATION_CONFIG: GraduationConfig;
|
|
38
|
-
export interface GraduationEvent {
|
|
39
|
-
type: "promote" | "demote";
|
|
40
|
-
classKey: string;
|
|
41
|
-
from: TrustLevel;
|
|
42
|
-
to: TrustLevel;
|
|
43
|
-
at: number;
|
|
44
|
-
lcb: number;
|
|
45
|
-
evidence: number;
|
|
46
|
-
reason: string;
|
|
47
|
-
}
|
|
48
|
-
export declare function initialState(classKey: string, prior: Posterior, at?: number): ClassTrustState;
|
|
49
|
-
export declare function graduate(state: ClassTrustState, outcome: Outcome, cfg?: GraduationConfig): {
|
|
50
|
-
state: ClassTrustState;
|
|
51
|
-
event?: GraduationEvent;
|
|
52
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { classifyActionClass, outcomeWeight, reachableLevels, } from "./actionClass.js";
|
|
2
|
-
import { applyOutcome, levelFromPosterior, } from "./trustLevel.js";
|
|
3
|
-
export const DEFAULT_GRADUATION_CONFIG = {
|
|
4
|
-
dwellMs: 6 * 60 * 60 * 1000, // 6h between climbs
|
|
5
|
-
demoteCooldownMs: 24 * 60 * 60 * 1000, // 24h freeze after a fall
|
|
6
|
-
minEvidenceForGraduation: 10,
|
|
7
|
-
};
|
|
8
|
-
export function initialState(classKey, prior, at = 0) {
|
|
9
|
-
return {
|
|
10
|
-
classKey,
|
|
11
|
-
posterior: prior,
|
|
12
|
-
prior,
|
|
13
|
-
level: 0,
|
|
14
|
-
lastChangeAt: at,
|
|
15
|
-
demoteUntil: 0,
|
|
16
|
-
observations: 0,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export function graduate(state, outcome, cfg = DEFAULT_GRADUATION_CONFIG) {
|
|
20
|
-
const ac = classifyActionClass(outcome.toolName, outcome.params);
|
|
21
|
-
const weight = outcomeWeight(ac, outcome.good);
|
|
22
|
-
const posterior = applyOutcome(state.posterior, outcome.good, weight);
|
|
23
|
-
const observations = state.observations + 1;
|
|
24
|
-
const result = levelFromPosterior(posterior, state.prior, {
|
|
25
|
-
k: cfg.k,
|
|
26
|
-
minEvidenceForGraduation: cfg.minEvidenceForGraduation,
|
|
27
|
-
reachable: reachableLevels(ac),
|
|
28
|
-
});
|
|
29
|
-
const candidate = result.level;
|
|
30
|
-
const base = {
|
|
31
|
-
...state,
|
|
32
|
-
posterior,
|
|
33
|
-
observations,
|
|
34
|
-
};
|
|
35
|
-
// DEMOTE — instant, may skip rungs.
|
|
36
|
-
if (candidate < state.level) {
|
|
37
|
-
const next = {
|
|
38
|
-
...base,
|
|
39
|
-
level: candidate,
|
|
40
|
-
lastChangeAt: outcome.at,
|
|
41
|
-
demoteUntil: outcome.at + cfg.demoteCooldownMs,
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
state: next,
|
|
45
|
-
event: {
|
|
46
|
-
type: "demote",
|
|
47
|
-
classKey: state.classKey,
|
|
48
|
-
from: state.level,
|
|
49
|
-
to: candidate,
|
|
50
|
-
at: outcome.at,
|
|
51
|
-
lcb: result.lcb,
|
|
52
|
-
evidence: result.evidence,
|
|
53
|
-
reason: `blast-weighted failure (weight=${weight})`,
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
// PROMOTE — gated by dwell + cooldown, one reachable rung at a time.
|
|
58
|
-
if (candidate > state.level) {
|
|
59
|
-
const dwellOk = outcome.at >= state.lastChangeAt + cfg.dwellMs;
|
|
60
|
-
const cooldownOk = outcome.at >= state.demoteUntil;
|
|
61
|
-
if (dwellOk && cooldownOk) {
|
|
62
|
-
const nextRung = reachableLevels(ac)
|
|
63
|
-
.filter((r) => r > state.level && r <= candidate)
|
|
64
|
-
.sort((a, b) => a - b)[0];
|
|
65
|
-
if (nextRung !== undefined) {
|
|
66
|
-
const to = nextRung;
|
|
67
|
-
return {
|
|
68
|
-
state: { ...base, level: to, lastChangeAt: outcome.at },
|
|
69
|
-
event: {
|
|
70
|
-
type: "promote",
|
|
71
|
-
classKey: state.classKey,
|
|
72
|
-
from: state.level,
|
|
73
|
-
to,
|
|
74
|
-
at: outcome.at,
|
|
75
|
-
lcb: result.lcb,
|
|
76
|
-
evidence: result.evidence,
|
|
77
|
-
reason: `sustained evidence (lcb=${result.lcb.toFixed(3)})`,
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// No level change — posterior still updates.
|
|
84
|
-
return { state: base };
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=graduation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graduation.js","sourceRoot":"","sources":["../../src/workers/graduation.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,kBAAkB,GAGnB,MAAM,iBAAiB,CAAC;AAyCzB,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,oBAAoB;IACjD,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,0BAA0B;IACjE,wBAAwB,EAAE,EAAE;CAC7B,CAAC;AAaF,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,KAAgB,EAChB,EAAE,GAAG,CAAC;IAEN,OAAO;QACL,QAAQ;QACR,SAAS,EAAE,KAAK;QAChB,KAAK;QACL,KAAK,EAAE,CAAC;QACR,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,CAAC;QACd,YAAY,EAAE,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,KAAsB,EACtB,OAAgB,EAChB,MAAwB,yBAAyB;IAEjD,MAAM,EAAE,GAAgB,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM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AAK,CAAC,WAAW,CAAC;QACnD,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,CAAC;iBACjC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,IAAI,SAAS,CAAC;iBAChD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,EAAE,GAAG,QAAsB,CAAC;gBAClC,OAAO;oBACL,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,EAAE;oBACvD,KAAK,EAAE;wBACL,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,IAAI,EAAE,KAAK,CAAC,KAAK;wBACjB,EAAE;wBACF,EAAE,EAAE,OAAO,CAAC,EAAE;wBACd,GAAG,EAAE,MAAM,CAAC,GAAG;wBACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,MAAM,EAAE,2BAA2B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;qBAC5D;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,6CAA6C;IAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { TrustLevel } from "./trustLevel.js";
|
|
2
|
-
import { type WorkerManifest } from "./worker.js";
|
|
3
|
-
import type { WorkerLevelStore } from "./workerLevelStore.js";
|
|
4
|
-
/**
|
|
5
|
-
* What the ramp WOULD decide for a worker's action — a PURE recommendation.
|
|
6
|
-
*
|
|
7
|
-
* v0 is shadow-only: this is NOT wired into the live approval gate
|
|
8
|
-
* (`evaluateInProcessGate`). Flipping the gate to obey the ramp is a deliberate,
|
|
9
|
-
* flag-gated phase-2 step, taken only after shadow data shows the ramp's
|
|
10
|
-
* decisions track reality. Until then this exists to log "ramp would bypass /
|
|
11
|
-
* gate did queue" and to drive the dial.
|
|
12
|
-
*
|
|
13
|
-
* Only the two execution modes that already exist are actionable in v0:
|
|
14
|
-
* L4 → bypass (autonomous), everything below → queue (approve-each).
|
|
15
|
-
* The full earned level (0–4) is reported for the dial. The effective level is
|
|
16
|
-
* `min(earned, autonomyCeiling)`, floored to 0 for actions outside the worker's
|
|
17
|
-
* domain — a worker has no standing trust on things it doesn't own.
|
|
18
|
-
*/
|
|
19
|
-
export interface ShadowDecision {
|
|
20
|
-
decision: "queue" | "bypass";
|
|
21
|
-
classKey: string;
|
|
22
|
-
owned: boolean;
|
|
23
|
-
/** Trust the worker has actually earned on this class (drives the dial). */
|
|
24
|
-
earnedLevel: TrustLevel;
|
|
25
|
-
autonomyCeiling: TrustLevel;
|
|
26
|
-
/** What the gate would operate at: min(earned, ceiling), 0 if not owned. */
|
|
27
|
-
effectiveLevel: TrustLevel;
|
|
28
|
-
reason: string;
|
|
29
|
-
}
|
|
30
|
-
export declare function recommend(worker: WorkerManifest, toolName: string, params: Record<string, unknown> | undefined, store: WorkerLevelStore): ShadowDecision;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { classifyActionClass } from "./actionClass.js";
|
|
2
|
-
import { ownsAction } from "./worker.js";
|
|
3
|
-
const AUTONOMOUS_LEVEL = 4;
|
|
4
|
-
export function recommend(worker, toolName, params, store) {
|
|
5
|
-
const ac = classifyActionClass(toolName, params);
|
|
6
|
-
const owned = ownsAction(worker, ac);
|
|
7
|
-
const earnedLevel = (store.getState(worker.id, ac.key)?.level ??
|
|
8
|
-
0);
|
|
9
|
-
let effectiveLevel = owned ? earnedLevel : 0;
|
|
10
|
-
if (effectiveLevel > worker.autonomyCeiling)
|
|
11
|
-
effectiveLevel = worker.autonomyCeiling;
|
|
12
|
-
const decision = effectiveLevel >= AUTONOMOUS_LEVEL ? "bypass" : "queue";
|
|
13
|
-
let reason;
|
|
14
|
-
if (!owned)
|
|
15
|
-
reason = "outside-worker-domain";
|
|
16
|
-
else if (worker.autonomyCeiling < earnedLevel)
|
|
17
|
-
reason = `capped-by-autonomy-ceiling (L${worker.autonomyCeiling}, earned L${earnedLevel})`;
|
|
18
|
-
else if (decision === "bypass")
|
|
19
|
-
reason = "autonomous (earned L4)";
|
|
20
|
-
else
|
|
21
|
-
reason = `below-autonomy (effective L${effectiveLevel})`;
|
|
22
|
-
return {
|
|
23
|
-
decision,
|
|
24
|
-
classKey: ac.key,
|
|
25
|
-
owned,
|
|
26
|
-
earnedLevel,
|
|
27
|
-
autonomyCeiling: worker.autonomyCeiling,
|
|
28
|
-
effectiveLevel,
|
|
29
|
-
reason,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=shadowGate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,IAAI,cAAc,GAAG,MAAM,CAAC,eAAe;QACzC,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC;IAE1C,MAAM,QAAQ,GAAG,cAAc,IAAI,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAEzE,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC,KAAK;QAAE,MAAM,GAAG,uBAAuB,CAAC;SACxC,IAAI,MAAM,CAAC,eAAe,GAAG,WAAW;QAC3C,MAAM,GAAG,gCAAgC,MAAM,CAAC,eAAe,aAAa,WAAW,GAAG,CAAC;SACxF,IAAI,QAAQ,KAAK,QAAQ;QAAE,MAAM,GAAG,wBAAwB,CAAC;;QAC7D,MAAM,GAAG,8BAA8B,cAAc,GAAG,CAAC;IAE9D,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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type GraduationConfig, type Outcome } from "./graduation.js";
|
|
2
|
-
import { type WorkerManifest } from "./worker.js";
|
|
3
|
-
import { type AuditEvent, type BoardRow, WorkerLevelStore } from "./workerLevelStore.js";
|
|
4
|
-
/**
|
|
5
|
-
* Replay an outcome sequence for a worker and capture the per-step dial
|
|
6
|
-
* trajectory. This is the cheapest test of the evidence-latency risk: it shows,
|
|
7
|
-
* deterministically, how many real observations (and how much wall-clock) a
|
|
8
|
-
* worker needs to climb each class — and how one catastrophic outcome demotes
|
|
9
|
-
* it in a single step. No model calls, no live gate — pure replay.
|
|
10
|
-
*/
|
|
11
|
-
export interface TrajectoryStep {
|
|
12
|
-
index: number;
|
|
13
|
-
at: number;
|
|
14
|
-
toolName: string;
|
|
15
|
-
good: boolean;
|
|
16
|
-
classKey: string;
|
|
17
|
-
level: number;
|
|
18
|
-
changed: "promote" | "demote" | null;
|
|
19
|
-
}
|
|
20
|
-
export interface ShadowRunResult {
|
|
21
|
-
workerId: string;
|
|
22
|
-
trajectory: TrajectoryStep[];
|
|
23
|
-
board: BoardRow[];
|
|
24
|
-
events: AuditEvent[];
|
|
25
|
-
store: WorkerLevelStore;
|
|
26
|
-
}
|
|
27
|
-
export declare function shadowRun(worker: WorkerManifest, outcomes: Outcome[], opts?: {
|
|
28
|
-
cfg?: GraduationConfig;
|
|
29
|
-
store?: WorkerLevelStore;
|
|
30
|
-
}): ShadowRunResult;
|
|
31
|
-
/** First trajectory step where `classKey` reached at least `level`. */
|
|
32
|
-
export declare function firstReached(result: ShadowRunResult, classKey: string, level: number): TrajectoryStep | undefined;
|
|
33
|
-
/** Build a steady cadence of same-tool outcomes spaced `intervalMs` apart. */
|
|
34
|
-
export declare function cadence(toolName: string, count: number, opts?: {
|
|
35
|
-
startAt?: number;
|
|
36
|
-
intervalMs?: number;
|
|
37
|
-
good?: boolean;
|
|
38
|
-
}): Outcome[];
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_GRADUATION_CONFIG, } from "./graduation.js";
|
|
2
|
-
import { priorFor } from "./worker.js";
|
|
3
|
-
import { WorkerLevelStore, } from "./workerLevelStore.js";
|
|
4
|
-
export function shadowRun(worker, outcomes, opts = {}) {
|
|
5
|
-
const store = opts.store ?? new WorkerLevelStore();
|
|
6
|
-
const cfg = opts.cfg ?? DEFAULT_GRADUATION_CONFIG;
|
|
7
|
-
const prior = priorFor(worker);
|
|
8
|
-
const trajectory = [];
|
|
9
|
-
outcomes.forEach((o, index) => {
|
|
10
|
-
const r = store.apply(worker.id, o, { prior, cfg });
|
|
11
|
-
trajectory.push({
|
|
12
|
-
index,
|
|
13
|
-
at: o.at,
|
|
14
|
-
toolName: o.toolName,
|
|
15
|
-
good: o.good,
|
|
16
|
-
classKey: r.classKey,
|
|
17
|
-
level: r.state.level,
|
|
18
|
-
changed: r.event?.type ?? null,
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
workerId: worker.id,
|
|
23
|
-
trajectory,
|
|
24
|
-
board: store.board(worker.id),
|
|
25
|
-
events: store.events(worker.id),
|
|
26
|
-
store,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/** First trajectory step where `classKey` reached at least `level`. */
|
|
30
|
-
export function firstReached(result, classKey, level) {
|
|
31
|
-
return result.trajectory.find((s) => s.classKey === classKey && s.level >= level);
|
|
32
|
-
}
|
|
33
|
-
/** Build a steady cadence of same-tool outcomes spaced `intervalMs` apart. */
|
|
34
|
-
export function cadence(toolName, count, opts = {}) {
|
|
35
|
-
const start = opts.startAt ?? 0;
|
|
36
|
-
const interval = opts.intervalMs ?? 6 * 60 * 60 * 1000; // 6h
|
|
37
|
-
const good = opts.good ?? true;
|
|
38
|
-
return Array.from({ length: count }, (_, i) => ({
|
|
39
|
-
toolName,
|
|
40
|
-
good,
|
|
41
|
-
at: start + i * interval,
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=shadowRun.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shadowRun.js","sourceRoot":"","sources":["../../src/workers/shadowRun.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAG1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAuB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAGL,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AA4B/B,MAAM,UAAU,SAAS,CACvB,MAAsB,EACtB,QAAmB,EACnB,OAA6D,EAAE;IAE/D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,gBAAgB,EAAE,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAA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,CAAC,OAAO,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,KAAK;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,QAAQ;QACR,IAAI;QACJ,EAAE,EAAE,KAAK,GAAG,CAAC,GAAG,QAAQ;KACzB,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bayesian trust model for a single (worker × action-class) pair.
|
|
3
|
-
*
|
|
4
|
-
* Reliability `p` (the probability that an action of this class is "good") is a
|
|
5
|
-
* Beta(α, β) posterior. The discrete autonomy rung L0–L4 is a threshold
|
|
6
|
-
* crossing of the posterior's LOWER confidence bound, not its mean. Using the
|
|
7
|
-
* lower bound is what makes the ramp behave correctly:
|
|
8
|
-
* - cold-start floors automatically: a fresh/wide posterior has a low bound
|
|
9
|
-
* even if its mean is optimistic, so a worker (or a marketplace prior) can't
|
|
10
|
-
* start trusted — uncertainty must collapse on local evidence first;
|
|
11
|
-
* - climbing is slow: the bound only rises as the mean rises AND variance
|
|
12
|
-
* shrinks, i.e. with sustained evidence;
|
|
13
|
-
* - demotion is instant: one high-weight failure spikes β, the mean drops and
|
|
14
|
-
* the bound craters in a single step.
|
|
15
|
-
*
|
|
16
|
-
* Asymmetry ("slow up, instant down") is therefore information, not a tuned
|
|
17
|
-
* rule — it falls out of weighting failures by blast radius (see actionClass).
|
|
18
|
-
*/
|
|
19
|
-
export interface Posterior {
|
|
20
|
-
readonly alpha: number;
|
|
21
|
-
readonly beta: number;
|
|
22
|
-
}
|
|
23
|
-
/** Uniform prior — maximally uncertain, no shipped competence. */
|
|
24
|
-
export declare const DEFAULT_PRIOR: Posterior;
|
|
25
|
-
/**
|
|
26
|
-
* Build a prior from a competence claim: a mean reliability + a strength
|
|
27
|
-
* (pseudo-count). Low strength = wide uncertainty = the bound stays low until
|
|
28
|
-
* local evidence accumulates. This is how a marketplace worker ships
|
|
29
|
-
* competence (a mean) without shipping trust (the bound only tightens on the
|
|
30
|
-
* operator's own data). Strength is capped low on purpose.
|
|
31
|
-
*/
|
|
32
|
-
export declare function priorFromCompetence(mean: number, strength: number): Posterior;
|
|
33
|
-
export declare function posteriorMean(p: Posterior): number;
|
|
34
|
-
export declare function posteriorStddev(p: Posterior): number;
|
|
35
|
-
/** Lower confidence bound: mean − k·σ, clamped to [0, 1]. The level reads off
|
|
36
|
-
* THIS, not the mean. */
|
|
37
|
-
export declare function lowerConfidenceBound(p: Posterior, k?: number): number;
|
|
38
|
-
/** Apply one outcome. A good outcome adds to α, a bad one to β, scaled by the
|
|
39
|
-
* blast-weighted evidence weight from actionClass.outcomeWeight. */
|
|
40
|
-
export declare function applyOutcome(p: Posterior, good: boolean, weight: number): Posterior;
|
|
41
|
-
/** Total evidence accumulated relative to the prior (pseudo-observations). */
|
|
42
|
-
export declare function evidenceCount(p: Posterior, prior: Posterior): number;
|
|
43
|
-
export type TrustLevel = 0 | 1 | 2 | 3 | 4;
|
|
44
|
-
/** LCB → rung. Tunable; conservative by default. */
|
|
45
|
-
export declare const DEFAULT_THRESHOLDS: ReadonlyArray<{
|
|
46
|
-
min: number;
|
|
47
|
-
level: TrustLevel;
|
|
48
|
-
}>;
|
|
49
|
-
export interface LevelOpts {
|
|
50
|
-
k?: number;
|
|
51
|
-
/** Min evidence before a class may exceed L1 (novel-class floor). */
|
|
52
|
-
minEvidenceForGraduation?: number;
|
|
53
|
-
/** Rungs reachable for this class (irreversible classes omit L2/L3). */
|
|
54
|
-
reachable?: number[];
|
|
55
|
-
thresholds?: ReadonlyArray<{
|
|
56
|
-
min: number;
|
|
57
|
-
level: TrustLevel;
|
|
58
|
-
}>;
|
|
59
|
-
}
|
|
60
|
-
export interface LevelResult {
|
|
61
|
-
level: TrustLevel;
|
|
62
|
-
/** Level before the novel-floor + reachability clamps (for diagnostics). */
|
|
63
|
-
rawLevel: TrustLevel;
|
|
64
|
-
lcb: number;
|
|
65
|
-
mean: number;
|
|
66
|
-
evidence: number;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Map a posterior to a discrete rung, applying:
|
|
70
|
-
* 1. LCB → raw level via thresholds.
|
|
71
|
-
* 2. Novel-class floor: below the evidence minimum, cap at L1 regardless of how
|
|
72
|
-
* good the (necessarily wide) posterior looks — no class graduates on faith.
|
|
73
|
-
* 3. Reachability clamp: drop to the highest reachable rung ≤ the computed one,
|
|
74
|
-
* so an irreversible class climbing through "would-be L2/L3" stays at L1
|
|
75
|
-
* until it actually clears the L4 bar.
|
|
76
|
-
*/
|
|
77
|
-
export declare function levelFromPosterior(p: Posterior, prior: Posterior, opts?: LevelOpts): LevelResult;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bayesian trust model for a single (worker × action-class) pair.
|
|
3
|
-
*
|
|
4
|
-
* Reliability `p` (the probability that an action of this class is "good") is a
|
|
5
|
-
* Beta(α, β) posterior. The discrete autonomy rung L0–L4 is a threshold
|
|
6
|
-
* crossing of the posterior's LOWER confidence bound, not its mean. Using the
|
|
7
|
-
* lower bound is what makes the ramp behave correctly:
|
|
8
|
-
* - cold-start floors automatically: a fresh/wide posterior has a low bound
|
|
9
|
-
* even if its mean is optimistic, so a worker (or a marketplace prior) can't
|
|
10
|
-
* start trusted — uncertainty must collapse on local evidence first;
|
|
11
|
-
* - climbing is slow: the bound only rises as the mean rises AND variance
|
|
12
|
-
* shrinks, i.e. with sustained evidence;
|
|
13
|
-
* - demotion is instant: one high-weight failure spikes β, the mean drops and
|
|
14
|
-
* the bound craters in a single step.
|
|
15
|
-
*
|
|
16
|
-
* Asymmetry ("slow up, instant down") is therefore information, not a tuned
|
|
17
|
-
* rule — it falls out of weighting failures by blast radius (see actionClass).
|
|
18
|
-
*/
|
|
19
|
-
/** Uniform prior — maximally uncertain, no shipped competence. */
|
|
20
|
-
export const DEFAULT_PRIOR = { alpha: 1, beta: 1 };
|
|
21
|
-
/**
|
|
22
|
-
* Build a prior from a competence claim: a mean reliability + a strength
|
|
23
|
-
* (pseudo-count). Low strength = wide uncertainty = the bound stays low until
|
|
24
|
-
* local evidence accumulates. This is how a marketplace worker ships
|
|
25
|
-
* competence (a mean) without shipping trust (the bound only tightens on the
|
|
26
|
-
* operator's own data). Strength is capped low on purpose.
|
|
27
|
-
*/
|
|
28
|
-
export function priorFromCompetence(mean, strength) {
|
|
29
|
-
const m = Math.min(0.99, Math.max(0.01, mean));
|
|
30
|
-
const s = Math.min(8, Math.max(0.5, strength));
|
|
31
|
-
return { alpha: m * s, beta: (1 - m) * s };
|
|
32
|
-
}
|
|
33
|
-
export function posteriorMean(p) {
|
|
34
|
-
return p.alpha / (p.alpha + p.beta);
|
|
35
|
-
}
|
|
36
|
-
export function posteriorStddev(p) {
|
|
37
|
-
const n = p.alpha + p.beta;
|
|
38
|
-
return Math.sqrt((p.alpha * p.beta) / (n * n * (n + 1)));
|
|
39
|
-
}
|
|
40
|
-
/** Lower confidence bound: mean − k·σ, clamped to [0, 1]. The level reads off
|
|
41
|
-
* THIS, not the mean. */
|
|
42
|
-
export function lowerConfidenceBound(p, k = 1.5) {
|
|
43
|
-
return Math.max(0, Math.min(1, posteriorMean(p) - k * posteriorStddev(p)));
|
|
44
|
-
}
|
|
45
|
-
/** Apply one outcome. A good outcome adds to α, a bad one to β, scaled by the
|
|
46
|
-
* blast-weighted evidence weight from actionClass.outcomeWeight. */
|
|
47
|
-
export function applyOutcome(p, good, weight) {
|
|
48
|
-
return good
|
|
49
|
-
? { alpha: p.alpha + weight, beta: p.beta }
|
|
50
|
-
: { alpha: p.alpha, beta: p.beta + weight };
|
|
51
|
-
}
|
|
52
|
-
/** Total evidence accumulated relative to the prior (pseudo-observations). */
|
|
53
|
-
export function evidenceCount(p, prior) {
|
|
54
|
-
return p.alpha + p.beta - (prior.alpha + prior.beta);
|
|
55
|
-
}
|
|
56
|
-
/** LCB → rung. Tunable; conservative by default. */
|
|
57
|
-
export const DEFAULT_THRESHOLDS = [
|
|
58
|
-
{ min: 0.95, level: 4 },
|
|
59
|
-
{ min: 0.85, level: 3 },
|
|
60
|
-
{ min: 0.7, level: 2 },
|
|
61
|
-
{ min: 0.5, level: 1 },
|
|
62
|
-
{ min: 0, level: 0 },
|
|
63
|
-
];
|
|
64
|
-
/**
|
|
65
|
-
* Map a posterior to a discrete rung, applying:
|
|
66
|
-
* 1. LCB → raw level via thresholds.
|
|
67
|
-
* 2. Novel-class floor: below the evidence minimum, cap at L1 regardless of how
|
|
68
|
-
* good the (necessarily wide) posterior looks — no class graduates on faith.
|
|
69
|
-
* 3. Reachability clamp: drop to the highest reachable rung ≤ the computed one,
|
|
70
|
-
* so an irreversible class climbing through "would-be L2/L3" stays at L1
|
|
71
|
-
* until it actually clears the L4 bar.
|
|
72
|
-
*/
|
|
73
|
-
export function levelFromPosterior(p, prior, opts = {}) {
|
|
74
|
-
const k = opts.k ?? 1.5;
|
|
75
|
-
const minEvidence = opts.minEvidenceForGraduation ?? 10;
|
|
76
|
-
const reachable = opts.reachable ?? [0, 1, 2, 3, 4];
|
|
77
|
-
const thresholds = opts.thresholds ?? DEFAULT_THRESHOLDS;
|
|
78
|
-
const lcb = lowerConfidenceBound(p, k);
|
|
79
|
-
const mean = posteriorMean(p);
|
|
80
|
-
const evidence = evidenceCount(p, prior);
|
|
81
|
-
const rawLevel = thresholds.find((t) => lcb >= t.min)?.level ?? 0;
|
|
82
|
-
let level = rawLevel;
|
|
83
|
-
// Novel-class floor.
|
|
84
|
-
if (evidence < minEvidence && level > 1)
|
|
85
|
-
level = 1;
|
|
86
|
-
// Reachability clamp (highest reachable rung ≤ level).
|
|
87
|
-
const allowed = reachable.filter((r) => r <= level);
|
|
88
|
-
level = (allowed.length ? Math.max(...allowed) : 0);
|
|
89
|
-
return { level, rawLevel, lcb, mean, evidence };
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=trustLevel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trustLevel.js","sourceRoot":"","sources":["../../src/workers/trustLevel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAc,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,QAAgB;IAChE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,CAAY;IACxC,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAY;IAC1C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,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
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { ActionClass } from "./actionClass.js";
|
|
2
|
-
import { type Posterior, type TrustLevel } from "./trustLevel.js";
|
|
3
|
-
export interface WorkerCompetence {
|
|
4
|
-
/** Claimed reliability mean (0–1) — a competence claim, not trust. */
|
|
5
|
-
mean: number;
|
|
6
|
-
/** Prior strength (pseudo-count); capped low so local evidence dominates. */
|
|
7
|
-
strength: number;
|
|
8
|
-
}
|
|
9
|
-
export interface WorkerManifest {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
responsibilities: string[];
|
|
13
|
-
/** Recipe name that forms this worker's body (its triggers + steps). */
|
|
14
|
-
recipe?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Action-classes this worker is responsible for. Each pattern matches a
|
|
17
|
-
* class by its domain, or by an exact/prefix class-key match
|
|
18
|
-
* (`vcs-local` matches `vcs-local:*`; `fs-write:reversible:medium` is exact).
|
|
19
|
-
*/
|
|
20
|
-
owns: string[];
|
|
21
|
-
/**
|
|
22
|
-
* Policy/regulatory cap on the max ramp level this worker may EVER reach,
|
|
23
|
-
* independent of earned track record — the schema encoding of the
|
|
24
|
-
* autonomy-tolerance axis (e.g. a Legal-sector worker is pinned at L2). The
|
|
25
|
-
* dial still shows *earned* level; the gate operates at min(earned, ceiling).
|
|
26
|
-
*/
|
|
27
|
-
autonomyCeiling: TrustLevel;
|
|
28
|
-
/** Optional shipped competence → the per-class prior. */
|
|
29
|
-
competence?: WorkerCompetence;
|
|
30
|
-
/** Free-form sector tag (drives default ceilings / reporting). */
|
|
31
|
-
sector?: string;
|
|
32
|
-
}
|
|
33
|
-
export declare class WorkerParseError extends Error {
|
|
34
|
-
constructor(message: string);
|
|
35
|
-
}
|
|
36
|
-
export declare function parseWorker(raw: unknown): WorkerManifest;
|
|
37
|
-
/** The per-class trust prior for a worker (its shipped competence, or uniform). */
|
|
38
|
-
export declare function priorFor(worker: WorkerManifest): Posterior;
|
|
39
|
-
/** Whether a worker is responsible for a given action-class. A pattern matches
|
|
40
|
-
* the class domain, an exact key, or a key prefix. Empty `owns` ⇒ owns nothing. */
|
|
41
|
-
export declare function ownsAction(worker: WorkerManifest, ac: ActionClass): boolean;
|
package/dist/workers/worker.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_PRIOR, priorFromCompetence, } from "./trustLevel.js";
|
|
2
|
-
/**
|
|
3
|
-
* A worker manifest. Deliberately NOT a fork of the recipe schema — the recipe
|
|
4
|
-
* is the worker's *body* (triggers + steps); this manifest adds identity, the
|
|
5
|
-
* action-classes it owns, a trust prior, and the policy autonomy ceiling. It
|
|
6
|
-
* references a recipe by name rather than redefining execution. (worker-ramp-v0)
|
|
7
|
-
*/
|
|
8
|
-
const WORKER_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
9
|
-
export class WorkerParseError extends Error {
|
|
10
|
-
constructor(message) {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "WorkerParseError";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function reqString(o, key) {
|
|
16
|
-
const v = o[key];
|
|
17
|
-
if (typeof v !== "string" || !v)
|
|
18
|
-
throw new WorkerParseError(`worker.${key} must be a non-empty string`);
|
|
19
|
-
return v;
|
|
20
|
-
}
|
|
21
|
-
export function parseWorker(raw) {
|
|
22
|
-
if (typeof raw !== "object" || raw === null)
|
|
23
|
-
throw new WorkerParseError("worker must be an object");
|
|
24
|
-
const r = raw;
|
|
25
|
-
const id = reqString(r, "id");
|
|
26
|
-
if (!WORKER_ID_RE.test(id))
|
|
27
|
-
throw new WorkerParseError(`worker.id must be kebab-case (got ${JSON.stringify(id)})`);
|
|
28
|
-
const name = reqString(r, "name");
|
|
29
|
-
const owns = Array.isArray(r.owns)
|
|
30
|
-
? r.owns.filter((x) => typeof x === "string")
|
|
31
|
-
: [];
|
|
32
|
-
const responsibilities = Array.isArray(r.responsibilities)
|
|
33
|
-
? r.responsibilities.filter((x) => typeof x === "string")
|
|
34
|
-
: [];
|
|
35
|
-
// autonomyCeiling: 0–4, default 4 (uncapped).
|
|
36
|
-
let autonomyCeiling = 4;
|
|
37
|
-
if (r.autonomyCeiling !== undefined) {
|
|
38
|
-
const c = r.autonomyCeiling;
|
|
39
|
-
if (typeof c !== "number" || !Number.isInteger(c) || c < 0 || c > 4)
|
|
40
|
-
throw new WorkerParseError("worker.autonomyCeiling must be an integer 0–4");
|
|
41
|
-
autonomyCeiling = c;
|
|
42
|
-
}
|
|
43
|
-
let competence;
|
|
44
|
-
if (r.competence !== undefined) {
|
|
45
|
-
const c = r.competence;
|
|
46
|
-
if (typeof c !== "object" ||
|
|
47
|
-
c === null ||
|
|
48
|
-
typeof c.mean !== "number" ||
|
|
49
|
-
typeof c.strength !== "number")
|
|
50
|
-
throw new WorkerParseError("worker.competence must be { mean: number, strength: number }");
|
|
51
|
-
if (c.mean < 0 || c.mean > 1)
|
|
52
|
-
throw new WorkerParseError("worker.competence.mean must be in [0,1]");
|
|
53
|
-
competence = { mean: c.mean, strength: c.strength };
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
id,
|
|
57
|
-
name,
|
|
58
|
-
responsibilities,
|
|
59
|
-
recipe: typeof r.recipe === "string" ? r.recipe : undefined,
|
|
60
|
-
owns,
|
|
61
|
-
autonomyCeiling,
|
|
62
|
-
competence,
|
|
63
|
-
sector: typeof r.sector === "string" ? r.sector : undefined,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/** The per-class trust prior for a worker (its shipped competence, or uniform). */
|
|
67
|
-
export function priorFor(worker) {
|
|
68
|
-
return worker.competence
|
|
69
|
-
? priorFromCompetence(worker.competence.mean, worker.competence.strength)
|
|
70
|
-
: DEFAULT_PRIOR;
|
|
71
|
-
}
|
|
72
|
-
/** Whether a worker is responsible for a given action-class. A pattern matches
|
|
73
|
-
* the class domain, an exact key, or a key prefix. Empty `owns` ⇒ owns nothing. */
|
|
74
|
-
export function ownsAction(worker, ac) {
|
|
75
|
-
return worker.owns.some((p) => p === ac.domain || p === ac.key || ac.key.startsWith(`${p}:`));
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/workers/worker.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAEb,mBAAmB,GAEpB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AAEH,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAkCjD,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,SAAS,SAAS,CAAC,CAA0B,EAAE,GAAW;IACxD,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACjB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC;QAC7B,MAAM,IAAI,gBAAgB,CAAC,UAAU,GAAG,6BAA6B,CAAC,CAAC;IACzE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QACzC,MAAM,IAAI,gBAAgB,CAAC,0BAA0B,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,GAA8B,CAAC;IAEzC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,gBAAgB,CACxB,qCAAqC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAC3D,CAAC;IACJ,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAElC,MAAM,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B,MAAM,IAAI,gBAAgB,CAAC,yCAAyC,CAAC,CAAC;QACxE,UAAU,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IACtD,CAAC;IAED,OAAO;QACL,EAAE;QACF,IAAI;QACJ,gBAAgB;QAChB,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;QAC3D,IAAI;QACJ,eAAe;QACf,UAAU;QACV,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,QAAQ,CAAC,MAAsB;IAC7C,OAAO,MAAM,CAAC,UAAU;QACtB,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QACzE,CAAC,CAAC,aAAa,CAAC;AACpB,CAAC;AAED;mFACmF;AACnF,MAAM,UAAU,UAAU,CAAC,MAAsB,EAAE,EAAe;IAChE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CACrE,CAAC;AACJ,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type ClassTrustState, type GraduationConfig, type GraduationEvent, type Outcome } from "./graduation.js";
|
|
2
|
-
import { type Posterior } from "./trustLevel.js";
|
|
3
|
-
export type AuditEvent = GraduationEvent & {
|
|
4
|
-
workerId: string;
|
|
5
|
-
};
|
|
6
|
-
export interface AppliedOutcome {
|
|
7
|
-
classKey: string;
|
|
8
|
-
state: ClassTrustState;
|
|
9
|
-
event?: AuditEvent;
|
|
10
|
-
}
|
|
11
|
-
export interface BoardRow {
|
|
12
|
-
classKey: string;
|
|
13
|
-
level: number;
|
|
14
|
-
observations: number;
|
|
15
|
-
mean: number;
|
|
16
|
-
}
|
|
17
|
-
export declare class WorkerLevelStore {
|
|
18
|
-
private states;
|
|
19
|
-
private log;
|
|
20
|
-
/** Fold one outcome for a worker; derives the action-class from the tool. */
|
|
21
|
-
apply(workerId: string, outcome: Outcome, opts?: {
|
|
22
|
-
prior?: Posterior;
|
|
23
|
-
cfg?: GraduationConfig;
|
|
24
|
-
}): AppliedOutcome;
|
|
25
|
-
getState(workerId: string, classKey: string): ClassTrustState | undefined;
|
|
26
|
-
/** Dial snapshot for one worker: every action-class it has touched, sorted. */
|
|
27
|
-
board(workerId: string): BoardRow[];
|
|
28
|
-
/** The audit log (optionally filtered to one worker). */
|
|
29
|
-
events(workerId?: string): AuditEvent[];
|
|
30
|
-
/** Serialize states + events to JSONL (one record per line). */
|
|
31
|
-
toJSONL(): string;
|
|
32
|
-
static fromJSONL(text: string): WorkerLevelStore;
|
|
33
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { classifyActionClass } from "./actionClass.js";
|
|
2
|
-
import { DEFAULT_GRADUATION_CONFIG, graduate, initialState, } from "./graduation.js";
|
|
3
|
-
import { DEFAULT_PRIOR, posteriorMean } from "./trustLevel.js";
|
|
4
|
-
/**
|
|
5
|
-
* Holds the per-(worker × action-class) trust state and the promotion/demotion
|
|
6
|
-
* event log. The state map is the dial; the event log is the compliance/audit
|
|
7
|
-
* artifact ("prove this worker never acted beyond its authority"). In-memory
|
|
8
|
-
* with a JSONL round-trip; wiring it to a live append-only JSONL file with the
|
|
9
|
-
* tail-on-read concurrency pattern (ADR-0007, as the existing trace stores do)
|
|
10
|
-
* is the productionization step — kept out of v0 to stay pure + testable.
|
|
11
|
-
*/
|
|
12
|
-
function compositeKey(workerId, classKey) {
|
|
13
|
-
return `${workerId}::${classKey}`;
|
|
14
|
-
}
|
|
15
|
-
export class WorkerLevelStore {
|
|
16
|
-
states = new Map();
|
|
17
|
-
log = [];
|
|
18
|
-
/** Fold one outcome for a worker; derives the action-class from the tool. */
|
|
19
|
-
apply(workerId, outcome, opts = {}) {
|
|
20
|
-
const ac = classifyActionClass(outcome.toolName, outcome.params);
|
|
21
|
-
const k = compositeKey(workerId, ac.key);
|
|
22
|
-
const prior = opts.prior ?? DEFAULT_PRIOR;
|
|
23
|
-
const current = this.states.get(k) ?? initialState(ac.key, prior, outcome.at);
|
|
24
|
-
const { state, event } = graduate(current, outcome, opts.cfg ?? DEFAULT_GRADUATION_CONFIG);
|
|
25
|
-
this.states.set(k, state);
|
|
26
|
-
const audit = event ? { ...event, workerId } : undefined;
|
|
27
|
-
if (audit)
|
|
28
|
-
this.log.push(audit);
|
|
29
|
-
return { classKey: ac.key, state, event: audit };
|
|
30
|
-
}
|
|
31
|
-
getState(workerId, classKey) {
|
|
32
|
-
return this.states.get(compositeKey(workerId, classKey));
|
|
33
|
-
}
|
|
34
|
-
/** Dial snapshot for one worker: every action-class it has touched, sorted. */
|
|
35
|
-
board(workerId) {
|
|
36
|
-
const prefix = `${workerId}::`;
|
|
37
|
-
const rows = [];
|
|
38
|
-
for (const [k, s] of this.states) {
|
|
39
|
-
if (!k.startsWith(prefix))
|
|
40
|
-
continue;
|
|
41
|
-
rows.push({
|
|
42
|
-
classKey: s.classKey,
|
|
43
|
-
level: s.level,
|
|
44
|
-
observations: s.observations,
|
|
45
|
-
mean: posteriorMean(s.posterior),
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return rows.sort((a, b) => a.classKey.localeCompare(b.classKey));
|
|
49
|
-
}
|
|
50
|
-
/** The audit log (optionally filtered to one worker). */
|
|
51
|
-
events(workerId) {
|
|
52
|
-
return workerId
|
|
53
|
-
? this.log.filter((e) => e.workerId === workerId)
|
|
54
|
-
: this.log;
|
|
55
|
-
}
|
|
56
|
-
/** Serialize states + events to JSONL (one record per line). */
|
|
57
|
-
toJSONL() {
|
|
58
|
-
const lines = [];
|
|
59
|
-
for (const [k, s] of this.states) {
|
|
60
|
-
const workerId = k.slice(0, k.indexOf("::"));
|
|
61
|
-
lines.push(JSON.stringify({ rec: "state", workerId, state: s }));
|
|
62
|
-
}
|
|
63
|
-
for (const e of this.log)
|
|
64
|
-
lines.push(JSON.stringify({ rec: "event", ...e }));
|
|
65
|
-
return lines.join("\n");
|
|
66
|
-
}
|
|
67
|
-
static fromJSONL(text) {
|
|
68
|
-
const store = new WorkerLevelStore();
|
|
69
|
-
for (const line of text.split("\n")) {
|
|
70
|
-
const t = line.trim();
|
|
71
|
-
if (!t)
|
|
72
|
-
continue;
|
|
73
|
-
const obj = JSON.parse(t);
|
|
74
|
-
if (obj.rec === "state") {
|
|
75
|
-
const workerId = obj.workerId;
|
|
76
|
-
const state = obj.state;
|
|
77
|
-
store.states.set(compositeKey(workerId, state.classKey), state);
|
|
78
|
-
}
|
|
79
|
-
else if (obj.rec === "event") {
|
|
80
|
-
const { rec: _rec, ...event } = obj;
|
|
81
|
-
store.log.push(event);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return store;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=workerLevelStore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workerLevelStore.js","sourceRoot":"","sources":["../../src/workers/workerLevelStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAEL,yBAAyB,EAGzB,QAAQ,EACR,YAAY,GAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAkB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;GAOG;AAEH,SAAS,YAAY,CAAC,QAAgB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C;IACf,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Dependency-upkeep worker — top-right beachhead. The classic low-blast,
|
|
2
|
-
# continuous, verifiable job to land first (the wedge): watch for outdated /
|
|
3
|
-
# vulnerable deps and open a bump PR. A human still merges → ceiling held at L3.
|
|
4
|
-
id: dependency-upkeep-worker
|
|
5
|
-
name: Dependency Upkeep Worker
|
|
6
|
-
sector: engineering
|
|
7
|
-
recipe: dependency-bump
|
|
8
|
-
responsibilities:
|
|
9
|
-
- Audit dependencies for outdated / vulnerable packages
|
|
10
|
-
- Open a bump PR with the changelog and advisory links
|
|
11
|
-
owns:
|
|
12
|
-
- deps-read # auditDependencies / getSecurityAdvisories — read-only
|
|
13
|
-
- vcs-local # gitCommit / gitCheckout on a branch — reversible
|
|
14
|
-
- vcs-remote # githubCreatePR — compensable + brand-exposed
|
|
15
|
-
autonomyCeiling: 3 # opening PRs autonomously is fine; merging stays human (policy)
|
|
16
|
-
competence:
|
|
17
|
-
mean: 0.8
|
|
18
|
-
strength: 4
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Release worker — top-right beachhead (high task-impact × high autonomy-tolerance).
|
|
2
|
-
# Body: a chained recipe triggered on merge-to-main that drafts release notes.
|
|
3
|
-
# Reversible, verifiable, internal → fast ramp evidence.
|
|
4
|
-
id: release-notes-worker
|
|
5
|
-
name: Release Worker
|
|
6
|
-
sector: engineering
|
|
7
|
-
recipe: release-notes # the recipe that forms this worker's body
|
|
8
|
-
responsibilities:
|
|
9
|
-
- Watch merges to main and draft release notes / changelog entries
|
|
10
|
-
- Summarize the diff and link the PRs in the range
|
|
11
|
-
owns:
|
|
12
|
-
- vcs-read # getGitStatus / getGitDiff / getGitLog — reversible, low blast
|
|
13
|
-
- fs-write # editText / createFile (the changelog) — reversible
|
|
14
|
-
autonomyCeiling: 4 # internal + reversible: may earn full autonomy
|
|
15
|
-
competence: # shipped competence (a prior), NOT trust — trust earns locally
|
|
16
|
-
mean: 0.85
|
|
17
|
-
strength: 4
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Test-guardian worker — top-right beachhead. Fires on a test-run failure
|
|
2
|
-
# (on_test_run trigger), investigates the failure, and files an issue. Reversible
|
|
3
|
-
# investigation + compensable issue creation → may earn full autonomy on triage.
|
|
4
|
-
id: test-guardian-worker
|
|
5
|
-
name: Test Guardian Worker
|
|
6
|
-
sector: engineering
|
|
7
|
-
recipe: triage-failing-tests
|
|
8
|
-
responsibilities:
|
|
9
|
-
- On a failing test run, investigate the stack trace and identify the cause
|
|
10
|
-
- File / update an issue with the failure summary and the suspect commit
|
|
11
|
-
owns:
|
|
12
|
-
- ci # runTests (re-runnable) — reversible
|
|
13
|
-
- vcs-read # getGitDiff / gitBlame to find the suspect commit
|
|
14
|
-
- issue # githubCreateIssue / addLinearComment — compensable + brand-exposed
|
|
15
|
-
autonomyCeiling: 4
|
|
16
|
-
competence:
|
|
17
|
-
mean: 0.8
|
|
18
|
-
strength: 4
|