@shop-on/theme-contract 0.6.0 → 0.7.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/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/ops.d.ts +41 -0
- package/dist/ops.js +12 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockDefinition, BlockSchema, CLOSEST_RESOURCES, ClosestOverlays, ClosestResource, LayoutGroupDef, ProviderDecl, Provides, SchemaSetting, SectionGroup, SectionGroupData, SectionPreset, SectionSchema, SettingBinding, SettingBindings, SettingValue, SettingsData, SettingsSchema, SettingsSchemaSection, THEME_FED, Template, TemplateBlock, TemplateSection } from "./schemas.js";
|
|
2
|
-
import { EntryDoc, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, Op, OpBatch, OpBatchBody, OpBatchBodySchema, OpReset, OpSchema, ThemeDocument, TouchedEntries, applyOps, chunkOps, diffDocument, invertOps, touchedEntries } from "./ops.js";
|
|
2
|
+
import { Container, EntryDoc, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, Op, OpBatch, OpBatchBody, OpBatchBodySchema, OpReset, OpSchema, PathShape, TabOpBatchBodySchema, ThemeDocument, TouchedEntries, agentClientId, applyOps, chunkOps, diffDocument, invertOps, isAgentClientId, shapeOf, touchedEntries } from "./ops.js";
|
|
3
3
|
import { ClosestScope, PICKER_RESOURCES, Providers, ScopeLink, closestScopeAt, providersOf } from "./closest-scope.js";
|
|
4
4
|
import { RICHTEXT_ALLOWED_TAGS, RICHTEXT_FIELD_TAGS, RICHTEXT_SANITIZE_CONFIG, RichTextPurifier, RichtextTag, hasRichText, registerRichTextHooks, stripInlineTokenSentinels } from "./richtext.js";
|
|
5
5
|
import { BLOCK_PATH_SEPARATOR, blockPathsEqual, isBlockPathPrefix, joinBlockPath, normalizeBlockPath, resolveContainerAtPath, splitBlockPath } from "./block-path.js";
|
|
@@ -18,4 +18,4 @@ import { NormalizedUrl, normalizeCustomUrl } from "./link-url.js";
|
|
|
18
18
|
import { VideoProvider, isAcceptedVideoUrl, parseVideoUrl } from "./video-url.js";
|
|
19
19
|
import { GOOGLE_FONTS, GoogleFontEntry } from "./google-fonts.generated.js";
|
|
20
20
|
import { SYSTEM_FONT_FAMILIES, isCatalogFontFamily } from "./fonts.js";
|
|
21
|
-
export { APP_BLOCK_WILDCARD, ARTICLE_ATTRIBUTE_KEYS, ArticleAttributeKey, BLOCK_PATH_SEPARATOR, BLOG_ATTRIBUTE_KEYS, BlockDefinition, BlockSchema, BlogAttributeKey, CLOSEST_RESOURCES, COLLECTION_ATTRIBUTE_KEYS, COLLECTION_INLINE_ATTRIBUTE_KEYS, ClosestItemSources, ClosestLookup, ClosestOverlays, ClosestResource, ClosestScope, CollectedTypes, CollectionAttributeBindingSources, CollectionAttributeKey, CollectionInlineAttributeKey, DRAFT_SEEDED_KEY, EDITOR_COMMANDS, EditorCommand, EditorKeyInput, EntryDoc, FieldSource, GOOGLE_FONTS, type GoogleFontEntry, INSTALL_ID_RE, InlineSegment, InlineSources, LayoutGroupDef, MAX_APP_BLOCK_CONTAINER_DEPTH, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_BLOCKS_PER_TEMPLATE, MAX_BLOCK_NESTING_DEPTH, MAX_ENTRY_BYTES, MAX_PALETTE_COLORS, MAX_PATH_DEPTH, MAX_SECTIONS_PER_TEMPLATE, MAX_SEGMENT_LENGTH, MIN_PALETTE_COLORS, NormalizedUrl, Op, OpBatch, OpBatchBody, OpBatchBodySchema, OpReset, OpSchema, PAGE_ATTRIBUTE_KEYS, PALETTE_FALLBACK_COLOR, PALETTE_GROUP_TYPE, PALETTE_PREFIX, PALETTE_REF_PREFIX, PICKER_RESOURCES, PRODUCT_ATTRIBUTE_KEYS, PageAttributeKey, PaletteColor, ProductAttributeKey, ProviderDecl, Providers, Provides, RESOURCE_METAFIELD_SOURCES, RICHTEXT_ALLOWED_TAGS, RICHTEXT_FIELD_TAGS, RICHTEXT_SANITIZE_CONFIG, ROUTE_METAFIELD_RESOURCE, ROUTE_METAFIELD_SOURCES, ResolverCtx, ResolverScope, ResolverShape, ResolverSpec, ResourceMetafieldBinding, ResourceMetafieldSource, RichTextPurifier, RichtextTag, RouteMetafieldSource, SKIP, STORE_SLUG_RE, SYSTEM_FONT_FAMILIES, SchemaSetting, ScopeLink, SectionGroup, SectionGroupData, SectionPreset, SectionSchema, SeedMissingStaticsReport, SelectedSection, SettingBinding, SettingBindings, SettingValue, SettingsData, SettingsSchema, SettingsSchemaSection, Skip, THEME_FED, Template, TemplateBlock, TemplateSection, TemplateShape, ThemeDocument, TouchedEntries, VideoProvider, WholeValueBindingOpts, acceptsAppBlocks, allowedChildBlockTypes, applyClosestBindings, applyCollectionAttributeBindings, applyInlineSources, applyMetafieldBindings, applyMetaobjectFieldBindings, applyOps, blockPathsEqual, buildBlockInstance, buildDisabledAncestorSet, buildParentMap, buildSectionInstance, buildStaticChildren, chunkOps, closestResourceOf, closestScopeAt, collectCollectionAttributeBindings, collectMetaobjectEntryIds, collectTraversedEntryIds, collectTypes, comparePaletteIds, countBlocksInBlock, countNestedBlocks, decodeStorefrontMetafield, defaultSettings, diffDocument, editorCommand, encodeSourceToken, escapeInertHtmlText, hasPaletteRefs, hasRichText, invalidTemplateId, invertOps, isAcceptedVideoUrl, isBlockPathPrefix, isCatalogFontFamily, isClosestSink, isEditorCommand, isNodeIdToken, isResourceMetafieldBinding, isResourceMetafieldSource, isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, joinBlockPath, maxBlockDepth, maxDepthOfBlock, maxDepthOfBlockSchema, metafieldDefinitionFitsSetting, metafieldTypeSupportsInlineToken, metafieldTypeToSettingTypes, metaobjectGid, metaobjectIdFromGid, nodeGid, nodeSourceDescriptors, normalizeBlockPath, normalizeCustomUrl, paletteKey, paletteRef, paletteValues, parsePalette, parsePaletteRef, parseSourceDescriptor, parseVideoUrl, providersOf, registerRichTextHooks, resolveContainerAtPath, resolveField, resolvePaletteRefs, resolvePaletteValue, resolveThemeSettingsPalette, routeTwin, seedMissingStatics, selectRenderableChildren, selectRenderableSections, serializeSourceDescriptor, settingTypeSupportsBinding, shortcutKey, splitBlockPath, splitInlineTokens, staticBlockId, staticChildId, stripInlineTokenSentinels, stripStaticFromBlockOrder, templateCounts, templateMatches, templateReferencesSource, touchedEntries, undoHotkey, walkBlocks, walkSections };
|
|
21
|
+
export { APP_BLOCK_WILDCARD, ARTICLE_ATTRIBUTE_KEYS, ArticleAttributeKey, BLOCK_PATH_SEPARATOR, BLOG_ATTRIBUTE_KEYS, BlockDefinition, BlockSchema, BlogAttributeKey, CLOSEST_RESOURCES, COLLECTION_ATTRIBUTE_KEYS, COLLECTION_INLINE_ATTRIBUTE_KEYS, ClosestItemSources, ClosestLookup, ClosestOverlays, ClosestResource, ClosestScope, CollectedTypes, CollectionAttributeBindingSources, CollectionAttributeKey, CollectionInlineAttributeKey, Container, DRAFT_SEEDED_KEY, EDITOR_COMMANDS, EditorCommand, EditorKeyInput, EntryDoc, FieldSource, GOOGLE_FONTS, type GoogleFontEntry, INSTALL_ID_RE, InlineSegment, InlineSources, LayoutGroupDef, MAX_APP_BLOCK_CONTAINER_DEPTH, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_BLOCKS_PER_TEMPLATE, MAX_BLOCK_NESTING_DEPTH, MAX_ENTRY_BYTES, MAX_PALETTE_COLORS, MAX_PATH_DEPTH, MAX_SECTIONS_PER_TEMPLATE, MAX_SEGMENT_LENGTH, MIN_PALETTE_COLORS, NormalizedUrl, Op, OpBatch, OpBatchBody, OpBatchBodySchema, OpReset, OpSchema, PAGE_ATTRIBUTE_KEYS, PALETTE_FALLBACK_COLOR, PALETTE_GROUP_TYPE, PALETTE_PREFIX, PALETTE_REF_PREFIX, PICKER_RESOURCES, PRODUCT_ATTRIBUTE_KEYS, PageAttributeKey, PaletteColor, PathShape, ProductAttributeKey, ProviderDecl, Providers, Provides, RESOURCE_METAFIELD_SOURCES, RICHTEXT_ALLOWED_TAGS, RICHTEXT_FIELD_TAGS, RICHTEXT_SANITIZE_CONFIG, ROUTE_METAFIELD_RESOURCE, ROUTE_METAFIELD_SOURCES, ResolverCtx, ResolverScope, ResolverShape, ResolverSpec, ResourceMetafieldBinding, ResourceMetafieldSource, RichTextPurifier, RichtextTag, RouteMetafieldSource, SKIP, STORE_SLUG_RE, SYSTEM_FONT_FAMILIES, SchemaSetting, ScopeLink, SectionGroup, SectionGroupData, SectionPreset, SectionSchema, SeedMissingStaticsReport, SelectedSection, SettingBinding, SettingBindings, SettingValue, SettingsData, SettingsSchema, SettingsSchemaSection, Skip, THEME_FED, TabOpBatchBodySchema, Template, TemplateBlock, TemplateSection, TemplateShape, ThemeDocument, TouchedEntries, VideoProvider, WholeValueBindingOpts, acceptsAppBlocks, agentClientId, allowedChildBlockTypes, applyClosestBindings, applyCollectionAttributeBindings, applyInlineSources, applyMetafieldBindings, applyMetaobjectFieldBindings, applyOps, blockPathsEqual, buildBlockInstance, buildDisabledAncestorSet, buildParentMap, buildSectionInstance, buildStaticChildren, chunkOps, closestResourceOf, closestScopeAt, collectCollectionAttributeBindings, collectMetaobjectEntryIds, collectTraversedEntryIds, collectTypes, comparePaletteIds, countBlocksInBlock, countNestedBlocks, decodeStorefrontMetafield, defaultSettings, diffDocument, editorCommand, encodeSourceToken, escapeInertHtmlText, hasPaletteRefs, hasRichText, invalidTemplateId, invertOps, isAcceptedVideoUrl, isAgentClientId, isBlockPathPrefix, isCatalogFontFamily, isClosestSink, isEditorCommand, isNodeIdToken, isResourceMetafieldBinding, isResourceMetafieldSource, isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, joinBlockPath, maxBlockDepth, maxDepthOfBlock, maxDepthOfBlockSchema, metafieldDefinitionFitsSetting, metafieldTypeSupportsInlineToken, metafieldTypeToSettingTypes, metaobjectGid, metaobjectIdFromGid, nodeGid, nodeSourceDescriptors, normalizeBlockPath, normalizeCustomUrl, paletteKey, paletteRef, paletteValues, parsePalette, parsePaletteRef, parseSourceDescriptor, parseVideoUrl, providersOf, registerRichTextHooks, resolveContainerAtPath, resolveField, resolvePaletteRefs, resolvePaletteValue, resolveThemeSettingsPalette, routeTwin, seedMissingStatics, selectRenderableChildren, selectRenderableSections, serializeSourceDescriptor, settingTypeSupportsBinding, shapeOf, shortcutKey, splitBlockPath, splitInlineTokens, staticBlockId, staticChildId, stripInlineTokenSentinels, stripStaticFromBlockOrder, templateCounts, templateMatches, templateReferencesSource, touchedEntries, undoHotkey, walkBlocks, walkSections };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ARTICLE_ATTRIBUTE_KEYS, BLOG_ATTRIBUTE_KEYS, COLLECTION_ATTRIBUTE_KEYS,
|
|
|
10
10
|
import { PICKER_RESOURCES, closestScopeAt, providersOf } from "./closest-scope.js";
|
|
11
11
|
import { isNodeIdToken, nodeGid } from "./node-id.js";
|
|
12
12
|
import { DRAFT_SEEDED_KEY, INSTALL_ID_RE, STORE_SLUG_RE, invalidTemplateId } from "./store-path.js";
|
|
13
|
-
import { MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, OpBatchBodySchema, OpSchema, applyOps, chunkOps, diffDocument, invertOps, touchedEntries } from "./ops.js";
|
|
13
|
+
import { MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, OpBatchBodySchema, OpSchema, TabOpBatchBodySchema, agentClientId, applyOps, chunkOps, diffDocument, invertOps, isAgentClientId, shapeOf, touchedEntries } from "./ops.js";
|
|
14
14
|
import { MAX_BLOCKS_PER_TEMPLATE, MAX_BLOCK_NESTING_DEPTH, MAX_ENTRY_BYTES, MAX_SECTIONS_PER_TEMPLATE, countBlocksInBlock, countNestedBlocks, maxBlockDepth, maxDepthOfBlock, maxDepthOfBlockSchema, templateCounts } from "./template-limits.js";
|
|
15
15
|
import { isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, templateMatches } from "./section-scope.js";
|
|
16
16
|
import { allowedChildBlockTypes } from "./block-allowlist.js";
|
|
@@ -18,4 +18,4 @@ import { normalizeCustomUrl } from "./link-url.js";
|
|
|
18
18
|
import { isAcceptedVideoUrl, parseVideoUrl } from "./video-url.js";
|
|
19
19
|
import { GOOGLE_FONTS } from "./google-fonts.generated.js";
|
|
20
20
|
import { SYSTEM_FONT_FAMILIES, isCatalogFontFamily } from "./fonts.js";
|
|
21
|
-
export { APP_BLOCK_WILDCARD, ARTICLE_ATTRIBUTE_KEYS, BLOCK_PATH_SEPARATOR, BLOG_ATTRIBUTE_KEYS, BlockDefinition, BlockSchema, CLOSEST_RESOURCES, COLLECTION_ATTRIBUTE_KEYS, COLLECTION_INLINE_ATTRIBUTE_KEYS, ClosestResource, DRAFT_SEEDED_KEY, EDITOR_COMMANDS, GOOGLE_FONTS, INSTALL_ID_RE, MAX_APP_BLOCK_CONTAINER_DEPTH, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_BLOCKS_PER_TEMPLATE, MAX_BLOCK_NESTING_DEPTH, MAX_ENTRY_BYTES, MAX_PALETTE_COLORS, MAX_PATH_DEPTH, MAX_SECTIONS_PER_TEMPLATE, MAX_SEGMENT_LENGTH, MIN_PALETTE_COLORS, OpBatchBodySchema, OpSchema, PAGE_ATTRIBUTE_KEYS, PALETTE_FALLBACK_COLOR, PALETTE_GROUP_TYPE, PALETTE_PREFIX, PALETTE_REF_PREFIX, PICKER_RESOURCES, PRODUCT_ATTRIBUTE_KEYS, ProviderDecl, Provides, RESOURCE_METAFIELD_SOURCES, RICHTEXT_ALLOWED_TAGS, RICHTEXT_FIELD_TAGS, RICHTEXT_SANITIZE_CONFIG, ROUTE_METAFIELD_RESOURCE, ROUTE_METAFIELD_SOURCES, SKIP, STORE_SLUG_RE, SYSTEM_FONT_FAMILIES, SchemaSetting, SectionGroup, SectionPreset, SectionSchema, SettingBinding, SettingBindings, SettingsData, SettingsSchema, SettingsSchemaSection, THEME_FED, Template, TemplateBlock, TemplateSection, acceptsAppBlocks, allowedChildBlockTypes, applyClosestBindings, applyCollectionAttributeBindings, applyInlineSources, applyMetafieldBindings, applyMetaobjectFieldBindings, applyOps, blockPathsEqual, buildBlockInstance, buildDisabledAncestorSet, buildParentMap, buildSectionInstance, buildStaticChildren, chunkOps, closestResourceOf, closestScopeAt, collectCollectionAttributeBindings, collectMetaobjectEntryIds, collectTraversedEntryIds, collectTypes, comparePaletteIds, countBlocksInBlock, countNestedBlocks, decodeStorefrontMetafield, defaultSettings, diffDocument, editorCommand, encodeSourceToken, escapeInertHtmlText, hasPaletteRefs, hasRichText, invalidTemplateId, invertOps, isAcceptedVideoUrl, isBlockPathPrefix, isCatalogFontFamily, isClosestSink, isEditorCommand, isNodeIdToken, isResourceMetafieldBinding, isResourceMetafieldSource, isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, joinBlockPath, maxBlockDepth, maxDepthOfBlock, maxDepthOfBlockSchema, metafieldDefinitionFitsSetting, metafieldTypeSupportsInlineToken, metafieldTypeToSettingTypes, metaobjectGid, metaobjectIdFromGid, nodeGid, nodeSourceDescriptors, normalizeBlockPath, normalizeCustomUrl, paletteKey, paletteRef, paletteValues, parsePalette, parsePaletteRef, parseSourceDescriptor, parseVideoUrl, providersOf, registerRichTextHooks, resolveContainerAtPath, resolveField, resolvePaletteRefs, resolvePaletteValue, resolveThemeSettingsPalette, routeTwin, seedMissingStatics, selectRenderableChildren, selectRenderableSections, serializeSourceDescriptor, settingTypeSupportsBinding, shortcutKey, splitBlockPath, splitInlineTokens, staticBlockId, staticChildId, stripInlineTokenSentinels, stripStaticFromBlockOrder, templateCounts, templateMatches, templateReferencesSource, touchedEntries, undoHotkey, walkBlocks, walkSections };
|
|
21
|
+
export { APP_BLOCK_WILDCARD, ARTICLE_ATTRIBUTE_KEYS, BLOCK_PATH_SEPARATOR, BLOG_ATTRIBUTE_KEYS, BlockDefinition, BlockSchema, CLOSEST_RESOURCES, COLLECTION_ATTRIBUTE_KEYS, COLLECTION_INLINE_ATTRIBUTE_KEYS, ClosestResource, DRAFT_SEEDED_KEY, EDITOR_COMMANDS, GOOGLE_FONTS, INSTALL_ID_RE, MAX_APP_BLOCK_CONTAINER_DEPTH, MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_BLOCKS_PER_TEMPLATE, MAX_BLOCK_NESTING_DEPTH, MAX_ENTRY_BYTES, MAX_PALETTE_COLORS, MAX_PATH_DEPTH, MAX_SECTIONS_PER_TEMPLATE, MAX_SEGMENT_LENGTH, MIN_PALETTE_COLORS, OpBatchBodySchema, OpSchema, PAGE_ATTRIBUTE_KEYS, PALETTE_FALLBACK_COLOR, PALETTE_GROUP_TYPE, PALETTE_PREFIX, PALETTE_REF_PREFIX, PICKER_RESOURCES, PRODUCT_ATTRIBUTE_KEYS, ProviderDecl, Provides, RESOURCE_METAFIELD_SOURCES, RICHTEXT_ALLOWED_TAGS, RICHTEXT_FIELD_TAGS, RICHTEXT_SANITIZE_CONFIG, ROUTE_METAFIELD_RESOURCE, ROUTE_METAFIELD_SOURCES, SKIP, STORE_SLUG_RE, SYSTEM_FONT_FAMILIES, SchemaSetting, SectionGroup, SectionPreset, SectionSchema, SettingBinding, SettingBindings, SettingsData, SettingsSchema, SettingsSchemaSection, THEME_FED, TabOpBatchBodySchema, Template, TemplateBlock, TemplateSection, acceptsAppBlocks, agentClientId, allowedChildBlockTypes, applyClosestBindings, applyCollectionAttributeBindings, applyInlineSources, applyMetafieldBindings, applyMetaobjectFieldBindings, applyOps, blockPathsEqual, buildBlockInstance, buildDisabledAncestorSet, buildParentMap, buildSectionInstance, buildStaticChildren, chunkOps, closestResourceOf, closestScopeAt, collectCollectionAttributeBindings, collectMetaobjectEntryIds, collectTraversedEntryIds, collectTypes, comparePaletteIds, countBlocksInBlock, countNestedBlocks, decodeStorefrontMetafield, defaultSettings, diffDocument, editorCommand, encodeSourceToken, escapeInertHtmlText, hasPaletteRefs, hasRichText, invalidTemplateId, invertOps, isAcceptedVideoUrl, isAgentClientId, isBlockPathPrefix, isCatalogFontFamily, isClosestSink, isEditorCommand, isNodeIdToken, isResourceMetafieldBinding, isResourceMetafieldSource, isSectionAddableInGroup, isSectionAllowedInGroup, isSectionEnabledOnTemplate, joinBlockPath, maxBlockDepth, maxDepthOfBlock, maxDepthOfBlockSchema, metafieldDefinitionFitsSetting, metafieldTypeSupportsInlineToken, metafieldTypeToSettingTypes, metaobjectGid, metaobjectIdFromGid, nodeGid, nodeSourceDescriptors, normalizeBlockPath, normalizeCustomUrl, paletteKey, paletteRef, paletteValues, parsePalette, parsePaletteRef, parseSourceDescriptor, parseVideoUrl, providersOf, registerRichTextHooks, resolveContainerAtPath, resolveField, resolvePaletteRefs, resolvePaletteValue, resolveThemeSettingsPalette, routeTwin, seedMissingStatics, selectRenderableChildren, selectRenderableSections, serializeSourceDescriptor, settingTypeSupportsBinding, shapeOf, shortcutKey, splitBlockPath, splitInlineTokens, staticBlockId, staticChildId, stripInlineTokenSentinels, stripStaticFromBlockOrder, templateCounts, templateMatches, templateReferencesSource, touchedEntries, undoHotkey, walkBlocks, walkSections };
|
package/dist/ops.d.ts
CHANGED
|
@@ -30,10 +30,40 @@ export interface OpBatch {
|
|
|
30
30
|
ops: Op[];
|
|
31
31
|
reset?: OpReset;
|
|
32
32
|
}
|
|
33
|
+
/** The client id an MCP editor tool call writes its batches under. */
|
|
34
|
+
export declare const agentClientId: (sid: string, callId: string) => string;
|
|
35
|
+
/** Whether a batch came from an MCP editor tool call, not an editor tab. */
|
|
36
|
+
export declare const isAgentClientId: (clientId: string) => boolean;
|
|
33
37
|
export declare const MAX_PATH_DEPTH = 24;
|
|
34
38
|
export declare const MAX_SEGMENT_LENGTH = 64;
|
|
35
39
|
export declare const MAX_BATCH_OPS = 200;
|
|
36
40
|
export declare const MAX_BATCH_BYTES: number;
|
|
41
|
+
/** A node that holds ordered children: an entry's sections, or a section's or block's blocks. */
|
|
42
|
+
export type Container = {
|
|
43
|
+
path: string[];
|
|
44
|
+
childKey: "sections" | "blocks";
|
|
45
|
+
orderKey: "order" | "block_order";
|
|
46
|
+
};
|
|
47
|
+
export type PathShape = {
|
|
48
|
+
kind: "settings";
|
|
49
|
+
} | {
|
|
50
|
+
kind: "entry";
|
|
51
|
+
} | {
|
|
52
|
+
kind: "order";
|
|
53
|
+
container: Container;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "child";
|
|
56
|
+
container: Container;
|
|
57
|
+
childId: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "children";
|
|
60
|
+
container: Container;
|
|
61
|
+
} | {
|
|
62
|
+
kind: "field";
|
|
63
|
+
container: Container;
|
|
64
|
+
};
|
|
65
|
+
/** Where an op lands relative to the order-bearing containers it passes. */
|
|
66
|
+
export declare function shapeOf(p: string[]): PathShape;
|
|
37
67
|
/**
|
|
38
68
|
* Applies a batch copy-on-write along each op's path, then normalises every
|
|
39
69
|
* container the batch touched: drops order ids with no node, strips static
|
|
@@ -82,4 +112,15 @@ export declare const OpBatchBodySchema: z.ZodObject<{
|
|
|
82
112
|
}, z.core.$strict>>;
|
|
83
113
|
}, z.core.$strict>;
|
|
84
114
|
export type OpBatchBody = z.infer<typeof OpBatchBodySchema>;
|
|
115
|
+
/** A batch an editor tab sends: the `mcp:` client id prefix marks an editor
|
|
116
|
+
* tool call's batches, and other tabs follow those, so a tab can't claim it. */
|
|
117
|
+
export declare const TabOpBatchBodySchema: z.ZodObject<{
|
|
118
|
+
clientId: z.ZodString;
|
|
119
|
+
batchNo: z.ZodNumber;
|
|
120
|
+
batchId: z.ZodString;
|
|
121
|
+
ops: z.ZodArray<z.ZodObject<{
|
|
122
|
+
p: z.ZodArray<z.ZodString>;
|
|
123
|
+
v: z.ZodOptional<z.ZodUnknown>;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
}, z.core.$strict>;
|
|
85
126
|
//#endregion
|
package/dist/ops.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { STORE_SLUG_RE, invalidTemplateId } from "./store-path.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/ops.ts
|
|
4
|
+
const AGENT_CLIENT_PREFIX = "mcp:";
|
|
5
|
+
/** The client id an MCP editor tool call writes its batches under. */
|
|
6
|
+
const agentClientId = (sid, callId) => `${AGENT_CLIENT_PREFIX}${sid}:${callId}`;
|
|
7
|
+
/** Whether a batch came from an MCP editor tool call, not an editor tab. */
|
|
8
|
+
const isAgentClientId = (clientId) => clientId.startsWith(AGENT_CLIENT_PREFIX);
|
|
4
9
|
const MAX_PATH_DEPTH = 24;
|
|
5
10
|
const MAX_SEGMENT_LENGTH = 64;
|
|
6
11
|
const MAX_BATCH_OPS = 200;
|
|
@@ -438,5 +443,11 @@ const OpBatchBodySchema = z.object({
|
|
|
438
443
|
batchId: z.string().min(1).max(64),
|
|
439
444
|
ops: z.array(OpSchema).min(1).max(200)
|
|
440
445
|
}).strict();
|
|
446
|
+
/** A batch an editor tab sends: the `mcp:` client id prefix marks an editor
|
|
447
|
+
* tool call's batches, and other tabs follow those, so a tab can't claim it. */
|
|
448
|
+
const TabOpBatchBodySchema = OpBatchBodySchema.refine((b) => !isAgentClientId(b.clientId), {
|
|
449
|
+
message: "the mcp: client id prefix is reserved for editor tool calls",
|
|
450
|
+
path: ["clientId"]
|
|
451
|
+
});
|
|
441
452
|
//#endregion
|
|
442
|
-
export { MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, OpBatchBodySchema, OpSchema, applyOps, chunkOps, diffDocument, invertOps, touchedEntries };
|
|
453
|
+
export { MAX_BATCH_BYTES, MAX_BATCH_OPS, MAX_PATH_DEPTH, MAX_SEGMENT_LENGTH, OpBatchBodySchema, OpSchema, TabOpBatchBodySchema, agentClientId, applyOps, chunkOps, diffDocument, invertOps, isAgentClientId, shapeOf, touchedEntries };
|