@duke-dsh-plugins/dsh-archive-manager 1.3.4 → 1.3.5

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 (4) hide show
  1. package/client.js +530 -515
  2. package/index.js +276 -276
  3. package/package.json +1 -1
  4. package/typert.host.js +224 -224
package/typert.host.js CHANGED
@@ -1,224 +1,224 @@
1
- /**
2
- * dsh-archive-manager — Typert Host manifest.
3
- *
4
- * Hand-written TYPERT manifest (the format the DSH typert-loader consumes from
5
- * the package's `./typert` export). It describes the `archiveManager` Remote
6
- * service the Host half publishes so the browser Client half can call it
7
- * through `ctx.remote.archiveManager.{restore,delete,state}`.
8
- *
9
- * Keep the invocation ids, service/namespace names and method names in sync
10
- * with `index.js` (ArchiveManagerService) and `client.js`.
11
- */
12
-
13
- import { z } from "zod";
14
-
15
- // ---- shared shapes ---------------------------------------------------------
16
-
17
- const sessionIdSchema = z.intersection(z.string(), z.unknown()).readonly();
18
-
19
- const restoreResultSchema = z.union([
20
- z.object({
21
- ok: z.literal(true).readonly(),
22
- value: z.object({
23
- restored: z.literal(true).readonly(),
24
- }).readonly(),
25
- }).readonly(),
26
- z.object({
27
- ok: z.literal(false).readonly(),
28
- error: z.object({
29
- code: z.string().readonly(),
30
- message: z.string().readonly().optional(),
31
- }).readonly(),
32
- }).readonly(),
33
- ]);
34
-
35
- const deleteResultSchema = z.union([
36
- z.object({
37
- ok: z.literal(true).readonly(),
38
- value: z.object({
39
- fileRemoved: z.boolean().readonly(),
40
- live: z.boolean().readonly(),
41
- }).readonly(),
42
- }).readonly(),
43
- z.object({
44
- ok: z.literal(false).readonly(),
45
- error: z.object({
46
- code: z.string().readonly(),
47
- message: z.string().readonly().optional(),
48
- }).readonly(),
49
- }).readonly(),
50
- ]);
51
-
52
- const stateResultSchema = z.union([
53
- z.object({
54
- ok: z.literal(true).readonly(),
55
- value: z.object({
56
- ghostIds: z.array(sessionIdSchema).readonly(),
57
- }).readonly(),
58
- }).readonly(),
59
- z.object({
60
- ok: z.literal(false).readonly(),
61
- error: z.object({
62
- code: z.string().readonly(),
63
- message: z.string().readonly().optional(),
64
- }).readonly(),
65
- }).readonly(),
66
- ]);
67
-
68
- // ---- per-invocation parameter/result schemas -------------------------------
69
-
70
- const _archiveManager_restore_parameter_0$schema = z.object({
71
- sessionId: sessionIdSchema,
72
- });
73
-
74
- const _archiveManager_delete_parameter_0$schema = z.object({
75
- sessionId: sessionIdSchema,
76
- });
77
-
78
- export const TYPERT = {
79
- package: "@duke-dsh-plugins/dsh-archive-manager",
80
- face: "host",
81
- schemas: [],
82
- invocations: [
83
- {
84
- id: "dsh-archive-manager#archiveManager/restore",
85
- service: "archiveManager",
86
- namespace: "archiveManager",
87
- method: "restore",
88
- invocation: { kind: "direct" },
89
- parameters: [
90
- {
91
- name: "request",
92
- wire: "request",
93
- source: "json",
94
- codec: {
95
- mode: "strict",
96
- typeSymbol: "dsh-archive-manager#ArchiveManagerRestoreRequest",
97
- schema: _archiveManager_restore_parameter_0$schema,
98
- },
99
- },
100
- ],
101
- result: {
102
- mode: "strict",
103
- typeSymbol: "dsh-archive-manager#ArchiveManagerRestoreResult",
104
- schema: restoreResultSchema,
105
- },
106
- sourceLocation: { file: "index.js", line: 1, column: 1 },
107
- },
108
- {
109
- id: "dsh-archive-manager#archiveManager/delete",
110
- service: "archiveManager",
111
- namespace: "archiveManager",
112
- method: "delete",
113
- invocation: { kind: "direct" },
114
- parameters: [
115
- {
116
- name: "request",
117
- wire: "request",
118
- source: "json",
119
- codec: {
120
- mode: "strict",
121
- typeSymbol: "dsh-archive-manager#ArchiveManagerDeleteRequest",
122
- schema: _archiveManager_delete_parameter_0$schema,
123
- },
124
- },
125
- ],
126
- result: {
127
- mode: "strict",
128
- typeSymbol: "dsh-archive-manager#ArchiveManagerDeleteResult",
129
- schema: deleteResultSchema,
130
- },
131
- sourceLocation: { file: "index.js", line: 1, column: 1 },
132
- },
133
- {
134
- id: "dsh-archive-manager#archiveManager/state",
135
- service: "archiveManager",
136
- namespace: "archiveManager",
137
- method: "state",
138
- invocation: { kind: "direct" },
139
- parameters: [],
140
- result: {
141
- mode: "strict",
142
- typeSymbol: "dsh-archive-manager#ArchiveManagerStateResult",
143
- schema: stateResultSchema,
144
- },
145
- sourceLocation: { file: "index.js", line: 1, column: 1 },
146
- },
147
- ],
148
- model: {
149
- services: [
150
- {
151
- description:
152
- "Archive manager service: restore, delete and inspect archived sessions for the DeepSeek Harness web UI.",
153
- summary: "Archive manager service.",
154
- tags: [],
155
- jsDoc:
156
- "/**\n * Archive manager service: restore, delete and inspect archived sessions.\n */",
157
- key: "archiveManager",
158
- exportName: "ArchiveManagerService",
159
- members: [
160
- {
161
- kind: "method",
162
- name: "restore",
163
- signature:
164
- "@Remote('restore') async restore(request: ArchiveManagerRestoreRequest): Promise<ArchiveManagerRestoreResult>",
165
- summary: "Remove one session from the archive set so it returns to its project slot.",
166
- jsDoc:
167
- "/**\n * Remove one session from the archive set so it returns to its project slot.\n * @param request - target session id.\n * @returns success or a business failure.\n */",
168
- },
169
- {
170
- kind: "method",
171
- name: "delete",
172
- signature:
173
- "@Remote('delete') async delete(request: ArchiveManagerDeleteRequest): Promise<ArchiveManagerDeleteResult>",
174
- summary: "Permanently delete one archived session's log directory and clear its archive entry.",
175
- jsDoc:
176
- "/**\n * Permanently delete one archived session's log directory and clear its archive\n * entry. Refuses sessions whose agent is running; live-but-idle sessions keep\n * their entry (ghost) until restart.\n * @param request - target session id.\n * @returns success or a business failure.\n */",
177
- },
178
- {
179
- kind: "method",
180
- name: "state",
181
- signature:
182
- "@Remote('state') async state(): Promise<ArchiveManagerStateResult>",
183
- summary: "Report archived sessions that are live in memory but whose logs are gone.",
184
- jsDoc:
185
- "/**\n * Report archived sessions that are still live in memory while their log files\n * no longer exist (ghost records the client hides).\n * @returns the ghost session ids.\n */",
186
- },
187
- ],
188
- types: [
189
- {
190
- name: "ArchiveManagerRestoreRequest",
191
- declaration:
192
- "export interface ArchiveManagerRestoreRequest {\n readonly sessionId: SessionId;\n}",
193
- },
194
- {
195
- name: "ArchiveManagerRestoreResult",
196
- declaration:
197
- "export type ArchiveManagerRestoreResult = { ok: true; value: { restored: true } } | { ok: false; error: { code: string; message?: string } };",
198
- },
199
- {
200
- name: "ArchiveManagerDeleteRequest",
201
- declaration:
202
- "export interface ArchiveManagerDeleteRequest {\n readonly sessionId: SessionId;\n}",
203
- },
204
- {
205
- name: "ArchiveManagerDeleteResult",
206
- declaration:
207
- "export type ArchiveManagerDeleteResult = { ok: true; value: { fileRemoved: boolean; live: boolean } } | { ok: false; error: { code: string; message?: string } };",
208
- },
209
- {
210
- name: "ArchiveManagerStateResult",
211
- declaration:
212
- "export type ArchiveManagerStateResult = { ok: true; value: { ghostIds: readonly SessionId[] } } | { ok: false; error: { code: string; message?: string } };",
213
- },
214
- {
215
- name: "SessionId",
216
- declaration: "export type SessionId = Branded<'SessionId'>;",
217
- },
218
- ],
219
- },
220
- ],
221
- events: [],
222
- objects: [],
223
- },
224
- };
1
+ /**
2
+ * dsh-archive-manager — Typert Host manifest.
3
+ *
4
+ * Hand-written TYPERT manifest (the format the DSH typert-loader consumes from
5
+ * the package's `./typert` export). It describes the `archiveManager` Remote
6
+ * service the Host half publishes so the browser Client half can call it
7
+ * through `ctx.remote.archiveManager.{restore,delete,state}`.
8
+ *
9
+ * Keep the invocation ids, service/namespace names and method names in sync
10
+ * with `index.js` (ArchiveManagerService) and `client.js`.
11
+ */
12
+
13
+ import { z } from "zod";
14
+
15
+ // ---- shared shapes ---------------------------------------------------------
16
+
17
+ const sessionIdSchema = z.intersection(z.string(), z.unknown()).readonly();
18
+
19
+ const restoreResultSchema = z.union([
20
+ z.object({
21
+ ok: z.literal(true).readonly(),
22
+ value: z.object({
23
+ restored: z.literal(true).readonly(),
24
+ }).readonly(),
25
+ }).readonly(),
26
+ z.object({
27
+ ok: z.literal(false).readonly(),
28
+ error: z.object({
29
+ code: z.string().readonly(),
30
+ message: z.string().readonly().optional(),
31
+ }).readonly(),
32
+ }).readonly(),
33
+ ]);
34
+
35
+ const deleteResultSchema = z.union([
36
+ z.object({
37
+ ok: z.literal(true).readonly(),
38
+ value: z.object({
39
+ fileRemoved: z.boolean().readonly(),
40
+ live: z.boolean().readonly(),
41
+ }).readonly(),
42
+ }).readonly(),
43
+ z.object({
44
+ ok: z.literal(false).readonly(),
45
+ error: z.object({
46
+ code: z.string().readonly(),
47
+ message: z.string().readonly().optional(),
48
+ }).readonly(),
49
+ }).readonly(),
50
+ ]);
51
+
52
+ const stateResultSchema = z.union([
53
+ z.object({
54
+ ok: z.literal(true).readonly(),
55
+ value: z.object({
56
+ ghostIds: z.array(sessionIdSchema).readonly(),
57
+ }).readonly(),
58
+ }).readonly(),
59
+ z.object({
60
+ ok: z.literal(false).readonly(),
61
+ error: z.object({
62
+ code: z.string().readonly(),
63
+ message: z.string().readonly().optional(),
64
+ }).readonly(),
65
+ }).readonly(),
66
+ ]);
67
+
68
+ // ---- per-invocation parameter/result schemas -------------------------------
69
+
70
+ const _archiveManager_restore_parameter_0$schema = z.object({
71
+ sessionId: sessionIdSchema,
72
+ });
73
+
74
+ const _archiveManager_delete_parameter_0$schema = z.object({
75
+ sessionId: sessionIdSchema,
76
+ });
77
+
78
+ export const TYPERT = {
79
+ package: "@duke-dsh-plugins/dsh-archive-manager",
80
+ face: "host",
81
+ schemas: [],
82
+ invocations: [
83
+ {
84
+ id: "dsh-archive-manager#archiveManager/restore",
85
+ service: "archiveManager",
86
+ namespace: "archiveManager",
87
+ method: "restore",
88
+ invocation: { kind: "direct" },
89
+ parameters: [
90
+ {
91
+ name: "request",
92
+ wire: "request",
93
+ source: "json",
94
+ codec: {
95
+ mode: "strict",
96
+ typeSymbol: "dsh-archive-manager#ArchiveManagerRestoreRequest",
97
+ schema: _archiveManager_restore_parameter_0$schema,
98
+ },
99
+ },
100
+ ],
101
+ result: {
102
+ mode: "strict",
103
+ typeSymbol: "dsh-archive-manager#ArchiveManagerRestoreResult",
104
+ schema: restoreResultSchema,
105
+ },
106
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
107
+ },
108
+ {
109
+ id: "dsh-archive-manager#archiveManager/delete",
110
+ service: "archiveManager",
111
+ namespace: "archiveManager",
112
+ method: "delete",
113
+ invocation: { kind: "direct" },
114
+ parameters: [
115
+ {
116
+ name: "request",
117
+ wire: "request",
118
+ source: "json",
119
+ codec: {
120
+ mode: "strict",
121
+ typeSymbol: "dsh-archive-manager#ArchiveManagerDeleteRequest",
122
+ schema: _archiveManager_delete_parameter_0$schema,
123
+ },
124
+ },
125
+ ],
126
+ result: {
127
+ mode: "strict",
128
+ typeSymbol: "dsh-archive-manager#ArchiveManagerDeleteResult",
129
+ schema: deleteResultSchema,
130
+ },
131
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
132
+ },
133
+ {
134
+ id: "dsh-archive-manager#archiveManager/state",
135
+ service: "archiveManager",
136
+ namespace: "archiveManager",
137
+ method: "state",
138
+ invocation: { kind: "direct" },
139
+ parameters: [],
140
+ result: {
141
+ mode: "strict",
142
+ typeSymbol: "dsh-archive-manager#ArchiveManagerStateResult",
143
+ schema: stateResultSchema,
144
+ },
145
+ sourceLocation: { file: "index.js", line: 1, column: 1 },
146
+ },
147
+ ],
148
+ model: {
149
+ services: [
150
+ {
151
+ description:
152
+ "Archive manager service: restore, delete and inspect archived sessions for the DeepSeek Harness web UI.",
153
+ summary: "Archive manager service.",
154
+ tags: [],
155
+ jsDoc:
156
+ "/**\n * Archive manager service: restore, delete and inspect archived sessions.\n */",
157
+ key: "archiveManager",
158
+ exportName: "ArchiveManagerService",
159
+ members: [
160
+ {
161
+ kind: "method",
162
+ name: "restore",
163
+ signature:
164
+ "@Remote('restore') async restore(request: ArchiveManagerRestoreRequest): Promise<ArchiveManagerRestoreResult>",
165
+ summary: "Remove one session from the archive set so it returns to its project slot.",
166
+ jsDoc:
167
+ "/**\n * Remove one session from the archive set so it returns to its project slot.\n * @param request - target session id.\n * @returns success or a business failure.\n */",
168
+ },
169
+ {
170
+ kind: "method",
171
+ name: "delete",
172
+ signature:
173
+ "@Remote('delete') async delete(request: ArchiveManagerDeleteRequest): Promise<ArchiveManagerDeleteResult>",
174
+ summary: "Permanently delete one archived session's log directory and clear its archive entry.",
175
+ jsDoc:
176
+ "/**\n * Permanently delete one archived session's log directory and clear its archive\n * entry. Refuses sessions whose agent is running; live-but-idle sessions keep\n * their entry (ghost) until restart.\n * @param request - target session id.\n * @returns success or a business failure.\n */",
177
+ },
178
+ {
179
+ kind: "method",
180
+ name: "state",
181
+ signature:
182
+ "@Remote('state') async state(): Promise<ArchiveManagerStateResult>",
183
+ summary: "Report archived sessions that are live in memory but whose logs are gone.",
184
+ jsDoc:
185
+ "/**\n * Report archived sessions that are still live in memory while their log files\n * no longer exist (ghost records the client hides).\n * @returns the ghost session ids.\n */",
186
+ },
187
+ ],
188
+ types: [
189
+ {
190
+ name: "ArchiveManagerRestoreRequest",
191
+ declaration:
192
+ "export interface ArchiveManagerRestoreRequest {\n readonly sessionId: SessionId;\n}",
193
+ },
194
+ {
195
+ name: "ArchiveManagerRestoreResult",
196
+ declaration:
197
+ "export type ArchiveManagerRestoreResult = { ok: true; value: { restored: true } } | { ok: false; error: { code: string; message?: string } };",
198
+ },
199
+ {
200
+ name: "ArchiveManagerDeleteRequest",
201
+ declaration:
202
+ "export interface ArchiveManagerDeleteRequest {\n readonly sessionId: SessionId;\n}",
203
+ },
204
+ {
205
+ name: "ArchiveManagerDeleteResult",
206
+ declaration:
207
+ "export type ArchiveManagerDeleteResult = { ok: true; value: { fileRemoved: boolean; live: boolean } } | { ok: false; error: { code: string; message?: string } };",
208
+ },
209
+ {
210
+ name: "ArchiveManagerStateResult",
211
+ declaration:
212
+ "export type ArchiveManagerStateResult = { ok: true; value: { ghostIds: readonly SessionId[] } } | { ok: false; error: { code: string; message?: string } };",
213
+ },
214
+ {
215
+ name: "SessionId",
216
+ declaration: "export type SessionId = Branded<'SessionId'>;",
217
+ },
218
+ ],
219
+ },
220
+ ],
221
+ events: [],
222
+ objects: [],
223
+ },
224
+ };