@superdoc-dev/sdk 1.19.1 → 1.20.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.
- package/dist/action-primitives/doc-index.cjs +215 -0
- package/dist/action-primitives/doc-index.d.ts +83 -0
- package/dist/action-primitives/doc-index.d.ts.map +1 -0
- package/dist/action-primitives/doc-index.js +211 -0
- package/dist/action-primitives/engine.cjs +204 -0
- package/dist/action-primitives/engine.d.ts +71 -0
- package/dist/action-primitives/engine.d.ts.map +1 -0
- package/dist/action-primitives/engine.js +196 -0
- package/dist/action-primitives/receipt.cjs +39 -0
- package/dist/action-primitives/receipt.d.ts +49 -0
- package/dist/action-primitives/receipt.d.ts.map +1 -0
- package/dist/action-primitives/receipt.js +32 -0
- package/dist/action-primitives/resolve.cjs +252 -0
- package/dist/action-primitives/resolve.d.ts +56 -0
- package/dist/action-primitives/resolve.d.ts.map +1 -0
- package/dist/action-primitives/resolve.js +246 -0
- package/dist/action-primitives/session-cache.cjs +43 -0
- package/dist/action-primitives/session-cache.d.ts +19 -0
- package/dist/action-primitives/session-cache.d.ts.map +1 -0
- package/dist/action-primitives/session-cache.js +37 -0
- package/dist/action-primitives/tools/list-transform.cjs +661 -0
- package/dist/action-primitives/tools/list-transform.d.ts +98 -0
- package/dist/action-primitives/tools/list-transform.d.ts.map +1 -0
- package/dist/action-primitives/tools/list-transform.js +656 -0
- package/dist/action-primitives/tools/structure-insert.cjs +1343 -0
- package/dist/action-primitives/tools/structure-insert.d.ts +183 -0
- package/dist/action-primitives/tools/structure-insert.d.ts.map +1 -0
- package/dist/action-primitives/tools/structure-insert.js +1338 -0
- package/dist/action-primitives/tools/text-transform.cjs +669 -0
- package/dist/action-primitives/tools/text-transform.d.ts +64 -0
- package/dist/action-primitives/tools/text-transform.d.ts.map +1 -0
- package/dist/action-primitives/tools/text-transform.js +664 -0
- package/dist/action-primitives/types.d.ts +36 -0
- package/dist/action-primitives/types.d.ts.map +1 -0
- package/dist/action-primitives/types.js +15 -0
- package/dist/agent/actions.cjs +5381 -0
- package/dist/agent/actions.d.ts +404 -0
- package/dist/agent/actions.d.ts.map +1 -0
- package/dist/agent/actions.js +5373 -0
- package/dist/agent/catalog.cjs +483 -0
- package/dist/agent/catalog.d.ts +103 -0
- package/dist/agent/catalog.d.ts.map +1 -0
- package/dist/agent/catalog.js +471 -0
- package/dist/agent/doc-snapshot.cjs +663 -0
- package/dist/agent/doc-snapshot.d.ts +247 -0
- package/dist/agent/doc-snapshot.d.ts.map +1 -0
- package/dist/agent/doc-snapshot.js +657 -0
- package/dist/agent/index.d.ts +16 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +15 -0
- package/dist/agent/ir.cjs +170 -0
- package/dist/agent/ir.d.ts +216 -0
- package/dist/agent/ir.d.ts.map +1 -0
- package/dist/agent/ir.js +181 -0
- package/dist/agent/operation-catalog.cjs +418 -0
- package/dist/agent/operation-catalog.d.ts +36 -0
- package/dist/agent/operation-catalog.d.ts.map +1 -0
- package/dist/agent/operation-catalog.js +446 -0
- package/dist/agent/runtime.cjs +501 -0
- package/dist/agent/runtime.d.ts +120 -0
- package/dist/agent/runtime.d.ts.map +1 -0
- package/dist/agent/runtime.js +493 -0
- package/dist/embedded-prompts.generated.cjs +13 -0
- package/dist/embedded-prompts.generated.d.ts +4 -0
- package/dist/embedded-prompts.generated.d.ts.map +1 -0
- package/dist/embedded-prompts.generated.js +9 -0
- package/dist/generated/client.cjs +18 -20
- package/dist/generated/client.d.ts +723 -3223
- package/dist/generated/client.d.ts.map +1 -1
- package/dist/generated/client.js +18 -20
- package/dist/generated/contract.cjs +12898 -18467
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +12898 -18467
- package/dist/generated/intent-dispatch.generated.cjs +0 -1
- package/dist/generated/intent-dispatch.generated.d.ts.map +1 -1
- package/dist/generated/intent-dispatch.generated.js +0 -1
- package/dist/index.cjs +3 -7
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/presets/core.cjs +454 -0
- package/dist/presets/core.d.ts +20 -0
- package/dist/presets/core.d.ts.map +1 -0
- package/dist/presets/core.js +447 -0
- package/dist/presets.cjs +55 -8
- package/dist/presets.d.ts +39 -8
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +53 -8
- package/dist/prompts/mcp-prompt.md +23 -0
- package/dist/prompts/system-prompt.md +108 -0
- package/dist/runtime/transport-common.cjs +8 -0
- package/dist/runtime/transport-common.d.ts.map +1 -1
- package/dist/runtime/transport-common.js +8 -0
- package/dist/tools.cjs +46 -11
- package/dist/tools.d.ts +55 -8
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +45 -13
- package/package.json +9 -8
- package/tools/__pycache__/__init__.cpython-312.pyc +0 -0
- package/tools/__pycache__/intent_dispatch_generated.cpython-312.pyc +0 -0
- package/tools/catalog.json +22 -178
- package/tools/intent_dispatch_generated.py +0 -2
- package/tools/tools-policy.json +1 -1
- package/tools/tools.anthropic.json +22 -158
- package/tools/tools.generic.json +23 -160
- package/tools/tools.openai.json +22 -158
- package/tools/tools.vercel.json +22 -158
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var contract = require('../generated/contract.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Operation catalog derived from the generated contract.
|
|
7
|
+
*
|
|
8
|
+
* This module turns every `doc.*` operation in `generated/contract.ts` into a
|
|
9
|
+
* row classified by domain, mutating vs read, target shape, change-mode
|
|
10
|
+
* support, dry-run support, atomicity, verification hints, exposure status,
|
|
11
|
+
* and action eligibility. The classification is built deterministically from
|
|
12
|
+
* the contract so the catalog cannot silently drift out of sync.
|
|
13
|
+
*
|
|
14
|
+
* The catalog is the source of truth used by:
|
|
15
|
+
* - the IR validator (every IR operation must resolve to a catalog row)
|
|
16
|
+
* - anti-overfit gates (tests that assert every generated operation is
|
|
17
|
+
* classified)
|
|
18
|
+
* - holdout-style conformance checks
|
|
19
|
+
*
|
|
20
|
+
* Do not hand-classify operations here. Add rules to the derivation pass.
|
|
21
|
+
*/
|
|
22
|
+
const MUTATING_VERBS = new Set([
|
|
23
|
+
'insert',
|
|
24
|
+
'create',
|
|
25
|
+
'delete',
|
|
26
|
+
'remove',
|
|
27
|
+
'patch',
|
|
28
|
+
'update',
|
|
29
|
+
'set',
|
|
30
|
+
'apply',
|
|
31
|
+
'replace',
|
|
32
|
+
'rewrite',
|
|
33
|
+
'merge',
|
|
34
|
+
'split',
|
|
35
|
+
'attach',
|
|
36
|
+
'detach',
|
|
37
|
+
'rebuild',
|
|
38
|
+
'configure',
|
|
39
|
+
'rename',
|
|
40
|
+
'clear',
|
|
41
|
+
'clearcontent',
|
|
42
|
+
'append',
|
|
43
|
+
'appendcontent',
|
|
44
|
+
'indent',
|
|
45
|
+
'outdent',
|
|
46
|
+
'decide',
|
|
47
|
+
'continueprevious',
|
|
48
|
+
'setlevel',
|
|
49
|
+
'setvalue',
|
|
50
|
+
'settype',
|
|
51
|
+
'setstate',
|
|
52
|
+
'undo',
|
|
53
|
+
'redo',
|
|
54
|
+
'insertlinebreak',
|
|
55
|
+
'inserttab',
|
|
56
|
+
'mutations',
|
|
57
|
+
'commit',
|
|
58
|
+
'rollback',
|
|
59
|
+
'transact',
|
|
60
|
+
]);
|
|
61
|
+
const READ_VERBS = new Set([
|
|
62
|
+
'get',
|
|
63
|
+
'list',
|
|
64
|
+
'find',
|
|
65
|
+
'info',
|
|
66
|
+
'capabilities',
|
|
67
|
+
'extract',
|
|
68
|
+
'gettext',
|
|
69
|
+
'gethtml',
|
|
70
|
+
'getmarkdown',
|
|
71
|
+
'getnode',
|
|
72
|
+
'getnodebyid',
|
|
73
|
+
'diff',
|
|
74
|
+
'history',
|
|
75
|
+
'describe',
|
|
76
|
+
'describecommand',
|
|
77
|
+
'status',
|
|
78
|
+
'query',
|
|
79
|
+
'markdowntofragment',
|
|
80
|
+
'getstate',
|
|
81
|
+
]);
|
|
82
|
+
const SESSION_OP_IDS = new Set(['doc.open', 'doc.close', 'doc.save', 'doc.session']);
|
|
83
|
+
const META_OP_IDS = new Set(['doc.describe', 'doc.describeCommand', 'doc.capabilities.get', 'doc.status']);
|
|
84
|
+
const BENCHMARK_ONLY_HINTS = [
|
|
85
|
+
// Anything we explicitly mark as not for product-default coverage. Empty
|
|
86
|
+
// for now — concrete benchmark surfaces live in profile config, not the
|
|
87
|
+
// contract-derived catalog.
|
|
88
|
+
];
|
|
89
|
+
function tokensFromOperationId(operationId) {
|
|
90
|
+
return operationId.split('.').slice(1);
|
|
91
|
+
}
|
|
92
|
+
function lastToken(operationId) {
|
|
93
|
+
const tokens = tokensFromOperationId(operationId);
|
|
94
|
+
return (tokens[tokens.length - 1] ?? '').toLowerCase();
|
|
95
|
+
}
|
|
96
|
+
function deriveDomain(operationId) {
|
|
97
|
+
const tokens = tokensFromOperationId(operationId);
|
|
98
|
+
const first = (tokens[0] ?? '').toLowerCase();
|
|
99
|
+
switch (first) {
|
|
100
|
+
case 'open':
|
|
101
|
+
case 'close':
|
|
102
|
+
case 'save':
|
|
103
|
+
case 'session':
|
|
104
|
+
return 'session';
|
|
105
|
+
case 'describe':
|
|
106
|
+
case 'describecommand':
|
|
107
|
+
case 'capabilities':
|
|
108
|
+
case 'status':
|
|
109
|
+
return 'meta';
|
|
110
|
+
case 'gettext':
|
|
111
|
+
case 'getmarkdown':
|
|
112
|
+
case 'gethtml':
|
|
113
|
+
case 'getnode':
|
|
114
|
+
case 'getnodebyid':
|
|
115
|
+
case 'info':
|
|
116
|
+
case 'extract':
|
|
117
|
+
case 'find':
|
|
118
|
+
case 'markdowntofragment':
|
|
119
|
+
return 'document-read';
|
|
120
|
+
case 'create':
|
|
121
|
+
// create.* domain-specific; classify by sub-domain
|
|
122
|
+
switch ((tokens[1] ?? '').toLowerCase()) {
|
|
123
|
+
case 'table':
|
|
124
|
+
return 'tables';
|
|
125
|
+
case 'image':
|
|
126
|
+
return 'images';
|
|
127
|
+
case 'paragraph':
|
|
128
|
+
case 'heading':
|
|
129
|
+
case 'sectionbreak':
|
|
130
|
+
case 'tableofcontents':
|
|
131
|
+
return 'blocks';
|
|
132
|
+
default:
|
|
133
|
+
return 'document-write';
|
|
134
|
+
}
|
|
135
|
+
case 'blocks':
|
|
136
|
+
return 'blocks';
|
|
137
|
+
case 'text':
|
|
138
|
+
case 'replace':
|
|
139
|
+
case 'delete':
|
|
140
|
+
case 'insert':
|
|
141
|
+
case 'insertlinebreak':
|
|
142
|
+
case 'inserttab':
|
|
143
|
+
case 'clearcontent':
|
|
144
|
+
return 'text';
|
|
145
|
+
case 'format':
|
|
146
|
+
return 'format';
|
|
147
|
+
case 'styles':
|
|
148
|
+
return 'styles';
|
|
149
|
+
case 'lists':
|
|
150
|
+
return 'lists';
|
|
151
|
+
case 'tables':
|
|
152
|
+
return 'tables';
|
|
153
|
+
case 'images':
|
|
154
|
+
return 'images';
|
|
155
|
+
case 'comments':
|
|
156
|
+
return 'comments';
|
|
157
|
+
case 'trackchanges':
|
|
158
|
+
return 'tracked-changes';
|
|
159
|
+
case 'sections':
|
|
160
|
+
return 'sections';
|
|
161
|
+
case 'fields':
|
|
162
|
+
return 'fields';
|
|
163
|
+
case 'hyperlinks':
|
|
164
|
+
return 'hyperlinks';
|
|
165
|
+
case 'bookmarks':
|
|
166
|
+
return 'bookmarks';
|
|
167
|
+
case 'crossrefs':
|
|
168
|
+
return 'cross-refs';
|
|
169
|
+
case 'footnotes':
|
|
170
|
+
return 'footnotes';
|
|
171
|
+
case 'headerfooters':
|
|
172
|
+
return 'header-footer';
|
|
173
|
+
case 'contentcontrols':
|
|
174
|
+
return 'content-controls';
|
|
175
|
+
case 'permissionranges':
|
|
176
|
+
return 'permission-ranges';
|
|
177
|
+
case 'protection':
|
|
178
|
+
return 'protection';
|
|
179
|
+
case 'toc':
|
|
180
|
+
return 'toc';
|
|
181
|
+
case 'authorities':
|
|
182
|
+
return 'authorities';
|
|
183
|
+
case 'captions':
|
|
184
|
+
return 'captions';
|
|
185
|
+
case 'citations':
|
|
186
|
+
return 'citations';
|
|
187
|
+
case 'mutations':
|
|
188
|
+
return 'mutations';
|
|
189
|
+
case 'selection':
|
|
190
|
+
return 'selection';
|
|
191
|
+
case 'history':
|
|
192
|
+
return 'history';
|
|
193
|
+
case 'index':
|
|
194
|
+
return 'index';
|
|
195
|
+
case 'query':
|
|
196
|
+
return 'query';
|
|
197
|
+
case 'ranges':
|
|
198
|
+
return 'ranges';
|
|
199
|
+
case 'diff':
|
|
200
|
+
return 'diff';
|
|
201
|
+
case 'get':
|
|
202
|
+
return 'document-read';
|
|
203
|
+
default:
|
|
204
|
+
return 'document-write';
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function deriveMode(operationId, entry) {
|
|
208
|
+
if (SESSION_OP_IDS.has(operationId))
|
|
209
|
+
return 'session';
|
|
210
|
+
const last = lastToken(operationId);
|
|
211
|
+
if (READ_VERBS.has(last))
|
|
212
|
+
return 'read';
|
|
213
|
+
if (entry?.mutates === true)
|
|
214
|
+
return 'write';
|
|
215
|
+
if (MUTATING_VERBS.has(last))
|
|
216
|
+
return 'write';
|
|
217
|
+
// Operations that don't end with a mutating verb but still mutate (e.g.
|
|
218
|
+
// doc.replace, doc.delete) are caught by the verb sets above or by the
|
|
219
|
+
// generated contract's `mutates` flag; the rest default to read.
|
|
220
|
+
if (last === 'replace' || last === 'delete' || last === 'insert')
|
|
221
|
+
return 'write';
|
|
222
|
+
return 'read';
|
|
223
|
+
}
|
|
224
|
+
function deriveTargetShape(operationId) {
|
|
225
|
+
const tokens = tokensFromOperationId(operationId).map((t) => t.toLowerCase());
|
|
226
|
+
if (tokens.length === 0)
|
|
227
|
+
return 'document';
|
|
228
|
+
if (tokens[0] === 'blocks')
|
|
229
|
+
return 'block';
|
|
230
|
+
if (tokens[0] === 'tables')
|
|
231
|
+
return 'table';
|
|
232
|
+
if (tokens[0] === 'lists')
|
|
233
|
+
return 'list';
|
|
234
|
+
if (tokens[0] === 'images')
|
|
235
|
+
return 'image';
|
|
236
|
+
if (tokens[0] === 'comments')
|
|
237
|
+
return 'comment';
|
|
238
|
+
if (tokens[0] === 'sections' || tokens[0] === 'headerfooters')
|
|
239
|
+
return 'document';
|
|
240
|
+
if (tokens[0] === 'find' || tokens[0] === 'query')
|
|
241
|
+
return 'range';
|
|
242
|
+
if (tokens[0] === 'selection' || tokens[0] === 'ranges')
|
|
243
|
+
return 'range';
|
|
244
|
+
if (tokens[0] === 'mutations')
|
|
245
|
+
return 'mixed';
|
|
246
|
+
if (tokens[0] === 'create')
|
|
247
|
+
return 'document';
|
|
248
|
+
if (tokens[0] === 'trackchanges' ||
|
|
249
|
+
tokens[0] === 'bookmarks' ||
|
|
250
|
+
tokens[0] === 'hyperlinks' ||
|
|
251
|
+
tokens[0] === 'crossrefs' ||
|
|
252
|
+
tokens[0] === 'footnotes' ||
|
|
253
|
+
tokens[0] === 'fields' ||
|
|
254
|
+
tokens[0] === 'permissionranges' ||
|
|
255
|
+
tokens[0] === 'contentcontrols' ||
|
|
256
|
+
tokens[0] === 'captions' ||
|
|
257
|
+
tokens[0] === 'authorities' ||
|
|
258
|
+
tokens[0] === 'citations') {
|
|
259
|
+
return 'entity';
|
|
260
|
+
}
|
|
261
|
+
if (tokens[0] === 'format' || tokens[0] === 'styles')
|
|
262
|
+
return 'range';
|
|
263
|
+
if (tokens[0] === 'index')
|
|
264
|
+
return 'document';
|
|
265
|
+
return 'none';
|
|
266
|
+
}
|
|
267
|
+
function hasParam(params, name) {
|
|
268
|
+
if (!params)
|
|
269
|
+
return false;
|
|
270
|
+
return params.some((p) => p?.name === name);
|
|
271
|
+
}
|
|
272
|
+
function deriveSupportsChangeMode(entry) {
|
|
273
|
+
return hasParam(entry.params, 'changeMode');
|
|
274
|
+
}
|
|
275
|
+
function deriveSupportsDryRun(entry) {
|
|
276
|
+
return hasParam(entry.params, 'dryRun');
|
|
277
|
+
}
|
|
278
|
+
function deriveAtomic(operationId, entry) {
|
|
279
|
+
// All mutating operations are atomic by contract: each operation either
|
|
280
|
+
// succeeds end-to-end or fails. doc.mutations.apply is the only batched
|
|
281
|
+
// form and is explicitly atomic when its `atomic` flag is set.
|
|
282
|
+
if (operationId === 'doc.mutations.apply')
|
|
283
|
+
return hasParam(entry.params, 'atomic');
|
|
284
|
+
return deriveMode(operationId, entry) === 'write';
|
|
285
|
+
}
|
|
286
|
+
function deriveVerificationHints(operationId) {
|
|
287
|
+
const domain = deriveDomain(operationId);
|
|
288
|
+
const hints = [];
|
|
289
|
+
switch (domain) {
|
|
290
|
+
case 'blocks':
|
|
291
|
+
case 'text':
|
|
292
|
+
hints.push('reread-block-text', 'verify-revision');
|
|
293
|
+
break;
|
|
294
|
+
case 'tables':
|
|
295
|
+
hints.push('reread-table-shape', 'verify-cell-text');
|
|
296
|
+
break;
|
|
297
|
+
case 'lists':
|
|
298
|
+
hints.push('reread-list-items', 'verify-list-count');
|
|
299
|
+
break;
|
|
300
|
+
case 'images':
|
|
301
|
+
hints.push('reread-image-anchor', 'verify-image-id');
|
|
302
|
+
break;
|
|
303
|
+
case 'comments':
|
|
304
|
+
hints.push('list-comments', 'verify-anchor-text');
|
|
305
|
+
break;
|
|
306
|
+
case 'tracked-changes':
|
|
307
|
+
hints.push('list-tracked-changes', 'verify-counts');
|
|
308
|
+
break;
|
|
309
|
+
case 'format':
|
|
310
|
+
case 'styles':
|
|
311
|
+
hints.push('reread-resolved-style', 'verify-revision');
|
|
312
|
+
break;
|
|
313
|
+
case 'sections':
|
|
314
|
+
case 'header-footer':
|
|
315
|
+
hints.push('reread-section-shape', 'save-reopen');
|
|
316
|
+
break;
|
|
317
|
+
case 'protection':
|
|
318
|
+
case 'permission-ranges':
|
|
319
|
+
hints.push('save-reopen', 'verify-xml-shape');
|
|
320
|
+
break;
|
|
321
|
+
case 'document-write':
|
|
322
|
+
case 'mutations':
|
|
323
|
+
hints.push('verify-revision', 'verify-text-snapshot');
|
|
324
|
+
break;
|
|
325
|
+
default:
|
|
326
|
+
hints.push('verify-revision');
|
|
327
|
+
}
|
|
328
|
+
return hints;
|
|
329
|
+
}
|
|
330
|
+
function deriveStoryHints(entry) {
|
|
331
|
+
const hints = [];
|
|
332
|
+
if (hasParam(entry.params, 'in'))
|
|
333
|
+
hints.push('story-scoped');
|
|
334
|
+
if (hasParam(entry.params, 'story'))
|
|
335
|
+
hints.push('story-scoped');
|
|
336
|
+
if (hasParam(entry.params, 'sectionId'))
|
|
337
|
+
hints.push('section-scoped');
|
|
338
|
+
return hints;
|
|
339
|
+
}
|
|
340
|
+
function deriveDomainHints(entry) {
|
|
341
|
+
const hints = new Set();
|
|
342
|
+
for (const param of entry.params ?? []) {
|
|
343
|
+
if (!param?.name)
|
|
344
|
+
continue;
|
|
345
|
+
if (param.name === 'changeMode')
|
|
346
|
+
hints.add('change-mode');
|
|
347
|
+
if (param.name === 'dryRun')
|
|
348
|
+
hints.add('dry-run');
|
|
349
|
+
if (param.name === 'atomic')
|
|
350
|
+
hints.add('atomic-batch');
|
|
351
|
+
if (param.name === 'force')
|
|
352
|
+
hints.add('force-allowed');
|
|
353
|
+
if (param.name === 'preserveStyle')
|
|
354
|
+
hints.add('preserve-style');
|
|
355
|
+
if (param.name === 'caseSensitive')
|
|
356
|
+
hints.add('case-sensitive');
|
|
357
|
+
}
|
|
358
|
+
if (typeof entry.category === 'string') {
|
|
359
|
+
hints.add(`category:${entry.category}`);
|
|
360
|
+
}
|
|
361
|
+
return [...hints];
|
|
362
|
+
}
|
|
363
|
+
function deriveExposure(operationId) {
|
|
364
|
+
if (META_OP_IDS.has(operationId))
|
|
365
|
+
return 'internal';
|
|
366
|
+
if (BENCHMARK_ONLY_HINTS.includes(operationId))
|
|
367
|
+
return 'benchmark-only';
|
|
368
|
+
if (operationId.startsWith('doc.session.'))
|
|
369
|
+
return 'internal';
|
|
370
|
+
return 'stable';
|
|
371
|
+
}
|
|
372
|
+
function deriveActionEligible(operationId) {
|
|
373
|
+
if (SESSION_OP_IDS.has(operationId))
|
|
374
|
+
return false;
|
|
375
|
+
if (META_OP_IDS.has(operationId))
|
|
376
|
+
return false;
|
|
377
|
+
if (deriveExposure(operationId) === 'internal')
|
|
378
|
+
return false;
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
function classifyEntry(operationId, entry) {
|
|
382
|
+
const mode = deriveMode(operationId, entry);
|
|
383
|
+
return {
|
|
384
|
+
operationId,
|
|
385
|
+
domain: deriveDomain(operationId),
|
|
386
|
+
mode,
|
|
387
|
+
isMutating: mode === 'write',
|
|
388
|
+
targetShape: deriveTargetShape(operationId),
|
|
389
|
+
storyHints: deriveStoryHints(entry),
|
|
390
|
+
domainHints: deriveDomainHints(entry),
|
|
391
|
+
supportsChangeMode: deriveSupportsChangeMode(entry),
|
|
392
|
+
supportsDryRun: deriveSupportsDryRun(entry),
|
|
393
|
+
atomic: deriveAtomic(operationId, entry),
|
|
394
|
+
verificationHints: deriveVerificationHints(operationId),
|
|
395
|
+
exposure: deriveExposure(operationId),
|
|
396
|
+
actionEligible: deriveActionEligible(operationId),
|
|
397
|
+
description: typeof entry.description === 'string'
|
|
398
|
+
? entry.description
|
|
399
|
+
: '',
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function buildCatalog() {
|
|
403
|
+
const entries = [];
|
|
404
|
+
for (const [operationId, entry] of Object.entries(contract.CONTRACT.operations)) {
|
|
405
|
+
entries.push(classifyEntry(operationId, entry));
|
|
406
|
+
}
|
|
407
|
+
entries.sort((a, b) => a.operationId.localeCompare(b.operationId));
|
|
408
|
+
return entries;
|
|
409
|
+
}
|
|
410
|
+
/** Full operation catalog derived from the generated contract. */
|
|
411
|
+
const OPERATION_CATALOG = Object.freeze(buildCatalog());
|
|
412
|
+
const CATALOG_BY_ID = new Map(OPERATION_CATALOG.map((entry) => [entry.operationId, entry]));
|
|
413
|
+
function getOperationCatalogEntry(operationId) {
|
|
414
|
+
return CATALOG_BY_ID.get(operationId);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
exports.OPERATION_CATALOG = OPERATION_CATALOG;
|
|
418
|
+
exports.getOperationCatalogEntry = getOperationCatalogEntry;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type OperationDomain = 'session' | 'meta' | 'document-read' | 'document-write' | 'blocks' | 'text' | 'format' | 'styles' | 'lists' | 'tables' | 'images' | 'comments' | 'tracked-changes' | 'sections' | 'fields' | 'hyperlinks' | 'bookmarks' | 'cross-refs' | 'footnotes' | 'header-footer' | 'content-controls' | 'permission-ranges' | 'protection' | 'toc' | 'authorities' | 'captions' | 'citations' | 'mutations' | 'selection' | 'history' | 'index' | 'query' | 'ranges' | 'diff';
|
|
2
|
+
export type OperationMode = 'read' | 'write' | 'session';
|
|
3
|
+
export type TargetShape = 'none' | 'block' | 'range' | 'entity' | 'paragraph' | 'table' | 'list' | 'document' | 'image' | 'comment' | 'mixed';
|
|
4
|
+
export type ExposureStatus = 'stable' | 'experimental' | 'benchmark-only' | 'internal';
|
|
5
|
+
export type OperationCatalogEntry = {
|
|
6
|
+
operationId: string;
|
|
7
|
+
domain: OperationDomain;
|
|
8
|
+
mode: OperationMode;
|
|
9
|
+
isMutating: boolean;
|
|
10
|
+
targetShape: TargetShape;
|
|
11
|
+
storyHints: readonly string[];
|
|
12
|
+
domainHints: readonly string[];
|
|
13
|
+
supportsChangeMode: boolean;
|
|
14
|
+
supportsDryRun: boolean;
|
|
15
|
+
atomic: boolean;
|
|
16
|
+
verificationHints: readonly string[];
|
|
17
|
+
exposure: ExposureStatus;
|
|
18
|
+
actionEligible: boolean;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
/** Full operation catalog derived from the generated contract. */
|
|
22
|
+
export declare const OPERATION_CATALOG: readonly OperationCatalogEntry[];
|
|
23
|
+
export declare function getOperationCatalogEntry(operationId: string): OperationCatalogEntry | undefined;
|
|
24
|
+
export declare function listOperationsByDomain(domain: OperationDomain): readonly OperationCatalogEntry[];
|
|
25
|
+
export declare function listMutatingOperations(): readonly OperationCatalogEntry[];
|
|
26
|
+
/** Returns operations that are classified but have no specific verification hint other than verify-revision. */
|
|
27
|
+
export declare function listOperationsMissingStructuralVerification(): readonly OperationCatalogEntry[];
|
|
28
|
+
export declare function getOperationCatalogSummary(): {
|
|
29
|
+
total: number;
|
|
30
|
+
byDomain: Record<string, number>;
|
|
31
|
+
byMode: Record<string, number>;
|
|
32
|
+
byExposure: Record<string, number>;
|
|
33
|
+
mutatingCount: number;
|
|
34
|
+
actionEligibleCount: number;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=operation-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-catalog.d.ts","sourceRoot":"","sources":["../../src/agent/operation-catalog.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,MAAM,GACN,eAAe,GACf,gBAAgB,GAChB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,eAAe,GACf,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,KAAK,GACL,aAAa,GACb,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,WAAW,GACX,OAAO,GACP,MAAM,GACN,UAAU,GACV,OAAO,GACP,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,cAAc,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAEvF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAyXF,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,EAAE,SAAS,qBAAqB,EAAkC,CAAC;AAMjG,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAE/F;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,qBAAqB,EAAE,CAEhG;AAED,wBAAgB,sBAAsB,IAAI,SAAS,qBAAqB,EAAE,CAEzE;AAED,gHAAgH;AAChH,wBAAgB,2CAA2C,IAAI,SAAS,qBAAqB,EAAE,CAK9F;AAED,wBAAgB,0BAA0B,IAAI;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAqBA"}
|