@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
@@ -725,13 +725,13 @@ var init_compat = __esm(() => {
725
725
  COMPAT = {
726
726
  pi: {
727
727
  label: "Pi",
728
- verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0"],
728
+ verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0", "1.6.1"],
729
729
  gate: "contract",
730
730
  probe: ["pi", "--version"],
731
731
  config: "pi.cmd",
732
732
  parse: (out) => plain(out.trim()),
733
- 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.",
734
- receipt: "docs/verification/2026-11-25-pi-160-compat.md"
733
+ 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.",
734
+ receipt: "docs/verification/2026-11-26-compat-pi-1.6.1.md"
735
735
  },
736
736
  "claude-implementer": {
737
737
  label: "Claude headless implementer",
@@ -14799,7 +14799,7 @@ var package_default;
14799
14799
  var init_package = __esm(() => {
14800
14800
  package_default = {
14801
14801
  name: "@staix/agent-hub",
14802
- version: "0.48.4",
14802
+ version: "0.49.1",
14803
14803
  description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
14804
14804
  license: "MIT",
14805
14805
  type: "module",
@@ -14816,8 +14816,8 @@ var init_package = __esm(() => {
14816
14816
  bun: ">=1.4.4"
14817
14817
  },
14818
14818
  dependencies: {
14819
- "@staix/agent-mem": ">=0.39.0 <1.0.0",
14820
- "@staix/cli-output": "0.1.3"
14819
+ "@staix/agent-mem": ">=0.42.0 <1.0.0",
14820
+ "@staix/cli-output": "0.1.4"
14821
14821
  },
14822
14822
  devDependencies: {
14823
14823
  "@modelcontextprotocol/sdk": "^1.27.1",
@@ -15092,6 +15092,60 @@ var init_brief_curated = __esm(() => {
15092
15092
  init_brief_cache();
15093
15093
  MAX_AGE = 24 * 60 * 60 * 1000;
15094
15094
  });
15095
+
15096
+ // node_modules/@staix/agent-mem/src/memory/profile-marker-cache.ts
15097
+ import { lstatSync as lstatSync19 } from "fs";
15098
+ function sameMetadataStamp(a, b) {
15099
+ return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
15100
+ }
15101
+ function freezeMetadata(value) {
15102
+ if (value && typeof value === "object" && !Object.isFrozen(value)) {
15103
+ for (const child of Object.values(value))
15104
+ freezeMetadata(child);
15105
+ Object.freeze(value);
15106
+ }
15107
+ return value;
15108
+ }
15109
+ function metadataReader(read) {
15110
+ const entries = new Map;
15111
+ return (path) => {
15112
+ let before;
15113
+ try {
15114
+ before = lstatSync19(path, { bigint: true, throwIfNoEntry: false });
15115
+ } catch {
15116
+ entries.delete(path);
15117
+ return read(path)?.value;
15118
+ }
15119
+ const entry = entries.get(path);
15120
+ if (before?.isFile() && entry && sameMetadataStamp(before, entry.stamp)) {
15121
+ entries.delete(path);
15122
+ entries.set(path, entry);
15123
+ return entry.value;
15124
+ }
15125
+ entries.delete(path);
15126
+ const result = read(path);
15127
+ if (!result)
15128
+ return;
15129
+ const { value, stamp } = result;
15130
+ if (!before?.isFile() || !sameMetadataStamp(before, stamp))
15131
+ return value;
15132
+ try {
15133
+ freezeMetadata(value);
15134
+ } catch {
15135
+ return value;
15136
+ }
15137
+ if (value && typeof value === "object")
15138
+ snapshots.add(value);
15139
+ if (entries.size === 32)
15140
+ entries.delete(entries.keys().next().value);
15141
+ entries.set(path, { stamp, value });
15142
+ return value;
15143
+ };
15144
+ }
15145
+ var snapshots;
15146
+ var init_profile_marker_cache = __esm(() => {
15147
+ snapshots = new WeakSet;
15148
+ });
15095
15149
  // node_modules/@staix/agent-mem/src/memory/home-identity.ts
15096
15150
  var resolved;
15097
15151
  var init_home_identity = __esm(() => {
@@ -15131,7 +15185,9 @@ var init_public_prune_input_chain = __esm(() => {
15131
15185
  });
15132
15186
 
15133
15187
  // node_modules/@staix/agent-mem/src/memory/sync-placement-active.ts
15188
+ var pruneAdvanceMemo, shardProofs, snapshotBindings;
15134
15189
  var init_sync_placement_active = __esm(() => {
15190
+ init_profile_marker_cache();
15135
15191
  init_generation();
15136
15192
  init_platform();
15137
15193
  init_home_identity();
@@ -15141,6 +15197,9 @@ var init_sync_placement_active = __esm(() => {
15141
15197
  init_public_prune_view();
15142
15198
  init_public_prune_input_chain();
15143
15199
  init_shard();
15200
+ pruneAdvanceMemo = new Map;
15201
+ shardProofs = new WeakMap;
15202
+ snapshotBindings = new WeakMap;
15144
15203
  });
15145
15204
 
15146
15205
  // node_modules/@staix/agent-mem/src/memory/mutation.ts
@@ -15151,8 +15210,8 @@ var init_mutation = __esm(() => {
15151
15210
  });
15152
15211
 
15153
15212
  // node_modules/@staix/agent-mem/src/memory/formats.ts
15154
- import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
15155
- var MAX_BYTES4, SEMVER, READER_VERSION;
15213
+ import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, lstatSync as lstatSync20, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
15214
+ var MAX_BYTES4, SEMVER, READER_VERSION, floorMemo;
15156
15215
  var init_formats = __esm(() => {
15157
15216
  MAX_BYTES4 = 64 * 1024;
15158
15217
  SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
@@ -15164,6 +15223,7 @@ var init_formats = __esm(() => {
15164
15223
  return;
15165
15224
  }
15166
15225
  })();
15226
+ floorMemo = new Map;
15167
15227
  });
15168
15228
  // node_modules/@staix/agent-mem/src/memory/sync-placement-bound.ts
15169
15229
  var PLACEMENT_SOURCE_MAX_BYTES;
@@ -15348,16 +15408,65 @@ var init_sync_placement_realm_effective = __esm(() => {
15348
15408
  init_sync_placement_realm_extension_format();
15349
15409
  });
15350
15410
  // node_modules/@staix/agent-mem/src/memory/profile-lock-diagnostic.ts
15351
- var recognised;
15411
+ function rememberProfileLockError(error, text) {
15412
+ if (Object.values(messages).includes(text))
15413
+ recognised.set(error, text);
15414
+ }
15415
+ var messages, recognised;
15352
15416
  var init_profile_lock_diagnostic = __esm(() => {
15353
15417
  init_platform();
15418
+ messages = {
15419
+ shards: "An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
15420
+ 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.",
15421
+ 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.",
15422
+ 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.",
15423
+ 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."
15424
+ };
15354
15425
  recognised = new WeakMap;
15355
15426
  });
15356
15427
 
15357
15428
  // node_modules/@staix/agent-mem/src/memory/sync-placement-guard.ts
15358
15429
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
15359
- var doctorContext;
15430
+ import { closeSync as closeSync10, constants as constants9, fstatSync as fstatSync9, lstatSync as lstatSync21, openSync as openSync10, readSync as readSync7 } from "fs";
15431
+ function readMarkerUncached(file) {
15432
+ for (let attempt = 0;attempt < 6; attempt++) {
15433
+ let fd;
15434
+ try {
15435
+ const before = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
15436
+ if (!before)
15437
+ return;
15438
+ if (!before.isFile() || before.isSymbolicLink() || before.size > BigInt(LOCAL_METADATA_MAX_BYTES))
15439
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15440
+ fd = openSync10(file, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
15441
+ const opened = fstatSync9(fd, { bigint: true });
15442
+ if (!sameMetadataStamp(before, opened))
15443
+ throw new MarkerChanged;
15444
+ const bytes = Buffer.alloc(Number(opened.size) + 1);
15445
+ let count = 0;
15446
+ while (count < bytes.length) {
15447
+ const read = readSync7(fd, bytes, count, bytes.length - count, count);
15448
+ if (!read)
15449
+ break;
15450
+ count += read;
15451
+ }
15452
+ const after = fstatSync9(fd, { bigint: true }), named = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
15453
+ if (count !== Number(opened.size) || !sameMetadataStamp(opened, after) || !named || named.isSymbolicLink() || !sameMetadataStamp(opened, named))
15454
+ throw new MarkerChanged;
15455
+ return { stamp: named, value: JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(0, count))) };
15456
+ } catch (error) {
15457
+ if (error instanceof MarkerChanged && attempt < 5)
15458
+ continue;
15459
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15460
+ } finally {
15461
+ if (fd !== undefined)
15462
+ closeSync10(fd);
15463
+ }
15464
+ }
15465
+ throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
15466
+ }
15467
+ 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;
15360
15468
  var init_sync_placement_guard = __esm(() => {
15469
+ init_profile_marker_cache();
15361
15470
  init_sync_placement_active();
15362
15471
  init_sync_placement_realm_effective();
15363
15472
  init_generation();
@@ -15367,7 +15476,62 @@ var init_sync_placement_guard = __esm(() => {
15367
15476
  init_sync_placement_format();
15368
15477
  init_profile_lock_diagnostic();
15369
15478
  doctorContext = new AsyncLocalStorage3;
15479
+ SyncPlacementRuntimeError = class SyncPlacementRuntimeError extends Error {
15480
+ code;
15481
+ constructor(reason) {
15482
+ super(reason);
15483
+ this.name = "SyncPlacementRuntimeError";
15484
+ this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";
15485
+ rememberProfileLockError(this, reason);
15486
+ }
15487
+ };
15488
+ MarkerChanged = class MarkerChanged extends Error {
15489
+ };
15490
+ readMarker = metadataReader(readMarkerUncached);
15491
+ });
15492
+ // node_modules/@staix/agent-mem/src/memory/search-score.ts
15493
+ function sql(expr, rank) {
15494
+ const get = (part) => sql(part, rank);
15495
+ switch (expr.op) {
15496
+ case "rank":
15497
+ return rank;
15498
+ case "tier":
15499
+ return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
15500
+ case "age":
15501
+ return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
15502
+ case "constant":
15503
+ return real(expr.value);
15504
+ case "negative":
15505
+ return `(-(${get(expr.value)}))`;
15506
+ case "reciprocal":
15507
+ return `(1.0 / ${get(expr.value)})`;
15508
+ case "add":
15509
+ return `(${get(expr.left)} + ${get(expr.right)})`;
15510
+ case "multiply":
15511
+ return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
15512
+ case "max":
15513
+ return `max(${get(expr.left)}, ${get(expr.right)})`;
15514
+ }
15515
+ }
15516
+ function rankedScoreSql(rank = "bm25(docs)") {
15517
+ return sql(SCORE, rank);
15518
+ }
15519
+ 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);
15520
+ var init_search_score = __esm(() => {
15521
+ TIER_WEIGHTS = { long: 1, capture: 0.5 };
15522
+ TIER_FACTOR = { op: "tier" };
15523
+ DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
15524
+ RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
15525
+ SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
15526
+ });
15527
+
15528
+ // node_modules/@staix/agent-mem/src/memory/search-fts.ts
15529
+ var SCREENED_SUBSTRING_SCORE;
15530
+ var init_search_fts = __esm(() => {
15531
+ init_search_score();
15532
+ SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
15370
15533
  });
15534
+
15371
15535
  // node_modules/@staix/agent-mem/src/memory/lifecycle-log.ts
15372
15536
  var MAX_LOG_BYTES;
15373
15537
  var init_lifecycle_log = __esm(() => {
@@ -15383,9 +15547,9 @@ var init_aliases = __esm(() => {
15383
15547
  var init_shard = __esm(() => {
15384
15548
  init_sync_placement_active();
15385
15549
  init_sync_placement_realm_effective();
15386
- init_sync_placement_format();
15387
15550
  init_sync_placement_guard();
15388
15551
  init_public_prune_view();
15552
+ init_search_fts();
15389
15553
  init_generation();
15390
15554
  init_aliases();
15391
15555
  init_profile_lock_diagnostic();
@@ -15402,6 +15566,7 @@ var init_sync_placement_format = __esm(() => {
15402
15566
  });
15403
15567
 
15404
15568
  // node_modules/@staix/agent-mem/src/memory/generation.ts
15569
+ var LOCAL_METADATA_MAX_BYTES = 262144;
15405
15570
  var init_generation = __esm(() => {
15406
15571
  init_sync_placement_format();
15407
15572
  init_sync_placement_guard();
@@ -15628,50 +15793,6 @@ var init_lifecycle = __esm(() => {
15628
15793
  init_lifecycle_log();
15629
15794
  init_shard();
15630
15795
  });
15631
-
15632
- // node_modules/@staix/agent-mem/src/memory/search-score.ts
15633
- function sql(expr, rank) {
15634
- const get = (part) => sql(part, rank);
15635
- switch (expr.op) {
15636
- case "rank":
15637
- return rank;
15638
- case "tier":
15639
- return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
15640
- case "age":
15641
- return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
15642
- case "constant":
15643
- return real(expr.value);
15644
- case "negative":
15645
- return `(-(${get(expr.value)}))`;
15646
- case "reciprocal":
15647
- return `(1.0 / ${get(expr.value)})`;
15648
- case "add":
15649
- return `(${get(expr.left)} + ${get(expr.right)})`;
15650
- case "multiply":
15651
- return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
15652
- case "max":
15653
- return `max(${get(expr.left)}, ${get(expr.right)})`;
15654
- }
15655
- }
15656
- function rankedScoreSql(rank = "bm25(docs)") {
15657
- return sql(SCORE, rank);
15658
- }
15659
- 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);
15660
- var init_search_score = __esm(() => {
15661
- TIER_WEIGHTS = { long: 1, capture: 0.5 };
15662
- TIER_FACTOR = { op: "tier" };
15663
- DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
15664
- RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
15665
- SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
15666
- });
15667
-
15668
- // node_modules/@staix/agent-mem/src/memory/search-fts.ts
15669
- var SCREENED_SCORE, SCREENED_SUBSTRING_SCORE;
15670
- var init_search_fts = __esm(() => {
15671
- init_search_score();
15672
- SCREENED_SCORE = rankedScoreSql();
15673
- SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
15674
- });
15675
15796
  // node_modules/@staix/agent-mem/src/memory/capture-input.ts
15676
15797
  var TOOL_INPUT_OMIT;
15677
15798
  var init_capture_input = __esm(() => {
@@ -16026,6 +16147,12 @@ var init_candidate_origin = __esm(() => {
16026
16147
  init_screen();
16027
16148
  });
16028
16149
 
16150
+ // node_modules/@staix/agent-mem/src/memory/topic.ts
16151
+ var TOPIC_FORM = "[a-z0-9][a-z0-9/-]{0,63}", TOPIC;
16152
+ var init_topic = __esm(() => {
16153
+ TOPIC = new RegExp(`^${TOPIC_FORM}$`);
16154
+ });
16155
+
16029
16156
  // node_modules/@staix/agent-mem/src/memory/candidates.ts
16030
16157
  var CANDIDATE_RETENTION, COUNTER_RETENTION;
16031
16158
  var init_candidates = __esm(() => {
@@ -16037,6 +16164,7 @@ var init_candidates = __esm(() => {
16037
16164
  init_platform();
16038
16165
  init_private_spans();
16039
16166
  init_candidate_origin();
16167
+ init_topic();
16040
16168
  CANDIDATE_RETENTION = { count: 500, ageMs: 30 * 86400000 };
16041
16169
  COUNTER_RETENTION = { count: 1e4, ageMs: 90 * 86400000 };
16042
16170
  });
@@ -16145,9 +16273,36 @@ var init_report_text = __esm(() => {
16145
16273
  init_style();
16146
16274
  });
16147
16275
  // node_modules/@staix/agent-mem/src/memory/consolidation-clusters.ts
16276
+ var OVERLAP_STOP;
16148
16277
  var init_consolidation_clusters = __esm(() => {
16149
16278
  init_search_fts();
16150
16279
  init_candidates();
16280
+ init_topic();
16281
+ OVERLAP_STOP = new Set([
16282
+ "the",
16283
+ "and",
16284
+ "for",
16285
+ "with",
16286
+ "from",
16287
+ "this",
16288
+ "that",
16289
+ "approach",
16290
+ "symptom",
16291
+ "cause",
16292
+ "evidence",
16293
+ "retry",
16294
+ "when",
16295
+ "\uC774\uAC83",
16296
+ "\uADF8\uAC83",
16297
+ "\uC800\uAC83",
16298
+ "\uC5B4\uB5A4",
16299
+ "\uBB34\uC5C7",
16300
+ "\uBAA8\uB4E0",
16301
+ "\uB610\uB294",
16302
+ "\uAC00\uC7A5",
16303
+ "\uC544\uC8FC",
16304
+ "\uB9E4\uC6B0"
16305
+ ]);
16151
16306
  });
16152
16307
 
16153
16308
  // node_modules/@staix/agent-mem/src/memory/forget-nearby.ts
@@ -16173,6 +16328,7 @@ var init_commands = __esm(() => {
16173
16328
  init_src();
16174
16329
  init_project2();
16175
16330
  init_forget_nearby();
16331
+ init_topic();
16176
16332
  AMEM_NAMES = { memory: "amem", goal: "amem goal" };
16177
16333
  MEMORY_USAGE = memoryUsage();
16178
16334
  GOAL_USAGE = goalUsage();
@@ -16212,39 +16368,41 @@ var init_shard_migration = __esm(() => {
16212
16368
  var init_shard_migration_text = __esm(() => {
16213
16369
  init_style();
16214
16370
  });
16215
-
16216
16371
  // node_modules/@staix/agent-mem/src/mcp.ts
16217
- 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) => ({
16372
+ 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) => ({
16218
16373
  name,
16219
16374
  description,
16220
16375
  inputSchema,
16221
16376
  annotations: { readOnlyHint, destructiveHint: false, openWorldHint: false }
16222
16377
  }), MCP_TOOLS;
16223
16378
  var init_mcp = __esm(() => {
16379
+ briefNodes = { type: "array", maxItems: 9, items: string(512) };
16380
+ failText = string(1200);
16224
16381
  limit = { type: "integer", minimum: 1, maximum: 100 };
16225
16382
  MCP_TOOLS = [
16226
16383
  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"])),
16227
16384
  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"])),
16228
16385
  tool("amem_show", "Show a screened memory entry in this project by its exact id or unique prefix.", object7({ id: string(80) }, ["id"])),
16229
16386
  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" } })),
16230
- 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"])),
16387
+ 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"])),
16231
16388
  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"])),
16232
16389
  tool("amem_work_state_read", "Read project work lists; closed lists/items can be included explicitly.", object7({ list: string(200), includeClosed: { type: "boolean" } })),
16233
16390
  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: {
16234
16391
  type: "object",
16235
16392
  minProperties: 1,
16236
- maxProperties: 64,
16237
- additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 4000 }
16393
+ maxProperties: 12,
16394
+ additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 640 }
16238
16395
  } }, ["list", "fields"]), false),
16239
- 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({
16396
+ 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({
16240
16397
  text: string(3000),
16241
16398
  title: string(200),
16242
16399
  kind: { type: "string", enum: ["decision", "finding", "contract", "fail", "preference"] },
16243
- approach: string(4000),
16244
- symptom: string(4000),
16245
- cause: string(4000),
16246
- evidenceRefs: { type: "array", minItems: 1, maxItems: 16, items: string(400) },
16247
- retryWhen: string(4000)
16400
+ topic: string(64),
16401
+ approach: failText,
16402
+ symptom: failText,
16403
+ cause: failText,
16404
+ evidenceRefs: { type: "array", minItems: 1, maxItems: 8, items: string(250) },
16405
+ retryWhen: failText
16248
16406
  }), false),
16249
16407
  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),
16250
16408
  tool("amem_vault_candidates", "List screened durable curated notes for review before moving them to a vault. Read only.", object7({ limit })),
@@ -16334,6 +16492,7 @@ var init_mcp_memory = __esm(() => {
16334
16492
  init_store();
16335
16493
  init_vault();
16336
16494
  init_candidate_origin();
16495
+ init_topic();
16337
16496
  init_work_lists();
16338
16497
  TOOL_EVENTS = new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
16339
16498
  });
@@ -16443,6 +16602,15 @@ var init_hook_jcode = __esm(() => {
16443
16602
  FIELD_BYTES = 16 * 1024 + 64;
16444
16603
  });
16445
16604
 
16605
+ // node_modules/@staix/agent-mem/src/memory/roots.ts
16606
+ var READ_BOUND;
16607
+ var init_roots = __esm(() => {
16608
+ init_aliases();
16609
+ init_platform();
16610
+ init_project2();
16611
+ READ_BOUND = 256 * 1024;
16612
+ });
16613
+
16446
16614
  // node_modules/@staix/agent-mem/src/hooks.ts
16447
16615
  var hookStartedAt;
16448
16616
  var init_hooks = __esm(() => {
@@ -16462,6 +16630,7 @@ var init_hooks = __esm(() => {
16462
16630
  init_platform();
16463
16631
  init_policy();
16464
16632
  init_config();
16633
+ init_roots();
16465
16634
  init_hook_contract();
16466
16635
  init_hook_contract();
16467
16636
  hookStartedAt = performance.now();
@@ -16529,6 +16698,7 @@ var init_session_brief = __esm(() => {
16529
16698
  init_config();
16530
16699
  init_candidate_pending();
16531
16700
  init_project2();
16701
+ init_roots();
16532
16702
  init_reader_lease();
16533
16703
  init_metrics();
16534
16704
  init_shard();
@@ -17123,6 +17293,35 @@ var init_setup_writer_roots = __esm(() => {
17123
17293
  JOURNAL_MAX = 12 * MAX2;
17124
17294
  });
17125
17295
 
17296
+ // node_modules/@staix/agent-mem/src/setup-console.ts
17297
+ var init_setup_console = __esm(() => {
17298
+ init_mutation();
17299
+ });
17300
+
17301
+ // node_modules/@staix/agent-mem/src/memory/formats-raise.ts
17302
+ var PACKAGE_BYTES;
17303
+ var init_formats_raise = __esm(() => {
17304
+ init_formats();
17305
+ init_mutation();
17306
+ init_platform();
17307
+ PACKAGE_BYTES = 64 * 1024;
17308
+ });
17309
+
17310
+ // node_modules/@staix/agent-mem/src/setup-drift.ts
17311
+ var JOURNAL_BYTES, READ_BYTES;
17312
+ var init_setup_drift = __esm(() => {
17313
+ init_setup_writer_roots();
17314
+ init_setup_toml();
17315
+ init_setup_owned();
17316
+ init_setup_paths();
17317
+ init_hook_contract();
17318
+ init_platform();
17319
+ init_setup_console();
17320
+ init_formats_raise();
17321
+ JOURNAL_BYTES = 12 * SETUP_CONFIG_BYTES;
17322
+ READ_BYTES = 32 * 1024 * 1024;
17323
+ });
17324
+
17126
17325
  // node_modules/@staix/agent-mem/src/setup.ts
17127
17326
  var SETUP_ALL_TARGETS, PACKAGE_JSON_MAX;
17128
17327
  var init_setup = __esm(() => {
@@ -17141,6 +17340,8 @@ var init_setup = __esm(() => {
17141
17340
  init_sync_placement_effective_writers();
17142
17341
  init_sync_placement_guard();
17143
17342
  init_home();
17343
+ init_setup_drift();
17344
+ init_setup_console();
17144
17345
  init_style();
17145
17346
  init_platform();
17146
17347
  SETUP_ALL_TARGETS = SETUP_TARGETS.filter((target) => target !== "agy");
@@ -17173,6 +17374,7 @@ var init_src2 = __esm(() => {
17173
17374
  init_migrate_text();
17174
17375
  init_prune_text();
17175
17376
  init_shard_migration_text();
17377
+ init_mcp();
17176
17378
  init_config();
17177
17379
  init_curated_brief_cache();
17178
17380
  init_sync_screen();
@@ -17207,7 +17409,6 @@ var init_src2 = __esm(() => {
17207
17409
  init_migrate();
17208
17410
  init_prune();
17209
17411
  init_shard_migration();
17210
- init_mcp();
17211
17412
  init_mcp_memory();
17212
17413
  init_policy();
17213
17414
  init_work_lists();
@@ -17236,7 +17437,7 @@ var init_src2 = __esm(() => {
17236
17437
  });
17237
17438
 
17238
17439
  // src/hub/log-rotation.ts
17239
- 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";
17440
+ 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";
17240
17441
  import { basename as basename5, dirname as dirname13, join as join20 } from "path";
17241
17442
  function segmentsOf(file) {
17242
17443
  const dir = dirname13(file), prefix = `${basename5(file)}.`;
@@ -17277,7 +17478,7 @@ var init_log_rotation = __esm(() => {
17277
17478
  });
17278
17479
 
17279
17480
  // src/hub/events.ts
17280
- import { appendFileSync as appendFileSync2, closeSync as closeSync11, existsSync as existsSync10, fstatSync as fstatSync10, openSync as openSync11, readFileSync as readFileSync9, readSync as readSync8 } from "fs";
17481
+ import { appendFileSync as appendFileSync2, closeSync as closeSync12, existsSync as existsSync10, fstatSync as fstatSync11, openSync as openSync12, readFileSync as readFileSync9, readSync as readSync9 } from "fs";
17281
17482
  function readEvents(file, since = 0) {
17282
17483
  for (let attempt = 0;; attempt++) {
17283
17484
  const segments = segmentsOf(file), out = [];
@@ -20843,6 +21044,7 @@ var init_native_channel_state = __esm(() => {
20843
21044
  });
20844
21045
 
20845
21046
  // src/hub/claude-state.ts
21047
+ 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);
20846
21048
  var init_claude_state = __esm(() => {
20847
21049
  init_native_channel_state();
20848
21050
  });
@@ -21042,7 +21244,7 @@ __export(exports_claude_implementer, {
21042
21244
  ClaudeImplementerPeer: () => ClaudeImplementerPeer
21043
21245
  });
21044
21246
  import { randomUUID as randomUUID9 } from "crypto";
21045
- import { lstatSync as lstatSync19, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
21247
+ import { lstatSync as lstatSync22, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
21046
21248
  import { tmpdir as tmpdir5 } from "os";
21047
21249
  import { join as join22 } from "path";
21048
21250
  function provenVersion(binding) {
@@ -21100,7 +21302,7 @@ function claudeImplementerArgs(turn, mcp, settings, prompt, model) {
21100
21302
  async function proveClaudeImplementer(peer, command) {
21101
21303
  const binary = Bun.which(command[0], { PATH: process.env.PATH }) ?? command[0];
21102
21304
  const fingerprint = () => {
21103
- const file = realPath(binary), stat = lstatSync19(file);
21305
+ const file = realPath(binary), stat = lstatSync22(file);
21104
21306
  return [file, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
21105
21307
  };
21106
21308
  const binding = fingerprint(), home = mkdtempSync6(join22(tmpdir5(), "ahub-claude-proof-"));
@@ -21715,7 +21917,7 @@ var init_reviewer_variants = __esm(() => {
21715
21917
  });
21716
21918
 
21717
21919
  // src/adapters/agy/hooks.ts
21718
- import { closeSync as closeSync12, constants as constants9, fstatSync as fstatSync11, lstatSync as lstatSync20, openSync as openSync12, readSync as readSync9 } from "fs";
21920
+ import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync12, lstatSync as lstatSync23, openSync as openSync13, readSync as readSync10 } from "fs";
21719
21921
  import { homedir as homedir5 } from "os";
21720
21922
  import { isAbsolute as isAbsolute7, join as join23, relative as relative5 } from "path";
21721
21923
  import { createHash as createHash12 } from "crypto";
@@ -21780,11 +21982,11 @@ function readAgyTranscript(session, transcript, options) {
21780
21982
  let cursor = home;
21781
21983
  for (const name of relative5(home, transcript).split("/")) {
21782
21984
  cursor = join23(cursor, name);
21783
- if (lstatSync20(cursor).isSymbolicLink())
21985
+ if (lstatSync23(cursor).isSymbolicLink())
21784
21986
  return empty;
21785
21987
  }
21786
- fd = openSync12(transcript, constants9.O_RDONLY | constants9.O_NOFOLLOW);
21787
- const stat = fstatSync11(fd);
21988
+ fd = openSync13(transcript, constants10.O_RDONLY | constants10.O_NOFOLLOW);
21989
+ const stat = fstatSync12(fd);
21788
21990
  if (!stat.isFile() || stat.nlink !== 1)
21789
21991
  return empty;
21790
21992
  if (options?.unchanged && stat.size === options.unchanged.size && stat.mtimeMs === options.unchanged.mtimeMs)
@@ -21799,7 +22001,7 @@ function readAgyTranscript(session, transcript, options) {
21799
22001
  const buffer = Buffer.alloc(stat.size - from);
21800
22002
  let bytes = 0;
21801
22003
  while (bytes < buffer.length) {
21802
- const count = readSync9(fd, buffer, bytes, buffer.length - bytes, from + bytes);
22004
+ const count = readSync10(fd, buffer, bytes, buffer.length - bytes, from + bytes);
21803
22005
  if (!count)
21804
22006
  break;
21805
22007
  bytes += count;
@@ -21860,7 +22062,7 @@ function readAgyTranscript(session, transcript, options) {
21860
22062
  return empty;
21861
22063
  } finally {
21862
22064
  if (fd !== undefined)
21863
- closeSync12(fd);
22065
+ closeSync13(fd);
21864
22066
  }
21865
22067
  }
21866
22068
  var EVENTS2, UUID2, record6 = (value) => !!value && typeof value === "object" && !Array.isArray(value), AGY_FACTS_HOOK;
@@ -21941,6 +22143,27 @@ function builtinCliEntries(definitions) {
21941
22143
  import { readFileSync as readFileSync11 } from "fs";
21942
22144
  import { join as join24 } from "path";
21943
22145
  import { randomUUID as randomUUID10 } from "crypto";
22146
+ function managedSession(nativeArgs) {
22147
+ const separator = nativeArgs.indexOf("--");
22148
+ const options = separator < 0 ? nativeArgs : nativeArgs.slice(0, separator);
22149
+ const values = (names) => options.flatMap((arg, index) => {
22150
+ if (names.includes(arg))
22151
+ return [options[index + 1]];
22152
+ const name = names.find((value) => arg.startsWith(value + "="));
22153
+ return name ? [arg.slice(name.length + 1)] : [];
22154
+ });
22155
+ const explicit = values(["--session-id"]);
22156
+ const resume = values(["--resume", "-r"]);
22157
+ if (explicit.length)
22158
+ return explicit.length === 1 && isClaudeSessionUuid(explicit[0]) ? explicit[0] : undefined;
22159
+ if (options.some((arg) => ["-c", "--continue", "--from-pr", "--teleport", "--fork-session"].some((flag) => arg === flag || arg.startsWith(flag + "="))))
22160
+ return;
22161
+ if (resume.length)
22162
+ return resume.length === 1 && isClaudeSessionUuid(resume[0]) ? resume[0] : undefined;
22163
+ const id = randomUUID10();
22164
+ nativeArgs.unshift("--session-id", id);
22165
+ return id;
22166
+ }
21944
22167
  async function runClaudeEntry(ctx) {
21945
22168
  const { args, cwd, stateDir, cliDir, unattendedEnv, projectConfig, fail } = ctx;
21946
22169
  const peer = ctx.instance ?? "claude";
@@ -22006,6 +22229,9 @@ async function runClaudeEntry(ctx) {
22006
22229
  let launchRecord;
22007
22230
  if (control?.instanceId) {
22008
22231
  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 };
22232
+ const nativeSessionId = managedSession(launch.args);
22233
+ if (nativeSessionId)
22234
+ launchRecord.nativeSessionId = nativeSessionId;
22009
22235
  recordClaudeLaunch(stateDir, launchRecord);
22010
22236
  cleanupStaleClaudeSettings(stateDir, previousLaunch);
22011
22237
  }
@@ -22094,10 +22320,10 @@ var init_native_cli_entry_codex = () => {};
22094
22320
 
22095
22321
  // src/cli/kimi-plugin.ts
22096
22322
  import { randomUUID as randomUUID11 } from "crypto";
22097
- 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";
22323
+ 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";
22098
22324
  import { dirname as dirname15, isAbsolute as isAbsolute8, join as join25 } from "path";
22099
22325
  function file(path, cap) {
22100
- const stat = lstatSync21(path, { throwIfNoEntry: false });
22326
+ const stat = lstatSync24(path, { throwIfNoEntry: false });
22101
22327
  if (!stat)
22102
22328
  return;
22103
22329
  if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1 || stat.size > cap)
@@ -22117,27 +22343,27 @@ function parse2(value, name) {
22117
22343
  }
22118
22344
  }
22119
22345
  function atomic(path, bytes, before) {
22120
- const current = lstatSync21(path, { throwIfNoEntry: false });
22346
+ const current = lstatSync24(path, { throwIfNoEntry: false });
22121
22347
  if (before ? !current || current.dev !== before.dev || current.ino !== before.ino : current)
22122
22348
  throw new Error(`${path} changed before its managed write`);
22123
22349
  const temporary = `${path}.${randomUUID11()}.tmp`;
22124
22350
  let fd;
22125
22351
  try {
22126
- fd = openSync13(temporary, "wx", 384);
22352
+ fd = openSync14(temporary, "wx", 384);
22127
22353
  writeFileSync10(fd, bytes);
22128
- closeSync13(fd);
22354
+ closeSync14(fd);
22129
22355
  fd = undefined;
22130
22356
  renameSync6(temporary, path);
22131
22357
  } finally {
22132
22358
  if (fd !== undefined)
22133
- closeSync13(fd);
22359
+ closeSync14(fd);
22134
22360
  try {
22135
22361
  unlinkSync4(temporary);
22136
22362
  } catch {}
22137
22363
  }
22138
22364
  }
22139
22365
  function removeFile(path, expected) {
22140
- const current = lstatSync21(path, { throwIfNoEntry: false });
22366
+ const current = lstatSync24(path, { throwIfNoEntry: false });
22141
22367
  if (!current || !current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || !readFileSync12(path).equals(expected))
22142
22368
  return;
22143
22369
  unlinkSync4(path);
@@ -22228,14 +22454,14 @@ function locked(options, run) {
22228
22454
  const path = join25(options.home, "agent-hub-plugin.lock");
22229
22455
  let fd;
22230
22456
  try {
22231
- fd = openSync13(path, "wx", 384);
22457
+ fd = openSync14(path, "wx", 384);
22232
22458
  } catch {
22233
22459
  throw new Error(`Another Kimi plugin replacement is active or left a stale lock; retry after it exits or inspect ${path}`);
22234
22460
  }
22235
22461
  try {
22236
22462
  return run();
22237
22463
  } finally {
22238
- closeSync13(fd);
22464
+ closeSync14(fd);
22239
22465
  unlinkSync4(path);
22240
22466
  }
22241
22467
  }
@@ -22277,7 +22503,7 @@ function cleanupKimiPlugin(options) {
22277
22503
  });
22278
22504
  }
22279
22505
  var EVENTS3, ID2 = "agent-hub", MAX_INSTALLED, MAX_HOOK, object8 = (value) => !!value && typeof value === "object" && !Array.isArray(value), directory = (path, required = true) => {
22280
- const stat = lstatSync21(path, { throwIfNoEntry: false });
22506
+ const stat = lstatSync24(path, { throwIfNoEntry: false });
22281
22507
  if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
22282
22508
  throw new Error(`${path} must be a plain directory`);
22283
22509
  if (!stat && required)
@@ -23037,7 +23263,7 @@ var init_native_config_policy = __esm(() => {
23037
23263
  });
23038
23264
 
23039
23265
  // src/adapters/definitions/native-policy-aux.ts
23040
- import { closeSync as closeSync14, constants as constants10, fstatSync as fstatSync12, openSync as openSync14, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
23266
+ import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, openSync as openSync15, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
23041
23267
  import { isAbsolute as isAbsolute9, join as join30, normalize } from "path";
23042
23268
  function claudeCrashPlan(_meta) {
23043
23269
  return { how: "claude: the Claude Code plugin reconnects by itself while that session is still open" };
@@ -23142,8 +23368,8 @@ function absoluteContinuityPath(value) {
23142
23368
  var str3 = (value) => typeof value === "string" && value ? value : undefined, PLUGINS, CLAUDE_ONLY, text2 = (file) => {
23143
23369
  let fd;
23144
23370
  try {
23145
- fd = openSync14(file, constants10.O_RDONLY | constants10.O_NONBLOCK);
23146
- const st = fstatSync12(fd);
23371
+ fd = openSync15(file, constants11.O_RDONLY | constants11.O_NONBLOCK);
23372
+ const st = fstatSync13(fd);
23147
23373
  if (!st.isFile() || st.size > 1024 * 1024)
23148
23374
  return;
23149
23375
  return readFileSync14(fd, "utf8");
@@ -23151,7 +23377,7 @@ var str3 = (value) => typeof value === "string" && value ? value : undefined, PL
23151
23377
  return;
23152
23378
  } finally {
23153
23379
  if (fd !== undefined)
23154
- closeSync14(fd);
23380
+ closeSync15(fd);
23155
23381
  }
23156
23382
  }, json = (file) => {
23157
23383
  try {
@@ -23446,7 +23672,7 @@ var init_native_recovery = __esm(() => {
23446
23672
  });
23447
23673
 
23448
23674
  // src/adapters/kimi-tui-facts.ts
23449
- import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, lstatSync as lstatSync22, openSync as openSync15, readSync as readSync10, readdirSync as readdirSync7 } from "fs";
23675
+ import { closeSync as closeSync16, constants as constants12, fstatSync as fstatSync14, lstatSync as lstatSync25, openSync as openSync16, readSync as readSync11, readdirSync as readdirSync7 } from "fs";
23450
23676
  import { createHash as createHash13 } from "crypto";
23451
23677
  import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute10, join as join34, relative as relative6 } from "path";
23452
23678
  import { homedir as homedir9 } from "os";
@@ -23468,26 +23694,26 @@ function encodeKimiTuiHook() {
23468
23694
  return;
23469
23695
  }
23470
23696
  function readBytes(path, cap, tail = false) {
23471
- const link = lstatSync22(path);
23697
+ const link = lstatSync25(path);
23472
23698
  if (!link.isFile() || link.isSymbolicLink() || link.nlink !== 1)
23473
23699
  throw new Error("not a regular file");
23474
- const fd = openSync15(path, constants11.O_RDONLY | constants11.O_NOFOLLOW);
23700
+ const fd = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW);
23475
23701
  try {
23476
- const stat = fstatSync13(fd);
23702
+ const stat = fstatSync14(fd);
23477
23703
  if (!stat.isFile() || stat.nlink !== 1 || !tail && stat.size > cap)
23478
23704
  throw new Error("invalid file");
23479
23705
  const length = Math.min(stat.size, cap), start = tail ? stat.size - length : 0;
23480
23706
  const bytes = Buffer.alloc(length);
23481
23707
  let offset = 0;
23482
23708
  while (offset < length) {
23483
- const count = readSync10(fd, bytes, offset, length - offset, start + offset);
23709
+ const count = readSync11(fd, bytes, offset, length - offset, start + offset);
23484
23710
  if (count <= 0)
23485
23711
  throw new Error("short read");
23486
23712
  offset += count;
23487
23713
  }
23488
23714
  return bytes;
23489
23715
  } finally {
23490
- closeSync15(fd);
23716
+ closeSync16(fd);
23491
23717
  }
23492
23718
  }
23493
23719
  function sessionDirectory(index, session) {
@@ -23527,7 +23753,7 @@ function taskInventory(agents) {
23527
23753
  if (!entry.isDirectory())
23528
23754
  continue;
23529
23755
  const tasks = join34(agents, entry.name, "tasks");
23530
- const dir = lstatSync22(tasks, { throwIfNoEntry: false });
23756
+ const dir = lstatSync25(tasks, { throwIfNoEntry: false });
23531
23757
  if (!dir)
23532
23758
  continue;
23533
23759
  if (!dir.isDirectory() || dir.isSymbolicLink())
@@ -31916,7 +32142,7 @@ init_registry();
31916
32142
  // src/hub/config-trust.ts
31917
32143
  init_child_process();
31918
32144
  init_git();
31919
- import { lstatSync as lstatSync23, statSync as statSync8 } from "fs";
32145
+ import { lstatSync as lstatSync26, statSync as statSync8 } from "fs";
31920
32146
  import { dirname as dirname17, join as join36 } from "path";
31921
32147
  var MACHINE_LOCAL = [
31922
32148
  "kimi_cmd",
@@ -32467,6 +32693,9 @@ init_envelope();
32467
32693
  // src/hub/roadmap-sync.ts
32468
32694
  init_roadmap();
32469
32695
 
32696
+ // src/hub/roadmap-issue-states.ts
32697
+ init_sdlc();
32698
+
32470
32699
  // src/hub/roadmap-unplaced.ts
32471
32700
  init_envelope();
32472
32701
 
@@ -32738,7 +32967,7 @@ var FOLLOWUP_DEFAULTS = { windowMs: LEARNING_DEFAULTS.windowMs, minReviewed: 5 }
32738
32967
  init_deliverables();
32739
32968
 
32740
32969
  // src/hub/deliverable-files.ts
32741
- import { constants as constants12, lstatSync as lstatSync24 } from "fs";
32970
+ import { constants as constants13, lstatSync as lstatSync27 } from "fs";
32742
32971
  init_tools();
32743
32972
  init_deny();
32744
32973
  init_permission_mode();
@@ -32746,7 +32975,7 @@ init_project();
32746
32975
  init_path_policy();
32747
32976
  init_deliverables();
32748
32977
  var CHUNK = 1024 * 1024;
32749
- var NOFOLLOW = constants12.O_NOFOLLOW ?? 0;
32978
+ var NOFOLLOW = constants13.O_NOFOLLOW ?? 0;
32750
32979
 
32751
32980
  // src/hub/tasks.ts
32752
32981
  init_src2();
@@ -32774,7 +33003,7 @@ init_registry();
32774
33003
  init_registry();
32775
33004
  // src/hub/task-sweep.ts
32776
33005
  var TASK_WAIT_MAX_MS = 14 * 24 * 3600000;
32777
- var WAIT_KEEPING_EVENTS = new Set(["wait recorded", "idle sweep", "answer", "reviewer changed", "memory reference started", "ready held", "plan observed", "planner changed", "claim verdict", "invocation", "shell branch bound"]);
33006
+ var WAIT_KEEPING_EVENTS = new Set(["wait recorded", "idle sweep", "answer", "reviewer changed", "memory reference started", "ready held", "plan observed", "planner changed", "claim verdict", "invocation", "shell branch bound", "check run passed", "check run failed"]);
32778
33007
  var GROOMING_CODES = new Set(["tests", "spec", "roster", "pull-only", "not-attached", "excluded", "owner-admission", "offline", "paused", "failing", "pii", "policy", "cancelled", "unavailable", "runner", "approvals", "quota", "dependency", "no-writes"]);
32779
33008
 
32780
33009
  // src/hub/ci-watch.ts
@@ -41456,7 +41685,7 @@ init_registry();
41456
41685
  // src/hub/instance-execution.ts
41457
41686
  init_git();
41458
41687
  init_project();
41459
- import { lstatSync as lstatSync25 } from "fs";
41688
+ import { lstatSync as lstatSync28 } from "fs";
41460
41689
  import { join as join39, resolve as resolve20 } from "path";
41461
41690
  var refuse = (reason) => {
41462
41691
  throw new Error(`instance execution workspace refused: ${reason}`);
@@ -41499,7 +41728,7 @@ function resolveInstanceExecutionCwd(projectRoot, id, declarations, roles, adapt
41499
41728
  try {
41500
41729
  root = realPath(projectRoot);
41501
41730
  cwd = realPath(resolve20(root, declaration.worktree));
41502
- if (!lstatSync25(root).isDirectory() || !lstatSync25(cwd).isDirectory())
41731
+ if (!lstatSync28(root).isDirectory() || !lstatSync28(cwd).isDirectory())
41503
41732
  return refuse("workspace is not a directory");
41504
41733
  } catch {
41505
41734
  return refuse("workspace paths are unavailable");
@@ -41977,6 +42206,7 @@ async function connectLoop() {
41977
42206
  ...toolsMode || sessionJoin ? {} : { channel, channelEvidence },
41978
42207
  ...!toolsMode && !sessionJoin ? { retainStandby: true, clientPid: process.pid } : {},
41979
42208
  ...sessionJoin ? { session: sessionJoin.label } : {},
42209
+ ...process.env.CLAUDE_CODE_SESSION_ID ? { claudeSessionId: process.env.CLAUDE_CODE_SESSION_ID } : {},
41980
42210
  ...process.env.AGENTHUB_LAUNCH_ID ? { launchId: process.env.AGENTHUB_LAUNCH_ID } : {},
41981
42211
  ...executionCwd !== undefined ? { cwd: executionCwd } : {},
41982
42212
  ...!toolsMode && standingBy ? { standby: true } : {},