instar 1.2.2 → 1.2.4
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +64 -33
- package/dist/commands/server.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +72 -0
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +46 -46
- package/upgrades/1.2.3.md +43 -0
- package/upgrades/1.2.4.md +69 -0
- package/upgrades/side-effects/capabilities-discoverability.md +116 -0
- package/upgrades/side-effects/worktree-detector-attention-wireup.md +194 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwnDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwnDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA68KtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
|
package/dist/commands/server.js
CHANGED
|
@@ -1947,39 +1947,13 @@ export async function startServer(options) {
|
|
|
1947
1947
|
console.log(pc.red(` Port conflict: ${err instanceof Error ? err.message : err}`));
|
|
1948
1948
|
process.exit(1);
|
|
1949
1949
|
}
|
|
1950
|
-
// Agent worktree convention (Layer 4) —
|
|
1951
|
-
//
|
|
1952
|
-
//
|
|
1953
|
-
//
|
|
1954
|
-
//
|
|
1955
|
-
//
|
|
1956
|
-
//
|
|
1957
|
-
try {
|
|
1958
|
-
const detector = await import('../core/AgentWorktreeDetector.js');
|
|
1959
|
-
const repo = detector.resolveDetectorInstarRepo();
|
|
1960
|
-
if (repo) {
|
|
1961
|
-
const safeRoots = detector.enumerateSafeRoots();
|
|
1962
|
-
const detectionResult = await detector.runDetection({
|
|
1963
|
-
instarRepo: repo,
|
|
1964
|
-
stateDir: config.stateDir,
|
|
1965
|
-
safeRoots,
|
|
1966
|
-
// No `emitAttention` adapter wired here yet — TelegramAdapter
|
|
1967
|
-
// initializes later in this same startServer. The JSONL
|
|
1968
|
-
// fallback at `<stateDir>/audit/worktree-detector.jsonl` is the
|
|
1969
|
-
// durable trail for v1; an explicit AttentionQueue wireup is a
|
|
1970
|
-
// tracked follow-up (Layer 4 spec residual R-?).
|
|
1971
|
-
});
|
|
1972
|
-
if (detectionResult.emitted > 0) {
|
|
1973
|
-
console.log(pc.yellow(` Worktree detector: ${detectionResult.emitted} misplaced worktree(s) flagged (` +
|
|
1974
|
-
`enumerated=${detectionResult.enumerated} skipped=${detectionResult.skipped}` +
|
|
1975
|
-
`${detectionResult.deduped ? ` deduped=${detectionResult.deduped}` : ''}` +
|
|
1976
|
-
`${detectionResult.timedOut ? ' [timeout]' : ''})`));
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
catch (err) {
|
|
1981
|
-
console.log(pc.yellow(` Worktree detector: skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
1982
|
-
}
|
|
1950
|
+
// Agent worktree convention (Layer 4) — detector invocation lives
|
|
1951
|
+
// AFTER the TelegramAdapter setup blocks below, so it can pass
|
|
1952
|
+
// `telegram.createAttentionItem` as the emit-attention callback when
|
|
1953
|
+
// Telegram is configured. The original placement here was deferred
|
|
1954
|
+
// for that reason (see upgrades/side-effects/agent-worktree-
|
|
1955
|
+
// convention-layer-3-4.md). When no Telegram adapter is present the
|
|
1956
|
+
// detector still runs and falls back to the JSONL append.
|
|
1983
1957
|
let stopHeartbeat;
|
|
1984
1958
|
try {
|
|
1985
1959
|
stopHeartbeat = startHeartbeat(config.projectDir);
|
|
@@ -2813,6 +2787,63 @@ export async function startServer(options) {
|
|
|
2813
2787
|
console.error(`[server] Failed to ensure Agent Updates topic: ${err}`);
|
|
2814
2788
|
});
|
|
2815
2789
|
}
|
|
2790
|
+
// Agent worktree convention (Layer 4) — lifeline detector.
|
|
2791
|
+
//
|
|
2792
|
+
// Runs once per server boot. Inspects the canonical instar repo's
|
|
2793
|
+
// worktree list and emits an AttentionItem per worktree that lives
|
|
2794
|
+
// outside any registered agent's `<agent_home>/.worktrees/` safe
|
|
2795
|
+
// area. Signal-only: never blocks, never moves, never deletes.
|
|
2796
|
+
//
|
|
2797
|
+
// Placement is deliberately AFTER both TelegramAdapter setup blocks
|
|
2798
|
+
// (send-only at line ~2810 and full-mode at line ~2897) so we can
|
|
2799
|
+
// pass `telegram.createAttentionItem` as the emit-attention callback.
|
|
2800
|
+
// When Telegram isn't configured the detector still runs and falls
|
|
2801
|
+
// back to the JSONL append at
|
|
2802
|
+
// `<stateDir>/audit/worktree-detector.jsonl` (O_NOFOLLOW + fstat,
|
|
2803
|
+
// 24h rolling-window dedupe).
|
|
2804
|
+
//
|
|
2805
|
+
// Dedupe semantics:
|
|
2806
|
+
// - Telegram path: AttentionQueue's `item.id` collision (a second
|
|
2807
|
+
// emit with the same `worktree-misplaced:sha256(path)` id is a
|
|
2808
|
+
// no-op via the existing `attentionItems` Map lookup in
|
|
2809
|
+
// TelegramAdapter.createAttentionItem).
|
|
2810
|
+
// - JSONL path: 24h rolling-window scan of the fallback file.
|
|
2811
|
+
try {
|
|
2812
|
+
const detector = await import('../core/AgentWorktreeDetector.js');
|
|
2813
|
+
const repo = detector.resolveDetectorInstarRepo();
|
|
2814
|
+
if (repo) {
|
|
2815
|
+
const safeRoots = detector.enumerateSafeRoots();
|
|
2816
|
+
const emitAttention = telegram
|
|
2817
|
+
? async (item) => {
|
|
2818
|
+
await telegram.createAttentionItem({
|
|
2819
|
+
id: item.id,
|
|
2820
|
+
title: item.title,
|
|
2821
|
+
summary: item.summary,
|
|
2822
|
+
description: item.description,
|
|
2823
|
+
category: item.category,
|
|
2824
|
+
priority: item.priority,
|
|
2825
|
+
sourceContext: item.sourceContext,
|
|
2826
|
+
});
|
|
2827
|
+
}
|
|
2828
|
+
: undefined;
|
|
2829
|
+
const detectionResult = await detector.runDetection({
|
|
2830
|
+
instarRepo: repo,
|
|
2831
|
+
stateDir: config.stateDir,
|
|
2832
|
+
safeRoots,
|
|
2833
|
+
emitAttention,
|
|
2834
|
+
});
|
|
2835
|
+
if (detectionResult.emitted > 0) {
|
|
2836
|
+
const channel = telegram ? 'Telegram' : 'JSONL fallback';
|
|
2837
|
+
console.log(pc.yellow(` Worktree detector: ${detectionResult.emitted} misplaced worktree(s) flagged via ${channel} (` +
|
|
2838
|
+
`enumerated=${detectionResult.enumerated} skipped=${detectionResult.skipped}` +
|
|
2839
|
+
`${detectionResult.deduped ? ` deduped=${detectionResult.deduped}` : ''}` +
|
|
2840
|
+
`${detectionResult.timedOut ? ' [timeout]' : ''})`));
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
catch (err) {
|
|
2845
|
+
console.log(pc.yellow(` Worktree detector: skipped (${err instanceof Error ? err.message : String(err)})`));
|
|
2846
|
+
}
|
|
2816
2847
|
// Initialize TopicMemory whenever Telegram is configured (any mode).
|
|
2817
2848
|
// TopicMemory provides session context — needed even when lifeline owns polling.
|
|
2818
2849
|
if (telegram) {
|