create-principles-disciple 1.147.14 → 1.147.17

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 (82) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/codex-adapter/package.json +1 -1
  3. package/console/dist/server/models/ActivationsConsoleModel.js +9 -3
  4. package/console/dist/server/models/ApprovalsConsoleModel.js +35 -6
  5. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +42 -2
  6. package/console/dist/shared/prompt-injection-contract.d.ts +31 -4
  7. package/console/dist/web/assets/app.css +4 -0
  8. package/console/dist/web/assets/app.js +25 -25
  9. package/core/dist/runtime/activation/index.d.ts +1 -1
  10. package/core/dist/runtime/activation/index.d.ts.map +1 -1
  11. package/core/dist/runtime/activation/index.js +4 -1
  12. package/core/dist/runtime/activation/index.js.map +1 -1
  13. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts +20 -0
  14. package/core/dist/runtime/activation/prompt-activation-reader-contract.d.ts.map +1 -1
  15. package/core/dist/runtime/activation/prompt-activation-reader-contract.js +86 -27
  16. package/core/dist/runtime/activation/prompt-activation-reader-contract.js.map +1 -1
  17. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  18. package/core/dist/runtime/feature-flags/feature-flag-contract.js +6 -1
  19. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  20. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  21. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +0 -8
  22. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  23. package/core/dist/runtime/index.d.ts +3 -3
  24. package/core/dist/runtime/index.d.ts.map +1 -1
  25. package/core/dist/runtime/index.js +4 -2
  26. package/core/dist/runtime/index.js.map +1 -1
  27. package/core/dist/runtime/types/event-types.d.ts +62 -3
  28. package/core/dist/runtime/types/event-types.d.ts.map +1 -1
  29. package/core/dist/runtime/types/event-types.js +43 -0
  30. package/core/dist/runtime/types/event-types.js.map +1 -1
  31. package/core/package.json +1 -1
  32. package/dist/mvp-config.d.ts +4 -0
  33. package/dist/mvp-config.d.ts.map +1 -1
  34. package/dist/mvp-config.js +4 -0
  35. package/dist/mvp-config.js.map +1 -1
  36. package/host-runtime/dist/active-principle-prompt.d.ts +111 -2
  37. package/host-runtime/dist/active-principle-prompt.js +168 -41
  38. package/host-runtime/dist/adaptive-principle-revalidation.js +1 -1
  39. package/host-runtime/dist/index.d.ts +10 -0
  40. package/host-runtime/dist/index.js +31 -13
  41. package/host-runtime/dist/product-telemetry/consent-store.d.ts +112 -14
  42. package/host-runtime/dist/product-telemetry/consent-store.js +343 -132
  43. package/host-runtime/dist/product-telemetry/control-state-lock.d.ts +99 -0
  44. package/host-runtime/dist/product-telemetry/control-state-lock.js +320 -0
  45. package/host-runtime/dist/product-telemetry/service.d.ts +26 -9
  46. package/host-runtime/dist/product-telemetry/service.js +90 -150
  47. package/host-runtime/dist/prompt-activation-deliverability.d.ts +25 -15
  48. package/host-runtime/dist/prompt-activation-deliverability.js +60 -30
  49. package/host-runtime/dist/prompt-injection-projection.d.ts +105 -48
  50. package/host-runtime/dist/prompt-injection-projection.js +190 -212
  51. package/host-runtime/dist/prompt-injection-status.js +16 -7
  52. package/host-runtime/dist/signal-stage2-cycle.js +8 -1
  53. package/host-runtime/package.json +1 -1
  54. package/package.json +3 -3
  55. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  56. package/pd-cli/dist/commands/runtime-activation.js +4 -0
  57. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  58. package/pd-cli/dist/commands/telemetry.d.ts.map +1 -1
  59. package/pd-cli/dist/commands/telemetry.js +3 -1
  60. package/pd-cli/dist/commands/telemetry.js.map +1 -1
  61. package/pd-cli/package.json +1 -1
  62. package/plugin/dist/bundle.js +487 -490
  63. package/plugin/dist/core/event-log.d.ts +8 -1
  64. package/plugin/dist/core/signal-collector-host.d.ts +27 -7
  65. package/plugin/dist/governance-audit.js +2 -2
  66. package/plugin/dist/hooks/llm-input-presence.d.ts +42 -0
  67. package/plugin/dist/hooks/prompt-presence-expectations.d.ts +74 -0
  68. package/plugin/dist/hooks/prompt-presence-lite.d.ts +53 -0
  69. package/plugin/dist/hooks/prompt-presence-measure.d.mts +1 -0
  70. package/plugin/dist/hooks/prompt-presence-registry.d.ts +150 -0
  71. package/plugin/dist/hooks/prompt.d.ts +40 -0
  72. package/plugin/dist/host-runtime/openclaw-host-runtime.d.ts +24 -1
  73. package/plugin/dist/index.d.ts +16 -9
  74. package/plugin/dist/openclaw-sdk.d.ts +33 -0
  75. package/plugin/dist/openclaw.plugin.json +1 -1
  76. package/plugin/dist/types/event-types.d.ts +1 -1
  77. package/plugin/openclaw.plugin.json +1 -1
  78. package/plugin/package.json +1 -1
  79. package/release-manager/dist/mvp-config.js +4 -0
  80. package/release-manager/package.json +1 -1
  81. package/workbuddy-adapter/package.json +1 -1
  82. package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +1 -1
@@ -10,6 +10,53 @@ export declare const PROMPT_INJECTION_TARGET_HOSTS: readonly PromptInjectionTarg
10
10
  * (review R1: each re-typed list forked the roster and dropped WorkBuddy). */
11
11
  export declare function isPromptInjectionTargetHost(kind: unknown): kind is PromptInjectionTargetHost;
12
12
  export type PromptInjectionRouteName = 'legacy_trim' | 'shared_render';
13
+ /**
14
+ * PRI-1137 final review (P1-1): rotation semantics of the production route as
15
+ * a THREE-STATE fact, never a boolean. A boolean conflates two different
16
+ * answers — "the bound host cannot rotate" (a real FIFO statement about a
17
+ * known host) and "no single host is bound, so rotation cannot be attributed"
18
+ * (an unknown). Downstream copy that reads the second as the first tells an
19
+ * OpenClaw Owner their principle is permanently FIFO-queued when it is not.
20
+ *
21
+ * This is the STATIC host capability. Whether a real OpenClaw round actually
22
+ * rotated is a runtime fact the plugin owns: a missing sessionId, a failed
23
+ * `user_turns` write, or an unreadable ordinal degrade that round to
24
+ * `legacy_fifo_prefix_v1` (existing FIFO fallback) — never fabricated here.
25
+ */
26
+ export type PromptProductionRotationState = {
27
+ readonly state: 'rotates';
28
+ } | {
29
+ readonly state: 'does_not_rotate';
30
+ } | {
31
+ readonly state: 'unknown';
32
+ /** Bounded reason rotation cannot be attributed (rc-3: fail loud, no silent guess). */
33
+ readonly reason: 'no_bound_host' | 'host_facts_unreadable';
34
+ };
35
+ /**
36
+ * A host's STATIC rotation capability (final review P1-1.4/P1-1.5): only
37
+ * OpenClaw supplies a trusted round authority (`nextSessionTurnOrdinal` over
38
+ * trajectory.db `user_turns`); Codex/WorkBuddy inject FIFO by their own
39
+ * policy and never fabricate a round key. One mapping, typed by the roster —
40
+ * consumers must not re-derive host capabilities from route names. A bound
41
+ * host always resolves to a definite state (never `unknown`).
42
+ */
43
+ export declare function hostRotationCapability(hostKind: PromptInjectionTargetHost): Extract<PromptProductionRotationState, {
44
+ state: 'rotates' | 'does_not_rotate';
45
+ }>;
46
+ /**
47
+ * PRI-1137 final review: the rotation truth of the ONE production route.
48
+ * Explicit host binding resolves that host's actual capability; otherwise a
49
+ * workspace with exactly one applicable host resolves to that host's
50
+ * capability, and anything else (no host has ever operated here, several
51
+ * applicable hosts, unreadable host facts) stays `unknown` — aggregate host
52
+ * facts are never flattened into "all hosts are FIFO" (P1-1.6). Route
53
+ * confirmation (`shared_render` for everyone) and host binding are separate
54
+ * facts; this function only answers the binding question.
55
+ */
56
+ export declare function productionRouteRotationState(input: {
57
+ workspaceDir: string;
58
+ targetHost?: PromptInjectionTargetHost;
59
+ }): PromptProductionRotationState;
13
60
  /**
14
61
  * Which serialization the budget is charged against (SPEC R-A2): the legacy
15
62
  * list route bills only the selected `- [id] text` lines (the directive
@@ -20,15 +67,14 @@ export type PromptInjectionRouteName = 'legacy_trim' | 'shared_render';
20
67
  export type PromptInjectionBudgetScope = 'selected_lines' | 'full_directive_context';
21
68
  export declare const PROMPT_INJECTION_UNIT: 'utf16_code_units';
22
69
  /**
23
- * AC-01: the effective injection route is a fact about WHICH HOST will run
24
- * the prompt build, not about the workspace flag alone. Codex always injects
25
- * through the shared route (`codex-adapter/src/pd-hook.ts`); OpenClaw routes
26
- * by its `abstraction_layer_v1` gate (`openclaw-plugin/src/index.ts`). Host
27
- * facts come from the existing durable provenance (declarations ∪ pain
28
- * evidence — `readWorkspaceHostKindFacts`); an explicit request-level target
29
- * overrides them. When the applicable hosts disagree (flag OFF + both hosts
30
- * possible, or no host facts at all) the decision is `unconfirmed` and every
31
- * consumer must say so instead of guessing FIFO or rotation (SPEC R-A1).
70
+ * AC-01 / PRI-1137: every standard host now injects through ONE shared route.
71
+ * `abstraction_layer_v1` is a gone tombstone and no longer selects a route, so
72
+ * the decision is about WHICH host will run the build (host attribution for
73
+ * the Owner), never about a per-host legacy/shared split. Host facts come from
74
+ * the existing durable provenance (declarations ∪ pain evidence —
75
+ * `readWorkspaceHostKindFacts`); an explicit request-level target overrides
76
+ * them. Unconfirmed remains for genuinely unreadable inputs (config, prompt
77
+ * flag, host facts, unknown host kinds) — never for "routes differ".
32
78
  */
33
79
  export interface PromptInjectionRouteDecision {
34
80
  status: 'confirmed' | 'unconfirmed';
@@ -36,11 +82,9 @@ export interface PromptInjectionRouteDecision {
36
82
  hostKind?: PromptInjectionTargetHost;
37
83
  /** Present when status === 'confirmed'. */
38
84
  route?: PromptInjectionRouteName;
39
- basis?: 'explicit_target' | 'workspace_host_facts' | 'flag_shared_all_hosts';
85
+ basis?: 'explicit_target' | 'workspace_host_facts' | 'single_route_all_hosts';
40
86
  /** Present when explicit binding succeeds while workspace-wide host facts are unreadable. */
41
87
  hostFactsStatus?: 'unreadable';
42
- /** Raw `abstraction_layer_v1` flag state (context for the OpenClaw branch). */
43
- flagEnabled: boolean;
44
88
  declaredHostKinds: readonly string[];
45
89
  effectiveHostKinds: readonly string[];
46
90
  /** Present when status === 'unconfirmed'. */
@@ -54,14 +98,13 @@ export interface PromptInjectionRouteDecision {
54
98
  }[];
55
99
  }
56
100
  /**
57
- * THE one route formula (P4): Codex always injects through the shared route
58
- * (codex-adapter has no flag branch); so does WorkBuddy (workbuddy-adapter
59
- * renders through the shared runtime unconditionally — it has no legacy
60
- * route); OpenClaw routes by its `abstraction_layer_v1` gate. Every consumer
61
- * that needs "which route would host X take" must call this — never re-type
62
- * the ternary.
101
+ * THE one route formula (P4 / PRI-1137): every standard host injects through
102
+ * the shared route. The OpenClaw legacy plugin-local route was deleted, so
103
+ * `legacy_trim` is retained only as a historical wire literal — production
104
+ * never returns it. Every consumer that needs "which route would host X take"
105
+ * must call this; never re-type the mapping.
63
106
  */
64
- export declare function promptRouteForHost(hostKind: PromptInjectionTargetHost, flagEnabled: boolean): PromptInjectionRouteName;
107
+ export declare function promptRouteForHost(_hostKind: PromptInjectionTargetHost): PromptInjectionRouteName;
65
108
  /**
66
109
  * Resolve the effective route for this workspace. Pure read of existing
67
110
  * config + provenance facts — no new registry, no persisted state.
@@ -102,8 +145,13 @@ export interface PromptInjectionProjection {
102
145
  * entry within N turns. So this is computed under the production policy
103
146
  * (fair rotation whenever the route actually rotates) and is therefore
104
147
  * non-empty even for a caller that supplied no round key — which is
105
- * exactly the console's situation. Empty only when the production route
106
- * genuinely does not rotate (shared route) or nothing is eligible.
148
+ * exactly the console's situation. Final review P1-1: this is a CAPABILITY
149
+ * bound, not a per-round guarantee — it holds while the session's
150
+ * user-turn records keep succeeding; a round degraded to FIFO (missing
151
+ * sessionId / failed write / unreadable ordinal) does not advance the
152
+ * window. Empty when the production route genuinely does not rotate, when
153
+ * no single host is bound (`productionRotation.state === 'unknown'` — no
154
+ * attributable ring), or when nothing is eligible.
107
155
  */
108
156
  eventuallyInjectedActivationIds: string[];
109
157
  /** Number of eligible candidates that reached the selector. */
@@ -115,8 +163,12 @@ export interface PromptInjectionProjection {
115
163
  * round key; this answers "will the agent's real injection rotate",
116
164
  * which is what determines whether an out-of-window activation is queued
117
165
  * or starved. They differ exactly in the case this whole fix is about.
166
+ *
167
+ * PRI-1137 final review (P1-1): three-state — `unknown` when no single host
168
+ * is bound, which consumers MUST NOT read as "does not rotate". Consumers
169
+ * branch on `.state`; the wire string is exactly the `state` value.
118
170
  */
119
- productionRotates: boolean;
171
+ productionRotation: PromptProductionRotationState;
120
172
  /** R-A2: the unit `usedChars`/`budget` are counted in. */
121
173
  unit: typeof PROMPT_INJECTION_UNIT;
122
174
  /** R-A2: which serialization the budget is charged against on this route. */
@@ -156,43 +208,37 @@ export interface PromptInjectionProjection {
156
208
  budgetFallbackDetail?: string;
157
209
  }
158
210
  /**
159
- * PR #1844 follow-up: forecast the prompt-injection budget from the SAME
160
- * projection the agent injection itself uses:
161
- *
162
- * - legacy route: activation candidates from `readPromptActivationCandidates`
163
- * (same FIFO query + artifact resolve as the plugin's list path) trimmed by
164
- * the REAL `trimToBudget` — identical input × ordering × trim logic as
165
- * `openclaw-plugin/src/hooks/prompt.ts`;
166
- * - shared route: delegate to `buildActivePrinciplePromptContext`, which IS
167
- * the production shared path's projection source (Codex always; OpenClaw
168
- * when its `abstraction_layer_v1` gate is on).
211
+ * PR #1844 follow-up / PRI-1137: forecast the prompt-injection budget from the
212
+ * SAME projection the agent injection itself uses — ONE route, no legacy path:
213
+ * `buildActivePrinciplePromptContext`, which IS the production shared path's
214
+ * projection source for every standard host.
169
215
  *
170
- * Route selection here is EXPLICIT: `targetHost: 'codex'` forces the shared
171
- * route (production truth for Codex), `targetHost: 'openclaw'` follows the
172
- * workspace flag, and no target follows the flag (the historical behavior —
173
- * callers that lack host context should prefer
174
- * `resolveLivePromptInjectionProjection`, which binds the route to real host
175
- * facts and refuses to guess).
216
+ * `targetHost` is host attribution only. It narrows which host's round
217
+ * authority the forecast may assume (see `productionRouteRotationState`); it
218
+ * never selects a different injection route.
176
219
  *
177
- * PR-1894 — round-key alignment. The plugin derives its fair-rotation round
178
- * key from the CURRENT session's turn ordinal (`nextSessionTurnOrdinal`),
179
- * which the console has no access to. Passing no key therefore does NOT make
180
- * the forecast "more conservative": it selects a DIFFERENT policy
181
- * (`legacy_fifo_prefix_v1`) than the one production runs. The console must
182
- * either supply the round key or report the policy honestly, so this
183
- * function takes the key as an explicit input and exposes
184
- * `selectionPolicy` on the result.
220
+ * PR-1894 — round-key alignment. Production derives its fair-rotation round
221
+ * key from the CURRENT session's turn ordinal. The console has no access to
222
+ * it, so passing no key selects `legacy_fifo_prefix_v1` for THIS forecast while
223
+ * production runs `fair_rotation_v1` on OpenClaw. The result therefore exposes
224
+ * both `selectionPolicy` (what this projection ran) and `productionRotation`
225
+ * (what the real injection will do) — never a single blended claim.
185
226
  */
186
227
  export declare function buildLivePromptInjectionProjection(input: {
187
228
  workspaceDir: string;
188
229
  /**
189
- * PR-1894: the fair-rotation round key the production route is using this
230
+ * PRI-1137: the fair-rotation round key the production route is using this
190
231
  * turn. Callers that hold one (the plugin) pass it; callers that do not
191
232
  * (the console) omit it and MUST read `selectionPolicy` off the result
192
233
  * rather than assuming FIFO.
193
234
  */
194
235
  roundKey?: number;
195
- /** AC-01: explicit route binding — 'codex'/'workbuddy' always shared, 'openclaw' by flag. */
236
+ /**
237
+ * PRI-1137: host attribution only — every host now takes the same shared
238
+ * route. This narrows WHICH host's rotation authority the forecast may
239
+ * assume (rotation is an OpenClaw-only capability); it never selects a
240
+ * different injection route.
241
+ */
196
242
  targetHost?: PromptInjectionTargetHost;
197
243
  /**
198
244
  * SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001 §6.1: budget resolution this
@@ -213,6 +259,17 @@ export type LivePromptInjectionProjectionResolution = {
213
259
  status: 'confirmed';
214
260
  decision: PromptInjectionRouteDecision;
215
261
  projection: PromptInjectionProjection;
262
+ /**
263
+ * PRI-1137: with ONE shared route, a workspace that binds no single host
264
+ * still has per-host budget facts (host attribution is a fact, not a route
265
+ * split). Each standard host's forecast runs under ITS OWN budget basis —
266
+ * never another host's window. Absent when a single host is bound (the
267
+ * headline projection already is that host's).
268
+ */
269
+ perHost?: readonly {
270
+ hostKind: PromptInjectionTargetHost;
271
+ projection: PromptInjectionProjection;
272
+ }[];
216
273
  } | {
217
274
  status: 'unconfirmed';
218
275
  decision: PromptInjectionRouteDecision;