@takboo/dsh-session-bin 0.0.0-stage → 0.1.0

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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -2
  3. package/cordis.patch.yml +4 -0
  4. package/dist/client-model.js +1673 -0
  5. package/dist/client.js +17043 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/host/archive.d.ts +766 -0
  8. package/dist/host/lease.d.ts +4 -0
  9. package/dist/host/module.d.ts +705 -0
  10. package/dist/host/native-jsonl-files.d.ts +198 -0
  11. package/dist/host/native-retirement-admission.d.ts +33 -0
  12. package/dist/host/native-retirement-metadata.d.ts +109 -0
  13. package/dist/host/native-retirement-owner.d.ts +305 -0
  14. package/dist/host/native-retirement-persistence.d.ts +24 -0
  15. package/dist/host/native-retirement-sdk.d.ts +80 -0
  16. package/dist/host/native.d.ts +12 -0
  17. package/dist/host/platform-files.d.ts +19 -0
  18. package/dist/host/remote.d.ts +32 -0
  19. package/dist/host/retirement-owner-store.d.ts +124 -0
  20. package/dist/host/retirement-owner.d.ts +124 -0
  21. package/dist/host/retirement-store.d.ts +311 -0
  22. package/dist/host/retirement.d.ts +76 -0
  23. package/dist/host/store.d.ts +215 -0
  24. package/dist/index.d.ts +912 -0
  25. package/dist/index.js +4921 -0
  26. package/dist/index.js.map +7 -0
  27. package/dist/operations/archive.d.ts +82 -0
  28. package/dist/operations/index.d.ts +2 -0
  29. package/dist/operations/retirement-owner.d.ts +129 -0
  30. package/dist/operations/retirement.d.ts +821 -0
  31. package/dist/operations/schema.d.ts +115 -0
  32. package/dist/operations.js +130 -0
  33. package/dist/operations.js.map +7 -0
  34. package/dist/remote/contracts.d.ts +891 -0
  35. package/dist/remote.js +442 -0
  36. package/dist/remote.js.map +7 -0
  37. package/dist/types/client/components.d.ts +17 -0
  38. package/dist/types/client/index.d.ts +10 -0
  39. package/dist/types/client/locales.d.ts +116 -0
  40. package/dist/types/client/model.d.ts +137 -0
  41. package/dist/types/client/purge-batch.d.ts +45 -0
  42. package/dist/types/client/retirement-digest.d.ts +3 -0
  43. package/dist/types/operations/archive.d.ts +82 -0
  44. package/dist/types/operations/retirement.d.ts +821 -0
  45. package/dist/types/operations/schema.d.ts +115 -0
  46. package/dist/types/remote/contracts.d.ts +891 -0
  47. package/docs/client-interface.md +79 -0
  48. package/docs/host-lifecycle.md +158 -0
  49. package/locale/en.json +6 -0
  50. package/locale/zh.json +6 -0
  51. package/package.json +163 -4
@@ -0,0 +1,198 @@
1
+ import type { SessionHeader } from '@deepseek-ai/dsh-session';
2
+ import { z } from 'zod';
3
+ declare const fileRowSchema: z.ZodObject<{
4
+ resourceId: z.ZodString;
5
+ kind: z.ZodEnum<{
6
+ generation: "generation";
7
+ staging: "staging";
8
+ }>;
9
+ formatVersion: z.ZodNumber;
10
+ compression: z.ZodEnum<{
11
+ none: "none";
12
+ zstd: "zstd";
13
+ }>;
14
+ identity: z.ZodObject<{
15
+ dev: z.ZodString;
16
+ ino: z.ZodString;
17
+ birthtimeNs: z.ZodString;
18
+ size: z.ZodString;
19
+ mtimeNs: z.ZodString;
20
+ ctimeNs: z.ZodString;
21
+ nlink: z.ZodLiteral<"1">;
22
+ }, z.core.$strict>;
23
+ digest: z.ZodString;
24
+ header: z.ZodObject<{
25
+ id: z.ZodString;
26
+ createdAt: z.ZodNumber;
27
+ cwd: z.ZodNullable<z.ZodString>;
28
+ parentSession: z.ZodNullable<z.ZodString>;
29
+ origin: z.ZodNullable<z.ZodLiteral<"subagent">>;
30
+ isSeeded: z.ZodBoolean;
31
+ delegationDepth: z.ZodNumber;
32
+ agentPreset: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strict>;
34
+ revision: z.ZodString;
35
+ }, z.core.$strict>;
36
+ export declare const nativeJsonlFileSchema: z.ZodObject<{
37
+ resourceId: z.ZodString;
38
+ kind: z.ZodEnum<{
39
+ generation: "generation";
40
+ staging: "staging";
41
+ }>;
42
+ formatVersion: z.ZodNumber;
43
+ compression: z.ZodEnum<{
44
+ none: "none";
45
+ zstd: "zstd";
46
+ }>;
47
+ identity: z.ZodObject<{
48
+ dev: z.ZodString;
49
+ ino: z.ZodString;
50
+ birthtimeNs: z.ZodString;
51
+ size: z.ZodString;
52
+ mtimeNs: z.ZodString;
53
+ ctimeNs: z.ZodString;
54
+ nlink: z.ZodLiteral<"1">;
55
+ }, z.core.$strict>;
56
+ digest: z.ZodString;
57
+ header: z.ZodObject<{
58
+ id: z.ZodString;
59
+ createdAt: z.ZodNumber;
60
+ cwd: z.ZodNullable<z.ZodString>;
61
+ parentSession: z.ZodNullable<z.ZodString>;
62
+ origin: z.ZodNullable<z.ZodLiteral<"subagent">>;
63
+ isSeeded: z.ZodBoolean;
64
+ delegationDepth: z.ZodNumber;
65
+ agentPreset: z.ZodNullable<z.ZodString>;
66
+ }, z.core.$strict>;
67
+ revision: z.ZodString;
68
+ }, z.core.$strict>;
69
+ export declare const nativeJsonlInventorySchema: z.ZodObject<{
70
+ schemaVersion: z.ZodLiteral<1>;
71
+ root: z.ZodString;
72
+ rootIdentity: z.ZodObject<{
73
+ dev: z.ZodString;
74
+ ino: z.ZodString;
75
+ birthtimeNs: z.ZodString;
76
+ }, z.core.$strict>;
77
+ directory: z.ZodString;
78
+ directoryIdentity: z.ZodObject<{
79
+ dev: z.ZodString;
80
+ ino: z.ZodString;
81
+ birthtimeNs: z.ZodString;
82
+ }, z.core.$strict>;
83
+ sessionId: z.ZodString;
84
+ compression: z.ZodEnum<{
85
+ none: "none";
86
+ zstd: "zstd";
87
+ }>;
88
+ header: z.ZodObject<{
89
+ id: z.ZodString;
90
+ createdAt: z.ZodNumber;
91
+ cwd: z.ZodNullable<z.ZodString>;
92
+ parentSession: z.ZodNullable<z.ZodString>;
93
+ origin: z.ZodNullable<z.ZodLiteral<"subagent">>;
94
+ isSeeded: z.ZodBoolean;
95
+ delegationDepth: z.ZodNumber;
96
+ agentPreset: z.ZodNullable<z.ZodString>;
97
+ }, z.core.$strict>;
98
+ anchor: z.ZodObject<{
99
+ resourceId: z.ZodString;
100
+ identity: z.ZodObject<{
101
+ dev: z.ZodString;
102
+ ino: z.ZodString;
103
+ birthtimeNs: z.ZodString;
104
+ }, z.core.$strict>;
105
+ header: z.ZodObject<{
106
+ id: z.ZodString;
107
+ createdAt: z.ZodNumber;
108
+ cwd: z.ZodNullable<z.ZodString>;
109
+ parentSession: z.ZodNullable<z.ZodString>;
110
+ origin: z.ZodNullable<z.ZodLiteral<"subagent">>;
111
+ isSeeded: z.ZodBoolean;
112
+ delegationDepth: z.ZodNumber;
113
+ agentPreset: z.ZodNullable<z.ZodString>;
114
+ }, z.core.$strict>;
115
+ }, z.core.$strict>;
116
+ lock: z.ZodUnion<readonly [z.ZodObject<{
117
+ dev: z.ZodString;
118
+ ino: z.ZodString;
119
+ birthtimeNs: z.ZodString;
120
+ size: z.ZodLiteral<"0">;
121
+ nlink: z.ZodLiteral<"1">;
122
+ }, z.core.$strict>, z.ZodObject<{
123
+ kind: z.ZodLiteral<"win32-semaphore">;
124
+ name: z.ZodString;
125
+ }, z.core.$strict>]>;
126
+ files: z.ZodArray<z.ZodObject<{
127
+ resourceId: z.ZodString;
128
+ kind: z.ZodEnum<{
129
+ generation: "generation";
130
+ staging: "staging";
131
+ }>;
132
+ formatVersion: z.ZodNumber;
133
+ compression: z.ZodEnum<{
134
+ none: "none";
135
+ zstd: "zstd";
136
+ }>;
137
+ identity: z.ZodObject<{
138
+ dev: z.ZodString;
139
+ ino: z.ZodString;
140
+ birthtimeNs: z.ZodString;
141
+ size: z.ZodString;
142
+ mtimeNs: z.ZodString;
143
+ ctimeNs: z.ZodString;
144
+ nlink: z.ZodLiteral<"1">;
145
+ }, z.core.$strict>;
146
+ digest: z.ZodString;
147
+ header: z.ZodObject<{
148
+ id: z.ZodString;
149
+ createdAt: z.ZodNumber;
150
+ cwd: z.ZodNullable<z.ZodString>;
151
+ parentSession: z.ZodNullable<z.ZodString>;
152
+ origin: z.ZodNullable<z.ZodLiteral<"subagent">>;
153
+ isSeeded: z.ZodBoolean;
154
+ delegationDepth: z.ZodNumber;
155
+ agentPreset: z.ZodNullable<z.ZodString>;
156
+ }, z.core.$strict>;
157
+ revision: z.ZodString;
158
+ }, z.core.$strict>>;
159
+ revision: z.ZodString;
160
+ }, z.core.$strict>;
161
+ export type NativeJsonlInventory = z.infer<typeof nativeJsonlInventorySchema>;
162
+ export type NativeJsonlFileRow = z.infer<typeof fileRowSchema>;
163
+ type Encoding = 'none' | 'zstd';
164
+ export declare class NativeJsonlRefusal extends Error {
165
+ readonly code: string;
166
+ constructor(code: string, message: string);
167
+ }
168
+ /** Exact file erasure; platform kernel leases share the audited JSONL writer namespace. */
169
+ export declare class NativeJsonlFiles {
170
+ private readonly provider;
171
+ readonly root: string;
172
+ readonly compression: Encoding;
173
+ private readonly rootIdentity;
174
+ private readonly leases;
175
+ private constructor();
176
+ static open(provider: unknown): Promise<NativeJsonlFiles | undefined>;
177
+ inspect(sessionId: string, header: SessionHeader): Promise<NativeJsonlInventory>;
178
+ /** Re-enumerate the entire scope without changing its original durable anchor. */
179
+ current(input: NativeJsonlInventory): Promise<NativeJsonlInventory>;
180
+ acquire(input: NativeJsonlInventory, options?: {
181
+ recovering?: boolean;
182
+ }): Promise<{
183
+ release(): Promise<void>;
184
+ }>;
185
+ /** Caller must have persisted the exact retirement intent before this method. */
186
+ erase(input: NativeJsonlInventory, inputRow: NativeJsonlFileRow): Promise<void>;
187
+ private eraseInner;
188
+ private validate;
189
+ private directory;
190
+ private assertDirectory;
191
+ private lockIdentity;
192
+ private isWindowsErasureRemainder;
193
+ private rows;
194
+ private readRow;
195
+ private openFile;
196
+ private syncDirectory;
197
+ }
198
+ export {};
@@ -0,0 +1,33 @@
1
+ export declare class NativeAdmissionError extends Error {
2
+ readonly code = "native/session-busy";
3
+ }
4
+ /** Shared per-target mutation gates and global header/migration read barriers. */
5
+ export declare class NativeAdmission {
6
+ private readonly maintenance;
7
+ private readonly acceptedFrames;
8
+ private readonly activeAcceptedFrames;
9
+ private readonly held;
10
+ private readonly released;
11
+ private readonly pending;
12
+ private readonly globalReads;
13
+ private readonly retired;
14
+ private readonly candidates;
15
+ private closing;
16
+ private failed;
17
+ private ready;
18
+ requiresRecovery(): boolean;
19
+ activate(): void;
20
+ suspend(): void;
21
+ beginClose(): void;
22
+ isRetired(id: string): boolean;
23
+ hasTombstones(): boolean;
24
+ markRetired(id: string): void;
25
+ private isAcceptedFrame;
26
+ assertAllowed(id: string): void;
27
+ bypass<T>(id: string, work: () => T): T;
28
+ withoutBypass<T>(work: () => T): T;
29
+ track<T>(id: string, work: () => Promise<T>): Promise<T>;
30
+ trackGlobal<T>(work: () => Promise<T>): Promise<T>;
31
+ drain(id?: string): Promise<void>;
32
+ acquire(id: string, recovery?: boolean): Promise<() => void>;
33
+ }
@@ -0,0 +1,109 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { z } from 'zod';
3
+ import type { LifecycleKey, RetirementRequest } from '../operations/retirement.js';
4
+ export interface NativeMetadataAdmission {
5
+ assertAllowed(sessionId: string): void;
6
+ track<T>(sessionId: string, work: () => Promise<T>): Promise<T>;
7
+ trackGlobal<T>(work: () => Promise<T>): Promise<T>;
8
+ isRetired(sessionId: string): boolean;
9
+ bypass<T>(sessionId: string, work: () => T): T;
10
+ withoutBypass<T>(work: () => T): T;
11
+ }
12
+ export declare class NativeMetadataRefusal extends Error {
13
+ readonly code: string;
14
+ constructor(code: string, message: string);
15
+ }
16
+ export declare const nativeMetadataSnapshotSchema: z.ZodObject<{
17
+ schemaVersion: z.ZodLiteral<1>;
18
+ sessionId: z.ZodString;
19
+ global: z.ZodObject<{
20
+ archived: z.ZodBoolean;
21
+ pinned: z.ZodBoolean;
22
+ }, z.core.$strict>;
23
+ workspaces: z.ZodArray<z.ZodObject<{
24
+ workspaceId: z.ZodString;
25
+ record: z.ZodObject<{
26
+ path: z.ZodString;
27
+ title: z.ZodString;
28
+ sessionIds: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("@deepseek-ai/dsh-session").SessionId, string>>>;
29
+ createdAt: z.ZodString;
30
+ updatedAt: z.ZodString;
31
+ }, z.core.$strip>;
32
+ }, z.core.$strict>>;
33
+ cache: z.ZodObject<{
34
+ present: z.ZodBoolean;
35
+ digest: z.ZodNullable<z.ZodString>;
36
+ location: z.ZodNullable<z.ZodString>;
37
+ documentDigest: z.ZodNullable<z.ZodString>;
38
+ memoryDigest: z.ZodNullable<z.ZodString>;
39
+ physicalIdentity: z.ZodOptional<z.ZodObject<{
40
+ dev: z.ZodString;
41
+ ino: z.ZodString;
42
+ birthtimeNs: z.ZodString;
43
+ }, z.core.$strict>>;
44
+ }, z.core.$strict>;
45
+ queryProvider: z.ZodEnum<{
46
+ none: "none";
47
+ "sqlite-0.2.0-rc.2": "sqlite-0.2.0-rc.2";
48
+ "sqlite-memory-disabled-0.2.0-rc.2": "sqlite-memory-disabled-0.2.0-rc.2";
49
+ }>;
50
+ queryPath: z.ZodNullable<z.ZodString>;
51
+ }, z.core.$strict>;
52
+ export type NativeMetadataSnapshot = z.infer<typeof nativeMetadataSnapshotSchema>;
53
+ /** Version-bound metadata participant. The composition verifies package/source
54
+ * fingerprints before open; this adapter additionally checks concrete instance
55
+ * shape. It neither removes files nor writes SQLite rows. */
56
+ export declare class NativeMetadataAdapter {
57
+ private readonly ctx;
58
+ private readonly admission;
59
+ private readonly workspace;
60
+ private readonly sessions;
61
+ private readonly cache;
62
+ private readonly query;
63
+ private readonly controller;
64
+ private readonly targets;
65
+ private readonly retained;
66
+ private readonly followers;
67
+ private readonly operations;
68
+ private readonly queueTarget;
69
+ private readonly receivers;
70
+ private readonly restores;
71
+ private readonly guardedMethods;
72
+ private readonly guardedEntities;
73
+ private installed;
74
+ private disposed;
75
+ private detached;
76
+ private fallbackRetired;
77
+ private readonly queryConfiguration;
78
+ private readonly queryProvider;
79
+ private readonly cacheTable;
80
+ private readonly cacheDirectory;
81
+ private moveCacheDocument;
82
+ private clearCacheStage;
83
+ private removeCacheStage;
84
+ private constructor();
85
+ private static get;
86
+ static open(ctx: Context, admission: NativeMetadataAdmission): Promise<NativeMetadataAdapter | undefined>;
87
+ private assert;
88
+ private tracked;
89
+ private increment;
90
+ private refuse;
91
+ private assertInstances;
92
+ private assertCold;
93
+ private cacheView;
94
+ private openCacheDocument;
95
+ private pathAbsent;
96
+ private frozenCacheBytes;
97
+ private eraseWindowsCache;
98
+ private eraseCache;
99
+ capture(sessionId: string): Promise<NativeMetadataSnapshot>;
100
+ private captureInner;
101
+ private wrap;
102
+ private guardEntity;
103
+ private guardedObservation;
104
+ install(): Promise<() => Promise<void>>;
105
+ /** The verified owner completes all asynchronous takeover work before this
106
+ * synchronous restoration and installs its successor guards without yielding. */
107
+ forceRestore(): void;
108
+ converge(input: NativeMetadataSnapshot, expected: LifecycleKey, request: RetirementRequest): Promise<boolean>;
109
+ }
@@ -0,0 +1,305 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { SessionId } from '@deepseek-ai/dsh-session';
3
+ import { z } from 'zod';
4
+ import type { RetirementOwnerCoordinatorOptions } from './retirement-owner.js';
5
+ import type { LifecycleKey, RetirementCapabilities, RetirementManifest, RetirementRequest, RetirementAuthorization, RetirementState } from '../operations/retirement.js';
6
+ import type { SessionRetirementOwnerV1 } from './retirement.js';
7
+ export declare const nativeRetirementDomainSpec: {
8
+ readonly name: "session_bin_jsonl_resources";
9
+ readonly version: 1;
10
+ readonly layout: "single";
11
+ readonly global: {
12
+ readonly schema: z.ZodObject<{
13
+ schemaVersion: z.ZodLiteral<1>;
14
+ storeId: z.ZodNullable<z.ZodUUID>;
15
+ root: z.ZodNullable<z.ZodString>;
16
+ fingerprint: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strict>;
18
+ readonly initial: {
19
+ readonly schemaVersion: 1;
20
+ readonly storeId: null;
21
+ readonly root: null;
22
+ readonly fingerprint: null;
23
+ };
24
+ };
25
+ readonly tables: {
26
+ readonly witnesses: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
27
+ schemaVersion: 1;
28
+ lifecycle: {
29
+ storeId: string;
30
+ sessionId: string;
31
+ lifecycleId: string;
32
+ };
33
+ inventory: {
34
+ schemaVersion: 1;
35
+ root: string;
36
+ rootIdentity: {
37
+ dev: string;
38
+ ino: string;
39
+ birthtimeNs: string;
40
+ };
41
+ directory: string;
42
+ directoryIdentity: {
43
+ dev: string;
44
+ ino: string;
45
+ birthtimeNs: string;
46
+ };
47
+ sessionId: string;
48
+ compression: "none" | "zstd";
49
+ header: {
50
+ id: string;
51
+ createdAt: number;
52
+ cwd: string | null;
53
+ parentSession: string | null;
54
+ origin: "subagent" | null;
55
+ isSeeded: boolean;
56
+ delegationDepth: number;
57
+ agentPreset: string | null;
58
+ };
59
+ anchor: {
60
+ resourceId: string;
61
+ identity: {
62
+ dev: string;
63
+ ino: string;
64
+ birthtimeNs: string;
65
+ };
66
+ header: {
67
+ id: string;
68
+ createdAt: number;
69
+ cwd: string | null;
70
+ parentSession: string | null;
71
+ origin: "subagent" | null;
72
+ isSeeded: boolean;
73
+ delegationDepth: number;
74
+ agentPreset: string | null;
75
+ };
76
+ };
77
+ lock: {
78
+ dev: string;
79
+ ino: string;
80
+ birthtimeNs: string;
81
+ size: "0";
82
+ nlink: "1";
83
+ } | {
84
+ kind: "win32-semaphore";
85
+ name: string;
86
+ };
87
+ files: {
88
+ resourceId: string;
89
+ kind: "generation" | "staging";
90
+ formatVersion: number;
91
+ compression: "none" | "zstd";
92
+ identity: {
93
+ dev: string;
94
+ ino: string;
95
+ birthtimeNs: string;
96
+ size: string;
97
+ mtimeNs: string;
98
+ ctimeNs: string;
99
+ nlink: "1";
100
+ };
101
+ digest: string;
102
+ header: {
103
+ id: string;
104
+ createdAt: number;
105
+ cwd: string | null;
106
+ parentSession: string | null;
107
+ origin: "subagent" | null;
108
+ isSeeded: boolean;
109
+ delegationDepth: number;
110
+ agentPreset: string | null;
111
+ };
112
+ revision: string;
113
+ }[];
114
+ revision: string;
115
+ };
116
+ metadata: {
117
+ schemaVersion: 1;
118
+ sessionId: string;
119
+ global: {
120
+ archived: boolean;
121
+ pinned: boolean;
122
+ };
123
+ workspaces: {
124
+ workspaceId: string;
125
+ record: {
126
+ path: string;
127
+ title: string;
128
+ sessionIds: SessionId[];
129
+ createdAt: string;
130
+ updatedAt: string;
131
+ };
132
+ }[];
133
+ cache: {
134
+ present: boolean;
135
+ digest: string | null;
136
+ location: string | null;
137
+ documentDigest: string | null;
138
+ memoryDigest: string | null;
139
+ physicalIdentity?: {
140
+ dev: string;
141
+ ino: string;
142
+ birthtimeNs: string;
143
+ } | undefined;
144
+ };
145
+ queryProvider: "none" | "sqlite-0.2.0-rc.2" | "sqlite-memory-disabled-0.2.0-rc.2";
146
+ queryPath: string | null;
147
+ };
148
+ }>;
149
+ };
150
+ };
151
+ export declare const nativeRetirementOwnerDomainSpec: {
152
+ readonly name: "session_bin_jsonl_retirement_owner";
153
+ readonly version: 1;
154
+ readonly layout: "single";
155
+ readonly global: {
156
+ readonly schema: z.ZodObject<{
157
+ schemaVersion: z.ZodLiteral<1>;
158
+ capabilities: z.ZodNullable<z.ZodObject<{
159
+ protocolVersion: z.ZodLiteral<1>;
160
+ ownerId: z.ZodString;
161
+ hostVersion: z.ZodString;
162
+ providerId: z.ZodString;
163
+ storeId: z.ZodString;
164
+ participants: z.ZodArray<z.ZodObject<{
165
+ id: z.ZodString;
166
+ version: z.ZodString;
167
+ }, z.core.$strict>>;
168
+ }, z.core.$strict>>;
169
+ }, z.core.$strict>;
170
+ readonly initial: {
171
+ readonly schemaVersion: 1;
172
+ readonly capabilities: null;
173
+ };
174
+ };
175
+ readonly tables: {
176
+ readonly operations: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
177
+ schemaVersion: 1;
178
+ state: {
179
+ schemaVersion: 1;
180
+ request: {
181
+ operationId: string;
182
+ expected: {
183
+ storeId: string;
184
+ sessionId: string;
185
+ lifecycleId: string;
186
+ };
187
+ bin: {
188
+ entryId: string;
189
+ entryVersion: 1;
190
+ } | {
191
+ kind: "native-archive";
192
+ entryId: string;
193
+ entryVersion: 2;
194
+ };
195
+ manifestDigest: string;
196
+ };
197
+ manifest: {
198
+ schemaVersion: 1;
199
+ lifecycle: {
200
+ storeId: string;
201
+ sessionId: string;
202
+ lifecycleId: string;
203
+ };
204
+ capabilities: {
205
+ protocolVersion: 1;
206
+ ownerId: string;
207
+ hostVersion: string;
208
+ providerId: string;
209
+ storeId: string;
210
+ participants: {
211
+ id: string;
212
+ version: string;
213
+ }[];
214
+ };
215
+ resources: {
216
+ ownerId: string;
217
+ resourceId: string;
218
+ revision: string;
219
+ kind: "transcript" | "workspace" | "index" | "cache" | "attachment" | "spill" | "coordination";
220
+ disposition: "erase" | "release-reference" | "retain-shared" | "retain-coordination";
221
+ retention: {
222
+ reason: "shared-reference" | "coordination-identity";
223
+ retainedBy: {
224
+ storeId: string;
225
+ sessionId: string;
226
+ lifecycleId: string;
227
+ }[];
228
+ } | null;
229
+ }[];
230
+ };
231
+ authorizationId: string | null;
232
+ phase: "rejected" | "conflict" | "done" | "fenced" | "quiesced" | "erasing" | "converging";
233
+ reason: string | null;
234
+ resources: {
235
+ ownerId: string;
236
+ resourceId: string;
237
+ status: "erased" | "reference-released" | "retained" | "failed";
238
+ reason: string | null;
239
+ }[];
240
+ };
241
+ participants: {
242
+ id: string;
243
+ version: string;
244
+ fenced: boolean;
245
+ quiesced: boolean;
246
+ converged: boolean;
247
+ }[];
248
+ lifecycleQuiesced: boolean;
249
+ lifecycleFinalized: boolean;
250
+ blockedReason: string | null;
251
+ }>;
252
+ };
253
+ };
254
+ export interface NativeRetirementOptions {
255
+ /** Independent composition qualification, used by isolated candidate-platform fixtures.
256
+ * The production Service never takes this callback from Host configuration. */
257
+ platformQualification?: (runtime: {
258
+ platform: NodeJS.Platform;
259
+ arch: string;
260
+ node: string;
261
+ }) => boolean;
262
+ checkpoint?: RetirementOwnerCoordinatorOptions['checkpoint'];
263
+ canAdvance?: RetirementOwnerCoordinatorOptions['canAdvance'];
264
+ }
265
+ /** Actual native log erasure, limited to the audited cold JSONL/Workspace composition. */
266
+ export declare class NativeRetirementOwner implements SessionRetirementOwnerV1 {
267
+ private readonly ctx;
268
+ private readonly files;
269
+ private readonly metadata;
270
+ private readonly admission;
271
+ private readonly domain;
272
+ private readonly journal;
273
+ private readonly scopes;
274
+ private readonly coordinator;
275
+ private readonly descriptor;
276
+ private readonly provider;
277
+ private readonly originalProvider;
278
+ private readonly restore;
279
+ private readonly observations;
280
+ private fullyClosed;
281
+ private observationsClosed;
282
+ private closing;
283
+ private constructor();
284
+ static open(ctx: Context, options?: NativeRetirementOptions): Promise<NativeRetirementOwner | undefined>;
285
+ capabilities(): Promise<RetirementCapabilities>;
286
+ eligibility(id: string): Promise<string | null>;
287
+ private eligibilityInner;
288
+ inspect(id: string): Promise<LifecycleKey | null>;
289
+ private inspectInner;
290
+ prepare(expected: LifecycleKey): Promise<RetirementManifest>;
291
+ retire(request: RetirementRequest, authorize: () => Promise<RetirementAuthorization>, manifest?: RetirementManifest): Promise<RetirementState>;
292
+ getOperation(id: string): Promise<RetirementState | null>;
293
+ recover(id: string): Promise<RetirementState>;
294
+ private acquire;
295
+ private observe;
296
+ private fileParticipant;
297
+ private metadataParticipant;
298
+ private requireScope;
299
+ private witness;
300
+ private putWitness;
301
+ private read;
302
+ private io;
303
+ private relinquishGuards;
304
+ close(): Promise<void>;
305
+ }
@@ -0,0 +1,24 @@
1
+ import type { SessionPersistence, SessionPersistenceSnapshot } from '@deepseek-ai/dsh-session-persistence';
2
+ import { NativeAdmission } from './native-retirement-admission.js';
3
+ export declare function nativeServiceInstance<T extends object>(value: T): T;
4
+ /** Version-bound instance Adapter. It never patches prototypes or other Hosts. */
5
+ export declare class NativePersistenceAdapter {
6
+ private readonly provider;
7
+ private readonly admission;
8
+ private readonly raw;
9
+ private originalStat;
10
+ private originalList;
11
+ private readonly restore;
12
+ private detached;
13
+ private active;
14
+ private readonly managedHandles;
15
+ constructor(provider: SessionPersistence, admission: NativeAdmission);
16
+ stat(id: string): Promise<SessionPersistenceSnapshot | undefined>;
17
+ list(): Promise<readonly SessionPersistenceSnapshot[]>;
18
+ busy(id: string): boolean;
19
+ forget(id: string): void;
20
+ install(): () => Promise<void>;
21
+ forceRestore(): void;
22
+ private originalRetired;
23
+ private manage;
24
+ }