@staix/agent-hub 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/docs/design/adapters.md +1 -0
- package/docs/design/agent-hub-architecture.md +1 -0
- package/docs/design/agent-hub.md +1 -0
- package/docs/design/bus.md +1 -0
- package/docs/design/cli-output-inventory.md +16 -16
- package/docs/design/cli-output.md +2 -1
- package/docs/design/execution-reference.md +1 -0
- package/docs/design/guidance-experiments.md +1 -0
- package/docs/design/guidance-probes.md +1 -0
- package/docs/design/model-routes.md +1 -0
- package/docs/design/roadmap.md +1 -0
- package/docs/design/supervision.md +1 -0
- package/docs/design/task-board.md +1 -0
- package/docs/dogfood.md +1 -0
- package/docs/memory.md +3 -3
- package/docs/operations.md +6 -3
- package/docs/quickstart.md +16 -3
- package/docs/security.md +1 -1
- package/docs/verification/2026-11-29-0.49.1.md +50 -0
- package/docs/verification/2026-11-29-0.50.0.md +54 -0
- package/docs/verified.json +13 -13
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +322 -96
- package/plugins/agent-hub/server.js +327 -101
- package/src/cli/console-state.ts +12 -39
- package/src/cli/help.ts +4 -4
- package/src/cli/main.ts +19 -7
|
@@ -14818,7 +14818,7 @@ var package_default;
|
|
|
14818
14818
|
var init_package = __esm(() => {
|
|
14819
14819
|
package_default = {
|
|
14820
14820
|
name: "@staix/agent-hub",
|
|
14821
|
-
version: "0.
|
|
14821
|
+
version: "0.50.0",
|
|
14822
14822
|
description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
|
|
14823
14823
|
license: "MIT",
|
|
14824
14824
|
type: "module",
|
|
@@ -14835,8 +14835,8 @@ var init_package = __esm(() => {
|
|
|
14835
14835
|
bun: ">=1.4.4"
|
|
14836
14836
|
},
|
|
14837
14837
|
dependencies: {
|
|
14838
|
-
"@staix/agent-mem": ">=0.
|
|
14839
|
-
"@staix/cli-output": "0.1.
|
|
14838
|
+
"@staix/agent-mem": ">=0.42.0 <1.0.0",
|
|
14839
|
+
"@staix/cli-output": "0.1.4"
|
|
14840
14840
|
},
|
|
14841
14841
|
devDependencies: {
|
|
14842
14842
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
@@ -15021,6 +15021,9 @@ var init_review_comments = __esm(() => {
|
|
|
15021
15021
|
init_review_anchor();
|
|
15022
15022
|
});
|
|
15023
15023
|
|
|
15024
|
+
// node_modules/@staix/agent-mem/src/memory/purge-intent.ts
|
|
15025
|
+
var init_purge_intent = () => {};
|
|
15026
|
+
|
|
15024
15027
|
// node_modules/@staix/agent-mem/src/memory/recap-scratch.ts
|
|
15025
15028
|
var RECAP_SCRATCH;
|
|
15026
15029
|
var init_recap_scratch = __esm(() => {
|
|
@@ -15111,6 +15114,60 @@ var init_brief_curated = __esm(() => {
|
|
|
15111
15114
|
init_brief_cache();
|
|
15112
15115
|
MAX_AGE = 24 * 60 * 60 * 1000;
|
|
15113
15116
|
});
|
|
15117
|
+
|
|
15118
|
+
// node_modules/@staix/agent-mem/src/memory/profile-marker-cache.ts
|
|
15119
|
+
import { lstatSync as lstatSync19 } from "fs";
|
|
15120
|
+
function sameMetadataStamp(a, b) {
|
|
15121
|
+
return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
|
|
15122
|
+
}
|
|
15123
|
+
function freezeMetadata(value) {
|
|
15124
|
+
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
15125
|
+
for (const child of Object.values(value))
|
|
15126
|
+
freezeMetadata(child);
|
|
15127
|
+
Object.freeze(value);
|
|
15128
|
+
}
|
|
15129
|
+
return value;
|
|
15130
|
+
}
|
|
15131
|
+
function metadataReader(read) {
|
|
15132
|
+
const entries = new Map;
|
|
15133
|
+
return (path) => {
|
|
15134
|
+
let before;
|
|
15135
|
+
try {
|
|
15136
|
+
before = lstatSync19(path, { bigint: true, throwIfNoEntry: false });
|
|
15137
|
+
} catch {
|
|
15138
|
+
entries.delete(path);
|
|
15139
|
+
return read(path)?.value;
|
|
15140
|
+
}
|
|
15141
|
+
const entry = entries.get(path);
|
|
15142
|
+
if (before?.isFile() && entry && sameMetadataStamp(before, entry.stamp)) {
|
|
15143
|
+
entries.delete(path);
|
|
15144
|
+
entries.set(path, entry);
|
|
15145
|
+
return entry.value;
|
|
15146
|
+
}
|
|
15147
|
+
entries.delete(path);
|
|
15148
|
+
const result = read(path);
|
|
15149
|
+
if (!result)
|
|
15150
|
+
return;
|
|
15151
|
+
const { value, stamp } = result;
|
|
15152
|
+
if (!before?.isFile() || !sameMetadataStamp(before, stamp))
|
|
15153
|
+
return value;
|
|
15154
|
+
try {
|
|
15155
|
+
freezeMetadata(value);
|
|
15156
|
+
} catch {
|
|
15157
|
+
return value;
|
|
15158
|
+
}
|
|
15159
|
+
if (value && typeof value === "object")
|
|
15160
|
+
snapshots.add(value);
|
|
15161
|
+
if (entries.size === 32)
|
|
15162
|
+
entries.delete(entries.keys().next().value);
|
|
15163
|
+
entries.set(path, { stamp, value });
|
|
15164
|
+
return value;
|
|
15165
|
+
};
|
|
15166
|
+
}
|
|
15167
|
+
var snapshots;
|
|
15168
|
+
var init_profile_marker_cache = __esm(() => {
|
|
15169
|
+
snapshots = new WeakSet;
|
|
15170
|
+
});
|
|
15114
15171
|
// node_modules/@staix/agent-mem/src/memory/home-identity.ts
|
|
15115
15172
|
var resolved;
|
|
15116
15173
|
var init_home_identity = __esm(() => {
|
|
@@ -15150,7 +15207,10 @@ var init_public_prune_input_chain = __esm(() => {
|
|
|
15150
15207
|
});
|
|
15151
15208
|
|
|
15152
15209
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-active.ts
|
|
15210
|
+
var pruneAdvanceMemo, shardProofs, snapshotBindings;
|
|
15153
15211
|
var init_sync_placement_active = __esm(() => {
|
|
15212
|
+
init_purge_intent();
|
|
15213
|
+
init_profile_marker_cache();
|
|
15154
15214
|
init_generation();
|
|
15155
15215
|
init_platform();
|
|
15156
15216
|
init_home_identity();
|
|
@@ -15160,19 +15220,24 @@ var init_sync_placement_active = __esm(() => {
|
|
|
15160
15220
|
init_public_prune_view();
|
|
15161
15221
|
init_public_prune_input_chain();
|
|
15162
15222
|
init_shard();
|
|
15223
|
+
pruneAdvanceMemo = new Map;
|
|
15224
|
+
shardProofs = new WeakMap;
|
|
15225
|
+
snapshotBindings = new WeakMap;
|
|
15163
15226
|
});
|
|
15164
15227
|
|
|
15165
15228
|
// node_modules/@staix/agent-mem/src/memory/mutation.ts
|
|
15166
15229
|
var mutations;
|
|
15167
15230
|
var init_mutation = __esm(() => {
|
|
15231
|
+
init_purge_intent();
|
|
15168
15232
|
init_platform();
|
|
15169
15233
|
mutations = new WeakMap;
|
|
15170
15234
|
});
|
|
15171
15235
|
|
|
15172
15236
|
// node_modules/@staix/agent-mem/src/memory/formats.ts
|
|
15173
|
-
import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
|
|
15174
|
-
var MAX_BYTES4, SEMVER, READER_VERSION;
|
|
15237
|
+
import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, lstatSync as lstatSync20, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
|
|
15238
|
+
var MAX_BYTES4, SEMVER, READER_VERSION, floorMemo;
|
|
15175
15239
|
var init_formats = __esm(() => {
|
|
15240
|
+
init_purge_intent();
|
|
15176
15241
|
MAX_BYTES4 = 64 * 1024;
|
|
15177
15242
|
SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
|
|
15178
15243
|
READER_VERSION = (() => {
|
|
@@ -15183,6 +15248,7 @@ var init_formats = __esm(() => {
|
|
|
15183
15248
|
return;
|
|
15184
15249
|
}
|
|
15185
15250
|
})();
|
|
15251
|
+
floorMemo = new Map;
|
|
15186
15252
|
});
|
|
15187
15253
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-bound.ts
|
|
15188
15254
|
var PLACEMENT_SOURCE_MAX_BYTES;
|
|
@@ -15367,16 +15433,66 @@ var init_sync_placement_realm_effective = __esm(() => {
|
|
|
15367
15433
|
init_sync_placement_realm_extension_format();
|
|
15368
15434
|
});
|
|
15369
15435
|
// node_modules/@staix/agent-mem/src/memory/profile-lock-diagnostic.ts
|
|
15370
|
-
|
|
15436
|
+
function rememberProfileLockError(error, text) {
|
|
15437
|
+
if (Object.values(messages).includes(text))
|
|
15438
|
+
recognised.set(error, text);
|
|
15439
|
+
}
|
|
15440
|
+
var messages, recognised;
|
|
15371
15441
|
var init_profile_lock_diagnostic = __esm(() => {
|
|
15372
15442
|
init_platform();
|
|
15443
|
+
messages = {
|
|
15444
|
+
shards: "An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
|
|
15445
|
+
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.",
|
|
15446
|
+
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.",
|
|
15447
|
+
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.",
|
|
15448
|
+
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."
|
|
15449
|
+
};
|
|
15373
15450
|
recognised = new WeakMap;
|
|
15374
15451
|
});
|
|
15375
15452
|
|
|
15376
15453
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-guard.ts
|
|
15377
15454
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
15378
|
-
|
|
15455
|
+
import { closeSync as closeSync10, constants as constants9, fstatSync as fstatSync9, lstatSync as lstatSync21, openSync as openSync10, readSync as readSync7 } from "fs";
|
|
15456
|
+
function readMarkerUncached(file) {
|
|
15457
|
+
for (let attempt = 0;attempt < 6; attempt++) {
|
|
15458
|
+
let fd;
|
|
15459
|
+
try {
|
|
15460
|
+
const before = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15461
|
+
if (!before)
|
|
15462
|
+
return;
|
|
15463
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > BigInt(LOCAL_METADATA_MAX_BYTES))
|
|
15464
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15465
|
+
fd = openSync10(file, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
|
|
15466
|
+
const opened = fstatSync9(fd, { bigint: true });
|
|
15467
|
+
if (!sameMetadataStamp(before, opened))
|
|
15468
|
+
throw new MarkerChanged;
|
|
15469
|
+
const bytes = Buffer.alloc(Number(opened.size) + 1);
|
|
15470
|
+
let count = 0;
|
|
15471
|
+
while (count < bytes.length) {
|
|
15472
|
+
const read = readSync7(fd, bytes, count, bytes.length - count, count);
|
|
15473
|
+
if (!read)
|
|
15474
|
+
break;
|
|
15475
|
+
count += read;
|
|
15476
|
+
}
|
|
15477
|
+
const after = fstatSync9(fd, { bigint: true }), named = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15478
|
+
if (count !== Number(opened.size) || !sameMetadataStamp(opened, after) || !named || named.isSymbolicLink() || !sameMetadataStamp(opened, named))
|
|
15479
|
+
throw new MarkerChanged;
|
|
15480
|
+
return { stamp: named, value: JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(0, count))) };
|
|
15481
|
+
} catch (error) {
|
|
15482
|
+
if (error instanceof MarkerChanged && attempt < 5)
|
|
15483
|
+
continue;
|
|
15484
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15485
|
+
} finally {
|
|
15486
|
+
if (fd !== undefined)
|
|
15487
|
+
closeSync10(fd);
|
|
15488
|
+
}
|
|
15489
|
+
}
|
|
15490
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15491
|
+
}
|
|
15492
|
+
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;
|
|
15379
15493
|
var init_sync_placement_guard = __esm(() => {
|
|
15494
|
+
init_purge_intent();
|
|
15495
|
+
init_profile_marker_cache();
|
|
15380
15496
|
init_sync_placement_active();
|
|
15381
15497
|
init_sync_placement_realm_effective();
|
|
15382
15498
|
init_generation();
|
|
@@ -15386,7 +15502,62 @@ var init_sync_placement_guard = __esm(() => {
|
|
|
15386
15502
|
init_sync_placement_format();
|
|
15387
15503
|
init_profile_lock_diagnostic();
|
|
15388
15504
|
doctorContext = new AsyncLocalStorage3;
|
|
15505
|
+
SyncPlacementRuntimeError = class SyncPlacementRuntimeError extends Error {
|
|
15506
|
+
code;
|
|
15507
|
+
constructor(reason) {
|
|
15508
|
+
super(reason);
|
|
15509
|
+
this.name = "SyncPlacementRuntimeError";
|
|
15510
|
+
this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";
|
|
15511
|
+
rememberProfileLockError(this, reason);
|
|
15512
|
+
}
|
|
15513
|
+
};
|
|
15514
|
+
MarkerChanged = class MarkerChanged extends Error {
|
|
15515
|
+
};
|
|
15516
|
+
readMarker = metadataReader(readMarkerUncached);
|
|
15517
|
+
});
|
|
15518
|
+
// node_modules/@staix/agent-mem/src/memory/search-score.ts
|
|
15519
|
+
function sql(expr, rank) {
|
|
15520
|
+
const get = (part) => sql(part, rank);
|
|
15521
|
+
switch (expr.op) {
|
|
15522
|
+
case "rank":
|
|
15523
|
+
return rank;
|
|
15524
|
+
case "tier":
|
|
15525
|
+
return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
|
|
15526
|
+
case "age":
|
|
15527
|
+
return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
|
|
15528
|
+
case "constant":
|
|
15529
|
+
return real(expr.value);
|
|
15530
|
+
case "negative":
|
|
15531
|
+
return `(-(${get(expr.value)}))`;
|
|
15532
|
+
case "reciprocal":
|
|
15533
|
+
return `(1.0 / ${get(expr.value)})`;
|
|
15534
|
+
case "add":
|
|
15535
|
+
return `(${get(expr.left)} + ${get(expr.right)})`;
|
|
15536
|
+
case "multiply":
|
|
15537
|
+
return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
|
|
15538
|
+
case "max":
|
|
15539
|
+
return `max(${get(expr.left)}, ${get(expr.right)})`;
|
|
15540
|
+
}
|
|
15541
|
+
}
|
|
15542
|
+
function rankedScoreSql(rank = "bm25(docs)") {
|
|
15543
|
+
return sql(SCORE, rank);
|
|
15544
|
+
}
|
|
15545
|
+
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);
|
|
15546
|
+
var init_search_score = __esm(() => {
|
|
15547
|
+
TIER_WEIGHTS = { long: 1, capture: 0.5 };
|
|
15548
|
+
TIER_FACTOR = { op: "tier" };
|
|
15549
|
+
DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
|
|
15550
|
+
RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
|
|
15551
|
+
SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
|
|
15552
|
+
});
|
|
15553
|
+
|
|
15554
|
+
// node_modules/@staix/agent-mem/src/memory/search-fts.ts
|
|
15555
|
+
var SCREENED_SUBSTRING_SCORE;
|
|
15556
|
+
var init_search_fts = __esm(() => {
|
|
15557
|
+
init_search_score();
|
|
15558
|
+
SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
|
|
15389
15559
|
});
|
|
15560
|
+
|
|
15390
15561
|
// node_modules/@staix/agent-mem/src/memory/lifecycle-log.ts
|
|
15391
15562
|
var MAX_LOG_BYTES;
|
|
15392
15563
|
var init_lifecycle_log = __esm(() => {
|
|
@@ -15402,9 +15573,9 @@ var init_aliases = __esm(() => {
|
|
|
15402
15573
|
var init_shard = __esm(() => {
|
|
15403
15574
|
init_sync_placement_active();
|
|
15404
15575
|
init_sync_placement_realm_effective();
|
|
15405
|
-
init_sync_placement_format();
|
|
15406
15576
|
init_sync_placement_guard();
|
|
15407
15577
|
init_public_prune_view();
|
|
15578
|
+
init_search_fts();
|
|
15408
15579
|
init_generation();
|
|
15409
15580
|
init_aliases();
|
|
15410
15581
|
init_profile_lock_diagnostic();
|
|
@@ -15421,6 +15592,7 @@ var init_sync_placement_format = __esm(() => {
|
|
|
15421
15592
|
});
|
|
15422
15593
|
|
|
15423
15594
|
// node_modules/@staix/agent-mem/src/memory/generation.ts
|
|
15595
|
+
var LOCAL_METADATA_MAX_BYTES = 262144;
|
|
15424
15596
|
var init_generation = __esm(() => {
|
|
15425
15597
|
init_sync_placement_format();
|
|
15426
15598
|
init_sync_placement_guard();
|
|
@@ -15647,50 +15819,6 @@ var init_lifecycle = __esm(() => {
|
|
|
15647
15819
|
init_lifecycle_log();
|
|
15648
15820
|
init_shard();
|
|
15649
15821
|
});
|
|
15650
|
-
|
|
15651
|
-
// node_modules/@staix/agent-mem/src/memory/search-score.ts
|
|
15652
|
-
function sql(expr, rank) {
|
|
15653
|
-
const get = (part) => sql(part, rank);
|
|
15654
|
-
switch (expr.op) {
|
|
15655
|
-
case "rank":
|
|
15656
|
-
return rank;
|
|
15657
|
-
case "tier":
|
|
15658
|
-
return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
|
|
15659
|
-
case "age":
|
|
15660
|
-
return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
|
|
15661
|
-
case "constant":
|
|
15662
|
-
return real(expr.value);
|
|
15663
|
-
case "negative":
|
|
15664
|
-
return `(-(${get(expr.value)}))`;
|
|
15665
|
-
case "reciprocal":
|
|
15666
|
-
return `(1.0 / ${get(expr.value)})`;
|
|
15667
|
-
case "add":
|
|
15668
|
-
return `(${get(expr.left)} + ${get(expr.right)})`;
|
|
15669
|
-
case "multiply":
|
|
15670
|
-
return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
|
|
15671
|
-
case "max":
|
|
15672
|
-
return `max(${get(expr.left)}, ${get(expr.right)})`;
|
|
15673
|
-
}
|
|
15674
|
-
}
|
|
15675
|
-
function rankedScoreSql(rank = "bm25(docs)") {
|
|
15676
|
-
return sql(SCORE, rank);
|
|
15677
|
-
}
|
|
15678
|
-
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);
|
|
15679
|
-
var init_search_score = __esm(() => {
|
|
15680
|
-
TIER_WEIGHTS = { long: 1, capture: 0.5 };
|
|
15681
|
-
TIER_FACTOR = { op: "tier" };
|
|
15682
|
-
DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
|
|
15683
|
-
RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
|
|
15684
|
-
SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
|
|
15685
|
-
});
|
|
15686
|
-
|
|
15687
|
-
// node_modules/@staix/agent-mem/src/memory/search-fts.ts
|
|
15688
|
-
var SCREENED_SCORE, SCREENED_SUBSTRING_SCORE;
|
|
15689
|
-
var init_search_fts = __esm(() => {
|
|
15690
|
-
init_search_score();
|
|
15691
|
-
SCREENED_SCORE = rankedScoreSql();
|
|
15692
|
-
SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
|
|
15693
|
-
});
|
|
15694
15822
|
// node_modules/@staix/agent-mem/src/memory/capture-input.ts
|
|
15695
15823
|
var TOOL_INPUT_OMIT;
|
|
15696
15824
|
var init_capture_input = __esm(() => {
|
|
@@ -15703,6 +15831,7 @@ var init_capture_input = __esm(() => {
|
|
|
15703
15831
|
// node_modules/@staix/agent-mem/src/memory/capture.ts
|
|
15704
15832
|
var SPOOL_MAX_BYTES;
|
|
15705
15833
|
var init_capture = __esm(() => {
|
|
15834
|
+
init_purge_intent();
|
|
15706
15835
|
init_brief_cache();
|
|
15707
15836
|
init_formats();
|
|
15708
15837
|
init_screen();
|
|
@@ -15801,6 +15930,7 @@ var init_migrate = __esm(() => {
|
|
|
15801
15930
|
// node_modules/@staix/agent-mem/src/memory/reader-lease.ts
|
|
15802
15931
|
var open;
|
|
15803
15932
|
var init_reader_lease = __esm(() => {
|
|
15933
|
+
init_purge_intent();
|
|
15804
15934
|
init_generation();
|
|
15805
15935
|
init_mutation();
|
|
15806
15936
|
init_platform();
|
|
@@ -15821,10 +15951,10 @@ var init_metrics = __esm(() => {
|
|
|
15821
15951
|
SEARCH_BYTES = 30 * 1024;
|
|
15822
15952
|
PHASE_BYTES = 6 * 1024;
|
|
15823
15953
|
});
|
|
15824
|
-
|
|
15825
15954
|
// node_modules/@staix/agent-mem/src/memory/store.ts
|
|
15826
15955
|
var DEFAULT_TTL_MS, UNSETTLED_MS, DEFAULT_LEASE_MS, MIGRATION_BOOTSTRAP, curatedDepth, curatedPending, curatedRecovery;
|
|
15827
15956
|
var init_store = __esm(() => {
|
|
15957
|
+
init_purge_intent();
|
|
15828
15958
|
init_recap_scratch();
|
|
15829
15959
|
init_brief_curated();
|
|
15830
15960
|
init_curated_cache_state();
|
|
@@ -16045,9 +16175,16 @@ var init_candidate_origin = __esm(() => {
|
|
|
16045
16175
|
init_screen();
|
|
16046
16176
|
});
|
|
16047
16177
|
|
|
16178
|
+
// node_modules/@staix/agent-mem/src/memory/topic.ts
|
|
16179
|
+
var TOPIC_FORM = "[a-z0-9][a-z0-9/-]{0,63}", TOPIC;
|
|
16180
|
+
var init_topic = __esm(() => {
|
|
16181
|
+
TOPIC = new RegExp(`^${TOPIC_FORM}$`);
|
|
16182
|
+
});
|
|
16183
|
+
|
|
16048
16184
|
// node_modules/@staix/agent-mem/src/memory/candidates.ts
|
|
16049
16185
|
var CANDIDATE_RETENTION, COUNTER_RETENTION;
|
|
16050
16186
|
var init_candidates = __esm(() => {
|
|
16187
|
+
init_purge_intent();
|
|
16051
16188
|
init_formats();
|
|
16052
16189
|
init_candidate_pending();
|
|
16053
16190
|
init_note_add();
|
|
@@ -16056,6 +16193,7 @@ var init_candidates = __esm(() => {
|
|
|
16056
16193
|
init_platform();
|
|
16057
16194
|
init_private_spans();
|
|
16058
16195
|
init_candidate_origin();
|
|
16196
|
+
init_topic();
|
|
16059
16197
|
CANDIDATE_RETENTION = { count: 500, ageMs: 30 * 86400000 };
|
|
16060
16198
|
COUNTER_RETENTION = { count: 1e4, ageMs: 90 * 86400000 };
|
|
16061
16199
|
});
|
|
@@ -16122,6 +16260,7 @@ var init_sync_binding = () => {};
|
|
|
16122
16260
|
// node_modules/@staix/agent-mem/src/memory/sync.ts
|
|
16123
16261
|
var liveGroups;
|
|
16124
16262
|
var init_sync = __esm(() => {
|
|
16263
|
+
init_purge_intent();
|
|
16125
16264
|
init_sync_placement_guard();
|
|
16126
16265
|
init_formats();
|
|
16127
16266
|
init_generation();
|
|
@@ -16164,9 +16303,36 @@ var init_report_text = __esm(() => {
|
|
|
16164
16303
|
init_style();
|
|
16165
16304
|
});
|
|
16166
16305
|
// node_modules/@staix/agent-mem/src/memory/consolidation-clusters.ts
|
|
16306
|
+
var OVERLAP_STOP;
|
|
16167
16307
|
var init_consolidation_clusters = __esm(() => {
|
|
16168
16308
|
init_search_fts();
|
|
16169
16309
|
init_candidates();
|
|
16310
|
+
init_topic();
|
|
16311
|
+
OVERLAP_STOP = new Set([
|
|
16312
|
+
"the",
|
|
16313
|
+
"and",
|
|
16314
|
+
"for",
|
|
16315
|
+
"with",
|
|
16316
|
+
"from",
|
|
16317
|
+
"this",
|
|
16318
|
+
"that",
|
|
16319
|
+
"approach",
|
|
16320
|
+
"symptom",
|
|
16321
|
+
"cause",
|
|
16322
|
+
"evidence",
|
|
16323
|
+
"retry",
|
|
16324
|
+
"when",
|
|
16325
|
+
"\uC774\uAC83",
|
|
16326
|
+
"\uADF8\uAC83",
|
|
16327
|
+
"\uC800\uAC83",
|
|
16328
|
+
"\uC5B4\uB5A4",
|
|
16329
|
+
"\uBB34\uC5C7",
|
|
16330
|
+
"\uBAA8\uB4E0",
|
|
16331
|
+
"\uB610\uB294",
|
|
16332
|
+
"\uAC00\uC7A5",
|
|
16333
|
+
"\uC544\uC8FC",
|
|
16334
|
+
"\uB9E4\uC6B0"
|
|
16335
|
+
]);
|
|
16170
16336
|
});
|
|
16171
16337
|
|
|
16172
16338
|
// node_modules/@staix/agent-mem/src/memory/forget-nearby.ts
|
|
@@ -16192,6 +16358,7 @@ var init_commands = __esm(() => {
|
|
|
16192
16358
|
init_src();
|
|
16193
16359
|
init_project2();
|
|
16194
16360
|
init_forget_nearby();
|
|
16361
|
+
init_topic();
|
|
16195
16362
|
AMEM_NAMES = { memory: "amem", goal: "amem goal" };
|
|
16196
16363
|
MEMORY_USAGE = memoryUsage();
|
|
16197
16364
|
GOAL_USAGE = goalUsage();
|
|
@@ -16231,39 +16398,41 @@ var init_shard_migration = __esm(() => {
|
|
|
16231
16398
|
var init_shard_migration_text = __esm(() => {
|
|
16232
16399
|
init_style();
|
|
16233
16400
|
});
|
|
16234
|
-
|
|
16235
16401
|
// node_modules/@staix/agent-mem/src/mcp.ts
|
|
16236
|
-
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) => ({
|
|
16402
|
+
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) => ({
|
|
16237
16403
|
name,
|
|
16238
16404
|
description,
|
|
16239
16405
|
inputSchema,
|
|
16240
16406
|
annotations: { readOnlyHint, destructiveHint: false, openWorldHint: false }
|
|
16241
16407
|
}), MCP_TOOLS;
|
|
16242
16408
|
var init_mcp = __esm(() => {
|
|
16409
|
+
briefNodes = { type: "array", maxItems: 9, items: string(512) };
|
|
16410
|
+
failText = string(1200);
|
|
16243
16411
|
limit = { type: "integer", minimum: 1, maximum: 100 };
|
|
16244
16412
|
MCP_TOOLS = [
|
|
16245
16413
|
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"])),
|
|
16246
16414
|
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"])),
|
|
16247
16415
|
tool("amem_show", "Show a screened memory entry in this project by its exact id or unique prefix.", object7({ id: string(80) }, ["id"])),
|
|
16248
16416
|
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" } })),
|
|
16249
|
-
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:
|
|
16417
|
+
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"])),
|
|
16250
16418
|
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"])),
|
|
16251
16419
|
tool("amem_work_state_read", "Read project work lists; closed lists/items can be included explicitly.", object7({ list: string(200), includeClosed: { type: "boolean" } })),
|
|
16252
16420
|
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: {
|
|
16253
16421
|
type: "object",
|
|
16254
16422
|
minProperties: 1,
|
|
16255
|
-
maxProperties:
|
|
16256
|
-
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength:
|
|
16423
|
+
maxProperties: 12,
|
|
16424
|
+
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 640 }
|
|
16257
16425
|
} }, ["list", "fields"]), false),
|
|
16258
|
-
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({
|
|
16426
|
+
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({
|
|
16259
16427
|
text: string(3000),
|
|
16260
16428
|
title: string(200),
|
|
16261
16429
|
kind: { type: "string", enum: ["decision", "finding", "contract", "fail", "preference"] },
|
|
16262
|
-
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16430
|
+
topic: string(64),
|
|
16431
|
+
approach: failText,
|
|
16432
|
+
symptom: failText,
|
|
16433
|
+
cause: failText,
|
|
16434
|
+
evidenceRefs: { type: "array", minItems: 1, maxItems: 8, items: string(250) },
|
|
16435
|
+
retryWhen: failText
|
|
16267
16436
|
}), false),
|
|
16268
16437
|
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),
|
|
16269
16438
|
tool("amem_vault_candidates", "List screened durable curated notes for review before moving them to a vault. Read only.", object7({ limit })),
|
|
@@ -16353,6 +16522,7 @@ var init_mcp_memory = __esm(() => {
|
|
|
16353
16522
|
init_store();
|
|
16354
16523
|
init_vault();
|
|
16355
16524
|
init_candidate_origin();
|
|
16525
|
+
init_topic();
|
|
16356
16526
|
init_work_lists();
|
|
16357
16527
|
TOOL_EVENTS = new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
|
|
16358
16528
|
});
|
|
@@ -16462,6 +16632,15 @@ var init_hook_jcode = __esm(() => {
|
|
|
16462
16632
|
FIELD_BYTES = 16 * 1024 + 64;
|
|
16463
16633
|
});
|
|
16464
16634
|
|
|
16635
|
+
// node_modules/@staix/agent-mem/src/memory/roots.ts
|
|
16636
|
+
var READ_BOUND;
|
|
16637
|
+
var init_roots = __esm(() => {
|
|
16638
|
+
init_aliases();
|
|
16639
|
+
init_platform();
|
|
16640
|
+
init_project2();
|
|
16641
|
+
READ_BOUND = 256 * 1024;
|
|
16642
|
+
});
|
|
16643
|
+
|
|
16465
16644
|
// node_modules/@staix/agent-mem/src/hooks.ts
|
|
16466
16645
|
var hookStartedAt;
|
|
16467
16646
|
var init_hooks = __esm(() => {
|
|
@@ -16481,6 +16660,7 @@ var init_hooks = __esm(() => {
|
|
|
16481
16660
|
init_platform();
|
|
16482
16661
|
init_policy();
|
|
16483
16662
|
init_config();
|
|
16663
|
+
init_roots();
|
|
16484
16664
|
init_hook_contract();
|
|
16485
16665
|
init_hook_contract();
|
|
16486
16666
|
hookStartedAt = performance.now();
|
|
@@ -16528,6 +16708,7 @@ var init_brief_curated_native = __esm(() => {
|
|
|
16528
16708
|
|
|
16529
16709
|
// node_modules/@staix/agent-mem/src/memory/home-binding-fence.ts
|
|
16530
16710
|
var init_home_binding_fence = __esm(() => {
|
|
16711
|
+
init_purge_intent();
|
|
16531
16712
|
init_public_prune_view();
|
|
16532
16713
|
});
|
|
16533
16714
|
|
|
@@ -16548,6 +16729,7 @@ var init_session_brief = __esm(() => {
|
|
|
16548
16729
|
init_config();
|
|
16549
16730
|
init_candidate_pending();
|
|
16550
16731
|
init_project2();
|
|
16732
|
+
init_roots();
|
|
16551
16733
|
init_reader_lease();
|
|
16552
16734
|
init_metrics();
|
|
16553
16735
|
init_shard();
|
|
@@ -17142,6 +17324,35 @@ var init_setup_writer_roots = __esm(() => {
|
|
|
17142
17324
|
JOURNAL_MAX = 12 * MAX2;
|
|
17143
17325
|
});
|
|
17144
17326
|
|
|
17327
|
+
// node_modules/@staix/agent-mem/src/setup-console.ts
|
|
17328
|
+
var init_setup_console = __esm(() => {
|
|
17329
|
+
init_mutation();
|
|
17330
|
+
});
|
|
17331
|
+
|
|
17332
|
+
// node_modules/@staix/agent-mem/src/memory/formats-raise.ts
|
|
17333
|
+
var PACKAGE_BYTES;
|
|
17334
|
+
var init_formats_raise = __esm(() => {
|
|
17335
|
+
init_formats();
|
|
17336
|
+
init_mutation();
|
|
17337
|
+
init_platform();
|
|
17338
|
+
PACKAGE_BYTES = 64 * 1024;
|
|
17339
|
+
});
|
|
17340
|
+
|
|
17341
|
+
// node_modules/@staix/agent-mem/src/setup-drift.ts
|
|
17342
|
+
var JOURNAL_BYTES, READ_BYTES;
|
|
17343
|
+
var init_setup_drift = __esm(() => {
|
|
17344
|
+
init_setup_writer_roots();
|
|
17345
|
+
init_setup_toml();
|
|
17346
|
+
init_setup_owned();
|
|
17347
|
+
init_setup_paths();
|
|
17348
|
+
init_hook_contract();
|
|
17349
|
+
init_platform();
|
|
17350
|
+
init_setup_console();
|
|
17351
|
+
init_formats_raise();
|
|
17352
|
+
JOURNAL_BYTES = 12 * SETUP_CONFIG_BYTES;
|
|
17353
|
+
READ_BYTES = 32 * 1024 * 1024;
|
|
17354
|
+
});
|
|
17355
|
+
|
|
17145
17356
|
// node_modules/@staix/agent-mem/src/setup.ts
|
|
17146
17357
|
var SETUP_ALL_TARGETS, PACKAGE_JSON_MAX;
|
|
17147
17358
|
var init_setup = __esm(() => {
|
|
@@ -17160,6 +17371,8 @@ var init_setup = __esm(() => {
|
|
|
17160
17371
|
init_sync_placement_effective_writers();
|
|
17161
17372
|
init_sync_placement_guard();
|
|
17162
17373
|
init_home();
|
|
17374
|
+
init_setup_drift();
|
|
17375
|
+
init_setup_console();
|
|
17163
17376
|
init_style();
|
|
17164
17377
|
init_platform();
|
|
17165
17378
|
SETUP_ALL_TARGETS = SETUP_TARGETS.filter((target) => target !== "agy");
|
|
@@ -17180,6 +17393,18 @@ var init_sync_placement_writer_context = __esm(() => {
|
|
|
17180
17393
|
init_sync_placement_refusal_category();
|
|
17181
17394
|
});
|
|
17182
17395
|
|
|
17396
|
+
// node_modules/@staix/agent-mem/src/memory/read-curated-entries.ts
|
|
17397
|
+
var FRESHNESS_HASH_BYTES;
|
|
17398
|
+
var init_read_curated_entries = __esm(() => {
|
|
17399
|
+
init_formats();
|
|
17400
|
+
init_lifecycle();
|
|
17401
|
+
init_purge_intent();
|
|
17402
|
+
init_generation();
|
|
17403
|
+
init_shard();
|
|
17404
|
+
init_store();
|
|
17405
|
+
FRESHNESS_HASH_BYTES = 16 * 1024 * 1024;
|
|
17406
|
+
});
|
|
17407
|
+
|
|
17183
17408
|
// node_modules/@staix/agent-mem/src/index.ts
|
|
17184
17409
|
var init_src2 = __esm(() => {
|
|
17185
17410
|
init_platform();
|
|
@@ -17192,6 +17417,7 @@ var init_src2 = __esm(() => {
|
|
|
17192
17417
|
init_migrate_text();
|
|
17193
17418
|
init_prune_text();
|
|
17194
17419
|
init_shard_migration_text();
|
|
17420
|
+
init_mcp();
|
|
17195
17421
|
init_config();
|
|
17196
17422
|
init_curated_brief_cache();
|
|
17197
17423
|
init_sync_screen();
|
|
@@ -17204,6 +17430,7 @@ var init_src2 = __esm(() => {
|
|
|
17204
17430
|
init_capture_input();
|
|
17205
17431
|
init_record_instruction();
|
|
17206
17432
|
init_skills_install();
|
|
17433
|
+
init_read_curated_entries();
|
|
17207
17434
|
init_store();
|
|
17208
17435
|
init_capture();
|
|
17209
17436
|
init_shard();
|
|
@@ -17226,7 +17453,6 @@ var init_src2 = __esm(() => {
|
|
|
17226
17453
|
init_migrate();
|
|
17227
17454
|
init_prune();
|
|
17228
17455
|
init_shard_migration();
|
|
17229
|
-
init_mcp();
|
|
17230
17456
|
init_mcp_memory();
|
|
17231
17457
|
init_policy();
|
|
17232
17458
|
init_work_lists();
|
|
@@ -17255,7 +17481,7 @@ var init_src2 = __esm(() => {
|
|
|
17255
17481
|
});
|
|
17256
17482
|
|
|
17257
17483
|
// src/hub/log-rotation.ts
|
|
17258
|
-
import { appendFileSync, closeSync as
|
|
17484
|
+
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";
|
|
17259
17485
|
import { basename as basename5, dirname as dirname13, join as join20 } from "path";
|
|
17260
17486
|
function segmentsOf(file) {
|
|
17261
17487
|
const dir = dirname13(file), prefix = `${basename5(file)}.`;
|
|
@@ -17296,7 +17522,7 @@ var init_log_rotation = __esm(() => {
|
|
|
17296
17522
|
});
|
|
17297
17523
|
|
|
17298
17524
|
// src/hub/events.ts
|
|
17299
|
-
import { appendFileSync as appendFileSync2, closeSync as
|
|
17525
|
+
import { appendFileSync as appendFileSync2, closeSync as closeSync12, existsSync as existsSync10, fstatSync as fstatSync11, openSync as openSync12, readFileSync as readFileSync9, readSync as readSync9 } from "fs";
|
|
17300
17526
|
function readEvents(file, since = 0) {
|
|
17301
17527
|
for (let attempt = 0;; attempt++) {
|
|
17302
17528
|
const segments = segmentsOf(file), out = [];
|
|
@@ -21044,7 +21270,7 @@ __export(exports_claude_implementer, {
|
|
|
21044
21270
|
ClaudeImplementerPeer: () => ClaudeImplementerPeer
|
|
21045
21271
|
});
|
|
21046
21272
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
21047
|
-
import { lstatSync as
|
|
21273
|
+
import { lstatSync as lstatSync22, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
21048
21274
|
import { tmpdir as tmpdir5 } from "os";
|
|
21049
21275
|
import { join as join22 } from "path";
|
|
21050
21276
|
function provenVersion(binding) {
|
|
@@ -21102,7 +21328,7 @@ function claudeImplementerArgs(turn, mcp, settings, prompt, model) {
|
|
|
21102
21328
|
async function proveClaudeImplementer(peer, command) {
|
|
21103
21329
|
const binary = Bun.which(command[0], { PATH: process.env.PATH }) ?? command[0];
|
|
21104
21330
|
const fingerprint = () => {
|
|
21105
|
-
const file = realPath(binary), stat =
|
|
21331
|
+
const file = realPath(binary), stat = lstatSync22(file);
|
|
21106
21332
|
return [file, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
|
|
21107
21333
|
};
|
|
21108
21334
|
const binding = fingerprint(), home = mkdtempSync6(join22(tmpdir5(), "ahub-claude-proof-"));
|
|
@@ -21717,7 +21943,7 @@ var init_reviewer_variants = __esm(() => {
|
|
|
21717
21943
|
});
|
|
21718
21944
|
|
|
21719
21945
|
// src/adapters/agy/hooks.ts
|
|
21720
|
-
import { closeSync as
|
|
21946
|
+
import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync12, lstatSync as lstatSync23, openSync as openSync13, readSync as readSync10 } from "fs";
|
|
21721
21947
|
import { homedir as homedir5 } from "os";
|
|
21722
21948
|
import { isAbsolute as isAbsolute7, join as join23, relative as relative5 } from "path";
|
|
21723
21949
|
import { createHash as createHash12 } from "crypto";
|
|
@@ -21782,11 +22008,11 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21782
22008
|
let cursor = home;
|
|
21783
22009
|
for (const name of relative5(home, transcript).split("/")) {
|
|
21784
22010
|
cursor = join23(cursor, name);
|
|
21785
|
-
if (
|
|
22011
|
+
if (lstatSync23(cursor).isSymbolicLink())
|
|
21786
22012
|
return empty;
|
|
21787
22013
|
}
|
|
21788
|
-
fd =
|
|
21789
|
-
const stat =
|
|
22014
|
+
fd = openSync13(transcript, constants10.O_RDONLY | constants10.O_NOFOLLOW);
|
|
22015
|
+
const stat = fstatSync12(fd);
|
|
21790
22016
|
if (!stat.isFile() || stat.nlink !== 1)
|
|
21791
22017
|
return empty;
|
|
21792
22018
|
if (options?.unchanged && stat.size === options.unchanged.size && stat.mtimeMs === options.unchanged.mtimeMs)
|
|
@@ -21801,7 +22027,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21801
22027
|
const buffer = Buffer.alloc(stat.size - from);
|
|
21802
22028
|
let bytes = 0;
|
|
21803
22029
|
while (bytes < buffer.length) {
|
|
21804
|
-
const count =
|
|
22030
|
+
const count = readSync10(fd, buffer, bytes, buffer.length - bytes, from + bytes);
|
|
21805
22031
|
if (!count)
|
|
21806
22032
|
break;
|
|
21807
22033
|
bytes += count;
|
|
@@ -21862,7 +22088,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21862
22088
|
return empty;
|
|
21863
22089
|
} finally {
|
|
21864
22090
|
if (fd !== undefined)
|
|
21865
|
-
|
|
22091
|
+
closeSync13(fd);
|
|
21866
22092
|
}
|
|
21867
22093
|
}
|
|
21868
22094
|
var EVENTS2, UUID2, record6 = (value) => !!value && typeof value === "object" && !Array.isArray(value), AGY_FACTS_HOOK;
|
|
@@ -22120,10 +22346,10 @@ var init_native_cli_entry_codex = () => {};
|
|
|
22120
22346
|
|
|
22121
22347
|
// src/cli/kimi-plugin.ts
|
|
22122
22348
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
22123
|
-
import { closeSync as
|
|
22349
|
+
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";
|
|
22124
22350
|
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join25 } from "path";
|
|
22125
22351
|
function file(path, cap) {
|
|
22126
|
-
const stat =
|
|
22352
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22127
22353
|
if (!stat)
|
|
22128
22354
|
return;
|
|
22129
22355
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1 || stat.size > cap)
|
|
@@ -22143,27 +22369,27 @@ function parse2(value, name) {
|
|
|
22143
22369
|
}
|
|
22144
22370
|
}
|
|
22145
22371
|
function atomic(path, bytes, before) {
|
|
22146
|
-
const current =
|
|
22372
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22147
22373
|
if (before ? !current || current.dev !== before.dev || current.ino !== before.ino : current)
|
|
22148
22374
|
throw new Error(`${path} changed before its managed write`);
|
|
22149
22375
|
const temporary = `${path}.${randomUUID11()}.tmp`;
|
|
22150
22376
|
let fd;
|
|
22151
22377
|
try {
|
|
22152
|
-
fd =
|
|
22378
|
+
fd = openSync14(temporary, "wx", 384);
|
|
22153
22379
|
writeFileSync10(fd, bytes);
|
|
22154
|
-
|
|
22380
|
+
closeSync14(fd);
|
|
22155
22381
|
fd = undefined;
|
|
22156
22382
|
renameSync6(temporary, path);
|
|
22157
22383
|
} finally {
|
|
22158
22384
|
if (fd !== undefined)
|
|
22159
|
-
|
|
22385
|
+
closeSync14(fd);
|
|
22160
22386
|
try {
|
|
22161
22387
|
unlinkSync4(temporary);
|
|
22162
22388
|
} catch {}
|
|
22163
22389
|
}
|
|
22164
22390
|
}
|
|
22165
22391
|
function removeFile(path, expected) {
|
|
22166
|
-
const current =
|
|
22392
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22167
22393
|
if (!current || !current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || !readFileSync12(path).equals(expected))
|
|
22168
22394
|
return;
|
|
22169
22395
|
unlinkSync4(path);
|
|
@@ -22254,14 +22480,14 @@ function locked(options, run) {
|
|
|
22254
22480
|
const path = join25(options.home, "agent-hub-plugin.lock");
|
|
22255
22481
|
let fd;
|
|
22256
22482
|
try {
|
|
22257
|
-
fd =
|
|
22483
|
+
fd = openSync14(path, "wx", 384);
|
|
22258
22484
|
} catch {
|
|
22259
22485
|
throw new Error(`Another Kimi plugin replacement is active or left a stale lock; retry after it exits or inspect ${path}`);
|
|
22260
22486
|
}
|
|
22261
22487
|
try {
|
|
22262
22488
|
return run();
|
|
22263
22489
|
} finally {
|
|
22264
|
-
|
|
22490
|
+
closeSync14(fd);
|
|
22265
22491
|
unlinkSync4(path);
|
|
22266
22492
|
}
|
|
22267
22493
|
}
|
|
@@ -22303,7 +22529,7 @@ function cleanupKimiPlugin(options) {
|
|
|
22303
22529
|
});
|
|
22304
22530
|
}
|
|
22305
22531
|
var EVENTS3, ID2 = "agent-hub", MAX_INSTALLED, MAX_HOOK, object8 = (value) => !!value && typeof value === "object" && !Array.isArray(value), directory = (path, required = true) => {
|
|
22306
|
-
const stat =
|
|
22532
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22307
22533
|
if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
|
|
22308
22534
|
throw new Error(`${path} must be a plain directory`);
|
|
22309
22535
|
if (!stat && required)
|
|
@@ -23063,7 +23289,7 @@ var init_native_config_policy = __esm(() => {
|
|
|
23063
23289
|
});
|
|
23064
23290
|
|
|
23065
23291
|
// src/adapters/definitions/native-policy-aux.ts
|
|
23066
|
-
import { closeSync as
|
|
23292
|
+
import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, openSync as openSync15, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
|
|
23067
23293
|
import { isAbsolute as isAbsolute9, join as join30, normalize } from "path";
|
|
23068
23294
|
function claudeCrashPlan(_meta) {
|
|
23069
23295
|
return { how: "claude: the Claude Code plugin reconnects by itself while that session is still open" };
|
|
@@ -23168,8 +23394,8 @@ function absoluteContinuityPath(value) {
|
|
|
23168
23394
|
var str3 = (value) => typeof value === "string" && value ? value : undefined, PLUGINS, CLAUDE_ONLY, text2 = (file) => {
|
|
23169
23395
|
let fd;
|
|
23170
23396
|
try {
|
|
23171
|
-
fd =
|
|
23172
|
-
const st =
|
|
23397
|
+
fd = openSync15(file, constants11.O_RDONLY | constants11.O_NONBLOCK);
|
|
23398
|
+
const st = fstatSync13(fd);
|
|
23173
23399
|
if (!st.isFile() || st.size > 1024 * 1024)
|
|
23174
23400
|
return;
|
|
23175
23401
|
return readFileSync14(fd, "utf8");
|
|
@@ -23177,7 +23403,7 @@ var str3 = (value) => typeof value === "string" && value ? value : undefined, PL
|
|
|
23177
23403
|
return;
|
|
23178
23404
|
} finally {
|
|
23179
23405
|
if (fd !== undefined)
|
|
23180
|
-
|
|
23406
|
+
closeSync15(fd);
|
|
23181
23407
|
}
|
|
23182
23408
|
}, json = (file) => {
|
|
23183
23409
|
try {
|
|
@@ -23472,7 +23698,7 @@ var init_native_recovery = __esm(() => {
|
|
|
23472
23698
|
});
|
|
23473
23699
|
|
|
23474
23700
|
// src/adapters/kimi-tui-facts.ts
|
|
23475
|
-
import { closeSync as
|
|
23701
|
+
import { closeSync as closeSync16, constants as constants12, fstatSync as fstatSync14, lstatSync as lstatSync25, openSync as openSync16, readSync as readSync11, readdirSync as readdirSync7 } from "fs";
|
|
23476
23702
|
import { createHash as createHash13 } from "crypto";
|
|
23477
23703
|
import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute10, join as join34, relative as relative6 } from "path";
|
|
23478
23704
|
import { homedir as homedir9 } from "os";
|
|
@@ -23494,26 +23720,26 @@ function encodeKimiTuiHook() {
|
|
|
23494
23720
|
return;
|
|
23495
23721
|
}
|
|
23496
23722
|
function readBytes(path, cap, tail = false) {
|
|
23497
|
-
const link =
|
|
23723
|
+
const link = lstatSync25(path);
|
|
23498
23724
|
if (!link.isFile() || link.isSymbolicLink() || link.nlink !== 1)
|
|
23499
23725
|
throw new Error("not a regular file");
|
|
23500
|
-
const fd =
|
|
23726
|
+
const fd = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW);
|
|
23501
23727
|
try {
|
|
23502
|
-
const stat =
|
|
23728
|
+
const stat = fstatSync14(fd);
|
|
23503
23729
|
if (!stat.isFile() || stat.nlink !== 1 || !tail && stat.size > cap)
|
|
23504
23730
|
throw new Error("invalid file");
|
|
23505
23731
|
const length = Math.min(stat.size, cap), start = tail ? stat.size - length : 0;
|
|
23506
23732
|
const bytes = Buffer.alloc(length);
|
|
23507
23733
|
let offset = 0;
|
|
23508
23734
|
while (offset < length) {
|
|
23509
|
-
const count =
|
|
23735
|
+
const count = readSync11(fd, bytes, offset, length - offset, start + offset);
|
|
23510
23736
|
if (count <= 0)
|
|
23511
23737
|
throw new Error("short read");
|
|
23512
23738
|
offset += count;
|
|
23513
23739
|
}
|
|
23514
23740
|
return bytes;
|
|
23515
23741
|
} finally {
|
|
23516
|
-
|
|
23742
|
+
closeSync16(fd);
|
|
23517
23743
|
}
|
|
23518
23744
|
}
|
|
23519
23745
|
function sessionDirectory(index, session) {
|
|
@@ -23553,7 +23779,7 @@ function taskInventory(agents) {
|
|
|
23553
23779
|
if (!entry.isDirectory())
|
|
23554
23780
|
continue;
|
|
23555
23781
|
const tasks = join34(agents, entry.name, "tasks");
|
|
23556
|
-
const dir =
|
|
23782
|
+
const dir = lstatSync25(tasks, { throwIfNoEntry: false });
|
|
23557
23783
|
if (!dir)
|
|
23558
23784
|
continue;
|
|
23559
23785
|
if (!dir.isDirectory() || dir.isSymbolicLink())
|