@linzumi/cli 1.0.274 → 1.0.276

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 (41) hide show
  1. package/README.md +10 -9
  2. package/dist/{impl-ts/cloud-supervisor.mjs → cloud-supervisor.mjs} +85 -85
  3. package/dist/hosted-coding-account-worker.js +25 -0
  4. package/dist/index.js +1609 -3
  5. package/dist/mcp-server.mjs +174 -168
  6. package/dist/{impl-res/native → native}/darwin/manifest.json +5 -2
  7. package/dist/remote-codex-harness-worker.js +757 -0
  8. package/dist/tcp-tunnel-cli.mjs +25 -69
  9. package/dist/topics-cli.mjs +137 -13
  10. package/package.json +9 -16
  11. package/scripts/build.mjs +33 -356
  12. package/scripts/bump-cli-version.mjs +35 -9
  13. package/scripts/check-package-size-budget.mjs +13 -61
  14. package/dist/impl-res/cloud-supervisor.mjs +0 -281
  15. package/dist/impl-res/index.js +0 -1546
  16. package/dist/impl-res/mcp-server.mjs +0 -461
  17. package/dist/impl-ts/assets/linzumi-logo.svg +0 -1
  18. package/dist/impl-ts/crossHarnessFailover.mjs +0 -14
  19. package/dist/impl-ts/index.js +0 -2617
  20. package/dist/impl-ts/mcp-server.mjs +0 -455
  21. package/dist/impl-ts/native/darwin/manifest.json +0 -21
  22. package/dist/impl-ts/native/darwin/preview-process-identity +0 -0
  23. package/dist/impl-ts/tcp-tunnel-cli.mjs +0 -93
  24. package/scripts/build-differential-entry-impl-res.mjs +0 -64
  25. package/scripts/build-differential-entry.mjs +0 -180
  26. package/scripts/build-onboarding-demo-evidence.mjs +0 -186
  27. package/scripts/build-tui-demo-evidence.mjs +0 -107
  28. package/scripts/diagnose-claude-probe.ts +0 -198
  29. package/scripts/differentialMutations.mjs +0 -114
  30. package/scripts/f5_live_cross_harness_failover_e2e.mjs +0 -239
  31. package/scripts/golden-chaos-harness.mjs +0 -1420
  32. package/scripts/normalize-agent-replay-fixture.ts +0 -281
  33. package/scripts/promote-gstack-claude-smoke-fixture.ts +0 -891
  34. package/scripts/record-agent-replay-fixtures.ts +0 -610
  35. package/scripts/replay-agent-backend-browser.ts +0 -198
  36. package/scripts/replay-agent-backend.ts +0 -1961
  37. package/scripts/replay-agent-fixture.ts +0 -326
  38. package/scripts/typecheck.mjs +0 -42
  39. /package/dist/{impl-res/assets → assets}/linzumi-logo.svg +0 -0
  40. /package/dist/{impl-res/crossHarnessFailover.mjs → crossHarnessFailover.mjs} +0 -0
  41. /package/dist/{impl-res/native → native}/darwin/preview-process-identity +0 -0
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="4096" height="4096" aria-label="Linzumi" color="#0e404b"><path fill="currentColor" fill-rule="evenodd" d="M2111 3966c-37 2-34 3-69 2l-141-7c-34-2-36-1-65-5l-107-15c-30-5-43-7-76-15a3031 3031 0 0 1-217-61l-84-31c-26-10-33-11-70-29a2233 2233 0 0 1-423-259 1796 1796 0 0 1-381-416 1962 1962 0 0 1-168-298c-25-57-54-131-74-191-19-59-35-127-45-168-11-40-11-45-16-76-5-30-11-58-16-107-6-48-13-132-16-183q-2-77 1-122c0-31 1-30 3-61 3-31 8-89 13-126 4-37 4-47 14-95a1863 1863 0 0 1 475-956q51-56 92-94c27-26 36-36 71-65s99-79 137-107 62-43 90-61a1539 1539 0 0 1 156-88c31-15 58-31 104-49a1697 1697 0 0 1 492-133c61-9 144-19 202-22s111 1 145 2c34 2 30 6 57 9s70 5 103 9 56 7 96 15q59 10 141 30c54 15 143 44 187 59s47 18 77 31 59 25 102 48 108 59 157 89a2162 2162 0 0 1 210 153c27 23 50 42 88 80s99 101 141 148c41 48 74 91 106 138 33 46 67 104 90 141a1170 1170 0 0 1 92 180c17 40 44 107 59 149 16 41 22 63 32 99a3000 3000 0 0 1 47 195c5 28 9 46 14 95s13 137 16 198c2 62-1 123-4 172-2 50-7 88-11 126l-16 103a3048 3048 0 0 1-62 248c-10 31-17 49-29 80-12 32-22 60-44 108-23 48-64 130-92 180s-57 90-77 121l-45 62a3211 3211 0 0 1-153 182q-32 35-76 76a2201 2201 0 0 1-349 260c-50 28-132 69-180 91-48 23-76 32-108 44-33 12-42 17-84 30-42 12-109 33-168 46-60 12-130 24-187 31-58 6-119 8-157 10m9-294c18-3 10-6 14-12 4-5 4-11 9-19 6-7 16-19 25-27 10-8 14-12 31-18 16-6 50-14 69-17 18-3 33-1 42-2 8-1 6-3 7-4 1-2 10 3 0-4-11-7-46-26-65-40s-37-32-50-44c-13-13-18-17-29-31-12-14-29-41-39-53s-11-17-19-19q-11-3-31 4c-14 3-40 9-53 14s-15 6-23 15c-8 8-20 28-27 35-6 7-5 5-11 7s-18 5-27 4q-15-2-27-9c-6-6-11-18-14-24-3-7-4-9-4-16l3-26q2-17 12-39c7-13 14-26 31-42 16-15 56-41 68-51s5-5 5-10c1-4 4-6-1-17a341 341 0 0 0-80-101c-18-14-41-24-58-32-16-9-15-9-43-18-28-8-98-27-125-36-27-8-21-7-38-15l-61-32c-13-7-10-4-20-12l-41-34a114 114 0 0 1-34-54q-5-17 0-30c3-10 0-9 15-27 16-18 54-59 76-80 23-21 37-30 58-45a1278 1278 0 0 1 126-78c18-9 40-15 53-20q18-9 23-14c4-3 5 4 3-7-3-11-14-37-17-57-3-21-3-46 0-65q4-27 15-50 13-25 29-46 15-19 35-30c13-8 32-15 46-18q18-5 34-3l34 2q15 2 27 7c8 4 19 11 23 15 3 5 5 1-2 12-8 11-31 34-43 53q-18 30-30 65c-7 24-14 65-15 80-2 16 2 9 5 12l12 8q5 2 8-3c3-2 10-4 13-13 4-8 2-19 8-38 6-18 18-54 29-73 10-19 21-28 34-41q20-21 42-35c14-9 24-13 42-17 18-3 46-5 65-5 18 0 29 1 46 7 16 6 39 20 53 30q20 17 32 35c9 12 14 22 19 38s10 38 10 57c0 20-4 45-9 61q-7 25-18 40c-5 10-7 12-16 21-9 10-24 24-37 34-13 9-33 17-41 24-7 6-5 12-4 15q-2 4 7 3c7 1 13 3 34-1 21-3 62-16 91-21a632 632 0 0 1 271 0c24 4 31 8 47 13l45 17c18 8 41 18 61 31a541 541 0 0 1 153 152q18 27 28 50a878 878 0 0 1 35 103c5 21 9 33 12 61s3 88 4 107c2 19 3 8 5 9 2 2-6 8 8 1 13-7 52-29 73-44s34-28 52-46 41-46 56-65q20-26 29-46c8-13 10-14 18-34s22-57 28-84c7-27 7-58 9-80 1-22 0-35-1-54a481 481 0 0 0-53-194c-13-24-31-52-47-73a530 530 0 0 0-114-99q-33-19-58-31a650 650 0 0 0-99-28l-46-3h-107c-20-2-9-5-11-9s-2-12 0-16q1-4 7-7l27-9 46-7 65-2q32-1 65 3c21 3 46 11 64 16a464 464 0 0 1 256 183c13 17 18 23 31 46 12 23 34 69 43 93 10 24 11 28 16 50l14 80c3 14 1 5 3 6q3 3 8 1c2-1 0 5 6-7q11-20 31-65l45-111a2679 2679 0 0 0 76-279 1612 1612 0 0 0 21-343c-1-36-1-62-7-111s-23-142-31-183c-7-40-7-34-14-61-8-27-16-57-31-99s-40-107-60-153-36-77-62-122a1923 1923 0 0 0-184-266c-38-43-90-98-133-138-44-41-96-81-127-106s-39-29-61-44-36-26-72-46c-37-21-97-55-145-78a1921 1921 0 0 0-245-90 1334 1334 0 0 0-336-55c-40-2-99-4-148-3a1957 1957 0 0 0-248 26c-30 6-35 6-73 16s-106 28-156 46a1494 1494 0 0 0-406 211c-40 31-93 73-133 108-39 36-78 77-106 106-27 29-40 46-58 67l-46 59-76 111q-30 47-48 80a2814 2814 0 0 0-75 153c-12 28-17 39-30 76s-33 96-46 145a1912 1912 0 0 0-48 267 2164 2164 0 0 0-4 233 1469 1469 0 0 0 51 328 1340 1340 0 0 0 62 183c12 32 22 59 45 103 22 45 73 138 89 166 17 29 5 6 8 5 2-1 6 1 7-10 2-12 0-33 3-58a1421 1421 0 0 1 30-145 837 837 0 0 1 59-164c13-26 28-59 46-88a1133 1133 0 0 1 242-274 1321 1321 0 0 1 170-106 890 890 0 0 1 229-76q45-11 80-15c25-4 43-4 69-7 26-4 69-10 88-15s21-11 27-14c5-4 5-3 7-8 1-5 2-16 0-21-2-6 8-7-11-13s-72-14-103-22c-31-9-65-21-84-28s-17-7-29-15l-44-30c-7-7-3-6-2-8s-8 1 6-7l76-41c15-8 8-3 12-3s1-2 11 2c10 5 32 18 50 25a340 340 0 0 0 168 18c10-2 10-4 12-9s6-7-1-20c-7-14-33-49-42-63l-9-17q-3-5 0-7c1-2-8-1 9-6 18-4 78-19 96-21s5 0 13 8 23 27 36 39c14 12 33 24 46 32a144 144 0 0 0 69 21c14 0 37-1 53-5 16-3 27-7 42-15s35-20 50-33 26-38 42-45c16-6 37 4 53 7 17 3 37 9 46 12s7 3 7 6c1 3 8-3-2 11l-60 77c-10 14-4 6-5 11s0 15 1 19q2 6 6 8c2 2-1 3 7 4l42 2c17-1 33 1 57-5 25-6 69-22 88-29 20-7 24-10 31-15q9-6 13-11 5-3 10-2c3 0-5-6 11 2s70 37 84 46c15 9 3 6 3 8s5-1-3 5l-41 29c-11 7-8 7-24 14-16 8-49 22-72 30s-30 13-65 20c-35 6-108 13-145 19s-59 10-77 15c-17 5-16 7-26 14-11 8-20 12-37 29s-44 51-65 73-48 45-62 58c-15 12-12 10-25 18l-52 30-30 15-50 16c-18 5-29 9-57 15l-111 21c-27 6-32 8-53 15q-33 12-73 31-36 16-80 45a709 709 0 0 0-238 270c-15 28-22 49-29 69-8 20-12 30-17 49-5 20-11 39-16 69-4 31-11 83-13 115-2 31-2 45 0 76l14 111c5 28 11 44 16 61l14 42q11 29 32 71c16 28 40 68 60 97a712 712 0 0 0 299 246c33 15 81 34 111 44s39 11 69 17q43 8 107 16c42 4 107 8 148 9s78-2 97-4m915-1801-54 1c-17 0-21 2-49-3-28-6-87-21-119-32-31-10-47-20-72-33-26-13-64-34-80-44-16-9 2-2-16-11a1748 1748 0 0 0-190-90c-32-13-69-24-88-30s-17-2-27-5c-9-3-12-7-30-11a914 914 0 0 0-191-30c-29-2-36-2-61-1q-41-1-92 3a1494 1494 0 0 0-175 28 1889 1889 0 0 0-184 60c-24 10-21 6-68 31s-164 91-214 116-65 26-88 33c-23 8-32 9-49 12a606 606 0 0 1-164 2c-19-4-43-12-58-17-15-4-16-5-30-13-15-8-42-24-58-35a286 286 0 0 1-64-58q-15-17-30-41-17-28-32-61a352 352 0 0 1-22-127c0-22 1-50 5-72q6-32 18-61a361 361 0 0 1 164-183 366 366 0 0 1 125-44c19-3 40-1 50-3s10 10 12-7c3-17 0-70 3-95 2-25 6-37 11-54a388 388 0 0 1 66-127 509 509 0 0 1 87-79 578 578 0 0 1 104-48c19-5 52-10 68-13 16-2 14-1 27-1q20-1 50 2 30 2 68 12c26 8 69 30 84 35s3 2 8-7l19-48 15-27c5-9 8-14 19-27 10-12 25-33 42-49q27-25 59-46a384 384 0 0 1 94-44q20-7 50-12a507 507 0 0 1 137-1q30 5 53 13c16 5 26 8 42 16a561 561 0 0 1 96 58c12 10 18 16 31 31l44 57c10 15 10 17 16 30l19 49c5 10-1 10 8 7 9-2 32-15 48-21a410 410 0 0 1 109-26c18-2 28-4 53-2s69 9 95 16c27 7 49 19 65 26 16 8 19 11 31 19a595 595 0 0 1 73 62q17 19 34 42a439 439 0 0 1 47 107c5 17 8 26 10 50s0 78 3 95c2 17 2 5 12 7 11 2 32 0 50 3q27 3 57 13a412 412 0 0 1 137 79c17 13 22 20 32 32a347 347 0 0 1 62 99c8 16 9 17 14 38 4 22 12 61 12 92s-6 72-10 95c-5 24-8 30-16 46a499 499 0 0 1-59 95q-14 18-30 31c-11 10-20 18-35 28a705 705 0 0 1-88 46l-49 16q-23 5-46 6m-1146 957q10-1 16-9c6-5 13-16 17-21 3-6 2-6 3-12 0-5 2-11-2-19-3-7-13-20-19-26q-12-9-22-10c-6-2-8-2-15 0s-21 7-28 13q-10 11-15 23-3 10-1 19c2 8 9 20 13 27q8 8 16 12c4 3 5 3 11 4s19 1 26-1"/></svg>
@@ -1,14 +0,0 @@
1
- import { createRequire as __linzumiBundleCreateRequire } from 'node:module';
2
- const require = __linzumiBundleCreateRequire(import.meta.url);
3
- import{randomUUID as fe}from"node:crypto";import{mkdir as ce,realpath as me,writeFile as pe}from"node:fs/promises";import{homedir as G}from"node:os";import{join as U}from"node:path";function F(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function _(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function h(e,t){let r=e.length,i=new Array(r),n=0;for(let o=0;o<r;++o){let s=e[o],u=t(s);u!==void 0&&(i[n]=_(u),n=n+1|0)}return i.length=n,i}function g(e,t,r){return e!==void 0?r(_(e)):t}function E(e,t){if(e!==void 0)return F(t(_(e)))}function S(e,t){if(e!==void 0)return t(_(e))}function O(e,t){return e!==void 0?_(e):t}var N=["codex","claude-code","pi","opencode"];function w(e){return e}function x(e,t){let r=e[t];if(typeof r=="object"&&r!==null&&!Array.isArray(r))return r}function m(e,t){let r=e[t];if(typeof r=="string")return r}function T(e,t){let r=e[t];if(Array.isArray(r))return r}function A(e){return h(e,t=>{if(typeof t!="object"||t===null||Array.isArray(t))return;if(m(t,"type")==="text")return m(t,"text")}).join(`
4
- `)}function C(e,t,r,i){return e+":"+t+":"+r+":"+i}function b(e,t){let r=t.split(":"),i=r[0],n=r[1],o=r[2];if(i===void 0||n===void 0||o===void 0||!(i===e&&n!==""&&o!==""&&r.length>=4))return;let s=r.slice(3,r.length).join(":");if(s!=="")return{keySessionId:n,keyTurnId:o,keyItemId:s}}function H(e,t){return{threadId:e,threadTitle:void 0,nodes:t,hasMore:!1,cursor:void 0,budget:void 0,session:void 0}}var D="codex";function te(e,t,r){return C(D,e,t,r)}function re(e){if(e===void 0)return"system_notice";switch(e){case"agentMessage":return"assistant_message";case"commandExecution":return"command_execution";case"fileChange":return"file_change";case"collabAgentToolCall":case"dynamicToolCall":case"mcpToolCall":return"tool_call";case"reasoning":return"reasoning";case"plan":case"subAgentActivity":return"agent_status";case"terminalInput":return"terminal_input";case"userMessage":return"user_message";default:return"system_notice"}}function j(e){return h(e,t=>{if(typeof t=="string")return t})}function ne(e){let t=m(e,"type");if(t===void 0)return"";switch(t){case"collabAgentToolCall":return O(m(e,"prompt"),"");case"commandExecution":return O(m(e,"aggregatedOutput"),"");case"dynamicToolCall":return g(T(e,"contentItems"),"",A);case"fileChange":return g(T(e,"changes"),[],n=>h(n,o=>{if(typeof o=="object"&&o!==null&&!Array.isArray(o))return m(o,"path")})).join(`
5
- `);case"mcpToolCall":return g(S(x(e,"result"),n=>T(n,"content")),"",A);case"reasoning":let r=g(T(e,"summary"),[],j),i=g(T(e,"content"),[],j);return r.concat(i).filter(n=>n!=="").join(`
6
-
7
- `);case"subAgentActivity":return O(m(e,"agentPath"),"");case"agentMessage":case"plan":case"terminalInput":return O(m(e,"text"),"");case"userMessage":return g(T(e,"content"),"",A);default:return""}}function ie(e){return new Date(e).toISOString()}function q(e,t){let r=[];return t.turns.forEach(i=>{i.items.forEach(n=>{let o=n.item,s;s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};let u=O(m(s,"id"),"");r.push({kind:re(m(s,"type")),seq:r.length+1|0,at:E(n.completedAtMs,ie),harness:D,body:ne(s),structured:n.item,actor:void 0,attachments:[],sourceSeq:void 0,streamKey:te(t.harnessSessionId,i.turnId,u)})})}),H(e,r)}var se="claude-code";function oe(e){return"rehydrated-"+e.toString()}var ue="rehydrated-marker";function le(e,t){switch(e){case"agent_status":return"[status] "+t;case"approval_request":return"[approval] "+t;case"command_execution":return`[command]
8
- `+t;case"error":return"[error] "+t;case"file_change":return`[file change]
9
- `+t;case"system_notice":return"[notice] "+t;case"terminal_input":return`[terminal input]
10
- `+t;case"tool_call":return`[tool call]
11
- `+t;case"tool_result":return`[tool result]
12
- `+t;default:return"["+e+"] "+t}}function W(e,t,r,i){let n={};n.type="text",n.text=i;let o={};o.role=e,o.content=[n];let s={};return s.type=e,s.session_id=t,s.uuid=r,s.message=o,s}function ae(e,t,r,i,n){return"[linzumi cross-harness resume] This session continues linzumi thread "+r+", imported from the "+e+" session "+t+". "+i.toString()+" activity records follow verbatim; "+n.toString()+" reasoning records were redacted (provider-private reasoning is never forged across harnesses)."}function de(e,t,r,i){return"[linzumi session rebuild] This Claude Code session continues Linzumi thread "+e+". Its local session store was missing ("+t+"), so the durable server transcript was restored under the persisted session identity. "+r.toString()+" activity records follow; "+i.toString()+" reasoning records were redacted (provider-private reasoning is never forged)."}function B(e,t,r,i,n){let o=[],s=[],u={contents:0};n.nodes.forEach(d=>{let p=d.kind;if(p==="reasoning"){u.contents=u.contents+1|0;return}let c;switch(p){case"assistant_message":c=["assistant",d.body];break;case"user_message":c=["user",d.body];break;default:c=["assistant",le(p,d.body)]}let y=c[0],I=oe(d.seq);o.push({sourceSeq:d.seq,sourceKind:p,uuid:I,role:y}),s.push(W(y,e,I,c[1]))});let f;f=typeof i!="object"?ae(t,r,n.threadId,s.length,u.contents):de(n.threadId,i._0,s.length,u.contents);let a=[W("user",e,ue,f)].concat(s);return{session:{harnessSessionId:e,messages:a},report:{sourceHarness:t,sourceSessionId:r,sessionMessageCount:a.length,redactedReasoningCount:u.contents,emissions:o}}}function K(e,t,r){let i={contents:void 0},n=f=>{if(i.contents===void 0){i.contents=f;return}},o=r.nodes.length;e===""?n("the persisted target session identity must be non-empty"):e.includes(":")?n("the persisted target session identity must be colon-free"):o!==0||n("an empty server transcript rehydrates nothing");let s={contents:void 0};r.nodes.forEach(f=>{let l=i.contents,a=s.contents;if(l===void 0){if(a!==void 0&&f.seq<=a)return n("server transcript nodes must ascend by seq");s.contents=f.seq;return}});let u=i.contents;return u!==void 0?{TAG:"Error",_0:u}:{TAG:"Ok",_0:B(e,"linzumi-server",r.threadId,{TAG:"ServerTranscript",_0:t},r)}}function V(e,t){let r={contents:void 0},i=l=>{if(r.contents===void 0){r.contents=l;return}};e===""?i("the caller-bound target session identity must be non-empty"):e.includes(":")&&i("the caller-bound target session identity must be colon-free"),r.contents===void 0&&t.nodes.length===0&&i("an empty page rehydrates nothing - the source session must carry content");let n={contents:void 0},o={contents:void 0};t.nodes.forEach(l=>{if(r.contents===void 0){let d=o.contents;d!==void 0&&l.seq<=d?i("page nodes must ascend by seq"):o.contents=l.seq}if(r.contents===void 0){let d=h(N.map(w),p=>E(S(l.streamKey,c=>b(p,c)),c=>[p,c.keySessionId]))[0];if(d!==void 0){let p=d[1],c=d[0];if(c===se)i("the page was minted by the claude harness - same-harness resume rides the native session store, never rehydration");else{let y=n.contents;y!==void 0&&(y[0]!==c||y[1]!==p)?i("page mixes two harness session identities"):n.contents=[c,p]}}else i("node carries no parseable minted stream_key identity of a catalog harness")}if(r.contents!==void 0)return;let a=l.structured;if(!(typeof a=="object"&&a!==null&&!Array.isArray(a)))return i("node carries no verbatim native passthrough")});let s=r.contents,u=n.contents;if(s!==void 0)return{TAG:"Error",_0:s};if(u===void 0)return{TAG:"Error",_0:"page carries no source harness identity"};let f=u[1];return f===e?{TAG:"Error",_0:"the caller-bound target session identity must be distinct from the source session identity"}:{TAG:"Ok",_0:B(e,u[0],f,"CrossHarness",t)}}function _e(e,t=G()){let r=e.replace(/[^a-zA-Z0-9]/g,"-");return U(t,".claude","projects",r)}async function z({rehydrated:e,targetSessionId:t,cwd:r,home:i}){let n;try{n=await me(r)}catch{return{ok:!1,failure:`the thread's working directory is not resolvable: ${r}`}}let o=_e(n,i);await ce(o,{recursive:!0});let s=U(o,`${t}.jsonl`),u=Date.now(),f=e.session.messages.map((l,a,d)=>({parentUuid:a===0?null:d[a-1]?.uuid??null,isSidechain:!1,userType:"external",cwd:n,sessionId:t,version:"0.0.0-linzumi-cross-harness-failover",type:l.type,message:l.message,uuid:l.uuid,timestamp:new Date(u+a).toISOString()}));return await pe(s,f.map(l=>JSON.stringify(l)).join(`
13
- `)+`
14
- `),{ok:!0,targetSessionId:t,sessionFile:s,transpiledItemCount:e.report.emissions.length,redactedReasoningCount:e.report.redactedReasoningCount}}function he({transcript:e,kandanThreadId:t}){return{threadId:t,threadTitle:e.threadTitle,nodes:e.nodes.map(r=>({kind:r.kind,seq:r.seq,at:r.at,harness:r.engine,body:r.body,structured:r.structured,actor:r.actor,attachments:r.attachments,sourceSeq:r.sourceSeq,streamKey:r.streamKey})),hasMore:!1,cursor:void 0,budget:e.budget,session:void 0}}async function Ne({transcript:e,kandanThreadId:t,targetSessionId:r,cwd:i,resumeFailure:n="local Claude Code session store entry was missing",home:o=G()}){try{if(r===""||t===""||!Array.isArray(e?.nodes)||e.nodes.length===0)return{ok:!1,failure:"canonical Claude rehydration requires non-empty thread/session identities and transcript nodes"};let s=he({transcript:e,kandanThreadId:t}),u=K(r,n,s);return u.TAG!=="Ok"?{ok:!1,failure:`Claude rehydration refused the canonical server transcript: ${JSON.stringify(u._0)}`}:await z({rehydrated:u._0,targetSessionId:r,cwd:i,home:o})}catch(s){return{ok:!1,failure:s instanceof Error?s.message:String(s)}}}async function $e({activity:e,codexThreadId:t,kandanThreadId:r,targetSessionId:i=fe(),cwd:n,home:o=G()}){try{let s=(e?.turns??[]).filter(a=>a.items.length>0);if(s.reduce((a,d)=>a+d.items.length,0)===0)return{ok:!1,failure:"no recorded harness activity to carry over (the failover journal is empty)"};let f=q(r,{harnessSessionId:t,turns:s}),l=V(i,f);return l.TAG!=="Ok"?{ok:!1,failure:`claude rehydration refused the exported page: ${JSON.stringify(l._0)}`}:await z({rehydrated:l._0,targetSessionId:i,cwd:n,home:o})}catch(s){return{ok:!1,failure:s instanceof Error?s.message:String(s)}}}export{_e as claudeSessionStoreDir,Ne as seedCanonicalTranscriptIntoClaudeSession,$e as transpileAndSeedClaudeSession};