@cortexkit/opencode-magic-context 0.32.0 → 0.32.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/README.md +3 -3
- package/dist/features/magic-context/dreamer/cron.d.ts +2 -2
- package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +4 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +7 -4
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +8 -16
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/plugin-messages.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-backfill.d.ts +6 -3
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-storage.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +3 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/runner.d.ts +1 -0
- package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +8 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +10 -0
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/storage.d.ts +16 -1
- package/dist/features/magic-context/smart-notes/storage.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-persisted.d.ts +8 -5
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-schema-helpers.d.ts +3 -4
- package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/tool-owner-backfill.d.ts +2 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
- package/dist/features/magic-context/transform-decision-log.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-render-epoch.d.ts +12 -0
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +29 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +15 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +24 -2
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/shadow-sender.d.ts +65 -27
- package/dist/hooks/magic-context/shadow-sender.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +27 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4128 -1207
- package/dist/plugin/rpc-handlers.d.ts +3 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +5 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +3 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts +11 -6
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +2 -2
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tui-config.d.ts +5 -3
- package/dist/shared/tui-config.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts +9 -2
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui/data/notification-socket.d.ts +4 -5
- package/dist/tui/data/notification-socket.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts +9 -2
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/notification-socket.d.ts +4 -5
- package/dist/tui-compiled/data/notification-socket.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/shared/models-dev-cache.test.ts +5 -0
- package/src/shared/models-dev-cache.ts +44 -6
- package/src/shared/opencode-compaction-detector.test.ts +11 -2
- package/src/shared/rpc-client.test.ts +213 -9
- package/src/shared/rpc-client.ts +48 -39
- package/src/shared/rpc-notifications.test.ts +26 -5
- package/src/shared/rpc-notifications.ts +44 -35
- package/src/shared/rpc-server.ts +69 -33
- package/src/shared/sqlite.ts +22 -3
- package/src/shared/tui-config.test.ts +4 -12
- package/src/shared/tui-config.ts +6 -6
- package/src/tui/data/context-db.test.ts +113 -0
- package/src/tui/data/context-db.ts +26 -19
- package/src/tui/data/notification-socket.test.ts +277 -11
- package/src/tui/data/notification-socket.ts +257 -86
- package/src/tui/index.tsx +33 -25
- package/src/tui/slots/sidebar-content.tsx +62 -24
- package/src/tui-compiled/data/context-db.ts +26 -19
- package/src/tui-compiled/data/notification-socket.ts +257 -86
- package/src/tui-compiled/index.tsx +41 -24
- package/src/tui-compiled/slots/sidebar-content.tsx +45 -23
|
@@ -8,6 +8,9 @@ import type { LiveSessionState } from "../hooks/magic-context/live-session-state
|
|
|
8
8
|
import type { MagicContextRpcServer } from "../shared/rpc-server";
|
|
9
9
|
import type { SidebarSnapshot, StatusDetail } from "../shared/rpc-types";
|
|
10
10
|
export declare function buildSidebarSnapshot(db: Database, sessionId: string, directory: string, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number, config?: Record<string, unknown>): SidebarSnapshot;
|
|
11
|
+
/** Convert snapshot-build failures into a transport-failure envelope. A genuine
|
|
12
|
+
* zero snapshot remains a successful value so deleted sessions stay deleted. */
|
|
13
|
+
export declare function buildSidebarSnapshotRpcResponse(db: Database, sessionId: string, directory: string, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number, config?: Record<string, unknown>): Record<string, unknown>;
|
|
11
14
|
export declare function buildStatusDetail(db: Database, sessionId: string, directory: string, modelKey?: string, config?: Record<string, unknown>, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number): StatusDetail;
|
|
12
15
|
/**
|
|
13
16
|
* Register all RPC handlers on the server.
|
|
@@ -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;AAIzE,OAAO,EACH,KAAK,eAAe,IAAI,QAAQ,EAGnC,MAAM,mCAAmC,CAAC;AAc3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAA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MAAM,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazB;AAED,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,qBAAqB,CAAC,EAAE,MAAM,GAC/B,YAAY,CAyKd;AA4BD;;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,CA4ON"}
|
|
@@ -103,6 +103,11 @@ export declare function resetAuthRewarmLatchForTest(): void;
|
|
|
103
103
|
* own resolution path is used.
|
|
104
104
|
*/
|
|
105
105
|
export declare function getSdkContextLimit(providerID: string, modelID: string): number | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Return only a provider-declared input cap. A combined context window is useful
|
|
108
|
+
* for scheduling but is not safe as a fail-closed prompt boundary.
|
|
109
|
+
*/
|
|
110
|
+
export declare function getSdkInputLimit(providerID: string, modelID: string): number | undefined;
|
|
106
111
|
/** Clear in-memory caches (for testing and the regression-recovery refetch). */
|
|
107
112
|
export declare function clearModelsDevCache(): void;
|
|
108
113
|
/** Inspection helpers (for logging / debugging). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,UAAU,kBAAkB;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;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI1F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWxF;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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class MagicContextRpcClient {
|
|
2
2
|
private port;
|
|
3
3
|
private token;
|
|
4
|
+
private instanceId;
|
|
4
5
|
private portDir;
|
|
5
6
|
private legacyPortFilePath;
|
|
6
7
|
private healthChecked;
|
|
@@ -16,9 +17,10 @@ export declare class MagicContextRpcClient {
|
|
|
16
17
|
resolveEndpoint(): Promise<{
|
|
17
18
|
port: number;
|
|
18
19
|
token: string | null;
|
|
20
|
+
instanceId: string | null;
|
|
19
21
|
} | null>;
|
|
20
22
|
private resolvePort;
|
|
21
|
-
private
|
|
23
|
+
private readPortFiles;
|
|
22
24
|
private healthCheck;
|
|
23
25
|
private fetchWithTimeout;
|
|
24
26
|
reset(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAiBA,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE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Notification {
|
|
|
21
21
|
export interface NotificationSink {
|
|
22
22
|
/** The TUI's active session at connect time (its hello scope). */
|
|
23
23
|
sessionId?: string;
|
|
24
|
+
/** Protocol 2 clients use strict session scoping; absent means legacy behavior. */
|
|
25
|
+
protocol?: number;
|
|
24
26
|
/** Deliver one notification over this sink's live socket. */
|
|
25
27
|
send: (notification: RpcNotification) => void;
|
|
26
28
|
}
|
|
@@ -30,8 +32,11 @@ export declare function registerNotificationSink(sink: NotificationSink): () =>
|
|
|
30
32
|
* also enqueues it so a TUI that is momentarily disconnected (reconnecting, or
|
|
31
33
|
* not yet connected) still receives it on its next hello via the backlog drain.
|
|
32
34
|
* At-least-once: a live push that the socket drops is re-delivered from the
|
|
33
|
-
* queue on reconnect (pruned only when the client
|
|
35
|
+
* queue on reconnect (pruned only when the client acknowledges it). */
|
|
34
36
|
export declare function pushNotification(type: string, payload: Record<string, unknown>, sessionId?: string): void;
|
|
37
|
+
export declare function acknowledgeNotifications(ids: readonly number[]): void;
|
|
38
|
+
/** Reset process-local state to simulate a fresh server module in protocol tests. */
|
|
39
|
+
export declare function __resetNotificationStateForTests(): void;
|
|
35
40
|
export interface DrainNotificationsOptions {
|
|
36
41
|
/**
|
|
37
42
|
* Cursor for global notifications when a session-scoped client sends separate
|
|
@@ -53,8 +58,8 @@ export interface DrainNotificationsOptions {
|
|
|
53
58
|
* behavior.
|
|
54
59
|
*
|
|
55
60
|
* Delivery is at-least-once (non-destructive return + prune-on-ack): a returned
|
|
56
|
-
* notification stays queued until
|
|
57
|
-
*
|
|
61
|
+
* notification stays queued until an exact acknowledgement or a legacy cursor
|
|
62
|
+
* removes it, so a dropped WS socket re-delivers unhandled backlog on reconnect. */
|
|
58
63
|
export declare function drainNotifications(lastReceivedId?: number, sessionId?: string, options?: DrainNotificationsOptions): RpcNotification[];
|
|
59
64
|
/** Whether a TUI client is connected via a live notification socket.
|
|
60
65
|
* Now exact socket liveness (a registered WS sink), not a poll-drain timestamp.
|
|
@@ -62,8 +67,8 @@ export declare function drainNotifications(lastReceivedId?: number, sessionId?:
|
|
|
62
67
|
* Pass `sessionId` (preferred) to ask whether a TUI is connected FOR THAT
|
|
63
68
|
* SESSION — this is what producers (`/ctx-status`, `/ctx-recomp`, the upgrade
|
|
64
69
|
* reminder) must use to decide dialog-vs-message, so a TUI on a different
|
|
65
|
-
* session in the same process does not misroute their delivery. A
|
|
66
|
-
* sink
|
|
67
|
-
* callers with no session context
|
|
70
|
+
* session in the same process does not misroute their delivery. A modern
|
|
71
|
+
* session-less sink is global-only; a legacy sink retains broad compatibility.
|
|
72
|
+
* Omit `sessionId` only for callers with no session context. */
|
|
68
73
|
export declare function isTuiConnected(sessionId?: string): boolean;
|
|
69
74
|
//# sourceMappingURL=rpc-notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,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;AAKD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,IAAI,EAAE,CAAC,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAYD,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,IAAI,CAK3E;
|
|
1
|
+
{"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX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|
/** HTTP route handler (Bun fetch). Returns a Response, or undefined when the
|
|
34
34
|
* request was upgraded to a WebSocket. */
|
|
35
35
|
private handleFetch;
|
|
36
|
-
/** WS message handler: hello (auth + sink registration + backlog
|
|
37
|
-
* ack (
|
|
36
|
+
/** WS message handler: hello (auth + sink registration + backlog delivery) and
|
|
37
|
+
* ack (exact removal or legacy cursor pruning). All other messages are ignored. */
|
|
38
38
|
private handleWsMessage;
|
|
39
39
|
}
|
|
40
40
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAsBA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AA8CxF;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,oEAAoE;IACpE,OAAO,CAAC,OAAO,CAAsC;IAMrD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;gBAE7C,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAIjD,6DAA6D;IACvD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA6F9B,6EAA6E;IAC7E,IAAI,IAAI,IAAI;IAuBZ,OAAO,CAAC,uBAAuB;IAgB/B;+CAC2C;YAC7B,WAAW;IAyDzB;wFACoF;IACpF,OAAO,CAAC,eAAe;CA8H1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AA4IhD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
* through setup or doctor.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
|
-
* Ensure
|
|
12
|
-
* Creates tui.
|
|
11
|
+
* Ensure the selected TUI config has the magic-context plugin entry.
|
|
12
|
+
* Creates tui.jsonc if neither TUI config exists. Silently skips if already present.
|
|
13
13
|
*/
|
|
14
|
-
export declare function ensureTuiPluginEntry(
|
|
14
|
+
export declare function ensureTuiPluginEntry(options?: {
|
|
15
|
+
configDir?: string;
|
|
16
|
+
}): boolean;
|
|
15
17
|
//# sourceMappingURL=tui-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyEH;;;GAGG;AACH,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAqDlF"}
|
|
@@ -15,8 +15,15 @@ export declare function loadSidebarSnapshot(sessionId: string, directory: string
|
|
|
15
15
|
export declare function loadStatusDetail(sessionId: string, directory: string, modelKey?: string): Promise<StatusDetail>;
|
|
16
16
|
/** Fetch embedding coverage status for `/ctx-embed` via RPC. */
|
|
17
17
|
export declare function loadEmbedDetail(sessionId: string, directory: string): Promise<EmbedDetail>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
export type CompartmentCountResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
count: number;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: string;
|
|
24
|
+
};
|
|
25
|
+
/** Get compartment count without making transport failure look like a real zero. */
|
|
26
|
+
export declare function getCompartmentCount(sessionId: string): Promise<CompartmentCountResult>;
|
|
20
27
|
/** Send recomp request to server via RPC. */
|
|
21
28
|
export declare function requestRecomp(sessionId: string): Promise<boolean>;
|
|
22
29
|
/** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui/data/context-db.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;A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KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhG,oFAAoF;AACpF,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAe5F;AAED,6CAA6C;AAC7C,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvE;AAED;mFACmF;AACnF,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxE;AAED;;iDAEiD;AACjD,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUhF;AAED,gEAAgE;AAChE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ3D;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAkBrE;AAED,wEAAwE;AACxE,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAQtD"}
|
|
@@ -26,14 +26,13 @@ export interface SocketNotification {
|
|
|
26
26
|
interface NotificationSocketOptions {
|
|
27
27
|
/** Current active session id (re-read cheaply to follow session switches). */
|
|
28
28
|
getSessionId: () => string | null;
|
|
29
|
-
/** Handle one delivered notification. Returns true
|
|
30
|
-
*
|
|
29
|
+
/** Handle one delivered notification. Returns true only after it is fully
|
|
30
|
+
* consumed and can be acknowledged. Async because dialog handlers await. */
|
|
31
31
|
onNotification: (notification: SocketNotification) => boolean | Promise<boolean>;
|
|
32
32
|
}
|
|
33
|
-
/** Open the persistent notification socket.
|
|
34
|
-
* is a no-op. Reconnects on its own after any drop. */
|
|
33
|
+
/** Open the persistent notification socket. Reconnects on its own after a drop. */
|
|
35
34
|
export declare function startNotificationSocket(options: NotificationSocketOptions): void;
|
|
36
|
-
/** Close the socket and
|
|
35
|
+
/** Close the socket and release all state owned by this TUI initialization. */
|
|
37
36
|
export declare function stopNotificationSocket(): void;
|
|
38
37
|
export declare function _resetNotificationSocketStateForTesting(): void;
|
|
39
38
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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;AAED,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC
|
|
1
|
+
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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;AAED,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;iFAC6E;IAC7E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AA6CD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAOhF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CA+B7C;AAyUD,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
|
@@ -15,8 +15,15 @@ export declare function loadSidebarSnapshot(sessionId: string, directory: string
|
|
|
15
15
|
export declare function loadStatusDetail(sessionId: string, directory: string, modelKey?: string): Promise<StatusDetail>;
|
|
16
16
|
/** Fetch embedding coverage status for `/ctx-embed` via RPC. */
|
|
17
17
|
export declare function loadEmbedDetail(sessionId: string, directory: string): Promise<EmbedDetail>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
export type CompartmentCountResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
count: number;
|
|
21
|
+
} | {
|
|
22
|
+
ok: false;
|
|
23
|
+
error: string;
|
|
24
|
+
};
|
|
25
|
+
/** Get compartment count without making transport failure look like a real zero. */
|
|
26
|
+
export declare function getCompartmentCount(sessionId: string): Promise<CompartmentCountResult>;
|
|
20
27
|
/** Send recomp request to server via RPC. */
|
|
21
28
|
export declare function requestRecomp(sessionId: string): Promise<boolean>;
|
|
22
29
|
/** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/context-db.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAc3D,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAOrD;AAED,wBAAgB,gBAAgB,IA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AE,CAAC;AAEhG,oFAAoF;AACpF,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAe5F;AAED,6CAA6C;AAC7C,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvE;AAED;mFACmF;AACnF,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxE;AAED;;iDAEiD;AACjD,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUhF;AAED,gEAAgE;AAChE,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ3D;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAkBrE;AAED,wEAAwE;AACxE,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAQtD"}
|
|
@@ -26,14 +26,13 @@ export interface SocketNotification {
|
|
|
26
26
|
interface NotificationSocketOptions {
|
|
27
27
|
/** Current active session id (re-read cheaply to follow session switches). */
|
|
28
28
|
getSessionId: () => string | null;
|
|
29
|
-
/** Handle one delivered notification. Returns true
|
|
30
|
-
*
|
|
29
|
+
/** Handle one delivered notification. Returns true only after it is fully
|
|
30
|
+
* consumed and can be acknowledged. Async because dialog handlers await. */
|
|
31
31
|
onNotification: (notification: SocketNotification) => boolean | Promise<boolean>;
|
|
32
32
|
}
|
|
33
|
-
/** Open the persistent notification socket.
|
|
34
|
-
* is a no-op. Reconnects on its own after any drop. */
|
|
33
|
+
/** Open the persistent notification socket. Reconnects on its own after a drop. */
|
|
35
34
|
export declare function startNotificationSocket(options: NotificationSocketOptions): void;
|
|
36
|
-
/** Close the socket and
|
|
35
|
+
/** Close the socket and release all state owned by this TUI initialization. */
|
|
37
36
|
export declare function stopNotificationSocket(): void;
|
|
38
37
|
export declare function _resetNotificationSocketStateForTesting(): void;
|
|
39
38
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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;AAED,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC
|
|
1
|
+
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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;AAED,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;iFAC6E;IAC7E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AA6CD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAOhF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CA+B7C;AAyUD,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-magic-context",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"prepublishOnly": "bun run build && bun run build:tui"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@cortexkit/subc-client": "0.4.1",
|
|
46
47
|
"@huggingface/transformers": "^4.1.0",
|
|
47
48
|
"@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0",
|
|
48
49
|
"@opencode-ai/plugin": "^1.17.11",
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
clearModelsDevCache,
|
|
7
7
|
getModelsDevCacheState,
|
|
8
8
|
getSdkContextLimit,
|
|
9
|
+
getSdkInputLimit,
|
|
9
10
|
refreshModelLimitsAfterAuthOnce,
|
|
10
11
|
refreshModelLimitsFromApi,
|
|
11
12
|
resetAuthRewarmLatchForTest,
|
|
@@ -62,7 +63,9 @@ describe("models-dev-cache (SDK-only)", () => {
|
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
expect(getSdkContextLimit("github-copilot", "gpt-5.3-codex")).toBe(272000);
|
|
66
|
+
expect(getSdkInputLimit("github-copilot", "gpt-5.3-codex")).toBe(272000);
|
|
65
67
|
expect(getSdkContextLimit("github-copilot", "legacy-only-context")).toBe(100000);
|
|
68
|
+
expect(getSdkInputLimit("github-copilot", "legacy-only-context")).toBeUndefined();
|
|
66
69
|
expect(getSdkContextLimit("unknown", "unknown")).toBeUndefined();
|
|
67
70
|
});
|
|
68
71
|
|
|
@@ -78,6 +81,7 @@ describe("models-dev-cache (SDK-only)", () => {
|
|
|
78
81
|
]),
|
|
79
82
|
);
|
|
80
83
|
expect(getSdkContextLimit("openai", "gpt-5.5")).toBe(272000);
|
|
84
|
+
expect(getSdkInputLimit("openai", "gpt-5.5")).toBe(272000);
|
|
81
85
|
});
|
|
82
86
|
|
|
83
87
|
test("derived experimental.modes inherit the effective (input) limit", async () => {
|
|
@@ -172,6 +176,7 @@ describe("models-dev-cache (SDK-only)", () => {
|
|
|
172
176
|
makeClient([{ id: "openai", models: { "gpt-5.5": { limit: { input: 272000 } } } }]),
|
|
173
177
|
);
|
|
174
178
|
expect(getSdkContextLimit("openai", "gpt-5.5")).toBe(272000);
|
|
179
|
+
expect(getSdkInputLimit("openai", "gpt-5.5")).toBe(272000);
|
|
175
180
|
|
|
176
181
|
// Simulate a restart: in-memory cache gone, but the persisted file
|
|
177
182
|
// remains under XDG_DATA_HOME. The next lookup seeds from disk.
|
|
@@ -56,6 +56,8 @@ export function isSaneLimit(limit: number | undefined): limit is number {
|
|
|
56
56
|
|
|
57
57
|
interface CachedModelMetadata {
|
|
58
58
|
limit?: number;
|
|
59
|
+
/** Provider-enforced prompt cap. Undefined when only a combined context window is known. */
|
|
60
|
+
inputLimit?: number;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/**
|
|
@@ -90,10 +92,20 @@ function loadPersistedApiCacheOnce(): void {
|
|
|
90
92
|
persistSeedLoaded = true;
|
|
91
93
|
try {
|
|
92
94
|
const raw = readFileSync(persistFilePath(), "utf-8");
|
|
93
|
-
const obj = JSON.parse(raw) as Record<
|
|
95
|
+
const obj = JSON.parse(raw) as Record<
|
|
96
|
+
string,
|
|
97
|
+
number | { limit?: number; inputLimit?: number }
|
|
98
|
+
>;
|
|
94
99
|
const map = new Map<string, CachedModelMetadata>();
|
|
95
|
-
for (const [key,
|
|
96
|
-
|
|
100
|
+
for (const [key, persisted] of Object.entries(obj)) {
|
|
101
|
+
const limit = typeof persisted === "number" ? persisted : persisted.limit;
|
|
102
|
+
const inputLimit = typeof persisted === "number" ? undefined : persisted.inputLimit;
|
|
103
|
+
if (isSaneLimit(limit)) {
|
|
104
|
+
map.set(key, {
|
|
105
|
+
limit,
|
|
106
|
+
inputLimit: isSaneLimit(inputLimit) ? inputLimit : undefined,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
97
109
|
}
|
|
98
110
|
if (map.size > 0) {
|
|
99
111
|
apiCache = map;
|
|
@@ -112,9 +124,14 @@ function loadPersistedApiCacheOnce(): void {
|
|
|
112
124
|
* never sees a torn file (the exact failure mode we're eliminating). */
|
|
113
125
|
function persistApiCache(): void {
|
|
114
126
|
if (!apiCache) return;
|
|
115
|
-
const obj: Record<string,
|
|
127
|
+
const obj: Record<string, CachedModelMetadata> = {};
|
|
116
128
|
for (const [key, value] of apiCache) {
|
|
117
|
-
if (isSaneLimit(value.limit))
|
|
129
|
+
if (isSaneLimit(value.limit)) {
|
|
130
|
+
obj[key] = {
|
|
131
|
+
limit: value.limit,
|
|
132
|
+
inputLimit: isSaneLimit(value.inputLimit) ? value.inputLimit : undefined,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
118
135
|
}
|
|
119
136
|
try {
|
|
120
137
|
const dir = getMagicContextStorageDir();
|
|
@@ -157,6 +174,7 @@ function setCachedModelMetadata(
|
|
|
157
174
|
| undefined,
|
|
158
175
|
): void {
|
|
159
176
|
const limit = resolveLimit(model?.limit);
|
|
177
|
+
const inputLimit = model?.limit?.input;
|
|
160
178
|
|
|
161
179
|
// Only cache plausible limits. A value outside [20k, 3M] is garbage (torn
|
|
162
180
|
// read / unconfigured default) and must never enter the cache or get
|
|
@@ -165,7 +183,10 @@ function setCachedModelMetadata(
|
|
|
165
183
|
return;
|
|
166
184
|
}
|
|
167
185
|
|
|
168
|
-
const value: CachedModelMetadata = {
|
|
186
|
+
const value: CachedModelMetadata = {
|
|
187
|
+
limit,
|
|
188
|
+
inputLimit: isSaneLimit(inputLimit) ? inputLimit : undefined,
|
|
189
|
+
};
|
|
169
190
|
cache.set(key, value);
|
|
170
191
|
|
|
171
192
|
// OpenCode creates derived model IDs from experimental.modes
|
|
@@ -332,6 +353,23 @@ export function getSdkContextLimit(providerID: string, modelID: string): number
|
|
|
332
353
|
return isSaneLimit(fromApi) ? fromApi : undefined;
|
|
333
354
|
}
|
|
334
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Return only a provider-declared input cap. A combined context window is useful
|
|
358
|
+
* for scheduling but is not safe as a fail-closed prompt boundary.
|
|
359
|
+
*/
|
|
360
|
+
export function getSdkInputLimit(providerID: string, modelID: string): number | undefined {
|
|
361
|
+
loadPersistedApiCacheOnce();
|
|
362
|
+
if (!apiCache) return undefined;
|
|
363
|
+
const direct = apiCache.get(`${providerID}/${modelID}`)?.inputLimit;
|
|
364
|
+
if (isSaneLimit(direct)) return direct;
|
|
365
|
+
const colon = modelID.indexOf(":");
|
|
366
|
+
if (colon > 0) {
|
|
367
|
+
const tagless = apiCache.get(`${providerID}/${modelID.slice(0, colon)}`)?.inputLimit;
|
|
368
|
+
if (isSaneLimit(tagless)) return tagless;
|
|
369
|
+
}
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
|
|
335
373
|
/**
|
|
336
374
|
* Look up a model's limit in the cache, with an ollama-style tag-suffix
|
|
337
375
|
* fallback. ollama invokes cloud models with a tag at runtime
|
|
@@ -6,24 +6,33 @@ import * as configDir from "./opencode-config-dir";
|
|
|
6
6
|
|
|
7
7
|
describe("opencode-compaction-detector", () => {
|
|
8
8
|
let tmpDir: string;
|
|
9
|
+
let previousDisableAutocompact: string | undefined;
|
|
10
|
+
let restoreConfigPaths: () => void;
|
|
9
11
|
|
|
10
12
|
beforeEach(() => {
|
|
11
13
|
tmpDir = join("/tmp", `compaction-detector-test-${Date.now()}`);
|
|
12
14
|
mkdirSync(join(tmpDir, ".opencode"), { recursive: true });
|
|
15
|
+
previousDisableAutocompact = process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
13
16
|
delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
14
|
-
spyOn(configDir, "getOpenCodeConfigPaths").mockReturnValue({
|
|
17
|
+
const configPathsSpy = spyOn(configDir, "getOpenCodeConfigPaths").mockReturnValue({
|
|
15
18
|
configJson: join(tmpDir, "user-config", "opencode.json"),
|
|
16
19
|
configJsonc: join(tmpDir, "user-config", "opencode.jsonc"),
|
|
17
20
|
} as ReturnType<typeof configDir.getOpenCodeConfigPaths>);
|
|
21
|
+
restoreConfigPaths = () => configPathsSpy.mockRestore();
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
afterEach(() => {
|
|
25
|
+
restoreConfigPaths();
|
|
21
26
|
try {
|
|
22
27
|
rmSync(tmpDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
23
28
|
} catch {
|
|
24
29
|
/* Ignore EBUSY on Windows */
|
|
25
30
|
}
|
|
26
|
-
|
|
31
|
+
if (previousDisableAutocompact === undefined) {
|
|
32
|
+
delete process.env.OPENCODE_DISABLE_AUTOCOMPACT;
|
|
33
|
+
} else {
|
|
34
|
+
process.env.OPENCODE_DISABLE_AUTOCOMPACT = previousDisableAutocompact;
|
|
35
|
+
}
|
|
27
36
|
});
|
|
28
37
|
|
|
29
38
|
describe("#given no config exists", () => {
|