create-principles-disciple 1.156.0 → 1.156.1

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.
Files changed (117) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +3 -2
  3. package/codex-adapter/dist/worker/workspace-worker.js +52 -17
  4. package/codex-adapter/package.json +1 -1
  5. package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
  6. package/core/dist/runtime/diagnostician-candidate.js +6 -4
  7. package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
  8. package/core/dist/runtime/index.d.ts +2 -1
  9. package/core/dist/runtime/index.d.ts.map +1 -1
  10. package/core/dist/runtime/index.js +2 -1
  11. package/core/dist/runtime/index.js.map +1 -1
  12. package/core/dist/runtime/intent/intent-doc.d.ts +30 -0
  13. package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
  14. package/core/dist/runtime/intent/intent-doc.js +47 -0
  15. package/core/dist/runtime/intent/intent-doc.js.map +1 -1
  16. package/core/dist/runtime/intent/intent-snapshot.d.ts +12 -0
  17. package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -1
  18. package/core/dist/runtime/intent/intent-snapshot.js +20 -0
  19. package/core/dist/runtime/intent/intent-snapshot.js.map +1 -1
  20. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +18 -0
  21. package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
  22. package/core/dist/runtime/internalization/diag-rootcause-runner.js +53 -15
  23. package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
  24. package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
  25. package/core/dist/runtime/internalization/split-diagnostician-runner.js +4 -0
  26. package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
  27. package/core/dist/runtime/pain-admission-disposition.d.ts +8 -4
  28. package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -1
  29. package/core/dist/runtime/pain-admission-disposition.js +8 -4
  30. package/core/dist/runtime/pain-admission-disposition.js.map +1 -1
  31. package/core/dist/runtime/pain-receipt-recovery.d.ts +38 -10
  32. package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -1
  33. package/core/dist/runtime/pain-receipt-recovery.js +266 -30
  34. package/core/dist/runtime/pain-receipt-recovery.js.map +1 -1
  35. package/core/dist/runtime/pain-signal-runtime-factory.d.ts +60 -12
  36. package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
  37. package/core/dist/runtime/pain-signal-runtime-factory.js +200 -142
  38. package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
  39. package/core/dist/runtime/pain-submit-capability.d.ts +14 -3
  40. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
  41. package/core/dist/runtime/pain-submit-capability.js +21 -9
  42. package/core/dist/runtime/pain-submit-capability.js.map +1 -1
  43. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +48 -13
  44. package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -1
  45. package/core/dist/runtime/pain-target-evidence-reconcile.js +267 -81
  46. package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -1
  47. package/core/dist/runtime/pain-to-principle-service.d.ts +2 -5
  48. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  49. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  50. package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
  51. package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
  52. package/core/dist/runtime/store/runtime-state-manager.js +18 -0
  53. package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
  54. package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
  55. package/core/dist/runtime/store/task/memory-task-store.js +20 -0
  56. package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
  57. package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
  58. package/core/dist/runtime/store/task/sqlite-task-store.js +9 -0
  59. package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
  60. package/core/dist/runtime/store/task/task-store.d.ts +10 -0
  61. package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
  62. package/core/package.json +1 -1
  63. package/host-runtime/dist/diagnostician-auto-run.js +20 -14
  64. package/host-runtime/dist/index.d.ts +1 -0
  65. package/host-runtime/dist/index.js +4 -0
  66. package/host-runtime/dist/intent-doc-reader.js +1 -1
  67. package/host-runtime/dist/workspace-pipeline-host-deps.d.ts +65 -0
  68. package/host-runtime/dist/workspace-pipeline-host-deps.js +94 -0
  69. package/host-runtime/dist/workspace-telemetry-emitter.js +14 -0
  70. package/host-runtime/package.json +1 -1
  71. package/install-layout/dist/index.d.ts +1 -0
  72. package/install-layout/dist/index.js +1 -0
  73. package/install-layout/dist/openclaw-config-path.d.ts +9 -0
  74. package/install-layout/dist/openclaw-config-path.js +64 -0
  75. package/install-layout/package.json +1 -1
  76. package/package.json +3 -3
  77. package/pd-cli/dist/commands/codex-worker.js +2 -2
  78. package/pd-cli/dist/commands/codex-worker.js.map +1 -1
  79. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  80. package/pd-cli/dist/commands/diagnose.js +49 -75
  81. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  82. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  83. package/pd-cli/dist/commands/pain-record.js +18 -26
  84. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  85. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  86. package/pd-cli/dist/commands/pain-retry.js +50 -66
  87. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  88. package/pd-cli/dist/commands/workbuddy-worker.js +2 -2
  89. package/pd-cli/dist/commands/workbuddy-worker.js.map +1 -1
  90. package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
  91. package/pd-cli/dist/services/config-doctor.js +7 -4
  92. package/pd-cli/dist/services/config-doctor.js.map +1 -1
  93. package/pd-cli/package.json +1 -1
  94. package/pd-mcp-server/dist/server.d.ts +7 -0
  95. package/pd-mcp-server/dist/server.js +12 -1
  96. package/pd-mcp-server/dist/submit-assembly.js +2 -1
  97. package/pd-mcp-server/dist/version.d.ts +1 -1
  98. package/pd-mcp-server/dist/version.js +1 -1
  99. package/pd-mcp-server/package.json +1 -1
  100. package/plugin/dist/bundle.js +532 -496
  101. package/plugin/dist/core/config-health.d.ts +6 -0
  102. package/plugin/dist/core/openclaw-config-loader.d.ts +14 -0
  103. package/plugin/dist/core/pain-service.d.ts +26 -0
  104. package/plugin/dist/hooks/openclaw-run-turn-correlation.d.ts +30 -0
  105. package/plugin/dist/hooks/openclaw-target-turn-capture.d.ts +13 -0
  106. package/plugin/dist/hooks/pain-receipt-fallback.d.ts +107 -0
  107. package/plugin/dist/openclaw-sdk.d.ts +15 -0
  108. package/plugin/dist/openclaw-worker.d.ts +3 -0
  109. package/plugin/dist/openclaw-worker.js +277 -276
  110. package/plugin/dist/openclaw.plugin.json +1 -1
  111. package/plugin/openclaw.plugin.json +1 -1
  112. package/plugin/package.json +1 -1
  113. package/release-manager/package.json +1 -1
  114. package/workbuddy-adapter/dist/ingestion/pain-receipt-fallback.js +3 -2
  115. package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +3 -0
  116. package/workbuddy-adapter/dist/worker/workspace-worker.js +48 -15
  117. package/workbuddy-adapter/package.json +1 -1
@@ -14,6 +14,12 @@ export interface ConversationAccessCheckResult {
14
14
  * Returns a structured result with reason and nextAction when not authorized (ERR-002).
15
15
  */
16
16
  export declare function checkConversationAccessConfig(pluginConfig: unknown): ConversationAccessCheckResult;
17
+ /**
18
+ * Live read-side conversation access decision. A missing global config keeps
19
+ * the documented missing-flag fallback semantics; an unreadable existing
20
+ * config or explicit `allowConversationAccess=false` blocks reads.
21
+ */
22
+ export declare function shouldBlockOpenClawConversationReads(pluginId?: string): boolean;
17
23
  export declare function ensureConversationAccessInConfig(): boolean;
18
24
  /**
19
25
  * True when the plugin entry carries an explicit
@@ -0,0 +1,14 @@
1
+ export type OpenClawEffectiveConfigResult = {
2
+ readonly ok: true;
3
+ readonly config: Record<string, unknown>;
4
+ readonly rawConfig: Record<string, unknown>;
5
+ readonly usesInclude: boolean;
6
+ readonly strictJson: boolean;
7
+ } | {
8
+ readonly ok: false;
9
+ readonly reason: 'missing' | 'read_failed' | 'parse_failed' | 'include_failed' | 'not_object';
10
+ };
11
+ /** Read and fully resolve the effective OpenClaw config. Missing/unreadable/
12
+ * malformed input and every include failure are indistinguishable fail-closed
13
+ * outcomes to callers; no partial config is ever returned. */
14
+ export declare function readOpenClawEffectiveConfig(configPath: string): OpenClawEffectiveConfigResult;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * SPEC-PD-PIPELINE-SPINE-001 §4.2 point 3 (PRI-1292 Phase 2A) — the single
3
+ * plugin-side PainToPrincipleService factory for the two OpenClaw pain
4
+ * entries (`src/hooks/pain.ts` after-tool-call hook and `src/commands/pain.ts`
5
+ * `/pd pain` command).
6
+ *
7
+ * Before this factory each entry assembled its own PainToPrincipleService with
8
+ * its own collaborator set (and its own consent-ledger authorization
9
+ * instance); the hook carried `telemetrySink`-less wiring and the command
10
+ * duplicated the whole block. Both entries are constant-sync (neither passes
11
+ * `asyncMode`), so the service always receives the type-mandatory sync
12
+ * collaborators — now sourced from ONE `resolveWorkspacePipelineHostDeps`
13
+ * assembly whose trajectory reader override is the Gateway's in-process
14
+ * `WorkspaceContext.trajectory`.
15
+ */
16
+ import { PainToPrincipleService } from '@principles/core/runtime';
17
+ import type { WorkspaceContext } from './workspace-context.js';
18
+ /**
19
+ * Build the (constant-sync) PainToPrincipleService for a workspace context.
20
+ *
21
+ * The five host collaborators come from the ONE host-runtime assembly point:
22
+ * the returned `trajectoryTurnReader` is the override adapter over
23
+ * `wctx.trajectory`, and `sourceMaterialAuthorization` is the workspace
24
+ * consent-ledger port shared with every gate consumer.
25
+ */
26
+ export declare function createPluginPainToPrincipleService(wctx: WorkspaceContext): PainToPrincipleService;
@@ -0,0 +1,30 @@
1
+ /** Remember the exact turn identity produced by this run's persisted user-turn write. */
2
+ export declare function rememberOpenclawRunTurnCorrelation(input: {
3
+ readonly workspaceDir: string;
4
+ readonly sessionId: string;
5
+ readonly runId: string;
6
+ readonly targetTurnId: string;
7
+ /** Exact message bytes that were cross-checked against the final host message. */
8
+ readonly message: string;
9
+ readonly now?: number;
10
+ }): boolean;
11
+ /** Confirm a repeated prompt callback is still the same admitted user message.
12
+ * A runId reused for different text is quarantined, never retargeted. */
13
+ export declare function confirmOpenclawRunTurnMessage(input: {
14
+ readonly workspaceDir: string;
15
+ readonly sessionId: string;
16
+ readonly runId: string;
17
+ readonly message: string;
18
+ readonly now?: number;
19
+ }): boolean;
20
+ /** Resolve only the same workspace/session/run tuple; never infer from session recency. */
21
+ export declare function resolveOpenclawRunTurnCorrelation(input: {
22
+ readonly workspaceDir: string;
23
+ readonly sessionId: string | undefined;
24
+ readonly runId: string | undefined;
25
+ /** Production consumes the mapping once so a reused runId cannot retarget a later tool call. */
26
+ readonly consume?: boolean;
27
+ readonly now?: number;
28
+ }): string | undefined;
29
+ /** Test isolation only. */
30
+ export declare function clearOpenclawRunTurnCorrelationsForTest(): void;
@@ -0,0 +1,13 @@
1
+ import type { PluginLogger } from '../openclaw-sdk.js';
2
+ export declare function captureOpenclawUserTurnForTargetEvidence(input: {
3
+ readonly workspaceDir: string;
4
+ readonly sessionId: string;
5
+ readonly hostTurnId: unknown;
6
+ /** Exact persisted user_turns row identity used when the embedded OpenClaw
7
+ * entry supplies no native message id. Callers prefix it `user-turn-row:` so
8
+ * it cannot be confused with a per-session ordinal. */
9
+ readonly fallbackHostTurnId?: string;
10
+ readonly text: unknown;
11
+ readonly logger?: Partial<PluginLogger>;
12
+ readonly now?: Date;
13
+ }): void;
@@ -0,0 +1,107 @@
1
+ import type { TargetTurnEvidenceRead } from '@principles/core/runtime';
2
+ import { type PainReceiptRecoveryOutcome } from '@principles/core/runtime';
3
+ import type { PluginHookAfterToolCallEvent, PluginHookToolContext } from '../openclaw-sdk.js';
4
+ /** The exact materialized tool name this fallback processes (audit §2.5).
5
+ * Exact equality — no substring, no regex, no second spelling. */
6
+ export declare const OPENCLAW_PAIN_SUBMIT_TOOL_NAME: 'pd-recall__pd_submit_pain';
7
+ /** The MCP server id the PD plugin manifest declares (`openclaw.plugin.json`
8
+ * `mcpServers["pd-recall"]`) and the host's own result attribution must agree
9
+ * with. */
10
+ export declare const OPENCLAW_PAIN_SUBMIT_SERVER_ID: 'pd-recall';
11
+ /** Exact gate: only the PD MCP server's materialized `pd_submit_pain`
12
+ * completion may enter the recovery path. */
13
+ export declare function isPainSubmitOpenclawToolName(toolName: string): boolean;
14
+ export type PainReceiptFallbackResult = {
15
+ readonly status: 'not_applicable';
16
+ } | {
17
+ readonly status: 'attempted';
18
+ readonly outcome: PainReceiptRecoveryOutcome;
19
+ };
20
+ /**
21
+ * Walk the OpenClaw agent tool result to the parsed receipt object. The
22
+ * REAL installed envelope (probe-verified 2026-11-25 on the isolated
23
+ * gateway, `.tmp/pri1276/probe/after-tool-call.jsonl`) is SINGLE-encoded:
24
+ * `result.content[0].text` IS the `pd.pain-submit-receipt.v1` JSON directly
25
+ * and `result.details` carries `{mcpServer:'pd-recall', mcpTool}`. The
26
+ * dist-derived double-encoded shape (CallToolResult JSON inside the text,
27
+ * audit §2.5 first reading) is kept as an accepted variant: a layer-1
28
+ * object that carries an ARRAY `content` property is unwrapped one more
29
+ * layer. Every deviation is a structured rejection — the event envelope is
30
+ * untrusted runtime data (rc-1..rc-5) and more than one text block at
31
+ * either layer is ambiguous (two blocks could each carry a different
32
+ * task's receipt).
33
+ */
34
+ export declare function extractOpenclawReceipt(result: unknown): {
35
+ ok: true;
36
+ receipt: unknown;
37
+ } | {
38
+ ok: false;
39
+ reasonCode: string;
40
+ };
41
+ /**
42
+ * The structured target-turn evidence read for the OpenClaw host boundary —
43
+ * the exact contract PRI-1273 froze: the consent ledger FIRST (a denial
44
+ * returns blocked_by_consent BEFORE any store query), then the EXACT
45
+ * (rollout identity, host turn id) — never a session scan, never the
46
+ * submission turn, never a recent-turn fallback.
47
+ */
48
+ export declare function readOpenclawTargetTurnEvidence(workspaceDir: string, sessionId: string, turnId: string): TargetTurnEvidenceRead;
49
+ /** Does the authorized governance store already hold readable text for the
50
+ * EXACT (session, turn)? Same contract as the WorkBuddy host boundary. */
51
+ export declare function openclawTargetTurnTextAvailable(workspaceDir: string, sessionId: string, turnId: string): boolean;
52
+ export interface PainReceiptFallbackInput {
53
+ readonly workspaceDir: string;
54
+ /** Raw host event `toolName` — exact-equality gated before anything else
55
+ * happens (P1-1). */
56
+ readonly toolName: string;
57
+ /** The formal event's `result` (double-encoded MCP envelope). */
58
+ readonly toolResult: unknown;
59
+ /** Host-authoritative identity plus an optional exact turn identity
60
+ * resolved by the same-process (workspace, session, runId) correlation. */
61
+ readonly identity: {
62
+ readonly sessionId: string | undefined;
63
+ readonly toolCallId: string | undefined;
64
+ readonly targetTurnId?: string;
65
+ };
66
+ /** OpenClaw's production after_tool_call path sets this to prevent a
67
+ * session-only READY fallback when target evidence is required. */
68
+ readonly requireTargetTurnIdentity?: boolean;
69
+ /** Caller-resolved `host_identity_minimal_metadata` flag verdict. */
70
+ readonly minimalMetadataGranted: boolean;
71
+ readonly now?: () => Date;
72
+ }
73
+ /**
74
+ * Attempt the receipt fallback for one `after_tool_call` event. Never
75
+ * throws — every failure is a structured result the hook surfaces as one
76
+ * bounded diagnostic (rc-9); the hook result itself is unaffected
77
+ * (fail-open belt: recovery cannot change what the tool already did).
78
+ */
79
+ export declare function attemptPainReceiptFallback(input: PainReceiptFallbackInput): Promise<PainReceiptFallbackResult>;
80
+ /**
81
+ * One bounded stderr/logger diagnostic line for the hook (ids and codes
82
+ * only — never receipt content, prompts or tool input/output). The
83
+ * `stage` segment keeps the degraded state observable per the host contract.
84
+ * `unbound=true` is emitted only when the shared recovery pass actually read
85
+ * the task and proved it unbound; conflict, parse and store failures leave
86
+ * the binding state unknown and therefore omit the field.
87
+ */
88
+ export declare function painReceiptFallbackDiagnostic(result: PainReceiptFallbackResult): string | null;
89
+ /**
90
+ * Hook entry: one `after_tool_call` event in, a bounded diagnostic line (or
91
+ * null) plus the gate verdict out. Resolves the
92
+ * `host_identity_minimal_metadata` verdict from the CURRENT workspace config
93
+ * (per-event re-read — a Workspace-side revocation stops binding on the next
94
+ * event without a gateway restart; a malformed config fails closed for the
95
+ * identity path) and aggregates the host-authoritative identity from
96
+ * the event and context (`sessionId` on context, `toolCallId` on event).
97
+ * The event's `runId` joins only to the exact target-turn identity captured
98
+ * by the prompt hook; it is never treated as a turn id itself. Never throws.
99
+ */
100
+ export declare function runAfterToolCallReceiptFallback(input: {
101
+ readonly event: PluginHookAfterToolCallEvent;
102
+ readonly ctx: PluginHookToolContext;
103
+ readonly workspaceDir: string;
104
+ }): Promise<{
105
+ readonly line: string | null;
106
+ readonly notApplicableReason?: 'tool_not_pd_submit_pain';
107
+ }>;
@@ -270,6 +270,21 @@ export interface PluginHookToolContext {
270
270
  export interface PluginHookAfterToolCallEvent {
271
271
  toolName: string;
272
272
  toolArgs?: Record<string, unknown>;
273
+ /**
274
+ * Host field since OpenClaw 2026.11.x: the executed tool arguments
275
+ * (`params`, structuredClone'd) — the deprecated `toolArgs` above is the
276
+ * legacy spelling some adapter shims still send.
277
+ */
278
+ params?: Record<string, unknown>;
279
+ /** Host field since OpenClaw 2026.11.x: the agent run id. */
280
+ runId?: string;
281
+ /**
282
+ * Host field since OpenClaw 2026.11.x: the physical tool call id from the
283
+ * real execution record (embedded-agent-subscribe `prepareToolExecutionEnd`
284
+ * → event `toolCallId`). PRI-1276's receipt fallback uses it as the
285
+ * ambiguity key — never synthesize it from params or ordering.
286
+ */
287
+ toolCallId?: string;
273
288
  result?: unknown;
274
289
  error?: unknown;
275
290
  agentId?: string;
@@ -1,5 +1,6 @@
1
1
  import { type ConsumerCycleLogger } from '@principles/host-runtime';
2
2
  import { type WorkspaceBackgroundOwnership } from '@principles/install-layout';
3
+ import { type TargetEvidenceReconcileReport } from '@principles/core/runtime';
3
4
  export { GATEWAY_QUIESCE_ACK_SCHEMA_VERSION, readGatewayQuiesceAck, type GatewayQuiesceAck, } from './service/gateway-quiesce-ack.js';
4
5
  export type OpenClawWorkerMode = 'ready' | 'paused' | 'degraded';
5
6
  export interface OpenClawWorkerCycleStepReport {
@@ -21,6 +22,8 @@ export interface OpenClawWorkerCycleStepReport {
21
22
  taskId?: string;
22
23
  taskKind?: string;
23
24
  };
25
+ /** PRI-1296: exact target-turn evidence reconcile before diagnosis. */
26
+ targetEvidenceReconcile?: TargetEvidenceReconcileReport;
24
27
  diagnostician: {
25
28
  served: boolean;
26
29
  status: 'succeeded' | 'no_candidate' | 'skipped' | 'failed';