shennian 0.3.42 → 0.3.44
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.
- package/dist/publish-build-manifest.json +91 -41
- package/dist/src/agents/adapter.d.ts +1 -0
- package/dist/src/index.js +3 -3
- package/dist/src/native-fusion/codex-parser.d.ts +1 -0
- package/dist/src/native-fusion/codex-parser.js +4 -4
- package/dist/src/native-fusion/file-watcher.d.ts +18 -0
- package/dist/src/native-fusion/file-watcher.js +1 -0
- package/dist/src/native-fusion/local-repository.d.ts +53 -0
- package/dist/src/native-fusion/local-repository.js +2 -0
- package/dist/src/native-fusion/opencode-parser.js +2 -2
- package/dist/src/native-fusion/parser-common.d.ts +7 -1
- package/dist/src/native-fusion/parser-common.js +4 -4
- package/dist/src/native-fusion/parsers.d.ts +2 -1
- package/dist/src/native-fusion/parsers.js +2 -2
- package/dist/src/native-fusion/service.d.ts +10 -2
- package/dist/src/native-fusion/service.js +2 -2
- package/dist/src/native-fusion/session-header.d.ts +9 -0
- package/dist/src/native-fusion/session-header.js +2 -0
- package/dist/src/native-fusion/state.d.ts +1 -1
- package/dist/src/native-fusion/state.js +2 -1
- package/dist/src/native-fusion/types.d.ts +31 -5
- package/dist/src/native-fusion/types.js +1 -1
- package/dist/src/personal-sync/paths.d.ts +2 -0
- package/dist/src/personal-sync/paths.js +1 -0
- package/dist/src/relay/client.d.ts +4 -1
- package/dist/src/relay/client.js +1 -1
- package/dist/src/session/attachment-reference.d.ts +2 -0
- package/dist/src/session/attachment-reference.js +1 -0
- package/dist/src/session/attachment-transfer-store.d.ts +38 -0
- package/dist/src/session/attachment-transfer-store.js +2 -0
- package/dist/src/session/canonical-store.d.ts +101 -0
- package/dist/src/session/canonical-store.js +5 -0
- package/dist/src/session/handlers/chat.js +2 -2
- package/dist/src/session/handlers/fs.d.ts +0 -1
- package/dist/src/session/handlers/fs.js +1 -1
- package/dist/src/session/handlers/message-status.d.ts +3 -0
- package/dist/src/session/handlers/message-status.js +1 -0
- package/dist/src/session/handlers/title.js +1 -1
- package/dist/src/session/handlers/tool-detail.js +1 -1
- package/dist/src/session/handlers/voice-window.d.ts +3 -0
- package/dist/src/session/handlers/voice-window.js +1 -0
- package/dist/src/session/history-subscriptions.d.ts +17 -0
- package/dist/src/session/history-subscriptions.js +1 -0
- package/dist/src/session/index-publisher.d.ts +3 -0
- package/dist/src/session/index-publisher.js +1 -0
- package/dist/src/session/manager.d.ts +2 -0
- package/dist/src/session/manager.js +1 -1
- package/dist/src/session/queue.d.ts +1 -1
- package/dist/src/session/queue.js +4 -3
- package/dist/src/session/store.d.ts +33 -3
- package/dist/src/session/store.js +2 -3
- package/dist/src/session/tool-detail-store.d.ts +16 -0
- package/dist/src/session/tool-detail-store.js +2 -0
- package/dist/src/session/types.d.ts +3 -13
- package/node_modules/@shennian/wire/dist/events.d.ts +2 -0
- package/node_modules/@shennian/wire/dist/fs.d.ts +45 -0
- package/node_modules/@shennian/wire/dist/fs.js +7 -1
- package/node_modules/@shennian/wire/dist/index.d.ts +1 -0
- package/node_modules/@shennian/wire/dist/index.js +1 -0
- package/node_modules/@shennian/wire/dist/machine.d.ts +6 -0
- package/node_modules/@shennian/wire/dist/message-payload.d.ts +2 -0
- package/node_modules/@shennian/wire/dist/message-payload.js +15 -1
- package/node_modules/@shennian/wire/dist/methods.d.ts +1 -1
- package/node_modules/@shennian/wire/dist/session-sync.d.ts +197 -0
- package/node_modules/@shennian/wire/dist/session-sync.js +49 -0
- package/node_modules/@shennian/wire/dist/session.d.ts +24 -13
- package/node_modules/@shennian/wire/dist/tool-detail.d.ts +18 -11
- package/node_modules/@shennian/wire/dist/tool-detail.js +7 -1
- package/package.json +1 -1
- package/dist/src/session/remote-attachments.d.ts +0 -15
- package/dist/src/session/remote-attachments.js +0 -1
- package/dist/src/session/tool-summary.d.ts +0 -1
- package/dist/src/session/tool-summary.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"jsMinified": true,
|
|
4
4
|
"minifier": "esbuild",
|
|
5
|
-
"fileCount":
|
|
5
|
+
"fileCount": 121,
|
|
6
6
|
"files": [
|
|
7
7
|
{
|
|
8
8
|
"file": "bin/shennian.js",
|
|
@@ -276,8 +276,8 @@
|
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
"file": "src/index.js",
|
|
279
|
-
"beforeBytes":
|
|
280
|
-
"afterBytes":
|
|
279
|
+
"beforeBytes": 21396,
|
|
280
|
+
"afterBytes": 11301
|
|
281
281
|
},
|
|
282
282
|
{
|
|
283
283
|
"file": "src/log-reporter.js",
|
|
@@ -306,43 +306,63 @@
|
|
|
306
306
|
},
|
|
307
307
|
{
|
|
308
308
|
"file": "src/native-fusion/codex-parser.js",
|
|
309
|
-
"beforeBytes":
|
|
310
|
-
"afterBytes":
|
|
309
|
+
"beforeBytes": 29910,
|
|
310
|
+
"afterBytes": 12631
|
|
311
311
|
},
|
|
312
312
|
{
|
|
313
313
|
"file": "src/native-fusion/config.js",
|
|
314
314
|
"beforeBytes": 225,
|
|
315
315
|
"afterBytes": 109
|
|
316
316
|
},
|
|
317
|
+
{
|
|
318
|
+
"file": "src/native-fusion/file-watcher.js",
|
|
319
|
+
"beforeBytes": 2954,
|
|
320
|
+
"afterBytes": 1278
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"file": "src/native-fusion/local-repository.js",
|
|
324
|
+
"beforeBytes": 13247,
|
|
325
|
+
"afterBytes": 6702
|
|
326
|
+
},
|
|
317
327
|
{
|
|
318
328
|
"file": "src/native-fusion/opencode-parser.js",
|
|
319
|
-
"beforeBytes":
|
|
320
|
-
"afterBytes":
|
|
329
|
+
"beforeBytes": 5208,
|
|
330
|
+
"afterBytes": 2743
|
|
321
331
|
},
|
|
322
332
|
{
|
|
323
333
|
"file": "src/native-fusion/parser-common.js",
|
|
324
|
-
"beforeBytes":
|
|
325
|
-
"afterBytes":
|
|
334
|
+
"beforeBytes": 7739,
|
|
335
|
+
"afterBytes": 3552
|
|
326
336
|
},
|
|
327
337
|
{
|
|
328
338
|
"file": "src/native-fusion/parsers.js",
|
|
329
|
-
"beforeBytes":
|
|
330
|
-
"afterBytes":
|
|
339
|
+
"beforeBytes": 5543,
|
|
340
|
+
"afterBytes": 3005
|
|
331
341
|
},
|
|
332
342
|
{
|
|
333
343
|
"file": "src/native-fusion/service.js",
|
|
334
|
-
"beforeBytes":
|
|
335
|
-
"afterBytes":
|
|
344
|
+
"beforeBytes": 20039,
|
|
345
|
+
"afterBytes": 9441
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"file": "src/native-fusion/session-header.js",
|
|
349
|
+
"beforeBytes": 3498,
|
|
350
|
+
"afterBytes": 1657
|
|
336
351
|
},
|
|
337
352
|
{
|
|
338
353
|
"file": "src/native-fusion/state.js",
|
|
339
|
-
"beforeBytes":
|
|
340
|
-
"afterBytes":
|
|
354
|
+
"beforeBytes": 3258,
|
|
355
|
+
"afterBytes": 1598
|
|
341
356
|
},
|
|
342
357
|
{
|
|
343
358
|
"file": "src/native-fusion/types.js",
|
|
344
|
-
"beforeBytes":
|
|
345
|
-
"afterBytes":
|
|
359
|
+
"beforeBytes": 54,
|
|
360
|
+
"afterBytes": 60
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"file": "src/personal-sync/paths.js",
|
|
364
|
+
"beforeBytes": 364,
|
|
365
|
+
"afterBytes": 223
|
|
346
366
|
},
|
|
347
367
|
{
|
|
348
368
|
"file": "src/region.js",
|
|
@@ -351,8 +371,8 @@
|
|
|
351
371
|
},
|
|
352
372
|
{
|
|
353
373
|
"file": "src/relay/client.js",
|
|
354
|
-
"beforeBytes":
|
|
355
|
-
"afterBytes":
|
|
374
|
+
"beforeBytes": 12612,
|
|
375
|
+
"afterBytes": 6310
|
|
356
376
|
},
|
|
357
377
|
{
|
|
358
378
|
"file": "src/room/activation-audit.js",
|
|
@@ -454,6 +474,21 @@
|
|
|
454
474
|
"beforeBytes": 8037,
|
|
455
475
|
"afterBytes": 3438
|
|
456
476
|
},
|
|
477
|
+
{
|
|
478
|
+
"file": "src/session/attachment-reference.js",
|
|
479
|
+
"beforeBytes": 1717,
|
|
480
|
+
"afterBytes": 914
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"file": "src/session/attachment-transfer-store.js",
|
|
484
|
+
"beforeBytes": 18717,
|
|
485
|
+
"afterBytes": 9372
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"file": "src/session/canonical-store.js",
|
|
489
|
+
"beforeBytes": 28665,
|
|
490
|
+
"afterBytes": 14062
|
|
491
|
+
},
|
|
457
492
|
{
|
|
458
493
|
"file": "src/session/handlers/agent-capabilities.js",
|
|
459
494
|
"beforeBytes": 767,
|
|
@@ -471,8 +506,8 @@
|
|
|
471
506
|
},
|
|
472
507
|
{
|
|
473
508
|
"file": "src/session/handlers/chat.js",
|
|
474
|
-
"beforeBytes":
|
|
475
|
-
"afterBytes":
|
|
509
|
+
"beforeBytes": 33758,
|
|
510
|
+
"afterBytes": 14377
|
|
476
511
|
},
|
|
477
512
|
{
|
|
478
513
|
"file": "src/session/handlers/control.js",
|
|
@@ -481,8 +516,13 @@
|
|
|
481
516
|
},
|
|
482
517
|
{
|
|
483
518
|
"file": "src/session/handlers/fs.js",
|
|
484
|
-
"beforeBytes":
|
|
485
|
-
"afterBytes":
|
|
519
|
+
"beforeBytes": 20840,
|
|
520
|
+
"afterBytes": 10026
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"file": "src/session/handlers/message-status.js",
|
|
524
|
+
"beforeBytes": 561,
|
|
525
|
+
"afterBytes": 313
|
|
486
526
|
},
|
|
487
527
|
{
|
|
488
528
|
"file": "src/session/handlers/room-managed.js",
|
|
@@ -496,18 +536,33 @@
|
|
|
496
536
|
},
|
|
497
537
|
{
|
|
498
538
|
"file": "src/session/handlers/title.js",
|
|
499
|
-
"beforeBytes":
|
|
500
|
-
"afterBytes":
|
|
539
|
+
"beforeBytes": 3013,
|
|
540
|
+
"afterBytes": 1583
|
|
501
541
|
},
|
|
502
542
|
{
|
|
503
543
|
"file": "src/session/handlers/tool-detail.js",
|
|
504
|
-
"beforeBytes":
|
|
505
|
-
"afterBytes":
|
|
544
|
+
"beforeBytes": 6010,
|
|
545
|
+
"afterBytes": 3159
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"file": "src/session/handlers/voice-window.js",
|
|
549
|
+
"beforeBytes": 2324,
|
|
550
|
+
"afterBytes": 1105
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
"file": "src/session/history-subscriptions.js",
|
|
554
|
+
"beforeBytes": 6272,
|
|
555
|
+
"afterBytes": 3181
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
"file": "src/session/index-publisher.js",
|
|
559
|
+
"beforeBytes": 1469,
|
|
560
|
+
"afterBytes": 731
|
|
506
561
|
},
|
|
507
562
|
{
|
|
508
563
|
"file": "src/session/manager.js",
|
|
509
|
-
"beforeBytes":
|
|
510
|
-
"afterBytes":
|
|
564
|
+
"beforeBytes": 20168,
|
|
565
|
+
"afterBytes": 10430
|
|
511
566
|
},
|
|
512
567
|
{
|
|
513
568
|
"file": "src/session/projection.js",
|
|
@@ -516,23 +571,18 @@
|
|
|
516
571
|
},
|
|
517
572
|
{
|
|
518
573
|
"file": "src/session/queue.js",
|
|
519
|
-
"beforeBytes":
|
|
520
|
-
"afterBytes":
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
"file": "src/session/remote-attachments.js",
|
|
524
|
-
"beforeBytes": 2999,
|
|
525
|
-
"afterBytes": 1492
|
|
574
|
+
"beforeBytes": 17298,
|
|
575
|
+
"afterBytes": 8175
|
|
526
576
|
},
|
|
527
577
|
{
|
|
528
578
|
"file": "src/session/store.js",
|
|
529
|
-
"beforeBytes":
|
|
530
|
-
"afterBytes":
|
|
579
|
+
"beforeBytes": 13169,
|
|
580
|
+
"afterBytes": 7349
|
|
531
581
|
},
|
|
532
582
|
{
|
|
533
|
-
"file": "src/session/tool-
|
|
534
|
-
"beforeBytes":
|
|
535
|
-
"afterBytes":
|
|
583
|
+
"file": "src/session/tool-detail-store.js",
|
|
584
|
+
"beforeBytes": 2690,
|
|
585
|
+
"afterBytes": 1307
|
|
536
586
|
},
|
|
537
587
|
{
|
|
538
588
|
"file": "src/session/types.js",
|
package/dist/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Command as oe}from"commander";import v from"chalk";import ne from"node:os";import
|
|
2
|
-
`),process.exitCode=1}function
|
|
3
|
-
Disconnecting...`)),S({level:"info",wsEvent:"daemon.stop"}),clearInterval(r);try{await f.cleanup(),
|
|
1
|
+
import{Command as oe}from"commander";import v from"chalk";import ne from"node:os";import O from"node:fs";import{loadConfig as d,saveConfig as te,getConfigPath as re,getShennianDir as ie,resolveShennianPath as H,normalizeAutoUpgradePolicy as se}from"./config/index.js";import{CliRelayClient as ae}from"./relay/client.js";import{registerPairCommand as ce,runSmartStart as me}from"./commands/pair.js";import{clearDaemonPidIfOwner as F,createDaemonInstanceId as le,clearDaemonLauncher as G,findRunningDaemonProcessIds as de,isRemoteAccessDisabled as pe,isIsolatedDaemonE2eInstance as ge,registerDaemonCommand as ue,writeDaemonPid as J,writeDaemonLauncher as j}from"./commands/daemon.js";import{registerRuntimeCommand as he}from"./commands/runtime.js";import{registerManagerCommand as fe}from"./commands/manager.js";import{registerUpgradeCommand as ve}from"./commands/upgrade.js";import{registerToolsCommand as Se}from"./commands/tools.js";import{registerIntegrationCommand as we}from"./commands/integration.js";import{registerRoomCommand as Ie}from"./commands/room.js";import{SessionManager as Re}from"./session/manager.js";import{SERVERS as A,regionToUrl as ye,urlToRegion as Ce}from"./region.js";import{getCurrentVersion as K,handleStartupCrashCheck as ke}from"./upgrade/engine.js";import{AutoUpgradeScheduler as De}from"./upgrade/scheduler.js";import{detectAgents as Ee}from"./agents/detect.js";import{augmentProcessPath as z}from"./env-path.js";z();const W=K();import{getCachedAgentInfos as Te,resolveAgentInfos as Ue}from"./agents/model-registry.js";import{initCliLogReporter as Oe,reportLog as S}from"./log-reporter.js";import{isNativeFusionEnabled as Ae}from"./native-fusion/config.js";import{NativeSessionFusionService as $e}from"./native-fusion/service.js";import{startDaemonLogRetention as Ne}from"./daemon-log.js";import{startDaemonIpcServer as be}from"./daemon-ipc/server.js";import{RoomSessionRegistry as Pe}from"./room/session-registry.js";import{HttpRoomBindingClient as _e}from"./room/room-binding-client.js";import{TrustedManagedRoomBinder as Me}from"./room/managed-room-binding.js";import{RoomHostSessionObservationStore as Le}from"./room/host-session-observations.js";import{RoomMirrorSyncService as xe}from"./room/mirror-sync-service.js";import{RoomActivationService as Ve}from"./room/activation-service.js";import{RoomActivationAudit as Be}from"./room/activation-audit.js";import{RoomAttachmentCache as He}from"./room/attachment-cache.js";import{RoomAttachmentUploader as Fe}from"./room/attachment-upload.js";import{ManagedRoomContextAuthority as Ge}from"./room/managed-context.js";import{createManagedRoomIpcHandlers as Je}from"./room/managed-room-ipc.js";import{SESSION_SYNC_PROTOCOL_VERSION as je,SESSION_SYNC_REQUIRED_CAPABILITIES as Ke}from"@shennian/wire";import{getDaemonInstallationId as ze}from"./session/store.js";const Y=ie(),We=H("daemon.pid");function Ye(){try{const o=O.readFileSync(We,"utf-8").trim();if(o.startsWith("{")){const r=JSON.parse(o),s=Number(r.pid);return Number.isInteger(s)&&s>0?s:null}const n=parseInt(o,10);return Number.isInteger(n)&&n>0?n:null}catch{return null}}function Qe(o){return o.replace(/^https:\/\//,"wss://").replace(/^http:\/\//,"ws://")}function $(){process.stdout.write(`${JSON.stringify({ok:!1,error:"integration_command_retired",message:"Room MCP and Hooks were retired. Use the Shennian Skill and CLI.",nextAction:{type:"open_install_guide",url:"https://shennian.net/install.md"}})}
|
|
2
|
+
`),process.exitCode=1}function qe(o){const n=[`trigger=${o.trigger??"unknown"}`,`phase=${o.phase}`,`code=${o.code??"unknown"}`,`attempt=${o.reconnectAttempt}`];return o.reason&&n.push(`reason=${o.reason}`),o.error&&n.push(`error=${o.error}`),n.join(" ")}async function Q(o,n=5e3){const r=Date.now();for(;Date.now()-r<n;){try{process.kill(o,0)}catch{return!0}await new Promise(s=>setTimeout(s,100))}try{return process.kill(o,0),!1}catch{return!0}}const t=new oe;t.name("shennian").description("Shennian \u2014 AI Agent Control Plane").version(W),t.enablePositionalOptions(),we(t),Ie(t),t.option("--api <url>","Server URL override").option("--name <name>","Machine name",ne.hostname()).action(async o=>{const n=d(),r=o.api??process.env.SHENNIAN_DESKTOP_SERVER_URL??n.serverUrl??void 0;await me(r,o.name)}),t.command("run-service",{hidden:!0}).description("(internal) Connect to relay server, called by the background service").option("--api <url>","Server URL override").action(async o=>{const n=H("env.json");try{const e=JSON.parse(O.readFileSync(n,"utf-8"));for(const[i,c]of Object.entries(e))process.env[i]||(process.env[i]=c);z()}catch{}const r=Ne();pe()&&(console.log(`[${new Date().toISOString()}] remote access disabled, service start skipped`),clearInterval(r),process.exit(0));const s=!!(process.env.INVOCATION_ID||process.env.JOURNAL_STREAM||process.env.SHENNIAN_DESKTOP_SERVER_URL),N=async(e,i)=>{console.log(`[${new Date().toISOString()}] ${i} (PID ${e})`),process.kill(e,"SIGTERM"),await Q(e)||(process.kill(e,"SIGKILL"),await Q(e,2e3))};try{const e=Ye();if(e&&e!==process.pid)try{process.kill(e,0),s?await N(e,"managed start taking over from existing daemon"):(console.log(`[${new Date().toISOString()}] daemon already running (PID ${e}), skipping duplicate start`),process.exit(0))}catch{}}catch{}const D=ge(process.env,Y)?[]:de(process.pid);if(D.length>0)if(s)for(const e of D)try{await N(e,"managed start taking over from orphan daemon")}catch{}else console.log(`[${new Date().toISOString()}] daemon already running (PID ${D[0]}), skipping duplicate start`),process.exit(0);const m=le();J(process.pid,m,{version:W}),j(process.pid,void 0,m),process.on("exit",()=>{F(process.pid,m),G(m)}),await ke()&&(console.log(`[${new Date().toISOString()}] Rolled back to previous version, restarting...`),process.exit(0));const a=d(),g=o.api??process.env.SHENNIAN_DESKTOP_SERVER_URL??a.serverUrl??A.cn.url,p=K(),E=Ee(),u=E.map(e=>e.type),T=Te(E),w=new Pe,I=new Le,b=new Ge(w),h=new _e(g),X=new He({actionClient:h}),Z=new Fe({actionClient:h});let P=null;const U=await be({handlers:{...Je({authority:b,actionClient:h,attachmentCache:X,attachmentUploader:Z,observations:I,getMachineCredentials:()=>({machineToken:d().machineToken})})}});let _=!1;const R=()=>{_||(_=!0,U.close().finally(()=>process.exit(0)))};if(process.once("SIGINT",R),process.once("SIGTERM",R),!a.machineToken){console.error('Shennian CLI is not paired. Run "shennian pair --browser" or "shennian pair --token" first.'),await U.close(),process.exitCode=1;return}process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R);const M=`${Qe(g)}/relay/machine`,L=a.machineToken;if(!L)return;a.machineId&&Oe(g,a.machineId),console.log(`[${new Date().toISOString()}] Connecting to ${M}... (v${p}) agents: ${u.join(",")}`),S({level:"info",wsEvent:"daemon.start",metadata:{version:p,agents:u}});let y=null,C=null;const x=se(a.autoUpgrade),l=new ae({serverUrl:M,machineToken:L,cliVersion:p,agentList:u,autoUpgradePolicy:x,sessionSyncProtocolVersion:je,sessionSyncCapabilities:Ke,daemonInstallationId:ze(),onConnected:()=>{console.log(`[${new Date().toISOString()}] \u2713 Connected`),S({level:"info",wsEvent:"daemon.connected"}),T.some(e=>e.models.length>0)&&l.sendEvent({type:"event",event:"machine.agents",payload:{agentList:u,agents:T}}),Ue(E,{serverUrl:a.serverUrl??g,authToken:a.machineToken??a.accessToken}).then(e=>{JSON.stringify(e)!==JSON.stringify(T)&&l.sendEvent({type:"event",event:"machine.agents",payload:{agentList:u,agents:e}})}).catch(()=>{}),import("./upgrade/engine.js").then(({readUpgradeAttempt:e,clearUpgradeAttempt:i})=>{const c=e();i(),c&&(console.log(`[${new Date().toISOString()}] [upgrade] Reporting success: ${c.from} \u2192 ${c.to}`),l.sendEvent({type:"event",event:"upgrade",payload:{state:"success",machineId:"self",from:c.from,to:c.to}}))}).catch(()=>{}),k.start(),y?.handleConnected(),C?.start()},onDisconnected:e=>{C?.stop(),console.log(`[${new Date().toISOString()}] \u26A0 Disconnected, reconnecting... ${qe(e)}`),S({level:"warn",wsEvent:"daemon.disconnected",metadata:{code:e.code,reason:e.reason,error:e.error,phase:e.phase,trigger:e.trigger,reconnectAttempt:e.reconnectAttempt}})},onReq:e=>{console.log(`[${new Date().toISOString()}] [req] ${e.method}`),S({level:"info",type:"ws",wsEvent:e.method,wsDirection:"in",traceId:e.traceId}),f.handleReq(e)}});y=Ae()?new $e(l):null,C=new xe({registry:w,observations:I,actionClient:h,getMachineCredentials:()=>({machineToken:d().machineToken}),onMessages:async(e,i,c,ee)=>{await P?.processMessages(e,i,c,ee)}});const k=new De({currentVersion:p,machineId:a.machineId??"unknown-machine",serverUrl:a.serverUrl??g,getIdleState:()=>f.getUpgradeIdleState(),startUpgrade:async e=>{const{handleUpgradeStart:i}=await import("./commands/upgrade.js");await i(l,"auto-upgrade",e,{currentVersion:p})}});k.setPolicy(x);const f=new Re(l,y,p,k,new Me({registry:w,observations:I,bindingClient:h,getMachineCredentials:()=>{const e=d();return{machineId:e.machineId,machineToken:e.machineToken}},hostProcessIdentity:()=>`daemon:${m}`}));P=new Ve({registry:w,observations:I,activate:e=>f.activateRoomSession(e),issueManagedRoomContext:e=>{const i=d().machineToken;if(!i)throw new Error("machine_not_authorized");return b.issue({registryKey:e,machineCredential:i})},abort:e=>f.abortRoomSession(e),audit:new Be}),O.mkdirSync(Y,{recursive:!0}),J(process.pid,m,{version:p}),j(process.pid,void 0,m),l.connect(),process.stdin.resume();let V=!1;const B=async()=>{if(!V){V=!0,console.log(v.gray(`
|
|
3
|
+
Disconnecting...`)),S({level:"info",wsEvent:"daemon.stop"}),clearInterval(r);try{await f.cleanup(),k.stop(),y?.stop(),C?.stop(),l.disconnect(),await U.close(),F(process.pid,m),G(m)}finally{process.exit(0)}}};process.on("SIGINT",()=>{B()}),process.on("SIGTERM",()=>{B()})}),t.command("workbuddy-session-hook",{hidden:!0}).description("(retired) WorkBuddy Room Hook").allowUnknownOption(!0).action(()=>$()),t.command("room-session-hook",{hidden:!0}).description("(internal) Authorize the official Room tool for one trusted Agent Session").argument("<runtime>","Trusted runtime adapter").allowUnknownOption(!0).action(()=>$()),t.command("room-tool-server",{hidden:!0}).description("(internal) Run the official Shennian Room MCP tool").allowUnknownOption(!0).action(()=>$());const q=t.command("config").description("View or modify configuration");q.command("show",{isDefault:!0}).description("Show current configuration").action(()=>{console.log(`Config file: ${re()}`);const n={...d()};if(n.machineToken&&(n.machineToken=n.machineToken.slice(0,12)+"..."),n.serverUrl){const r=Ce(n.serverUrl);console.log(`Region: ${r} (${A[r].label})`)}console.log(JSON.stringify(n,null,2))}),q.command("set").description("Update a config value").argument("<key>",'Config key (e.g. "server")').argument("<value>",'Config value (e.g. "cn" or "global")').action((o,n)=>{const r=d();if(o==="server"){n!=="cn"&&n!=="global"&&(console.error(v.red('\u2717 Value must be "cn" or "global"')),process.exit(1));const s=n;r.serverUrl=ye(s),te(r),console.log(v.green(`\u2713 Server set to ${A[s].label}`)),console.log(v.yellow(" Restart the background service for this to take effect: shennian stop && shennian start"));return}console.error(v.red(`\u2717 Unknown config key: ${o}. Supported: server`)),process.exit(1)}),ce(t),ue(t),he(t),fe(t),ve(t),Se(t),t.parse();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParsedNativeEvent } from './types.js';
|
|
2
|
+
export declare function lookupCodexThreadName(sourceSessionKey: string): string | null;
|
|
2
3
|
export declare function listCodexRolloutFiles(): string[];
|
|
3
4
|
export declare function parseCodexRolloutChunk(filePath: string, startOffset: number): {
|
|
4
5
|
nextOffset: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import j from"node:fs";import $ from"node:os";import I from"node:path";import{createHash as Z}from"node:crypto";import{buildApprovalPendingPayload as P,buildUserMessagePayload as N,isSystemControlPayload as M,isToolPayload as q}from"@shennian/wire";import{buildImagePayload as D,buildToolPayload as K,inferMimeType as W,makeCursor as U,makeEventKey as w,normalizeText as h,parseStructuredString as O,readJsonlLines as F,readTimestamp as tt,safeParse as k}from"./parser-common.js";function et(e){if(typeof e=="string"){const i=e.trim();return i?{path:i,name:I.basename(i)||"image.png",mimeType:W(i),kind:"image"}:null}if(typeof e!="object"||e===null)return null;const r=e,n=typeof r.path=="string"?r.path:typeof r.file_path=="string"?r.file_path:typeof r.saved_path=="string"?r.saved_path:"";if(!n.trim())return null;const t=typeof r.name=="string"&&r.name.trim()?r.name:I.basename(n)||"image.png",o=typeof r.mimeType=="string"&&r.mimeType.trim()?r.mimeType:W(n);return{path:n,name:t,mimeType:o,kind:"image"}}function H(e){return Array.isArray(e)?e.map(n=>{if(typeof n=="string")return n;if(typeof n=="object"&&n!==null){const t=n;return typeof t.text=="string"?t.text:""}return""}).map(n=>h(n)).filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`):""}function
|
|
3
|
+
`):""}function z(e){const r=h(e);if(!r)return{text:"",strippedWrapper:!1};const n=r.match(/My request for Codex:\s*([\s\S]*)$/i);return n&&n[1]?{text:nt(n[1]),strippedWrapper:!0}:{text:r,strippedWrapper:!1}}function nt(e){return h(e.replace(/<image>\s*<\/image>/gi,""))}function B(e){const r=h(e);if(!r)return!1;if(M(r)||/^<environment_context>[\s\S]*<\/environment_context>$/i.test(r)&&r.includes("<current_date>")&&r.includes("<timezone>")&&r.includes("<workspace_roots>"))return!0;const n=r.startsWith("<recommended_plugins>")&&r.includes("</recommended_plugins>"),t=r.includes("# AGENTS.md instructions for ")&&r.includes("<INSTRUCTIONS>")&&r.includes("</INSTRUCTIONS>"),o=r.includes("<environment_context>")&&r.includes("</environment_context>");return t&&o&&(r.startsWith("# AGENTS.md instructions for ")||n)}function L(e){const r=H(e.text_elements),n=Array.isArray(e.input)?H(e.input):"",t=typeof e.message=="string"?z(e.message):{text:"",strippedWrapper:!1},o=t.text,i=r||n||o,u=t.strippedWrapper?"codex_app_context_wrapper":void 0,a=Array.isArray(e.local_images)?e.local_images.map(et).filter(f=>f!=null):[];return!i&&a.length===0||M(i)&&a.length===0||B(i)&&a.length===0?null:a.length>0?{payload:N(i,a),titleText:i,repairHint:u}:{payload:i,titleText:i,repairHint:u}}function rt(e){return e==="turn_completed"||e==="turn_complete"||e==="task_complete"}function ot(e){return/approval|permission|confirm|user[_-]?input|input[_-]?required/i.test(e)}function it(e){const r=typeof e.command=="string"?e.command:Array.isArray(e.command)?e.command.join(" "):"",n=typeof e.prompt=="string"?e.prompt:typeof e.reason=="string"?e.reason:typeof e.message=="string"?e.message:r?`Codex \u8BF7\u6C42\u6267\u884C\u547D\u4EE4\uFF1A${r}`:"Codex \u6B63\u5728\u7B49\u5F85\u7528\u6237\u786E\u8BA4\u540E\u7EE7\u7EED\u3002";return P({title:"\u9700\u8981\u7528\u6237\u786E\u8BA4",content:n,source:"codex",actionHint:"\u5F53\u524D\u795E\u5FF5\u6682\u4E0D\u652F\u6301\u8FDC\u7A0B\u786E\u8BA4\uFF0C\u8BF7\u56DE\u5230\u8FD0\u884C Codex \u7684\u7535\u8111/\u7EC8\u7AEF\u5B8C\u6210\u786E\u8BA4\u3002"})}function G(e,r){return Array.isArray(e)?h(e.map(n=>{if(typeof n=="string")return n;if(typeof n!="object"||n===null)return"";const t=n;return t.type!==r?"":typeof t.text=="string"?t.text:""}).filter(Boolean).join(`
|
|
4
4
|
|
|
5
|
-
`)):""}function
|
|
6
|
-
(exit ${String(
|
|
5
|
+
`)):""}function st(e){if(!Array.isArray(e))return[];const r=[];for(const n of e){if(typeof n!="object"||n===null)continue;const t=n;if(t.type!=="input_image")continue;const o=typeof t.path=="string"?t.path:typeof t.file_path=="string"?t.file_path:typeof t.saved_path=="string"?t.saved_path:typeof t.image_path=="string"?t.image_path:"";o.trim()&&r.push({path:o,name:I.basename(o)||"image.png",mimeType:W(o),kind:"image"})}return r}function J(e){if(e.type!=="message")return null;const r=e.role==="assistant"?"agent":e.role==="user"?"user":null;if(!r)return null;if(r==="agent"){const i=G(e.content,"output_text");return M(i)?null:i?{role:r,payload:i,titleText:i}:null}const n=z(G(e.content,"input_text")),t=n.text,o=st(e.content);return!t&&o.length===0||M(t)&&o.length===0||B(t)&&o.length===0?null:{role:r,payload:o.length>0?N(t,o):t,titleText:t,repairHint:n.strippedWrapper?"codex_app_context_wrapper":void 0}}function Q(e){if(!e)return"";try{const r=JSON.parse(e);if(typeof r=="object"&&r!==null){const n=r;if(n.type==="user"&&typeof n.content=="string")return h(n.content)}}catch{}return h(e)}function ct(e,r,n,t){return e.agentType!=="codex"||e.role!==r||q(e.payload)||Math.abs(e.ts-t)>300*1e3?!1:Q(e.payload)===Q(n)}function R(e,r,n,t){for(let o=e.length-1;o>=0;o-=1){const i=e[o];if(i){if(ct(i,r,n,t))return o;if(i.agentType==="codex"&&Math.abs(i.ts-t)>300*1e3)break}}return-1}function v(e,r,n,t,o,i,u,a,f,c,s="agent",l=!1,m){u&&e.push({agentType:"codex",sourceMode:"codex_rollout_import",sourceSessionKey:o,sourceEventKey:w(r,n,t),cursor:U(r,n),role:s,ts:i,payload:u,title:a,modelId:f,workDir:c,terminal:l,repairHint:m})}function x(e,r,n,t,o,i,u,a,f,c,s,l,m){const A=w(r,n,t),y=typeof m?.callId=="string"&&m.callId.trim()?m.callId.trim():null,T=y?Z("sha256").update(`${o}\0${y}`).digest("hex").slice(0,32):null,p=T?`tool:${T}`:void 0,b=T?`native:tool:${T}`:`native:${A}`,g=m?.completed&&T?2:1,S=l!==void 0?"completed":"running";e.push({agentType:"codex",sourceMode:"codex_rollout_import",sourceSessionKey:o,sourceEventKey:A,cursor:U(r,n),role:"agent",ts:i,payload:K({name:u,toolCallId:b,detailRevision:g,status:S}),title:a,modelId:f,workDir:c,...p?{canonicalMessageKey:p,canonicalMutation:m?.completed?"upsert":"append"}:{},localToolDetail:{toolCallId:b,detailRevision:g,name:u,...s!==void 0?{args:s}:{},...l!==void 0?{result:l}:{},status:S}})}function ut(e,r,n,t,o,i,u,a,f){const c=typeof t.type=="string"?t.type:"";if(c){if(c==="message"){const s=J(t);if(!s||R(e,s.role,s.payload,i)>=0)return;v(e,r,n,`${c}:${s.role}`,o,i,s.payload,u,a,f,s.role,!1,s.repairHint);return}if(c==="function_call"){const s=typeof t.name=="string"?t.name:"function_call";x(e,r,n,c,o,i,s,u,a,f,O(t.arguments),void 0,{callId:t.call_id});return}if(c==="function_call_output"){x(e,r,n,c,o,i,"function_call_output",u,a,f,void 0,t.output,{callId:t.call_id,completed:!0});return}if(c==="custom_tool_call"){const s=typeof t.name=="string"?t.name:"custom_tool_call",l=t.input!==void 0?{input:t.input}:void 0;x(e,r,n,c,o,i,s,u,a,f,l,void 0,{callId:t.call_id});return}if(c==="custom_tool_call_output"){const s=typeof t.name=="string"?t.name:"custom_tool_call_output",l=t.output??t.result??t.content;x(e,r,n,c,o,i,s,u,a,f,void 0,l,{callId:t.call_id,completed:!0});return}if(c==="web_search_call"){const s=typeof t.action=="object"&&t.action!==null?t.action:null;x(e,r,n,c,o,i,"web_search",u,a,f,s??t.query);return}}}function at(e,r,n,t,o,i,u,a,f){const c=typeof t.type=="string"?t.type:"";if(c){if(c==="user_message"){const s=L(t);if(!s)return;v(e,r,n,c,o,i,s.payload,u,a,f,"user",!1,s.repairHint);return}if(c==="agent_message"){const s=typeof t.message=="string"?h(t.message):"";if(!s||M(s))return;v(e,r,n,c,o,i,s,u,a,f);return}if(c==="turn_aborted"||c==="error"){const s=typeof t.message=="string"?h(t.message):typeof t.error=="string"?h(t.error):"";if(!s)return;v(e,r,n,c,o,i,s,u,a,f,"agent",!0);return}if(ot(c)){v(e,r,n,c,o,i,it(t),u,a,f,"agent");return}if(c==="exec_command_end"){const s=Array.isArray(t.command)?t.command:t.parsed_cmd??t.command,l=t.exit_code??t.exitCode,m=[typeof t.aggregated_output=="string"?t.aggregated_output:"",l!=null?`
|
|
6
|
+
(exit ${String(l)})`:""].join("");x(e,r,n,c,o,i,"command_execution",u,a,f,{command:s},m);return}if(c==="patch_apply_end"){x(e,r,n,c,o,i,"apply_patch",u,a,f,t.changes,{success:t.success,stdout:t.stdout,stderr:t.stderr});return}if(c==="mcp_tool_call_end"){const s=typeof t.invocation=="object"&&t.invocation!==null?t.invocation:null,l=typeof s?.tool=="string"?s.tool:"mcp_tool_call",m={server:s?.server,...typeof s?.arguments=="object"&&s.arguments!==null?s.arguments:{}};x(e,r,n,c,o,i,l,u,a,f,m,t.result);return}if(c==="dynamic_tool_call_request"){const s=typeof t.tool=="string"?t.tool:"dynamic_tool_call";x(e,r,n,c,o,i,s,u,a,f,t.arguments,void 0,{callId:t.callId??t.call_id});return}if(c==="dynamic_tool_call_response"){const s=typeof t.tool=="string"?t.tool:"dynamic_tool_call";x(e,r,n,c,o,i,s,u,a,f,void 0,t.result??t.output,{callId:t.callId??t.call_id,completed:!0});return}if(c==="web_search_end"){const s=typeof t.action=="object"&&t.action!==null?t.action:null;x(e,r,n,c,o,i,"web_search",u,a,f,s??t.query,t.query);return}if(c==="image_generation_end"){const s=typeof t.saved_path=="string"?t.saved_path.trim():"";if(!s)return;v(e,r,n,c,o,i,D(s),u,a,f);return}c==="view_image_tool_call"&&x(e,r,n,c,o,i,"view_image",u,a,f,t.path??t.image_path??t)}}function E(e=!1){return{sourceSessionKey:"",workDir:"",modelId:null,title:"",skipImport:e}}function V(e){if((typeof e.thread_source=="string"?e.thread_source.trim().toLowerCase():"")==="subagent")return!0;const n=typeof e.source=="object"&&e.source!==null?e.source:null;if(n&&typeof n.subagent=="object"&&n.subagent!==null)return!0;const t=typeof e.parent_thread_id=="string"&&e.parent_thread_id.trim().length>0,o=typeof e.agent_nickname=="string"||typeof e.agent_role=="string"||typeof e.multi_agent_version=="string";return t&&o}function ft(e){const r=j.openSync(e,"r");try{const n=[];let t=0,o="";for(;t<1024*1024;){const f=Buffer.alloc(16384),c=j.readSync(r,f,0,f.length,t);if(c<=0)break;const s=f.subarray(0,c);n.push(s),t+=c;const l=Buffer.concat(n),m=l.indexOf(10);if(m>=0){o=l.subarray(0,m).toString("utf8");break}}!o&&n.length>0&&(o=Buffer.concat(n).toString("utf8"));const i=k(o);if(!i||i.type!=="session_meta")return E();const u=typeof i.payload=="object"&&i.payload!==null?i.payload:null;if(!u)return E();if(V(u))return E(!0);const a=typeof u.id=="string"?u.id:"";return{sourceSessionKey:a,workDir:typeof u.cwd=="string"?u.cwd:"",modelId:X(u),title:Y(a)??"",skipImport:!1}}finally{j.closeSync(r)}return E()}function X(e){return(typeof e.model=="string"?e.model.trim():"")||null}function lt(e,r){if((typeof e.id=="string"?e.id:typeof e.thread_id=="string"?e.thread_id:typeof e.session_id=="string"?e.session_id:"")!==r)return null;const o=(typeof e.thread_name=="string"?e.thread_name:typeof e.title=="string"?e.title:"").trim();return o?o.slice(0,120):null}function Y(e){if(!e)return null;const r=I.join($.homedir(),".codex","session_index.jsonl");if(!j.existsSync(r))return null;let n=null;return F(r,0,t=>{if(!t.trim())return;const o=k(t);if(!o)return;const i=lt(o,e);i&&(n=i)}),n}function ht(){const e=[I.join($.homedir(),".codex","sessions"),I.join($.homedir(),".codex","archived_sessions")],r=[],n=t=>{for(const o of j.readdirSync(t,{withFileTypes:!0})){const i=I.join(t,o.name);o.isDirectory()?n(i):o.isFile()&&o.name.endsWith(".jsonl")&&r.push(i)}};for(const t of e)j.existsSync(t)&&n(t);return[...new Set(r)].sort()}function yt(e,r){const n=[],t=ft(e);let{sourceSessionKey:o,workDir:i,modelId:u,title:a,skipImport:f}=t,c=t.title;if(f)return{nextOffset:j.statSync(e).size,events:[]};let s=!1;const l=F(e,r,(m,A)=>{const y=k(m);if(!y)return;const T=typeof y.type=="string"?y.type:"",p=typeof y.payload=="object"&&y.payload!==null?y.payload:null,b=tt(y.timestamp);if(!(!p||!b)){if(T==="session_meta"){if(V(p)){n.length=0,f=!0;return}o=typeof p.id=="string"?p.id:o,i=typeof p.cwd=="string"?p.cwd:i,u=X(p)??u;const g=Y(o);g&&(c=g,a=g);return}if(!f&&o){if(T==="response_item"){const g=J(p);g?.role==="user"&&g.titleText&&!a&&(a=g.titleText.slice(0,80)),ut(n,e,A,p,o,b,a,u,i);return}if(T==="event_msg"){const g=typeof p.type=="string"?p.type:"";if(rt(g)){let d=!1;for(let _=n.length-1;_>=0;_-=1){const C=n[_];if(C?.agentType==="codex"&&C.role==="agent"&&!q(C.payload)){C.terminal=!0,d=!0,s=!1;break}}if(!d)for(let _=n.length-1;_>=0;_-=1){const C=n[_];if(!(C?.agentType!=="codex"||C.role!=="agent")){C.terminal=!0,d=!0,s=!1;break}}d||(s=!0);return}if(g==="user_message"){const d=L(p);if(d?.titleText&&!a&&(a=d.titleText.slice(0,80)),d){const _=R(n,"user",d.payload,b);_>=0&&n.splice(_,1)}}else if(g==="agent_message"){const d=typeof p.message=="string"?h(p.message):"";if(d&&!M(d)){const _=R(n,"agent",d,b);_>=0&&n.splice(_,1)}}const S=n.length;at(n,e,A,p,o,b,a,u,i),s&&n.length>S&&(n[n.length-1].terminal=!0,s=!1)}}}});for(const m of n)m.titleSource=c&&m.title===c?"agent_native":"first_user_fallback";return{nextOffset:l,events:n}}export{ht as listCodexRolloutFiles,Y as lookupCodexThreadName,yt as parseCodexRolloutChunk};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type WatchHandle = {
|
|
2
|
+
close(): void;
|
|
3
|
+
};
|
|
4
|
+
type WatchListener = (eventType: string, filename: string | Buffer | null) => void;
|
|
5
|
+
type WatchFactory = (directory: string, listener: WatchListener) => WatchHandle;
|
|
6
|
+
export declare class NativeFusionFileWatcher {
|
|
7
|
+
private onChanged;
|
|
8
|
+
private watchFactory;
|
|
9
|
+
private watchers;
|
|
10
|
+
private filesByDirectory;
|
|
11
|
+
private debounceTimers;
|
|
12
|
+
constructor(onChanged: (filePaths: string[]) => void, watchFactory?: WatchFactory);
|
|
13
|
+
refresh(filePaths: readonly string[]): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
private handleChange;
|
|
16
|
+
private schedule;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import h from"node:fs";import i from"node:path";const a=250;class f{onChanged;watchFactory;watchers=new Map;filesByDirectory=new Map;debounceTimers=new Map;constructor(t,s=(e,o)=>h.watch(e,o)){this.onChanged=t,this.watchFactory=s}refresh(t){const s=new Map;for(const e of t){const o=i.dirname(e),r=s.get(o)??new Set;r.add(e),s.set(o,r)}for(const[e,o]of this.watchers.entries())s.has(e)||(o.close(),this.watchers.delete(e));this.filesByDirectory=s;for(const e of s.keys())if(!this.watchers.has(e))try{const o=this.watchFactory(e,(r,n)=>{this.handleChange(e,n)});this.watchers.set(e,o)}catch(o){console.warn(`[native-fusion] unable to watch ${e}`,o)}}stop(){for(const t of this.watchers.values())t.close();this.watchers.clear(),this.filesByDirectory.clear();for(const t of this.debounceTimers.values())clearTimeout(t);this.debounceTimers.clear()}handleChange(t,s){const e=s?i.join(t,s.toString()):null,o=e&&d(e)?[e]:[...this.filesByDirectory.get(t)??[]];for(const r of o)this.schedule(r)}schedule(t){const s=this.debounceTimers.get(t);s&&clearTimeout(s);const e=setTimeout(()=>{this.debounceTimers.delete(t),this.onChanged([t])},a);this.debounceTimers.set(t,e)}}function d(c){return c.endsWith(".jsonl")||c.endsWith(".opencode-session.json")}export{f as NativeFusionFileWatcher};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CanonicalSessionStore } from '../session/canonical-store.js';
|
|
2
|
+
import { listSessionRecords, recordSession } from '../session/store.js';
|
|
3
|
+
import type { ParsedNativeEvent } from './types.js';
|
|
4
|
+
import { type LocalToolDetail } from '../session/tool-detail-store.js';
|
|
5
|
+
declare const SCHEMA_VERSION: 1;
|
|
6
|
+
export declare class MissingUserBoundaryError extends Error {
|
|
7
|
+
readonly code = "missing_user_boundary";
|
|
8
|
+
constructor(sourceSessionKey: string);
|
|
9
|
+
}
|
|
10
|
+
type SourceBinding = {
|
|
11
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
|
12
|
+
daemonInstallationId: string;
|
|
13
|
+
sessionId: string;
|
|
14
|
+
agentType: ParsedNativeEvent['agentType'];
|
|
15
|
+
sourceSessionKey: string;
|
|
16
|
+
sourceMode: ParsedNativeEvent['sourceMode'];
|
|
17
|
+
lastCursor: string | null;
|
|
18
|
+
bodyRevision: number;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
};
|
|
22
|
+
export type NativeLocalCommitResult = {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
messageId: string;
|
|
25
|
+
bodyRevision: number;
|
|
26
|
+
duplicate: boolean;
|
|
27
|
+
claimed: boolean;
|
|
28
|
+
};
|
|
29
|
+
type RecordSessionInput = Parameters<typeof recordSession>[0];
|
|
30
|
+
export declare class NativeFusionLocalRepository {
|
|
31
|
+
private options;
|
|
32
|
+
constructor(options?: {
|
|
33
|
+
rootDir?: string;
|
|
34
|
+
daemonInstallationId?: string;
|
|
35
|
+
canonicalStore?: CanonicalSessionStore;
|
|
36
|
+
recordLocalSession?: (input: RecordSessionInput) => unknown;
|
|
37
|
+
listLocalSessions?: typeof listSessionRecords;
|
|
38
|
+
writeLocalToolDetail?: (detail: Omit<LocalToolDetail, 'schemaVersion'>) => void;
|
|
39
|
+
readLocalToolDetail?: (sessionId: string, toolCallId: string) => LocalToolDetail | null;
|
|
40
|
+
});
|
|
41
|
+
commitEvents(events: readonly ParsedNativeEvent[]): NativeLocalCommitResult[];
|
|
42
|
+
commitEvent(event: ParsedNativeEvent): NativeLocalCommitResult;
|
|
43
|
+
listSourceBindings(): SourceBinding[];
|
|
44
|
+
observeNativeTitle(agentType: ParsedNativeEvent['agentType'], sourceSessionKey: string, titleValue: string): boolean;
|
|
45
|
+
private recordIndex;
|
|
46
|
+
private readSources;
|
|
47
|
+
private installationId;
|
|
48
|
+
private canonicalStore;
|
|
49
|
+
private rootDir;
|
|
50
|
+
private sourcesFile;
|
|
51
|
+
private ledgerFile;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import d from"node:crypto";import c from"node:fs";import w from"node:path";import{resolvePersonalSyncV1Path as N}from"../personal-sync/paths.js";import{getCanonicalSessionStore as O,getDaemonInstallationId as k,listSessionRecords as B,recordSession as T}from"../session/store.js";import{readToolDetail as H,writeToolDetail as J}from"../session/tool-detail-store.js";const h=1;class L extends Error{code="missing_user_boundary";constructor(e){super(`native source ${e} does not start at a visible user boundary`),this.name="MissingUserBoundaryError"}}class Y{options;constructor(e={}){this.options=e}commitEvents(e){return[...e].sort((t,o)=>t.ts-o.ts).map(t=>this.commitEvent(t))}commitEvent(e){R(e);const t=this.installationId(),o=this.readSources(),i=K(e.agentType,e.sourceSessionKey),r=o.sources[i],l=j(e),g=this.ledgerFile(e.agentType,e.sourceEventKey),n=c.existsSync(g)?b(g):null;if(n&&n.eventFingerprint!==l)throw new Error(`native event identity conflict: ${e.sourceEventKey}`);if(!r&&!n&&e.role!=="user")throw new L(e.sourceSessionKey);const p=e.claimSessionId??null,a=r?.sessionId??n?.sessionId??p??A(t,e.agentType,e.sourceSessionKey);if(p&&r&&r.sessionId!==p)throw new Error(`managed claim session conflicts with source binding ${e.sourceSessionKey}`);const m=this.canonicalStore(),u=e.claimCanonicalMessageId??V(t,e.agentType,e.canonicalMessageKey??e.sourceEventKey);let f=m.getManifest(a)?.bodyRevision??0,$=!!n;const S=!!e.claimCanonicalMessageId;if(S){const y=m.getMessageState(a,u);if(!y||y.tombstoned)throw new Error(`managed echo claim target is not durable: ${u}`)}if(!n&&!S){const y=e.canonicalMutation==="upsert"?m.getMessageState(a,u):null,E={id:u,sessionId:a,role:e.role,ts:y?.message?.ts??e.ts,payload:U(y?.message?.payload,e.payload)},M=e.canonicalMutation==="upsert"?m.upsert(a,E):m.append(a,E);if(f=M.bodyRevision,$=M.duplicate,e.localToolDetail){const _=this.options.writeLocalToolDetail??J,C=this.options.readLocalToolDetail??H,F=P(C(a,e.localToolDetail.toolCallId),e.localToolDetail);_({sessionId:a,...F,ts:e.ts,detailRef:{toolIndex:0}})}}n||this.recordIndex(e,a);const I=new Date().toISOString();return n||x(g,{schemaVersion:h,daemonInstallationId:t,sessionId:a,agentType:e.agentType,sourceSessionKey:e.sourceSessionKey,sourceEventKey:e.sourceEventKey,eventFingerprint:l,canonicalMessageId:u,canonicalRevision:f,cursor:e.cursor??null,mappedBy:S?"managed_echo_claim":e.sourceMode,eventTs:e.ts,createdAt:I}),o.sources[i]={schemaVersion:h,daemonInstallationId:t,sessionId:a,agentType:e.agentType,sourceSessionKey:e.sourceSessionKey,sourceMode:n?r?.sourceMode??e.sourceMode:e.sourceMode,lastCursor:n?r?.lastCursor??n.cursor:e.cursor??r?.lastCursor??null,bodyRevision:f,createdAt:r?.createdAt??I,updatedAt:I},x(this.sourcesFile(),o),{sessionId:a,messageId:u,bodyRevision:f,duplicate:$,claimed:S}}listSourceBindings(){return Object.values(this.readSources().sources)}observeNativeTitle(e,t,o){const i=o.trim().slice(0,120);if(!i)return!1;const r=this.readSources().sources[K(e,t)];if(!r)return!1;const l=(this.options.listLocalSessions??B)().find(p=>p.sessionId===r.sessionId);if(l?.titleLockedByUser||l?.titleSource==="agent_native"&&l.title===i)return!1;const g=d.createHash("sha256").update(`${e}\0${t}\0${i}`).digest("hex");return(this.options.recordLocalSession??T)({sessionId:r.sessionId,agentType:r.agentType,workDir:l?.workDir??"",agentSessionId:t,title:i,titleSource:"agent_native",titleOriginEventId:`agent-native:${g}`}),!0}recordIndex(e,t){(this.options.recordLocalSession??T)({sessionId:t,agentType:e.agentType,workDir:e.workDir??"",agentSessionId:e.sourceSessionKey,modelId:e.modelId??null,status:e.terminal?"completed":"active",lastActivityAt:new Date(e.ts).toISOString(),lastMessagePreview:e.role==="user"?D(e.payload):void 0,title:e.title?.trim()||(e.role==="user"?D(e.payload)??"":void 0),titleSource:e.title?.trim()?e.titleSource??"first_user_fallback":"first_user_fallback",titleOriginEventId:e.sourceEventKey})}readSources(){const e=this.sourcesFile();if(!c.existsSync(e))return{schemaVersion:h,daemonInstallationId:this.installationId(),sources:{}};const t=b(e);if(t.schemaVersion!==h||t.daemonInstallationId!==this.installationId()||!t.sources)throw new Error("invalid native source binding store");return t}installationId(){return this.options.daemonInstallationId??k()}canonicalStore(){return this.options.canonicalStore??O()}rootDir(){return this.options.rootDir??N("native-fusion")}sourcesFile(){return w.join(this.rootDir(),"sources.json")}ledgerFile(e,t){const o=d.createHash("sha256").update(`${e}\0${t}`).digest("hex");return w.join(this.rootDir(),"ledger",`${o}.json`)}}function R(s){if(!s.agentType||!s.sourceSessionKey||!s.sourceEventKey||!s.payload)throw new Error("invalid native event");if(!Number.isFinite(s.ts))throw new Error("invalid native event timestamp")}function K(s,e){return d.createHash("sha256").update(`${s}\0${e}`).digest("hex")}function A(s,e,t){return`native-session-${d.createHash("sha256").update(`${s}\0${e}\0${t}`).digest("hex").slice(0,32)}`}function V(s,e,t){return`native-${d.createHash("sha256").update(`${s}\0${e}\0${t}`).digest("hex").slice(0,32)}`}function j(s){return d.createHash("sha256").update(JSON.stringify({agentType:s.agentType,sourceSessionKey:s.sourceSessionKey,sourceEventKey:s.sourceEventKey,role:s.role,ts:s.ts,payload:s.payload,claimCanonicalMessageId:s.claimCanonicalMessageId??null,claimSessionId:s.claimSessionId??null,canonicalMessageKey:s.canonicalMessageKey??null,canonicalMutation:s.canonicalMutation??"append"})).digest("hex")}function U(s,e){if(!s)return e;try{const t=JSON.parse(s),o=JSON.parse(e);if(t.type!=="tool"||o.type!=="tool"||t.toolCallId!==o.toolCallId)return e;const i=typeof o.name=="string"?o.name:"",r=/(?:_output|_result)$/.test(i);return JSON.stringify({...t,...o,...r&&typeof t.name=="string"?{name:t.name}:{}})}catch{return e}}function P(s,e){if(!s||s.toolCallId!==e.toolCallId)return e;const t=/(?:_output|_result)$/.test(e.name);return{...e,name:t?s.name:e.name,...e.args===void 0&&s.args!==void 0?{args:s.args}:{},...e.result===void 0&&s.result!==void 0?{result:s.result}:{}}}function D(s){const e=s.replace(/\s+/g," ").trim();return e?e.length>120?`${e.slice(0,120)}...`:e:null}function x(s,e){const t=w.dirname(s);c.mkdirSync(t,{recursive:!0,mode:448});const o=`${s}.tmp-${process.pid}-${d.randomBytes(6).toString("hex")}`;let i;try{i=c.openSync(o,"wx",384),c.writeFileSync(i,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,"utf8"),c.fsyncSync(i),c.closeSync(i),i=void 0,c.renameSync(o,s)}finally{i!==void 0&&c.closeSync(i);try{c.unlinkSync(o)}catch{}}}function b(s){return JSON.parse(c.readFileSync(s,"utf8"))}export{L as MissingUserBoundaryError,Y as NativeFusionLocalRepository};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import d from"node:fs";import
|
|
1
|
+
import d from"node:fs";import _ from"node:os";import u from"node:path";import{resolveBuiltinCommand as S,spawnResolvedCommandSync as v}from"../agents/command-spec.js";import{normalizeNativeTimestamp as f}from"./session-header.js";function l(t){try{const e=JSON.parse(t);return typeof e=="object"&&e!==null?e:null}catch{return null}}function O(t){return t.filter(e=>e.type==="text"||e.type==="reasoning").map(e=>typeof e.text=="string"?e.text:"").filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`).trim()}function h(t,e,s,r,c,n,i,o){n
|
|
3
|
+
`).trim()}function h(t,e,s,r,c,n,i,o){if(!n)return;const a=f(r.time_created),p=f(s.time_created);!a||!p||t.push({agentType:"opencode",sourceMode:"opencode_session_import",sourceSessionKey:s.id,sourceEventKey:`opencode:${s.id}:${r.id}:${c}`,cursor:`${e}:${r.time_created}:${r.id}`,role:c,ts:a,payload:n,title:s.title,titleSource:"agent_native",modelId:i,workDir:s.directory,terminal:o,sourceSessionCreatedAtMs:p})}function x(t,e){const s=[],r=new Map(e.sessions.map(n=>[n.id,n])),c=new Map;for(const n of e.parts){const i=l(n.data);if(!i)continue;const o=c.get(n.message_id)??[];o.push(i),c.set(n.message_id,o)}for(const n of[...e.messages].sort((i,o)=>i.time_created-o.time_created)){const i=r.get(n.session_id);if(!i)continue;const o=l(n.data);if(!o)continue;const a=o.role==="user"?"user":o.role==="assistant"?"agent":null;if(!a)continue;const p=c.get(n.id)??[],y=O(p),g=typeof o.modelID=="string"?`${typeof o.providerID=="string"?`${o.providerID}/`:""}${o.modelID}`:null;h(s,t,i,n,a,y,g,a==="agent")}return s}function I(){const t=u.join(_.homedir(),".local","share","opencode"),e=u.join(t,"shennian-opencode-session-snapshot.opencode-session.json");return C(e),d.existsSync(e)?[e]:[]}function m(t){const e=S("opencode");if(!e)return[];const s=v(e,["db",t,"--format","json"],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:1e4});if(s.status!==0)return[];try{const r=JSON.parse(String(s.stdout??""));return Array.isArray(r)?r:[]}catch{return[]}}function C(t){try{const e=m("select id, title, directory, time_created, time_updated from session where time_archived is null order by time_updated asc");if(e.length===0)return;const s=m("select id, session_id, time_created, data from message order by time_created asc, id asc"),r=m("select id, message_id, session_id, time_created, data from part order by message_id asc, id asc");d.mkdirSync(u.dirname(t),{recursive:!0}),d.writeFileSync(t,JSON.stringify({sessions:e,messages:s,parts:r}))}catch{}}function z(t,e){const s=d.statSync(t);if(e>=s.size)return{nextOffset:s.size,events:[]};if(e>0)return{nextOffset:s.size,events:[]};const r=JSON.parse(d.readFileSync(t,"utf8"));return{nextOffset:s.size,events:x(t,r)}}export{I as listOpenCodeSessionFiles,z as parseOpenCodeSessionFile,x as parseOpenCodeSessionSnapshot};
|
|
@@ -15,7 +15,13 @@ export declare function makeEventKey(filePath: string, offset: number, kind: str
|
|
|
15
15
|
export declare function safeStringify(value: unknown): string;
|
|
16
16
|
export declare function normalizeToolText(text: string): string;
|
|
17
17
|
export declare function parseStructuredString(value: unknown): unknown;
|
|
18
|
-
export declare function buildToolPayload(
|
|
18
|
+
export declare function buildToolPayload(input: {
|
|
19
|
+
name: string;
|
|
20
|
+
toolCallId: string;
|
|
21
|
+
detailRevision: number;
|
|
22
|
+
status: 'running' | 'completed' | 'failed';
|
|
23
|
+
durationMs?: number;
|
|
24
|
+
}): string;
|
|
19
25
|
export declare function escapeMarkdownLabel(label: string): string;
|
|
20
26
|
export declare function buildMarkdownImageRef(filePath: string, label?: string): string;
|
|
21
27
|
export declare function buildImagePayload(filePath: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createHash as
|
|
2
|
-
`).trim())}const
|
|
3
|
-
`).replace(/\n+$/g,""):""}function v(e){if(typeof e!="string")return null;const t=Date.parse(e);return Number.isFinite(t)?t:null}function
|
|
4
|
-
`).trim()}function
|
|
1
|
+
import{createHash as I}from"node:crypto";import m from"node:fs";import T from"node:os";import n from"node:path";const x=64*1024*1024,S=["/root/.claude-mem/observer-session"],N=S.map(z);function j(e){return _(e.replace(/\r\n/g,`
|
|
2
|
+
`).trim())}const E=/^\s*::git-[a-z-]+\{[^\n]*\}\s*$/gm;function _(e){if(!e)return"";if(!/(^|\n)\s*::git-[a-z-]+\{[^\n]*\}\s*(?=\n|$)/.test(e))return e;const r=e.replace(E,"");return r.trim()?r.replace(/[ \t]+\n/g,`
|
|
3
|
+
`).replace(/\n+$/g,""):""}function v(e){if(typeof e!="string")return null;const t=Date.parse(e);return Number.isFinite(t)?t:null}function B(e){try{const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:null}catch{return null}}function J(e,t,r){const u=m.statSync(e).size;if(t>=u)return u;const h=m.openSync(e,"r");try{const y=Buffer.allocUnsafe(262144);let l=t,f=t,c=Buffer.alloc(0),p=!1;for(;l<u;){const d=m.readSync(h,y,0,Math.min(262144,u-l),l);if(d<=0)break;l+=d;let a=y.subarray(0,d);c.length>0&&(a=Buffer.concat([c,a]),c=Buffer.alloc(0));let s=0;for(;s<a.length;){const i=a.indexOf(10,s);if(i<0)break;const g=a.subarray(s,i),C=f;f+=i-s+1,s=i+1,!p&&g.length>0&&g.length<=x&&r(g.toString("utf8"),C),p=!1}if(s<a.length){const i=a.subarray(s);p||i.length>x?(p=!0,f+=i.length,c=Buffer.alloc(0)):c=Buffer.from(i)}}return f}finally{m.closeSync(h)}}function M(e){return typeof e.cwd=="string"&&e.cwd.trim()?e.cwd:null}function F(e){return n.basename(n.dirname(e))==="subagents"}function b(e){const t=n.resolve(e);return process.platform==="win32"?t.toLowerCase():t}function w(e,t){const r=b(e),o=b(t);return r===o||r.startsWith(o+n.sep)}function z(e){return n.resolve(e).replace(/\//g,"-")}function G(e){return S.some(t=>w(e,t))}function D(e){return N.includes(e)}function U(e){const t=n.join(T.homedir(),".claude","projects"),r=n.relative(t,e);if(!r||r.startsWith("..")||n.isAbsolute(r))return!1;const[o]=r.split(n.sep);return o?D(o):!1}function V(e,t){return`${e}:${t}`}function H(e,t,r){return`${I("sha1").update(e).digest("hex").slice(0,16)}:${t}:${r}`}function W(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function K(e){return e.replace(/\r\n/g,`
|
|
4
|
+
`).trim()}function X(e){if(typeof e!="string")return e;const t=e.trim();if(!t)return"";try{return JSON.parse(t)}catch{return e}}function Y(e){const t={v:1,type:"tool",name:e.name,toolCallId:e.toolCallId,detailRevision:e.detailRevision,status:e.status,resultOmitted:!0,detailAvailable:!0,...e.durationMs!==void 0?{durationMs:e.durationMs}:{}};return JSON.stringify(t)}function O(e){return e.replace(/[[\]\\]/g,"\\$&")}function k(e,t="Generated image"){return``}function q(e){const t=n.basename(e)||"generated-image.png";return JSON.stringify({v:1,type:"image",content:k(e,t),attachments:[{path:e,name:t,mimeType:"image/png",kind:"image"}]})}function Q(e){const t=n.extname(e).toLowerCase();return t===".png"?"image/png":t===".jpg"||t===".jpeg"?"image/jpeg":t===".webp"?"image/webp":t===".gif"?"image/gif":"application/octet-stream"}export{q as buildImagePayload,k as buildMarkdownImageRef,Y as buildToolPayload,z as encodeClaudeProjectDir,O as escapeMarkdownLabel,Q as inferMimeType,F as isClaudeSubagentTranscript,w as isSameOrChildPath,V as makeCursor,H as makeEventKey,b as normalizePathForCompare,j as normalizeText,K as normalizeToolText,X as parseStructuredString,M as readClaudeEventCwd,J as readJsonlLines,v as readTimestamp,B as safeParse,W as safeStringify,D as shouldIgnoreClaudeProjectDir,U as shouldIgnoreClaudeTranscriptPath,G as shouldIgnoreNativeScanPath};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ParsedNativeEvent } from './types.js';
|
|
2
|
-
export { listCodexRolloutFiles, parseCodexRolloutChunk } from './codex-parser.js';
|
|
2
|
+
export { listCodexRolloutFiles, lookupCodexThreadName, parseCodexRolloutChunk, } from './codex-parser.js';
|
|
3
|
+
export { inspectNativeSessionFile, normalizeNativeTimestamp } from './session-header.js';
|
|
3
4
|
export { listOpenCodeSessionFiles, parseOpenCodeSessionFile, parseOpenCodeSessionSnapshot, type OpenCodeSnapshot, } from './opencode-parser.js';
|
|
4
5
|
export declare function listClaudeTranscriptFiles(): string[];
|
|
5
6
|
export declare function lookupClaudeTranscriptCwd(sourceSessionKey: string): string | null;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import g from"node:fs";import
|
|
1
|
+
import g from"node:fs";import x from"node:os";import l from"node:path";import{listCodexRolloutFiles as q,lookupCodexThreadName as G,parseCodexRolloutChunk as H}from"./codex-parser.js";import{inspectNativeSessionFile as U,normalizeNativeTimestamp as V}from"./session-header.js";import{listOpenCodeSessionFiles as Y,parseOpenCodeSessionFile as Z,parseOpenCodeSessionSnapshot as $}from"./opencode-parser.js";import{makeCursor as j,makeEventKey as h,normalizeText as k,readClaudeEventCwd as S,readJsonlLines as v,readTimestamp as w,safeParse as T,isClaudeSubagentTranscript as D,shouldIgnoreClaudeProjectDir as z,shouldIgnoreClaudeTranscriptPath as E,shouldIgnoreNativeScanPath as b}from"./parser-common.js";function I(e){const n=x.homedir();return e.startsWith(n)?e.slice(n.length).replace(/^\//,"")||"~":e.replace(/\//g,"-")}function N(){const e=l.join(x.homedir(),".claude","projects");if(!g.existsSync(e))return[];const n=[],o=t=>{for(const r of g.readdirSync(t,{withFileTypes:!0})){const i=l.join(t,r.name);if(r.isDirectory()){if(t===e&&z(r.name))continue;o(i)}else r.isFile()&&r.name.endsWith(".jsonl")&&n.push(i)}};return o(e),n.sort()}function R(e){if(!e)return null;const n=N().find(t=>l.basename(t,".jsonl")===e);if(!n)return null;let o=null;return v(n,0,t=>{if(o||!t.trim())return;const r=T(t);if(!r)return;const i=S(r);i&&(o=i)}),o}function B(e,n){const o=g.statSync(e).size;if(D(e)||E(e))return{nextOffset:o,events:[]};const t=[],r=l.basename(e,".jsonl"),i=I(l.dirname(e).replace(l.join(x.homedir(),".claude","projects")+l.sep,""));if(b(i))return{nextOffset:o,events:[]};let u="";return{nextOffset:v(e,n,(_,p)=>{const s=T(_);if(!s)return;const d=w(s.timestamp),y=typeof s.type=="string"?s.type:"";if(!d||!y)return;const m=S(s);if(!(m&&b(m))){if(y==="user"){const a=typeof s.message=="object"&&s.message!==null?s.message:null,c=typeof a?.content=="string"?k(a.content):"";if(!c)return;u||(u=c.slice(0,80)),t.push({agentType:"claude",sourceMode:"claude_transcript_import",sourceSessionKey:r,sourceEventKey:h(e,p,"user"),cursor:j(e,p),role:"user",ts:d,payload:c,title:u,titleSource:"first_user_fallback",workDir:m??i})}else if(y==="assistant"){const a=typeof s.message=="object"&&s.message!==null?s.message:null,c=Array.isArray(a?.content)?a.content:[],C=k(c.map(f=>typeof f=="object"&&f!==null&&typeof f.text=="string"?f.text:"").filter(Boolean).join(`
|
|
2
2
|
|
|
3
|
-
`));if(!
|
|
3
|
+
`));if(!C)return;const F=typeof a?.model=="string"?a.model:null;t.push({agentType:"claude",sourceMode:"claude_transcript_import",sourceSessionKey:r,sourceEventKey:h(e,p,"assistant"),cursor:j(e,p),role:"agent",ts:d,payload:C,title:u,titleSource:"first_user_fallback",modelId:F,workDir:m??i})}}}),events:t}}export{U as inspectNativeSessionFile,N as listClaudeTranscriptFiles,q as listCodexRolloutFiles,Y as listOpenCodeSessionFiles,R as lookupClaudeTranscriptCwd,G as lookupCodexThreadName,V as normalizeNativeTimestamp,B as parseClaudeTranscriptChunk,H as parseCodexRolloutChunk,Z as parseOpenCodeSessionFile,$ as parseOpenCodeSessionSnapshot};
|