@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
|
@@ -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.
|
|
14802
|
+
version: "0.50.0",
|
|
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.
|
|
14820
|
-
"@staix/cli-output": "0.1.
|
|
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",
|
|
@@ -15002,6 +15002,9 @@ var init_review_comments = __esm(() => {
|
|
|
15002
15002
|
init_review_anchor();
|
|
15003
15003
|
});
|
|
15004
15004
|
|
|
15005
|
+
// node_modules/@staix/agent-mem/src/memory/purge-intent.ts
|
|
15006
|
+
var init_purge_intent = () => {};
|
|
15007
|
+
|
|
15005
15008
|
// node_modules/@staix/agent-mem/src/memory/recap-scratch.ts
|
|
15006
15009
|
var RECAP_SCRATCH;
|
|
15007
15010
|
var init_recap_scratch = __esm(() => {
|
|
@@ -15092,6 +15095,60 @@ var init_brief_curated = __esm(() => {
|
|
|
15092
15095
|
init_brief_cache();
|
|
15093
15096
|
MAX_AGE = 24 * 60 * 60 * 1000;
|
|
15094
15097
|
});
|
|
15098
|
+
|
|
15099
|
+
// node_modules/@staix/agent-mem/src/memory/profile-marker-cache.ts
|
|
15100
|
+
import { lstatSync as lstatSync19 } from "fs";
|
|
15101
|
+
function sameMetadataStamp(a, b) {
|
|
15102
|
+
return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
|
|
15103
|
+
}
|
|
15104
|
+
function freezeMetadata(value) {
|
|
15105
|
+
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
15106
|
+
for (const child of Object.values(value))
|
|
15107
|
+
freezeMetadata(child);
|
|
15108
|
+
Object.freeze(value);
|
|
15109
|
+
}
|
|
15110
|
+
return value;
|
|
15111
|
+
}
|
|
15112
|
+
function metadataReader(read) {
|
|
15113
|
+
const entries = new Map;
|
|
15114
|
+
return (path) => {
|
|
15115
|
+
let before;
|
|
15116
|
+
try {
|
|
15117
|
+
before = lstatSync19(path, { bigint: true, throwIfNoEntry: false });
|
|
15118
|
+
} catch {
|
|
15119
|
+
entries.delete(path);
|
|
15120
|
+
return read(path)?.value;
|
|
15121
|
+
}
|
|
15122
|
+
const entry = entries.get(path);
|
|
15123
|
+
if (before?.isFile() && entry && sameMetadataStamp(before, entry.stamp)) {
|
|
15124
|
+
entries.delete(path);
|
|
15125
|
+
entries.set(path, entry);
|
|
15126
|
+
return entry.value;
|
|
15127
|
+
}
|
|
15128
|
+
entries.delete(path);
|
|
15129
|
+
const result = read(path);
|
|
15130
|
+
if (!result)
|
|
15131
|
+
return;
|
|
15132
|
+
const { value, stamp } = result;
|
|
15133
|
+
if (!before?.isFile() || !sameMetadataStamp(before, stamp))
|
|
15134
|
+
return value;
|
|
15135
|
+
try {
|
|
15136
|
+
freezeMetadata(value);
|
|
15137
|
+
} catch {
|
|
15138
|
+
return value;
|
|
15139
|
+
}
|
|
15140
|
+
if (value && typeof value === "object")
|
|
15141
|
+
snapshots.add(value);
|
|
15142
|
+
if (entries.size === 32)
|
|
15143
|
+
entries.delete(entries.keys().next().value);
|
|
15144
|
+
entries.set(path, { stamp, value });
|
|
15145
|
+
return value;
|
|
15146
|
+
};
|
|
15147
|
+
}
|
|
15148
|
+
var snapshots;
|
|
15149
|
+
var init_profile_marker_cache = __esm(() => {
|
|
15150
|
+
snapshots = new WeakSet;
|
|
15151
|
+
});
|
|
15095
15152
|
// node_modules/@staix/agent-mem/src/memory/home-identity.ts
|
|
15096
15153
|
var resolved;
|
|
15097
15154
|
var init_home_identity = __esm(() => {
|
|
@@ -15131,7 +15188,10 @@ var init_public_prune_input_chain = __esm(() => {
|
|
|
15131
15188
|
});
|
|
15132
15189
|
|
|
15133
15190
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-active.ts
|
|
15191
|
+
var pruneAdvanceMemo, shardProofs, snapshotBindings;
|
|
15134
15192
|
var init_sync_placement_active = __esm(() => {
|
|
15193
|
+
init_purge_intent();
|
|
15194
|
+
init_profile_marker_cache();
|
|
15135
15195
|
init_generation();
|
|
15136
15196
|
init_platform();
|
|
15137
15197
|
init_home_identity();
|
|
@@ -15141,19 +15201,24 @@ var init_sync_placement_active = __esm(() => {
|
|
|
15141
15201
|
init_public_prune_view();
|
|
15142
15202
|
init_public_prune_input_chain();
|
|
15143
15203
|
init_shard();
|
|
15204
|
+
pruneAdvanceMemo = new Map;
|
|
15205
|
+
shardProofs = new WeakMap;
|
|
15206
|
+
snapshotBindings = new WeakMap;
|
|
15144
15207
|
});
|
|
15145
15208
|
|
|
15146
15209
|
// node_modules/@staix/agent-mem/src/memory/mutation.ts
|
|
15147
15210
|
var mutations;
|
|
15148
15211
|
var init_mutation = __esm(() => {
|
|
15212
|
+
init_purge_intent();
|
|
15149
15213
|
init_platform();
|
|
15150
15214
|
mutations = new WeakMap;
|
|
15151
15215
|
});
|
|
15152
15216
|
|
|
15153
15217
|
// 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;
|
|
15218
|
+
import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, lstatSync as lstatSync20, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
|
|
15219
|
+
var MAX_BYTES4, SEMVER, READER_VERSION, floorMemo;
|
|
15156
15220
|
var init_formats = __esm(() => {
|
|
15221
|
+
init_purge_intent();
|
|
15157
15222
|
MAX_BYTES4 = 64 * 1024;
|
|
15158
15223
|
SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
|
|
15159
15224
|
READER_VERSION = (() => {
|
|
@@ -15164,6 +15229,7 @@ var init_formats = __esm(() => {
|
|
|
15164
15229
|
return;
|
|
15165
15230
|
}
|
|
15166
15231
|
})();
|
|
15232
|
+
floorMemo = new Map;
|
|
15167
15233
|
});
|
|
15168
15234
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-bound.ts
|
|
15169
15235
|
var PLACEMENT_SOURCE_MAX_BYTES;
|
|
@@ -15348,16 +15414,66 @@ var init_sync_placement_realm_effective = __esm(() => {
|
|
|
15348
15414
|
init_sync_placement_realm_extension_format();
|
|
15349
15415
|
});
|
|
15350
15416
|
// node_modules/@staix/agent-mem/src/memory/profile-lock-diagnostic.ts
|
|
15351
|
-
|
|
15417
|
+
function rememberProfileLockError(error, text) {
|
|
15418
|
+
if (Object.values(messages).includes(text))
|
|
15419
|
+
recognised.set(error, text);
|
|
15420
|
+
}
|
|
15421
|
+
var messages, recognised;
|
|
15352
15422
|
var init_profile_lock_diagnostic = __esm(() => {
|
|
15353
15423
|
init_platform();
|
|
15424
|
+
messages = {
|
|
15425
|
+
shards: "An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
|
|
15426
|
+
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.",
|
|
15427
|
+
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.",
|
|
15428
|
+
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.",
|
|
15429
|
+
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."
|
|
15430
|
+
};
|
|
15354
15431
|
recognised = new WeakMap;
|
|
15355
15432
|
});
|
|
15356
15433
|
|
|
15357
15434
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-guard.ts
|
|
15358
15435
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
15359
|
-
|
|
15436
|
+
import { closeSync as closeSync10, constants as constants9, fstatSync as fstatSync9, lstatSync as lstatSync21, openSync as openSync10, readSync as readSync7 } from "fs";
|
|
15437
|
+
function readMarkerUncached(file) {
|
|
15438
|
+
for (let attempt = 0;attempt < 6; attempt++) {
|
|
15439
|
+
let fd;
|
|
15440
|
+
try {
|
|
15441
|
+
const before = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15442
|
+
if (!before)
|
|
15443
|
+
return;
|
|
15444
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > BigInt(LOCAL_METADATA_MAX_BYTES))
|
|
15445
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15446
|
+
fd = openSync10(file, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
|
|
15447
|
+
const opened = fstatSync9(fd, { bigint: true });
|
|
15448
|
+
if (!sameMetadataStamp(before, opened))
|
|
15449
|
+
throw new MarkerChanged;
|
|
15450
|
+
const bytes = Buffer.alloc(Number(opened.size) + 1);
|
|
15451
|
+
let count = 0;
|
|
15452
|
+
while (count < bytes.length) {
|
|
15453
|
+
const read = readSync7(fd, bytes, count, bytes.length - count, count);
|
|
15454
|
+
if (!read)
|
|
15455
|
+
break;
|
|
15456
|
+
count += read;
|
|
15457
|
+
}
|
|
15458
|
+
const after = fstatSync9(fd, { bigint: true }), named = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15459
|
+
if (count !== Number(opened.size) || !sameMetadataStamp(opened, after) || !named || named.isSymbolicLink() || !sameMetadataStamp(opened, named))
|
|
15460
|
+
throw new MarkerChanged;
|
|
15461
|
+
return { stamp: named, value: JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(0, count))) };
|
|
15462
|
+
} catch (error) {
|
|
15463
|
+
if (error instanceof MarkerChanged && attempt < 5)
|
|
15464
|
+
continue;
|
|
15465
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15466
|
+
} finally {
|
|
15467
|
+
if (fd !== undefined)
|
|
15468
|
+
closeSync10(fd);
|
|
15469
|
+
}
|
|
15470
|
+
}
|
|
15471
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15472
|
+
}
|
|
15473
|
+
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
15474
|
var init_sync_placement_guard = __esm(() => {
|
|
15475
|
+
init_purge_intent();
|
|
15476
|
+
init_profile_marker_cache();
|
|
15361
15477
|
init_sync_placement_active();
|
|
15362
15478
|
init_sync_placement_realm_effective();
|
|
15363
15479
|
init_generation();
|
|
@@ -15367,7 +15483,62 @@ var init_sync_placement_guard = __esm(() => {
|
|
|
15367
15483
|
init_sync_placement_format();
|
|
15368
15484
|
init_profile_lock_diagnostic();
|
|
15369
15485
|
doctorContext = new AsyncLocalStorage3;
|
|
15486
|
+
SyncPlacementRuntimeError = class SyncPlacementRuntimeError extends Error {
|
|
15487
|
+
code;
|
|
15488
|
+
constructor(reason) {
|
|
15489
|
+
super(reason);
|
|
15490
|
+
this.name = "SyncPlacementRuntimeError";
|
|
15491
|
+
this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";
|
|
15492
|
+
rememberProfileLockError(this, reason);
|
|
15493
|
+
}
|
|
15494
|
+
};
|
|
15495
|
+
MarkerChanged = class MarkerChanged extends Error {
|
|
15496
|
+
};
|
|
15497
|
+
readMarker = metadataReader(readMarkerUncached);
|
|
15498
|
+
});
|
|
15499
|
+
// node_modules/@staix/agent-mem/src/memory/search-score.ts
|
|
15500
|
+
function sql(expr, rank) {
|
|
15501
|
+
const get = (part) => sql(part, rank);
|
|
15502
|
+
switch (expr.op) {
|
|
15503
|
+
case "rank":
|
|
15504
|
+
return rank;
|
|
15505
|
+
case "tier":
|
|
15506
|
+
return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
|
|
15507
|
+
case "age":
|
|
15508
|
+
return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
|
|
15509
|
+
case "constant":
|
|
15510
|
+
return real(expr.value);
|
|
15511
|
+
case "negative":
|
|
15512
|
+
return `(-(${get(expr.value)}))`;
|
|
15513
|
+
case "reciprocal":
|
|
15514
|
+
return `(1.0 / ${get(expr.value)})`;
|
|
15515
|
+
case "add":
|
|
15516
|
+
return `(${get(expr.left)} + ${get(expr.right)})`;
|
|
15517
|
+
case "multiply":
|
|
15518
|
+
return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
|
|
15519
|
+
case "max":
|
|
15520
|
+
return `max(${get(expr.left)}, ${get(expr.right)})`;
|
|
15521
|
+
}
|
|
15522
|
+
}
|
|
15523
|
+
function rankedScoreSql(rank = "bm25(docs)") {
|
|
15524
|
+
return sql(SCORE, rank);
|
|
15525
|
+
}
|
|
15526
|
+
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);
|
|
15527
|
+
var init_search_score = __esm(() => {
|
|
15528
|
+
TIER_WEIGHTS = { long: 1, capture: 0.5 };
|
|
15529
|
+
TIER_FACTOR = { op: "tier" };
|
|
15530
|
+
DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
|
|
15531
|
+
RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
|
|
15532
|
+
SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
|
|
15533
|
+
});
|
|
15534
|
+
|
|
15535
|
+
// node_modules/@staix/agent-mem/src/memory/search-fts.ts
|
|
15536
|
+
var SCREENED_SUBSTRING_SCORE;
|
|
15537
|
+
var init_search_fts = __esm(() => {
|
|
15538
|
+
init_search_score();
|
|
15539
|
+
SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
|
|
15370
15540
|
});
|
|
15541
|
+
|
|
15371
15542
|
// node_modules/@staix/agent-mem/src/memory/lifecycle-log.ts
|
|
15372
15543
|
var MAX_LOG_BYTES;
|
|
15373
15544
|
var init_lifecycle_log = __esm(() => {
|
|
@@ -15383,9 +15554,9 @@ var init_aliases = __esm(() => {
|
|
|
15383
15554
|
var init_shard = __esm(() => {
|
|
15384
15555
|
init_sync_placement_active();
|
|
15385
15556
|
init_sync_placement_realm_effective();
|
|
15386
|
-
init_sync_placement_format();
|
|
15387
15557
|
init_sync_placement_guard();
|
|
15388
15558
|
init_public_prune_view();
|
|
15559
|
+
init_search_fts();
|
|
15389
15560
|
init_generation();
|
|
15390
15561
|
init_aliases();
|
|
15391
15562
|
init_profile_lock_diagnostic();
|
|
@@ -15402,6 +15573,7 @@ var init_sync_placement_format = __esm(() => {
|
|
|
15402
15573
|
});
|
|
15403
15574
|
|
|
15404
15575
|
// node_modules/@staix/agent-mem/src/memory/generation.ts
|
|
15576
|
+
var LOCAL_METADATA_MAX_BYTES = 262144;
|
|
15405
15577
|
var init_generation = __esm(() => {
|
|
15406
15578
|
init_sync_placement_format();
|
|
15407
15579
|
init_sync_placement_guard();
|
|
@@ -15628,50 +15800,6 @@ var init_lifecycle = __esm(() => {
|
|
|
15628
15800
|
init_lifecycle_log();
|
|
15629
15801
|
init_shard();
|
|
15630
15802
|
});
|
|
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
15803
|
// node_modules/@staix/agent-mem/src/memory/capture-input.ts
|
|
15676
15804
|
var TOOL_INPUT_OMIT;
|
|
15677
15805
|
var init_capture_input = __esm(() => {
|
|
@@ -15684,6 +15812,7 @@ var init_capture_input = __esm(() => {
|
|
|
15684
15812
|
// node_modules/@staix/agent-mem/src/memory/capture.ts
|
|
15685
15813
|
var SPOOL_MAX_BYTES;
|
|
15686
15814
|
var init_capture = __esm(() => {
|
|
15815
|
+
init_purge_intent();
|
|
15687
15816
|
init_brief_cache();
|
|
15688
15817
|
init_formats();
|
|
15689
15818
|
init_screen();
|
|
@@ -15782,6 +15911,7 @@ var init_migrate = __esm(() => {
|
|
|
15782
15911
|
// node_modules/@staix/agent-mem/src/memory/reader-lease.ts
|
|
15783
15912
|
var open;
|
|
15784
15913
|
var init_reader_lease = __esm(() => {
|
|
15914
|
+
init_purge_intent();
|
|
15785
15915
|
init_generation();
|
|
15786
15916
|
init_mutation();
|
|
15787
15917
|
init_platform();
|
|
@@ -15802,10 +15932,10 @@ var init_metrics = __esm(() => {
|
|
|
15802
15932
|
SEARCH_BYTES = 30 * 1024;
|
|
15803
15933
|
PHASE_BYTES = 6 * 1024;
|
|
15804
15934
|
});
|
|
15805
|
-
|
|
15806
15935
|
// node_modules/@staix/agent-mem/src/memory/store.ts
|
|
15807
15936
|
var DEFAULT_TTL_MS, UNSETTLED_MS, DEFAULT_LEASE_MS, MIGRATION_BOOTSTRAP, curatedDepth, curatedPending, curatedRecovery;
|
|
15808
15937
|
var init_store = __esm(() => {
|
|
15938
|
+
init_purge_intent();
|
|
15809
15939
|
init_recap_scratch();
|
|
15810
15940
|
init_brief_curated();
|
|
15811
15941
|
init_curated_cache_state();
|
|
@@ -16026,9 +16156,16 @@ var init_candidate_origin = __esm(() => {
|
|
|
16026
16156
|
init_screen();
|
|
16027
16157
|
});
|
|
16028
16158
|
|
|
16159
|
+
// node_modules/@staix/agent-mem/src/memory/topic.ts
|
|
16160
|
+
var TOPIC_FORM = "[a-z0-9][a-z0-9/-]{0,63}", TOPIC;
|
|
16161
|
+
var init_topic = __esm(() => {
|
|
16162
|
+
TOPIC = new RegExp(`^${TOPIC_FORM}$`);
|
|
16163
|
+
});
|
|
16164
|
+
|
|
16029
16165
|
// node_modules/@staix/agent-mem/src/memory/candidates.ts
|
|
16030
16166
|
var CANDIDATE_RETENTION, COUNTER_RETENTION;
|
|
16031
16167
|
var init_candidates = __esm(() => {
|
|
16168
|
+
init_purge_intent();
|
|
16032
16169
|
init_formats();
|
|
16033
16170
|
init_candidate_pending();
|
|
16034
16171
|
init_note_add();
|
|
@@ -16037,6 +16174,7 @@ var init_candidates = __esm(() => {
|
|
|
16037
16174
|
init_platform();
|
|
16038
16175
|
init_private_spans();
|
|
16039
16176
|
init_candidate_origin();
|
|
16177
|
+
init_topic();
|
|
16040
16178
|
CANDIDATE_RETENTION = { count: 500, ageMs: 30 * 86400000 };
|
|
16041
16179
|
COUNTER_RETENTION = { count: 1e4, ageMs: 90 * 86400000 };
|
|
16042
16180
|
});
|
|
@@ -16103,6 +16241,7 @@ var init_sync_binding = () => {};
|
|
|
16103
16241
|
// node_modules/@staix/agent-mem/src/memory/sync.ts
|
|
16104
16242
|
var liveGroups;
|
|
16105
16243
|
var init_sync = __esm(() => {
|
|
16244
|
+
init_purge_intent();
|
|
16106
16245
|
init_sync_placement_guard();
|
|
16107
16246
|
init_formats();
|
|
16108
16247
|
init_generation();
|
|
@@ -16145,9 +16284,36 @@ var init_report_text = __esm(() => {
|
|
|
16145
16284
|
init_style();
|
|
16146
16285
|
});
|
|
16147
16286
|
// node_modules/@staix/agent-mem/src/memory/consolidation-clusters.ts
|
|
16287
|
+
var OVERLAP_STOP;
|
|
16148
16288
|
var init_consolidation_clusters = __esm(() => {
|
|
16149
16289
|
init_search_fts();
|
|
16150
16290
|
init_candidates();
|
|
16291
|
+
init_topic();
|
|
16292
|
+
OVERLAP_STOP = new Set([
|
|
16293
|
+
"the",
|
|
16294
|
+
"and",
|
|
16295
|
+
"for",
|
|
16296
|
+
"with",
|
|
16297
|
+
"from",
|
|
16298
|
+
"this",
|
|
16299
|
+
"that",
|
|
16300
|
+
"approach",
|
|
16301
|
+
"symptom",
|
|
16302
|
+
"cause",
|
|
16303
|
+
"evidence",
|
|
16304
|
+
"retry",
|
|
16305
|
+
"when",
|
|
16306
|
+
"\uC774\uAC83",
|
|
16307
|
+
"\uADF8\uAC83",
|
|
16308
|
+
"\uC800\uAC83",
|
|
16309
|
+
"\uC5B4\uB5A4",
|
|
16310
|
+
"\uBB34\uC5C7",
|
|
16311
|
+
"\uBAA8\uB4E0",
|
|
16312
|
+
"\uB610\uB294",
|
|
16313
|
+
"\uAC00\uC7A5",
|
|
16314
|
+
"\uC544\uC8FC",
|
|
16315
|
+
"\uB9E4\uC6B0"
|
|
16316
|
+
]);
|
|
16151
16317
|
});
|
|
16152
16318
|
|
|
16153
16319
|
// node_modules/@staix/agent-mem/src/memory/forget-nearby.ts
|
|
@@ -16173,6 +16339,7 @@ var init_commands = __esm(() => {
|
|
|
16173
16339
|
init_src();
|
|
16174
16340
|
init_project2();
|
|
16175
16341
|
init_forget_nearby();
|
|
16342
|
+
init_topic();
|
|
16176
16343
|
AMEM_NAMES = { memory: "amem", goal: "amem goal" };
|
|
16177
16344
|
MEMORY_USAGE = memoryUsage();
|
|
16178
16345
|
GOAL_USAGE = goalUsage();
|
|
@@ -16212,39 +16379,41 @@ var init_shard_migration = __esm(() => {
|
|
|
16212
16379
|
var init_shard_migration_text = __esm(() => {
|
|
16213
16380
|
init_style();
|
|
16214
16381
|
});
|
|
16215
|
-
|
|
16216
16382
|
// 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) => ({
|
|
16383
|
+
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
16384
|
name,
|
|
16219
16385
|
description,
|
|
16220
16386
|
inputSchema,
|
|
16221
16387
|
annotations: { readOnlyHint, destructiveHint: false, openWorldHint: false }
|
|
16222
16388
|
}), MCP_TOOLS;
|
|
16223
16389
|
var init_mcp = __esm(() => {
|
|
16390
|
+
briefNodes = { type: "array", maxItems: 9, items: string(512) };
|
|
16391
|
+
failText = string(1200);
|
|
16224
16392
|
limit = { type: "integer", minimum: 1, maximum: 100 };
|
|
16225
16393
|
MCP_TOOLS = [
|
|
16226
16394
|
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
16395
|
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
16396
|
tool("amem_show", "Show a screened memory entry in this project by its exact id or unique prefix.", object7({ id: string(80) }, ["id"])),
|
|
16229
16397
|
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:
|
|
16398
|
+
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
16399
|
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
16400
|
tool("amem_work_state_read", "Read project work lists; closed lists/items can be included explicitly.", object7({ list: string(200), includeClosed: { type: "boolean" } })),
|
|
16233
16401
|
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
16402
|
type: "object",
|
|
16235
16403
|
minProperties: 1,
|
|
16236
|
-
maxProperties:
|
|
16237
|
-
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength:
|
|
16404
|
+
maxProperties: 12,
|
|
16405
|
+
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 640 }
|
|
16238
16406
|
} }, ["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({
|
|
16407
|
+
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
16408
|
text: string(3000),
|
|
16241
16409
|
title: string(200),
|
|
16242
16410
|
kind: { type: "string", enum: ["decision", "finding", "contract", "fail", "preference"] },
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16411
|
+
topic: string(64),
|
|
16412
|
+
approach: failText,
|
|
16413
|
+
symptom: failText,
|
|
16414
|
+
cause: failText,
|
|
16415
|
+
evidenceRefs: { type: "array", minItems: 1, maxItems: 8, items: string(250) },
|
|
16416
|
+
retryWhen: failText
|
|
16248
16417
|
}), false),
|
|
16249
16418
|
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
16419
|
tool("amem_vault_candidates", "List screened durable curated notes for review before moving them to a vault. Read only.", object7({ limit })),
|
|
@@ -16334,6 +16503,7 @@ var init_mcp_memory = __esm(() => {
|
|
|
16334
16503
|
init_store();
|
|
16335
16504
|
init_vault();
|
|
16336
16505
|
init_candidate_origin();
|
|
16506
|
+
init_topic();
|
|
16337
16507
|
init_work_lists();
|
|
16338
16508
|
TOOL_EVENTS = new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
|
|
16339
16509
|
});
|
|
@@ -16443,6 +16613,15 @@ var init_hook_jcode = __esm(() => {
|
|
|
16443
16613
|
FIELD_BYTES = 16 * 1024 + 64;
|
|
16444
16614
|
});
|
|
16445
16615
|
|
|
16616
|
+
// node_modules/@staix/agent-mem/src/memory/roots.ts
|
|
16617
|
+
var READ_BOUND;
|
|
16618
|
+
var init_roots = __esm(() => {
|
|
16619
|
+
init_aliases();
|
|
16620
|
+
init_platform();
|
|
16621
|
+
init_project2();
|
|
16622
|
+
READ_BOUND = 256 * 1024;
|
|
16623
|
+
});
|
|
16624
|
+
|
|
16446
16625
|
// node_modules/@staix/agent-mem/src/hooks.ts
|
|
16447
16626
|
var hookStartedAt;
|
|
16448
16627
|
var init_hooks = __esm(() => {
|
|
@@ -16462,6 +16641,7 @@ var init_hooks = __esm(() => {
|
|
|
16462
16641
|
init_platform();
|
|
16463
16642
|
init_policy();
|
|
16464
16643
|
init_config();
|
|
16644
|
+
init_roots();
|
|
16465
16645
|
init_hook_contract();
|
|
16466
16646
|
init_hook_contract();
|
|
16467
16647
|
hookStartedAt = performance.now();
|
|
@@ -16509,6 +16689,7 @@ var init_brief_curated_native = __esm(() => {
|
|
|
16509
16689
|
|
|
16510
16690
|
// node_modules/@staix/agent-mem/src/memory/home-binding-fence.ts
|
|
16511
16691
|
var init_home_binding_fence = __esm(() => {
|
|
16692
|
+
init_purge_intent();
|
|
16512
16693
|
init_public_prune_view();
|
|
16513
16694
|
});
|
|
16514
16695
|
|
|
@@ -16529,6 +16710,7 @@ var init_session_brief = __esm(() => {
|
|
|
16529
16710
|
init_config();
|
|
16530
16711
|
init_candidate_pending();
|
|
16531
16712
|
init_project2();
|
|
16713
|
+
init_roots();
|
|
16532
16714
|
init_reader_lease();
|
|
16533
16715
|
init_metrics();
|
|
16534
16716
|
init_shard();
|
|
@@ -17123,6 +17305,35 @@ var init_setup_writer_roots = __esm(() => {
|
|
|
17123
17305
|
JOURNAL_MAX = 12 * MAX2;
|
|
17124
17306
|
});
|
|
17125
17307
|
|
|
17308
|
+
// node_modules/@staix/agent-mem/src/setup-console.ts
|
|
17309
|
+
var init_setup_console = __esm(() => {
|
|
17310
|
+
init_mutation();
|
|
17311
|
+
});
|
|
17312
|
+
|
|
17313
|
+
// node_modules/@staix/agent-mem/src/memory/formats-raise.ts
|
|
17314
|
+
var PACKAGE_BYTES;
|
|
17315
|
+
var init_formats_raise = __esm(() => {
|
|
17316
|
+
init_formats();
|
|
17317
|
+
init_mutation();
|
|
17318
|
+
init_platform();
|
|
17319
|
+
PACKAGE_BYTES = 64 * 1024;
|
|
17320
|
+
});
|
|
17321
|
+
|
|
17322
|
+
// node_modules/@staix/agent-mem/src/setup-drift.ts
|
|
17323
|
+
var JOURNAL_BYTES, READ_BYTES;
|
|
17324
|
+
var init_setup_drift = __esm(() => {
|
|
17325
|
+
init_setup_writer_roots();
|
|
17326
|
+
init_setup_toml();
|
|
17327
|
+
init_setup_owned();
|
|
17328
|
+
init_setup_paths();
|
|
17329
|
+
init_hook_contract();
|
|
17330
|
+
init_platform();
|
|
17331
|
+
init_setup_console();
|
|
17332
|
+
init_formats_raise();
|
|
17333
|
+
JOURNAL_BYTES = 12 * SETUP_CONFIG_BYTES;
|
|
17334
|
+
READ_BYTES = 32 * 1024 * 1024;
|
|
17335
|
+
});
|
|
17336
|
+
|
|
17126
17337
|
// node_modules/@staix/agent-mem/src/setup.ts
|
|
17127
17338
|
var SETUP_ALL_TARGETS, PACKAGE_JSON_MAX;
|
|
17128
17339
|
var init_setup = __esm(() => {
|
|
@@ -17141,6 +17352,8 @@ var init_setup = __esm(() => {
|
|
|
17141
17352
|
init_sync_placement_effective_writers();
|
|
17142
17353
|
init_sync_placement_guard();
|
|
17143
17354
|
init_home();
|
|
17355
|
+
init_setup_drift();
|
|
17356
|
+
init_setup_console();
|
|
17144
17357
|
init_style();
|
|
17145
17358
|
init_platform();
|
|
17146
17359
|
SETUP_ALL_TARGETS = SETUP_TARGETS.filter((target) => target !== "agy");
|
|
@@ -17161,6 +17374,18 @@ var init_sync_placement_writer_context = __esm(() => {
|
|
|
17161
17374
|
init_sync_placement_refusal_category();
|
|
17162
17375
|
});
|
|
17163
17376
|
|
|
17377
|
+
// node_modules/@staix/agent-mem/src/memory/read-curated-entries.ts
|
|
17378
|
+
var FRESHNESS_HASH_BYTES;
|
|
17379
|
+
var init_read_curated_entries = __esm(() => {
|
|
17380
|
+
init_formats();
|
|
17381
|
+
init_lifecycle();
|
|
17382
|
+
init_purge_intent();
|
|
17383
|
+
init_generation();
|
|
17384
|
+
init_shard();
|
|
17385
|
+
init_store();
|
|
17386
|
+
FRESHNESS_HASH_BYTES = 16 * 1024 * 1024;
|
|
17387
|
+
});
|
|
17388
|
+
|
|
17164
17389
|
// node_modules/@staix/agent-mem/src/index.ts
|
|
17165
17390
|
var init_src2 = __esm(() => {
|
|
17166
17391
|
init_platform();
|
|
@@ -17173,6 +17398,7 @@ var init_src2 = __esm(() => {
|
|
|
17173
17398
|
init_migrate_text();
|
|
17174
17399
|
init_prune_text();
|
|
17175
17400
|
init_shard_migration_text();
|
|
17401
|
+
init_mcp();
|
|
17176
17402
|
init_config();
|
|
17177
17403
|
init_curated_brief_cache();
|
|
17178
17404
|
init_sync_screen();
|
|
@@ -17185,6 +17411,7 @@ var init_src2 = __esm(() => {
|
|
|
17185
17411
|
init_capture_input();
|
|
17186
17412
|
init_record_instruction();
|
|
17187
17413
|
init_skills_install();
|
|
17414
|
+
init_read_curated_entries();
|
|
17188
17415
|
init_store();
|
|
17189
17416
|
init_capture();
|
|
17190
17417
|
init_shard();
|
|
@@ -17207,7 +17434,6 @@ var init_src2 = __esm(() => {
|
|
|
17207
17434
|
init_migrate();
|
|
17208
17435
|
init_prune();
|
|
17209
17436
|
init_shard_migration();
|
|
17210
|
-
init_mcp();
|
|
17211
17437
|
init_mcp_memory();
|
|
17212
17438
|
init_policy();
|
|
17213
17439
|
init_work_lists();
|
|
@@ -17236,7 +17462,7 @@ var init_src2 = __esm(() => {
|
|
|
17236
17462
|
});
|
|
17237
17463
|
|
|
17238
17464
|
// src/hub/log-rotation.ts
|
|
17239
|
-
import { appendFileSync, closeSync as
|
|
17465
|
+
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
17466
|
import { basename as basename5, dirname as dirname13, join as join20 } from "path";
|
|
17241
17467
|
function segmentsOf(file) {
|
|
17242
17468
|
const dir = dirname13(file), prefix = `${basename5(file)}.`;
|
|
@@ -17277,7 +17503,7 @@ var init_log_rotation = __esm(() => {
|
|
|
17277
17503
|
});
|
|
17278
17504
|
|
|
17279
17505
|
// src/hub/events.ts
|
|
17280
|
-
import { appendFileSync as appendFileSync2, closeSync as
|
|
17506
|
+
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
17507
|
function readEvents(file, since = 0) {
|
|
17282
17508
|
for (let attempt = 0;; attempt++) {
|
|
17283
17509
|
const segments = segmentsOf(file), out = [];
|
|
@@ -21043,7 +21269,7 @@ __export(exports_claude_implementer, {
|
|
|
21043
21269
|
ClaudeImplementerPeer: () => ClaudeImplementerPeer
|
|
21044
21270
|
});
|
|
21045
21271
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
21046
|
-
import { lstatSync as
|
|
21272
|
+
import { lstatSync as lstatSync22, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
21047
21273
|
import { tmpdir as tmpdir5 } from "os";
|
|
21048
21274
|
import { join as join22 } from "path";
|
|
21049
21275
|
function provenVersion(binding) {
|
|
@@ -21101,7 +21327,7 @@ function claudeImplementerArgs(turn, mcp, settings, prompt, model) {
|
|
|
21101
21327
|
async function proveClaudeImplementer(peer, command) {
|
|
21102
21328
|
const binary = Bun.which(command[0], { PATH: process.env.PATH }) ?? command[0];
|
|
21103
21329
|
const fingerprint = () => {
|
|
21104
|
-
const file = realPath(binary), stat =
|
|
21330
|
+
const file = realPath(binary), stat = lstatSync22(file);
|
|
21105
21331
|
return [file, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
|
|
21106
21332
|
};
|
|
21107
21333
|
const binding = fingerprint(), home = mkdtempSync6(join22(tmpdir5(), "ahub-claude-proof-"));
|
|
@@ -21716,7 +21942,7 @@ var init_reviewer_variants = __esm(() => {
|
|
|
21716
21942
|
});
|
|
21717
21943
|
|
|
21718
21944
|
// src/adapters/agy/hooks.ts
|
|
21719
|
-
import { closeSync as
|
|
21945
|
+
import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync12, lstatSync as lstatSync23, openSync as openSync13, readSync as readSync10 } from "fs";
|
|
21720
21946
|
import { homedir as homedir5 } from "os";
|
|
21721
21947
|
import { isAbsolute as isAbsolute7, join as join23, relative as relative5 } from "path";
|
|
21722
21948
|
import { createHash as createHash12 } from "crypto";
|
|
@@ -21781,11 +22007,11 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21781
22007
|
let cursor = home;
|
|
21782
22008
|
for (const name of relative5(home, transcript).split("/")) {
|
|
21783
22009
|
cursor = join23(cursor, name);
|
|
21784
|
-
if (
|
|
22010
|
+
if (lstatSync23(cursor).isSymbolicLink())
|
|
21785
22011
|
return empty;
|
|
21786
22012
|
}
|
|
21787
|
-
fd =
|
|
21788
|
-
const stat =
|
|
22013
|
+
fd = openSync13(transcript, constants10.O_RDONLY | constants10.O_NOFOLLOW);
|
|
22014
|
+
const stat = fstatSync12(fd);
|
|
21789
22015
|
if (!stat.isFile() || stat.nlink !== 1)
|
|
21790
22016
|
return empty;
|
|
21791
22017
|
if (options?.unchanged && stat.size === options.unchanged.size && stat.mtimeMs === options.unchanged.mtimeMs)
|
|
@@ -21800,7 +22026,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21800
22026
|
const buffer = Buffer.alloc(stat.size - from);
|
|
21801
22027
|
let bytes = 0;
|
|
21802
22028
|
while (bytes < buffer.length) {
|
|
21803
|
-
const count =
|
|
22029
|
+
const count = readSync10(fd, buffer, bytes, buffer.length - bytes, from + bytes);
|
|
21804
22030
|
if (!count)
|
|
21805
22031
|
break;
|
|
21806
22032
|
bytes += count;
|
|
@@ -21861,7 +22087,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21861
22087
|
return empty;
|
|
21862
22088
|
} finally {
|
|
21863
22089
|
if (fd !== undefined)
|
|
21864
|
-
|
|
22090
|
+
closeSync13(fd);
|
|
21865
22091
|
}
|
|
21866
22092
|
}
|
|
21867
22093
|
var EVENTS2, UUID2, record6 = (value) => !!value && typeof value === "object" && !Array.isArray(value), AGY_FACTS_HOOK;
|
|
@@ -22119,10 +22345,10 @@ var init_native_cli_entry_codex = () => {};
|
|
|
22119
22345
|
|
|
22120
22346
|
// src/cli/kimi-plugin.ts
|
|
22121
22347
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
22122
|
-
import { closeSync as
|
|
22348
|
+
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";
|
|
22123
22349
|
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join25 } from "path";
|
|
22124
22350
|
function file(path, cap) {
|
|
22125
|
-
const stat =
|
|
22351
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22126
22352
|
if (!stat)
|
|
22127
22353
|
return;
|
|
22128
22354
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1 || stat.size > cap)
|
|
@@ -22142,27 +22368,27 @@ function parse2(value, name) {
|
|
|
22142
22368
|
}
|
|
22143
22369
|
}
|
|
22144
22370
|
function atomic(path, bytes, before) {
|
|
22145
|
-
const current =
|
|
22371
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22146
22372
|
if (before ? !current || current.dev !== before.dev || current.ino !== before.ino : current)
|
|
22147
22373
|
throw new Error(`${path} changed before its managed write`);
|
|
22148
22374
|
const temporary = `${path}.${randomUUID11()}.tmp`;
|
|
22149
22375
|
let fd;
|
|
22150
22376
|
try {
|
|
22151
|
-
fd =
|
|
22377
|
+
fd = openSync14(temporary, "wx", 384);
|
|
22152
22378
|
writeFileSync10(fd, bytes);
|
|
22153
|
-
|
|
22379
|
+
closeSync14(fd);
|
|
22154
22380
|
fd = undefined;
|
|
22155
22381
|
renameSync6(temporary, path);
|
|
22156
22382
|
} finally {
|
|
22157
22383
|
if (fd !== undefined)
|
|
22158
|
-
|
|
22384
|
+
closeSync14(fd);
|
|
22159
22385
|
try {
|
|
22160
22386
|
unlinkSync4(temporary);
|
|
22161
22387
|
} catch {}
|
|
22162
22388
|
}
|
|
22163
22389
|
}
|
|
22164
22390
|
function removeFile(path, expected) {
|
|
22165
|
-
const current =
|
|
22391
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22166
22392
|
if (!current || !current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || !readFileSync12(path).equals(expected))
|
|
22167
22393
|
return;
|
|
22168
22394
|
unlinkSync4(path);
|
|
@@ -22253,14 +22479,14 @@ function locked(options, run) {
|
|
|
22253
22479
|
const path = join25(options.home, "agent-hub-plugin.lock");
|
|
22254
22480
|
let fd;
|
|
22255
22481
|
try {
|
|
22256
|
-
fd =
|
|
22482
|
+
fd = openSync14(path, "wx", 384);
|
|
22257
22483
|
} catch {
|
|
22258
22484
|
throw new Error(`Another Kimi plugin replacement is active or left a stale lock; retry after it exits or inspect ${path}`);
|
|
22259
22485
|
}
|
|
22260
22486
|
try {
|
|
22261
22487
|
return run();
|
|
22262
22488
|
} finally {
|
|
22263
|
-
|
|
22489
|
+
closeSync14(fd);
|
|
22264
22490
|
unlinkSync4(path);
|
|
22265
22491
|
}
|
|
22266
22492
|
}
|
|
@@ -22302,7 +22528,7 @@ function cleanupKimiPlugin(options) {
|
|
|
22302
22528
|
});
|
|
22303
22529
|
}
|
|
22304
22530
|
var EVENTS3, ID2 = "agent-hub", MAX_INSTALLED, MAX_HOOK, object8 = (value) => !!value && typeof value === "object" && !Array.isArray(value), directory = (path, required = true) => {
|
|
22305
|
-
const stat =
|
|
22531
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22306
22532
|
if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
|
|
22307
22533
|
throw new Error(`${path} must be a plain directory`);
|
|
22308
22534
|
if (!stat && required)
|
|
@@ -23062,7 +23288,7 @@ var init_native_config_policy = __esm(() => {
|
|
|
23062
23288
|
});
|
|
23063
23289
|
|
|
23064
23290
|
// src/adapters/definitions/native-policy-aux.ts
|
|
23065
|
-
import { closeSync as
|
|
23291
|
+
import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, openSync as openSync15, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
|
|
23066
23292
|
import { isAbsolute as isAbsolute9, join as join30, normalize } from "path";
|
|
23067
23293
|
function claudeCrashPlan(_meta) {
|
|
23068
23294
|
return { how: "claude: the Claude Code plugin reconnects by itself while that session is still open" };
|
|
@@ -23167,8 +23393,8 @@ function absoluteContinuityPath(value) {
|
|
|
23167
23393
|
var str3 = (value) => typeof value === "string" && value ? value : undefined, PLUGINS, CLAUDE_ONLY, text2 = (file) => {
|
|
23168
23394
|
let fd;
|
|
23169
23395
|
try {
|
|
23170
|
-
fd =
|
|
23171
|
-
const st =
|
|
23396
|
+
fd = openSync15(file, constants11.O_RDONLY | constants11.O_NONBLOCK);
|
|
23397
|
+
const st = fstatSync13(fd);
|
|
23172
23398
|
if (!st.isFile() || st.size > 1024 * 1024)
|
|
23173
23399
|
return;
|
|
23174
23400
|
return readFileSync14(fd, "utf8");
|
|
@@ -23176,7 +23402,7 @@ var str3 = (value) => typeof value === "string" && value ? value : undefined, PL
|
|
|
23176
23402
|
return;
|
|
23177
23403
|
} finally {
|
|
23178
23404
|
if (fd !== undefined)
|
|
23179
|
-
|
|
23405
|
+
closeSync15(fd);
|
|
23180
23406
|
}
|
|
23181
23407
|
}, json = (file) => {
|
|
23182
23408
|
try {
|
|
@@ -23471,7 +23697,7 @@ var init_native_recovery = __esm(() => {
|
|
|
23471
23697
|
});
|
|
23472
23698
|
|
|
23473
23699
|
// src/adapters/kimi-tui-facts.ts
|
|
23474
|
-
import { closeSync as
|
|
23700
|
+
import { closeSync as closeSync16, constants as constants12, fstatSync as fstatSync14, lstatSync as lstatSync25, openSync as openSync16, readSync as readSync11, readdirSync as readdirSync7 } from "fs";
|
|
23475
23701
|
import { createHash as createHash13 } from "crypto";
|
|
23476
23702
|
import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute10, join as join34, relative as relative6 } from "path";
|
|
23477
23703
|
import { homedir as homedir9 } from "os";
|
|
@@ -23493,26 +23719,26 @@ function encodeKimiTuiHook() {
|
|
|
23493
23719
|
return;
|
|
23494
23720
|
}
|
|
23495
23721
|
function readBytes(path, cap, tail = false) {
|
|
23496
|
-
const link =
|
|
23722
|
+
const link = lstatSync25(path);
|
|
23497
23723
|
if (!link.isFile() || link.isSymbolicLink() || link.nlink !== 1)
|
|
23498
23724
|
throw new Error("not a regular file");
|
|
23499
|
-
const fd =
|
|
23725
|
+
const fd = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW);
|
|
23500
23726
|
try {
|
|
23501
|
-
const stat =
|
|
23727
|
+
const stat = fstatSync14(fd);
|
|
23502
23728
|
if (!stat.isFile() || stat.nlink !== 1 || !tail && stat.size > cap)
|
|
23503
23729
|
throw new Error("invalid file");
|
|
23504
23730
|
const length = Math.min(stat.size, cap), start = tail ? stat.size - length : 0;
|
|
23505
23731
|
const bytes = Buffer.alloc(length);
|
|
23506
23732
|
let offset = 0;
|
|
23507
23733
|
while (offset < length) {
|
|
23508
|
-
const count =
|
|
23734
|
+
const count = readSync11(fd, bytes, offset, length - offset, start + offset);
|
|
23509
23735
|
if (count <= 0)
|
|
23510
23736
|
throw new Error("short read");
|
|
23511
23737
|
offset += count;
|
|
23512
23738
|
}
|
|
23513
23739
|
return bytes;
|
|
23514
23740
|
} finally {
|
|
23515
|
-
|
|
23741
|
+
closeSync16(fd);
|
|
23516
23742
|
}
|
|
23517
23743
|
}
|
|
23518
23744
|
function sessionDirectory(index, session) {
|
|
@@ -23552,7 +23778,7 @@ function taskInventory(agents) {
|
|
|
23552
23778
|
if (!entry.isDirectory())
|
|
23553
23779
|
continue;
|
|
23554
23780
|
const tasks = join34(agents, entry.name, "tasks");
|
|
23555
|
-
const dir =
|
|
23781
|
+
const dir = lstatSync25(tasks, { throwIfNoEntry: false });
|
|
23556
23782
|
if (!dir)
|
|
23557
23783
|
continue;
|
|
23558
23784
|
if (!dir.isDirectory() || dir.isSymbolicLink())
|
|
@@ -31941,7 +32167,7 @@ init_registry();
|
|
|
31941
32167
|
// src/hub/config-trust.ts
|
|
31942
32168
|
init_child_process();
|
|
31943
32169
|
init_git();
|
|
31944
|
-
import { lstatSync as
|
|
32170
|
+
import { lstatSync as lstatSync26, statSync as statSync8 } from "fs";
|
|
31945
32171
|
import { dirname as dirname17, join as join36 } from "path";
|
|
31946
32172
|
var MACHINE_LOCAL = [
|
|
31947
32173
|
"kimi_cmd",
|
|
@@ -32766,7 +32992,7 @@ var FOLLOWUP_DEFAULTS = { windowMs: LEARNING_DEFAULTS.windowMs, minReviewed: 5 }
|
|
|
32766
32992
|
init_deliverables();
|
|
32767
32993
|
|
|
32768
32994
|
// src/hub/deliverable-files.ts
|
|
32769
|
-
import { constants as
|
|
32995
|
+
import { constants as constants13, lstatSync as lstatSync27 } from "fs";
|
|
32770
32996
|
init_tools();
|
|
32771
32997
|
init_deny();
|
|
32772
32998
|
init_permission_mode();
|
|
@@ -32774,7 +33000,7 @@ init_project();
|
|
|
32774
33000
|
init_path_policy();
|
|
32775
33001
|
init_deliverables();
|
|
32776
33002
|
var CHUNK = 1024 * 1024;
|
|
32777
|
-
var NOFOLLOW =
|
|
33003
|
+
var NOFOLLOW = constants13.O_NOFOLLOW ?? 0;
|
|
32778
33004
|
|
|
32779
33005
|
// src/hub/tasks.ts
|
|
32780
33006
|
init_src2();
|
|
@@ -41484,7 +41710,7 @@ init_registry();
|
|
|
41484
41710
|
// src/hub/instance-execution.ts
|
|
41485
41711
|
init_git();
|
|
41486
41712
|
init_project();
|
|
41487
|
-
import { lstatSync as
|
|
41713
|
+
import { lstatSync as lstatSync28 } from "fs";
|
|
41488
41714
|
import { join as join39, resolve as resolve20 } from "path";
|
|
41489
41715
|
var refuse = (reason) => {
|
|
41490
41716
|
throw new Error(`instance execution workspace refused: ${reason}`);
|
|
@@ -41527,7 +41753,7 @@ function resolveInstanceExecutionCwd(projectRoot, id, declarations, roles, adapt
|
|
|
41527
41753
|
try {
|
|
41528
41754
|
root = realPath(projectRoot);
|
|
41529
41755
|
cwd = realPath(resolve20(root, declaration.worktree));
|
|
41530
|
-
if (!
|
|
41756
|
+
if (!lstatSync28(root).isDirectory() || !lstatSync28(cwd).isDirectory())
|
|
41531
41757
|
return refuse("workspace is not a directory");
|
|
41532
41758
|
} catch {
|
|
41533
41759
|
return refuse("workspace paths are unavailable");
|