@staix/agent-hub 0.49.0 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -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.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/memory.md +3 -3
- package/docs/operations.md +2 -2
- package/docs/quickstart.md +8 -2
- package/docs/security.md +1 -1
- package/docs/verification/2026-11-29-0.49.1.md +50 -0
- package/docs/verified.json +10 -10
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +296 -95
- package/plugins/agent-hub/server.js +301 -100
- package/src/cli/console-state.ts +12 -39
|
@@ -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.49.
|
|
14802
|
+
version: "0.49.1",
|
|
14803
14803
|
description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
|
|
14804
14804
|
license: "MIT",
|
|
14805
14805
|
type: "module",
|
|
@@ -14816,8 +14816,8 @@ var init_package = __esm(() => {
|
|
|
14816
14816
|
bun: ">=1.4.4"
|
|
14817
14817
|
},
|
|
14818
14818
|
dependencies: {
|
|
14819
|
-
"@staix/agent-mem": ">=0.
|
|
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",
|
|
@@ -15092,6 +15092,60 @@ var init_brief_curated = __esm(() => {
|
|
|
15092
15092
|
init_brief_cache();
|
|
15093
15093
|
MAX_AGE = 24 * 60 * 60 * 1000;
|
|
15094
15094
|
});
|
|
15095
|
+
|
|
15096
|
+
// node_modules/@staix/agent-mem/src/memory/profile-marker-cache.ts
|
|
15097
|
+
import { lstatSync as lstatSync19 } from "fs";
|
|
15098
|
+
function sameMetadataStamp(a, b) {
|
|
15099
|
+
return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
|
|
15100
|
+
}
|
|
15101
|
+
function freezeMetadata(value) {
|
|
15102
|
+
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
15103
|
+
for (const child of Object.values(value))
|
|
15104
|
+
freezeMetadata(child);
|
|
15105
|
+
Object.freeze(value);
|
|
15106
|
+
}
|
|
15107
|
+
return value;
|
|
15108
|
+
}
|
|
15109
|
+
function metadataReader(read) {
|
|
15110
|
+
const entries = new Map;
|
|
15111
|
+
return (path) => {
|
|
15112
|
+
let before;
|
|
15113
|
+
try {
|
|
15114
|
+
before = lstatSync19(path, { bigint: true, throwIfNoEntry: false });
|
|
15115
|
+
} catch {
|
|
15116
|
+
entries.delete(path);
|
|
15117
|
+
return read(path)?.value;
|
|
15118
|
+
}
|
|
15119
|
+
const entry = entries.get(path);
|
|
15120
|
+
if (before?.isFile() && entry && sameMetadataStamp(before, entry.stamp)) {
|
|
15121
|
+
entries.delete(path);
|
|
15122
|
+
entries.set(path, entry);
|
|
15123
|
+
return entry.value;
|
|
15124
|
+
}
|
|
15125
|
+
entries.delete(path);
|
|
15126
|
+
const result = read(path);
|
|
15127
|
+
if (!result)
|
|
15128
|
+
return;
|
|
15129
|
+
const { value, stamp } = result;
|
|
15130
|
+
if (!before?.isFile() || !sameMetadataStamp(before, stamp))
|
|
15131
|
+
return value;
|
|
15132
|
+
try {
|
|
15133
|
+
freezeMetadata(value);
|
|
15134
|
+
} catch {
|
|
15135
|
+
return value;
|
|
15136
|
+
}
|
|
15137
|
+
if (value && typeof value === "object")
|
|
15138
|
+
snapshots.add(value);
|
|
15139
|
+
if (entries.size === 32)
|
|
15140
|
+
entries.delete(entries.keys().next().value);
|
|
15141
|
+
entries.set(path, { stamp, value });
|
|
15142
|
+
return value;
|
|
15143
|
+
};
|
|
15144
|
+
}
|
|
15145
|
+
var snapshots;
|
|
15146
|
+
var init_profile_marker_cache = __esm(() => {
|
|
15147
|
+
snapshots = new WeakSet;
|
|
15148
|
+
});
|
|
15095
15149
|
// node_modules/@staix/agent-mem/src/memory/home-identity.ts
|
|
15096
15150
|
var resolved;
|
|
15097
15151
|
var init_home_identity = __esm(() => {
|
|
@@ -15131,7 +15185,9 @@ var init_public_prune_input_chain = __esm(() => {
|
|
|
15131
15185
|
});
|
|
15132
15186
|
|
|
15133
15187
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-active.ts
|
|
15188
|
+
var pruneAdvanceMemo, shardProofs, snapshotBindings;
|
|
15134
15189
|
var init_sync_placement_active = __esm(() => {
|
|
15190
|
+
init_profile_marker_cache();
|
|
15135
15191
|
init_generation();
|
|
15136
15192
|
init_platform();
|
|
15137
15193
|
init_home_identity();
|
|
@@ -15141,6 +15197,9 @@ var init_sync_placement_active = __esm(() => {
|
|
|
15141
15197
|
init_public_prune_view();
|
|
15142
15198
|
init_public_prune_input_chain();
|
|
15143
15199
|
init_shard();
|
|
15200
|
+
pruneAdvanceMemo = new Map;
|
|
15201
|
+
shardProofs = new WeakMap;
|
|
15202
|
+
snapshotBindings = new WeakMap;
|
|
15144
15203
|
});
|
|
15145
15204
|
|
|
15146
15205
|
// node_modules/@staix/agent-mem/src/memory/mutation.ts
|
|
@@ -15151,8 +15210,8 @@ var init_mutation = __esm(() => {
|
|
|
15151
15210
|
});
|
|
15152
15211
|
|
|
15153
15212
|
// node_modules/@staix/agent-mem/src/memory/formats.ts
|
|
15154
|
-
import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
|
|
15155
|
-
var MAX_BYTES4, SEMVER, READER_VERSION;
|
|
15213
|
+
import { closeSync as closeSync9, constants as constants8, fstatSync as fstatSync8, lstatSync as lstatSync20, openSync as openSync9, readFileSync as readFileSync8, readSync as readSync6 } from "fs";
|
|
15214
|
+
var MAX_BYTES4, SEMVER, READER_VERSION, floorMemo;
|
|
15156
15215
|
var init_formats = __esm(() => {
|
|
15157
15216
|
MAX_BYTES4 = 64 * 1024;
|
|
15158
15217
|
SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
|
|
@@ -15164,6 +15223,7 @@ var init_formats = __esm(() => {
|
|
|
15164
15223
|
return;
|
|
15165
15224
|
}
|
|
15166
15225
|
})();
|
|
15226
|
+
floorMemo = new Map;
|
|
15167
15227
|
});
|
|
15168
15228
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-bound.ts
|
|
15169
15229
|
var PLACEMENT_SOURCE_MAX_BYTES;
|
|
@@ -15348,16 +15408,65 @@ var init_sync_placement_realm_effective = __esm(() => {
|
|
|
15348
15408
|
init_sync_placement_realm_extension_format();
|
|
15349
15409
|
});
|
|
15350
15410
|
// node_modules/@staix/agent-mem/src/memory/profile-lock-diagnostic.ts
|
|
15351
|
-
|
|
15411
|
+
function rememberProfileLockError(error, text) {
|
|
15412
|
+
if (Object.values(messages).includes(text))
|
|
15413
|
+
recognised.set(error, text);
|
|
15414
|
+
}
|
|
15415
|
+
var messages, recognised;
|
|
15352
15416
|
var init_profile_lock_diagnostic = __esm(() => {
|
|
15353
15417
|
init_platform();
|
|
15418
|
+
messages = {
|
|
15419
|
+
shards: "An interrupted or still-running shard migration retains profile.lock; wait for it to finish or run amem migrate --shards --resume.",
|
|
15420
|
+
prune: "An interrupted or still-running public-prune view migration retains profile.lock; wait for it to finish or run amem migrate --public-prune-view --resume.",
|
|
15421
|
+
activation: "An interrupted or still-running sync-placement activation retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only while both markers retain their original v2 bytes.",
|
|
15422
|
+
renewal: "An interrupted or still-running writer-inventory renewal retains profile.lock; run amem migrate --sync-placement --resume, or amem migrate --sync-placement --abandon only before the first commit-log byte.",
|
|
15423
|
+
staging: "An interrupted or still-running writer-inventory renewal retains profile.lock and unpublished intent staging; run amem migrate --sync-placement --abandon, then amem migrate --sync-placement --dry-run before another apply."
|
|
15424
|
+
};
|
|
15354
15425
|
recognised = new WeakMap;
|
|
15355
15426
|
});
|
|
15356
15427
|
|
|
15357
15428
|
// node_modules/@staix/agent-mem/src/memory/sync-placement-guard.ts
|
|
15358
15429
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
15359
|
-
|
|
15430
|
+
import { closeSync as closeSync10, constants as constants9, fstatSync as fstatSync9, lstatSync as lstatSync21, openSync as openSync10, readSync as readSync7 } from "fs";
|
|
15431
|
+
function readMarkerUncached(file) {
|
|
15432
|
+
for (let attempt = 0;attempt < 6; attempt++) {
|
|
15433
|
+
let fd;
|
|
15434
|
+
try {
|
|
15435
|
+
const before = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15436
|
+
if (!before)
|
|
15437
|
+
return;
|
|
15438
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > BigInt(LOCAL_METADATA_MAX_BYTES))
|
|
15439
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15440
|
+
fd = openSync10(file, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
|
|
15441
|
+
const opened = fstatSync9(fd, { bigint: true });
|
|
15442
|
+
if (!sameMetadataStamp(before, opened))
|
|
15443
|
+
throw new MarkerChanged;
|
|
15444
|
+
const bytes = Buffer.alloc(Number(opened.size) + 1);
|
|
15445
|
+
let count = 0;
|
|
15446
|
+
while (count < bytes.length) {
|
|
15447
|
+
const read = readSync7(fd, bytes, count, bytes.length - count, count);
|
|
15448
|
+
if (!read)
|
|
15449
|
+
break;
|
|
15450
|
+
count += read;
|
|
15451
|
+
}
|
|
15452
|
+
const after = fstatSync9(fd, { bigint: true }), named = lstatSync21(file, { bigint: true, throwIfNoEntry: false });
|
|
15453
|
+
if (count !== Number(opened.size) || !sameMetadataStamp(opened, after) || !named || named.isSymbolicLink() || !sameMetadataStamp(opened, named))
|
|
15454
|
+
throw new MarkerChanged;
|
|
15455
|
+
return { stamp: named, value: JSON.parse(new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes.subarray(0, count))) };
|
|
15456
|
+
} catch (error) {
|
|
15457
|
+
if (error instanceof MarkerChanged && attempt < 5)
|
|
15458
|
+
continue;
|
|
15459
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15460
|
+
} finally {
|
|
15461
|
+
if (fd !== undefined)
|
|
15462
|
+
closeSync10(fd);
|
|
15463
|
+
}
|
|
15464
|
+
}
|
|
15465
|
+
throw new SyncPlacementRuntimeError(PLACEMENT_MARKER_REFUSAL);
|
|
15466
|
+
}
|
|
15467
|
+
var doctorContext, PLACEMENT_STAGE1_REFUSAL = "sync placement v3 requires matching durable activation metadata; keep the current compatible profile active until person-authorized activation is complete", PLACEMENT_MARKER_REFUSAL = "sync placement metadata is invalid or unsupported; person inspection and a compatible reader are required before continuing", SyncPlacementRuntimeError, MarkerChanged, readMarker;
|
|
15360
15468
|
var init_sync_placement_guard = __esm(() => {
|
|
15469
|
+
init_profile_marker_cache();
|
|
15361
15470
|
init_sync_placement_active();
|
|
15362
15471
|
init_sync_placement_realm_effective();
|
|
15363
15472
|
init_generation();
|
|
@@ -15367,7 +15476,62 @@ var init_sync_placement_guard = __esm(() => {
|
|
|
15367
15476
|
init_sync_placement_format();
|
|
15368
15477
|
init_profile_lock_diagnostic();
|
|
15369
15478
|
doctorContext = new AsyncLocalStorage3;
|
|
15479
|
+
SyncPlacementRuntimeError = class SyncPlacementRuntimeError extends Error {
|
|
15480
|
+
code;
|
|
15481
|
+
constructor(reason) {
|
|
15482
|
+
super(reason);
|
|
15483
|
+
this.name = "SyncPlacementRuntimeError";
|
|
15484
|
+
this.code = reason === PLACEMENT_STAGE1_REFUSAL ? "sync_placement_not_enabled" : "sync_placement_unavailable";
|
|
15485
|
+
rememberProfileLockError(this, reason);
|
|
15486
|
+
}
|
|
15487
|
+
};
|
|
15488
|
+
MarkerChanged = class MarkerChanged extends Error {
|
|
15489
|
+
};
|
|
15490
|
+
readMarker = metadataReader(readMarkerUncached);
|
|
15491
|
+
});
|
|
15492
|
+
// node_modules/@staix/agent-mem/src/memory/search-score.ts
|
|
15493
|
+
function sql(expr, rank) {
|
|
15494
|
+
const get = (part) => sql(part, rank);
|
|
15495
|
+
switch (expr.op) {
|
|
15496
|
+
case "rank":
|
|
15497
|
+
return rank;
|
|
15498
|
+
case "tier":
|
|
15499
|
+
return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
|
|
15500
|
+
case "age":
|
|
15501
|
+
return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
|
|
15502
|
+
case "constant":
|
|
15503
|
+
return real(expr.value);
|
|
15504
|
+
case "negative":
|
|
15505
|
+
return `(-(${get(expr.value)}))`;
|
|
15506
|
+
case "reciprocal":
|
|
15507
|
+
return `(1.0 / ${get(expr.value)})`;
|
|
15508
|
+
case "add":
|
|
15509
|
+
return `(${get(expr.left)} + ${get(expr.right)})`;
|
|
15510
|
+
case "multiply":
|
|
15511
|
+
return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
|
|
15512
|
+
case "max":
|
|
15513
|
+
return `max(${get(expr.left)}, ${get(expr.right)})`;
|
|
15514
|
+
}
|
|
15515
|
+
}
|
|
15516
|
+
function rankedScoreSql(rank = "bm25(docs)") {
|
|
15517
|
+
return sql(SCORE, rank);
|
|
15518
|
+
}
|
|
15519
|
+
var MONTH_DAYS = 30, TIER_WEIGHTS, DEFAULT_TIER_WEIGHT = 0.9, TIER_FACTOR, DENOMINATOR, RECENCY_FACTOR, SCORE, real = (value) => Number.isInteger(value) ? `${value}.0` : String(value);
|
|
15520
|
+
var init_search_score = __esm(() => {
|
|
15521
|
+
TIER_WEIGHTS = { long: 1, capture: 0.5 };
|
|
15522
|
+
TIER_FACTOR = { op: "tier" };
|
|
15523
|
+
DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
|
|
15524
|
+
RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
|
|
15525
|
+
SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
|
|
15370
15526
|
});
|
|
15527
|
+
|
|
15528
|
+
// node_modules/@staix/agent-mem/src/memory/search-fts.ts
|
|
15529
|
+
var SCREENED_SUBSTRING_SCORE;
|
|
15530
|
+
var init_search_fts = __esm(() => {
|
|
15531
|
+
init_search_score();
|
|
15532
|
+
SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
|
|
15533
|
+
});
|
|
15534
|
+
|
|
15371
15535
|
// node_modules/@staix/agent-mem/src/memory/lifecycle-log.ts
|
|
15372
15536
|
var MAX_LOG_BYTES;
|
|
15373
15537
|
var init_lifecycle_log = __esm(() => {
|
|
@@ -15383,9 +15547,9 @@ var init_aliases = __esm(() => {
|
|
|
15383
15547
|
var init_shard = __esm(() => {
|
|
15384
15548
|
init_sync_placement_active();
|
|
15385
15549
|
init_sync_placement_realm_effective();
|
|
15386
|
-
init_sync_placement_format();
|
|
15387
15550
|
init_sync_placement_guard();
|
|
15388
15551
|
init_public_prune_view();
|
|
15552
|
+
init_search_fts();
|
|
15389
15553
|
init_generation();
|
|
15390
15554
|
init_aliases();
|
|
15391
15555
|
init_profile_lock_diagnostic();
|
|
@@ -15402,6 +15566,7 @@ var init_sync_placement_format = __esm(() => {
|
|
|
15402
15566
|
});
|
|
15403
15567
|
|
|
15404
15568
|
// node_modules/@staix/agent-mem/src/memory/generation.ts
|
|
15569
|
+
var LOCAL_METADATA_MAX_BYTES = 262144;
|
|
15405
15570
|
var init_generation = __esm(() => {
|
|
15406
15571
|
init_sync_placement_format();
|
|
15407
15572
|
init_sync_placement_guard();
|
|
@@ -15628,50 +15793,6 @@ var init_lifecycle = __esm(() => {
|
|
|
15628
15793
|
init_lifecycle_log();
|
|
15629
15794
|
init_shard();
|
|
15630
15795
|
});
|
|
15631
|
-
|
|
15632
|
-
// node_modules/@staix/agent-mem/src/memory/search-score.ts
|
|
15633
|
-
function sql(expr, rank) {
|
|
15634
|
-
const get = (part) => sql(part, rank);
|
|
15635
|
-
switch (expr.op) {
|
|
15636
|
-
case "rank":
|
|
15637
|
-
return rank;
|
|
15638
|
-
case "tier":
|
|
15639
|
-
return `CASE tier ${Object.entries(TIER_WEIGHTS).map(([name, value]) => `WHEN '${name}' THEN ${real(value)}`).join(" ")} ELSE ${real(DEFAULT_TIER_WEIGHT)} END`;
|
|
15640
|
-
case "age":
|
|
15641
|
-
return `((julianday(?) - julianday(at)) / ${real(MONTH_DAYS)})`;
|
|
15642
|
-
case "constant":
|
|
15643
|
-
return real(expr.value);
|
|
15644
|
-
case "negative":
|
|
15645
|
-
return `(-(${get(expr.value)}))`;
|
|
15646
|
-
case "reciprocal":
|
|
15647
|
-
return `(1.0 / ${get(expr.value)})`;
|
|
15648
|
-
case "add":
|
|
15649
|
-
return `(${get(expr.left)} + ${get(expr.right)})`;
|
|
15650
|
-
case "multiply":
|
|
15651
|
-
return expr.right.op === "reciprocal" ? `(${get(expr.left)} / ${get(expr.right.value)})` : `(${get(expr.left)} * ${get(expr.right)})`;
|
|
15652
|
-
case "max":
|
|
15653
|
-
return `max(${get(expr.left)}, ${get(expr.right)})`;
|
|
15654
|
-
}
|
|
15655
|
-
}
|
|
15656
|
-
function rankedScoreSql(rank = "bm25(docs)") {
|
|
15657
|
-
return sql(SCORE, rank);
|
|
15658
|
-
}
|
|
15659
|
-
var MONTH_DAYS = 30, TIER_WEIGHTS, DEFAULT_TIER_WEIGHT = 0.9, TIER_FACTOR, DENOMINATOR, RECENCY_FACTOR, SCORE, real = (value) => Number.isInteger(value) ? `${value}.0` : String(value);
|
|
15660
|
-
var init_search_score = __esm(() => {
|
|
15661
|
-
TIER_WEIGHTS = { long: 1, capture: 0.5 };
|
|
15662
|
-
TIER_FACTOR = { op: "tier" };
|
|
15663
|
-
DENOMINATOR = { op: "add", left: { op: "constant", value: 1 }, right: { op: "max", left: { op: "constant", value: 0 }, right: { op: "age" } } };
|
|
15664
|
-
RECENCY_FACTOR = { op: "reciprocal", value: DENOMINATOR };
|
|
15665
|
-
SCORE = { op: "multiply", left: { op: "multiply", left: { op: "negative", value: { op: "rank" } }, right: TIER_FACTOR }, right: RECENCY_FACTOR };
|
|
15666
|
-
});
|
|
15667
|
-
|
|
15668
|
-
// node_modules/@staix/agent-mem/src/memory/search-fts.ts
|
|
15669
|
-
var SCREENED_SCORE, SCREENED_SUBSTRING_SCORE;
|
|
15670
|
-
var init_search_fts = __esm(() => {
|
|
15671
|
-
init_search_score();
|
|
15672
|
-
SCREENED_SCORE = rankedScoreSql();
|
|
15673
|
-
SCREENED_SUBSTRING_SCORE = rankedScoreSql("-1.0");
|
|
15674
|
-
});
|
|
15675
15796
|
// node_modules/@staix/agent-mem/src/memory/capture-input.ts
|
|
15676
15797
|
var TOOL_INPUT_OMIT;
|
|
15677
15798
|
var init_capture_input = __esm(() => {
|
|
@@ -16026,6 +16147,12 @@ var init_candidate_origin = __esm(() => {
|
|
|
16026
16147
|
init_screen();
|
|
16027
16148
|
});
|
|
16028
16149
|
|
|
16150
|
+
// node_modules/@staix/agent-mem/src/memory/topic.ts
|
|
16151
|
+
var TOPIC_FORM = "[a-z0-9][a-z0-9/-]{0,63}", TOPIC;
|
|
16152
|
+
var init_topic = __esm(() => {
|
|
16153
|
+
TOPIC = new RegExp(`^${TOPIC_FORM}$`);
|
|
16154
|
+
});
|
|
16155
|
+
|
|
16029
16156
|
// node_modules/@staix/agent-mem/src/memory/candidates.ts
|
|
16030
16157
|
var CANDIDATE_RETENTION, COUNTER_RETENTION;
|
|
16031
16158
|
var init_candidates = __esm(() => {
|
|
@@ -16037,6 +16164,7 @@ var init_candidates = __esm(() => {
|
|
|
16037
16164
|
init_platform();
|
|
16038
16165
|
init_private_spans();
|
|
16039
16166
|
init_candidate_origin();
|
|
16167
|
+
init_topic();
|
|
16040
16168
|
CANDIDATE_RETENTION = { count: 500, ageMs: 30 * 86400000 };
|
|
16041
16169
|
COUNTER_RETENTION = { count: 1e4, ageMs: 90 * 86400000 };
|
|
16042
16170
|
});
|
|
@@ -16145,9 +16273,36 @@ var init_report_text = __esm(() => {
|
|
|
16145
16273
|
init_style();
|
|
16146
16274
|
});
|
|
16147
16275
|
// node_modules/@staix/agent-mem/src/memory/consolidation-clusters.ts
|
|
16276
|
+
var OVERLAP_STOP;
|
|
16148
16277
|
var init_consolidation_clusters = __esm(() => {
|
|
16149
16278
|
init_search_fts();
|
|
16150
16279
|
init_candidates();
|
|
16280
|
+
init_topic();
|
|
16281
|
+
OVERLAP_STOP = new Set([
|
|
16282
|
+
"the",
|
|
16283
|
+
"and",
|
|
16284
|
+
"for",
|
|
16285
|
+
"with",
|
|
16286
|
+
"from",
|
|
16287
|
+
"this",
|
|
16288
|
+
"that",
|
|
16289
|
+
"approach",
|
|
16290
|
+
"symptom",
|
|
16291
|
+
"cause",
|
|
16292
|
+
"evidence",
|
|
16293
|
+
"retry",
|
|
16294
|
+
"when",
|
|
16295
|
+
"\uC774\uAC83",
|
|
16296
|
+
"\uADF8\uAC83",
|
|
16297
|
+
"\uC800\uAC83",
|
|
16298
|
+
"\uC5B4\uB5A4",
|
|
16299
|
+
"\uBB34\uC5C7",
|
|
16300
|
+
"\uBAA8\uB4E0",
|
|
16301
|
+
"\uB610\uB294",
|
|
16302
|
+
"\uAC00\uC7A5",
|
|
16303
|
+
"\uC544\uC8FC",
|
|
16304
|
+
"\uB9E4\uC6B0"
|
|
16305
|
+
]);
|
|
16151
16306
|
});
|
|
16152
16307
|
|
|
16153
16308
|
// node_modules/@staix/agent-mem/src/memory/forget-nearby.ts
|
|
@@ -16173,6 +16328,7 @@ var init_commands = __esm(() => {
|
|
|
16173
16328
|
init_src();
|
|
16174
16329
|
init_project2();
|
|
16175
16330
|
init_forget_nearby();
|
|
16331
|
+
init_topic();
|
|
16176
16332
|
AMEM_NAMES = { memory: "amem", goal: "amem goal" };
|
|
16177
16333
|
MEMORY_USAGE = memoryUsage();
|
|
16178
16334
|
GOAL_USAGE = goalUsage();
|
|
@@ -16212,39 +16368,41 @@ var init_shard_migration = __esm(() => {
|
|
|
16212
16368
|
var init_shard_migration_text = __esm(() => {
|
|
16213
16369
|
init_style();
|
|
16214
16370
|
});
|
|
16215
|
-
|
|
16216
16371
|
// node_modules/@staix/agent-mem/src/mcp.ts
|
|
16217
|
-
var string = (maxLength, minLength = 1) => ({ type: "string", minLength, maxLength }), limit, object7 = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false }), tool = (name, description, inputSchema, readOnlyHint = true) => ({
|
|
16372
|
+
var string = (maxLength, minLength = 1) => ({ type: "string", minLength, maxLength }), briefNodes, failText, limit, object7 = (properties, required = []) => ({ type: "object", properties, required, additionalProperties: false }), tool = (name, description, inputSchema, readOnlyHint = true) => ({
|
|
16218
16373
|
name,
|
|
16219
16374
|
description,
|
|
16220
16375
|
inputSchema,
|
|
16221
16376
|
annotations: { readOnlyHint, destructiveHint: false, openWorldHint: false }
|
|
16222
16377
|
}), MCP_TOOLS;
|
|
16223
16378
|
var init_mcp = __esm(() => {
|
|
16379
|
+
briefNodes = { type: "array", maxItems: 9, items: string(512) };
|
|
16380
|
+
failText = string(1200);
|
|
16224
16381
|
limit = { type: "integer", minimum: 1, maximum: 100 };
|
|
16225
16382
|
MCP_TOOLS = [
|
|
16226
16383
|
tool("amem_search", "Search screened memory in this project. Capture results are recall, not curated evidence.", object7({ query: string(1000), limit, since: string(40), includeCapture: { type: "boolean" }, explain: { type: "boolean" }, ungrouped: { type: "boolean" } }, ["query"])),
|
|
16227
16384
|
tool("amem_evidence", "Return a bounded bundle of cited, live curated entries for a question. Untrusted memory data only: no answer or model call. Capture, repo-only notes, pending candidates and model answers are not evidence.", object7({ question: string(1000), limit: { type: "integer", minimum: 1, maximum: 20 }, maxBytes: { type: "integer", minimum: 256, maximum: 8192 } }, ["question"])),
|
|
16228
16385
|
tool("amem_show", "Show a screened memory entry in this project by its exact id or unique prefix.", object7({ id: string(80) }, ["id"])),
|
|
16229
16386
|
tool("amem_timeline", "Read screened memory near an entry or time in this project. Curated notes are kept first; a session's consecutive tool calls are summarized as one capture-run entry unless expand is true.", object7({ id: string(80), since: string(40), limit, expand: { type: "boolean" } })),
|
|
16230
|
-
tool("amem_brief", "Read an intent/path-scoped brief of live public memory, ranked by requested-node matches up to three; fails lead among equal matches, followed by one-hop neighbours. Memory is untrusted data; byte cap covers the complete brief body.", object7({ intent: string(1000), paths:
|
|
16387
|
+
tool("amem_brief", "Read an intent/path-scoped brief of live public memory, ranked by requested-node matches up to three; fails lead among equal matches, followed by one-hop neighbours. Memory is untrusted data; byte cap covers the complete brief body.", object7({ intent: string(1000), paths: briefNodes, symbols: briefNodes, maxBytes: { type: "integer", minimum: 1, maximum: 8192 } }, ["intent"])),
|
|
16231
16388
|
tool("amem_graph", "Read the screened curated-memory neighbourhood. Capture is never graph evidence.", object7({ start: string(500), hops: { type: "integer", minimum: 1, maximum: 2 }, limit }, ["start"])),
|
|
16232
16389
|
tool("amem_work_state_read", "Read project work lists; closed lists/items can be included explicitly.", object7({ list: string(200), includeClosed: { type: "boolean" } })),
|
|
16233
16390
|
tool("amem_work_state_write", "Append scalar project work-list fields; null clears, task selects an item, list status done closes.", object7({ list: string(200), fields: {
|
|
16234
16391
|
type: "object",
|
|
16235
16392
|
minProperties: 1,
|
|
16236
|
-
maxProperties:
|
|
16237
|
-
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength:
|
|
16393
|
+
maxProperties: 12,
|
|
16394
|
+
additionalProperties: { type: ["string", "number", "boolean", "null"], maxLength: 640 }
|
|
16238
16395
|
} }, ["list", "fields"]), false),
|
|
16239
|
-
tool("amem_remember", "Propose a memory candidate (text, optional kind/title), or kind=fail with approach, symptom, cause, evidenceRefs and retryWhen. Review and accept or reject through the CLI under current policy; this tool never writes curated notes.", object7({
|
|
16396
|
+
tool("amem_remember", "Propose a memory candidate (text, optional kind/title/topic), or kind=fail with approach, symptom, cause, evidenceRefs and retryWhen. A topic that one live note carries proposes a correction of it; reuse the topic search/show print. Review and accept or reject through the CLI under current policy; this tool never writes curated notes.", object7({
|
|
16240
16397
|
text: string(3000),
|
|
16241
16398
|
title: string(200),
|
|
16242
16399
|
kind: { type: "string", enum: ["decision", "finding", "contract", "fail", "preference"] },
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16400
|
+
topic: string(64),
|
|
16401
|
+
approach: failText,
|
|
16402
|
+
symptom: failText,
|
|
16403
|
+
cause: failText,
|
|
16404
|
+
evidenceRefs: { type: "array", minItems: 1, maxItems: 8, items: string(250) },
|
|
16405
|
+
retryWhen: failText
|
|
16248
16406
|
}), false),
|
|
16249
16407
|
tool("amem_correct", "Propose a correction to an exact curated entry id visible in this project. The host binds its current revision; the full accepted body including reason and provenance headers must fit 4000 characters. Review and accept or reject through the CLI under current policy before any note or supersession is written.", object7({ id: string(80), proposedText: string(4000), reason: string(4000), kind: { type: "string", enum: ["decision", "contract", "fail"] } }, ["id", "proposedText", "reason"]), false),
|
|
16250
16408
|
tool("amem_vault_candidates", "List screened durable curated notes for review before moving them to a vault. Read only.", object7({ limit })),
|
|
@@ -16334,6 +16492,7 @@ var init_mcp_memory = __esm(() => {
|
|
|
16334
16492
|
init_store();
|
|
16335
16493
|
init_vault();
|
|
16336
16494
|
init_candidate_origin();
|
|
16495
|
+
init_topic();
|
|
16337
16496
|
init_work_lists();
|
|
16338
16497
|
TOOL_EVENTS = new Set(["PreToolUse", "PostToolUse", "PostToolUseFailure"]);
|
|
16339
16498
|
});
|
|
@@ -16443,6 +16602,15 @@ var init_hook_jcode = __esm(() => {
|
|
|
16443
16602
|
FIELD_BYTES = 16 * 1024 + 64;
|
|
16444
16603
|
});
|
|
16445
16604
|
|
|
16605
|
+
// node_modules/@staix/agent-mem/src/memory/roots.ts
|
|
16606
|
+
var READ_BOUND;
|
|
16607
|
+
var init_roots = __esm(() => {
|
|
16608
|
+
init_aliases();
|
|
16609
|
+
init_platform();
|
|
16610
|
+
init_project2();
|
|
16611
|
+
READ_BOUND = 256 * 1024;
|
|
16612
|
+
});
|
|
16613
|
+
|
|
16446
16614
|
// node_modules/@staix/agent-mem/src/hooks.ts
|
|
16447
16615
|
var hookStartedAt;
|
|
16448
16616
|
var init_hooks = __esm(() => {
|
|
@@ -16462,6 +16630,7 @@ var init_hooks = __esm(() => {
|
|
|
16462
16630
|
init_platform();
|
|
16463
16631
|
init_policy();
|
|
16464
16632
|
init_config();
|
|
16633
|
+
init_roots();
|
|
16465
16634
|
init_hook_contract();
|
|
16466
16635
|
init_hook_contract();
|
|
16467
16636
|
hookStartedAt = performance.now();
|
|
@@ -16529,6 +16698,7 @@ var init_session_brief = __esm(() => {
|
|
|
16529
16698
|
init_config();
|
|
16530
16699
|
init_candidate_pending();
|
|
16531
16700
|
init_project2();
|
|
16701
|
+
init_roots();
|
|
16532
16702
|
init_reader_lease();
|
|
16533
16703
|
init_metrics();
|
|
16534
16704
|
init_shard();
|
|
@@ -17123,6 +17293,35 @@ var init_setup_writer_roots = __esm(() => {
|
|
|
17123
17293
|
JOURNAL_MAX = 12 * MAX2;
|
|
17124
17294
|
});
|
|
17125
17295
|
|
|
17296
|
+
// node_modules/@staix/agent-mem/src/setup-console.ts
|
|
17297
|
+
var init_setup_console = __esm(() => {
|
|
17298
|
+
init_mutation();
|
|
17299
|
+
});
|
|
17300
|
+
|
|
17301
|
+
// node_modules/@staix/agent-mem/src/memory/formats-raise.ts
|
|
17302
|
+
var PACKAGE_BYTES;
|
|
17303
|
+
var init_formats_raise = __esm(() => {
|
|
17304
|
+
init_formats();
|
|
17305
|
+
init_mutation();
|
|
17306
|
+
init_platform();
|
|
17307
|
+
PACKAGE_BYTES = 64 * 1024;
|
|
17308
|
+
});
|
|
17309
|
+
|
|
17310
|
+
// node_modules/@staix/agent-mem/src/setup-drift.ts
|
|
17311
|
+
var JOURNAL_BYTES, READ_BYTES;
|
|
17312
|
+
var init_setup_drift = __esm(() => {
|
|
17313
|
+
init_setup_writer_roots();
|
|
17314
|
+
init_setup_toml();
|
|
17315
|
+
init_setup_owned();
|
|
17316
|
+
init_setup_paths();
|
|
17317
|
+
init_hook_contract();
|
|
17318
|
+
init_platform();
|
|
17319
|
+
init_setup_console();
|
|
17320
|
+
init_formats_raise();
|
|
17321
|
+
JOURNAL_BYTES = 12 * SETUP_CONFIG_BYTES;
|
|
17322
|
+
READ_BYTES = 32 * 1024 * 1024;
|
|
17323
|
+
});
|
|
17324
|
+
|
|
17126
17325
|
// node_modules/@staix/agent-mem/src/setup.ts
|
|
17127
17326
|
var SETUP_ALL_TARGETS, PACKAGE_JSON_MAX;
|
|
17128
17327
|
var init_setup = __esm(() => {
|
|
@@ -17141,6 +17340,8 @@ var init_setup = __esm(() => {
|
|
|
17141
17340
|
init_sync_placement_effective_writers();
|
|
17142
17341
|
init_sync_placement_guard();
|
|
17143
17342
|
init_home();
|
|
17343
|
+
init_setup_drift();
|
|
17344
|
+
init_setup_console();
|
|
17144
17345
|
init_style();
|
|
17145
17346
|
init_platform();
|
|
17146
17347
|
SETUP_ALL_TARGETS = SETUP_TARGETS.filter((target) => target !== "agy");
|
|
@@ -17173,6 +17374,7 @@ var init_src2 = __esm(() => {
|
|
|
17173
17374
|
init_migrate_text();
|
|
17174
17375
|
init_prune_text();
|
|
17175
17376
|
init_shard_migration_text();
|
|
17377
|
+
init_mcp();
|
|
17176
17378
|
init_config();
|
|
17177
17379
|
init_curated_brief_cache();
|
|
17178
17380
|
init_sync_screen();
|
|
@@ -17207,7 +17409,6 @@ var init_src2 = __esm(() => {
|
|
|
17207
17409
|
init_migrate();
|
|
17208
17410
|
init_prune();
|
|
17209
17411
|
init_shard_migration();
|
|
17210
|
-
init_mcp();
|
|
17211
17412
|
init_mcp_memory();
|
|
17212
17413
|
init_policy();
|
|
17213
17414
|
init_work_lists();
|
|
@@ -17236,7 +17437,7 @@ var init_src2 = __esm(() => {
|
|
|
17236
17437
|
});
|
|
17237
17438
|
|
|
17238
17439
|
// src/hub/log-rotation.ts
|
|
17239
|
-
import { appendFileSync, closeSync as
|
|
17440
|
+
import { appendFileSync, closeSync as closeSync11, copyFileSync, existsSync as existsSync9, fstatSync as fstatSync10, openSync as openSync11, readdirSync as readdirSync4, readSync as readSync8, renameSync as renameSync5, rmSync as rmSync7, statSync as statSync5, truncateSync } from "fs";
|
|
17240
17441
|
import { basename as basename5, dirname as dirname13, join as join20 } from "path";
|
|
17241
17442
|
function segmentsOf(file) {
|
|
17242
17443
|
const dir = dirname13(file), prefix = `${basename5(file)}.`;
|
|
@@ -17277,7 +17478,7 @@ var init_log_rotation = __esm(() => {
|
|
|
17277
17478
|
});
|
|
17278
17479
|
|
|
17279
17480
|
// src/hub/events.ts
|
|
17280
|
-
import { appendFileSync as appendFileSync2, closeSync as
|
|
17481
|
+
import { appendFileSync as appendFileSync2, closeSync as closeSync12, existsSync as existsSync10, fstatSync as fstatSync11, openSync as openSync12, readFileSync as readFileSync9, readSync as readSync9 } from "fs";
|
|
17281
17482
|
function readEvents(file, since = 0) {
|
|
17282
17483
|
for (let attempt = 0;; attempt++) {
|
|
17283
17484
|
const segments = segmentsOf(file), out = [];
|
|
@@ -21043,7 +21244,7 @@ __export(exports_claude_implementer, {
|
|
|
21043
21244
|
ClaudeImplementerPeer: () => ClaudeImplementerPeer
|
|
21044
21245
|
});
|
|
21045
21246
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
21046
|
-
import { lstatSync as
|
|
21247
|
+
import { lstatSync as lstatSync22, mkdtempSync as mkdtempSync6, rmSync as rmSync8, writeFileSync as writeFileSync9 } from "fs";
|
|
21047
21248
|
import { tmpdir as tmpdir5 } from "os";
|
|
21048
21249
|
import { join as join22 } from "path";
|
|
21049
21250
|
function provenVersion(binding) {
|
|
@@ -21101,7 +21302,7 @@ function claudeImplementerArgs(turn, mcp, settings, prompt, model) {
|
|
|
21101
21302
|
async function proveClaudeImplementer(peer, command) {
|
|
21102
21303
|
const binary = Bun.which(command[0], { PATH: process.env.PATH }) ?? command[0];
|
|
21103
21304
|
const fingerprint = () => {
|
|
21104
|
-
const file = realPath(binary), stat =
|
|
21305
|
+
const file = realPath(binary), stat = lstatSync22(file);
|
|
21105
21306
|
return [file, stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(":");
|
|
21106
21307
|
};
|
|
21107
21308
|
const binding = fingerprint(), home = mkdtempSync6(join22(tmpdir5(), "ahub-claude-proof-"));
|
|
@@ -21716,7 +21917,7 @@ var init_reviewer_variants = __esm(() => {
|
|
|
21716
21917
|
});
|
|
21717
21918
|
|
|
21718
21919
|
// src/adapters/agy/hooks.ts
|
|
21719
|
-
import { closeSync as
|
|
21920
|
+
import { closeSync as closeSync13, constants as constants10, fstatSync as fstatSync12, lstatSync as lstatSync23, openSync as openSync13, readSync as readSync10 } from "fs";
|
|
21720
21921
|
import { homedir as homedir5 } from "os";
|
|
21721
21922
|
import { isAbsolute as isAbsolute7, join as join23, relative as relative5 } from "path";
|
|
21722
21923
|
import { createHash as createHash12 } from "crypto";
|
|
@@ -21781,11 +21982,11 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21781
21982
|
let cursor = home;
|
|
21782
21983
|
for (const name of relative5(home, transcript).split("/")) {
|
|
21783
21984
|
cursor = join23(cursor, name);
|
|
21784
|
-
if (
|
|
21985
|
+
if (lstatSync23(cursor).isSymbolicLink())
|
|
21785
21986
|
return empty;
|
|
21786
21987
|
}
|
|
21787
|
-
fd =
|
|
21788
|
-
const stat =
|
|
21988
|
+
fd = openSync13(transcript, constants10.O_RDONLY | constants10.O_NOFOLLOW);
|
|
21989
|
+
const stat = fstatSync12(fd);
|
|
21789
21990
|
if (!stat.isFile() || stat.nlink !== 1)
|
|
21790
21991
|
return empty;
|
|
21791
21992
|
if (options?.unchanged && stat.size === options.unchanged.size && stat.mtimeMs === options.unchanged.mtimeMs)
|
|
@@ -21800,7 +22001,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21800
22001
|
const buffer = Buffer.alloc(stat.size - from);
|
|
21801
22002
|
let bytes = 0;
|
|
21802
22003
|
while (bytes < buffer.length) {
|
|
21803
|
-
const count =
|
|
22004
|
+
const count = readSync10(fd, buffer, bytes, buffer.length - bytes, from + bytes);
|
|
21804
22005
|
if (!count)
|
|
21805
22006
|
break;
|
|
21806
22007
|
bytes += count;
|
|
@@ -21861,7 +22062,7 @@ function readAgyTranscript(session, transcript, options) {
|
|
|
21861
22062
|
return empty;
|
|
21862
22063
|
} finally {
|
|
21863
22064
|
if (fd !== undefined)
|
|
21864
|
-
|
|
22065
|
+
closeSync13(fd);
|
|
21865
22066
|
}
|
|
21866
22067
|
}
|
|
21867
22068
|
var EVENTS2, UUID2, record6 = (value) => !!value && typeof value === "object" && !Array.isArray(value), AGY_FACTS_HOOK;
|
|
@@ -22119,10 +22320,10 @@ var init_native_cli_entry_codex = () => {};
|
|
|
22119
22320
|
|
|
22120
22321
|
// src/cli/kimi-plugin.ts
|
|
22121
22322
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
22122
|
-
import { closeSync as
|
|
22323
|
+
import { closeSync as closeSync14, lstatSync as lstatSync24, mkdirSync as mkdirSync12, openSync as openSync14, readFileSync as readFileSync12, renameSync as renameSync6, rmdirSync as rmdirSync4, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
|
|
22123
22324
|
import { dirname as dirname15, isAbsolute as isAbsolute8, join as join25 } from "path";
|
|
22124
22325
|
function file(path, cap) {
|
|
22125
|
-
const stat =
|
|
22326
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22126
22327
|
if (!stat)
|
|
22127
22328
|
return;
|
|
22128
22329
|
if (!stat.isFile() || stat.isSymbolicLink() || stat.nlink !== 1 || stat.size > cap)
|
|
@@ -22142,27 +22343,27 @@ function parse2(value, name) {
|
|
|
22142
22343
|
}
|
|
22143
22344
|
}
|
|
22144
22345
|
function atomic(path, bytes, before) {
|
|
22145
|
-
const current =
|
|
22346
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22146
22347
|
if (before ? !current || current.dev !== before.dev || current.ino !== before.ino : current)
|
|
22147
22348
|
throw new Error(`${path} changed before its managed write`);
|
|
22148
22349
|
const temporary = `${path}.${randomUUID11()}.tmp`;
|
|
22149
22350
|
let fd;
|
|
22150
22351
|
try {
|
|
22151
|
-
fd =
|
|
22352
|
+
fd = openSync14(temporary, "wx", 384);
|
|
22152
22353
|
writeFileSync10(fd, bytes);
|
|
22153
|
-
|
|
22354
|
+
closeSync14(fd);
|
|
22154
22355
|
fd = undefined;
|
|
22155
22356
|
renameSync6(temporary, path);
|
|
22156
22357
|
} finally {
|
|
22157
22358
|
if (fd !== undefined)
|
|
22158
|
-
|
|
22359
|
+
closeSync14(fd);
|
|
22159
22360
|
try {
|
|
22160
22361
|
unlinkSync4(temporary);
|
|
22161
22362
|
} catch {}
|
|
22162
22363
|
}
|
|
22163
22364
|
}
|
|
22164
22365
|
function removeFile(path, expected) {
|
|
22165
|
-
const current =
|
|
22366
|
+
const current = lstatSync24(path, { throwIfNoEntry: false });
|
|
22166
22367
|
if (!current || !current.isFile() || current.isSymbolicLink() || current.nlink !== 1 || !readFileSync12(path).equals(expected))
|
|
22167
22368
|
return;
|
|
22168
22369
|
unlinkSync4(path);
|
|
@@ -22253,14 +22454,14 @@ function locked(options, run) {
|
|
|
22253
22454
|
const path = join25(options.home, "agent-hub-plugin.lock");
|
|
22254
22455
|
let fd;
|
|
22255
22456
|
try {
|
|
22256
|
-
fd =
|
|
22457
|
+
fd = openSync14(path, "wx", 384);
|
|
22257
22458
|
} catch {
|
|
22258
22459
|
throw new Error(`Another Kimi plugin replacement is active or left a stale lock; retry after it exits or inspect ${path}`);
|
|
22259
22460
|
}
|
|
22260
22461
|
try {
|
|
22261
22462
|
return run();
|
|
22262
22463
|
} finally {
|
|
22263
|
-
|
|
22464
|
+
closeSync14(fd);
|
|
22264
22465
|
unlinkSync4(path);
|
|
22265
22466
|
}
|
|
22266
22467
|
}
|
|
@@ -22302,7 +22503,7 @@ function cleanupKimiPlugin(options) {
|
|
|
22302
22503
|
});
|
|
22303
22504
|
}
|
|
22304
22505
|
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 =
|
|
22506
|
+
const stat = lstatSync24(path, { throwIfNoEntry: false });
|
|
22306
22507
|
if (stat && (!stat.isDirectory() || stat.isSymbolicLink()))
|
|
22307
22508
|
throw new Error(`${path} must be a plain directory`);
|
|
22308
22509
|
if (!stat && required)
|
|
@@ -23062,7 +23263,7 @@ var init_native_config_policy = __esm(() => {
|
|
|
23062
23263
|
});
|
|
23063
23264
|
|
|
23064
23265
|
// src/adapters/definitions/native-policy-aux.ts
|
|
23065
|
-
import { closeSync as
|
|
23266
|
+
import { closeSync as closeSync15, constants as constants11, fstatSync as fstatSync13, openSync as openSync15, readdirSync as readdirSync5, readFileSync as readFileSync14 } from "fs";
|
|
23066
23267
|
import { isAbsolute as isAbsolute9, join as join30, normalize } from "path";
|
|
23067
23268
|
function claudeCrashPlan(_meta) {
|
|
23068
23269
|
return { how: "claude: the Claude Code plugin reconnects by itself while that session is still open" };
|
|
@@ -23167,8 +23368,8 @@ function absoluteContinuityPath(value) {
|
|
|
23167
23368
|
var str3 = (value) => typeof value === "string" && value ? value : undefined, PLUGINS, CLAUDE_ONLY, text2 = (file) => {
|
|
23168
23369
|
let fd;
|
|
23169
23370
|
try {
|
|
23170
|
-
fd =
|
|
23171
|
-
const st =
|
|
23371
|
+
fd = openSync15(file, constants11.O_RDONLY | constants11.O_NONBLOCK);
|
|
23372
|
+
const st = fstatSync13(fd);
|
|
23172
23373
|
if (!st.isFile() || st.size > 1024 * 1024)
|
|
23173
23374
|
return;
|
|
23174
23375
|
return readFileSync14(fd, "utf8");
|
|
@@ -23176,7 +23377,7 @@ var str3 = (value) => typeof value === "string" && value ? value : undefined, PL
|
|
|
23176
23377
|
return;
|
|
23177
23378
|
} finally {
|
|
23178
23379
|
if (fd !== undefined)
|
|
23179
|
-
|
|
23380
|
+
closeSync15(fd);
|
|
23180
23381
|
}
|
|
23181
23382
|
}, json = (file) => {
|
|
23182
23383
|
try {
|
|
@@ -23471,7 +23672,7 @@ var init_native_recovery = __esm(() => {
|
|
|
23471
23672
|
});
|
|
23472
23673
|
|
|
23473
23674
|
// src/adapters/kimi-tui-facts.ts
|
|
23474
|
-
import { closeSync as
|
|
23675
|
+
import { closeSync as closeSync16, constants as constants12, fstatSync as fstatSync14, lstatSync as lstatSync25, openSync as openSync16, readSync as readSync11, readdirSync as readdirSync7 } from "fs";
|
|
23475
23676
|
import { createHash as createHash13 } from "crypto";
|
|
23476
23677
|
import { basename as basename7, dirname as dirname16, isAbsolute as isAbsolute10, join as join34, relative as relative6 } from "path";
|
|
23477
23678
|
import { homedir as homedir9 } from "os";
|
|
@@ -23493,26 +23694,26 @@ function encodeKimiTuiHook() {
|
|
|
23493
23694
|
return;
|
|
23494
23695
|
}
|
|
23495
23696
|
function readBytes(path, cap, tail = false) {
|
|
23496
|
-
const link =
|
|
23697
|
+
const link = lstatSync25(path);
|
|
23497
23698
|
if (!link.isFile() || link.isSymbolicLink() || link.nlink !== 1)
|
|
23498
23699
|
throw new Error("not a regular file");
|
|
23499
|
-
const fd =
|
|
23700
|
+
const fd = openSync16(path, constants12.O_RDONLY | constants12.O_NOFOLLOW);
|
|
23500
23701
|
try {
|
|
23501
|
-
const stat =
|
|
23702
|
+
const stat = fstatSync14(fd);
|
|
23502
23703
|
if (!stat.isFile() || stat.nlink !== 1 || !tail && stat.size > cap)
|
|
23503
23704
|
throw new Error("invalid file");
|
|
23504
23705
|
const length = Math.min(stat.size, cap), start = tail ? stat.size - length : 0;
|
|
23505
23706
|
const bytes = Buffer.alloc(length);
|
|
23506
23707
|
let offset = 0;
|
|
23507
23708
|
while (offset < length) {
|
|
23508
|
-
const count =
|
|
23709
|
+
const count = readSync11(fd, bytes, offset, length - offset, start + offset);
|
|
23509
23710
|
if (count <= 0)
|
|
23510
23711
|
throw new Error("short read");
|
|
23511
23712
|
offset += count;
|
|
23512
23713
|
}
|
|
23513
23714
|
return bytes;
|
|
23514
23715
|
} finally {
|
|
23515
|
-
|
|
23716
|
+
closeSync16(fd);
|
|
23516
23717
|
}
|
|
23517
23718
|
}
|
|
23518
23719
|
function sessionDirectory(index, session) {
|
|
@@ -23552,7 +23753,7 @@ function taskInventory(agents) {
|
|
|
23552
23753
|
if (!entry.isDirectory())
|
|
23553
23754
|
continue;
|
|
23554
23755
|
const tasks = join34(agents, entry.name, "tasks");
|
|
23555
|
-
const dir =
|
|
23756
|
+
const dir = lstatSync25(tasks, { throwIfNoEntry: false });
|
|
23556
23757
|
if (!dir)
|
|
23557
23758
|
continue;
|
|
23558
23759
|
if (!dir.isDirectory() || dir.isSymbolicLink())
|
|
@@ -31941,7 +32142,7 @@ init_registry();
|
|
|
31941
32142
|
// src/hub/config-trust.ts
|
|
31942
32143
|
init_child_process();
|
|
31943
32144
|
init_git();
|
|
31944
|
-
import { lstatSync as
|
|
32145
|
+
import { lstatSync as lstatSync26, statSync as statSync8 } from "fs";
|
|
31945
32146
|
import { dirname as dirname17, join as join36 } from "path";
|
|
31946
32147
|
var MACHINE_LOCAL = [
|
|
31947
32148
|
"kimi_cmd",
|
|
@@ -32766,7 +32967,7 @@ var FOLLOWUP_DEFAULTS = { windowMs: LEARNING_DEFAULTS.windowMs, minReviewed: 5 }
|
|
|
32766
32967
|
init_deliverables();
|
|
32767
32968
|
|
|
32768
32969
|
// src/hub/deliverable-files.ts
|
|
32769
|
-
import { constants as
|
|
32970
|
+
import { constants as constants13, lstatSync as lstatSync27 } from "fs";
|
|
32770
32971
|
init_tools();
|
|
32771
32972
|
init_deny();
|
|
32772
32973
|
init_permission_mode();
|
|
@@ -32774,7 +32975,7 @@ init_project();
|
|
|
32774
32975
|
init_path_policy();
|
|
32775
32976
|
init_deliverables();
|
|
32776
32977
|
var CHUNK = 1024 * 1024;
|
|
32777
|
-
var NOFOLLOW =
|
|
32978
|
+
var NOFOLLOW = constants13.O_NOFOLLOW ?? 0;
|
|
32778
32979
|
|
|
32779
32980
|
// src/hub/tasks.ts
|
|
32780
32981
|
init_src2();
|
|
@@ -41484,7 +41685,7 @@ init_registry();
|
|
|
41484
41685
|
// src/hub/instance-execution.ts
|
|
41485
41686
|
init_git();
|
|
41486
41687
|
init_project();
|
|
41487
|
-
import { lstatSync as
|
|
41688
|
+
import { lstatSync as lstatSync28 } from "fs";
|
|
41488
41689
|
import { join as join39, resolve as resolve20 } from "path";
|
|
41489
41690
|
var refuse = (reason) => {
|
|
41490
41691
|
throw new Error(`instance execution workspace refused: ${reason}`);
|
|
@@ -41527,7 +41728,7 @@ function resolveInstanceExecutionCwd(projectRoot, id, declarations, roles, adapt
|
|
|
41527
41728
|
try {
|
|
41528
41729
|
root = realPath(projectRoot);
|
|
41529
41730
|
cwd = realPath(resolve20(root, declaration.worktree));
|
|
41530
|
-
if (!
|
|
41731
|
+
if (!lstatSync28(root).isDirectory() || !lstatSync28(cwd).isDirectory())
|
|
41531
41732
|
return refuse("workspace is not a directory");
|
|
41532
41733
|
} catch {
|
|
41533
41734
|
return refuse("workspace paths are unavailable");
|