@staix/agent-hub 0.48.4 → 0.49.1

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 (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/docs/agent-notes/daemon.md +2 -2
  4. package/docs/agent-notes/tasks.md +1 -1
  5. package/docs/design/adapters.md +5 -7
  6. package/docs/design/agent-hub-architecture.md +2 -1
  7. package/docs/design/agent-hub.md +2 -1
  8. package/docs/design/bus.md +3 -2
  9. package/docs/design/cli-output-inventory.md +39 -38
  10. package/docs/design/cli-output.md +9 -4
  11. package/docs/design/execution-reference.md +1 -0
  12. package/docs/design/guidance-experiments.md +4 -1
  13. package/docs/design/guidance-probes.md +34 -31
  14. package/docs/design/model-routes.md +12 -14
  15. package/docs/design/roadmap.md +11 -9
  16. package/docs/design/supervision.md +7 -6
  17. package/docs/design/task-board.md +3 -2
  18. package/docs/dogfood.md +1 -1
  19. package/docs/memory.md +3 -3
  20. package/docs/operations.md +14 -9
  21. package/docs/quickstart.md +20 -2
  22. package/docs/roadmap.json +519 -1
  23. package/docs/roadmap.md +94 -0
  24. package/docs/security.md +4 -2
  25. package/docs/verification/2026-11-26-compat-pi-1.6.1.md +28 -0
  26. package/docs/verification/2026-11-28-0.49.0.md +53 -0
  27. package/docs/verification/2026-11-29-0.49.1.md +50 -0
  28. package/docs/verified.json +19 -19
  29. package/package.json +3 -3
  30. package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
  31. package/plugins/agent-hub/kimi-hook.js +324 -98
  32. package/plugins/agent-hub/server.js +334 -104
  33. package/src/adapters/channel-peer.ts +5 -2
  34. package/src/adapters/claude-channel.ts +1 -0
  35. package/src/adapters/compat.ts +4 -4
  36. package/src/adapters/definitions/native-cli-entry-claude.ts +22 -1
  37. package/src/cli/agents-output.ts +13 -0
  38. package/src/cli/agents.ts +16 -7
  39. package/src/cli/answer-output.ts +67 -0
  40. package/src/cli/broker.ts +9 -2
  41. package/src/cli/console-state.ts +12 -39
  42. package/src/cli/launch.ts +1 -1
  43. package/src/cli/main.ts +96 -127
  44. package/src/cli/recovery-package.ts +78 -26
  45. package/src/cli/reset-output.ts +50 -0
  46. package/src/cli/sdlc-output.ts +57 -0
  47. package/src/cli/settings-output.ts +80 -0
  48. package/src/hub/check-runner.ts +7 -3
  49. package/src/hub/claude-launch-proof.ts +12 -2
  50. package/src/hub/claude-state.ts +3 -0
  51. package/src/hub/control-client.ts +2 -0
  52. package/src/hub/daemon.ts +102 -40
  53. package/src/hub/roadmap-export.ts +12 -9
  54. package/src/hub/roadmap-issue-states.ts +35 -0
  55. package/src/hub/runtime-capture-prune.ts +21 -6
  56. package/src/hub/runtime-package-assets.ts +6 -0
  57. package/src/hub/supervision-proposals.ts +3 -3
  58. package/src/hub/supervision-rules.ts +2 -2
  59. package/src/hub/task-sweep.ts +1 -1
  60. package/src/hub/tasks.ts +37 -20
@@ -89,6 +89,7 @@ var init_native_channel_state = __esm(() => {
89
89
  });
90
90
 
91
91
  // src/hub/claude-state.ts
92
+ var isClaudeSessionUuid = (value) => typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
92
93
  var init_claude_state = __esm(() => {
93
94
  init_native_channel_state();
94
95
  });
@@ -365,13 +366,13 @@ var init_compat = __esm(() => {
365
366
  COMPAT = {
366
367
  pi: {
367
368
  label: "Pi",
368
- verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0"],
369
+ verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0", "1.6.1"],
369
370
  gate: "contract",
370
371
  probe: ["pi", "--version"],
371
372
  config: "pi.cmd",
372
373
  parse: (out) => plain(out.trim()),
373
- trustNote: "The model-free extension load, RPC session identity and managed tool receipt path were checked on 1.4.0, 1.5.0, 1.5.2 and 1.6.0. Permissions remain host-owned; account-backed inference and another version's extension contract are unverified.",
374
- receipt: "docs/verification/2026-11-25-pi-160-compat.md"
374
+ trustNote: "The model-free extension load, RPC session identity and managed tool receipt path were checked on 1.4.0, 1.5.0, 1.5.2, 1.6.0 and 1.6.1. Permissions remain host-owned; account-backed inference and another version's extension contract are unverified.",
375
+ receipt: "docs/verification/2026-11-26-compat-pi-1.6.1.md"
375
376
  },
376
377
  "claude-implementer": {
377
378
  label: "Claude headless implementer",
@@ -14817,7 +14818,7 @@ var package_default;
14817
14818
  var init_package = __esm(() => {
14818
14819
  package_default = {
14819
14820
  name: "@staix/agent-hub",
14820
- version: "0.48.4",
14821
+ version: "0.49.1",
14821
14822
  description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
14822
14823
  license: "MIT",
14823
14824
  type: "module",
@@ -14834,8 +14835,8 @@ var init_package = __esm(() => {
14834
14835
  bun: ">=1.4.4"
14835
14836
  },
14836
14837
  dependencies: {
14837
- "@staix/agent-mem": ">=0.39.0 <1.0.0",
14838
- "@staix/cli-output": "0.1.3"
14838
+ "@staix/agent-mem": ">=0.42.0 <1.0.0",
14839
+ "@staix/cli-output": "0.1.4"
14839
14840
  },
14840
14841
  devDependencies: {
14841
14842
  "@modelcontextprotocol/sdk": "^1.27.1",
@@ -15110,6 +15111,60 @@ var init_brief_curated = __esm(() => {
15110
15111
  init_brief_cache();
15111
15112
  MAX_AGE = 24 * 60 * 60 * 1000;
15112
15113
  });
15114
+
15115
+ // node_modules/@staix/agent-mem/src/memory/profile-marker-cache.ts
15116
+ import { lstatSync as lstatSync19 } from "fs";
15117
+ function sameMetadataStamp(a, b) {
15118
+ return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
15119
+ }
15120
+ function freezeMetadata(value) {
15121
+ if (value && typeof value === "object" && !Object.isFrozen(value)) {
15122
+ for (const child of Object.values(value))
15123
+ freezeMetadata(child);
15124
+ Object.freeze(value);
15125
+ }
15126
+ return value;
15127
+ }
15128
+ function metadataReader(read) {
15129
+ const entries = new Map;
15130
+ return (path) => {
15131
+ let before;
15132
+ try {
15133
+ before = lstatSync19(path, { bigint: true, throwIfNoEntry: false });
15134
+ } catch {
15135
+ entries.delete(path);
15136
+ return read(path)?.value;
15137
+ }
15138
+ const entry = entries.get(path);
15139
+ if (before?.isFile() && entry && sameMetadataStamp(before, entry.stamp)) {
15140
+ entries.delete(path);
15141
+ entries.set(path, entry);
15142
+ return entry.value;
15143
+ }
15144
+ entries.delete(path);
15145
+ const result = read(path);
15146
+ if (!result)
15147
+ return;
15148
+ const { value, stamp } = result;
15149
+ if (!before?.isFile() || !sameMetadataStamp(before, stamp))
15150
+ return value;
15151
+ try {
15152
+ freezeMetadata(value);
15153
+ } catch {
15154
+ return value;
15155
+ }
15156
+ if (value && typeof value === "object")
15157
+ snapshots.add(value);
15158
+ if (entries.size === 32)
15159
+ entries.delete(entries.keys().next().value);
15160
+ entries.set(path, { stamp, value });
15161
+ return value;
15162
+ };
15163
+ }
15164
+ var snapshots;
15165
+ var init_profile_marker_cache = __esm(() => {
15166
+ snapshots = new WeakSet;
15167
+ });
15113
15168
  // node_modules/@staix/agent-mem/src/memory/home-identity.ts
15114
15169
  var resolved;
15115
15170
  var init_home_identity = __esm(() => {
@@ -15149,7 +15204,9 @@ var init_public_prune_input_chain = __esm(() => {
15149
15204
  });
15150
15205
 
15151
15206
  // node_modules/@staix/agent-mem/src/memory/sync-placement-active.ts
15207
+ var pruneAdvanceMemo, shardProofs, snapshotBindings;
15152
15208
  var init_sync_placement_active = __esm(() => {
15209
+ init_profile_marker_cache();
15153
15210
  init_generation();
15154
15211
  init_platform();
15155
15212
  init_home_identity();
@@ -15159,6 +15216,9 @@ var init_sync_placement_active = __esm(() => {
15159
15216
  init_public_prune_view();
15160
15217
  init_public_prune_input_chain();
15161
15218
  init_shard();
15219
+ pruneAdvanceMemo = new Map;
15220
+ shardProofs = new WeakMap;
15221
+ snapshotBindings = new WeakMap;
15162
15222
  });
15163
15223
 
15164
15224
  // node_modules/@staix/agent-mem/src/memory/mutation.ts
@@ -15169,8 +15229,8 @@ var init_mutation = __esm(() => {
15169
15229
  });
15170
15230
 
15171
15231
  // node_modules/@staix/agent-mem/src/memory/formats.ts
15172
- import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
15173
- var MAX_BYTES4, SEMVER, READER_VERSION;
15232
+ import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, lstatSync as lstatSync20, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
15233
+ var MAX_BYTES4, SEMVER, READER_VERSION, floorMemo;
15174
15234
  var init_formats = __esm(() => {
15175
15235
  MAX_BYTES4 = 64 * 1024;
15176
15236
  SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
@@ -15182,6 +15242,7 @@ var init_formats = __esm(() => {
15182
15242
  return;
15183
15243
  }
15184
15244
  })();
15245
+ floorMemo = new Map;
15185
15246
  });
15186
15247
  // node_modules/@staix/agent-mem/src/memory/sync-placement-bound.ts
15187
15248
  var PLACEMENT_SOURCE_MAX_BYTES;
@@ -15366,16 +15427,65 @@ var init_sync_placement_realm_effective = __esm(() => {
15366
15427
  init_sync_placement_realm_extension_format();
15367
15428
  });
15368
15429
  // node_modules/@staix/agent-mem/src/memory/profile-lock-diagnostic.ts
15369
- var recognised;
15430
+ function rememberProfileLockError(error, text) {
15431
+ if (Object.values(messages).includes(text))
15432
+ recognised.set(error, text);
15433
+ }
15434
+ var messages, recognised;
15370
15435
  var init_profile_lock_diagnostic = __esm(() => {
15371
15436
  init_platform();
15437
+ messages = {
15438
+ shards: "An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
15439
+ prune: "An interrupted or still-running public-prune view migration retains profile.lock; wait for it to finish or run amem migrate --public-prune-view --resume.",
15440
+ activation: "An interrupted or still-running sync-placement activation retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only while both markers retain their original v2 bytes.",
15441
+ renewal: "An interrupted or still-running writer-inventory renewal retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only before the first commit-log byte.",
15442
+ staging: "An interrupted or still-running writer-inventory renewal retains profile.lock and unpublished intent staging; run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply."
15443
+ };
15372
15444
  recognised = new WeakMap;
15373
15445
  });
15374
15446
 
15375
15447
  // node_modules/@staix/agent-mem/src/memory/sync-placement-guard.ts
15376
15448
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
15377
- var doctorContext;
15449
+ import { closeSync as closeSync10, constants as constants9, fstatSync as fstatSync9, lstatSync as lstatSync21, openSync as openSync10, readSync as readSync7 } from "fs";
15450
+ function readMarkerUncached(file) {
15451
+ for (let attempt = 0;attempt < 6; attempt++) {
15452
+ let fd;
15453
+ try {
15454
+ const before = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
15455
+ if (!before)
15456
+ return;
15457
+ if (!before.isFile() || before.isSymbolicLink() || before.size > BigInt(LOCAL_METADATA_MAX_BYTES))
15458
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15459
+ fd = openSync10(file, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
15460
+ const opened = fstatSync9(fd, { bigint: true });
15461
+ if (!sameMetadataStamp(before, opened))
15462
+ throw new MarkerChanged;
15463
+ const bytes = Buffer.alloc(Number(opened.size) + 1);
15464
+ let count = 0;
15465
+ while (count < bytes.length) {
15466
+ const read = readSync7(fd, bytes, count, bytes.length - count, count);
15467
+ if (!read)
15468
+ break;
15469
+ count += read;
15470
+ }
15471
+ const after = fstatSync9(fd, { bigint: true }), named = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
15472
+ if (count !== Number(opened.size) || !sameMetadataStamp(opened, after) || !named || named.isSymbolicLink() || !sameMetadataStamp(opened, named))
15473
+ throw new MarkerChanged;
15474
+ return { stamp: named, value: JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(0, count))) };
15475
+ } catch (error) {
15476
+ if (error instanceof MarkerChanged && attempt < 5)
15477
+ continue;
15478
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15479
+ } finally {
15480
+ if (fd !== undefined)
15481
+ closeSync10(fd);
15482
+ }
15483
+ }
15484
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15485
+ }
15486
+ var doctorContext, PLACEMENT_STAGE1_REFUSAL = "sync placement v3 requires matching durable activation metadata; keep the current compatible profile active until person-authorized activation is complete", PLACEMENT_MARKER_REFUSAL = "sync placement metadata is invalid or unsupported; person inspection and a compatible reader are required before continuing", SyncPlacementRuntimeError, MarkerChanged, readMarker;
15378
15487
  var init_sync_placement_guard = __esm(() => {
15488
+ init_profile_marker_cache();
15379
15489
  init_sync_placement_active();
15380
15490
  init_sync_placement_realm_effective();
15381
15491
  init_generation();
@@ -15385,7 +15495,62 @@ var init_sync_placement_guard = __esm(() => {
15385
15495
  init_sync_placement_format();
15386
15496
  init_profile_lock_diagnostic();
15387
15497
  doctorContext = new AsyncLocalStorage3;
15498
+ SyncPlacementRuntimeError = class SyncPlacementRuntimeError extends Error {
15499
+ code;
15500
+ constructor(reason) {
15501
+ super(reason);
15502
+ this.name = "SyncPlacementRuntimeError";
15503
+ this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";
15504
+ rememberProfileLockError(this, reason);
15505
+ }
15506
+ };
15507
+ MarkerChanged = class MarkerChanged extends Error {
15508
+ };
15509
+ readMarker = metadataReader(readMarkerUncached);
15510
+ });
15511
+ // node_modules/@staix/agent-mem/src/memory/search-score.ts
15512
+ function sql(expr, rank) {
15513
+ const get = (part) => sql(part, rank);
15514
+ switch (expr.op) {
15515
+ case "rank":
15516
+ return rank;
15517
+ case "tier":
15518
+ return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
15519
+ case "age":
15520
+ return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
15521
+ case "constant":
15522
+ return real(expr.value);
15523
+ case "negative":
15524
+ return `(-(${get(expr.value)}))`;
15525
+ case "reciprocal":
15526
+ return `(1.0 / ${get(expr.value)})`;
15527
+ case "add":
15528
+ return `(${get(expr.left)} + ${get(expr.right)})`;
15529
+ case "multiply":
15530
+ return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
15531
+ case "max":
15532
+ return `max(${get(expr.left)}, ${get(expr.right)})`;
15533
+ }
15534
+ }
15535
+ function rankedScoreSql(rank = "bm25(docs)") {
15536
+ return sql(SCORE, rank);
15537
+ }
15538
+ var MONTH_DAYS = 30, TIER_WEIGHTS, DEFAULT_TIER_WEIGHT = 0.9, TIER_FACTOR, DENOMINATOR, RECENCY_FACTOR, SCORE, real = (value) => Number.isInteger(value) ? `${value}.0` : String(value);
15539
+ var init_search_score = __esm(() => {
15540
+ TIER_WEIGHTS = { long: 1, capture: 0.5 };
15541
+ TIER_FACTOR = { op: "tier" };
15542
+ DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
15543
+ RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
15544
+ SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
15545
+ });
15546
+
15547
+ // node_modules/@staix/agent-mem/src/memory/search-fts.ts
15548
+ var SCREENED_SUBSTRING_SCORE;
15549
+ var init_search_fts = __esm(() => {
15550
+ init_search_score();
15551
+ SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
15388
15552
  });
15553
+
15389
15554
  // node_modules/@staix/agent-mem/src/memory/lifecycle-log.ts
15390
15555
  var MAX_LOG_BYTES;
15391
15556
  var init_lifecycle_log = __esm(() => {
@@ -15401,9 +15566,9 @@ var init_aliases = __esm(() => {
15401
15566
  var init_shard = __esm(() => {
15402
15567
  init_sync_placement_active();
15403
15568
  init_sync_placement_realm_effective();
15404
- init_sync_placement_format();
15405
15569
  init_sync_placement_guard();
15406
15570
  init_public_prune_view();
15571
+ init_search_fts();
15407
15572
  init_generation();
15408
15573
  init_aliases();
15409
15574
  init_profile_lock_diagnostic();
@@ -15420,6 +15585,7 @@ var init_sync_placement_format = __esm(() => {
15420
15585
  });
15421
15586
 
15422
15587
  // node_modules/@staix/agent-mem/src/memory/generation.ts
15588
+ var LOCAL_METADATA_MAX_BYTES = 262144;
15423
15589
  var init_generation = __esm(() => {
15424
15590
  init_sync_placement_format();
15425
15591
  init_sync_placement_guard();
@@ -15646,50 +15812,6 @@ var init_lifecycle = __esm(() => {
15646
15812
  init_lifecycle_log();
15647
15813
  init_shard();
15648
15814
  });
15649
-
15650
- // node_modules/@staix/agent-mem/src/memory/search-score.ts
15651
- function sql(expr, rank) {
15652
- const get = (part) => sql(part, rank);
15653
- switch (expr.op) {
15654
- case "rank":
15655
- return rank;
15656
- case "tier":
15657
- return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
15658
- case "age":
15659
- return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
15660
- case "constant":
15661
- return real(expr.value);
15662
- case "negative":
15663
- return `(-(${get(expr.value)}))`;
15664
- case "reciprocal":
15665
- return `(1.0 / ${get(expr.value)})`;
15666
- case "add":
15667
- return `(${get(expr.left)} + ${get(expr.right)})`;
15668
- case "multiply":
15669
- return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
15670
- case "max":
15671
- return `max(${get(expr.left)}, ${get(expr.right)})`;
15672
- }
15673
- }
15674
- function rankedScoreSql(rank = "bm25(docs)") {
15675
- return sql(SCORE, rank);
15676
- }
15677
- var MONTH_DAYS = 30, TIER_WEIGHTS, DEFAULT_TIER_WEIGHT = 0.9, TIER_FACTOR, DENOMINATOR, RECENCY_FACTOR, SCORE, real = (value) => Number.isInteger(value) ? `${value}.0` : String(value);
15678
- var init_search_score = __esm(() => {
15679
- TIER_WEIGHTS = { long: 1, capture: 0.5 };
15680
- TIER_FACTOR = { op: "tier" };
15681
- DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
15682
- RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
15683
- SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
15684
- });
15685
-
15686
- // node_modules/@staix/agent-mem/src/memory/search-fts.ts
15687
- var SCREENED_SCORE, SCREENED_SUBSTRING_SCORE;
15688
- var init_search_fts = __esm(() => {
15689
- init_search_score();
15690
- SCREENED_SCORE = rankedScoreSql();
15691
- SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
15692
- });
15693
15815
  // node_modules/@staix/agent-mem/src/memory/capture-input.ts
15694
15816
  var TOOL_INPUT_OMIT;
15695
15817
  var init_capture_input = __esm(() => {
@@ -16044,6 +16166,12 @@ var init_candidate_origin = __esm(() => {
16044
16166
  init_screen();
16045
16167
  });
16046
16168
 
16169
+ // node_modules/@staix/agent-mem/src/memory/topic.ts
16170
+ var TOPIC_FORM = "[a-z0-9][a-z0-9/-]{0,63}", TOPIC;
16171
+ var init_topic = __esm(() => {
16172
+ TOPIC = new RegExp(`^${TOPIC_FORM}$`);
16173
+ });
16174
+
16047
16175
  // node_modules/@staix/agent-mem/src/memory/candidates.ts
16048
16176
  var CANDIDATE_RETENTION, COUNTER_RETENTION;
16049
16177
  var init_candidates = __esm(() => {
@@ -16055,6 +16183,7 @@ var init_candidates = __esm(() => {
16055
16183
  init_platform();
16056
16184
  init_private_spans();
16057
16185
  init_candidate_origin();
16186
+ init_topic();
16058
16187
  CANDIDATE_RETENTION = { count: 500, ageMs: 30 * 86400000 };
16059
16188
  COUNTER_RETENTION = { count: 1e4, ageMs: 90 * 86400000 };
16060
16189
  });
@@ -16163,9 +16292,36 @@ var init_report_text = __esm(() => {
16163
16292
  init_style();
16164
16293
  });
16165
16294
  // node_modules/@staix/agent-mem/src/memory/consolidation-clusters.ts
16295
+ var OVERLAP_STOP;
16166
16296
  var init_consolidation_clusters = __esm(() => {
16167
16297
  init_search_fts();
16168
16298
  init_candidates();
16299
+ init_topic();
16300
+ OVERLAP_STOP = new Set([
16301
+ "the",
16302
+ "and",
16303
+ "for",
16304
+ "with",
16305
+ "from",
16306
+ "this",
16307
+ "that",
16308
+ "approach",
16309
+ "symptom",
16310
+ "cause",
16311
+ "evidence",
16312
+ "retry",
16313
+ "when",
16314
+ "\uC774\uAC83",
16315
+ "\uADF8\uAC83",
16316
+ "\uC800\uAC83",
16317
+ "\uC5B4\uB5A4",
16318
+ "\uBB34\uC5C7",
16319
+ "\uBAA8\uB4E0",
16320
+ "\uB610\uB294",
16321
+ "\uAC00\uC7A5",
16322
+ "\uC544\uC8FC",
16323
+ "\uB9E4\uC6B0"
16324
+ ]);
16169
16325
  });
16170
16326
 
16171
16327
  // node_modules/@staix/agent-mem/src/memory/forget-nearby.ts
@@ -16191,6 +16347,7 @@ var init_commands = __esm(() => {
16191
16347
  init_src();
16192
16348
  init_project2();
16193
16349
  init_forget_nearby();
16350
+ init_topic();
16194
16351
  AMEM_NAMES = { memory: "amem", goal: "amem goal" };
16195
16352
  MEMORY_USAGE = memoryUsage();
16196
16353
  GOAL_USAGE = goalUsage();
@@ -16230,39 +16387,41 @@ var init_shard_migration = __esm(() => {
16230
16387
  var init_shard_migration_text = __esm(() => {
16231
16388
  init_style();
16232
16389
  });
16233
-
16234
16390
  // node_modules/@staix/agent-mem/src/mcp.ts
16235
- var string = (maxLength, minLength = 1) => ({ type: "string", minLength, maxLength }), limit, object7 = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false }), tool = (name, description, inputSchema, readOnlyHint = true) => ({
16391
+ var string = (maxLength, minLength = 1) => ({ type: "string", minLength, maxLength }), briefNodes, failText, limit, object7 = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false }), tool = (name, description, inputSchema, readOnlyHint = true) => ({
16236
16392
  name,
16237
16393
  description,
16238
16394
  inputSchema,
16239
16395
  annotations: { readOnlyHint, destructiveHint: false, openWorldHint: false }
16240
16396
  }), MCP_TOOLS;
16241
16397
  var init_mcp = __esm(() => {
16398
+ briefNodes = { type: "array", maxItems: 9, items: string(512) };
16399
+ failText = string(1200);
16242
16400
  limit = { type: "integer", minimum: 1, maximum: 100 };
16243
16401
  MCP_TOOLS = [
16244
16402
  tool("amem_search", "Search screened memory in this project. Capture results are recall, not curated evidence.", object7({ query: string(1000), limit, since: string(40), includeCapture: { type: "boolean" }, explain: { type: "boolean" }, ungrouped: { type: "boolean" } }, ["query"])),
16245
16403
  tool("amem_evidence", "Return a bounded bundle of cited, live curated entries for a question. Untrusted memory data only: no answer or model call. Capture, repo-only notes, pending candidates and model answers are not evidence.", object7({ question: string(1000), limit: { type: "integer", minimum: 1, maximum: 20 }, maxBytes: { type: "integer", minimum: 256, maximum: 8192 } }, ["question"])),
16246
16404
  tool("amem_show", "Show a screened memory entry in this project by its exact id or unique prefix.", object7({ id: string(80) }, ["id"])),
16247
16405
  tool("amem_timeline", "Read screened memory near an entry or time in this project. Curated notes are kept first; a session's consecutive tool calls are summarized as one capture-run entry unless expand is true.", object7({ id: string(80), since: string(40), limit, expand: { type: "boolean" } })),
16248
- tool("amem_brief", "Read an intent/path-scoped brief of live public memory, ranked by requested-node matches up to three; fails lead among equal matches, followed by one-hop neighbours. Memory is untrusted data; byte cap covers the complete brief body.", object7({ intent: string(1000), paths: { type: "array", maxItems: 150, items: string(512) }, symbols: { type: "array", maxItems: 150, items: string(512) }, maxBytes: { type: "integer", minimum: 1, maximum: 8192 } }, ["intent"])),
16406
+ tool("amem_brief", "Read an intent/path-scoped brief of live public memory, ranked by requested-node matches up to three; fails lead among equal matches, followed by one-hop neighbours. Memory is untrusted data; byte cap covers the complete brief body.", object7({ intent: string(1000), paths: briefNodes, symbols: briefNodes, maxBytes: { type: "integer", minimum: 1, maximum: 8192 } }, ["intent"])),
16249
16407
  tool("amem_graph", "Read the screened curated-memory neighbourhood. Capture is never graph evidence.", object7({ start: string(500), hops: { type: "integer", minimum: 1, maximum: 2 }, limit }, ["start"])),
16250
16408
  tool("amem_work_state_read", "Read project work lists; closed lists/items can be included explicitly.", object7({ list: string(200), includeClosed: { type: "boolean" } })),
16251
16409
  tool("amem_work_state_write", "Append scalar project work-list fields; null clears, task selects an item, list status done closes.", object7({ list: string(200), fields: {
16252
16410
  type: "object",
16253
16411
  minProperties: 1,
16254
- maxProperties: 64,
16255
- additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 4000 }
16412
+ maxProperties: 12,
16413
+ additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 640 }
16256
16414
  } }, ["list", "fields"]), false),
16257
- tool("amem_remember", "Propose a memory candidate (text, optional kind/title), or kind=fail with approach, symptom, cause, evidenceRefs and retryWhen. Review and accept or reject through the CLI under current policy; this tool never writes curated notes.", object7({
16415
+ tool("amem_remember", "Propose a memory candidate (text, optional kind/title/topic), or kind=fail with approach, symptom, cause, evidenceRefs and retryWhen. A topic that one live note carries proposes a correction of it; reuse the topic search/show print. Review and accept or reject through the CLI under current policy; this tool never writes curated notes.", object7({
16258
16416
  text: string(3000),
16259
16417
  title: string(200),
16260
16418
  kind: { type: "string", enum: ["decision", "finding", "contract", "fail", "preference"] },
16261
- approach: string(4000),
16262
- symptom: string(4000),
16263
- cause: string(4000),
16264
- evidenceRefs: { type: "array", minItems: 1, maxItems: 16, items: string(400) },
16265
- retryWhen: string(4000)
16419
+ topic: string(64),
16420
+ approach: failText,
16421
+ symptom: failText,
16422
+ cause: failText,
16423
+ evidenceRefs: { type: "array", minItems: 1, maxItems: 8, items: string(250) },
16424
+ retryWhen: failText
16266
16425
  }), false),
16267
16426
  tool("amem_correct", "Propose a correction to an exact curated entry id visible in this project. The host binds its current revision; the full accepted body including reason and provenance headers must fit 4000 characters. Review and accept or reject through the CLI under current policy before any note or supersession is written.", object7({ id: string(80), proposedText: string(4000), reason: string(4000), kind: { type: "string", enum: ["decision", "contract", "fail"] } }, ["id", "proposedText", "reason"]), false),
16268
16427
  tool("amem_vault_candidates", "List screened durable curated notes for review before moving them to a vault. Read only.", object7({ limit })),
@@ -16352,6 +16511,7 @@ var init_mcp_memory = __esm(() => {
16352
16511
  init_store();
16353
16512
  init_vault();
16354
16513
  init_candidate_origin();
16514
+ init_topic();
16355
16515
  init_work_lists();
16356
16516
  TOOL_EVENTS = new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
16357
16517
  });
@@ -16461,6 +16621,15 @@ var init_hook_jcode = __esm(() => {
16461
16621
  FIELD_BYTES = 16 * 1024 + 64;
16462
16622
  });
16463
16623
 
16624
+ // node_modules/@staix/agent-mem/src/memory/roots.ts
16625
+ var READ_BOUND;
16626
+ var init_roots = __esm(() => {
16627
+ init_aliases();
16628
+ init_platform();
16629
+ init_project2();
16630
+ READ_BOUND = 256 * 1024;
16631
+ });
16632
+
16464
16633
  // node_modules/@staix/agent-mem/src/hooks.ts
16465
16634
  var hookStartedAt;
16466
16635
  var init_hooks = __esm(() => {
@@ -16480,6 +16649,7 @@ var init_hooks = __esm(() => {
16480
16649
  init_platform();
16481
16650
  init_policy();
16482
16651
  init_config();
16652
+ init_roots();
16483
16653
  init_hook_contract();
16484
16654
  init_hook_contract();
16485
16655
  hookStartedAt = performance.now();
@@ -16547,6 +16717,7 @@ var init_session_brief = __esm(() => {
16547
16717
  init_config();
16548
16718
  init_candidate_pending();
16549
16719
  init_project2();
16720
+ init_roots();
16550
16721
  init_reader_lease();
16551
16722
  init_metrics();
16552
16723
  init_shard();
@@ -17141,6 +17312,35 @@ var init_setup_writer_roots = __esm(() => {
17141
17312
  JOURNAL_MAX = 12 * MAX2;
17142
17313
  });
17143
17314
 
17315
+ // node_modules/@staix/agent-mem/src/setup-console.ts
17316
+ var init_setup_console = __esm(() => {
17317
+ init_mutation();
17318
+ });
17319
+
17320
+ // node_modules/@staix/agent-mem/src/memory/formats-raise.ts
17321
+ var PACKAGE_BYTES;
17322
+ var init_formats_raise = __esm(() => {
17323
+ init_formats();
17324
+ init_mutation();
17325
+ init_platform();
17326
+ PACKAGE_BYTES = 64 * 1024;
17327
+ });
17328
+
17329
+ // node_modules/@staix/agent-mem/src/setup-drift.ts
17330
+ var JOURNAL_BYTES, READ_BYTES;
17331
+ var init_setup_drift = __esm(() => {
17332
+ init_setup_writer_roots();
17333
+ init_setup_toml();
17334
+ init_setup_owned();
17335
+ init_setup_paths();
17336
+ init_hook_contract();
17337
+ init_platform();
17338
+ init_setup_console();
17339
+ init_formats_raise();
17340
+ JOURNAL_BYTES = 12 * SETUP_CONFIG_BYTES;
17341
+ READ_BYTES = 32 * 1024 * 1024;
17342
+ });
17343
+
17144
17344
  // node_modules/@staix/agent-mem/src/setup.ts
17145
17345
  var SETUP_ALL_TARGETS, PACKAGE_JSON_MAX;
17146
17346
  var init_setup = __esm(() => {
@@ -17159,6 +17359,8 @@ var init_setup = __esm(() => {
17159
17359
  init_sync_placement_effective_writers();
17160
17360
  init_sync_placement_guard();
17161
17361
  init_home();
17362
+ init_setup_drift();
17363
+ init_setup_console();
17162
17364
  init_style();
17163
17365
  init_platform();
17164
17366
  SETUP_ALL_TARGETS = SETUP_TARGETS.filter((target) => target !== "agy");
@@ -17191,6 +17393,7 @@ var init_src2 = __esm(() => {
17191
17393
  init_migrate_text();
17192
17394
  init_prune_text();
17193
17395
  init_shard_migration_text();
17396
+ init_mcp();
17194
17397
  init_config();
17195
17398
  init_curated_brief_cache();
17196
17399
  init_sync_screen();
@@ -17225,7 +17428,6 @@ var init_src2 = __esm(() => {
17225
17428
  init_migrate();
17226
17429
  init_prune();
17227
17430
  init_shard_migration();
17228
- init_mcp();
17229
17431
  init_mcp_memory();
17230
17432
  init_policy();
17231
17433
  init_work_lists();
@@ -17254,7 +17456,7 @@ var init_src2 = __esm(() => {
17254
17456
  });
17255
17457
 
17256
17458
  // src/hub/log-rotation.ts
17257
- import { appendFileSync, closeSync as closeSync10, copyFileSync, existsSync as existsSync9, fstatSync as fstatSync9, openSync as openSync10, readdirSync as readdirSync4, readSync as readSync7, renameSync as renameSync5, rmSync as rmSync7, statSync as statSync5, truncateSync } from "fs";
17459
+ import { appendFileSync, closeSync as closeSync11, copyFileSync, existsSync as existsSync9, fstatSync as fstatSync10, openSync as openSync11, readdirSync as readdirSync4, readSync as readSync8, renameSync as renameSync5, rmSync as rmSync7, statSync as statSync5, truncateSync } from "fs";
17258
17460
  import { basename as basename5, dirname as dirname13, join as join20 } from "path";
17259
17461
  function segmentsOf(file) {
17260
17462
  const dir = dirname13(file), prefix = `${basename5(file)}.`;
@@ -17295,7 +17497,7 @@ var init_log_rotation = __esm(() => {
17295
17497
  });
17296
17498
 
17297
17499
  // src/hub/events.ts
17298
- import { appendFileSync as appendFileSync2, closeSync as closeSync11, existsSync as existsSync10, fstatSync as fstatSync10, openSync as openSync11, readFileSync as readFileSync9, readSync as readSync8 } from "fs";
17500
+ import { appendFileSync as appendFileSync2, closeSync as closeSync12, existsSync as existsSync10, fstatSync as fstatSync11, openSync as openSync12, readFileSync as readFileSync9, readSync as readSync9 } from "fs";
17299
17501
  function readEvents(file, since = 0) {
17300
17502
  for (let attempt = 0;; attempt++) {
17301
17503
  const segments = segmentsOf(file), out = [];
@@ -21043,7 +21245,7 @@ __export(exports_claude_implementer, {
21043
21245
  ClaudeImplementerPeer: () => ClaudeImplementerPeer
21044
21246
  });
21045
21247
  import { randomUUID as randomUUID9 } from "crypto";
21046
- import { lstatSync as lstatSync19, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
21248
+ import { lstatSync as lstatSync22, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
21047
21249
  import { tmpdir as tmpdir5 } from "os";
21048
21250
  import { join as join22 } from "path";
21049
21251
  function provenVersion(binding) {
@@ -21101,7 +21303,7 @@ function claudeImplementerArgs(turn, mcp, settings, prompt, model) {
21101
21303
  async function proveClaudeImplementer(peer, command) {
21102
21304
  const binary = Bun.which(command[0], { PATH: process.env.PATH }) ?? command[0];
21103
21305
  const fingerprint = () => {
21104
- const file = realPath(binary), stat = lstatSync19(file);
21306
+ const file = realPath(binary), stat = lstatSync22(file);
21105
21307
  return [file, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
21106
21308
  };
21107
21309
  const binding = fingerprint(), home = mkdtempSync6(join22(tmpdir5(), "ahub-claude-proof-"));
@@ -21716,7 +21918,7 @@ var init_reviewer_variants = __esm(() => {
21716
21918
  });
21717
21919
 
21718
21920
  // src/adapters/agy/hooks.ts
21719
- import { closeSync as closeSync12, constants as constants9, fstatSync as fstatSync11, lstatSync as lstatSync20, openSync as openSync12, readSync as readSync9 } from "fs";
21921
+ import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync12, lstatSync as lstatSync23, openSync as openSync13, readSync as readSync10 } from "fs";
21720
21922
  import { homedir as homedir5 } from "os";
21721
21923
  import { isAbsolute as isAbsolute7, join as join23, relative as relative5 } from "path";
21722
21924
  import { createHash as createHash12 } from "crypto";
@@ -21781,11 +21983,11 @@ function readAgyTranscript(session, transcript, options) {
21781
21983
  let cursor = home;
21782
21984
  for (const name of relative5(home, transcript).split("/")) {
21783
21985
  cursor = join23(cursor, name);
21784
- if (lstatSync20(cursor).isSymbolicLink())
21986
+ if (lstatSync23(cursor).isSymbolicLink())
21785
21987
  return empty;
21786
21988
  }
21787
- fd = openSync12(transcript, constants9.O_RDONLY | constants9.O_NOFOLLOW);
21788
- const stat = fstatSync11(fd);
21989
+ fd = openSync13(transcript, constants10.O_RDONLY | constants10.O_NOFOLLOW);
21990
+ const stat = fstatSync12(fd);
21789
21991
  if (!stat.isFile() || stat.nlink !== 1)
21790
21992
  return empty;
21791
21993
  if (options?.unchanged && stat.size === options.unchanged.size && stat.mtimeMs === options.unchanged.mtimeMs)
@@ -21800,7 +22002,7 @@ function readAgyTranscript(session, transcript, options) {
21800
22002
  const buffer = Buffer.alloc(stat.size - from);
21801
22003
  let bytes = 0;
21802
22004
  while (bytes < buffer.length) {
21803
- const count = readSync9(fd, buffer, bytes, buffer.length - bytes, from + bytes);
22005
+ const count = readSync10(fd, buffer, bytes, buffer.length - bytes, from + bytes);
21804
22006
  if (!count)
21805
22007
  break;
21806
22008
  bytes += count;
@@ -21861,7 +22063,7 @@ function readAgyTranscript(session, transcript, options) {
21861
22063
  return empty;
21862
22064
  } finally {
21863
22065
  if (fd !== undefined)
21864
- closeSync12(fd);
22066
+ closeSync13(fd);
21865
22067
  }
21866
22068
  }
21867
22069
  var EVENTS2, UUID2, record6 = (value) => !!value && typeof value === "object" && !Array.isArray(value), AGY_FACTS_HOOK;
@@ -21942,6 +22144,27 @@ function builtinCliEntries(definitions) {
21942
22144
  import { readFileSync as readFileSync11 } from "fs";
21943
22145
  import { join as join24 } from "path";
21944
22146
  import { randomUUID as randomUUID10 } from "crypto";
22147
+ function managedSession(nativeArgs) {
22148
+ const separator = nativeArgs.indexOf("--");
22149
+ const options = separator < 0 ? nativeArgs : nativeArgs.slice(0, separator);
22150
+ const values = (names) => options.flatMap((arg, index) => {
22151
+ if (names.includes(arg))
22152
+ return [options[index + 1]];
22153
+ const name = names.find((value) => arg.startsWith(value + "="));
22154
+ return name ? [arg.slice(name.length + 1)] : [];
22155
+ });
22156
+ const explicit = values(["--session-id"]);
22157
+ const resume = values(["--resume", "-r"]);
22158
+ if (explicit.length)
22159
+ return explicit.length === 1 && isClaudeSessionUuid(explicit[0]) ? explicit[0] : undefined;
22160
+ if (options.some((arg) => ["-c", "--continue", "--from-pr", "--teleport", "--fork-session"].some((flag) => arg === flag || arg.startsWith(flag + "="))))
22161
+ return;
22162
+ if (resume.length)
22163
+ return resume.length === 1 && isClaudeSessionUuid(resume[0]) ? resume[0] : undefined;
22164
+ const id = randomUUID10();
22165
+ nativeArgs.unshift("--session-id", id);
22166
+ return id;
22167
+ }
21945
22168
  async function runClaudeEntry(ctx) {
21946
22169
  const { args, cwd, stateDir, cliDir, unattendedEnv, projectConfig, fail } = ctx;
21947
22170
  const peer = ctx.instance ?? "claude";
@@ -22007,6 +22230,9 @@ async function runClaudeEntry(ctx) {
22007
22230
  let launchRecord;
22008
22231
  if (control?.instanceId) {
22009
22232
  launchRecord = { ...ctx.instance ? { peer, executionCwd } : {}, instanceId: control.instanceId, launchId: process.env.AGENTHUB_LAUNCH_ID, permissionHook: launch.permissionHook === true, hookPurpose: launch.hookPurpose, settingsFile: launch.settingsFile, launcherPid: process.pid, launcherSignature: processSignature(process.pid), unattended: launch.unattended === true };
22233
+ const nativeSessionId = managedSession(launch.args);
22234
+ if (nativeSessionId)
22235
+ launchRecord.nativeSessionId = nativeSessionId;
22010
22236
  recordClaudeLaunch(stateDir, launchRecord);
22011
22237
  cleanupStaleClaudeSettings(stateDir, previousLaunch);
22012
22238
  }
@@ -22095,10 +22321,10 @@ var init_native_cli_entry_codex = () => {};
22095
22321
 
22096
22322
  // src/cli/kimi-plugin.ts
22097
22323
  import { randomUUID as randomUUID11 } from "crypto";
22098
- import { closeSync as closeSync13, lstatSync as lstatSync21, mkdirSync as mkdirSync12, openSync as openSync13, readFileSync as readFileSync12, renameSync as renameSync6, rmdirSync as rmdirSync4, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
22324
+ import { closeSync as closeSync14, lstatSync as lstatSync24, mkdirSync as mkdirSync12, openSync as openSync14, readFileSync as readFileSync12, renameSync as renameSync6, rmdirSync as rmdirSync4, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
22099
22325
  import { dirname as dirname15, isAbsolute as isAbsolute8, join as join25 } from "path";
22100
22326
  function file(path, cap) {
22101
- const stat = lstatSync21(path, { throwIfNoEntry: false });
22327
+ const stat = lstatSync24(path, { throwIfNoEntry: false });
22102
22328
  if (!stat)
22103
22329
  return;
22104
22330
  if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1 || stat.size > cap)
@@ -22118,27 +22344,27 @@ function parse2(value, name) {
22118
22344
  }
22119
22345
  }
22120
22346
  function atomic(path, bytes, before) {
22121
- const current = lstatSync21(path, { throwIfNoEntry: false });
22347
+ const current = lstatSync24(path, { throwIfNoEntry: false });
22122
22348
  if (before ? !current || current.dev !== before.dev || current.ino !== before.ino : current)
22123
22349
  throw new Error(`${path} changed before its managed write`);
22124
22350
  const temporary = `${path}.${randomUUID11()}.tmp`;
22125
22351
  let fd;
22126
22352
  try {
22127
- fd = openSync13(temporary, "wx", 384);
22353
+ fd = openSync14(temporary, "wx", 384);
22128
22354
  writeFileSync10(fd, bytes);
22129
- closeSync13(fd);
22355
+ closeSync14(fd);
22130
22356
  fd = undefined;
22131
22357
  renameSync6(temporary, path);
22132
22358
  } finally {
22133
22359
  if (fd !== undefined)
22134
- closeSync13(fd);
22360
+ closeSync14(fd);
22135
22361
  try {
22136
22362
  unlinkSync4(temporary);
22137
22363
  } catch {}
22138
22364
  }
22139
22365
  }
22140
22366
  function removeFile(path, expected) {
22141
- const current = lstatSync21(path, { throwIfNoEntry: false });
22367
+ const current = lstatSync24(path, { throwIfNoEntry: false });
22142
22368
  if (!current || !current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || !readFileSync12(path).equals(expected))
22143
22369
  return;
22144
22370
  unlinkSync4(path);
@@ -22229,14 +22455,14 @@ function locked(options, run) {
22229
22455
  const path = join25(options.home, "agent-hub-plugin.lock");
22230
22456
  let fd;
22231
22457
  try {
22232
- fd = openSync13(path, "wx", 384);
22458
+ fd = openSync14(path, "wx", 384);
22233
22459
  } catch {
22234
22460
  throw new Error(`Another Kimi plugin replacement is active or left a stale lock; retry after it exits or inspect ${path}`);
22235
22461
  }
22236
22462
  try {
22237
22463
  return run();
22238
22464
  } finally {
22239
- closeSync13(fd);
22465
+ closeSync14(fd);
22240
22466
  unlinkSync4(path);
22241
22467
  }
22242
22468
  }
@@ -22278,7 +22504,7 @@ function cleanupKimiPlugin(options) {
22278
22504
  });
22279
22505
  }
22280
22506
  var EVENTS3, ID2 = "agent-hub", MAX_INSTALLED, MAX_HOOK, object8 = (value) => !!value && typeof value === "object" && !Array.isArray(value), directory = (path, required = true) => {
22281
- const stat = lstatSync21(path, { throwIfNoEntry: false });
22507
+ const stat = lstatSync24(path, { throwIfNoEntry: false });
22282
22508
  if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
22283
22509
  throw new Error(`${path} must be a plain directory`);
22284
22510
  if (!stat && required)
@@ -23038,7 +23264,7 @@ var init_native_config_policy = __esm(() => {
23038
23264
  });
23039
23265
 
23040
23266
  // src/adapters/definitions/native-policy-aux.ts
23041
- import { closeSync as closeSync14, constants as constants10, fstatSync as fstatSync12, openSync as openSync14, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
23267
+ import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, openSync as openSync15, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
23042
23268
  import { isAbsolute as isAbsolute9, join as join30, normalize } from "path";
23043
23269
  function claudeCrashPlan(_meta) {
23044
23270
  return { how: "claude: the Claude Code plugin reconnects by itself while that session is still open" };
@@ -23143,8 +23369,8 @@ function absoluteContinuityPath(value) {
23143
23369
  var str3 = (value) => typeof value === "string" && value ? value : undefined, PLUGINS, CLAUDE_ONLY, text2 = (file) => {
23144
23370
  let fd;
23145
23371
  try {
23146
- fd = openSync14(file, constants10.O_RDONLY | constants10.O_NONBLOCK);
23147
- const st = fstatSync12(fd);
23372
+ fd = openSync15(file, constants11.O_RDONLY | constants11.O_NONBLOCK);
23373
+ const st = fstatSync13(fd);
23148
23374
  if (!st.isFile() || st.size > 1024 * 1024)
23149
23375
  return;
23150
23376
  return readFileSync14(fd, "utf8");
@@ -23152,7 +23378,7 @@ var str3 = (value) => typeof value === "string" && value ? value : undefined, PL
23152
23378
  return;
23153
23379
  } finally {
23154
23380
  if (fd !== undefined)
23155
- closeSync14(fd);
23381
+ closeSync15(fd);
23156
23382
  }
23157
23383
  }, json = (file) => {
23158
23384
  try {
@@ -23447,7 +23673,7 @@ var init_native_recovery = __esm(() => {
23447
23673
  });
23448
23674
 
23449
23675
  // src/adapters/kimi-tui-facts.ts
23450
- import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, lstatSync as lstatSync22, openSync as openSync15, readSync as readSync10, readdirSync as readdirSync7 } from "fs";
23676
+ import { closeSync as closeSync16, constants as constants12, fstatSync as fstatSync14, lstatSync as lstatSync25, openSync as openSync16, readSync as readSync11, readdirSync as readdirSync7 } from "fs";
23451
23677
  import { createHash as createHash13 } from "crypto";
23452
23678
  import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute10, join as join34, relative as relative6 } from "path";
23453
23679
  import { homedir as homedir9 } from "os";
@@ -23469,26 +23695,26 @@ function encodeKimiTuiHook() {
23469
23695
  return;
23470
23696
  }
23471
23697
  function readBytes(path, cap, tail = false) {
23472
- const link = lstatSync22(path);
23698
+ const link = lstatSync25(path);
23473
23699
  if (!link.isFile() || link.isSymbolicLink() || link.nlink !== 1)
23474
23700
  throw new Error("not a regular file");
23475
- const fd = openSync15(path, constants11.O_RDONLY | constants11.O_NOFOLLOW);
23701
+ const fd = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW);
23476
23702
  try {
23477
- const stat = fstatSync13(fd);
23703
+ const stat = fstatSync14(fd);
23478
23704
  if (!stat.isFile() || stat.nlink !== 1 || !tail && stat.size > cap)
23479
23705
  throw new Error("invalid file");
23480
23706
  const length = Math.min(stat.size, cap), start = tail ? stat.size - length : 0;
23481
23707
  const bytes = Buffer.alloc(length);
23482
23708
  let offset = 0;
23483
23709
  while (offset < length) {
23484
- const count = readSync10(fd, bytes, offset, length - offset, start + offset);
23710
+ const count = readSync11(fd, bytes, offset, length - offset, start + offset);
23485
23711
  if (count <= 0)
23486
23712
  throw new Error("short read");
23487
23713
  offset += count;
23488
23714
  }
23489
23715
  return bytes;
23490
23716
  } finally {
23491
- closeSync15(fd);
23717
+ closeSync16(fd);
23492
23718
  }
23493
23719
  }
23494
23720
  function sessionDirectory(index, session) {
@@ -23528,7 +23754,7 @@ function taskInventory(agents) {
23528
23754
  if (!entry.isDirectory())
23529
23755
  continue;
23530
23756
  const tasks = join34(agents, entry.name, "tasks");
23531
- const dir = lstatSync22(tasks, { throwIfNoEntry: false });
23757
+ const dir = lstatSync25(tasks, { throwIfNoEntry: false });
23532
23758
  if (!dir)
23533
23759
  continue;
23534
23760
  if (!dir.isDirectory() || dir.isSymbolicLink())