@remnic/core 9.3.691 → 9.3.693
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/access-boundary.d.ts +6 -5
- package/dist/access-boundary.js +12 -12
- package/dist/access-cli.js +71 -18
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +5 -4
- package/dist/access-http.js +16 -16
- package/dist/access-mcp.d.ts +7 -4
- package/dist/access-mcp.js +15 -15
- package/dist/access-operations.d.ts +12 -6
- package/dist/access-operations.js +16 -14
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-CKnFdxH-.d.ts → access-service-DxCpgyVW.d.ts} +96 -2
- package/dist/access-service.d.ts +5 -4
- package/dist/access-service.js +11 -11
- package/dist/access-surface-catalog.d.ts +5 -4
- package/dist/access-surface-catalog.js +2 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/bootstrap.d.ts +4 -3
- package/dist/{chunk-QNG35H27.js → chunk-4IQNAOP3.js} +5 -141
- package/dist/chunk-4IQNAOP3.js.map +1 -0
- package/dist/{chunk-VH2DHBHG.js → chunk-5HGPDRQZ.js} +2 -2
- package/dist/chunk-5HGPDRQZ.js.map +1 -0
- package/dist/chunk-6C2BMUZA.js +444 -0
- package/dist/chunk-6C2BMUZA.js.map +1 -0
- package/dist/{chunk-UUMYB3FR.js → chunk-6ZNIUGXB.js} +10 -10
- package/dist/{chunk-IPJD7WJH.js → chunk-E6BOD3UJ.js} +2 -2
- package/dist/{chunk-TJ5IIQIR.js → chunk-F7BVJ3IE.js} +40 -369
- package/dist/chunk-F7BVJ3IE.js.map +1 -0
- package/dist/{chunk-D3DNGQNQ.js → chunk-FM7KLRKN.js} +2 -2
- package/dist/{chunk-7MOTEVAA.js → chunk-HRUULBBV.js} +3 -1
- package/dist/chunk-HRUULBBV.js.map +1 -0
- package/dist/chunk-HXNMDPHN.js +149 -0
- package/dist/chunk-HXNMDPHN.js.map +1 -0
- package/dist/{chunk-7UVDIWLL.js → chunk-JNKH2XWQ.js} +36 -6
- package/dist/chunk-JNKH2XWQ.js.map +1 -0
- package/dist/{chunk-IPLYGWQF.js → chunk-KQAFEZQX.js} +5 -5
- package/dist/{chunk-OOO7ZKOD.js → chunk-KYH53EFD.js} +3 -3
- package/dist/{chunk-LQ6JI4VH.js → chunk-LD53WPMU.js} +4 -4
- package/dist/{chunk-KO6OL4I7.js → chunk-MQTPUPLP.js} +297 -17
- package/dist/chunk-MQTPUPLP.js.map +1 -0
- package/dist/{chunk-TSGREOYY.js → chunk-RHWFMBO5.js} +33 -6
- package/dist/chunk-RHWFMBO5.js.map +1 -0
- package/dist/{chunk-5CEJH5ZN.js → chunk-TAPSNIMA.js} +4 -4
- package/dist/{chunk-K7I24ZO2.js → chunk-THKNO6OX.js} +22 -21
- package/dist/{chunk-K7I24ZO2.js.map → chunk-THKNO6OX.js.map} +1 -1
- package/dist/{chunk-QLRYXOAD.js → chunk-UDJLF3BO.js} +2 -2
- package/dist/{chunk-NCRDCTEJ.js → chunk-WYB44HHV.js} +21 -7
- package/dist/chunk-WYB44HHV.js.map +1 -0
- package/dist/{chunk-WRFKZEO6.js → chunk-YQGHW5ML.js} +4 -4
- package/dist/{cli-CrSW_KRq.d.ts → cli-DoQsv4ut.d.ts} +2 -2
- package/dist/cli.d.ts +6 -5
- package/dist/cli.js +26 -25
- package/dist/contradiction/index.js +4 -4
- package/dist/explicit-capture.d.ts +4 -3
- package/dist/index.d.ts +6 -5
- package/dist/index.js +33 -31
- package/dist/index.js.map +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +5 -4
- package/dist/namespaces/migrate.js +8 -8
- package/dist/namespaces/search.js +7 -7
- package/dist/operator-toolkit.js +11 -10
- package/dist/orchestration/maintenance.d.ts +112 -0
- package/dist/orchestration/maintenance.js +39 -0
- package/dist/orchestration/maintenance.js.map +1 -0
- package/dist/{orchestrator-DvswGK76.d.ts → orchestrator-CNJCYjZ1.d.ts} +9 -33
- package/dist/orchestrator.d.ts +2 -1
- package/dist/orchestrator.js +13 -11
- package/dist/schemas.d.ts +28 -28
- package/dist/search/factory.js +6 -6
- package/dist/search/index.js +11 -11
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/orama-backend.js +2 -2
- package/dist/transfer/autodetect.js +1 -1
- package/dist/transfer/backup.js +1 -1
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/types.d.ts +12 -12
- package/package.json +12 -2
- package/src/access-boundary.ts +2 -1
- package/src/access-cli.ts +65 -2
- package/src/access-http.ts +20 -0
- package/src/access-mcp.ts +29 -0
- package/src/access-operations.ts +46 -0
- package/src/access-service.ts +55 -0
- package/src/access-surface-catalog.test.ts +1 -1
- package/src/access-surface-catalog.ts +2 -0
- package/src/cli.ts +1 -0
- package/src/coding/coding-namespace.ts +1 -1
- package/src/coding/session-delta-surfaces.test.ts +383 -0
- package/src/coding/session-delta-surfaces.ts +325 -0
- package/src/coding/session-delta.test.ts +411 -0
- package/src/coding/session-delta.ts +442 -0
- package/src/orchestration/maintenance.test.ts +738 -0
- package/src/orchestration/maintenance.ts +557 -0
- package/src/orchestrator-flush.test.ts +0 -599
- package/src/orchestrator.ts +33 -419
- package/dist/chunk-7MOTEVAA.js.map +0 -1
- package/dist/chunk-7UVDIWLL.js.map +0 -1
- package/dist/chunk-KO6OL4I7.js.map +0 -1
- package/dist/chunk-NCRDCTEJ.js.map +0 -1
- package/dist/chunk-QNG35H27.js.map +0 -1
- package/dist/chunk-TJ5IIQIR.js.map +0 -1
- package/dist/chunk-TSGREOYY.js.map +0 -1
- package/dist/chunk-VH2DHBHG.js.map +0 -1
- /package/dist/{chunk-UUMYB3FR.js.map → chunk-6ZNIUGXB.js.map} +0 -0
- /package/dist/{chunk-IPJD7WJH.js.map → chunk-E6BOD3UJ.js.map} +0 -0
- /package/dist/{chunk-D3DNGQNQ.js.map → chunk-FM7KLRKN.js.map} +0 -0
- /package/dist/{chunk-IPLYGWQF.js.map → chunk-KQAFEZQX.js.map} +0 -0
- /package/dist/{chunk-OOO7ZKOD.js.map → chunk-KYH53EFD.js.map} +0 -0
- /package/dist/{chunk-LQ6JI4VH.js.map → chunk-LD53WPMU.js.map} +0 -0
- /package/dist/{chunk-5CEJH5ZN.js.map → chunk-TAPSNIMA.js.map} +0 -0
- /package/dist/{chunk-QLRYXOAD.js.map → chunk-UDJLF3BO.js.map} +0 -0
- /package/dist/{chunk-WRFKZEO6.js.map → chunk-YQGHW5ML.js.map} +0 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-delta surface contract + handler (issue #1548 Track A PR 4).
|
|
3
|
+
*
|
|
4
|
+
* The single shared implementation behind the MCP, HTTP, and CLI
|
|
5
|
+
* session-delta surfaces. All three transports dispatch through the
|
|
6
|
+
* `coding_delta` boundary operation, which calls {@link handleCodingDelta}
|
|
7
|
+
* via the service delegate.
|
|
8
|
+
*
|
|
9
|
+
* Gate (rule 39): `codingKnowledge.enabled + sessionDelta + coding
|
|
10
|
+
* context` — one predicate, identical on every surface. The tools/list
|
|
11
|
+
* visibility gate checks conditions 1–2 only (config-level).
|
|
12
|
+
*
|
|
13
|
+
* Persistence (rule 25): the new last-seen-head marker is written AFTER
|
|
14
|
+
* the delta is computed from the old one. State writes use temp-file-then-
|
|
15
|
+
* rename (rule 54) via the pure module's `writeLastSeenState`.
|
|
16
|
+
*
|
|
17
|
+
* Subcommand: `get` — computes the delta against the persisted last-seen
|
|
18
|
+
* head and updates the marker in the same call (so the NEXT session sees
|
|
19
|
+
* this one as the baseline). Read-only semantically, but it mutates the
|
|
20
|
+
* state file: it is therefore NOT counted against the write-quota (the
|
|
21
|
+
* state file is operator-side bookkeeping, not user memory content — the
|
|
22
|
+
* same way `calibration.ts` writes are uncounted).
|
|
23
|
+
*/
|
|
24
|
+
import type {
|
|
25
|
+
CodingKnowledgeConfig,
|
|
26
|
+
CodingContext,
|
|
27
|
+
} from "../types.js";
|
|
28
|
+
import {
|
|
29
|
+
computeSessionDelta,
|
|
30
|
+
readLastSeenState,
|
|
31
|
+
writeLastSeenState,
|
|
32
|
+
resolveSlice,
|
|
33
|
+
sessionDeltaStatePath,
|
|
34
|
+
type GitLogSlice,
|
|
35
|
+
type LastSeenState,
|
|
36
|
+
type ResolveSliceResult,
|
|
37
|
+
type SessionDeltaGitInvoker,
|
|
38
|
+
type SessionDeltaResult,
|
|
39
|
+
} from "./session-delta.js";
|
|
40
|
+
import { log } from "../logger.js";
|
|
41
|
+
|
|
42
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
43
|
+
// Subcommands
|
|
44
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
export const DELTA_SUBCOMMANDS = ["get"] as const;
|
|
47
|
+
|
|
48
|
+
export type DeltaSubcommand = (typeof DELTA_SUBCOMMANDS)[number];
|
|
49
|
+
|
|
50
|
+
const SUBCOMMAND_VALUES = DELTA_SUBCOMMANDS as readonly string[];
|
|
51
|
+
|
|
52
|
+
/** Type guard — narrows an unknown subcommand string. */
|
|
53
|
+
export function isDeltaSubcommand(value: unknown): value is DeltaSubcommand {
|
|
54
|
+
return typeof value === "string" && SUBCOMMAND_VALUES.includes(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Human-readable subcommand list for error messages (rule 51). */
|
|
58
|
+
export function formatDeltaSubcommands(): string {
|
|
59
|
+
return DELTA_SUBCOMMANDS.join(", ");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
63
|
+
// Gate predicates — rule 39: one predicate, identical on every surface
|
|
64
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The single session-delta surface gate. Returns `true` only when:
|
|
68
|
+
* 1. `codingKnowledge.enabled` is true,
|
|
69
|
+
* 2. `codingKnowledge.sessionDelta` is true,
|
|
70
|
+
* 3. a coding context is attached (so a repo root is available).
|
|
71
|
+
*/
|
|
72
|
+
export function isSessionDeltaSurfaceEnabled(
|
|
73
|
+
config: CodingKnowledgeConfig,
|
|
74
|
+
codingContext: CodingContext | null | undefined,
|
|
75
|
+
): boolean {
|
|
76
|
+
return (
|
|
77
|
+
config.enabled === true &&
|
|
78
|
+
config.sessionDelta === true &&
|
|
79
|
+
codingContext !== null &&
|
|
80
|
+
codingContext !== undefined
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Config-only visibility gate — used by the MCP constructor to decide
|
|
86
|
+
* whether to advertise `engram.coding_delta` in `tools/list`. When this
|
|
87
|
+
* returns `false` the tools array is byte-identical to pre-feature (rule 39).
|
|
88
|
+
*/
|
|
89
|
+
export function isSessionDeltaSurfaceVisible(
|
|
90
|
+
config: CodingKnowledgeConfig,
|
|
91
|
+
): boolean {
|
|
92
|
+
return config.enabled === true && config.sessionDelta === true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
96
|
+
// Surface request / response shapes
|
|
97
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
/** Canonical surface request — one shape for all three transports. */
|
|
100
|
+
export interface DeltaSurfaceRequest {
|
|
101
|
+
subcommand: DeltaSubcommand;
|
|
102
|
+
sessionKey?: string;
|
|
103
|
+
namespace?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Surface response. Mirrors {@link SessionDeltaResult} but flattened for
|
|
108
|
+
* transport: every outcome carries `nextState` so callers can observe the
|
|
109
|
+
* new marker even on failure (the head still advanced).
|
|
110
|
+
*/
|
|
111
|
+
export type DeltaSurfaceResponse =
|
|
112
|
+
| {
|
|
113
|
+
subcommand: "get";
|
|
114
|
+
ok: true;
|
|
115
|
+
/** A real delta was computed. */
|
|
116
|
+
kind: "changed";
|
|
117
|
+
delta: {
|
|
118
|
+
commits: ReadonlyArray<{ sha: string; subject: string }>;
|
|
119
|
+
touchedFiles: readonly string[];
|
|
120
|
+
summaryLine: string;
|
|
121
|
+
};
|
|
122
|
+
nextState: LastSeenState;
|
|
123
|
+
}
|
|
124
|
+
| {
|
|
125
|
+
subcommand: "get";
|
|
126
|
+
ok: true;
|
|
127
|
+
/** Prior head equals current — no changes. */
|
|
128
|
+
kind: "unchanged";
|
|
129
|
+
nextState: LastSeenState;
|
|
130
|
+
}
|
|
131
|
+
| {
|
|
132
|
+
subcommand: "get";
|
|
133
|
+
ok: true;
|
|
134
|
+
/** No prior state — first session for this namespace. */
|
|
135
|
+
kind: "first_run";
|
|
136
|
+
nextState: LastSeenState;
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
subcommand: "get";
|
|
140
|
+
/**
|
|
141
|
+
* Delta unavailable. `code` is one of `unreachable_head` (force-push/
|
|
142
|
+
* rebase erased the prior head) or `git_failed` (invoker error). The
|
|
143
|
+
* state file is still advanced when `nextState` is present.
|
|
144
|
+
*/
|
|
145
|
+
ok: false;
|
|
146
|
+
code: "unreachable_head" | "git_failed";
|
|
147
|
+
detail: string;
|
|
148
|
+
nextState?: LastSeenState;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
152
|
+
// Storage contract — narrow; the handler needs the memoryDir + namespace only
|
|
153
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The resolved namespace context the handler needs. The service produces
|
|
157
|
+
* this through the SAME coding-scoped read path as the other coding surfaces.
|
|
158
|
+
*/
|
|
159
|
+
export interface DeltaSurfaceStorage {
|
|
160
|
+
/** The orchestrator's memoryDir — base for the state file path. */
|
|
161
|
+
readonly memoryDir: string;
|
|
162
|
+
/** The resolved coding-scoped namespace — basis for the state filename. */
|
|
163
|
+
readonly namespace: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Dependencies the handler borrows from the service. The service constructs
|
|
168
|
+
* this context per call; the handler never touches the orchestrator directly.
|
|
169
|
+
*/
|
|
170
|
+
export interface DeltaSurfaceContext {
|
|
171
|
+
readonly codingKnowledge: CodingKnowledgeConfig;
|
|
172
|
+
getCodingContext(sessionKey: string): CodingContext | null;
|
|
173
|
+
/** Resolve storage (memoryDir + namespace) via the coding-scoped read path. */
|
|
174
|
+
resolveStorage(request: DeltaSurfaceRequest): Promise<DeltaSurfaceStorage>;
|
|
175
|
+
/** Git invoker — drives `rev-parse` + `log`. Defaults to a real invoker. */
|
|
176
|
+
gitInvoker: SessionDeltaGitInvoker;
|
|
177
|
+
/** Throw the surface-appropriate input-validation error. */
|
|
178
|
+
throwInputError(message: string): never;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
182
|
+
// Handler — the single shared implementation behind all three surfaces
|
|
183
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The single shared implementation behind the MCP, HTTP, and CLI
|
|
187
|
+
* session-delta surfaces.
|
|
188
|
+
*
|
|
189
|
+
* Order of operations (rule 25 — do not destroy the old marker before the
|
|
190
|
+
* new state is useful):
|
|
191
|
+
* 1. Read the persisted last-seen-head.
|
|
192
|
+
* 2. Resolve the current repo slice via the git invoker.
|
|
193
|
+
* 3. Compute the delta from the OLD state + current slice.
|
|
194
|
+
* 4. Persist the NEW state (temp-file-then-rename).
|
|
195
|
+
* 5. Return the result.
|
|
196
|
+
*/
|
|
197
|
+
export async function handleCodingDelta(
|
|
198
|
+
request: DeltaSurfaceRequest,
|
|
199
|
+
ctx: DeltaSurfaceContext,
|
|
200
|
+
): Promise<DeltaSurfaceResponse> {
|
|
201
|
+
const codingContext = request.sessionKey
|
|
202
|
+
? ctx.getCodingContext(request.sessionKey)
|
|
203
|
+
: null;
|
|
204
|
+
if (
|
|
205
|
+
codingContext === null ||
|
|
206
|
+
!isSessionDeltaSurfaceEnabled(ctx.codingKnowledge, codingContext)
|
|
207
|
+
) {
|
|
208
|
+
ctx.throwInputError(
|
|
209
|
+
"coding_delta requires codingKnowledge.enabled, codingKnowledge.sessionDelta, and an attached coding context",
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
// `get` is the only subcommand today; the switch keeps the shape forward-
|
|
213
|
+
// compatible if `refresh`/`reset` land later.
|
|
214
|
+
switch (request.subcommand) {
|
|
215
|
+
case "get":
|
|
216
|
+
return deltaGet(request, ctx, codingContext);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
221
|
+
// Subcommand handler
|
|
222
|
+
// ──────────────────────────────────────────────────────────────────────────
|
|
223
|
+
|
|
224
|
+
async function deltaGet(
|
|
225
|
+
request: DeltaSurfaceRequest,
|
|
226
|
+
ctx: DeltaSurfaceContext,
|
|
227
|
+
codingContext: CodingContext,
|
|
228
|
+
): Promise<DeltaSurfaceResponse> {
|
|
229
|
+
const storage = await ctx.resolveStorage(request);
|
|
230
|
+
const statePath = sessionDeltaStatePath(storage.memoryDir, storage.namespace);
|
|
231
|
+
|
|
232
|
+
// 1. Read prior state. Absent/empty/malformed → null → first_run.
|
|
233
|
+
const lastSeen = await readLastSeenState(statePath);
|
|
234
|
+
|
|
235
|
+
// 2. Resolve the current repo slice. `rootPath` is the repo root the
|
|
236
|
+
// coding context was resolved from; it MUST exist for a delta to make
|
|
237
|
+
// sense. Fall back to `projectId` only as a path hint — refresh is the
|
|
238
|
+
// caller's responsibility (the gate already required a context).
|
|
239
|
+
const repoRoot = codingContext.rootPath ?? codingContext.projectId;
|
|
240
|
+
const sliceResult: ResolveSliceResult = resolveSlice(
|
|
241
|
+
repoRoot,
|
|
242
|
+
lastSeen?.head ?? null,
|
|
243
|
+
ctx.gitInvoker,
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
// 3. Git failure → tagged failure, but advance the state file when we
|
|
247
|
+
// could at least read the current head (so the next call has a chance).
|
|
248
|
+
if (!sliceResult.ok) {
|
|
249
|
+
log.warn(
|
|
250
|
+
`coding_delta/get: slice resolution failed (code=${sliceResult.code}): ${sliceResult.detail}`,
|
|
251
|
+
);
|
|
252
|
+
// Best-effort: still try to advance the state file if the head was readable.
|
|
253
|
+
// On `no_head` we cannot write anything sensible — leave the prior marker.
|
|
254
|
+
return {
|
|
255
|
+
subcommand: "get",
|
|
256
|
+
ok: false,
|
|
257
|
+
code: "git_failed",
|
|
258
|
+
detail: sliceResult.detail,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// 4. Compute the delta from the OLD state + the slice.
|
|
263
|
+
const result: SessionDeltaResult = computeSessionDelta(lastSeen, sliceResult.slice);
|
|
264
|
+
|
|
265
|
+
// 5. Persist the new state (rule 25 + rule 54). Failures here are logged
|
|
266
|
+
// but do NOT fail the operation — the delta was computed; the next
|
|
267
|
+
// session may re-derive it. A write failure surfaces in doctor/xray.
|
|
268
|
+
let nextState: LastSeenState | null = null;
|
|
269
|
+
if (result.ok) {
|
|
270
|
+
nextState = result.nextState;
|
|
271
|
+
} else if (result.code === "unreachable_head") {
|
|
272
|
+
nextState = result.nextState;
|
|
273
|
+
}
|
|
274
|
+
if (nextState) {
|
|
275
|
+
try {
|
|
276
|
+
await writeLastSeenState(statePath, nextState);
|
|
277
|
+
} catch (err) {
|
|
278
|
+
log.warn(
|
|
279
|
+
`coding_delta/get: state write failed for ${statePath}: ${err instanceof Error ? err.message : String(err)}`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// 6. Map to the surface response shape.
|
|
285
|
+
if (!result.ok) {
|
|
286
|
+
if (result.code === "unreachable_head") {
|
|
287
|
+
return {
|
|
288
|
+
subcommand: "get",
|
|
289
|
+
ok: false,
|
|
290
|
+
code: result.code,
|
|
291
|
+
detail: result.detail,
|
|
292
|
+
nextState: result.nextState,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
subcommand: "get",
|
|
297
|
+
ok: false,
|
|
298
|
+
code: result.code,
|
|
299
|
+
detail: result.detail,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
switch (result.kind) {
|
|
303
|
+
case "first_run":
|
|
304
|
+
return { subcommand: "get", ok: true, kind: "first_run", nextState: result.nextState };
|
|
305
|
+
case "unchanged":
|
|
306
|
+
return { subcommand: "get", ok: true, kind: "unchanged", nextState: result.nextState };
|
|
307
|
+
case "changed":
|
|
308
|
+
return {
|
|
309
|
+
subcommand: "get",
|
|
310
|
+
ok: true,
|
|
311
|
+
kind: "changed",
|
|
312
|
+
delta: {
|
|
313
|
+
commits: result.delta.commits,
|
|
314
|
+
touchedFiles: result.delta.touchedFiles,
|
|
315
|
+
summaryLine: result.delta.summaryLine,
|
|
316
|
+
},
|
|
317
|
+
nextState: result.nextState,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Exported for the surface's storage-adapter glue so the service delegate
|
|
323
|
+
// can build the narrow {@link DeltaSurfaceStorage} without re-importing the
|
|
324
|
+
// path helper from the pure module.
|
|
325
|
+
export { sessionDeltaStatePath, type GitLogSlice };
|