@principles/workbuddy-adapter 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,8 +47,16 @@ export interface WorkbuddyWorkerCycleOptions {
|
|
|
47
47
|
/**
|
|
48
48
|
* WHO drove this cycle — same attribution contract as the Codex worker
|
|
49
49
|
* (PRI-1264 + Phase 2 `service_host` driver identity, TD §5.2).
|
|
50
|
+
*
|
|
51
|
+
* PRI-1278 Phase 5 (Companion-runtime removal): the companion worker driver
|
|
52
|
+
* is retired — there is no Companion runtime left that could legitimately
|
|
53
|
+
* produce it. A process still self-declaring `PD_INVOCATION_SOURCE=companion`
|
|
54
|
+
* (a legacy env leftover) is not authoritative: no resident supervisor backs
|
|
55
|
+
* it, so it is attributed as what it factually is — manual. Historical
|
|
56
|
+
* liveness records already persisted with `lastCycleDriver: 'companion'`
|
|
57
|
+
* stay readable as-is; they are durable facts and are never rewritten.
|
|
50
58
|
*/
|
|
51
|
-
export declare function workbuddyWorkerCycleDriver(): '
|
|
59
|
+
export declare function workbuddyWorkerCycleDriver(): 'service_host' | 'manual';
|
|
52
60
|
/** Read the persisted liveness record, or null when absent/unreadable. */
|
|
53
61
|
export declare function readWorkbuddyWorkerLiveness(workspaceDir: string): Record<string, unknown> | null;
|
|
54
62
|
/**
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
* scheduler state — and no Codex flag, path or transcript semantics are
|
|
23
23
|
* borrowed (SPEC §5: 不借用 Codex flag/日志伪装归因).
|
|
24
24
|
*
|
|
25
|
-
* Correctness under concurrent consumers (
|
|
26
|
-
* worker` + manual `pd runtime internalization
|
|
27
|
-
* durable Runtime task lease — never by
|
|
25
|
+
* Correctness under concurrent consumers (Service-Host-spawned bounded
|
|
26
|
+
* `pd workbuddy worker --once` + manual `pd runtime internalization
|
|
27
|
+
* run-once`) is owned by the durable Runtime task lease — never by
|
|
28
|
+
* process-local state. The
|
|
28
29
|
* governance workspace is the single canonical directory
|
|
29
30
|
* (`~/.workbuddy/pd-workspace`), so two projects never double-schedule:
|
|
30
31
|
* they share one workspace and the lease serialises consumption.
|
|
@@ -36,7 +37,12 @@ import { loadPdConfigForPlugin, loadFeatureFlagFromConfig, reconcileGovernanceCo
|
|
|
36
37
|
import { WORKBUDDY_TOOL_SEMANTICS, WORKBUDDY_TOOL_SEMANTIC_MAPPINGS } from '../tool-semantics.js';
|
|
37
38
|
import { catchUpWorkbuddyIngestion } from '../ingestion/catch-up.js';
|
|
38
39
|
import { readWorkbuddyTargetTurnEvidence } from '../ingestion/pain-receipt-fallback.js';
|
|
39
|
-
|
|
40
|
+
// PRI-1278 Phase 5 (Companion-runtime removal): the lease/consumer owner
|
|
41
|
+
// label for NEW writes is the Service Host worker identity — the PD Service
|
|
42
|
+
// Host is the only background runtime and spawns these bounded worker cycles.
|
|
43
|
+
// Historical lease records keep the retired 'companion-worker' string; they
|
|
44
|
+
// are durable facts and are deliberately NOT migrated.
|
|
45
|
+
const WORKER_OWNER = 'service-host-worker';
|
|
40
46
|
const DEFAULT_DIAG_CANDIDATE_LIMIT = 5;
|
|
41
47
|
// ── Cycle liveness (Phase 2, SPEC §11 / TD §2.3: WorkBuddy had NO liveness
|
|
42
48
|
// record — FR-10 health was undecidable). Same shape and atomic-write
|
|
@@ -56,11 +62,17 @@ function isPlainRecord(value) {
|
|
|
56
62
|
/**
|
|
57
63
|
* WHO drove this cycle — same attribution contract as the Codex worker
|
|
58
64
|
* (PRI-1264 + Phase 2 `service_host` driver identity, TD §5.2).
|
|
65
|
+
*
|
|
66
|
+
* PRI-1278 Phase 5 (Companion-runtime removal): the companion worker driver
|
|
67
|
+
* is retired — there is no Companion runtime left that could legitimately
|
|
68
|
+
* produce it. A process still self-declaring `PD_INVOCATION_SOURCE=companion`
|
|
69
|
+
* (a legacy env leftover) is not authoritative: no resident supervisor backs
|
|
70
|
+
* it, so it is attributed as what it factually is — manual. Historical
|
|
71
|
+
* liveness records already persisted with `lastCycleDriver: 'companion'`
|
|
72
|
+
* stay readable as-is; they are durable facts and are never rewritten.
|
|
59
73
|
*/
|
|
60
74
|
export function workbuddyWorkerCycleDriver() {
|
|
61
75
|
const source = process.env.PD_INVOCATION_SOURCE;
|
|
62
|
-
if (source === 'companion')
|
|
63
|
-
return 'companion';
|
|
64
76
|
if (source === 'service_host')
|
|
65
77
|
return 'service_host';
|
|
66
78
|
return 'manual';
|
|
@@ -69,9 +81,9 @@ export function workbuddyWorkerCycleDriver() {
|
|
|
69
81
|
* F13 (TD §5.2): the coordinator passes a unique invocation id; when
|
|
70
82
|
* present it lands in the liveness record so the shared per-workspace file
|
|
71
83
|
* can be correlated back to the exact Service Host invocation.
|
|
72
|
-
* R5 review fix: a manual
|
|
73
|
-
* patch must CLEAR the field — otherwise a completed manual run
|
|
74
|
-
* masquerading under the previous shadow run's id.
|
|
84
|
+
* R5 review fix: a manual (non-Service-Host) cycle carries NO invocation
|
|
85
|
+
* id, so the patch must CLEAR the field — otherwise a completed manual run
|
|
86
|
+
* would keep masquerading under the previous shadow run's id.
|
|
75
87
|
*/
|
|
76
88
|
function invocationIdLivenessPatch() {
|
|
77
89
|
const invocationId = process.env.PD_INVOCATION_ID;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/workbuddy-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "WorkBuddy host adapter for Principles Disciple — implements the HostAdapter interface for WorkBuddy's Git Bash command-hook model (ADR-0020 third host, SPEC workbuddy-host-adapter v0.3.0).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"lint": "eslint \"src/**/*.ts\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@principles/core": "^8.
|
|
46
|
-
"@principles/host-runtime": "^4.
|
|
47
|
-
"@principles/install-layout": "^0.
|
|
45
|
+
"@principles/core": "^8.4.0",
|
|
46
|
+
"@principles/host-runtime": "^4.8.0",
|
|
47
|
+
"@principles/install-layout": "^0.12.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^26.6.6",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "ff62137821c993773cc7df104a01625310776c51"
|
|
65
65
|
}
|