patchwork-os 1.2.0-beta.2.canary.770 → 1.2.0-beta.2.canary.771

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/gate.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The autonomy gate's public surface, for a consumer outside this package.
3
+ *
4
+ * ## Why this file exists at all
5
+ *
6
+ * `previewActions` already exists so that a screen showing "may do now / needs
7
+ * approval / not permitted" is computed by the SAME code that enforces it.
8
+ * Its own header states the reason: a preview holding policy of its own drifts,
9
+ * and the drift is silent and permissive — a screen reading "not permitted"
10
+ * where the gate would allow it tells an operator they are protected when they
11
+ * are not. `ControlBoundary.tsx` is presentational for the same reason.
12
+ *
13
+ * That guarantee held only inside this repository. `package.json` exposes two
14
+ * subpaths — `.` and `./plugin` — and `.` is `dist/index.js`, which is also the
15
+ * `bin`: importing the package root RUNS THE CLI rather than yielding a module.
16
+ * So an out-of-package consumer could not reach the gate at all, and its only
17
+ * remaining option was to re-derive the three buckets from `boundary_receipts
18
+ * .jsonl` and `worker_gate_decisions.jsonl` by hand — a second implementation
19
+ * of the boundary, arrived at not by anyone deciding to have one but by the
20
+ * export map being narrower than the guarantee.
21
+ *
22
+ * The compiled modules were already shipped (`files` carries `dist` wholesale),
23
+ * so nothing new is published here. What changes is that the seam is now NAMED,
24
+ * and a consumer gets the gate's answer instead of its ledger's residue.
25
+ *
26
+ * ## This is a re-export, and it must stay one
27
+ *
28
+ * Every binding below is the identity of the symbol it names. Nothing here
29
+ * wraps, adapts, defaults or "simplifies" — a barrel that computed anything
30
+ * would be the very second implementation the seam exists to prevent, sited
31
+ * where it looks most like plumbing. `gateBarrelIsPassThrough.test.ts` asserts
32
+ * reference identity against the source modules and fails if that changes.
33
+ *
34
+ * ## Scope: the decision, not the operation
35
+ *
36
+ * Exported: how an action is CLASSIFIED, what the gate DECIDES, and the types
37
+ * to say either. Not exported: anything that writes a ledger, mutates a dial or
38
+ * runs a recipe. A consumer of this surface asks questions; the runtime remains
39
+ * the only thing that acts.
40
+ */
41
+ export { type AutonomyDecisionOpts, decideWorkerAction, disallowedToolsForAgentStep, flowsUngated, GATE_POLICY_VERSION, type GateOutcome, gateOutcomeFor, mergeAgentDisallowedTools, type ResolvedGateOutcome, resolveGateOutcome, type StandingPermissionContext, type WorkerGateAction, type WorkerGateDecision, } from "./workers/workerGate.js";
42
+ export { type ActionBoundary, type CandidateAction, defaultCandidatesFor, type PreviewedAction, type PreviewOpts, previewActions, } from "./workers/previewActions.js";
43
+ export { type ActionClass, AGENT_STEP_TOOL, classifyActionClass, knownActionDomains, knownActionTools, type MagnitudeBand, outcomeWeight, type Reversibility, reachableLevels, } from "./workers/actionClass.js";
44
+ export { ownsAction, ownsClassKey, parseWorker, priorFor, WORKER_ID_RE, type WorkerCompetence, type WorkerManifest, WorkerParseError, } from "./workers/worker.js";
45
+ export { loadWorkersFromDir } from "./workers/workerLoader.js";
46
+ export { DEFAULT_PRIOR, DEFAULT_THRESHOLDS, evidenceCount, type LevelOpts, type LevelResult, levelFromPosterior, lowerConfidenceBound, type Posterior, posteriorMean, posteriorStddev, type TrustLevel, } from "./workers/trustLevel.js";
47
+ export { type AppliedOutcome, type BoardRow, WorkerLevelStore, } from "./workers/workerLevelStore.js";
48
+ export { describeForbidRules, type ForbidRule, type ForbidVerdict, isForbidden, type ParsedForbidRules, parseForbidRule, parseForbidRules, } from "./workers/forbidPolicy.js";
49
+ export { type ContextRisk, contextRiskCeiling, } from "./workers/contextRisk.js";
50
+ export { type CoverageOpts, coversAction, isActive, type PermissionCheck, type PermissionSubject, type StandingPermission, } from "./butler/standingPermission.js";
package/dist/gate.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The autonomy gate's public surface, for a consumer outside this package.
3
+ *
4
+ * ## Why this file exists at all
5
+ *
6
+ * `previewActions` already exists so that a screen showing "may do now / needs
7
+ * approval / not permitted" is computed by the SAME code that enforces it.
8
+ * Its own header states the reason: a preview holding policy of its own drifts,
9
+ * and the drift is silent and permissive — a screen reading "not permitted"
10
+ * where the gate would allow it tells an operator they are protected when they
11
+ * are not. `ControlBoundary.tsx` is presentational for the same reason.
12
+ *
13
+ * That guarantee held only inside this repository. `package.json` exposes two
14
+ * subpaths — `.` and `./plugin` — and `.` is `dist/index.js`, which is also the
15
+ * `bin`: importing the package root RUNS THE CLI rather than yielding a module.
16
+ * So an out-of-package consumer could not reach the gate at all, and its only
17
+ * remaining option was to re-derive the three buckets from `boundary_receipts
18
+ * .jsonl` and `worker_gate_decisions.jsonl` by hand — a second implementation
19
+ * of the boundary, arrived at not by anyone deciding to have one but by the
20
+ * export map being narrower than the guarantee.
21
+ *
22
+ * The compiled modules were already shipped (`files` carries `dist` wholesale),
23
+ * so nothing new is published here. What changes is that the seam is now NAMED,
24
+ * and a consumer gets the gate's answer instead of its ledger's residue.
25
+ *
26
+ * ## This is a re-export, and it must stay one
27
+ *
28
+ * Every binding below is the identity of the symbol it names. Nothing here
29
+ * wraps, adapts, defaults or "simplifies" — a barrel that computed anything
30
+ * would be the very second implementation the seam exists to prevent, sited
31
+ * where it looks most like plumbing. `gateBarrelIsPassThrough.test.ts` asserts
32
+ * reference identity against the source modules and fails if that changes.
33
+ *
34
+ * ## Scope: the decision, not the operation
35
+ *
36
+ * Exported: how an action is CLASSIFIED, what the gate DECIDES, and the types
37
+ * to say either. Not exported: anything that writes a ledger, mutates a dial or
38
+ * runs a recipe. A consumer of this surface asks questions; the runtime remains
39
+ * the only thing that acts.
40
+ */
41
+ // ── The decision ─────────────────────────────────────────────────────────────
42
+ export { decideWorkerAction, disallowedToolsForAgentStep, flowsUngated, GATE_POLICY_VERSION, gateOutcomeFor, mergeAgentDisallowedTools, resolveGateOutcome, } from "./workers/workerGate.js";
43
+ // ── The prospective view (the three columns) ─────────────────────────────────
44
+ export { defaultCandidatesFor, previewActions, } from "./workers/previewActions.js";
45
+ // ── What an action IS ────────────────────────────────────────────────────────
46
+ export { AGENT_STEP_TOOL, classifyActionClass, knownActionDomains, knownActionTools, outcomeWeight, reachableLevels, } from "./workers/actionClass.js";
47
+ // ── Who the worker is, and what it owns ──────────────────────────────────────
48
+ export { ownsAction, ownsClassKey, parseWorker, priorFor, WORKER_ID_RE, WorkerParseError, } from "./workers/worker.js";
49
+ export { loadWorkersFromDir } from "./workers/workerLoader.js";
50
+ // ── The trust dial ───────────────────────────────────────────────────────────
51
+ export { DEFAULT_PRIOR, DEFAULT_THRESHOLDS, evidenceCount, levelFromPosterior, lowerConfidenceBound, posteriorMean, posteriorStddev, } from "./workers/trustLevel.js";
52
+ export { WorkerLevelStore, } from "./workers/workerLevelStore.js";
53
+ // ── The deny-list ────────────────────────────────────────────────────────────
54
+ //
55
+ // `parseForbidRules` REPORTS what it could not parse and drops it, which fails
56
+ // OPEN — correct at runtime, where a banned action degrading to merely gated is
57
+ // still recoverable because a human approves it. A consumer building a
58
+ // repository gate must invert that (see `workers authority-delta`): "I could
59
+ // not read your deny-list" may not resolve to "looks fine". The parser is
60
+ // exported with its report intact so that inversion stays possible.
61
+ export { describeForbidRules, isForbidden, parseForbidRule, parseForbidRules, } from "./workers/forbidPolicy.js";
62
+ // ── Descending-only situational risk ─────────────────────────────────────────
63
+ export { contextRiskCeiling, } from "./workers/contextRisk.js";
64
+ // ── Standing permissions ─────────────────────────────────────────────────────
65
+ //
66
+ // A pre-recorded human approval, NOT earned trust, and deliberately not part of
67
+ // the `min()` in `decideWorkerAction`. Exported so a consumer can render why an
68
+ // action flowed without anyone being asked — never so it can grant one.
69
+ export { coversAction, isActive, } from "./butler/standingPermission.js";
70
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,gFAAgF;AAEhF,OAAO,EAEL,kBAAkB,EAClB,2BAA2B,EAC3B,YAAY,EACZ,mBAAmB,EAEnB,cAAc,EACd,yBAAyB,EAEzB,kBAAkB,GAInB,MAAM,yBAAyB,CAAC;AAEjC,gFAAgF;AAEhF,OAAO,EAGL,oBAAoB,EAGpB,cAAc,GACf,MAAM,6BAA6B,CAAC;AAErC,gFAAgF;AAEhF,OAAO,EAEL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAEhB,aAAa,EAEb,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAEhF,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,YAAY,EAGZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,gFAAgF;AAEhF,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,aAAa,EAGb,kBAAkB,EAClB,oBAAoB,EAEpB,aAAa,EACb,eAAe,GAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAEvC,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,uEAAuE;AACvE,6EAA6E;AAC7E,0EAA0E;AAC1E,oEAAoE;AAEpE,OAAO,EACL,mBAAmB,EAGnB,WAAW,EAEX,eAAe,EACf,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,gFAAgF;AAEhF,OAAO,EAEL,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AAExE,OAAO,EAEL,YAAY,EACZ,QAAQ,GAIT,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The information boundary's public surface, for a consumer outside this
3
+ * package.
4
+ *
5
+ * ## Why this is a second barrel and not more of `./gate`
6
+ *
7
+ * They answer different questions and must stay separable. The autonomy gate
8
+ * answers *what may this worker DO*; the information boundary answers *what may
9
+ * this destination RECEIVE*. A consumer that conflated them would show a
10
+ * refusal under the wrong heading, and the two refusals have opposite remedies:
11
+ * a gated action waits for a person, a `LOCAL_ONLY` dispatch waits for a
12
+ * different destination.
13
+ *
14
+ * ## Same reason as `./gate`, applied to a second engine
15
+ *
16
+ * `decideBoundary` is a pure function of (declared classification, destination
17
+ * policy) with no model in the loop — deliberately, so it is replayable and
18
+ * testable, and so the boundary is not enforced by the thing it constrains.
19
+ * That makes it exactly the kind of decision an external console should CALL
20
+ * rather than reconstruct.
21
+ *
22
+ * Reconstructing it is the alternative, and it is worse than it looks. The
23
+ * residue in `boundary_receipts.jsonl` records what was decided, not the rule
24
+ * that decided it, so a console deriving the boundary from receipts would be
25
+ * inferring policy from outcomes — and would quietly disagree the moment a
26
+ * destination's clearances changed, in the direction that shows a refusal
27
+ * where there is now an allow.
28
+ *
29
+ * ## This is a re-export, and it must stay one
30
+ *
31
+ * Every binding below is the identity of the symbol it names. Nothing wraps,
32
+ * adapts or defaults. `privacySubpathExport.test.ts` asserts reference identity
33
+ * against the source modules and fails if that changes — the same guard, for
34
+ * the same reason, as the gate barrel.
35
+ *
36
+ * ## Scope: the decision, not the ledger
37
+ *
38
+ * Exported: how data is CLASSIFIED, which destination a dispatch RESOLVES to,
39
+ * what the boundary DECIDES, and how to describe a destination to a human. Not
40
+ * exported: `BoundaryReceiptLog` or anything else that writes. A consumer of
41
+ * this surface asks questions; the runtime remains the only thing that records.
42
+ */
43
+ export { type BoundaryDecision, type BoundaryOutcome, CLASSIFICATIONS, type Classification, classificationRank, type DataPolicy, DEFAULT_CLASSIFICATION, type Destination, decideBoundary, narrowest, parseDataPolicy, } from "./privacy/dataPolicy.js";
44
+ export { type DestinationConfig, isLocalFamilyDriver, type ParsedRegistry, type PrivacyConfig, parseRegistry, type ResolveDestinationOptions, type ResolvedDestination, resolveDestination, } from "./privacy/destinationRegistry.js";
45
+ export { ALL_CLASSIFICATIONS, type DescribedDestination, type DescribeOptions, type DestinationNote, describeDestinations, disclosureFor, noteIsStale, } from "./privacy/describeDestinations.js";
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The information boundary's public surface, for a consumer outside this
3
+ * package.
4
+ *
5
+ * ## Why this is a second barrel and not more of `./gate`
6
+ *
7
+ * They answer different questions and must stay separable. The autonomy gate
8
+ * answers *what may this worker DO*; the information boundary answers *what may
9
+ * this destination RECEIVE*. A consumer that conflated them would show a
10
+ * refusal under the wrong heading, and the two refusals have opposite remedies:
11
+ * a gated action waits for a person, a `LOCAL_ONLY` dispatch waits for a
12
+ * different destination.
13
+ *
14
+ * ## Same reason as `./gate`, applied to a second engine
15
+ *
16
+ * `decideBoundary` is a pure function of (declared classification, destination
17
+ * policy) with no model in the loop — deliberately, so it is replayable and
18
+ * testable, and so the boundary is not enforced by the thing it constrains.
19
+ * That makes it exactly the kind of decision an external console should CALL
20
+ * rather than reconstruct.
21
+ *
22
+ * Reconstructing it is the alternative, and it is worse than it looks. The
23
+ * residue in `boundary_receipts.jsonl` records what was decided, not the rule
24
+ * that decided it, so a console deriving the boundary from receipts would be
25
+ * inferring policy from outcomes — and would quietly disagree the moment a
26
+ * destination's clearances changed, in the direction that shows a refusal
27
+ * where there is now an allow.
28
+ *
29
+ * ## This is a re-export, and it must stay one
30
+ *
31
+ * Every binding below is the identity of the symbol it names. Nothing wraps,
32
+ * adapts or defaults. `privacySubpathExport.test.ts` asserts reference identity
33
+ * against the source modules and fails if that changes — the same guard, for
34
+ * the same reason, as the gate barrel.
35
+ *
36
+ * ## Scope: the decision, not the ledger
37
+ *
38
+ * Exported: how data is CLASSIFIED, which destination a dispatch RESOLVES to,
39
+ * what the boundary DECIDES, and how to describe a destination to a human. Not
40
+ * exported: `BoundaryReceiptLog` or anything else that writes. A consumer of
41
+ * this surface asks questions; the runtime remains the only thing that records.
42
+ */
43
+ // ── What the data is, and what a destination may receive ─────────────────────
44
+ export { CLASSIFICATIONS, classificationRank, DEFAULT_CLASSIFICATION, decideBoundary, narrowest, parseDataPolicy, } from "./privacy/dataPolicy.js";
45
+ // ── Which destination a dispatch actually resolves to ────────────────────────
46
+ //
47
+ // `resolveDestination` returns `localDestinationAccepts` alongside the
48
+ // destination, and BOTH must be passed to `decideBoundary`. Dropping the second
49
+ // is not a cosmetic omission: it turns `LOCAL_ONLY` ("a local destination
50
+ // accepts this — set `driver: local`") into `DENY` ("no approval can unlock
51
+ // it"). Nothing leaks either way, which is why that defect survives review; it
52
+ // is wrong in the SENTENCE, telling an operator their situation is unfixable
53
+ // while a registered local destination would take the data.
54
+ export { isLocalFamilyDriver, parseRegistry, resolveDestination, } from "./privacy/destinationRegistry.js";
55
+ // ── Saying what a destination is, to a person ────────────────────────────────
56
+ //
57
+ // The disclosure states only what is true by construction: whether the prompt
58
+ // leaves the machine, over the network, to the named destination. It carries no
59
+ // retention period, deletion promise or training claim, because such a claim
60
+ // rots without a code change and a claim the code cannot keep is worse than
61
+ // none — it is believed. Provider behaviour belongs in an operator `note`, and
62
+ // an undated or stale note is reported as undated or stale.
63
+ export { ALL_CLASSIFICATIONS, describeDestinations, disclosureFor, noteIsStale, } from "./privacy/describeDestinations.js";
64
+ //# sourceMappingURL=privacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.js","sourceRoot":"","sources":["../src/privacy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,gFAAgF;AAEhF,OAAO,EAGL,eAAe,EAEf,kBAAkB,EAElB,sBAAsB,EAEtB,cAAc,EACd,SAAS,EACT,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC,gFAAgF;AAChF,EAAE;AACF,uEAAuE;AACvE,gFAAgF;AAChF,0EAA0E;AAC1E,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,4DAA4D;AAE5D,OAAO,EAEL,mBAAmB,EAGnB,aAAa,EAGb,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAE1C,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,4DAA4D;AAE5D,OAAO,EACL,mBAAmB,EAInB,oBAAoB,EACpB,aAAa,EACb,WAAW,GACZ,MAAM,mCAAmC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchwork-os",
3
- "version": "1.2.0-beta.2.canary.770",
3
+ "version": "1.2.0-beta.2.canary.771",
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",
@@ -13,6 +13,14 @@
13
13
  "./plugin": {
14
14
  "import": "./dist/plugin.js",
15
15
  "types": "./dist/plugin.d.ts"
16
+ },
17
+ "./gate": {
18
+ "import": "./dist/gate.js",
19
+ "types": "./dist/gate.d.ts"
20
+ },
21
+ "./privacy": {
22
+ "import": "./dist/privacy.js",
23
+ "types": "./dist/privacy.d.ts"
16
24
  }
17
25
  },
18
26
  "bin": {