@wolfx/opencode-magic-context 0.22.1-patch.1 → 0.22.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/config/agent-disable.d.ts +0 -9
- package/dist/config/agent-disable.d.ts.map +1 -1
- package/dist/config/schema/agent-overrides.d.ts +0 -3
- package/dist/config/schema/agent-overrides.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +7 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/features/builtin-commands/types.d.ts +0 -2
- package/dist/features/builtin-commands/types.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/scheduler.d.ts +0 -4
- package/dist/features/magic-context/dreamer/scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts +8 -0
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/index.d.ts +1 -0
- package/dist/features/magic-context/git-commits/index.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/storage-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/sweep-coordinator.d.ts +48 -0
- package/dist/features/magic-context/git-commits/sweep-coordinator.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/aft-availability.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/storage-key-files.d.ts +0 -5
- package/dist/features/magic-context/key-files/storage-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/literal-probes.d.ts +24 -0
- package/dist/features/magic-context/literal-probes.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +7 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +7 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-notes.d.ts +8 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +21 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/types.d.ts +4 -0
- package/dist/features/magic-context/types.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +14 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/derive-budgets.d.ts +3 -3
- package/dist/hooks/magic-context/event-handler.d.ts +7 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-payloads.d.ts +7 -0
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +1 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +41 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +12 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +7 -2
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +9 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-content-primitives.d.ts +23 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -1
- package/dist/hooks/magic-context/temporal-awareness.d.ts.map +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts +11 -26
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +17 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +830 -263
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/shared/keep-subagents.d.ts +7 -0
- package/dist/shared/keep-subagents.d.ts.map +1 -0
- package/dist/shared/models-dev-cache.d.ts +54 -27
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +3 -1
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/keep-subagents.test.ts +39 -0
- package/src/shared/keep-subagents.ts +33 -0
- package/src/shared/models-dev-cache.test.ts +192 -360
- package/src/shared/models-dev-cache.ts +162 -193
- package/src/shared/rpc-types.ts +3 -1
- package/src/tui/index.tsx +17 -8
- package/src/tui/slots/sidebar-content.tsx +20 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAkBpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C;;;;;GAKG;AACH,UAAU,mBAAmB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,iBAAiB,CAAC,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AA2BD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CACzC,IAAI,EAAE,mBAAmB,GAC1B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CA6DnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;
|
|
1
|
+
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAyDihK,CAAC;;;;;;;;;;;;qBAA9rD,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAA4w1B,CAAC;;;;;;EAD7s8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-handlers.d.ts","sourceRoot":"","sources":["../../src/plugin/rpc-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EACH,KAAK,eAAe,IAAI,QAAQ,EAGnC,MAAM,mCAAmC,CAAC;AAY3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAqBlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,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B,CAAC,EAAE,MAAM,GAC/B,YAAY,CAuKd;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,qBAAqB,EAChC,IAAI,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;CACtC,GACF,IAAI,CAgON"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Set at plugin boot from `keep_subagents` config. */
|
|
2
|
+
export declare function setKeepSubagents(value: boolean): void;
|
|
3
|
+
/** True when subagent child sessions should be retained (not deleted). */
|
|
4
|
+
export declare function shouldKeepSubagents(): boolean;
|
|
5
|
+
/** Test-only reset. Do NOT call from production paths. */
|
|
6
|
+
export declare function _resetKeepSubagentsForTesting(): void;
|
|
7
|
+
//# sourceMappingURL=keep-subagents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-subagents.d.ts","sourceRoot":"","sources":["../../src/shared/keep-subagents.ts"],"names":[],"mappings":"AAmBA,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAErD;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,0DAA0D;AAC1D,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolve per-model context limits
|
|
2
|
+
* Resolve per-model context limits from OpenCode's SDK — the single source of
|
|
3
|
+
* truth — for OpenCode sessions.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
+
* `client.config.providers()` returns OpenCode's fully-resolved config: the
|
|
6
|
+
* live models.dev cache + compiled-in snapshot + opencode.json custom-provider
|
|
7
|
+
* overrides + auth-plugin caps (e.g. the Codex-OAuth gpt-5.5 400k cap). We
|
|
8
|
+
* consume ONLY that. We no longer read OpenCode's `models.json` file ourselves:
|
|
9
|
+
* a torn read mid-write produced impossible limits (a 6748 "limit" for a session
|
|
10
|
+
* that had run for hours), and a stale on-disk copy out-voted the live
|
|
11
|
+
* auth-resolved cap (922k vs the real 400k). OpenCode reads that file safely in
|
|
12
|
+
* its own process and hands us the merged answer.
|
|
5
13
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* modes. Whatever OpenCode reports is the source of truth.
|
|
14
|
+
* Layers:
|
|
15
|
+
* 1. `apiCache` (authoritative): warmed once at startup from the SDK; seeded
|
|
16
|
+
* from a persisted last-known-good file on cold start so a restart uses the
|
|
17
|
+
* real limit immediately (no 128k-default budget-collapse window).
|
|
11
18
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* code path that cannot reach the SDK client.
|
|
19
|
+
* All cached values are bounded to a sane [20k, 3M] range on insert, so torn /
|
|
20
|
+
* unconfigured-default garbage can never be returned or persisted. The startup
|
|
21
|
+
* warm retries a couple times when OpenCode's provider service isn't ready yet.
|
|
16
22
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* issue #77 cache-regression recovery path.
|
|
23
|
+
* Pi does NOT use this — it resolves from its own `ctx.getModel().contextWindow`
|
|
24
|
+
* (instant at extension load), so `getSdkContextLimit()` returns `undefined`
|
|
25
|
+
* for Pi and Pi's own path is used.
|
|
21
26
|
*/
|
|
22
27
|
interface OpencodeClientLike {
|
|
23
28
|
config: {
|
|
@@ -28,6 +33,12 @@ interface OpencodeClientLike {
|
|
|
28
33
|
}>;
|
|
29
34
|
};
|
|
30
35
|
}
|
|
36
|
+
export declare const MIN_SANE_LIMIT = 20000;
|
|
37
|
+
export declare const MAX_SANE_LIMIT = 3000000;
|
|
38
|
+
/** True when `limit` is a plausible real prompt window — used to reject torn /
|
|
39
|
+
* unconfigured-default garbage in BOTH harnesses (OpenCode's SDK values and
|
|
40
|
+
* Pi's reported `contextWindow`). Exported so Pi applies the identical bound. */
|
|
41
|
+
export declare function isSaneLimit(limit: number | undefined): limit is number;
|
|
31
42
|
/**
|
|
32
43
|
* Asynchronously refresh the API-layer cache from OpenCode's SDK.
|
|
33
44
|
*
|
|
@@ -35,31 +46,47 @@ interface OpencodeClientLike {
|
|
|
35
46
|
* OpenCode's `/config/providers` endpoint returns every provider with full
|
|
36
47
|
* model metadata — including `limit.context` — resolved through the same path
|
|
37
48
|
* OpenCode itself uses (live cache + compiled-in snapshot + opencode.json
|
|
38
|
-
* overrides + derived experimental modes).
|
|
49
|
+
* overrides + derived experimental modes + auth-plugin caps).
|
|
50
|
+
*
|
|
51
|
+
* `retries`/`retryDelayMs`: when OpenCode's provider service isn't ready at our
|
|
52
|
+
* startup, `config.providers()` can return an empty/no-providers payload. Retry
|
|
53
|
+
* a few times so the cache warms instead of leaving the session on the 128k
|
|
54
|
+
* default until the next restart. A successful load (any providers) stops early.
|
|
39
55
|
*
|
|
40
56
|
* Safe to call concurrently; only overwrites the cache on success.
|
|
41
57
|
*/
|
|
42
|
-
export declare function refreshModelLimitsFromApi(client: OpencodeClientLike
|
|
58
|
+
export declare function refreshModelLimitsFromApi(client: OpencodeClientLike, options?: {
|
|
59
|
+
retries?: number;
|
|
60
|
+
retryDelayMs?: number;
|
|
61
|
+
}): Promise<void>;
|
|
43
62
|
/**
|
|
44
|
-
*
|
|
63
|
+
* Resolve a model's prompt limit from OpenCode's SDK (`config.providers()`),
|
|
64
|
+
* the single source of truth: it already merges models.dev + compiled-in
|
|
65
|
+
* snapshot + opencode.json overrides + auth-plugin caps (e.g. the Codex-OAuth
|
|
66
|
+
* gpt-5.5 400k cap). We deliberately do NOT read OpenCode's `models.json` file
|
|
67
|
+
* ourselves — a torn read of that file mid-write produced garbage limits, and a
|
|
68
|
+
* stale on-disk copy out-voted the live auth-resolved cap (922k vs the real
|
|
69
|
+
* 400k). OpenCode reads that file safely within its own process and exposes the
|
|
70
|
+
* merged result here.
|
|
45
71
|
*
|
|
46
|
-
*
|
|
47
|
-
* 1.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
72
|
+
* Resolution:
|
|
73
|
+
* 1. Seed `apiCache` from the persisted last-known-good file once (cold start).
|
|
74
|
+
* 2. Return the SDK value (sane by construction — only [20k,3M] is cached).
|
|
75
|
+
* 3. `undefined` when the SDK hasn't reported this model yet → the caller
|
|
76
|
+
* defaults / retries (the startup warm retries when OpenCode isn't ready).
|
|
51
77
|
*
|
|
52
|
-
*
|
|
78
|
+
* OpenCode-only: Pi never warms `apiCache` (it resolves from its own
|
|
79
|
+
* `ctx.getModel().contextWindow`), so for Pi this returns `undefined` and Pi's
|
|
80
|
+
* own resolution path is used.
|
|
53
81
|
*/
|
|
54
|
-
export declare function
|
|
55
|
-
/** Clear in-memory caches (for testing). */
|
|
82
|
+
export declare function getSdkContextLimit(providerID: string, modelID: string): number | undefined;
|
|
83
|
+
/** Clear in-memory caches (for testing and the regression-recovery refetch). */
|
|
56
84
|
export declare function clearModelsDevCache(): void;
|
|
57
85
|
/** Inspection helpers (for logging / debugging). */
|
|
58
86
|
export declare function getModelsDevCacheState(): {
|
|
59
87
|
apiLoaded: boolean;
|
|
60
88
|
apiCount: number;
|
|
61
89
|
apiAgeMs: number;
|
|
62
|
-
fileCount: number;
|
|
63
90
|
};
|
|
64
91
|
export {};
|
|
65
92
|
//# sourceMappingURL=models-dev-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,UAAU,kBAAkB;IACxB,MAAM,EAAE;QACJ,SAAS,EAAE,MAAM,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,SAAS,CAAC,EAAE,OAAO,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KAChE,CAAC;CACL;AASD,eAAO,MAAM,cAAc,QAAS,CAAC;AACrC,eAAO,MAAM,cAAc,UAAY,CAAC;AAExC;;kFAEkF;AAClF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,IAAI,MAAM,CAEtE;AA+HD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAC3C,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD,OAAO,CAAC,IAAI,CAAC,CAUf;AA+DD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI1F;AA6BD,gFAAgF;AAChF,wBAAgB,mBAAmB,IAAI,IAAI,CAI1C;AAED,oDAAoD;AACpD,wBAAgB,sBAAsB,IAAI;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAMA"}
|
|
@@ -76,7 +76,9 @@ export interface SidebarSnapshot {
|
|
|
76
76
|
* the runtime `RecompProgress` shape from compartment-runner-types.ts.
|
|
77
77
|
*/
|
|
78
78
|
recompProgress?: {
|
|
79
|
-
|
|
79
|
+
/** "recomp" → "Recomp" labels; "upgrade" → "Upgrade" labels. */
|
|
80
|
+
kind?: "recomp" | "upgrade";
|
|
81
|
+
phase: "recomp" | "migration" | "done" | "failed" | "skipped";
|
|
80
82
|
processedMessages: number;
|
|
81
83
|
totalMessages: number;
|
|
82
84
|
passCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|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MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAYhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACtD;AA2QD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAahE,OAAO,KAAK,EAAkC,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAahE,OAAO,KAAK,EAAkC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqKjF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
_resetKeepSubagentsForTesting,
|
|
4
|
+
setKeepSubagents,
|
|
5
|
+
shouldKeepSubagents,
|
|
6
|
+
} from "./keep-subagents";
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
_resetKeepSubagentsForTesting();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe("keep-subagents flag", () => {
|
|
13
|
+
it("#given default #then subagent sessions are NOT kept (deleted on success)", () => {
|
|
14
|
+
expect(shouldKeepSubagents()).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("#given setKeepSubagents(true) #then sessions are kept", () => {
|
|
18
|
+
setKeepSubagents(true);
|
|
19
|
+
expect(shouldKeepSubagents()).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("#given setKeepSubagents(false) #then sessions are not kept", () => {
|
|
23
|
+
setKeepSubagents(true);
|
|
24
|
+
setKeepSubagents(false);
|
|
25
|
+
expect(shouldKeepSubagents()).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("#given a non-true value #then coerces to false (only strict true keeps)", () => {
|
|
29
|
+
// boot wiring passes `config.keep_subagents === true`, but guard anyway.
|
|
30
|
+
setKeepSubagents(undefined as unknown as boolean);
|
|
31
|
+
expect(shouldKeepSubagents()).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("#given reset helper #then returns to default false", () => {
|
|
35
|
+
setKeepSubagents(true);
|
|
36
|
+
_resetKeepSubagentsForTesting();
|
|
37
|
+
expect(shouldKeepSubagents()).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug / data-collection switch: when enabled, Magic Context does NOT delete
|
|
3
|
+
* the child sessions it spawns for its own subagents (historian, dreamer,
|
|
4
|
+
* sidekick, memory-migration, key-files, user-memory review, recomp).
|
|
5
|
+
*
|
|
6
|
+
* By default these child sessions are deleted on success (only FAILED ones are
|
|
7
|
+
* kept for debugging). With `keep_subagents: true` ALL of them are retained, so
|
|
8
|
+
* their full transcript — prompt, tool calls, token usage, model output — stays
|
|
9
|
+
* inspectable in OpenCode's session store / the dashboard. Intended for
|
|
10
|
+
* short-term data collection (e.g. profiling what the dreamer actually does)
|
|
11
|
+
* before the dreamer v2 overhaul, NOT for steady-state use — kept sessions
|
|
12
|
+
* accumulate in the host's session DB until manually cleared.
|
|
13
|
+
*
|
|
14
|
+
* Process-global, set once at boot from config (mirrors `harness.ts`). A
|
|
15
|
+
* config change requires a restart to take effect. NEVER thread this through
|
|
16
|
+
* per-call args — it's a coarse, boot-time debug toggle.
|
|
17
|
+
*/
|
|
18
|
+
let keepSubagents = false;
|
|
19
|
+
|
|
20
|
+
/** Set at plugin boot from `keep_subagents` config. */
|
|
21
|
+
export function setKeepSubagents(value: boolean): void {
|
|
22
|
+
keepSubagents = value === true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** True when subagent child sessions should be retained (not deleted). */
|
|
26
|
+
export function shouldKeepSubagents(): boolean {
|
|
27
|
+
return keepSubagents;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Test-only reset. Do NOT call from production paths. */
|
|
31
|
+
export function _resetKeepSubagentsForTesting(): void {
|
|
32
|
+
keepSubagents = false;
|
|
33
|
+
}
|