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