@mclawnet/agent 0.6.10 → 0.6.12

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=skill-sync.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-sync.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/skill-sync.test.ts"],"names":[],"mappings":""}
@@ -13,6 +13,12 @@ export interface BackendProcess {
13
13
  workDir: string;
14
14
  /** Kill the backend process */
15
15
  kill(): Promise<void>;
16
+ /**
17
+ * Whether the backend process is still alive and capable of accepting input.
18
+ * Returns false if the process has exited, is being killed, or its stdin is no
19
+ * longer writable. Used by SessionManager.isHealthy() to detect stale entries.
20
+ */
21
+ isAlive(): boolean;
16
22
  }
17
23
  export interface SpawnOptions {
18
24
  /** ClawNet session ID */
@@ -55,5 +61,34 @@ export interface BackendAdapter {
55
61
  }) => void): void;
56
62
  /** Register error handler */
57
63
  onError?(process: BackendProcess, handler: (error: Error) => void): void;
64
+ /**
65
+ * Register a handler that fires the moment the backend reports its session
66
+ * is initialized (e.g. Claude CLI's `system/init` frame). Used by hub to
67
+ * persist `claudeSessionId` early — without this we have to wait for
68
+ * `turn_complete`, and a mid-turn crash would leave db's claudeSessionId
69
+ * NULL despite a valid jsonl file existing on disk.
70
+ *
71
+ * Optional: adapters that don't implement this lose the early-backfill
72
+ * capability — db's claudeSessionId will only be populated on
73
+ * `turn_complete`, so any session whose first turn crashes will be
74
+ * unrecoverable via `--resume`. Other backends (codex, openclaw) should
75
+ * implement this if they have an analogous "session ready" signal.
76
+ */
77
+ onSessionStarted?(process: BackendProcess, handler: (info: {
78
+ claudeSessionId: string;
79
+ }) => void): void;
80
+ /**
81
+ * Register a handler that fires when the underlying process exits on its
82
+ * own (crash, EPIPE, OOM, manual SIGKILL from outside) — *not* when we
83
+ * deliberately call kill() ourselves. Used by SessionManager to auto-evict
84
+ * dead Map entries and notify hub via onSessionError.
85
+ *
86
+ * Optional: adapters that don't implement this lose auto-eviction —
87
+ * SessionManager's Map will keep the dead entry, isHealthy() will still
88
+ * fall back to BackendProcess.isAlive() so the unhealthy-fallback-resume
89
+ * branch in hub-connection.ts still works, but the orphan Map entry will
90
+ * accumulate until the next abortSession/closeSession call.
91
+ */
92
+ onExit?(process: BackendProcess, handler: (code: number | null) => void): void;
58
93
  }
59
94
  //# sourceMappingURL=backend-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend-adapter.d.ts","sourceRoot":"","sources":["../src/backend-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEtD,qCAAqC;IACrC,IAAI,CAAC,OAAO,EAAE,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