@a1hvdy/cc-openclaw 0.11.0 → 0.13.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.
Files changed (212) hide show
  1. package/dist/src/channels/telegram/event-reducer.js +3 -15
  2. package/dist/src/channels/telegram/event-reducer.js.map +1 -1
  3. package/dist/src/channels/telegram/format-helpers.d.ts +20 -0
  4. package/dist/src/channels/telegram/format-helpers.js +34 -0
  5. package/dist/src/channels/telegram/format-helpers.js.map +1 -0
  6. package/dist/src/channels/telegram/live-card.js +3 -21
  7. package/dist/src/channels/telegram/live-card.js.map +1 -1
  8. package/dist/src/channels/telegram/result-preview.d.ts +12 -0
  9. package/dist/src/channels/telegram/result-preview.js +48 -0
  10. package/dist/src/channels/telegram/result-preview.js.map +1 -0
  11. package/dist/src/channels/telegram/tool-tracker.d.ts +1 -2
  12. package/dist/src/channels/telegram/tool-tracker.js +11 -38
  13. package/dist/src/channels/telegram/tool-tracker.js.map +1 -1
  14. package/dist/src/cli/checks/bridge-wiring.d.ts +14 -0
  15. package/dist/src/cli/checks/bridge-wiring.js +64 -0
  16. package/dist/src/cli/checks/bridge-wiring.js.map +1 -0
  17. package/dist/src/cli/checks/config-schema.d.ts +11 -0
  18. package/dist/src/cli/checks/config-schema.js +51 -0
  19. package/dist/src/cli/checks/config-schema.js.map +1 -0
  20. package/dist/src/cli/checks/critical-openclaw-json-keys.d.ts +21 -0
  21. package/dist/src/cli/checks/critical-openclaw-json-keys.js +106 -0
  22. package/dist/src/cli/checks/critical-openclaw-json-keys.js.map +1 -0
  23. package/dist/src/cli/checks/install-path.d.ts +11 -0
  24. package/dist/src/cli/checks/install-path.js +89 -0
  25. package/dist/src/cli/checks/install-path.js.map +1 -0
  26. package/dist/src/cli/checks/patch-scaffold.d.ts +17 -0
  27. package/dist/src/cli/checks/patch-scaffold.js +56 -0
  28. package/dist/src/cli/checks/patch-scaffold.js.map +1 -0
  29. package/dist/src/cli/doctor.d.ts +5 -9
  30. package/dist/src/cli/doctor.js +28 -129
  31. package/dist/src/cli/doctor.js.map +1 -1
  32. package/dist/src/cli/index.js +2 -2
  33. package/dist/src/cli/index.js.map +1 -1
  34. package/dist/src/cli/migrate.d.ts +29 -0
  35. package/dist/src/cli/migrate.js +75 -0
  36. package/dist/src/cli/migrate.js.map +1 -0
  37. package/dist/src/config/drift-detector.d.ts +28 -0
  38. package/dist/src/config/drift-detector.js +75 -0
  39. package/dist/src/config/drift-detector.js.map +1 -0
  40. package/dist/src/config/loader.d.ts +8 -0
  41. package/dist/src/config/loader.js +69 -0
  42. package/dist/src/config/loader.js.map +1 -0
  43. package/dist/src/config/schema.d.ts +188 -0
  44. package/dist/src/config/schema.js +98 -0
  45. package/dist/src/config/schema.js.map +1 -0
  46. package/dist/src/council/build-agent-prompt.d.ts +11 -0
  47. package/dist/src/council/build-agent-prompt.js +96 -0
  48. package/dist/src/council/build-agent-prompt.js.map +1 -0
  49. package/dist/src/council/cleanup-worktrees.d.ts +10 -0
  50. package/dist/src/council/cleanup-worktrees.js +22 -0
  51. package/dist/src/council/cleanup-worktrees.js.map +1 -0
  52. package/dist/src/council/council.js +15 -186
  53. package/dist/src/council/council.js.map +1 -1
  54. package/dist/src/council/system-prompt.d.ts +16 -0
  55. package/dist/src/council/system-prompt.js +40 -0
  56. package/dist/src/council/system-prompt.js.map +1 -0
  57. package/dist/src/council/write-worktree-claude-md.d.ts +10 -0
  58. package/dist/src/council/write-worktree-claude-md.js +41 -0
  59. package/dist/src/council/write-worktree-claude-md.js.map +1 -0
  60. package/dist/src/engines/persistent-custom-session.js +3 -8
  61. package/dist/src/engines/persistent-custom-session.js.map +1 -1
  62. package/dist/src/engines/resolve-bin.d.ts +14 -0
  63. package/dist/src/engines/resolve-bin.js +18 -0
  64. package/dist/src/engines/resolve-bin.js.map +1 -0
  65. package/dist/src/lib/config-service.js +8 -0
  66. package/dist/src/lib/config-service.js.map +1 -1
  67. package/dist/src/lib/debounce.d.ts +12 -0
  68. package/dist/src/lib/debounce.js +23 -0
  69. package/dist/src/lib/debounce.js.map +1 -0
  70. package/dist/src/lib/domain-error.d.ts +59 -0
  71. package/dist/src/lib/domain-error.js +79 -0
  72. package/dist/src/lib/domain-error.js.map +1 -0
  73. package/dist/src/lib/json-array.d.ts +10 -0
  74. package/dist/src/lib/json-array.js +23 -0
  75. package/dist/src/lib/json-array.js.map +1 -0
  76. package/dist/src/lib/safe-upstream-probes.d.ts +25 -0
  77. package/dist/src/lib/safe-upstream-probes.js +42 -0
  78. package/dist/src/lib/safe-upstream-probes.js.map +1 -0
  79. package/dist/src/lib/spawn-async.d.ts +18 -0
  80. package/dist/src/lib/spawn-async.js +47 -0
  81. package/dist/src/lib/spawn-async.js.map +1 -0
  82. package/dist/src/lib/stale-pid-files.d.ts +17 -0
  83. package/dist/src/lib/stale-pid-files.js +40 -0
  84. package/dist/src/lib/stale-pid-files.js.map +1 -0
  85. package/dist/src/lifecycle/boot.d.ts +59 -0
  86. package/dist/src/lifecycle/boot.js +132 -0
  87. package/dist/src/lifecycle/boot.js.map +1 -0
  88. package/dist/src/lifecycle/patch-manifest.d.ts +82 -0
  89. package/dist/src/lifecycle/patch-manifest.js +126 -0
  90. package/dist/src/lifecycle/patch-manifest.js.map +1 -0
  91. package/dist/src/lifecycle/phase-import-upstream.d.ts +12 -0
  92. package/dist/src/lifecycle/phase-import-upstream.js +18 -0
  93. package/dist/src/lifecycle/phase-import-upstream.js.map +1 -0
  94. package/dist/src/lifecycle/phase-install-patches.d.ts +12 -0
  95. package/dist/src/lifecycle/phase-install-patches.js +31 -0
  96. package/dist/src/lifecycle/phase-install-patches.js.map +1 -0
  97. package/dist/src/lifecycle/phase-schedule-jobs.d.ts +12 -0
  98. package/dist/src/lifecycle/phase-schedule-jobs.js +15 -0
  99. package/dist/src/lifecycle/phase-schedule-jobs.js.map +1 -0
  100. package/dist/src/lifecycle/phase-start-server.d.ts +11 -0
  101. package/dist/src/lifecycle/phase-start-server.js +11 -0
  102. package/dist/src/lifecycle/phase-start-server.js.map +1 -0
  103. package/dist/src/lifecycle/phase-validate-config.d.ts +9 -0
  104. package/dist/src/lifecycle/phase-validate-config.js +25 -0
  105. package/dist/src/lifecycle/phase-validate-config.js.map +1 -0
  106. package/dist/src/lifecycle/phase-validate-upstream.d.ts +11 -0
  107. package/dist/src/lifecycle/phase-validate-upstream.js +16 -0
  108. package/dist/src/lifecycle/phase-validate-upstream.js.map +1 -0
  109. package/dist/src/lifecycle/phase-wire-handlers.d.ts +12 -0
  110. package/dist/src/lifecycle/phase-wire-handlers.js +16 -0
  111. package/dist/src/lifecycle/phase-wire-handlers.js.map +1 -0
  112. package/dist/src/observability/event-bus.d.ts +75 -0
  113. package/dist/src/observability/event-bus.js +63 -0
  114. package/dist/src/observability/event-bus.js.map +1 -0
  115. package/dist/src/observability/get-event-bus.d.ts +25 -0
  116. package/dist/src/observability/get-event-bus.js +34 -0
  117. package/dist/src/observability/get-event-bus.js.map +1 -0
  118. package/dist/src/observability/observability-service.d.ts +19 -0
  119. package/dist/src/observability/observability-service.js +24 -0
  120. package/dist/src/observability/observability-service.js.map +1 -0
  121. package/dist/src/observability/subscribers/metrics.d.ts +11 -0
  122. package/dist/src/observability/subscribers/metrics.js +21 -0
  123. package/dist/src/observability/subscribers/metrics.js.map +1 -0
  124. package/dist/src/observability/subscribers/session-capture.d.ts +15 -0
  125. package/dist/src/observability/subscribers/session-capture.js +25 -0
  126. package/dist/src/observability/subscribers/session-capture.js.map +1 -0
  127. package/dist/src/openai-compat/bridges/allowlist.d.ts +14 -5
  128. package/dist/src/openai-compat/bridges/allowlist.js +18 -7
  129. package/dist/src/openai-compat/bridges/allowlist.js.map +1 -1
  130. package/dist/src/openai-compat/bridges/openclaw-api-shim.d.ts +54 -0
  131. package/dist/src/openai-compat/bridges/openclaw-api-shim.js +45 -0
  132. package/dist/src/openai-compat/bridges/openclaw-api-shim.js.map +1 -0
  133. package/dist/src/openai-compat/openai-chunk-types.d.ts +35 -0
  134. package/dist/src/openai-compat/openai-chunk-types.js +9 -0
  135. package/dist/src/openai-compat/openai-chunk-types.js.map +1 -0
  136. package/dist/src/openai-compat/openai-compat.d.ts +2 -90
  137. package/dist/src/openai-compat/openai-compat.js +68 -68
  138. package/dist/src/openai-compat/openai-compat.js.map +1 -1
  139. package/dist/src/openai-compat/openai-types.d.ts +71 -0
  140. package/dist/src/openai-compat/openai-types.js +11 -0
  141. package/dist/src/openai-compat/openai-types.js.map +1 -0
  142. package/dist/src/openai-compat/parse-route-body.d.ts +24 -0
  143. package/dist/src/openai-compat/parse-route-body.js +45 -0
  144. package/dist/src/openai-compat/parse-route-body.js.map +1 -0
  145. package/dist/src/openai-compat/tts-rule.d.ts +20 -0
  146. package/dist/src/openai-compat/tts-rule.js +58 -0
  147. package/dist/src/openai-compat/tts-rule.js.map +1 -0
  148. package/dist/src/openai-compat/voice-recovery.js +0 -1
  149. package/dist/src/openai-compat/voice-recovery.js.map +1 -1
  150. package/dist/src/patches/cache-parity-registry.d.ts +20 -0
  151. package/dist/src/patches/cache-parity-registry.js +64 -0
  152. package/dist/src/patches/cache-parity-registry.js.map +1 -0
  153. package/dist/src/patches/claude-md-injection.d.ts +10 -0
  154. package/dist/src/patches/claude-md-injection.js +46 -0
  155. package/dist/src/patches/claude-md-injection.js.map +1 -0
  156. package/dist/src/patches/cwd-redirect.d.ts +10 -0
  157. package/dist/src/patches/cwd-redirect.js +51 -0
  158. package/dist/src/patches/cwd-redirect.js.map +1 -0
  159. package/dist/src/patches/embedded-server-route.d.ts +23 -0
  160. package/dist/src/patches/embedded-server-route.js +64 -0
  161. package/dist/src/patches/embedded-server-route.js.map +1 -0
  162. package/dist/src/patches/pricing-overrides.d.ts +10 -0
  163. package/dist/src/patches/pricing-overrides.js +55 -0
  164. package/dist/src/patches/pricing-overrides.js.map +1 -0
  165. package/dist/src/patches/resume-registry-restore.d.ts +11 -0
  166. package/dist/src/patches/resume-registry-restore.js +48 -0
  167. package/dist/src/patches/resume-registry-restore.js.map +1 -0
  168. package/dist/src/patches/session-pid-tracking.d.ts +10 -0
  169. package/dist/src/patches/session-pid-tracking.js +45 -0
  170. package/dist/src/patches/session-pid-tracking.js.map +1 -0
  171. package/dist/src/patches/sysprompt-strip.d.ts +46 -0
  172. package/dist/src/patches/sysprompt-strip.js +78 -0
  173. package/dist/src/patches/sysprompt-strip.js.map +1 -0
  174. package/dist/src/patches/sysprompt-strip.spec.d.ts +33 -0
  175. package/dist/src/patches/sysprompt-strip.spec.js +53 -0
  176. package/dist/src/patches/sysprompt-strip.spec.js.map +1 -0
  177. package/dist/src/patches/tools-restoration.d.ts +12 -0
  178. package/dist/src/patches/tools-restoration.js +43 -0
  179. package/dist/src/patches/tools-restoration.js.map +1 -0
  180. package/dist/src/persistence/migration-v0.d.ts +24 -0
  181. package/dist/src/persistence/migration-v0.js +142 -0
  182. package/dist/src/persistence/migration-v0.js.map +1 -0
  183. package/dist/src/persistence/session-registry.d.ts +57 -0
  184. package/dist/src/persistence/session-registry.js +58 -0
  185. package/dist/src/persistence/session-registry.js.map +1 -0
  186. package/dist/src/persistence/snapshot.d.ts +18 -0
  187. package/dist/src/persistence/snapshot.js +32 -0
  188. package/dist/src/persistence/snapshot.js.map +1 -0
  189. package/dist/src/persistence/wal.d.ts +17 -0
  190. package/dist/src/persistence/wal.js +32 -0
  191. package/dist/src/persistence/wal.js.map +1 -0
  192. package/dist/src/session/persisted-sessions.d.ts +26 -0
  193. package/dist/src/session/persisted-sessions.js +70 -0
  194. package/dist/src/session/persisted-sessions.js.map +1 -0
  195. package/dist/src/session/session-manager.d.ts +2 -11
  196. package/dist/src/session/session-manager.js +22 -66
  197. package/dist/src/session/session-manager.js.map +1 -1
  198. package/dist/src/session-bootstrap/boot-self-heal.d.ts +32 -0
  199. package/dist/src/session-bootstrap/boot-self-heal.js +54 -0
  200. package/dist/src/session-bootstrap/boot-self-heal.js.map +1 -0
  201. package/dist/src/session-bootstrap/cwd-patch.js +11 -87
  202. package/dist/src/session-bootstrap/cwd-patch.js.map +1 -1
  203. package/dist/src/session-bootstrap/resume-registry.d.ts +29 -0
  204. package/dist/src/session-bootstrap/resume-registry.js +58 -0
  205. package/dist/src/session-bootstrap/resume-registry.js.map +1 -0
  206. package/dist/src/session-bootstrap/session-hygiene.d.ts +23 -0
  207. package/dist/src/session-bootstrap/session-hygiene.js +41 -0
  208. package/dist/src/session-bootstrap/session-hygiene.js.map +1 -0
  209. package/dist/src/types/runtime-config.d.ts +11 -0
  210. package/dist/src/types/runtime-config.js +9 -0
  211. package/dist/src/types/runtime-config.js.map +1 -1
  212. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * PatchSpec: cache-parity-registry
3
+ *
4
+ * Second Phase E#3 PatchSpec, demonstrating that the pattern composes —
5
+ * multiple specs can register in one PatchManifest and validate
6
+ * independently. Drift-detection only at this stage; real install/uninstall
7
+ * extracted from `src/lib/cache-parity.ts` lands in Phase E#3 proper.
8
+ *
9
+ * Drift contract: verifies `src/lib/cache-parity.ts` exports its canonical
10
+ * registry path constant and at least one accessor function. If a future
11
+ * refactor accidentally removes the registry writer, this probe surfaces
12
+ * a DriftError at boot phase 3, preventing silent cache-parity regressions
13
+ * of the v0.6.0 namespace-bug class.
14
+ */
15
+ export const cacheParityRegistrySpec = {
16
+ id: 'cache-parity-registry',
17
+ targetModule: 'src/lib/cache-parity.ts',
18
+ targetSymbol: 'cacheParityRegistry path + writer',
19
+ async resolve() {
20
+ // Importing our own canonical module — proves the cache-parity surface
21
+ // stays present across refactors. Phase E#3 narrows this to a specific
22
+ // export check (registry-path constant + write/read helpers).
23
+ const mod = (await import('../lib/cache-parity.js'));
24
+ if (typeof mod !== 'object' || mod === null) {
25
+ throw new Error('cache-parity module did not export an object');
26
+ }
27
+ return { module: mod };
28
+ },
29
+ expectedShape(target) {
30
+ // Narrowed probe (Phase E#3 finding 2026-05-13): verify the 5
31
+ // load-bearing exports from `src/lib/cache-parity.ts`. If any future
32
+ // refactor accidentally removes one, this probe fails at boot phase 3
33
+ // and DriftError surfaces in the doctor report.
34
+ const mod = target.module;
35
+ return (typeof mod.REGISTRY_PATH === 'string' &&
36
+ typeof mod.isCacheParityEnabled === 'function' &&
37
+ typeof mod.hashPrompt === 'function' &&
38
+ typeof mod.recordAttachment === 'function' &&
39
+ typeof mod.readRegistry === 'function');
40
+ },
41
+ async expectedBehavior(target) {
42
+ // Phase E#3 narrowing (2026-05-13): exercise hashPrompt() to verify it
43
+ // returns a deterministic non-empty string for a known input. Catches
44
+ // regressions in the hash implementation that would silently invalidate
45
+ // the v0.6.0 namespace fix (cache keys must round-trip identically).
46
+ const mod = target.module;
47
+ if (typeof mod.hashPrompt !== 'function')
48
+ return false;
49
+ const hash = mod.hashPrompt('cc-openclaw-probe');
50
+ if (typeof hash !== 'string' || hash.length === 0)
51
+ return false;
52
+ // Determinism — same input must produce same output.
53
+ const hash2 = mod.hashPrompt('cc-openclaw-probe');
54
+ return hash === hash2;
55
+ },
56
+ install(_target) {
57
+ // Drift-detection-only mode: no install. Phase E#3 wires the
58
+ // appendSystemPrompt + disk-registry pair from cwd-patch.ts.
59
+ },
60
+ uninstall(_target) {
61
+ // Drift-detection-only mode: no uninstall.
62
+ },
63
+ };
64
+ //# sourceMappingURL=cache-parity-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-parity-registry.js","sourceRoot":"","sources":["../../../src/patches/cache-parity-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,EAAE,EAAE,uBAAuB;IAC3B,YAAY,EAAE,yBAAyB;IACvC,YAAY,EAAE,mCAAmC;IAEjD,KAAK,CAAC,OAAO;QACX,uEAAuE;QACvE,uEAAuE;QACvE,8DAA8D;QAC9D,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAY,CAAC;QAChE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,GAA8B,EAAE,CAAC;IACpD,CAAC;IAED,aAAa,CAAC,MAAyB;QACrC,8DAA8D;QAC9D,qEAAqE;QACrE,sEAAsE;QACtE,gDAAgD;QAChD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,OAAO,CACL,OAAO,GAAG,CAAC,aAAa,KAAK,QAAQ;YACrC,OAAO,GAAG,CAAC,oBAAoB,KAAK,UAAU;YAC9C,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;YACpC,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU;YAC1C,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU,CACvC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAyB;QAC9C,uEAAuE;QACvE,sEAAsE;QACtE,wEAAwE;QACxE,qEAAqE;QACrE,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;QAC1B,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QACvD,MAAM,IAAI,GAAI,GAAG,CAAC,UAAoC,CAAC,mBAAmB,CAAC,CAAC;QAC5E,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAChE,qDAAqD;QACrD,MAAM,KAAK,GAAI,GAAG,CAAC,UAAoC,CAAC,mBAAmB,CAAC,CAAC;QAC7E,OAAO,IAAI,KAAK,KAAK,CAAC;IACxB,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,6DAA6D;QAC7D,6DAA6D;IAC/D,CAAC;IAED,SAAS,CAAC,OAA0B;QAClC,2CAA2C;IAC7C,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * PatchSpec: claude-md-injection — Phase E#3 scaffold.
3
+ *
4
+ * Target: CLAUDE.md inline sysprompt prepend (cwd-patch.ts:~489 area).
5
+ * Pairs with sysprompt-strip but on the inject side. Drift-detection only today.
6
+ */
7
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
8
+ type ClaudeMdInjectionTarget = Record<string, unknown>;
9
+ export declare const claudeMdInjectionSpec: PatchSpec<ClaudeMdInjectionTarget>;
10
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * PatchSpec: claude-md-injection — Phase E#3 scaffold.
3
+ *
4
+ * Target: CLAUDE.md inline sysprompt prepend (cwd-patch.ts:~489 area).
5
+ * Pairs with sysprompt-strip but on the inject side. Drift-detection only today.
6
+ */
7
+ export const claudeMdInjectionSpec = {
8
+ id: 'claude-md-injection',
9
+ targetModule: 'openclaw',
10
+ targetSymbol: 'SessionManager.prototype.startSession (sysprompt inject)',
11
+ async resolve() {
12
+ const upstream = (await import('openclaw'));
13
+ if (typeof upstream !== 'object' || upstream === null) {
14
+ throw new Error('openclaw import did not return an object');
15
+ }
16
+ return upstream;
17
+ },
18
+ expectedShape(target) {
19
+ // CLAUDE.md injection happens at session-start time. Verify the same
20
+ // session-startup surface as sysprompt-strip — applyTemplate (template
21
+ // engine) and session-store accessors.
22
+ if (typeof target !== 'object' || target === null)
23
+ return false;
24
+ return (typeof target.applyTemplate === 'function' &&
25
+ typeof target.loadSessionStore === 'function' &&
26
+ typeof target.saveSessionStore === 'function');
27
+ },
28
+ async expectedBehavior(target) {
29
+ // Verify applyTemplate substitutes {{name}} tokens correctly and is
30
+ // deterministic. The CLAUDE.md injection patch relies on this template
31
+ // engine to render the inline sysprompt with session-specific values.
32
+ if (typeof target.applyTemplate !== 'function')
33
+ return false;
34
+ const fn = target.applyTemplate;
35
+ const r1 = fn('hello {{n}}', { n: 'world' });
36
+ const r2 = fn('hello {{n}}', { n: 'world' });
37
+ return r1 === 'hello world' && r2 === r1;
38
+ },
39
+ install(_target) {
40
+ // Phase E#3 — extract CLAUDE.md inline injection from cwd-patch.ts:~489.
41
+ },
42
+ uninstall(_target) {
43
+ // Phase E#3 — restore original startSession sysprompt lookup.
44
+ },
45
+ };
46
+ //# sourceMappingURL=claude-md-injection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-md-injection.js","sourceRoot":"","sources":["../../../src/patches/claude-md-injection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,qBAAqB,GAAuC;IACvE,EAAE,EAAE,qBAAqB;IACzB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,0DAA0D;IAExE,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAmC,CAAC;IAC7C,CAAC;IAED,aAAa,CAAC,MAA+B;QAC3C,qEAAqE;QACrE,uEAAuE;QACvE,uCAAuC;QACvC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,CACL,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU;YAC1C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,CAC9C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAA+B;QACpD,oEAAoE;QACpE,uEAAuE;QACvE,sEAAsE;QACtE,IAAI,OAAO,MAAM,CAAC,aAAa,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAC7D,MAAM,EAAE,GAAG,MAAM,CAAC,aAAuE,CAAC;QAC1F,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,MAAM,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,KAAK,aAAa,IAAI,EAAE,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED,OAAO,CAAC,OAAgC;QACtC,yEAAyE;IAC3E,CAAC;IAED,SAAS,CAAC,OAAgC;QACxC,8DAA8D;IAChE,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * PatchSpec: cwd-redirect — Phase E#3 scaffold.
3
+ *
4
+ * Target: workspace cwd injection in cwd-patch.ts:applyPatch step 1 (the
5
+ * `'openai-'` session prefix branded type gate). Drift-detection only today.
6
+ */
7
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
8
+ type CwdRedirectTarget = Record<string, unknown>;
9
+ export declare const cwdRedirectSpec: PatchSpec<CwdRedirectTarget>;
10
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * PatchSpec: cwd-redirect — Phase E#3 scaffold.
3
+ *
4
+ * Target: workspace cwd injection in cwd-patch.ts:applyPatch step 1 (the
5
+ * `'openai-'` session prefix branded type gate). Drift-detection only today.
6
+ */
7
+ export const cwdRedirectSpec = {
8
+ id: 'cwd-redirect',
9
+ targetModule: 'openclaw',
10
+ targetSymbol: "SessionManager.prototype.startSession ('openai-' prefix gate)",
11
+ async resolve() {
12
+ const upstream = (await import('openclaw'));
13
+ if (typeof upstream !== 'object' || upstream === null) {
14
+ throw new Error('openclaw import did not return an object');
15
+ }
16
+ return upstream;
17
+ },
18
+ expectedShape(target) {
19
+ // cwd-redirect patches the SessionManager.startSession 'openai-' prefix
20
+ // gate. Since SessionManager isn't a public openclaw export, verify
21
+ // the 4 public session-related functions exist as a proxy for upstream
22
+ // session subsystem integrity.
23
+ if (typeof target !== 'object' || target === null)
24
+ return false;
25
+ return (typeof target.deriveSessionKey === 'function' &&
26
+ typeof target.loadSessionStore === 'function' &&
27
+ typeof target.resolveSessionKey === 'function' &&
28
+ typeof target.saveSessionStore === 'function');
29
+ },
30
+ async expectedBehavior(target) {
31
+ // Verify deriveSessionKey returns a deterministic non-empty string for
32
+ // the same input. (Phase E#3 finding 2026-05-13: deriveSessionKey
33
+ // returns 'unknown' for unrecognized session names regardless of cwd,
34
+ // so the cwd-sensitivity invariant doesn't hold at the public API
35
+ // level. Real cwd-redirect logic must operate elsewhere — Phase E#3
36
+ // hot-path extraction will reveal where.)
37
+ if (typeof target.deriveSessionKey !== 'function')
38
+ return false;
39
+ const fn = target.deriveSessionKey;
40
+ const k1 = fn('probe', '/tmp/a');
41
+ const k2 = fn('probe', '/tmp/a');
42
+ return typeof k1 === 'string' && k1.length > 0 && k1 === k2;
43
+ },
44
+ install(_target) {
45
+ // Phase E#3 — extract cwd-redirect step from cwd-patch.ts:applyPatch.
46
+ },
47
+ uninstall(_target) {
48
+ // Phase E#3 — restore original SessionManager.startSession cwd lookup.
49
+ },
50
+ };
51
+ //# sourceMappingURL=cwd-redirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cwd-redirect.js","sourceRoot":"","sources":["../../../src/patches/cwd-redirect.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,EAAE,EAAE,cAAc;IAClB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,+DAA+D;IAE7E,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAA6B,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,MAAyB;QACrC,wEAAwE;QACxE,oEAAoE;QACpE,uEAAuE;QACvE,+BAA+B;QAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,CACL,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU;YAC9C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,CAC9C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAyB;QAC9C,uEAAuE;QACvE,kEAAkE;QAClE,sEAAsE;QACtE,kEAAkE;QAClE,oEAAoE;QACpE,0CAA0C;QAC1C,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAyD,CAAC;QAC5E,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjC,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACjC,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,OAA0B;QAChC,sEAAsE;IACxE,CAAC;IAED,SAAS,CAAC,OAA0B;QAClC,uEAAuE;IACzE,CAAC;CACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * PatchSpec: embedded-server-route
3
+ *
4
+ * Third Phase E#3 PatchSpec. Targets the 9-step route-patch closure
5
+ * currently in `src/session-bootstrap/cwd-patch.ts:applyPatch` (~line 481).
6
+ * That closure intercepts `EmbeddedServer.route` to inject:
7
+ * - cwd redirect (workspace injection)
8
+ * - tools restoration (drop the defensive `tools=''` block)
9
+ * - CLAUDE.md inline sysprompt prepend
10
+ * - cache-parity registry write
11
+ * - token telemetry hook
12
+ * - ... 4 more steps
13
+ *
14
+ * Phase E#3 full conversion: each of the 9 steps becomes its own sub-spec
15
+ * (or this single spec internally composes them with named labels for
16
+ * mutation-test granularity).
17
+ *
18
+ * Today: drift-detection only against the openclaw EmbeddedServer surface.
19
+ */
20
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
21
+ type EmbeddedServerRouteTarget = Record<string, unknown>;
22
+ export declare const embeddedServerRouteSpec: PatchSpec<EmbeddedServerRouteTarget>;
23
+ export {};
@@ -0,0 +1,64 @@
1
+ /**
2
+ * PatchSpec: embedded-server-route
3
+ *
4
+ * Third Phase E#3 PatchSpec. Targets the 9-step route-patch closure
5
+ * currently in `src/session-bootstrap/cwd-patch.ts:applyPatch` (~line 481).
6
+ * That closure intercepts `EmbeddedServer.route` to inject:
7
+ * - cwd redirect (workspace injection)
8
+ * - tools restoration (drop the defensive `tools=''` block)
9
+ * - CLAUDE.md inline sysprompt prepend
10
+ * - cache-parity registry write
11
+ * - token telemetry hook
12
+ * - ... 4 more steps
13
+ *
14
+ * Phase E#3 full conversion: each of the 9 steps becomes its own sub-spec
15
+ * (or this single spec internally composes them with named labels for
16
+ * mutation-test granularity).
17
+ *
18
+ * Today: drift-detection only against the openclaw EmbeddedServer surface.
19
+ */
20
+ export const embeddedServerRouteSpec = {
21
+ id: 'embedded-server-route',
22
+ targetModule: 'openclaw',
23
+ targetSymbol: 'EmbeddedServer.prototype.route',
24
+ async resolve() {
25
+ const upstream = (await import('openclaw'));
26
+ if (typeof upstream !== 'object' || upstream === null) {
27
+ throw new Error('openclaw import did not return an object');
28
+ }
29
+ return upstream;
30
+ },
31
+ expectedShape(target) {
32
+ // Narrowed probe (Phase E#3 finding 2026-05-13): openclaw's public API
33
+ // has 21 named exports; `EmbeddedServer` class is not among them.
34
+ // Phase E#3 must either reach into dist/ chunks (preserving legacy
35
+ // cwd-patch behavior) or refactor to operate on the public surface.
36
+ //
37
+ // For drift-gate purposes, verify the 3 load-bearing server-startup
38
+ // exports. Their loss signals catastrophic upstream regression of the
39
+ // surface cc-openclaw needs to function at all.
40
+ if (typeof target !== 'object' || target === null)
41
+ return false;
42
+ const required = ['loadConfig', 'runLegacyCliEntry', 'ensurePortAvailable'];
43
+ return required.every((k) => typeof target[k] === 'function');
44
+ },
45
+ async expectedBehavior(_target) {
46
+ // Phase E#3 finding 4 workaround (2026-05-13): bypass loadConfig schema
47
+ // validation via raw JSON.parse. The 9-step route patch's behavior
48
+ // depends on openclaw.json being readable — probe it via the safe
49
+ // helper instead of invoking loadConfig (which schema-rejects).
50
+ const { probeOpenclawJsonReachable } = await import('../lib/safe-upstream-probes.js');
51
+ return probeOpenclawJsonReachable();
52
+ },
53
+ install(_target) {
54
+ // Drift-detection-only mode. Phase E#3 extracts the 9-step closure
55
+ // from src/session-bootstrap/cwd-patch.ts:applyPatch and ports it
56
+ // here (file budget: <200 LOC per INITIAL.md §NF2 — may require
57
+ // splitting some steps into helper modules).
58
+ },
59
+ uninstall(_target) {
60
+ // Drift-detection-only mode. Phase E#3 restores the original
61
+ // EmbeddedServer.prototype.route reference saved at install time.
62
+ },
63
+ };
64
+ //# sourceMappingURL=embedded-server-route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded-server-route.js","sourceRoot":"","sources":["../../../src/patches/embedded-server-route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,MAAM,CAAC,MAAM,uBAAuB,GAAyC;IAC3E,EAAE,EAAE,uBAAuB;IAC3B,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,gCAAgC;IAE9C,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAqC,CAAC;IAC/C,CAAC;IAED,aAAa,CAAC,MAAiC;QAC7C,uEAAuE;QACvE,kEAAkE;QAClE,mEAAmE;QACnE,oEAAoE;QACpE,EAAE;QACF,oEAAoE;QACpE,sEAAsE;QACtE,gDAAgD;QAChD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,CAAC,CAAC;QAC5E,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAkC;QACvD,wEAAwE;QACxE,mEAAmE;QACnE,kEAAkE;QAClE,gEAAgE;QAChE,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,MAAM,CAAC,gCAAgC,CAAC,CAAC;QACtF,OAAO,0BAA0B,EAAE,CAAC;IACtC,CAAC;IAED,OAAO,CAAC,OAAkC;QACxC,mEAAmE;QACnE,kEAAkE;QAClE,gEAAgE;QAChE,6CAA6C;IAC/C,CAAC;IAED,SAAS,CAAC,OAAkC;QAC1C,6DAA6D;QAC7D,kEAAkE;IACpE,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * PatchSpec: pricing-overrides — Phase E#3 scaffold.
3
+ *
4
+ * Target: the pricing-override import currently at
5
+ * `src/session-bootstrap/cwd-patch.ts:1094`. Drift-detection only today.
6
+ */
7
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
8
+ type PricingTarget = Record<string, unknown>;
9
+ export declare const pricingOverridesSpec: PatchSpec<PricingTarget>;
10
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * PatchSpec: pricing-overrides — Phase E#3 scaffold.
3
+ *
4
+ * Target: the pricing-override import currently at
5
+ * `src/session-bootstrap/cwd-patch.ts:1094`. Drift-detection only today.
6
+ */
7
+ export const pricingOverridesSpec = {
8
+ id: 'pricing-overrides',
9
+ targetModule: 'openclaw',
10
+ targetSymbol: 'pricing override registry',
11
+ async resolve() {
12
+ const upstream = (await import('openclaw'));
13
+ if (typeof upstream !== 'object' || upstream === null) {
14
+ throw new Error('openclaw import did not return an object');
15
+ }
16
+ return upstream;
17
+ },
18
+ expectedShape(target) {
19
+ // Pricing override patches reach into upstream dep injection. Verify
20
+ // the public DI entry points exist as functions.
21
+ if (typeof target !== 'object' || target === null)
22
+ return false;
23
+ return (typeof target.createDefaultDeps === 'function' &&
24
+ typeof target.loadConfig === 'function');
25
+ },
26
+ async expectedBehavior(target) {
27
+ // Phase E#3 finding 2026-05-13: openclaw's `loadConfig()` REJECTS the
28
+ // cc-openclaw-specific keys (timeoutSeconds, agentRuntime,
29
+ // maxActiveTranscriptBytes) that `check_critical_openclaw_json_keys`
30
+ // REQUIRES. So `loadConfig` cannot be invoked as a probe — it would
31
+ // throw on every user with a real cc-openclaw-tuned openclaw.json.
32
+ // Phase E#3 install bodies must read openclaw.json directly via raw
33
+ // JSON.parse to bypass openclaw's schema validation.
34
+ //
35
+ // Phase E#3 finding 2026-05-13: `createDefaultDeps()` returns `{}` —
36
+ // an empty object. It's safe to invoke but provides no pricing-related
37
+ // shape to probe. The actual pricing override mechanism in legacy
38
+ // cwd-patch.ts must hook into the openclaw DI container at a chunk-
39
+ // internal level not reachable via this public function.
40
+ //
41
+ // Probe: verify createDefaultDeps returns an object (sanity check that
42
+ // the function still exists + behaves as a callable returning a value).
43
+ if (typeof target.createDefaultDeps !== 'function')
44
+ return false;
45
+ const deps = target.createDefaultDeps();
46
+ return typeof deps === 'object' && deps !== null;
47
+ },
48
+ install(_target) {
49
+ // Phase E#3 — extract pricing override block from cwd-patch.ts:~1094.
50
+ },
51
+ uninstall(_target) {
52
+ // Phase E#3 — restore original pricing surface.
53
+ },
54
+ };
55
+ //# sourceMappingURL=pricing-overrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing-overrides.js","sourceRoot":"","sources":["../../../src/patches/pricing-overrides.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,oBAAoB,GAA6B;IAC5D,EAAE,EAAE,mBAAmB;IACvB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,2BAA2B;IAEzC,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAyB,CAAC;IACnC,CAAC;IAED,aAAa,CAAC,MAAqB;QACjC,qEAAqE;QACrE,iDAAiD;QACjD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,CACL,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU;YAC9C,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,CACxC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAqB;QAC1C,sEAAsE;QACtE,2DAA2D;QAC3D,qEAAqE;QACrE,oEAAoE;QACpE,mEAAmE;QACnE,oEAAoE;QACpE,qDAAqD;QACrD,EAAE;QACF,qEAAqE;QACrE,uEAAuE;QACvE,kEAAkE;QAClE,oEAAoE;QACpE,yDAAyD;QACzD,EAAE;QACF,uEAAuE;QACvE,wEAAwE;QACxE,IAAI,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QACjE,MAAM,IAAI,GAAI,MAAM,CAAC,iBAAmC,EAAE,CAAC;QAC3D,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,OAAsB;QAC5B,sEAAsE;IACxE,CAAC;IAED,SAAS,CAAC,OAAsB;QAC9B,gDAAgD;IAClD,CAAC;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * PatchSpec: resume-registry-restore — Phase E#3 scaffold.
3
+ *
4
+ * Target: Savvy resume-registry restoration logic in cwd-patch.ts. Reads
5
+ * `~/.openclaw/savvy-resume-registry.json` and seeds SessionManager state.
6
+ * Drift-detection only today.
7
+ */
8
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
9
+ type ResumeRegistryTarget = Record<string, unknown>;
10
+ export declare const resumeRegistryRestoreSpec: PatchSpec<ResumeRegistryTarget>;
11
+ export {};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * PatchSpec: resume-registry-restore — Phase E#3 scaffold.
3
+ *
4
+ * Target: Savvy resume-registry restoration logic in cwd-patch.ts. Reads
5
+ * `~/.openclaw/savvy-resume-registry.json` and seeds SessionManager state.
6
+ * Drift-detection only today.
7
+ */
8
+ export const resumeRegistryRestoreSpec = {
9
+ id: 'resume-registry-restore',
10
+ targetModule: 'openclaw',
11
+ targetSymbol: 'SessionManager state seed from savvy-resume-registry.json',
12
+ async resolve() {
13
+ const upstream = (await import('openclaw'));
14
+ if (typeof upstream !== 'object' || upstream === null) {
15
+ throw new Error('openclaw import did not return an object');
16
+ }
17
+ return upstream;
18
+ },
19
+ expectedShape(target) {
20
+ // Resume-registry restore seeds SessionManager state from disk.
21
+ // Verify the public session-store load/resolve surface — the resume
22
+ // path round-trips through these.
23
+ if (typeof target !== 'object' || target === null)
24
+ return false;
25
+ return (typeof target.loadSessionStore === 'function' &&
26
+ typeof target.resolveSessionKey === 'function' &&
27
+ typeof target.resolveStorePath === 'function');
28
+ },
29
+ async expectedBehavior(target) {
30
+ // Verify resolveStorePath returns a non-empty path string (pure function).
31
+ // resolveSessionKey is NOT probed here because it depends on internal
32
+ // state (throws when invoked without proper context) — Phase E#3 finding
33
+ // 2026-05-13. Per-spec install/uninstall extraction may need to mock or
34
+ // pre-populate that state.
35
+ if (typeof target.resolveStorePath !== 'function')
36
+ return false;
37
+ const fn = target.resolveStorePath;
38
+ const p = fn();
39
+ return typeof p === 'string' && p.length > 0;
40
+ },
41
+ install(_target) {
42
+ // Phase E#3 — extract resume-registry restore block from cwd-patch.ts.
43
+ },
44
+ uninstall(_target) {
45
+ // Phase E#3 — restore original SessionManager state lifecycle.
46
+ },
47
+ };
48
+ //# sourceMappingURL=resume-registry-restore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume-registry-restore.js","sourceRoot":"","sources":["../../../src/patches/resume-registry-restore.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,CAAC,MAAM,yBAAyB,GAAoC;IACxE,EAAE,EAAE,yBAAyB;IAC7B,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,2DAA2D;IAEzE,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAgC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAC,MAA4B;QACxC,gEAAgE;QAChE,oEAAoE;QACpE,kCAAkC;QAClC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,CACL,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU;YAC9C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,CAC9C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAA4B;QACjD,2EAA2E;QAC3E,sEAAsE;QACtE,yEAAyE;QACzE,wEAAwE;QACxE,2BAA2B;QAC3B,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,EAAE,GAAG,MAAM,CAAC,gBAA+C,CAAC;QAClE,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,uEAAuE;IACzE,CAAC;IAED,SAAS,CAAC,OAA6B;QACrC,+DAA+D;IACjE,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * PatchSpec: session-pid-tracking — Phase E#3 scaffold.
3
+ *
4
+ * Target: PID map maintenance for `~/.openclaw/workspace/memory/session-pids.json`.
5
+ * Currently in cwd-patch.ts + session-manager.ts. Drift-detection only today.
6
+ */
7
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
8
+ type SessionPidTarget = Record<string, unknown>;
9
+ export declare const sessionPidTrackingSpec: PatchSpec<SessionPidTarget>;
10
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * PatchSpec: session-pid-tracking — Phase E#3 scaffold.
3
+ *
4
+ * Target: PID map maintenance for `~/.openclaw/workspace/memory/session-pids.json`.
5
+ * Currently in cwd-patch.ts + session-manager.ts. Drift-detection only today.
6
+ */
7
+ export const sessionPidTrackingSpec = {
8
+ id: 'session-pid-tracking',
9
+ targetModule: 'openclaw',
10
+ targetSymbol: 'SessionManager PID map maintenance',
11
+ async resolve() {
12
+ const upstream = (await import('openclaw'));
13
+ if (typeof upstream !== 'object' || upstream === null) {
14
+ throw new Error('openclaw import did not return an object');
15
+ }
16
+ return upstream;
17
+ },
18
+ expectedShape(target) {
19
+ // PID tracking maintains the session map. Verify session-store load/save
20
+ // exports — the PID map is keyed off session names from these stores.
21
+ if (typeof target !== 'object' || target === null)
22
+ return false;
23
+ return (typeof target.loadSessionStore === 'function' &&
24
+ typeof target.saveSessionStore === 'function' &&
25
+ typeof target.resolveStorePath === 'function');
26
+ },
27
+ async expectedBehavior(target) {
28
+ // Verify resolveStorePath returns a non-empty string path (pure function;
29
+ // no I/O). Catches regressions where the session-store path resolution
30
+ // returns empty or non-string output — breaks PID map maintenance.
31
+ if (typeof target.resolveStorePath !== 'function')
32
+ return false;
33
+ const fn = target.resolveStorePath;
34
+ const p = fn();
35
+ return typeof p === 'string' && p.length > 0;
36
+ },
37
+ install(_target) {
38
+ // Phase E#3 — extract PID-tracking block; migrates to SessionRegistry
39
+ // (E#7 dependency).
40
+ },
41
+ uninstall(_target) {
42
+ // Phase E#3 — restore original PID lifecycle.
43
+ },
44
+ };
45
+ //# sourceMappingURL=session-pid-tracking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-pid-tracking.js","sourceRoot":"","sources":["../../../src/patches/session-pid-tracking.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,MAAM,sBAAsB,GAAgC;IACjE,EAAE,EAAE,sBAAsB;IAC1B,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,oCAAoC;IAElD,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAA4B,CAAC;IACtC,CAAC;IAED,aAAa,CAAC,MAAwB;QACpC,yEAAyE;QACzE,sEAAsE;QACtE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,OAAO,CACL,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAC7C,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,CAC9C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAAwB;QAC7C,0EAA0E;QAC1E,uEAAuE;QACvE,mEAAmE;QACnE,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAkD,CAAC;QACrE,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,OAAyB;QAC/B,sEAAsE;QACtE,oBAAoB;IACtB,CAAC;IAED,SAAS,CAAC,OAAyB;QACjC,8CAA8C;IAChD,CAAC;CACF,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * PatchSpec: sysprompt-strip
3
+ *
4
+ * Establishes the file convention for Phase E#3. NOT REGISTERED with any
5
+ * PatchManifest yet — this is the documented template that real PatchSpec
6
+ * files mirror as the cwd-patch.ts decomposition proceeds.
7
+ *
8
+ * Pattern for Phase E#3:
9
+ * 1. One file per logical patch under `src/patches/<id>.spec.ts`.
10
+ * 2. File <200 LOC (INITIAL.md §NF2).
11
+ * 3. Exports a single `PatchSpec` instance as a named export.
12
+ * 4. `resolve()` owns its upstream symbol lookup — no global target arg.
13
+ * 5. `expectedShape` is sync, returns boolean; checks signature/props.
14
+ * 6. `expectedBehavior` is async; runs a tiny invocation; <100ms.
15
+ * 7. `install` + `uninstall` are paired and round-trip-safe.
16
+ * 8. A companion `tests/patches/<id>.test.ts` proves shape + mutation necessity.
17
+ *
18
+ * Functional source for sysprompt-strip lives at `src/lib/sysprompt-strip.ts`
19
+ * (pure function, reused as-is per INITIAL.md §Reuse). The wrapper that
20
+ * registers it as a Claude Code prototype patch lives at
21
+ * `src/session-bootstrap/sysprompt-strip.ts`. Phase E#3 converts that wrapper
22
+ * into the structured PatchSpec form below.
23
+ */
24
+ import type { PatchSpec } from '../lifecycle/patch-manifest.js';
25
+ /**
26
+ * PatchSpec: sysprompt-strip — first real Phase E#3 PatchSpec.
27
+ *
28
+ * Today this spec is **drift-detection only**: `resolve()` does a real
29
+ * `await import('openclaw')` to verify the upstream package loads and
30
+ * surfaces some exports. `install()` and `uninstall()` remain no-ops until
31
+ * the cwd-patch.ts closure is fully extracted (multi-session work).
32
+ *
33
+ * Even in drift-detection-only mode this is meaningful: a future openclaw
34
+ * publish that catastrophically loses its public API will cause `resolve()`
35
+ * to throw → DriftError surfaces in `cc-openclaw doctor` output → boot
36
+ * refuses install of any patches.
37
+ *
38
+ * Phase E#3 full conversion: replace the no-op install/uninstall with the
39
+ * prototype-patch closure from `src/session-bootstrap/sysprompt-strip.ts`,
40
+ * narrow `expectedShape` to verify `SessionManager.prototype.startSession`
41
+ * specifically, and populate `expectedBehavior` with a sysprompt round-trip
42
+ * fixture.
43
+ */
44
+ type SyspromptStripTarget = Record<string, unknown>;
45
+ export declare const syspromptStripSpec: PatchSpec<SyspromptStripTarget>;
46
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * PatchSpec: sysprompt-strip
3
+ *
4
+ * Establishes the file convention for Phase E#3. NOT REGISTERED with any
5
+ * PatchManifest yet — this is the documented template that real PatchSpec
6
+ * files mirror as the cwd-patch.ts decomposition proceeds.
7
+ *
8
+ * Pattern for Phase E#3:
9
+ * 1. One file per logical patch under `src/patches/<id>.spec.ts`.
10
+ * 2. File <200 LOC (INITIAL.md §NF2).
11
+ * 3. Exports a single `PatchSpec` instance as a named export.
12
+ * 4. `resolve()` owns its upstream symbol lookup — no global target arg.
13
+ * 5. `expectedShape` is sync, returns boolean; checks signature/props.
14
+ * 6. `expectedBehavior` is async; runs a tiny invocation; <100ms.
15
+ * 7. `install` + `uninstall` are paired and round-trip-safe.
16
+ * 8. A companion `tests/patches/<id>.test.ts` proves shape + mutation necessity.
17
+ *
18
+ * Functional source for sysprompt-strip lives at `src/lib/sysprompt-strip.ts`
19
+ * (pure function, reused as-is per INITIAL.md §Reuse). The wrapper that
20
+ * registers it as a Claude Code prototype patch lives at
21
+ * `src/session-bootstrap/sysprompt-strip.ts`. Phase E#3 converts that wrapper
22
+ * into the structured PatchSpec form below.
23
+ */
24
+ export const syspromptStripSpec = {
25
+ id: 'sysprompt-strip',
26
+ targetModule: 'openclaw',
27
+ targetSymbol: 'SessionManager.prototype.startSession',
28
+ async resolve() {
29
+ // Real upstream import — async to handle openclaw's top-level await.
30
+ const upstream = (await import('openclaw'));
31
+ if (typeof upstream !== 'object' || upstream === null) {
32
+ throw new Error('openclaw import did not return an object');
33
+ }
34
+ return upstream;
35
+ },
36
+ expectedShape(target) {
37
+ // Narrowed probe (Phase E#3 finding 2026-05-13): openclaw exports only
38
+ // 21 named public functions; `SessionManager` class is NOT exported
39
+ // directly — it lives in an esbuild chunk reachable only via internal
40
+ // requires. The legacy cwd-patch.ts:applyPatch closure presumably
41
+ // navigates into dist/ chunks directly.
42
+ //
43
+ // For this proof-of-concept probe, verify the 4 session-related public
44
+ // exports are present. They are the canonical openclaw session entry
45
+ // points; their loss would signal catastrophic upstream API regression.
46
+ if (typeof target !== 'object' || target === null)
47
+ return false;
48
+ const required = [
49
+ 'deriveSessionKey',
50
+ 'loadSessionStore',
51
+ 'resolveSessionKey',
52
+ 'saveSessionStore',
53
+ ];
54
+ return required.every((k) => typeof target[k] === 'function');
55
+ },
56
+ async expectedBehavior(target) {
57
+ // Phase E#3 narrowing (2026-05-13): exercise the public session-key
58
+ // derivation function with a known input and verify determinism. This
59
+ // catches a future regression where `deriveSessionKey` returns
60
+ // nondeterministic output — silently breaking session lookup. No I/O.
61
+ if (typeof target.deriveSessionKey !== 'function')
62
+ return false;
63
+ const fn = target.deriveSessionKey;
64
+ const a = fn('cc-openclaw-probe', '/tmp/probe');
65
+ if (typeof a !== 'string' || a.length === 0)
66
+ return false;
67
+ const b = fn('cc-openclaw-probe', '/tmp/probe');
68
+ return a === b;
69
+ },
70
+ install(_target) {
71
+ // Drift-detection-only mode: no-op install until Phase E#3 extracts the
72
+ // legacy closure from `src/session-bootstrap/sysprompt-strip.ts`.
73
+ },
74
+ uninstall(_target) {
75
+ // Drift-detection-only mode: no-op uninstall until Phase E#3 wires install.
76
+ },
77
+ };
78
+ //# sourceMappingURL=sysprompt-strip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sysprompt-strip.js","sourceRoot":"","sources":["../../../src/patches/sysprompt-strip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA0BH,MAAM,CAAC,MAAM,kBAAkB,GAAoC;IACjE,EAAE,EAAE,iBAAiB;IACrB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,uCAAuC;IAErD,KAAK,CAAC,OAAO;QACX,qEAAqE;QACrE,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAY,CAAC;QACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,QAAgC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAC,MAA4B;QACxC,uEAAuE;QACvE,oEAAoE;QACpE,sEAAsE;QACtE,kEAAkE;QAClE,wCAAwC;QACxC,EAAE;QACF,uEAAuE;QACvE,qEAAqE;QACrE,wEAAwE;QACxE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,QAAQ,GAAG;YACf,kBAAkB;YAClB,kBAAkB;YAClB,mBAAmB;YACnB,kBAAkB;SACnB,CAAC;QACF,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,MAA4B;QACjD,oEAAoE;QACpE,sEAAsE;QACtE,+DAA+D;QAC/D,sEAAsE;QACtE,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAChE,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAyD,CAAC;QAC5E,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;QAChD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAC1D,MAAM,CAAC,GAAG,EAAE,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,OAA6B;QACnC,wEAAwE;QACxE,kEAAkE;IACpE,CAAC;IAED,SAAS,CAAC,OAA6B;QACrC,4EAA4E;IAC9E,CAAC;CACF,CAAC"}