@linzumi/cli 1.0.275 → 1.0.277

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 (45) hide show
  1. package/README.md +10 -9
  2. package/dist/cloud-supervisor.mjs +295 -0
  3. package/dist/hosted-coding-account-worker.js +25 -0
  4. package/dist/index.js +2084 -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 +10 -17
  11. package/scripts/build.mjs +33 -356
  12. package/scripts/bump-cli-version.mjs +35 -36
  13. package/scripts/check-package-size-budget.mjs +13 -61
  14. package/scripts/vm-provision-proof.mjs +1 -2
  15. package/dist/impl-res/cloud-supervisor.mjs +0 -281
  16. package/dist/impl-res/index.js +0 -1546
  17. package/dist/impl-res/mcp-server.mjs +0 -461
  18. package/dist/impl-ts/assets/linzumi-logo.svg +0 -1
  19. package/dist/impl-ts/cloud-supervisor.mjs +0 -281
  20. package/dist/impl-ts/crossHarnessFailover.mjs +0 -14
  21. package/dist/impl-ts/index.js +0 -2617
  22. package/dist/impl-ts/mcp-server.mjs +0 -455
  23. package/dist/impl-ts/native/darwin/manifest.json +0 -21
  24. package/dist/impl-ts/native/darwin/preview-process-identity +0 -0
  25. package/dist/impl-ts/tcp-tunnel-cli.mjs +0 -93
  26. package/scripts/build-differential-entry-impl-res.mjs +0 -64
  27. package/scripts/build-differential-entry.mjs +0 -180
  28. package/scripts/build-onboarding-demo-evidence.mjs +0 -186
  29. package/scripts/build-tui-demo-evidence.mjs +0 -107
  30. package/scripts/diagnose-claude-probe.ts +0 -198
  31. package/scripts/differentialMutations.mjs +0 -114
  32. package/scripts/f5_live_cross_harness_failover_e2e.mjs +0 -239
  33. package/scripts/golden-chaos-harness.mjs +0 -1420
  34. package/scripts/golden-lifecycle-e2e.mjs +0 -969
  35. package/scripts/normalize-agent-replay-fixture.ts +0 -281
  36. package/scripts/promote-gstack-claude-smoke-fixture.ts +0 -891
  37. package/scripts/record-agent-replay-fixtures.ts +0 -610
  38. package/scripts/replay-agent-backend-browser.ts +0 -198
  39. package/scripts/replay-agent-backend.ts +0 -1961
  40. package/scripts/replay-agent-fixture.ts +0 -326
  41. package/scripts/typecheck.mjs +0 -42
  42. package/scripts/vm-smoke.mjs +0 -241
  43. /package/dist/{impl-res/assets → assets}/linzumi-logo.svg +0 -0
  44. /package/dist/{impl-res/crossHarnessFailover.mjs → crossHarnessFailover.mjs} +0 -0
  45. /package/dist/{impl-res/native → native}/darwin/preview-process-identity +0 -0
@@ -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};