@retaw106/mmc-oc 2.5.0 → 2.7.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/dist/{context-xx09sh1g.js → context-9q17e52a.js} +553 -214
- package/dist/features/magic-context/auto-search-diagnostics.d.ts +27 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/compaction-marker.d.ts +34 -6
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +1 -24
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +4 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -1
- package/dist/features/magic-context/session-retention.fixture.d.ts +4 -0
- package/dist/features/magic-context/session-retention.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +21 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-native-replay.d.ts +2 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +4 -11
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +113 -58
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics.d.ts +5 -3
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +32 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/ask-answer-notice.d.ts +25 -0
- package/dist/hooks/magic-context/ask-answer-notice.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
- package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +5 -5
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts +14 -0
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +11 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +11 -3
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-history-wait.d.ts +16 -0
- package/dist/hooks/magic-context/historian-history-wait.d.ts.map +1 -0
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +2 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +8 -2
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +20 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts +42 -0
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/todo-view.d.ts +2 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-bpjjcdy9.js → index-8rmt6s4f.js} +77 -31
- package/dist/{index-mjf0p7yq.js → index-cgjyhwdk.js} +1 -1
- package/dist/{index-k25thxq7.js → index-s3ebcy63.js} +1 -1
- package/dist/{index-1vxffj5j.js → index-t0zx3tgz.js} +408 -89
- package/dist/{index-0d40b4q8.js → index-xrxpbe74.js} +9355 -9215
- package/dist/index.js +14 -4
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{read-session-chunk-eb3fy45y.js → read-session-chunk-2s8x6xps.js} +2 -2
- package/dist/{recomp-orchestrator-mmpy5cb7.js → recomp-orchestrator-gzd1at06.js} +5 -5
- package/dist/{send-session-notification-zpqs213d.js → send-session-notification-vdppp5x6.js} +2 -2
- package/dist/shared/search-text.d.ts +2 -0
- package/dist/shared/search-text.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +2 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +3 -1
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/tools/ctx-expand/render.d.ts +5 -3
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +2 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +10 -10
- package/dist/tools/parameter-descriptions.d.ts.map +1 -1
- package/dist/tui.js +2144 -0
- package/dist/v2/hooks/context.d.ts +5 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/message-times.d.ts +17 -0
- package/dist/v2/message-times.d.ts.map +1 -0
- package/dist/v2/server.js +11211 -10345
- package/dist/v2/store-reader.d.ts +14 -4
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tui/client.d.ts +57 -0
- package/dist/v2/tui/client.d.ts.map +1 -0
- package/dist/v2/tui/context-rpc.d.ts +63 -0
- package/dist/v2/tui/context-rpc.d.ts.map +1 -0
- package/dist/v2/tui/entry.d.ts +8 -0
- package/dist/v2/tui/entry.d.ts.map +1 -0
- package/dist/v2/tui/notification-socket.d.ts +26 -0
- package/dist/v2/tui/notification-socket.d.ts.map +1 -0
- package/dist/v2/tui/session-directory.d.ts +22 -0
- package/dist/v2/tui/session-directory.d.ts.map +1 -0
- package/dist/v2/tui/types.d.ts +110 -0
- package/dist/v2/tui/types.d.ts.map +1 -0
- package/dist/web/main.js +85 -11
- package/dist/{wrapup-orchestrator-jq589pgr.js → wrapup-orchestrator-ghq4y406.js} +5 -5
- package/package.json +13 -3
- package/src/config/latch-permanence-guard.test.ts +0 -5
- package/src/shared/prompt-surface-a1-golden.md +8 -9
- package/src/shared/search-text.test.ts +36 -1
- package/src/shared/search-text.ts +48 -0
- package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
- package/src/shared/tag-transcript.ts +47 -4
- package/src/shared/transcript.ts +1 -1
- package/src/shared/write-transaction-attribution.test.ts +1 -6
- package/tui.js +4 -0
- package/dist/features/magic-context/message-index-sweep.d.ts +0 -11
- package/dist/features/magic-context/message-index-sweep.d.ts.map +0 -1
|
@@ -148,7 +148,14 @@ export declare class V2StoreReaderPool {
|
|
|
148
148
|
closeWhenIdle(timeoutMs: number): Promise<boolean>;
|
|
149
149
|
private finishClose;
|
|
150
150
|
}
|
|
151
|
-
export declare function messageTimesQuery(count: number): string;
|
|
151
|
+
export declare function messageTimesQuery(count: number, withVersions?: boolean): string;
|
|
152
|
+
export interface V2MessageTimeVersion {
|
|
153
|
+
id: string;
|
|
154
|
+
type: string;
|
|
155
|
+
seq: number;
|
|
156
|
+
created: number | null;
|
|
157
|
+
updated: number | null;
|
|
158
|
+
}
|
|
152
159
|
/** Opens an existing store read-only; missing/corrupt stores propagate errors, never an empty history. */
|
|
153
160
|
export declare class V2StoreReader {
|
|
154
161
|
private readonly path;
|
|
@@ -199,8 +206,6 @@ export declare class V2StoreReader {
|
|
|
199
206
|
latestMessageTime(sessionID: string): number | undefined;
|
|
200
207
|
/** Parent links are recorded by the host before a child's first context pass. */
|
|
201
208
|
isSubagent(sessionID: string): boolean | null;
|
|
202
|
-
/** Authoritative liveness snapshot for background orphan cleanup. */
|
|
203
|
-
sessionIds(): string[];
|
|
204
209
|
/** Count session_message rows after a sequence. This counts stored rows, not
|
|
205
210
|
* model messages: it includes idle rows (OpenCode's marker that a run finished)
|
|
206
211
|
* and compaction rows (checkpoints), and one stored assistant row can render as
|
|
@@ -209,7 +214,12 @@ export declare class V2StoreReader {
|
|
|
209
214
|
storedRowsAfter(sessionID: string, after: number): number;
|
|
210
215
|
storedMessageCount(sessionID: string): number;
|
|
211
216
|
messageById(sessionID: string, id: string): StoreRow | null;
|
|
212
|
-
|
|
217
|
+
/** Check membership and row revisions without loading or parsing message data. */
|
|
218
|
+
messageTimeVersions(sessionID: string, ids: readonly string[], span?: {
|
|
219
|
+
first: number;
|
|
220
|
+
last: number;
|
|
221
|
+
}): Map<string, V2MessageTimeVersion>;
|
|
222
|
+
messageTimes(sessionID: string, ids: readonly string[], versions?: Map<string, V2MessageTimeVersion>): Map<string, {
|
|
213
223
|
created?: number;
|
|
214
224
|
completed?: number;
|
|
215
225
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-reader.d.ts","sourceRoot":"","sources":["../../src/v2/store-reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAMvF,OAAO,EAAE,QAAQ,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M,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE;IAOrE,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM;IAavE,OAAO,CAAC,kBAAkB;IAc1B,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS;IAMvE,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS;IAM9E,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE;IAO3D,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOvD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAOzC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,EAAE;IAU5E,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,SAAS;IAUrE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS;IAU3D,8EAA8E;IAC9E,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAWrC;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ,EAAE;IAItC,OAAO,CAAC,GAAG;CAcd"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { StatusDetail } from "../../shared/rpc-types";
|
|
2
|
+
import { type CommandRpcResult, type StatusDetailResult } from "./context-rpc";
|
|
3
|
+
import { type SocketNotification } from "./notification-socket";
|
|
4
|
+
import type { V2KeymapLayer, V2TuiContext } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Plain-text projection of the status snapshot for the host's native text
|
|
7
|
+
* dialog. This tier mounts no component dialog, so this is the only arm the
|
|
8
|
+
* `/mmc-status` dialog ever draws.
|
|
9
|
+
*
|
|
10
|
+
* Exported for test access.
|
|
11
|
+
*/
|
|
12
|
+
export declare function statusText(detail: Pick<StatusDetail, "contextLimit" | "usagePercentage" | "inputTokens" | "compaction_enabled" | "historianRunning" | "compartmentCount" | "memoryBlockCount" | "memoryCount" | "pendingOpsCount" | "configGeneration" | "configAdoptedAt" | "configReloadFailure" | "lastTransformError">): string;
|
|
13
|
+
/**
|
|
14
|
+
* Plain-text status for one checked result: the status lines above, or the
|
|
15
|
+
* "status unavailable" view as text when there is no usable snapshot. A
|
|
16
|
+
* server/UI version difference is named first in both cases.
|
|
17
|
+
*
|
|
18
|
+
* Exported for test access.
|
|
19
|
+
*/
|
|
20
|
+
export declare function statusTextFor(status: StatusDetailResult): string;
|
|
21
|
+
/** The command runner `buildKeymapLayer` hands each slash command. */
|
|
22
|
+
export type CommandRunner = (title: string, call: (sessionID: string) => Promise<CommandRpcResult>, pending?: string) => Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Every /mmc-* command this host can reach from the palette goes through this
|
|
25
|
+
* runner: OpenCode 2 has no `command.execute.before` hook, so the server-side
|
|
26
|
+
* command handler the OpenCode 1 plugin uses never runs here. Each call
|
|
27
|
+
* invokes the RPC handler that does the same server-side work and reports
|
|
28
|
+
* back through a dialog or toast, because this host has no ignored-message
|
|
29
|
+
* chat carrier.
|
|
30
|
+
*
|
|
31
|
+
* Exported (with the context injected) so the branches are unit-testable
|
|
32
|
+
* without a live socket.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createCommandRunner(context: V2TuiContext): CommandRunner;
|
|
35
|
+
/**
|
|
36
|
+
* The five fork slash commands, built with the context and dialog hooks
|
|
37
|
+
* injected so the command set is unit-testable without a live socket.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildKeymapLayer(context: V2TuiContext, hooks: {
|
|
40
|
+
showStatus: (target?: string | null) => Promise<boolean>;
|
|
41
|
+
showRecomp: (target?: string | null) => Promise<boolean>;
|
|
42
|
+
runCommand: CommandRunner;
|
|
43
|
+
}): V2KeymapLayer;
|
|
44
|
+
/**
|
|
45
|
+
* The four server→TUI notification branches this tier consumes. Everything the
|
|
46
|
+
* sidebar tier handled (refresh-sidebar and any unknown action) returns false,
|
|
47
|
+
* which leaves the notification unacknowledged instead of falsely consumed.
|
|
48
|
+
*
|
|
49
|
+
* Exported (with the dialog hooks injected) so the routing is unit-testable
|
|
50
|
+
* without a live socket.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createNotificationHandler(context: V2TuiContext, hooks: {
|
|
53
|
+
showStatus: (target?: string | null) => Promise<boolean>;
|
|
54
|
+
showRecomp: (target?: string | null) => Promise<boolean>;
|
|
55
|
+
}): (notification: SocketNotification) => Promise<boolean>;
|
|
56
|
+
export declare function setup(context: V2TuiContext): Promise<() => void>;
|
|
57
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EACH,KAAK,gBAAgB,EAQrB,KAAK,kBAAkB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,kBAAkB,EAG1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQ3D;;;;;;GAMG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,IAAI,CACR,YAAY,EACV,cAAc,GACd,iBAAiB,GACjB,aAAa,GACb,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,CACzB,GACF,MAAM,CA6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{ type OpenCodeStatusExtras, type StatusCheck } from "../../shared/status-view-check";
|
|
3
|
+
/** Initialize the RPC client. Call once on TUI startup. */
|
|
4
|
+
export declare function initRpcClient(directory: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* The server the notification socket should subscribe to: the one that owns
|
|
7
|
+
* the shown session's directory, so a push from the command that session runs
|
|
8
|
+
* (for example `/mmc-status` asking to open its dialog) reaches this TUI. That
|
|
9
|
+
* is the startup directory's server when no session is shown or the session is
|
|
10
|
+
* in the startup directory. A session directory with no discovery file falls
|
|
11
|
+
* back to the startup server so session-less notifications still arrive
|
|
12
|
+
* (upstream additionally asks every local server which one owns the session;
|
|
13
|
+
* this fork's rpc-client has no session-owner discovery, so that arm is not
|
|
14
|
+
* ported).
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveNotificationTarget(sessionDirectory: string | null): Promise<{
|
|
17
|
+
client: MagicContextRpcClient;
|
|
18
|
+
directory: string;
|
|
19
|
+
endpoint: {
|
|
20
|
+
port: number;
|
|
21
|
+
token: string | null;
|
|
22
|
+
instanceId: string | null;
|
|
23
|
+
};
|
|
24
|
+
} | null>;
|
|
25
|
+
/** The directory whose server a notification subscription for `sessionDirectory` targets first. */
|
|
26
|
+
export declare function notificationDirectoryFor(sessionDirectory: string | null): string;
|
|
27
|
+
export declare function getRpcGeneration(): number;
|
|
28
|
+
/** Clean up the RPC client. */
|
|
29
|
+
export declare function closeRpc(): void;
|
|
30
|
+
export type StatusDetailResult = StatusCheck<OpenCodeStatusExtras>;
|
|
31
|
+
/**
|
|
32
|
+
* Fetch the status for the `/mmc-status` dialog. Every reply, including a
|
|
33
|
+
* transport failure, comes back as a checked result: either a snapshot the
|
|
34
|
+
* view model can draw, or the reason there is none. The dialog never receives
|
|
35
|
+
* an unchecked payload.
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadStatusDetail(sessionId: string, directory: string, modelKey?: string): Promise<StatusDetailResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Send recomp request to server via RPC. `directory` is the session's
|
|
40
|
+
* directory, so the request reaches the server instance that owns the session.
|
|
41
|
+
*/
|
|
42
|
+
export declare function requestRecomp(sessionId: string, directory?: string): Promise<boolean>;
|
|
43
|
+
/** What a command RPC reports back: finished text, an acknowledgement that
|
|
44
|
+
* background work started (no text yet), or the failure. */
|
|
45
|
+
export type CommandRpcResult = {
|
|
46
|
+
ok: true;
|
|
47
|
+
message?: string;
|
|
48
|
+
started?: boolean;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
error?: string;
|
|
52
|
+
};
|
|
53
|
+
/** Run `/mmc-flush` for the session: apply the queued operations now. */
|
|
54
|
+
export declare function requestFlush(sessionId: string): Promise<CommandRpcResult>;
|
|
55
|
+
/** Start `/mmc-wrapup`: compact the older live tail, keeping the newest N raw. */
|
|
56
|
+
export declare function requestWrapup(sessionId: string, messagesToKeep: number): Promise<CommandRpcResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Start one memory-maintenance pass for the session (fork-specific endpoint:
|
|
59
|
+
* the server command's default `status` subcommand is reachable through its
|
|
60
|
+
* own reply, so the TUI command always asks for a run).
|
|
61
|
+
*/
|
|
62
|
+
export declare function requestMaintenance(sessionId: string): Promise<CommandRpcResult>;
|
|
63
|
+
//# sourceMappingURL=context-rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-rpc.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/context-rpc.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAEH,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAEnB,MAAM,gCAAgC,CAAC;AAsBxC,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CASrD;AA6BD;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,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AgB,CAAC,CAE3B;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAErF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/entry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,iBAAe,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAG/D;;;;;AAGD,wBAA2C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface SocketNotification {
|
|
2
|
+
id: number;
|
|
3
|
+
type: string;
|
|
4
|
+
payload: Record<string, unknown>;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
}
|
|
7
|
+
interface NotificationSocketOptions {
|
|
8
|
+
/** Current active session id (re-read cheaply to follow session switches). */
|
|
9
|
+
getSessionId: () => string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Directory of the active session, when the host reports it. The socket
|
|
12
|
+
* subscribes to that directory's server, because that is the server whose
|
|
13
|
+
* commands push this session's notifications; null means the startup one.
|
|
14
|
+
*/
|
|
15
|
+
getSessionDirectory?: () => string | null;
|
|
16
|
+
/** Handle one delivered notification. Returns true only after it is fully
|
|
17
|
+
* consumed and can be acknowledged. Async because dialog handlers await. */
|
|
18
|
+
onNotification: (notification: SocketNotification) => boolean | Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/** Open the persistent notification socket. Reconnects on its own after a drop. */
|
|
21
|
+
export declare function startNotificationSocket(options: NotificationSocketOptions): void;
|
|
22
|
+
/** Close the socket and release all state owned by this TUI initialization. */
|
|
23
|
+
export declare function stopNotificationSocket(): void;
|
|
24
|
+
export declare function _resetNotificationSocketStateForTesting(): void;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=notification-socket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/notification-socket.ts"],"names":[],"mappings":"AAiDA,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;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC1C;iFAC6E;IAC7E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AAoDD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAOhF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CAiC7C;AA2UD,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { V2TuiContext } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* The directory whose Magic Context server owns a session.
|
|
4
|
+
*
|
|
5
|
+
* OpenCode starts one Magic Context server instance per directory. The TUI
|
|
6
|
+
* starts in one directory but can show a session from another one (non-git
|
|
7
|
+
* directories share OpenCode's global project, so a TUI started in the home
|
|
8
|
+
* directory lists sessions from any of them). The status dialog must ask the
|
|
9
|
+
* server for the session's directory, not the startup one.
|
|
10
|
+
*
|
|
11
|
+
* `sessionDirectory` is what the host reports for the session
|
|
12
|
+
* (`context.data.session.get(id).location.directory` on OpenCode 2). The
|
|
13
|
+
* startup directory is the fallback while the host has not loaded the session.
|
|
14
|
+
*/
|
|
15
|
+
export declare function directoryForSession(sessionDirectory: unknown, startupDirectory: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* The directory of the Magic Context server that owns `sessionID` on this host,
|
|
18
|
+
* or undefined while the host has not loaded the session (the caller then uses
|
|
19
|
+
* its startup directory). See `directoryForSession`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sessionDirectory(context: V2TuiContext, sessionID: string): string | undefined;
|
|
22
|
+
//# sourceMappingURL=session-directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-directory.d.ts","sourceRoot":"","sources":["../../../src/v2/tui/session-directory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAI/F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM7F"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export interface V2TuiLocation {
|
|
2
|
+
readonly directory: string;
|
|
3
|
+
}
|
|
4
|
+
export interface V2TuiRoute {
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly sessionID?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface V2TuiContext {
|
|
9
|
+
readonly location?: V2TuiLocation;
|
|
10
|
+
readonly data: {
|
|
11
|
+
readonly location: {
|
|
12
|
+
default(): V2TuiLocation;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* `Context.data.session` on GA 2.0.x. `location.directory` is the
|
|
16
|
+
* directory whose Magic Context server owns the session. Optional so a
|
|
17
|
+
* host without it falls back to the startup directory.
|
|
18
|
+
*/
|
|
19
|
+
readonly session?: {
|
|
20
|
+
get(sessionID: string): {
|
|
21
|
+
readonly location?: {
|
|
22
|
+
readonly directory?: string;
|
|
23
|
+
};
|
|
24
|
+
} | undefined;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly renderer: {
|
|
28
|
+
requestRender(): void;
|
|
29
|
+
};
|
|
30
|
+
readonly keymap: {
|
|
31
|
+
/** `Context.keymap.layer` on GA 2.0.22. See `V2KeymapLayer`. */
|
|
32
|
+
readonly layer: (input: () => V2KeymapLayer) => void;
|
|
33
|
+
};
|
|
34
|
+
readonly ui: {
|
|
35
|
+
readonly router: {
|
|
36
|
+
current(): V2TuiRoute;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* `Context.ui.slot` on GA 2.0.22: claims a place in the host's slot
|
|
40
|
+
* tree and returns the unregister function. See `V2SlotClaim`.
|
|
41
|
+
*/
|
|
42
|
+
readonly slot: (claim: V2SlotClaim) => () => void;
|
|
43
|
+
readonly toast: {
|
|
44
|
+
show(options: {
|
|
45
|
+
readonly title?: string;
|
|
46
|
+
readonly message: string;
|
|
47
|
+
readonly variant?: "info" | "success" | "warning" | "error";
|
|
48
|
+
readonly duration?: number;
|
|
49
|
+
}): void;
|
|
50
|
+
};
|
|
51
|
+
readonly dialog: {
|
|
52
|
+
alert(options: {
|
|
53
|
+
readonly title: string;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
confirm(options: {
|
|
57
|
+
readonly title: string;
|
|
58
|
+
readonly message: string;
|
|
59
|
+
readonly label?: {
|
|
60
|
+
readonly confirm?: string;
|
|
61
|
+
readonly cancel?: string;
|
|
62
|
+
};
|
|
63
|
+
}): Promise<boolean | undefined>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* One keymap command, aligned with `@opencode/plugin` 2.0.22's
|
|
69
|
+
* `dist/tui/context.d.ts` `KeymapCommand` (the fields this layer writes).
|
|
70
|
+
* Differences from that declaration, kept as a structural subset so the
|
|
71
|
+
* plugin depends on no @opentui/* types: 2.0.22 makes `id`/`title`/`group`
|
|
72
|
+
* optional (inline commands omit them) and adds `description`/`enabled`/
|
|
73
|
+
* `bind`/`suggested`; its `run` also receives the dispatching `KeyEvent` as a
|
|
74
|
+
* second argument and may return `false` to continue dispatch. This layer
|
|
75
|
+
* always names its commands and reads only the slash input, so the narrower
|
|
76
|
+
* `run` shape stays assignable to the host's.
|
|
77
|
+
*/
|
|
78
|
+
export interface V2KeymapCommand {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly title: string;
|
|
81
|
+
readonly group: string;
|
|
82
|
+
readonly palette: true;
|
|
83
|
+
readonly slash: {
|
|
84
|
+
readonly name: string;
|
|
85
|
+
readonly arguments?: true;
|
|
86
|
+
};
|
|
87
|
+
readonly run: (input?: string) => void | Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The layer object `context.keymap.layer()` accepts, aligned with 2.0.22's
|
|
91
|
+
* `KeymapLayer` (whose `mode`/`commands` are optional and which also carries
|
|
92
|
+
* `enabled`/`target`/`priority`/`bindings`). This layer always pins
|
|
93
|
+
* `mode: "global"` and lists its commands.
|
|
94
|
+
*/
|
|
95
|
+
export interface V2KeymapLayer {
|
|
96
|
+
readonly mode: string;
|
|
97
|
+
readonly commands: readonly V2KeymapCommand[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The one slot claim this face uses, a subset of 2.0.22's `SlotClaim`
|
|
101
|
+
* (`SlotMap["app"]` input is `Readonly<Record<string, never>>`; 2.0.22's claim
|
|
102
|
+
* type is a mutually-exclusive placement union whose `render` returns a
|
|
103
|
+
* Solid `JSX.Element` — this layer's app-slot render returns `null`, which
|
|
104
|
+
* the host accepts at runtime).
|
|
105
|
+
*/
|
|
106
|
+
export interface V2SlotClaim {
|
|
107
|
+
readonly append: "app";
|
|
108
|
+
readonly render: (input: Readonly<Record<string, never>>) => unknown;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@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;CAC1D;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;CACjD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,KAAK,OAAO,CAAC;CACxE"}
|
package/dist/web/main.js
CHANGED
|
@@ -1359,12 +1359,58 @@ var init_read_session_formatting = __esm(() => {
|
|
|
1359
1359
|
promptTokenCounts = new Map;
|
|
1360
1360
|
PROMPT_TOKEN_COUNT_BYTES = 8 * 1024 * 1024;
|
|
1361
1361
|
});
|
|
1362
|
+
|
|
1363
|
+
// src/shared/bounded-session-map.ts
|
|
1364
|
+
class BoundedSessionMap {
|
|
1365
|
+
maxEntries;
|
|
1366
|
+
store = new Map;
|
|
1367
|
+
constructor(maxEntries) {
|
|
1368
|
+
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
1369
|
+
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
1370
|
+
}
|
|
1371
|
+
this.maxEntries = maxEntries;
|
|
1372
|
+
}
|
|
1373
|
+
get(sessionId) {
|
|
1374
|
+
const value = this.store.get(sessionId);
|
|
1375
|
+
if (value === undefined)
|
|
1376
|
+
return;
|
|
1377
|
+
this.store.delete(sessionId);
|
|
1378
|
+
this.store.set(sessionId, value);
|
|
1379
|
+
return value;
|
|
1380
|
+
}
|
|
1381
|
+
peek(sessionId) {
|
|
1382
|
+
return this.store.get(sessionId);
|
|
1383
|
+
}
|
|
1384
|
+
has(sessionId) {
|
|
1385
|
+
return this.store.has(sessionId);
|
|
1386
|
+
}
|
|
1387
|
+
set(sessionId, value) {
|
|
1388
|
+
if (this.store.has(sessionId)) {
|
|
1389
|
+
this.store.delete(sessionId);
|
|
1390
|
+
} else if (this.store.size >= this.maxEntries) {
|
|
1391
|
+
const oldest = this.store.keys().next().value;
|
|
1392
|
+
if (oldest !== undefined)
|
|
1393
|
+
this.store.delete(oldest);
|
|
1394
|
+
}
|
|
1395
|
+
this.store.set(sessionId, value);
|
|
1396
|
+
}
|
|
1397
|
+
delete(sessionId) {
|
|
1398
|
+
return this.store.delete(sessionId);
|
|
1399
|
+
}
|
|
1400
|
+
clear() {
|
|
1401
|
+
this.store.clear();
|
|
1402
|
+
}
|
|
1403
|
+
get size() {
|
|
1404
|
+
return this.store.size;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1362
1407
|
// src/features/magic-context/tool-definition-tokens.ts
|
|
1363
|
-
var
|
|
1408
|
+
var ACTIVITY_WINDOW_MS, routes, sessionFlights;
|
|
1364
1409
|
var init_tool_definition_tokens = __esm(() => {
|
|
1365
1410
|
init_read_session_formatting();
|
|
1366
|
-
|
|
1367
|
-
|
|
1411
|
+
ACTIVITY_WINDOW_MS = 10 * 60000;
|
|
1412
|
+
routes = new Map;
|
|
1413
|
+
sessionFlights = new BoundedSessionMap(1000);
|
|
1368
1414
|
});
|
|
1369
1415
|
|
|
1370
1416
|
// src/shared/opencode-db-path.ts
|
|
@@ -4345,9 +4391,10 @@ function closeConnection(connection) {
|
|
|
4345
4391
|
counters.readersClosed += 1;
|
|
4346
4392
|
}
|
|
4347
4393
|
}
|
|
4348
|
-
function messageTimesQuery(count) {
|
|
4394
|
+
function messageTimesQuery(count, withVersions = false) {
|
|
4349
4395
|
return `SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
|
|
4350
4396
|
json_extract(data, '$.time.completed') AS completed
|
|
4397
|
+
${withVersions ? ", type, seq, time_created AS version_created, time_updated AS version_updated" : ""}
|
|
4351
4398
|
FROM session_message WHERE +session_id = ? AND id IN (${Array.from({ length: count }, () => "?").join(",")})`;
|
|
4352
4399
|
}
|
|
4353
4400
|
|
|
@@ -4467,9 +4514,6 @@ class V2StoreReader {
|
|
|
4467
4514
|
return null;
|
|
4468
4515
|
return typeof row.parent_id === "string" && row.parent_id.length > 0;
|
|
4469
4516
|
}
|
|
4470
|
-
sessionIds() {
|
|
4471
|
-
return this.prepare("SELECT id FROM session_v2").all().map((row) => row.id);
|
|
4472
|
-
}
|
|
4473
4517
|
storedRowsAfter(sessionID, after) {
|
|
4474
4518
|
const row = this.prepare("SELECT COUNT(*) AS count FROM session_message WHERE session_id = ? AND seq > ?").get(sessionID, after);
|
|
4475
4519
|
return row.count;
|
|
@@ -4488,16 +4532,46 @@ class V2StoreReader {
|
|
|
4488
4532
|
return row ? decode(row) : null;
|
|
4489
4533
|
});
|
|
4490
4534
|
}
|
|
4491
|
-
|
|
4492
|
-
const
|
|
4535
|
+
messageTimeVersions(sessionID, ids, span) {
|
|
4536
|
+
const versions = new Map;
|
|
4537
|
+
if (ids.length > 0 && span && span.last - span.first < ids.length * 2) {
|
|
4538
|
+
const wanted = new Set(ids);
|
|
4539
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
4540
|
+
FROM session_message WHERE session_id = ? AND seq >= ? AND seq <= ?`).all(sessionID, span.first, span.last);
|
|
4541
|
+
for (const row of rows)
|
|
4542
|
+
if (wanted.has(row.id))
|
|
4543
|
+
versions.set(row.id, row);
|
|
4544
|
+
for (const [id, version] of this.messageTimeVersions(sessionID, ids.filter((id) => !versions.has(id))))
|
|
4545
|
+
versions.set(id, version);
|
|
4546
|
+
return versions;
|
|
4547
|
+
}
|
|
4493
4548
|
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
4494
4549
|
const batch = ids.slice(offset, offset + 500);
|
|
4495
|
-
const rows = this.prepare(
|
|
4550
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
4551
|
+
FROM session_message WHERE +session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
|
|
4496
4552
|
for (const row of rows)
|
|
4553
|
+
versions.set(row.id, row);
|
|
4554
|
+
}
|
|
4555
|
+
return versions;
|
|
4556
|
+
}
|
|
4557
|
+
messageTimes(sessionID, ids, versions) {
|
|
4558
|
+
const times = new Map;
|
|
4559
|
+
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
4560
|
+
const batch = ids.slice(offset, offset + 500);
|
|
4561
|
+
const rows = this.prepare(messageTimesQuery(batch.length, versions !== undefined)).all(sessionID, ...batch);
|
|
4562
|
+
for (const row of rows) {
|
|
4497
4563
|
times.set(row.id, {
|
|
4498
4564
|
created: typeof row.created === "number" ? row.created : undefined,
|
|
4499
4565
|
completed: typeof row.completed === "number" ? row.completed : undefined
|
|
4500
4566
|
});
|
|
4567
|
+
versions?.set(row.id, {
|
|
4568
|
+
id: row.id,
|
|
4569
|
+
type: row.type,
|
|
4570
|
+
seq: row.seq,
|
|
4571
|
+
created: row.version_created,
|
|
4572
|
+
updated: row.version_updated
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4501
4575
|
}
|
|
4502
4576
|
return times;
|
|
4503
4577
|
}
|
|
@@ -5643,7 +5717,7 @@ function projectRawMessages(rows, ordinalFor) {
|
|
|
5643
5717
|
const message = {
|
|
5644
5718
|
id: row.id,
|
|
5645
5719
|
ordinal: ordinalFor(row, index),
|
|
5646
|
-
role: row.type === "assistant" ? "assistant" : "user",
|
|
5720
|
+
role: row.type === "assistant" ? "assistant" : row.type === "system" ? "system" : "user",
|
|
5647
5721
|
createdAt: row.time_created ?? row.data.time?.created,
|
|
5648
5722
|
parts: row.type === "assistant" ? (row.data.content ?? []).map((part) => {
|
|
5649
5723
|
if (part.type !== "tool")
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
getActiveCompartmentRun,
|
|
22
22
|
markActiveCompartmentRunPublished,
|
|
23
23
|
registerActiveCompartmentRun
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-xrxpbe74.js";
|
|
25
25
|
import"./index-pte3cfs9.js";
|
|
26
26
|
import"./index-x37vg474.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
import"./index-t0zx3tgz.js";
|
|
28
|
+
import"./index-8rmt6s4f.js";
|
|
29
29
|
import {
|
|
30
30
|
pushNotification2
|
|
31
31
|
} from "./index-jdxxq8cz.js";
|
|
@@ -33,11 +33,11 @@ import"./index-5ty9rnbx.js";
|
|
|
33
33
|
import"./index-kmbme1v1.js";
|
|
34
34
|
import {
|
|
35
35
|
sendStatusNotification2
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-s3ebcy63.js";
|
|
37
37
|
import {
|
|
38
38
|
setRecompStarting2,
|
|
39
39
|
setRecompTerminal2
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-cgjyhwdk.js";
|
|
41
41
|
import"./index-yjv8dpht.js";
|
|
42
42
|
|
|
43
43
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retaw106/mmc-oc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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",
|
|
@@ -31,14 +31,16 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
33
|
"index.js",
|
|
34
|
+
"tui.js",
|
|
34
35
|
"src/shared",
|
|
35
36
|
"src/config",
|
|
36
37
|
"src/agents",
|
|
37
38
|
"README.md"
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|
|
40
|
-
"build": "bun ../../scripts/check-bun.mjs && bun ../../scripts/clean-dist-chunks.mjs dist index.js config-init.js cli.js && rm -rf dist/web && bun build src/index.ts --outdir dist --target node --format esm --splitting --external @opencode-ai/plugin --external bun:sqlite --external node:sqlite && bun run build:v2 && bun run build:web && bun run build:config-init && bun run build:cli && tsc --emitDeclarationOnly",
|
|
41
|
+
"build": "bun ../../scripts/check-bun.mjs && bun ../../scripts/clean-dist-chunks.mjs dist index.js config-init.js cli.js && rm -rf dist/web && bun build src/index.ts --outdir dist --target node --format esm --splitting --external @opencode-ai/plugin --external bun:sqlite --external node:sqlite && bun run build:v2 && bun run build:tui && bun run build:web && bun run build:config-init && bun run build:cli && tsc --emitDeclarationOnly",
|
|
41
42
|
"build:v2": "bun build src/v2/server.ts --outfile dist/v2/server.js --target node --format esm --external @opencode/plugin && bun test src/v2/server.test.ts",
|
|
43
|
+
"build:tui": "bun build src/v2/tui/entry.ts --outfile dist/tui.js --target node --format esm",
|
|
42
44
|
"build:web": "bun build src/web/main.ts --outfile dist/web/main.js --target node --format esm --external bun:sqlite --external node:sqlite && mkdir -p dist/web/ui && cp src/web/ui/* dist/web/ui/",
|
|
43
45
|
"build:config-init": "bun build scripts/config-init-entry.ts --outfile dist/config-init.js --target node --format esm",
|
|
44
46
|
"build:cli": "bun build scripts/cli.ts --outfile dist/cli.js --target node --format esm",
|
|
@@ -80,10 +82,18 @@
|
|
|
80
82
|
".": {
|
|
81
83
|
"types": "./dist/index.d.ts",
|
|
82
84
|
"import": "./dist/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./tui": {
|
|
87
|
+
"import": "./tui.js"
|
|
83
88
|
}
|
|
84
89
|
},
|
|
85
90
|
"oc-plugin": [
|
|
86
|
-
"server"
|
|
91
|
+
"server",
|
|
92
|
+
"tui"
|
|
93
|
+
],
|
|
94
|
+
"opencode": [
|
|
95
|
+
"server",
|
|
96
|
+
"tui"
|
|
87
97
|
],
|
|
88
98
|
"peerDependencies": {
|
|
89
99
|
"@opencode-ai/plugin": ">=1.15.0"
|
|
@@ -62,11 +62,6 @@ const KNOWN_SLOTS: Record<string, KnownSlot> = {
|
|
|
62
62
|
classification: "VERDICT",
|
|
63
63
|
reason: "Saved: getActiveCooldown deletes an expired entry and forces a new git probe after five minutes.",
|
|
64
64
|
},
|
|
65
|
-
"packages/plugin/src/features/magic-context/message-index.ts:MESSAGE_HISTORY_ORPHAN_UNAVAILABLE_REPROBE_MS":
|
|
66
|
-
{
|
|
67
|
-
classification: "VERDICT",
|
|
68
|
-
reason: "Saved: source_unavailable persists a future timestamp, then the normal cooldown arithmetic re-probes after one day.",
|
|
69
|
-
},
|
|
70
65
|
"packages/plugin/src/features/magic-context/storage-meta-session.ts:sessionMetaSelectColumnsCache":
|
|
71
66
|
{
|
|
72
67
|
classification: "VERDICT",
|