@superdoc/sdk 2.23.0-next.1 → 2.23.0-next.11

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 (38) hide show
  1. package/dist/action-primitives/tools/structure-insert.cjs +3 -5
  2. package/dist/action-primitives/tools/structure-insert.js +3 -5
  3. package/dist/action-primitives/tools/text-transform.cjs +3 -5
  4. package/dist/action-primitives/tools/text-transform.js +3 -5
  5. package/dist/actions/define.cjs +15 -17
  6. package/dist/actions/define.js +1 -3
  7. package/dist/agent/actions.cjs +42 -44
  8. package/dist/agent/actions.js +1 -3
  9. package/dist/agent/operation-catalog.js +0 -4
  10. package/dist/agent/runtime.cjs +7 -9
  11. package/dist/agent/runtime.js +1 -3
  12. package/dist/agent/v2-preset-compat.cjs +5 -7
  13. package/dist/agent/v2-preset-compat.js +1 -3
  14. package/dist/embedded-tools.generated.cjs +5 -5
  15. package/dist/embedded-tools.generated.js +5 -5
  16. package/dist/generated/client.cjs +10 -0
  17. package/dist/generated/client.d.ts +16343 -919
  18. package/dist/generated/client.js +10 -0
  19. package/dist/generated/contract.cjs +1 -1
  20. package/dist/generated/contract.js +1 -1
  21. package/dist/guards.cjs +7 -0
  22. package/dist/guards.d.ts +1 -0
  23. package/dist/guards.js +3 -0
  24. package/dist/presets/core.cjs +10 -12
  25. package/dist/presets/core.js +1 -3
  26. package/dist/presets/legacy.cjs +6 -8
  27. package/dist/presets/legacy.js +1 -3
  28. package/dist/runtime/sdk-version.generated.cjs +1 -1
  29. package/dist/runtime/sdk-version.generated.d.ts +1 -1
  30. package/dist/runtime/sdk-version.generated.js +1 -1
  31. package/package.json +6 -6
  32. package/tools/catalog.json +77 -0
  33. package/tools/generation-receipt.json +17 -17
  34. package/tools/tools-policy.json +1 -1
  35. package/tools/tools.anthropic.json +77 -0
  36. package/tools/tools.generic.json +77 -0
  37. package/tools/tools.openai.json +77 -0
  38. package/tools/tools.vercel.json +77 -0
@@ -7,6 +7,7 @@ var errors = require('../runtime/errors.cjs');
7
7
  var ir = require('./ir.cjs');
8
8
  var docSnapshot = require('./doc-snapshot.cjs');
9
9
  var operationCatalog = require('./operation-catalog.cjs');
10
+ var guards = require('../guards.cjs');
10
11
 
11
12
  const RESERVED_ARG_KEYS = new Set(['sessionId', 'doc']);
12
13
  function ensureKnownOperation(operationId) {
@@ -30,11 +31,8 @@ function ensureClean(args) {
30
31
  }
31
32
  return args;
32
33
  }
33
- function isRecord(value) {
34
- return value != null && typeof value === 'object' && !Array.isArray(value);
35
- }
36
34
  function isRefToken(value) {
37
- return (isRecord(value) &&
35
+ return (guards.isRecord(value) &&
38
36
  typeof value.ref === 'string' &&
39
37
  (value.path == null || typeof value.path === 'string') &&
40
38
  Object.keys(value).every((key) => key === 'ref' || key === 'path'));
@@ -51,7 +49,7 @@ function readBindingPath(value, path) {
51
49
  cursor = cursor[index];
52
50
  continue;
53
51
  }
54
- if (!isRecord(cursor) || !(segment in cursor))
52
+ if (!guards.isRecord(cursor) || !(segment in cursor))
55
53
  return undefined;
56
54
  cursor = cursor[segment];
57
55
  }
@@ -80,7 +78,7 @@ function resolveBindingTokens(value, bindings) {
80
78
  if (Array.isArray(value)) {
81
79
  return value.map((entry) => resolveBindingTokens(entry, bindings));
82
80
  }
83
- if (!isRecord(value))
81
+ if (!guards.isRecord(value))
84
82
  return value;
85
83
  return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, resolveBindingTokens(entry, bindings)]));
86
84
  }
@@ -90,7 +88,7 @@ function extractBoundNodeIds(value) {
90
88
  if (Array.isArray(value)) {
91
89
  return [...new Set(value.flatMap((entry) => extractBoundNodeIds(entry)))];
92
90
  }
93
- if (!isRecord(value))
91
+ if (!guards.isRecord(value))
94
92
  return [];
95
93
  const direct = typeof value.nodeId === 'string' && value.nodeId.length > 0
96
94
  ? [value.nodeId]
@@ -364,7 +362,7 @@ function revisionOnlyParagraphStep(plan) {
364
362
  return undefined;
365
363
  const at = apply.args.at;
366
364
  if (at !== undefined) {
367
- if (!isRecord(at))
365
+ if (!guards.isRecord(at))
368
366
  return undefined;
369
367
  if (at.kind === 'documentStart' || at.kind === 'documentEnd') {
370
368
  if (Object.keys(at).some((key) => key !== 'kind'))
@@ -372,7 +370,7 @@ function revisionOnlyParagraphStep(plan) {
372
370
  }
373
371
  else if (at.kind === 'before' || at.kind === 'after') {
374
372
  if (Object.keys(at).some((key) => key !== 'kind' && key !== 'target') ||
375
- !isRecord(at.target) ||
373
+ !guards.isRecord(at.target) ||
376
374
  at.target.kind !== 'block' ||
377
375
  typeof at.target.nodeId !== 'string' ||
378
376
  typeof at.target.nodeType !== 'string' ||
@@ -5,6 +5,7 @@ import { SuperDocCliError } from '../runtime/errors.js';
5
5
  import { validatePlan } from './ir.js';
6
6
  import { buildDocumentSnapshot, buildMutationSnapshot, resolveSnapshotSelector, AmbiguousSelectorError, } from './doc-snapshot.js';
7
7
  import { getOperationCatalogEntry } from './operation-catalog.js';
8
+ import { isRecord } from '../guards.js';
8
9
  const RESERVED_ARG_KEYS = new Set(['sessionId', 'doc']);
9
10
  function ensureKnownOperation(operationId) {
10
11
  const entry = getOperationCatalogEntry(operationId);
@@ -27,9 +28,6 @@ function ensureClean(args) {
27
28
  }
28
29
  return args;
29
30
  }
30
- function isRecord(value) {
31
- return value != null && typeof value === 'object' && !Array.isArray(value);
32
- }
33
31
  function isRefToken(value) {
34
32
  return (isRecord(value) &&
35
33
  typeof value.ref === 'string' &&
@@ -1,17 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var documentEvidence = require('../runtime/document-evidence.cjs');
4
+ var guards = require('../guards.cjs');
4
5
 
5
6
  const LEGACY_TRACKED_CHANGE_TYPES = {
6
7
  insertion: 'insert',
7
8
  deletion: 'delete',
8
9
  formatting: 'format',
9
10
  };
10
- function isRecord(value) {
11
- return typeof value === 'object' && value !== null;
12
- }
13
11
  function normalizeTrackedChangeItem(item) {
14
- if (!isRecord(item))
12
+ if (!guards.isRecord(item))
15
13
  return item;
16
14
  const type = item.type;
17
15
  if (typeof type !== 'string' || !Object.hasOwn(LEGACY_TRACKED_CHANGE_TYPES, type))
@@ -22,7 +20,7 @@ function normalizeTrackedChangeItem(item) {
22
20
  };
23
21
  }
24
22
  function normalizeTrackedChangeList(result) {
25
- if (!isRecord(result) || !Array.isArray(result.items))
23
+ if (!guards.isRecord(result) || !Array.isArray(result.items))
26
24
  return result;
27
25
  return {
28
26
  ...result,
@@ -30,7 +28,7 @@ function normalizeTrackedChangeList(result) {
30
28
  };
31
29
  }
32
30
  function isThenable(value) {
33
- return isRecord(value) && typeof value.then === 'function';
31
+ return guards.isRecord(value) && typeof value.then === 'function';
34
32
  }
35
33
  function applyNormalization(result, normalize) {
36
34
  return isThenable(result) ? result.then(normalize) : normalize(result);
@@ -43,7 +41,7 @@ function applyNormalization(result, normalize) {
43
41
  */
44
42
  function wrapV2PresetCompat(doc) {
45
43
  const sourceTrackChanges = Reflect.get(doc, 'trackChanges');
46
- if (!isRecord(sourceTrackChanges))
44
+ if (!guards.isRecord(sourceTrackChanges))
47
45
  return doc;
48
46
  const trackChanges = new Proxy(sourceTrackChanges, {
49
47
  get(target, property, receiver) {
@@ -1,12 +1,10 @@
1
1
  import { forwardDocumentEvidence } from '../runtime/document-evidence.js';
2
+ import { isRecord } from '../guards.js';
2
3
  const LEGACY_TRACKED_CHANGE_TYPES = {
3
4
  insertion: 'insert',
4
5
  deletion: 'delete',
5
6
  formatting: 'format',
6
7
  };
7
- function isRecord(value) {
8
- return typeof value === 'object' && value !== null;
9
- }
10
8
  function normalizeTrackedChangeItem(item) {
11
9
  if (!isRecord(item))
12
10
  return item;