@melite/estate-drafts 0.0.0-stage → 0.1.4-alpha

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/lib/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import type { Context, Plugin } from "@deepseek-ai/cordis";
2
+ export { BenchRemoteService, DraftsRemoteService, installBenchChangeSeam } from "./remote.js";
3
+ export { resolveStorageRoot, openDraftsDomain, } from "./store.js";
4
+ export { DRAFT_ID_RE, draftIdOk } from "./spec.js";
5
+ export type { BenchChangeSeam } from "./bench.js";
6
+ export { setBenchChangeSeam } from "./bench.js";
7
+ export type { BenchEnsureRow, BenchGetRow, DraftListResult, DraftListRow, } from "./remote.js";
8
+ export declare const name = "estate-drafts";
9
+ export declare function apply(ctx: Context): void;
10
+ declare const plugin: Plugin;
11
+ export default plugin;
12
+ //# sourceMappingURL=index.d.ts.map
package/lib/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { BenchRemoteService, DraftsRemoteService } from "./remote.js";
2
+ export { BenchRemoteService, DraftsRemoteService, installBenchChangeSeam } from "./remote.js";
3
+ export { resolveStorageRoot, openDraftsDomain, } from "./store.js";
4
+ export { DRAFT_ID_RE, draftIdOk } from "./spec.js";
5
+ export { setBenchChangeSeam } from "./bench.js";
6
+ export const name = "estate-drafts";
7
+ export function apply(ctx) {
8
+ new DraftsRemoteService(ctx);
9
+ new BenchRemoteService(ctx);
10
+ }
11
+ const plugin = { name, apply };
12
+ export default plugin;
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,306 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
3
+ import { STAGE_PATCH_KEYS, type StagePatchKey } from "@melite/contracts/benchStage";
4
+ export { STAGE_PATCH_KEYS, type StagePatchKey };
5
+ import type { BenchEnsureRow, BenchGetRow, BenchPatchRow, BenchReorderRow, BenchRewireRow, BenchClearRow, BenchStageRow, BenchUndoRow } from "./bench.js";
6
+ export type { BenchEnsureRow, BenchGetRow, BenchPatchRow, BenchReorderRow, BenchRewireRow, BenchStageRow, BenchUndoRow, } from "./bench.js";
7
+ /** Endpoint `drafts/patch` answer — the old door's delivered envelope:
8
+ * a missing doc/stage is delivered:false + reason (a DOMAIN outcome,
9
+ * never an error); a landing patch reports the patched key set and
10
+ * the bench revision it landed at (the CAS law's re-read handle). */
11
+ export interface DraftPatchRow {
12
+ draftId: string;
13
+ stageId: string;
14
+ delivered: boolean;
15
+ reason?: string;
16
+ patched?: string[];
17
+ rev?: number;
18
+ }
19
+ /** draft_id_ok: 1..96 chars of [A-Za-z0-9_-] (the composer mint). */
20
+ /** One listed draft — the index row (recency-ordered by the caller). */
21
+ export interface DraftListRow {
22
+ readonly draft_id: string;
23
+ readonly model: string;
24
+ readonly name: string;
25
+ }
26
+ /** The list result: rows capped at 600, count total pre-cap. */
27
+ export interface DraftListResult {
28
+ readonly count: number;
29
+ readonly drafts: readonly DraftListRow[];
30
+ }
31
+ /** JSON at the wire — the constrained face of every open doc. The
32
+ * Typert generator's boundary law refuses unconstrained `unknown`
33
+ * data in @Remote signatures (assertRemoteJsonType: "Remote
34
+ * boundary contains unconstrained unknown data"); open card
35
+ * payloads (stage params, results, history) are honestly JSON all
36
+ * the way down, so the wire face says exactly that. */
37
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
38
+ readonly [key: string]: JsonValue;
39
+ };
40
+ /** Endpoint `drafts/get` answer — the stored draft doc (open,
41
+ * card-authored) with its stages resolved for the wire. */
42
+ export type DraftGetRow = {
43
+ readonly [key: string]: JsonValue;
44
+ };
45
+ /** Endpoint `drafts/patch` body — the door's FIXED key set (unknown
46
+ * keys refuse at admission with the old door's voice; STAGE_PATCH_KEYS).
47
+ * Optional: presence IS the write; a null params value is the
48
+ * merge-patch DELETE (the layered-params law); a null health value
49
+ * is the same DELETE (the recovery clear, LOW-23). */
50
+ export type DraftStagePatch = {
51
+ params?: JsonValue;
52
+ result?: JsonValue;
53
+ runStatus?: JsonValue;
54
+ health?: JsonValue;
55
+ inputs?: JsonValue;
56
+ inputOutputs?: JsonValue;
57
+ };
58
+ /** The bench verbs' wire body — an open JSON doc (each verb's
59
+ * admission law constrains its own keys at the door: stage,
60
+ * expect_rev, index, binding, …). */
61
+ export type BenchDoc = {
62
+ readonly [key: string]: JsonValue;
63
+ };
64
+ /** The drafts' Remote failure codes, merged into the protocol's one
65
+ * vocabulary (cookbook §2: declaration merging, next to the throw). */
66
+ declare module "@deepseek-ai/dsh-typert-protocol" {
67
+ interface RemoteErrorDetailsMap {
68
+ /** The id fails the [A-Za-z0-9_-]{1,96} draft law. */
69
+ "draft/bad-id": {
70
+ readonly draftId: string;
71
+ };
72
+ /** No stored draft carries that id. */
73
+ "draft/not-found": {
74
+ readonly draftId: string;
75
+ };
76
+ /** The storage open refused an otherwise valid call. */
77
+ "draft/store-failed": Record<string, never>;
78
+ /** The stage id is empty/non-string (the patch door). */
79
+ "draft/bad-stage-id": {
80
+ readonly stageId: string;
81
+ };
82
+ /** The patch body is not a plain object (the patch door). */
83
+ "draft/bad-patch": Record<string, never>;
84
+ /** Keys outside the door's fixed set (the old voice names them). */
85
+ "draft/patch-unknown-keys": {
86
+ readonly unknown: readonly string[];
87
+ };
88
+ /** The domain write refused (put failed at the medium). */
89
+ "draft/cannot-persist": Record<string, never>;
90
+ }
91
+ }
92
+ declare module "@deepseek-ai/cordis" {
93
+ interface Context {
94
+ draftsRemote: DraftsRemoteService;
95
+ benchRemote: BenchRemoteService;
96
+ }
97
+ interface Events {
98
+ /**
99
+ * A bench write landed. Emitted after every successful bench verb
100
+ * (and after the drafts-patch door's bench-shaped write).
101
+ * @param session - the bench session whose doc changed.
102
+ */
103
+ "bench.changed": (session: string) => void;
104
+ }
105
+ }
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ export declare function installBenchChangeSeam(ctx: Context): () => void;
125
+ /** ── THE OUTPUT HISTORY HELPERS (stroke 40) ──────────────────────
126
+ * A result's OUTPUT urls, one spelling: the artifacts name→url map
127
+ * first, the flat assetUrls list second, the lone url third (the
128
+ * same harvest order the client's preview reads — the history and
129
+ * the hero can never disagree about what a run produced). */
130
+ export declare function resultOutputUrls(result: unknown): string[];
131
+ /** Same OUTPUTS (the uniqueness key): two results match when their
132
+ * url sets are equal — a re-run landing the same urls is not a new
133
+ * history entry (the operator's "when it is unique"). */
134
+ export declare function sameResultOutputs(a: unknown, b: unknown): boolean;
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+ export declare function admissionOf(ctx: Context): ((card: string, params: Record<string, unknown>, provenance: unknown) => void) | undefined;
157
+
158
+
159
+
160
+
161
+
162
+ export declare const RESTORED_PROVENANCE: unique symbol;
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ export declare const RESTORED_WIRE_SPELLING = "restored";
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ export declare function laneAdmissionOf(ctx: Context): ((card: string, params: Record<string, unknown>, provenance: unknown) => void) | undefined;
189
+
190
+
191
+
192
+
193
+
194
+ export declare function benchAdmissionOf(ctx: Context): ((card: string, params: Record<string, unknown>, provenance: unknown) => void) | undefined;
195
+ /** The drafts Remote owner: list/get over the storage domain. */
196
+ export declare class DraftsRemoteService extends TypertRemoteService {
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ private benchAdmit;
211
+ constructor(ctx: Context);
212
+ /** Endpoint `drafts/list` — the domain index, recency DESC. */
213
+ remoteExportList(signal: AbortSignal): Promise<DraftListResult>;
214
+ /** Endpoint `drafts/get` — one doc by id. */
215
+ remoteExportGet(draftId: string, signal: AbortSignal): Promise<DraftGetRow>;
216
+ /** The in-process API the adapters above delegate to. */
217
+ list(signal: AbortSignal): Promise<DraftListResult>;
218
+ /** The in-process API the adapter above delegates to. */
219
+ get(draftId: string, signal: AbortSignal): Promise<Record<string, unknown>>;
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+ remoteExportPatch(draftId: string, stageId: string, patch: DraftStagePatch, expectRev: number | null, signal: AbortSignal): Promise<DraftPatchRow>;
243
+ /** The patch arm the adapter above delegates to. */
244
+ patch(draftId: string, stageId: string, patch: Record<string, unknown>, expectRev: number | null, signal: AbortSignal): Promise<DraftPatchRow>;
245
+ }
246
+ /** The bench Remote owner: ensure/get over the same drafts domain
247
+ * (the bench doc IS a draft doc, id "bench-<session>"). */
248
+ export declare class BenchRemoteService extends TypertRemoteService {
249
+ constructor(ctx: Context);
250
+ /** Endpoint `bench/get` — one session's bench block as the row. */
251
+ remoteExportGet(sessionKey: string, signal: AbortSignal): Promise<BenchGetRow>;
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ subscribe(sessionKey: string, signal: AbortSignal): AsyncIterable<BenchGetRow>;
263
+ /** Endpoint `bench/ensure` — birth or load (the only creating arm). */
264
+ remoteExportEnsure(doc: BenchDoc, signal: AbortSignal): Promise<BenchEnsureRow>;
265
+ /** The in-process API the adapters above delegate to. Classified
266
+ * bench failures pass through untouched; only the open itself
267
+ * wraps as bench/store-failed. */
268
+ get(session: string, signal: AbortSignal): Promise<BenchGetRow>;
269
+ /** The in-process API the adapter above delegates to. */
270
+ ensure(doc: BenchDoc, signal: AbortSignal): Promise<BenchEnsureRow>;
271
+ /** Endpoint `bench/patch` — params merge (+result/runStatus) with
272
+ * CAS + log. */
273
+ remoteExportPatch(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchPatchRow>;
274
+ /** Endpoint `bench/add-stage` — append a card stage. */
275
+ remoteExportAddStage(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
276
+ /** Endpoint `bench/remove-stage` — splice one stage out. */
277
+ remoteExportRemoveStage(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
278
+
279
+
280
+
281
+
282
+ remoteExportClear(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchClearRow>;
283
+ /** Endpoint `bench/rewire` — set or clear one input binding. */
284
+ remoteExportRewire(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchRewireRow>;
285
+
286
+
287
+ remoteExportReorder(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchReorderRow>;
288
+
289
+
290
+ remoteExportGroup(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
291
+ /** Endpoint `bench/ungroup` — spill a compound's children back. */
292
+ remoteExportUngroup(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
293
+ /** Endpoint `bench/undo` — walk the log tail, apply inverses. */
294
+ remoteExportUndo(sessionKey: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchUndoRow>;
295
+ /** The in-process APIs the adapters above delegate to. The
296
+ * domain's classified failures pass through untouched; only the
297
+ * open itself wraps as bench/store-failed. */
298
+ private open;
299
+ patch(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchPatchRow>;
300
+ addStage(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
301
+ removeStage(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchStageRow>;
302
+ clear(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchClearRow>;
303
+ rewire(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchRewireRow>;
304
+ undo(session: string, doc: BenchDoc, signal: AbortSignal): Promise<BenchUndoRow>;
305
+ }
306
+ //# sourceMappingURL=remote.d.ts.map