@superdoc/sdk 2.11.0-next.13 → 2.11.0-next.3

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.
@@ -112,7 +112,6 @@ function dispatchIntentTool(toolName, args, execute) {
112
112
  case 'set_row_options': return execute('doc.tables.setRowOptions', rest);
113
113
  case 'insert_column': return execute('doc.tables.insertColumn', rest);
114
114
  case 'delete_column': return execute('doc.tables.deleteColumn', rest);
115
- case 'move_column': return execute('doc.tables.moveColumn', rest);
116
115
  case 'set_column': return execute('doc.tables.setColumnWidth', rest);
117
116
  case 'merge_cells': return execute('doc.tables.mergeCells', rest);
118
117
  case 'unmerge_cells': return execute('doc.tables.unmergeCells', rest);
@@ -110,7 +110,6 @@ export function dispatchIntentTool(toolName, args, execute) {
110
110
  case 'set_row_options': return execute('doc.tables.setRowOptions', rest);
111
111
  case 'insert_column': return execute('doc.tables.insertColumn', rest);
112
112
  case 'delete_column': return execute('doc.tables.deleteColumn', rest);
113
- case 'move_column': return execute('doc.tables.moveColumn', rest);
114
113
  case 'set_column': return execute('doc.tables.setColumnWidth', rest);
115
114
  case 'merge_cells': return execute('doc.tables.mergeCells', rest);
116
115
  case 'unmerge_cells': return execute('doc.tables.unmergeCells', rest);
package/dist/index.cjs CHANGED
@@ -10,7 +10,6 @@ var skills = require('./skills.cjs');
10
10
  var tools = require('./tools.cjs');
11
11
  var intentDispatch_generated = require('./generated/intent-dispatch.generated.cjs');
12
12
  var v2PresetCompat = require('./agent/v2-preset-compat.cjs');
13
- var define = require('./actions/define.cjs');
14
13
  var presets = require('./presets.cjs');
15
14
 
16
15
  // ---------------------------------------------------------------------------
@@ -216,7 +215,6 @@ exports.getToolCatalog = tools.getToolCatalog;
216
215
  exports.listTools = tools.listTools;
217
216
  exports.dispatchIntentTool = intentDispatch_generated.dispatchIntentTool;
218
217
  exports.wrapV2PresetCompat = v2PresetCompat.wrapV2PresetCompat;
219
- exports.defineAction = define.defineAction;
220
218
  exports.DEFAULT_PRESET = presets.DEFAULT_PRESET;
221
219
  exports.getPreset = presets.getPreset;
222
220
  exports.listPresets = presets.listPresets;
package/dist/index.d.ts CHANGED
@@ -98,8 +98,6 @@ export type { AgentReceipt, AgentApplyArgs, AgentVerifyArgs } from './agent/runt
98
98
  export type { GetSystemPromptOptions, GetToolsOptions, GetToolsResult, PresetDescriptor } from './presets.js';
99
99
  export { createAgentToolkit } from './tools.js';
100
100
  export type { AgentToolkit, CreateAgentToolkitInput } from './tools.js';
101
- export { defineAction } from './actions/define.js';
102
- export type { ActionSpec, ActionStep, DefineActionInput, JSONSchemaObject } from './actions/define.js';
103
101
  export { SuperDocCliError } from './runtime/errors.js';
104
102
  export type { CollaborationAuth, DocOpenOptions, InvokeOptions, OperationSpec, OperationParamSpec, RuntimeInvoker, SuperDocClientOptions, } from './runtime/process.js';
105
103
  export type { DocOpenResult } from './generated/client.js';
package/dist/index.js CHANGED
@@ -197,7 +197,4 @@ export { chooseTools, dispatchSuperDocTool, getMcpPrompt, getSystemPrompt, getSy
197
197
  export { dispatchIntentTool } from './generated/intent-dispatch.generated.js';
198
198
  export { wrapV2PresetCompat } from './agent/v2-preset-compat.js';
199
199
  export { createAgentToolkit } from './tools.js';
200
- // Custom-action authoring kit: `defineAction` builds an ActionSpec (steps or
201
- // run tier); hand the specs to `createAgentToolkit({ actions })`.
202
- export { defineAction } from './actions/define.js';
203
200
  export { SuperDocCliError } from './runtime/errors.js';
package/dist/presets.cjs CHANGED
@@ -40,8 +40,8 @@ const BUILTIN_PRESETS = {
40
40
  };
41
41
  /**
42
42
  * Mutable registry, seeded with the built-ins. Customers add their own presets
43
- * via {@link registerPreset} so `getPreset`/`chooseTools` can resolve them
44
- * by id.
43
+ * via {@link registerPreset} (e.g. one produced by `extendPreset` /
44
+ * `composePreset`) so `getPreset`/`chooseTools` can resolve them by id.
45
45
  */
46
46
  const PRESETS = { ...BUILTIN_PRESETS };
47
47
  /** List the IDs of all registered presets. */
package/dist/presets.js CHANGED
@@ -37,8 +37,8 @@ const BUILTIN_PRESETS = {
37
37
  };
38
38
  /**
39
39
  * Mutable registry, seeded with the built-ins. Customers add their own presets
40
- * via {@link registerPreset} so `getPreset`/`chooseTools` can resolve them
41
- * by id.
40
+ * via {@link registerPreset} (e.g. one produced by `extendPreset` /
41
+ * `composePreset`) so `getPreset`/`chooseTools` can resolve them by id.
42
42
  */
43
43
  const PRESETS = { ...BUILTIN_PRESETS };
44
44
  /** List the IDs of all registered presets. */
@@ -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.11.0-next.13';
6
+ const SDK_VERSION = '2.11.0-next.3';
7
7
 
8
8
  exports.SDK_VERSION = SDK_VERSION;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.11.0-next.13";
1
+ export declare const SDK_VERSION = "2.11.0-next.3";
@@ -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.11.0-next.13';
4
+ export const SDK_VERSION = '2.11.0-next.3';
package/dist/tools.cjs CHANGED
@@ -1,8 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var errors = require('./runtime/errors.cjs');
4
3
  var presets = require('./presets.cjs');
5
- var define = require('./actions/define.cjs');
6
4
 
7
5
  /**
8
6
  * Public LLM-tools API. Thin layer over the preset registry — every call here
@@ -97,9 +95,6 @@ function resolvePromptPresetArg(preset) {
97
95
  }
98
96
  return presets.DEFAULT_PRESET;
99
97
  }
100
- /** Label for the ephemeral preset built by the one-call `customActions` path. */
101
- const CUSTOM_TOOLKIT_PRESET_ID = 'custom_superdoc_preset';
102
- const TOOL_PROVIDERS = new Set(['openai', 'anthropic', 'vercel', 'generic']);
103
98
  /**
104
99
  * One-call agent surface: tools, system prompt, and a pre-bound dispatcher
105
100
  * that are coherent BY CONSTRUCTION — the same preset and `excludeActions`
@@ -111,51 +106,8 @@ const TOOL_PROVIDERS = new Set(['openai', 'anthropic', 'vercel', 'generic']);
111
106
  * matching the standalone functions.
112
107
  */
113
108
  async function createAgentToolkit(input) {
114
- const excludeActions = input.excludeActions ? [...input.excludeActions] : undefined;
115
- // One-call custom-actions path: define your actions, hand them here as
116
- // `customActions`, use the
117
- // returned toolkit. We build an ephemeral extended/composed preset over
118
- // `base` (default 'core') and drive it directly — no global registerPreset,
119
- // and nothing for the caller to remember at dispatch time.
120
- //
121
- // An explicit `base` selects this path even with an empty actions list —
122
- // otherwise `{ base: 'core', customActions: [] }` would silently fall through to
123
- // the default (legacy) preset, a different tool family than the one named.
124
- if ((input.customActions && input.customActions.length > 0) || input.includeActions != null || input.base != null) {
125
- // This path builds tools directly (no chooseTools), so it must validate
126
- // the provider itself; an unknown value would otherwise yield a silently
127
- // mixed-dialect tool list. Mirrors the Python `create_agent_toolkit` guard.
128
- if (!TOOL_PROVIDERS.has(input.provider)) {
129
- throw new errors.SuperDocCliError('provider is required.', {
130
- code: 'INVALID_ARGUMENT',
131
- details: { provider: input.provider },
132
- });
133
- }
134
- // `preset` doubles as the base to extend here (so `{ preset: 'core', actions }`
135
- // reads naturally); `base` wins if both are given. Default base is 'core'.
136
- const baseId = input.base ?? input.preset ?? 'core';
137
- const descriptor = define.extendPreset(baseId, {
138
- id: CUSTOM_TOOLKIT_PRESET_ID,
139
- actions: input.customActions ?? [],
140
- ...(input.includeActions != null ? { includeActions: input.includeActions } : {}),
141
- });
142
- const { tools, cacheStrategy } = await descriptor.getTools(input.provider, {
143
- cache: input.cache === true,
144
- excludeActions,
145
- });
146
- const systemPrompt = await descriptor.getSystemPrompt(excludeActions ? { excludeActions } : undefined);
147
- const dispatch = (documentHandle, toolName, args = {}, invokeOptions) => descriptor.dispatch(documentHandle, toolName, args, {
148
- ...invokeOptions,
149
- ...(excludeActions ? { excludeActions } : {}),
150
- });
151
- return {
152
- tools,
153
- meta: { provider: input.provider, preset: descriptor.id, toolCount: tools.length, cacheStrategy },
154
- systemPrompt,
155
- dispatch,
156
- };
157
- }
158
109
  const presetId = input.preset ?? presets.DEFAULT_PRESET;
110
+ const excludeActions = input.excludeActions ? [...input.excludeActions] : undefined;
159
111
  const { tools, meta } = await chooseTools({ ...input, preset: presetId, excludeActions });
160
112
  const systemPrompt = await getSystemPrompt(presetId, excludeActions ? { excludeActions } : undefined);
161
113
  const dispatch = (documentHandle, toolName, args = {}, invokeOptions) => dispatchSuperDocTool(documentHandle, toolName, args, {
package/dist/tools.d.ts CHANGED
@@ -10,7 +10,6 @@
10
10
  import type { BoundDocApi } from './generated/client.js';
11
11
  import type { InvokeOptions } from './runtime/process.js';
12
12
  import { DEFAULT_PRESET, getPreset, listPresets, registerPreset, unregisterPreset, type CacheStrategy, type GetSystemPromptOptions, type ToolCatalog, type ToolCatalogEntry, type ToolCatalogOperation, type ToolProvider } from './presets.js';
13
- import { type ActionSpec } from './actions/define.js';
14
13
  export { DEFAULT_PRESET, getPreset, listPresets, registerPreset, unregisterPreset };
15
14
  export type { CacheStrategy, GetSystemPromptOptions, ToolCatalog, ToolCatalogEntry, ToolCatalogOperation, ToolProvider, };
16
15
  export type ToolChooserInput = {
@@ -99,23 +98,7 @@ export declare function dispatchSuperDocTool(documentHandle: BoundDocApi, toolNa
99
98
  * suitable for embedded LLM usage (OpenAI, Anthropic, Vercel APIs). For MCP
100
99
  * server instructions, use {@link getMcpPrompt} instead.
101
100
  */
102
- export type CreateAgentToolkitInput = ToolChooserInput & {
103
- /**
104
- * Custom actions to expose alongside the base preset's built-ins. When set,
105
- * the toolkit builds the extended preset FOR YOU — no `registerPreset`, no
106
- * preset id to invent or thread through later `dispatch` calls. This is the
107
- * path: define your actions, hand them here, use the returned toolkit.
108
- */
109
- customActions?: readonly ActionSpec[];
110
- /** Base preset to extend on the custom-actions path (default `'core'`). */
111
- base?: string;
112
- /**
113
- * Of the base preset's built-in actions, keep only these (`customActions`
114
- * are always included; `[]` yields a custom-only surface). See
115
- * `ExtendPresetOptions.includeActions`.
116
- */
117
- includeActions?: readonly string[];
118
- };
101
+ export type CreateAgentToolkitInput = ToolChooserInput;
119
102
  export type AgentToolkit = {
120
103
  /** Provider-shaped tool definitions (see {@link chooseTools}). */
121
104
  tools: unknown[];
package/dist/tools.js CHANGED
@@ -7,9 +7,7 @@
7
7
  * "core" tools, prompt-caching variant, lazy-load experiment), register a new
8
8
  * descriptor in `presets.ts` — no changes here required.
9
9
  */
10
- import { SuperDocCliError } from './runtime/errors.js';
11
10
  import { DEFAULT_PRESET, getPreset, listPresets, registerPreset, unregisterPreset, } from './presets.js';
12
- import { extendPreset } from './actions/define.js';
13
11
  export { DEFAULT_PRESET, getPreset, listPresets, registerPreset, unregisterPreset };
14
12
  /**
15
13
  * Select tools for a specific provider from a preset.
@@ -95,9 +93,6 @@ function resolvePromptPresetArg(preset) {
95
93
  }
96
94
  return DEFAULT_PRESET;
97
95
  }
98
- /** Label for the ephemeral preset built by the one-call `customActions` path. */
99
- const CUSTOM_TOOLKIT_PRESET_ID = 'custom_superdoc_preset';
100
- const TOOL_PROVIDERS = new Set(['openai', 'anthropic', 'vercel', 'generic']);
101
96
  /**
102
97
  * One-call agent surface: tools, system prompt, and a pre-bound dispatcher
103
98
  * that are coherent BY CONSTRUCTION — the same preset and `excludeActions`
@@ -109,51 +104,8 @@ const TOOL_PROVIDERS = new Set(['openai', 'anthropic', 'vercel', 'generic']);
109
104
  * matching the standalone functions.
110
105
  */
111
106
  export async function createAgentToolkit(input) {
112
- const excludeActions = input.excludeActions ? [...input.excludeActions] : undefined;
113
- // One-call custom-actions path: define your actions, hand them here as
114
- // `customActions`, use the
115
- // returned toolkit. We build an ephemeral extended/composed preset over
116
- // `base` (default 'core') and drive it directly — no global registerPreset,
117
- // and nothing for the caller to remember at dispatch time.
118
- //
119
- // An explicit `base` selects this path even with an empty actions list —
120
- // otherwise `{ base: 'core', customActions: [] }` would silently fall through to
121
- // the default (legacy) preset, a different tool family than the one named.
122
- if ((input.customActions && input.customActions.length > 0) || input.includeActions != null || input.base != null) {
123
- // This path builds tools directly (no chooseTools), so it must validate
124
- // the provider itself; an unknown value would otherwise yield a silently
125
- // mixed-dialect tool list. Mirrors the Python `create_agent_toolkit` guard.
126
- if (!TOOL_PROVIDERS.has(input.provider)) {
127
- throw new SuperDocCliError('provider is required.', {
128
- code: 'INVALID_ARGUMENT',
129
- details: { provider: input.provider },
130
- });
131
- }
132
- // `preset` doubles as the base to extend here (so `{ preset: 'core', actions }`
133
- // reads naturally); `base` wins if both are given. Default base is 'core'.
134
- const baseId = input.base ?? input.preset ?? 'core';
135
- const descriptor = extendPreset(baseId, {
136
- id: CUSTOM_TOOLKIT_PRESET_ID,
137
- actions: input.customActions ?? [],
138
- ...(input.includeActions != null ? { includeActions: input.includeActions } : {}),
139
- });
140
- const { tools, cacheStrategy } = await descriptor.getTools(input.provider, {
141
- cache: input.cache === true,
142
- excludeActions,
143
- });
144
- const systemPrompt = await descriptor.getSystemPrompt(excludeActions ? { excludeActions } : undefined);
145
- const dispatch = (documentHandle, toolName, args = {}, invokeOptions) => descriptor.dispatch(documentHandle, toolName, args, {
146
- ...invokeOptions,
147
- ...(excludeActions ? { excludeActions } : {}),
148
- });
149
- return {
150
- tools,
151
- meta: { provider: input.provider, preset: descriptor.id, toolCount: tools.length, cacheStrategy },
152
- systemPrompt,
153
- dispatch,
154
- };
155
- }
156
107
  const presetId = input.preset ?? DEFAULT_PRESET;
108
+ const excludeActions = input.excludeActions ? [...input.excludeActions] : undefined;
157
109
  const { tools, meta } = await chooseTools({ ...input, preset: presetId, excludeActions });
158
110
  const systemPrompt = await getSystemPrompt(presetId, excludeActions ? { excludeActions } : undefined);
159
111
  const dispatch = (documentHandle, toolName, args = {}, invokeOptions) => dispatchSuperDocTool(documentHandle, toolName, args, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/sdk",
3
- "version": "2.11.0-next.13",
3
+ "version": "2.11.0-next.3",
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",
@@ -38,11 +38,11 @@
38
38
  "typescript": "^5.9.2"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@superdoc/sdk-darwin-arm64": "2.11.0-next.13",
42
- "@superdoc/sdk-darwin-x64": "2.11.0-next.13",
43
- "@superdoc/sdk-linux-x64": "2.11.0-next.13",
44
- "@superdoc/sdk-linux-arm64": "2.11.0-next.13",
45
- "@superdoc/sdk-windows-x64": "2.11.0-next.13"
41
+ "@superdoc/sdk-darwin-arm64": "2.11.0-next.3",
42
+ "@superdoc/sdk-darwin-x64": "2.11.0-next.3",
43
+ "@superdoc/sdk-linux-x64": "2.11.0-next.3",
44
+ "@superdoc/sdk-linux-arm64": "2.11.0-next.3",
45
+ "@superdoc/sdk-windows-x64": "2.11.0-next.3"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
@@ -51,9 +51,9 @@
51
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",
52
52
  "audit:publish": "node ../../../../scripts/audit-publish-artifact.mjs dist --label sdk-node-dist",
53
53
  "typecheck": "tsc --noEmit",
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 ../../../../tests/consumer-typecheck/src/sdk-custom-actions.mts",
55
- "test:agent-actions": "bun test src/__tests__/actions.test.ts src/__tests__/agent-runtime.test.ts src/__tests__/custom-actions.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 src/__tests__/custom-actions.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",
57
57
  "smoke:product-action": "node scripts/product-action-smoke.mjs"
58
58
  }
59
59
  }