instar 1.3.236 → 1.3.237
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/core/ParallelActivityIndex.d.ts +62 -0
- package/dist/core/ParallelActivityIndex.d.ts.map +1 -0
- package/dist/core/ParallelActivityIndex.js +129 -0
- package/dist/core/ParallelActivityIndex.js.map +1 -0
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +16 -0
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/monitoring/GeminiLoopDriver.d.ts +112 -0
- package/dist/monitoring/GeminiLoopDriver.d.ts.map +1 -0
- package/dist/monitoring/GeminiLoopDriver.js +111 -0
- package/dist/monitoring/GeminiLoopDriver.js.map +1 -0
- package/dist/monitoring/ParallelWorkOverlap.d.ts +59 -0
- package/dist/monitoring/ParallelWorkOverlap.d.ts.map +1 -0
- package/dist/monitoring/ParallelWorkOverlap.js +86 -0
- package/dist/monitoring/ParallelWorkOverlap.js.map +1 -0
- package/dist/monitoring/ParallelWorkSentinel.d.ts +59 -0
- package/dist/monitoring/ParallelWorkSentinel.d.ts.map +1 -0
- package/dist/monitoring/ParallelWorkSentinel.js +79 -0
- package/dist/monitoring/ParallelWorkSentinel.js.map +1 -0
- package/dist/providers/adapters/gemini-cli/transport/geminiSpawn.d.ts +14 -0
- package/dist/providers/adapters/gemini-cli/transport/geminiSpawn.d.ts.map +1 -1
- package/dist/providers/adapters/gemini-cli/transport/geminiSpawn.js +16 -0
- package/dist/providers/adapters/gemini-cli/transport/geminiSpawn.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +4 -0
- package/dist/scaffold/templates.js.map +1 -1
- package/dist/server/AgentServer.d.ts +1 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +30 -0
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/CapabilityIndex.d.ts.map +1 -1
- package/dist/server/CapabilityIndex.js +9 -0
- package/dist/server/CapabilityIndex.js.map +1 -1
- package/dist/server/routes.d.ts +2 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +17 -0
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +64 -64
- package/src/scaffold/templates.ts +4 -0
- package/upgrades/1.3.237.md +82 -0
- package/upgrades/side-effects/gemini-multi-turn-loop-driver.md +56 -0
- package/upgrades/side-effects/parallel-activity-coherence.md +85 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Side-Effects Review — Gemini multi-turn loop-driver (engine increment)
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `gemini-multi-turn-loop-driver`
|
|
4
|
+
**Date:** `2026-06-04`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required` (dark + unwired engine increment; the
|
|
7
|
+
spendable surface — the invoking route/wiring — is a separate later increment
|
|
8
|
+
that will carry its own review)
|
|
9
|
+
|
|
10
|
+
## Summary of the change
|
|
11
|
+
|
|
12
|
+
Adds `GeminiLoopDriver` (`src/monitoring/GeminiLoopDriver.ts`), a dependency-
|
|
13
|
+
injected engine that drives a gemini task across turns via the native
|
|
14
|
+
`gemini -r <handle>` resume path (turn 1 one-shot establishes the session; later
|
|
15
|
+
turns resume by a stable handle, re-prompting with only the next instruction so
|
|
16
|
+
no transcript is re-sent). Adds the `buildGeminiResumeArgv` transport helper. The
|
|
17
|
+
engine is NOT invoked anywhere yet (dark + unwired); only its 14 unit tests
|
|
18
|
+
exercise it.
|
|
19
|
+
|
|
20
|
+
## Decision-point inventory
|
|
21
|
+
|
|
22
|
+
The engine makes five terminal decisions per run: done-sentinel detected,
|
|
23
|
+
turn-cap reached, budget-gate closed, spawn failure (non-zero exit), and
|
|
24
|
+
handle-capture failure. Each is covered both-sides in the unit suite.
|
|
25
|
+
|
|
26
|
+
## 1. Over-block
|
|
27
|
+
|
|
28
|
+
**What legitimate inputs does this change reject?** Nothing in production today —
|
|
29
|
+
the engine is unwired, so no caller is gated by it. Within a run: a closed budget
|
|
30
|
+
gate halts before spawning (intended — that IS the overspend guard), and a
|
|
31
|
+
`null` handle-capture aborts the loop after turn 1 rather than resuming (intended
|
|
32
|
+
— resuming `latest` could hijack a foreign session; aborting is the safe choice).
|
|
33
|
+
The `maxTurns` clamp floors at 1, so a 0/negative cap still runs exactly one turn
|
|
34
|
+
rather than zero or infinite.
|
|
35
|
+
|
|
36
|
+
## 2. Under-block
|
|
37
|
+
|
|
38
|
+
**What does this still miss?** The engine does not itself enforce a token budget —
|
|
39
|
+
it delegates to the injected `budgetGate`, which is wired to the real
|
|
40
|
+
QuotaTracker only in the (later) invocation increment; an integrator that injects
|
|
41
|
+
a permissive gate gets no budget protection. It does not detect a wedged turn
|
|
42
|
+
mid-spawn (it relies on the injected spawn's own timeout, which the real
|
|
43
|
+
`spawnGeminiAndWait` provides). It does not yet verify the empirically-noted 3+
|
|
44
|
+
turn resume-accumulation (a live-verify gate recorded in the spec before any
|
|
45
|
+
enable). Completion relies on the mentee emitting the sentinel OR (later) a judge;
|
|
46
|
+
a mentee that finishes silently without the sentinel runs to the turn cap.
|
|
47
|
+
|
|
48
|
+
## 3. Level-of-abstraction fit
|
|
49
|
+
|
|
50
|
+
**Right layer?** Yes. The engine sits in `src/monitoring/` beside the other
|
|
51
|
+
driver/lifecycle components and depends only on the gemini transport's pure argv
|
|
52
|
+
builders (`buildGeminiOneShotArgv` / `buildGeminiResumeArgv`); all I/O is
|
|
53
|
+
injected, so the subscription-auth guarantee stays in the transport
|
|
54
|
+
(`buildGeminiChildEnv` strips billing env) and is reused, not re-implemented. The
|
|
55
|
+
resume argv helper lives in the transport module next to the one-shot builder,
|
|
56
|
+
keeping the gemini-cli invocation surface in one place.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Side-Effects Review — Parallel-Work Awareness, Phase A core (cross-topic index)
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `parallel-activity-coherence`
|
|
4
|
+
**Date:** `2026-06-03`
|
|
5
|
+
**Author:** `Echo (instar-dev agent)`
|
|
6
|
+
**Tier:** `2` (new capability; converged + approved spec: docs/specs/parallel-activity-coherence.md)
|
|
7
|
+
**Second-pass reviewer:** `not required (the converged spec carries a 2-reviewer adversarial+integration pass that reshaped it)`
|
|
8
|
+
|
|
9
|
+
## Summary of the change
|
|
10
|
+
Phase A CORE of the Parallel-Work Awareness feature: `ParallelActivityIndex` — a thin
|
|
11
|
+
CROSS-topic read aggregator over the EXISTING Topic-Intent Layer. It does NOT add a new
|
|
12
|
+
per-topic store (convergence: that would duplicate `TopicIntentStore`); it only READS the
|
|
13
|
+
existing per-topic intent files and presents the cross-topic view ("all my topics + what
|
|
14
|
+
each is working on") that genuinely did not exist. Plus `extractTags` — high-specificity
|
|
15
|
+
token extraction (drops generic boilerplate so two "fix the test" topics don't false-match).
|
|
16
|
+
|
|
17
|
+
New:
|
|
18
|
+
- `src/core/ParallelActivityIndex.ts` — enumerate `{stateDir}/topic-intent/*.json`; per
|
|
19
|
+
topic derive `focus` (latest goal > latest decision > purpose), `tags` (high-specificity
|
|
20
|
+
tokens), `refCount`, `updatedAt`, `running`. Read-only; an injectable `getRefs` seam for
|
|
21
|
+
testability (production uses the real `TopicIntentStore.getRefsAtOrAbove`).
|
|
22
|
+
- `tests/unit/parallel-activity-index.test.ts` — 7 tests.
|
|
23
|
+
|
|
24
|
+
Phase A is now COMPLETE: `GET /parallel-work/activities` route + CapabilityIndex entry
|
|
25
|
+
(`parallelWork`, prefixes `['/parallel-work']`) + server wiring (constructed in AgentServer
|
|
26
|
+
in its OWN try/catch, injected into routeCtx, `running` enriched from the live session list)
|
|
27
|
+
+ integration/e2e tests + CLAUDE.md template + migrateClaudeMd agent-awareness. The overlap
|
|
28
|
+
ParallelWorkSentinel is Phase B (ships dark), a separate PR.
|
|
29
|
+
|
|
30
|
+
## Phase B (overlap sentinel core — added to this PR)
|
|
31
|
+
- `src/monitoring/ParallelWorkOverlap.ts` — the PURE cross-topic overlap detector: activity
|
|
32
|
+
gate (only recently-worked topics), IDF/specificity weighting over the already-boilerplate-
|
|
33
|
+
filtered tags, ≥1 shared high-specificity tag required, self-exclusion, signature = sorted
|
|
34
|
+
shared-tag set, + `signatureChangedMaterially` (hysteresis) and `pairKey`. No I/O, no real
|
|
35
|
+
time (injected nowMs) ⇒ exhaustively unit-tested (11 tests).
|
|
36
|
+
- `src/monitoring/ParallelWorkSentinel.ts` — the stateful councilor: `tick(nowMs)` reads the
|
|
37
|
+
activities, runs the detector, and emits ONE `overlap` nudge per genuinely-fresh overlap.
|
|
38
|
+
Containment: PAIR-KEYED cooldown (survives focus edits), signature hysteresis (no re-nag on
|
|
39
|
+
a one-token tweak), audit sink for every transition. SIGNAL-ONLY (emits an event; never
|
|
40
|
+
gates/mutates). 6 tests. The cadence + lease-gating + server wiring + config (ships dark) +
|
|
41
|
+
the nudge→Telegram/sentinel-events routing are the remaining wiring on this branch.
|
|
42
|
+
|
|
43
|
+
## Decision-point inventory
|
|
44
|
+
- `ParallelActivityIndex` read aggregation — **add** — pure read over existing state; no
|
|
45
|
+
block/allow surface, no mutation.
|
|
46
|
+
- `ParallelWorkOverlap` / `ParallelWorkSentinel` — **add** — pure detector + a signal-only
|
|
47
|
+
EventEmitter; no block/allow surface, no mutation. The nudge informs; the agent decides.
|
|
48
|
+
|
|
49
|
+
## 1./2. Over/Under-block
|
|
50
|
+
No block/allow surface. Signal-only observability over existing data.
|
|
51
|
+
|
|
52
|
+
## 3. Level-of-abstraction fit
|
|
53
|
+
Correct — it reads the Topic-Intent layer (the right source for "what each topic intends")
|
|
54
|
+
and presents a cross-topic view; it does not re-implement intent capture or storage.
|
|
55
|
+
|
|
56
|
+
## 4. Signal vs authority
|
|
57
|
+
**Reference:** docs/signal-vs-authority.md. [x] No block/allow surface. A read aggregator.
|
|
58
|
+
|
|
59
|
+
## 5. Interactions
|
|
60
|
+
- **No new store / no new write path** — reuses `TopicIntentStore` (which already has the
|
|
61
|
+
structural per-turn write path via TopicIntentCapture). No duplication, no second decay engine.
|
|
62
|
+
- **False-positive containment starts here:** `extractTags` strips generic boilerplate +
|
|
63
|
+
requires specificity (compound/identifier tokens, or rare ≥4-char words), so the Phase B
|
|
64
|
+
overlap comparison rests on genuine shared entities, not coincidental generic words.
|
|
65
|
+
- **Robustness:** missing intent dir ⇒ empty list; a corrupt/again topic file ⇒ that topic
|
|
66
|
+
contributes no refs (swallowed), never throws.
|
|
67
|
+
|
|
68
|
+
## 6. External surfaces
|
|
69
|
+
- (Remaining) `GET /parallel-work/activities` + CapabilityIndex classification (the #727
|
|
70
|
+
lesson). No persistent state of its own (reads existing topic-intent files). Config flag
|
|
71
|
+
(`monitoring.parallelWorkSentinel`) lands with the sentinel (Phase B), ships dark.
|
|
72
|
+
|
|
73
|
+
## 7. Rollback cost
|
|
74
|
+
Pure additive read code. Revert ⇒ gone, no state, no migration.
|
|
75
|
+
|
|
76
|
+
## Conclusion
|
|
77
|
+
Phase A core complete + unit-tested (7 tests, tsc clean): the cross-topic index over the
|
|
78
|
+
existing Topic-Intent layer + specificity-aware tag extraction. Non-duplicative (the
|
|
79
|
+
convergence-mandated reshape). Route + wiring + integration/e2e + agent-awareness follow on
|
|
80
|
+
this branch; the overlap ParallelWorkSentinel is Phase B (ships dark).
|
|
81
|
+
|
|
82
|
+
## Evidence pointers
|
|
83
|
+
- `tsc --noEmit` clean; `vitest run tests/unit/parallel-activity-index.test.ts` → 7/7
|
|
84
|
+
(extractTags specificity boundary incl. the cpu vs cpu-sampling case; focus derivation
|
|
85
|
+
goal>decision>purpose; tags; running/nickname; empty-dir ⇒ []).
|