@superdoc/sdk 2.10.0-next.7 → 2.10.0-next.8
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/README.md +45 -0
- package/dist/action-primitives/doc-index.cjs +6 -4
- package/dist/action-primitives/doc-index.js +6 -4
- package/dist/action-primitives/engine.cjs +6 -2
- package/dist/action-primitives/engine.js +6 -2
- package/dist/action-primitives/receipt.d.ts +4 -0
- package/dist/action-primitives/tools/structure-insert.d.ts +1 -1
- package/dist/agent/actions.cjs +203 -223
- package/dist/agent/actions.d.ts +5 -0
- package/dist/agent/actions.js +203 -223
- package/dist/agent/catalog.cjs +15 -0
- package/dist/agent/catalog.js +15 -0
- package/dist/agent/doc-snapshot.cjs +22 -46
- package/dist/agent/doc-snapshot.js +22 -46
- package/dist/agent/execution-context.cjs +385 -0
- package/dist/agent/execution-context.d.ts +97 -0
- package/dist/agent/execution-context.js +376 -0
- package/dist/agent/runtime.cjs +116 -158
- package/dist/agent/runtime.d.ts +3 -0
- package/dist/agent/runtime.js +117 -159
- package/dist/agent/v2-preset-compat.cjs +5 -1
- package/dist/agent/v2-preset-compat.js +4 -1
- package/dist/embedded-tools.generated.cjs +5 -5
- package/dist/embedded-tools.generated.js +5 -5
- package/dist/generated/client.cjs +2 -0
- package/dist/generated/client.d.ts +47 -0
- package/dist/generated/client.js +2 -0
- package/dist/generated/contract.cjs +1600 -1296
- package/dist/generated/contract.js +1600 -1296
- package/dist/index.cjs +11 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +11 -0
- package/dist/presets/core.cjs +1 -1
- package/dist/presets/core.js +1 -1
- package/dist/runtime/document-evidence.cjs +40 -0
- package/dist/runtime/document-evidence.d.ts +13 -0
- package/dist/runtime/document-evidence.js +30 -0
- package/dist/runtime/host.cjs +30 -2
- package/dist/runtime/host.d.ts +2 -0
- package/dist/runtime/host.js +30 -2
- package/dist/runtime/process.cjs +6 -0
- package/dist/runtime/process.d.ts +2 -0
- package/dist/runtime/process.js +6 -0
- package/dist/runtime/sdk-version.generated.cjs +1 -1
- package/dist/runtime/sdk-version.generated.d.ts +1 -1
- package/dist/runtime/sdk-version.generated.js +1 -1
- package/package.json +10 -9
- package/tools/catalog.json +35 -0
- package/tools/tools-policy.json +1 -1
- package/tools/tools.anthropic.json +35 -0
- package/tools/tools.generic.json +35 -0
- package/tools/tools.openai.json +35 -0
- package/tools/tools.vercel.json +35 -0
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var documentEvidence = require('./runtime/document-evidence.cjs');
|
|
3
4
|
var client = require('./generated/client.cjs');
|
|
4
5
|
var contract = require('./generated/contract.cjs');
|
|
5
6
|
var process = require('./runtime/process.cjs');
|
|
@@ -46,6 +47,14 @@ class BoundRuntime {
|
|
|
46
47
|
}
|
|
47
48
|
return this.runtime.replaceFile(this.sessionId, source, options);
|
|
48
49
|
}
|
|
50
|
+
supportsDocumentFacts() {
|
|
51
|
+
return !this.closed && this.runtime.supportsDocumentFacts(this.sessionId);
|
|
52
|
+
}
|
|
53
|
+
async readRevision() {
|
|
54
|
+
if (this.closed)
|
|
55
|
+
throw new errors.SuperDocCliError('Document handle is closed; cannot read its revision.', { code: 'DOCUMENT_CLOSED' });
|
|
56
|
+
return this.runtime.readDocumentRevision(this.sessionId);
|
|
57
|
+
}
|
|
49
58
|
markClosed() {
|
|
50
59
|
this.closed = true;
|
|
51
60
|
}
|
|
@@ -70,6 +79,8 @@ class SuperDocDocumentCore {
|
|
|
70
79
|
this._openResult = openResult;
|
|
71
80
|
this.client = client$1;
|
|
72
81
|
attachBoundDocApi(this, client.createBoundDocApi(this.boundRuntime));
|
|
82
|
+
documentEvidence.registerDocumentRevisionReader(this, () => this.boundRuntime.readRevision());
|
|
83
|
+
documentEvidence.registerDocumentFactCapability(this, () => this.boundRuntime.supportsDocumentFacts());
|
|
73
84
|
}
|
|
74
85
|
get sessionId() {
|
|
75
86
|
return this._sessionId;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ declare class BoundRuntime implements RuntimeInvoker {
|
|
|
13
13
|
constructor(runtime: SuperDocRuntime, sessionId: string);
|
|
14
14
|
invoke<TData = unknown>(operation: OperationSpec, params?: Record<string, unknown>, options?: InvokeOptions): Promise<TData>;
|
|
15
15
|
replaceFile(source: ReplaceFileSource, options?: ReplaceFileOptions): Promise<ReplaceFileResult>;
|
|
16
|
+
supportsDocumentFacts(): boolean;
|
|
17
|
+
readRevision(): Promise<string | undefined>;
|
|
16
18
|
markClosed(): void;
|
|
17
19
|
}
|
|
18
20
|
export interface DocFormatRangeBoundParams extends Omit<DocFormatApplyBoundParams, 'inline'> {
|
|
@@ -92,7 +94,7 @@ export { dispatchIntentTool } from './generated/intent-dispatch.generated.js';
|
|
|
92
94
|
export { wrapV2PresetCompat } from './agent/v2-preset-compat.js';
|
|
93
95
|
export type { BoundDocApi } from './generated/client.js';
|
|
94
96
|
export type { ActionName } from './agent/actions.js';
|
|
95
|
-
export type { AgentReceipt } from './agent/runtime.js';
|
|
97
|
+
export type { AgentReceipt, AgentApplyArgs, AgentVerifyArgs } from './agent/runtime.js';
|
|
96
98
|
export type { GetSystemPromptOptions, GetToolsOptions, GetToolsResult, PresetDescriptor } from './presets.js';
|
|
97
99
|
export { createAgentToolkit } from './tools.js';
|
|
98
100
|
export type { AgentToolkit, CreateAgentToolkitInput } from './tools.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerDocumentRevisionReader, registerDocumentFactCapability } from './runtime/document-evidence.js';
|
|
1
2
|
import { createDocApi, createBoundDocApi, } from './generated/client.js';
|
|
2
3
|
import { CONTRACT } from './generated/contract.js';
|
|
3
4
|
import { SuperDocRuntime, } from './runtime/process.js';
|
|
@@ -38,6 +39,14 @@ class BoundRuntime {
|
|
|
38
39
|
}
|
|
39
40
|
return this.runtime.replaceFile(this.sessionId, source, options);
|
|
40
41
|
}
|
|
42
|
+
supportsDocumentFacts() {
|
|
43
|
+
return !this.closed && this.runtime.supportsDocumentFacts(this.sessionId);
|
|
44
|
+
}
|
|
45
|
+
async readRevision() {
|
|
46
|
+
if (this.closed)
|
|
47
|
+
throw new SuperDocCliError('Document handle is closed; cannot read its revision.', { code: 'DOCUMENT_CLOSED' });
|
|
48
|
+
return this.runtime.readDocumentRevision(this.sessionId);
|
|
49
|
+
}
|
|
41
50
|
markClosed() {
|
|
42
51
|
this.closed = true;
|
|
43
52
|
}
|
|
@@ -62,6 +71,8 @@ class SuperDocDocumentCore {
|
|
|
62
71
|
this._openResult = openResult;
|
|
63
72
|
this.client = client;
|
|
64
73
|
attachBoundDocApi(this, createBoundDocApi(this.boundRuntime));
|
|
74
|
+
registerDocumentRevisionReader(this, () => this.boundRuntime.readRevision());
|
|
75
|
+
registerDocumentFactCapability(this, () => this.boundRuntime.supportsDocumentFacts());
|
|
65
76
|
}
|
|
66
77
|
get sessionId() {
|
|
67
78
|
return this._sessionId;
|
package/dist/presets/core.cjs
CHANGED
|
@@ -245,7 +245,7 @@ function compactAgentReceipt(receipt) {
|
|
|
245
245
|
: {}),
|
|
246
246
|
...(verification
|
|
247
247
|
? {
|
|
248
|
-
verificationPassed: verification.every((entry) => entry.passed),
|
|
248
|
+
verificationPassed: verification.length > 0 && verification.every((entry) => entry.passed),
|
|
249
249
|
verification: verification.map((entry) => ({
|
|
250
250
|
check: pickScalarFields(entry.check, undefined, 6),
|
|
251
251
|
passed: entry.passed,
|
package/dist/presets/core.js
CHANGED
|
@@ -241,7 +241,7 @@ function compactAgentReceipt(receipt) {
|
|
|
241
241
|
: {}),
|
|
242
242
|
...(verification
|
|
243
243
|
? {
|
|
244
|
-
verificationPassed: verification.every((entry) => entry.passed),
|
|
244
|
+
verificationPassed: verification.length > 0 && verification.every((entry) => entry.passed),
|
|
245
245
|
verification: verification.map((entry) => ({
|
|
246
246
|
check: pickScalarFields(entry.check, undefined, 6),
|
|
247
247
|
passed: entry.passed,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const mutationRevisions = new WeakMap();
|
|
4
|
+
function registerMutationRevision(result, revision) {
|
|
5
|
+
if (result && typeof result === 'object')
|
|
6
|
+
mutationRevisions.set(result, revision);
|
|
7
|
+
}
|
|
8
|
+
function getMutationRevision(result) {
|
|
9
|
+
return result && typeof result === 'object' ? mutationRevisions.get(result) : undefined;
|
|
10
|
+
}
|
|
11
|
+
// Keep transport capabilities off the public document API and tied to the live
|
|
12
|
+
// handle. Undefined means unsupported, never a cached or unknown revision.
|
|
13
|
+
const revisionReaders = new WeakMap();
|
|
14
|
+
function registerDocumentRevisionReader(document, reader) {
|
|
15
|
+
revisionReaders.set(document, reader);
|
|
16
|
+
}
|
|
17
|
+
function getDocumentRevisionReader(document) {
|
|
18
|
+
return revisionReaders.get(document);
|
|
19
|
+
}
|
|
20
|
+
const factCapabilities = new WeakMap();
|
|
21
|
+
function registerDocumentFactCapability(document, supported) {
|
|
22
|
+
factCapabilities.set(document, supported);
|
|
23
|
+
}
|
|
24
|
+
function supportsDocumentFacts(document) {
|
|
25
|
+
return factCapabilities.get(document)?.() === true;
|
|
26
|
+
}
|
|
27
|
+
function forwardDocumentEvidence(source, target) {
|
|
28
|
+
const reader = getDocumentRevisionReader(source);
|
|
29
|
+
if (reader)
|
|
30
|
+
registerDocumentRevisionReader(target, reader);
|
|
31
|
+
registerDocumentFactCapability(target, () => supportsDocumentFacts(source));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.forwardDocumentEvidence = forwardDocumentEvidence;
|
|
35
|
+
exports.getDocumentRevisionReader = getDocumentRevisionReader;
|
|
36
|
+
exports.getMutationRevision = getMutationRevision;
|
|
37
|
+
exports.registerDocumentFactCapability = registerDocumentFactCapability;
|
|
38
|
+
exports.registerDocumentRevisionReader = registerDocumentRevisionReader;
|
|
39
|
+
exports.registerMutationRevision = registerMutationRevision;
|
|
40
|
+
exports.supportsDocumentFacts = supportsDocumentFacts;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type RevisionReader = () => Promise<string | undefined>;
|
|
2
|
+
type MutationRevision = {
|
|
3
|
+
before: string;
|
|
4
|
+
after: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function registerMutationRevision(result: unknown, revision: MutationRevision): void;
|
|
7
|
+
export declare function getMutationRevision(result: unknown): MutationRevision | undefined;
|
|
8
|
+
export declare function registerDocumentRevisionReader(document: object, reader: RevisionReader): void;
|
|
9
|
+
export declare function getDocumentRevisionReader(document: object): RevisionReader | undefined;
|
|
10
|
+
export declare function registerDocumentFactCapability(document: object, supported: () => boolean): void;
|
|
11
|
+
export declare function supportsDocumentFacts(document: object): boolean;
|
|
12
|
+
export declare function forwardDocumentEvidence(source: object, target: object): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const mutationRevisions = new WeakMap();
|
|
2
|
+
export function registerMutationRevision(result, revision) {
|
|
3
|
+
if (result && typeof result === 'object')
|
|
4
|
+
mutationRevisions.set(result, revision);
|
|
5
|
+
}
|
|
6
|
+
export function getMutationRevision(result) {
|
|
7
|
+
return result && typeof result === 'object' ? mutationRevisions.get(result) : undefined;
|
|
8
|
+
}
|
|
9
|
+
// Keep transport capabilities off the public document API and tied to the live
|
|
10
|
+
// handle. Undefined means unsupported, never a cached or unknown revision.
|
|
11
|
+
const revisionReaders = new WeakMap();
|
|
12
|
+
export function registerDocumentRevisionReader(document, reader) {
|
|
13
|
+
revisionReaders.set(document, reader);
|
|
14
|
+
}
|
|
15
|
+
export function getDocumentRevisionReader(document) {
|
|
16
|
+
return revisionReaders.get(document);
|
|
17
|
+
}
|
|
18
|
+
const factCapabilities = new WeakMap();
|
|
19
|
+
export function registerDocumentFactCapability(document, supported) {
|
|
20
|
+
factCapabilities.set(document, supported);
|
|
21
|
+
}
|
|
22
|
+
export function supportsDocumentFacts(document) {
|
|
23
|
+
return factCapabilities.get(document)?.() === true;
|
|
24
|
+
}
|
|
25
|
+
export function forwardDocumentEvidence(source, target) {
|
|
26
|
+
const reader = getDocumentRevisionReader(source);
|
|
27
|
+
if (reader)
|
|
28
|
+
registerDocumentRevisionReader(target, reader);
|
|
29
|
+
registerDocumentFactCapability(target, () => supportsDocumentFacts(source));
|
|
30
|
+
}
|
package/dist/runtime/host.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var node_child_process = require('node:child_process');
|
|
|
4
4
|
var node_readline = require('node:readline');
|
|
5
5
|
var transportCommon = require('./transport-common.cjs');
|
|
6
6
|
var errors = require('./errors.cjs');
|
|
7
|
+
var documentEvidence = require('./document-evidence.cjs');
|
|
7
8
|
var documentRpc = require('./document-rpc.cjs');
|
|
8
9
|
|
|
9
10
|
const HOST_PROTOCOL_VERSION = '1.0';
|
|
@@ -130,6 +131,28 @@ class HostTransport {
|
|
|
130
131
|
async connect() {
|
|
131
132
|
await this.runWhileActive(() => this.ensureConnected());
|
|
132
133
|
}
|
|
134
|
+
supportsDocumentFacts(sessionId) {
|
|
135
|
+
return (this.documentRpcSessions.has(sessionId) &&
|
|
136
|
+
this.hostFeatures.has('document.currentRevision') &&
|
|
137
|
+
this.hostFeatures.has('document.executionFacts') &&
|
|
138
|
+
this.hostFeatures.has('document.mutationRevision'));
|
|
139
|
+
}
|
|
140
|
+
async readDocumentRevision(sessionId) {
|
|
141
|
+
return this.runWhileActive(async () => {
|
|
142
|
+
if (!this.documentRpcSessions.has(sessionId) || !this.hostFeatures.has('document.currentRevision')) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
await this.ensureConnected();
|
|
146
|
+
const revision = await this.sendJsonRpcRequest('document.currentRevision', { sessionId }, this.resolveWatchdogTimeout(undefined), { requestTimeoutMs: this.resolveDocumentRequestTimeout(undefined) });
|
|
147
|
+
if (typeof revision !== 'string' || revision.trim().length === 0 || revision === 'unknown') {
|
|
148
|
+
throw new errors.SuperDocCliError('Document host returned an invalid current revision.', {
|
|
149
|
+
code: 'HOST_PROTOCOL_ERROR',
|
|
150
|
+
details: { sessionId },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return revision;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
133
156
|
async dispose() {
|
|
134
157
|
if (this.disposePromise)
|
|
135
158
|
return this.disposePromise;
|
|
@@ -268,12 +291,17 @@ class HostTransport {
|
|
|
268
291
|
? request.params.options
|
|
269
292
|
: undefined;
|
|
270
293
|
const tracksMutation = request.method === 'document.invoke' && documentOperation.mutates === true && requestOptions?.dryRun !== true;
|
|
294
|
+
const includeRevision = request.method === 'document.invoke' &&
|
|
295
|
+
documentOperation.mutates === true &&
|
|
296
|
+
this.hostFeatures.has('document.mutationRevision');
|
|
271
297
|
if (tracksMutation)
|
|
272
298
|
this.beginDocumentRpcMutation(sessionId);
|
|
273
299
|
let result;
|
|
274
300
|
try {
|
|
275
|
-
const response = await this.sendJsonRpcRequest(request.method, request.params, this.resolveWatchdogTimeout(options.timeoutMs), { requestTimeoutMs });
|
|
276
|
-
result = documentRpc.mapDocumentLifecycleResult(operation.operationId, response, sessionId, operation.operationId === 'doc.save' ? request.params.path === undefined : undefined);
|
|
301
|
+
const response = await this.sendJsonRpcRequest(request.method, { ...request.params, ...(includeRevision ? { includeRevision: true } : {}) }, this.resolveWatchdogTimeout(options.timeoutMs), { requestTimeoutMs });
|
|
302
|
+
result = documentRpc.mapDocumentLifecycleResult(operation.operationId, includeRevision ? response.result : response, sessionId, operation.operationId === 'doc.save' ? request.params.path === undefined : undefined);
|
|
303
|
+
if (includeRevision)
|
|
304
|
+
documentEvidence.registerMutationRevision(result, response.revision);
|
|
277
305
|
}
|
|
278
306
|
catch (error) {
|
|
279
307
|
if (tracksMutation) {
|
package/dist/runtime/host.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export declare class HostTransport {
|
|
|
61
61
|
processMode?: 'cli' | 'document';
|
|
62
62
|
} & SuperDocClientOptions);
|
|
63
63
|
connect(): Promise<void>;
|
|
64
|
+
supportsDocumentFacts(sessionId: string): boolean;
|
|
65
|
+
readDocumentRevision(sessionId: string): Promise<string | undefined>;
|
|
64
66
|
dispose(): Promise<void>;
|
|
65
67
|
private disposeAfterActiveCalls;
|
|
66
68
|
invoke<TData = unknown>(operation: OperationSpec, params?: Record<string, unknown>, options?: TransportInvokeOptions): Promise<TData>;
|
package/dist/runtime/host.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { createInterface } from 'node:readline';
|
|
3
3
|
import { buildOperationArgv, normalizeCollaborationAuth, resolveInvocation, } from './transport-common.js';
|
|
4
4
|
import { SuperDocCliError } from './errors.js';
|
|
5
|
+
import { registerMutationRevision } from './document-evidence.js';
|
|
5
6
|
import { DOCUMENT_RPC_FEATURES, DOCUMENT_RPC_DEFAULT_CHANGE_MODE_FEATURE, DOCUMENT_RPC_REQUEST_TIMEOUT_FEATURE, DOCUMENT_RPC_REPLACE_FILE_FEATURE, DOCUMENT_RPC_SOURCE_SAVE_FEATURE, buildDocumentInvokeParams, buildDocumentOpenParams, canOpenWithDocumentRpc, documentRpcRequestSupportsResponseTimeout, documentRpcEnabled, mapDocumentLifecycleResult, mapDocumentOpenResult, mapDocumentReplaceFileResult, supportsDocumentRpc, } from './document-rpc.js';
|
|
6
7
|
const HOST_PROTOCOL_VERSION = '1.0';
|
|
7
8
|
const CLI_HOST_REQUIRED_FEATURES = ['cli.invoke', 'host.shutdown'];
|
|
@@ -127,6 +128,28 @@ export class HostTransport {
|
|
|
127
128
|
async connect() {
|
|
128
129
|
await this.runWhileActive(() => this.ensureConnected());
|
|
129
130
|
}
|
|
131
|
+
supportsDocumentFacts(sessionId) {
|
|
132
|
+
return (this.documentRpcSessions.has(sessionId) &&
|
|
133
|
+
this.hostFeatures.has('document.currentRevision') &&
|
|
134
|
+
this.hostFeatures.has('document.executionFacts') &&
|
|
135
|
+
this.hostFeatures.has('document.mutationRevision'));
|
|
136
|
+
}
|
|
137
|
+
async readDocumentRevision(sessionId) {
|
|
138
|
+
return this.runWhileActive(async () => {
|
|
139
|
+
if (!this.documentRpcSessions.has(sessionId) || !this.hostFeatures.has('document.currentRevision')) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
await this.ensureConnected();
|
|
143
|
+
const revision = await this.sendJsonRpcRequest('document.currentRevision', { sessionId }, this.resolveWatchdogTimeout(undefined), { requestTimeoutMs: this.resolveDocumentRequestTimeout(undefined) });
|
|
144
|
+
if (typeof revision !== 'string' || revision.trim().length === 0 || revision === 'unknown') {
|
|
145
|
+
throw new SuperDocCliError('Document host returned an invalid current revision.', {
|
|
146
|
+
code: 'HOST_PROTOCOL_ERROR',
|
|
147
|
+
details: { sessionId },
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return revision;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
130
153
|
async dispose() {
|
|
131
154
|
if (this.disposePromise)
|
|
132
155
|
return this.disposePromise;
|
|
@@ -265,12 +288,17 @@ export class HostTransport {
|
|
|
265
288
|
? request.params.options
|
|
266
289
|
: undefined;
|
|
267
290
|
const tracksMutation = request.method === 'document.invoke' && documentOperation.mutates === true && requestOptions?.dryRun !== true;
|
|
291
|
+
const includeRevision = request.method === 'document.invoke' &&
|
|
292
|
+
documentOperation.mutates === true &&
|
|
293
|
+
this.hostFeatures.has('document.mutationRevision');
|
|
268
294
|
if (tracksMutation)
|
|
269
295
|
this.beginDocumentRpcMutation(sessionId);
|
|
270
296
|
let result;
|
|
271
297
|
try {
|
|
272
|
-
const response = await this.sendJsonRpcRequest(request.method, request.params, this.resolveWatchdogTimeout(options.timeoutMs), { requestTimeoutMs });
|
|
273
|
-
result = mapDocumentLifecycleResult(operation.operationId, response, sessionId, operation.operationId === 'doc.save' ? request.params.path === undefined : undefined);
|
|
298
|
+
const response = await this.sendJsonRpcRequest(request.method, { ...request.params, ...(includeRevision ? { includeRevision: true } : {}) }, this.resolveWatchdogTimeout(options.timeoutMs), { requestTimeoutMs });
|
|
299
|
+
result = mapDocumentLifecycleResult(operation.operationId, includeRevision ? response.result : response, sessionId, operation.operationId === 'doc.save' ? request.params.path === undefined : undefined);
|
|
300
|
+
if (includeRevision)
|
|
301
|
+
registerMutationRevision(result, response.revision);
|
|
274
302
|
}
|
|
275
303
|
catch (error) {
|
|
276
304
|
if (tracksMutation) {
|
package/dist/runtime/process.cjs
CHANGED
|
@@ -57,6 +57,12 @@ class SuperDocRuntime {
|
|
|
57
57
|
async connect() {
|
|
58
58
|
await this.transport.connect();
|
|
59
59
|
}
|
|
60
|
+
supportsDocumentFacts(sessionId) {
|
|
61
|
+
return this.transport.supportsDocumentFacts(sessionId);
|
|
62
|
+
}
|
|
63
|
+
async readDocumentRevision(sessionId) {
|
|
64
|
+
return this.transport.readDocumentRevision(sessionId);
|
|
65
|
+
}
|
|
60
66
|
async dispose() {
|
|
61
67
|
await this.transport.dispose();
|
|
62
68
|
}
|
|
@@ -32,6 +32,8 @@ export declare class SuperDocRuntime {
|
|
|
32
32
|
private readonly transport;
|
|
33
33
|
constructor(options?: SuperDocClientOptions);
|
|
34
34
|
connect(): Promise<void>;
|
|
35
|
+
supportsDocumentFacts(sessionId: string): boolean;
|
|
36
|
+
readDocumentRevision(sessionId: string): Promise<string | undefined>;
|
|
35
37
|
dispose(): Promise<void>;
|
|
36
38
|
invoke<TData = unknown>(operation: OperationSpec, params?: Record<string, unknown>, options?: TransportInvokeOptions): Promise<TData>;
|
|
37
39
|
replaceFile(sessionId: string, source: ReplaceFileSource, options?: ReplaceFileOptions): Promise<ReplaceFileResult>;
|
package/dist/runtime/process.js
CHANGED
|
@@ -54,6 +54,12 @@ export class SuperDocRuntime {
|
|
|
54
54
|
async connect() {
|
|
55
55
|
await this.transport.connect();
|
|
56
56
|
}
|
|
57
|
+
supportsDocumentFacts(sessionId) {
|
|
58
|
+
return this.transport.supportsDocumentFacts(sessionId);
|
|
59
|
+
}
|
|
60
|
+
async readDocumentRevision(sessionId) {
|
|
61
|
+
return this.transport.readDocumentRevision(sessionId);
|
|
62
|
+
}
|
|
57
63
|
async dispose() {
|
|
58
64
|
await this.transport.dispose();
|
|
59
65
|
}
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
// AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
|
|
4
4
|
// Source of truth: package.json. Regenerated on every SDK build so the
|
|
5
5
|
// SDK retains its own version identity when bundled into another package.
|
|
6
|
-
const SDK_VERSION = '2.10.0-next.
|
|
6
|
+
const SDK_VERSION = '2.10.0-next.8';
|
|
7
7
|
|
|
8
8
|
exports.SDK_VERSION = SDK_VERSION;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.10.0-next.
|
|
1
|
+
export declare const SDK_VERSION = "2.10.0-next.8";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
|
|
2
2
|
// Source of truth: package.json. Regenerated on every SDK build so the
|
|
3
3
|
// SDK retains its own version identity when bundled into another package.
|
|
4
|
-
export const SDK_VERSION = '2.10.0-next.
|
|
4
|
+
export const SDK_VERSION = '2.10.0-next.8';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc/sdk",
|
|
3
|
-
"version": "2.10.0-next.
|
|
3
|
+
"version": "2.10.0-next.8",
|
|
4
4
|
"description": "Node SDK for SuperDoc, wrapping the SuperDoc CLI to read and edit .docx files from JavaScript and TypeScript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -33,15 +33,16 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/bun": "^1.3.8",
|
|
35
35
|
"@types/node": "22.19.2",
|
|
36
|
+
"jszip": "3.10.1",
|
|
36
37
|
"rollup": "^4.31.0",
|
|
37
38
|
"typescript": "^5.9.2"
|
|
38
39
|
},
|
|
39
40
|
"optionalDependencies": {
|
|
40
|
-
"@superdoc/sdk-darwin-arm64": "2.10.0-next.
|
|
41
|
-
"@superdoc/sdk-darwin-x64": "2.10.0-next.
|
|
42
|
-
"@superdoc/sdk-linux-x64": "2.10.0-next.
|
|
43
|
-
"@superdoc/sdk-linux-arm64": "2.10.0-next.
|
|
44
|
-
"@superdoc/sdk-windows-x64": "2.10.0-next.
|
|
41
|
+
"@superdoc/sdk-darwin-arm64": "2.10.0-next.8",
|
|
42
|
+
"@superdoc/sdk-darwin-x64": "2.10.0-next.8",
|
|
43
|
+
"@superdoc/sdk-linux-x64": "2.10.0-next.8",
|
|
44
|
+
"@superdoc/sdk-linux-arm64": "2.10.0-next.8",
|
|
45
|
+
"@superdoc/sdk-windows-x64": "2.10.0-next.8"
|
|
45
46
|
},
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|
|
@@ -50,9 +51,9 @@
|
|
|
50
51
|
"build": "rm -rf dist && node scripts/embed-version.mjs && node scripts/embed-prompts.mjs && node scripts/embed-tools.mjs && tsc && pnpm run typecheck:consumer && rollup -c rollup.cjs.config.mjs && rm -rf dist/prompts && mkdir -p dist/prompts && cp src/prompts/*.md dist/prompts/ && pnpm run audit:publish",
|
|
51
52
|
"audit:publish": "node ../../../../scripts/audit-publish-artifact.mjs dist --label sdk-node-dist",
|
|
52
53
|
"typecheck": "tsc --noEmit",
|
|
53
|
-
"typecheck:consumer": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module NodeNext --moduleResolution NodeNext ../../../../tests/consumer-typecheck/src/sdk-per-open-collaboration-auth.mts ../../../../tests/consumer-typecheck/src/sdk-replace-file.mts",
|
|
54
|
-
"test:agent-actions": "bun test src/__tests__/actions.test.ts",
|
|
55
|
-
"test:document-host": "bun test src/runtime/__tests__/host-spawn-args.test.ts src/runtime/__tests__/document-rpc.test.ts src/__tests__/structured-document-rpc.e2e.test.ts src/__tests__/request-timeout-ms.e2e.test.ts",
|
|
54
|
+
"typecheck:consumer": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module NodeNext --moduleResolution NodeNext ../../../../tests/consumer-typecheck/src/sdk-per-open-collaboration-auth.mts ../../../../tests/consumer-typecheck/src/sdk-replace-file.mts ../../../../tests/consumer-typecheck/src/sdk-agent-evidence.mts",
|
|
55
|
+
"test:agent-actions": "bun test src/__tests__/actions.test.ts src/__tests__/agent-runtime.test.ts",
|
|
56
|
+
"test:document-host": "bun test src/runtime/__tests__/host-spawn-args.test.ts src/runtime/__tests__/document-rpc.test.ts src/__tests__/structured-document-rpc.e2e.test.ts src/__tests__/request-timeout-ms.e2e.test.ts src/__tests__/agent-evidence.e2e.test.ts src/__tests__/agent-apply.e2e.test.ts src/__tests__/find-text.e2e.test.ts",
|
|
56
57
|
"smoke:product-action": "node scripts/product-action-smoke.mjs"
|
|
57
58
|
}
|
|
58
59
|
}
|
package/tools/catalog.json
CHANGED
|
@@ -43,6 +43,41 @@
|
|
|
43
43
|
"type": "boolean",
|
|
44
44
|
"description": "Only for actions 'markdown_projection', 'html_projection'. Omit for other actions."
|
|
45
45
|
},
|
|
46
|
+
"nodeIds": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"description": "Top-level block identities to match before pagination. Only for action 'blocks'. Omit for other actions."
|
|
53
|
+
},
|
|
54
|
+
"textSearch": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"terms": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"minItems": 1,
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"match": {
|
|
66
|
+
"enum": [
|
|
67
|
+
"all",
|
|
68
|
+
"any"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"caseSensitive": {
|
|
72
|
+
"type": "boolean"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": [
|
|
77
|
+
"terms"
|
|
78
|
+
],
|
|
79
|
+
"description": "Only for action 'blocks'. Omit for other actions."
|
|
80
|
+
},
|
|
46
81
|
"offset": {
|
|
47
82
|
"type": "number",
|
|
48
83
|
"minimum": 0,
|
package/tools/tools-policy.json
CHANGED
|
@@ -41,6 +41,41 @@
|
|
|
41
41
|
"type": "boolean",
|
|
42
42
|
"description": "Only for actions 'markdown_projection', 'html_projection'. Omit for other actions."
|
|
43
43
|
},
|
|
44
|
+
"nodeIds": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
},
|
|
50
|
+
"description": "Top-level block identities to match before pagination. Only for action 'blocks'. Omit for other actions."
|
|
51
|
+
},
|
|
52
|
+
"textSearch": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"terms": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"minItems": 1,
|
|
58
|
+
"items": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"minLength": 1
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"match": {
|
|
64
|
+
"enum": [
|
|
65
|
+
"all",
|
|
66
|
+
"any"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"caseSensitive": {
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": [
|
|
75
|
+
"terms"
|
|
76
|
+
],
|
|
77
|
+
"description": "Only for action 'blocks'. Omit for other actions."
|
|
78
|
+
},
|
|
44
79
|
"offset": {
|
|
45
80
|
"type": "number",
|
|
46
81
|
"minimum": 0,
|
package/tools/tools.generic.json
CHANGED
|
@@ -41,6 +41,41 @@
|
|
|
41
41
|
"type": "boolean",
|
|
42
42
|
"description": "Only for actions 'markdown_projection', 'html_projection'. Omit for other actions."
|
|
43
43
|
},
|
|
44
|
+
"nodeIds": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
},
|
|
50
|
+
"description": "Top-level block identities to match before pagination. Only for action 'blocks'. Omit for other actions."
|
|
51
|
+
},
|
|
52
|
+
"textSearch": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"terms": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"minItems": 1,
|
|
58
|
+
"items": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"minLength": 1
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"match": {
|
|
64
|
+
"enum": [
|
|
65
|
+
"all",
|
|
66
|
+
"any"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"caseSensitive": {
|
|
70
|
+
"type": "boolean"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": [
|
|
75
|
+
"terms"
|
|
76
|
+
],
|
|
77
|
+
"description": "Only for action 'blocks'. Omit for other actions."
|
|
78
|
+
},
|
|
44
79
|
"offset": {
|
|
45
80
|
"type": "number",
|
|
46
81
|
"minimum": 0,
|
package/tools/tools.openai.json
CHANGED
|
@@ -43,6 +43,41 @@
|
|
|
43
43
|
"type": "boolean",
|
|
44
44
|
"description": "Only for actions 'markdown_projection', 'html_projection'. Omit for other actions."
|
|
45
45
|
},
|
|
46
|
+
"nodeIds": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"description": "Top-level block identities to match before pagination. Only for action 'blocks'. Omit for other actions."
|
|
53
|
+
},
|
|
54
|
+
"textSearch": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"terms": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"minItems": 1,
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"match": {
|
|
66
|
+
"enum": [
|
|
67
|
+
"all",
|
|
68
|
+
"any"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"caseSensitive": {
|
|
72
|
+
"type": "boolean"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": [
|
|
77
|
+
"terms"
|
|
78
|
+
],
|
|
79
|
+
"description": "Only for action 'blocks'. Omit for other actions."
|
|
80
|
+
},
|
|
46
81
|
"offset": {
|
|
47
82
|
"type": "number",
|
|
48
83
|
"minimum": 0,
|
package/tools/tools.vercel.json
CHANGED
|
@@ -43,6 +43,41 @@
|
|
|
43
43
|
"type": "boolean",
|
|
44
44
|
"description": "Only for actions 'markdown_projection', 'html_projection'. Omit for other actions."
|
|
45
45
|
},
|
|
46
|
+
"nodeIds": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"description": "Top-level block identities to match before pagination. Only for action 'blocks'. Omit for other actions."
|
|
53
|
+
},
|
|
54
|
+
"textSearch": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"terms": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"minItems": 1,
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"match": {
|
|
66
|
+
"enum": [
|
|
67
|
+
"all",
|
|
68
|
+
"any"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"caseSensitive": {
|
|
72
|
+
"type": "boolean"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": [
|
|
77
|
+
"terms"
|
|
78
|
+
],
|
|
79
|
+
"description": "Only for action 'blocks'. Omit for other actions."
|
|
80
|
+
},
|
|
46
81
|
"offset": {
|
|
47
82
|
"type": "number",
|
|
48
83
|
"minimum": 0,
|