@spotpatch/shared 1.15.0 → 1.16.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.
Files changed (40) hide show
  1. package/dist/{annotation-Cz-NNgR4.d.cts → annotation-eo_ltNRm.d.cts} +24 -1
  2. package/dist/{annotation-Cz-NNgR4.d.ts → annotation-eo_ltNRm.d.ts} +24 -1
  3. package/dist/{chunk-JTZFOTPT.js → chunk-7777QFBJ.js} +2 -2
  4. package/dist/{chunk-R3BQKCCY.js → chunk-D7R32NFF.js} +2 -2
  5. package/dist/{chunk-R6QJFNT2.js → chunk-FCY5V76A.js} +31 -1
  6. package/dist/chunk-FCY5V76A.js.map +1 -0
  7. package/dist/{contextual-ask-BbmHG3Z8.d.cts → contextual-ask-Dz3Mh9LR.d.cts} +105 -0
  8. package/dist/{contextual-ask-BbmHG3Z8.d.ts → contextual-ask-Dz3Mh9LR.d.ts} +105 -0
  9. package/dist/contextual-ask-browser.d.cts +1 -1
  10. package/dist/contextual-ask-browser.d.ts +1 -1
  11. package/dist/contextual-ask-node.cjs +24 -0
  12. package/dist/contextual-ask-node.cjs.map +1 -1
  13. package/dist/contextual-ask-node.d.cts +3 -3
  14. package/dist/contextual-ask-node.d.ts +3 -3
  15. package/dist/contextual-ask-node.js +2 -2
  16. package/dist/data-flow-runtime.d.cts +1 -1
  17. package/dist/data-flow-runtime.d.ts +1 -1
  18. package/dist/external-agent-node.cjs +26 -0
  19. package/dist/external-agent-node.cjs.map +1 -1
  20. package/dist/external-agent-node.d.cts +66 -36
  21. package/dist/external-agent-node.d.ts +66 -36
  22. package/dist/external-agent-node.js +2 -2
  23. package/dist/{external-handoff-BpoxbpPk.d.ts → external-handoff-BaPiKnYG.d.ts} +68 -38
  24. package/dist/{external-handoff-D1Ua2jIA.d.cts → external-handoff-ByHmcwWv.d.cts} +68 -38
  25. package/dist/external-handoff-browser.d.cts +3 -3
  26. package/dist/external-handoff-browser.d.ts +3 -3
  27. package/dist/index.cjs +34 -0
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +76 -31
  30. package/dist/index.d.ts +76 -31
  31. package/dist/index.js +11 -3
  32. package/dist/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-R6QJFNT2.js.map +0 -1
  35. package/dist/{chunk-JTZFOTPT.js.map → chunk-7777QFBJ.js.map} +0 -0
  36. package/dist/{chunk-R3BQKCCY.js.map → chunk-D7R32NFF.js.map} +0 -0
  37. package/dist/{data-flow-runtime-tyqGH1OS.d.ts → data-flow-runtime-DhWpQoik.d.ts} +8 -8
  38. package/dist/{data-flow-runtime-Bfm5LbHE.d.cts → data-flow-runtime-w43iwvGA.d.cts} +8 -8
  39. package/dist/{external-agent-control-yC4ToQXg.d.cts → external-agent-control-DKxQACUv.d.cts} +28 -28
  40. package/dist/{external-agent-control-yC4ToQXg.d.ts → external-agent-control-DKxQACUv.d.ts} +28 -28
@@ -15,6 +15,28 @@ interface CodeContext {
15
15
  readonly boundary: "component" | "nearby-lines";
16
16
  }
17
17
 
18
+ /** Capture evidence is framework-neutral and never grants source access. */
19
+ declare const ELEMENT_INSTANCE_LIMITS: Readonly<{
20
+ idCharacters: 128;
21
+ contextCharacters: 1200;
22
+ labelCharacters: 160;
23
+ selectorCharacters: 2048;
24
+ ancestorDepth: 8;
25
+ locatorDepth: 32;
26
+ }>;
27
+ declare const ELEMENT_INSTANCE_STATES: readonly ["captured", "changed", "detached", "restored"];
28
+ declare const ELEMENT_INSTANCE_HINT_ATTRIBUTE = "data-spotpatch-instance";
29
+ interface ElementInstanceContext {
30
+ /** Opaque capture identity, not a framework key or a business record ID. */
31
+ readonly id: string;
32
+ readonly state: (typeof ELEMENT_INSTANCE_STATES)[number];
33
+ readonly selectorStatus: "unique-at-capture" | "unavailable";
34
+ readonly label: string;
35
+ /** Sanitized nearby DOM scope; it is not a proven component boundary. */
36
+ readonly context: string;
37
+ }
38
+ declare const INSTANCE_SELECTION_INSTRUCTIONS = "Selected targets can be different rendered instances of the same source. Preserve each target and its instruction even when source locations match. Instance IDs identify captures, not business records. Selectors are capture-time evidence, never stable record IDs. Nearby DOM context is not a proven component boundary. Changed, detached, or restored instances are historical snapshots; verify their identity before changing code. Follow the requested scope: a selected instance does not by itself authorize changes to every instance or imply instance-only changes. For an instance-only request, establish the corresponding record/condition and check the shared component's impact; if evidence is insufficient, explain what is missing rather than guessing.";
39
+
18
40
  type SourceConfidence = "exact" | "probable" | "approximate" | "unknown";
19
41
  type SourceOrigin = "jsx-host" | "astro-host" | "react-fiber" | "dom-ancestor" | "none";
20
42
  interface SourceRef {
@@ -58,6 +80,7 @@ interface PageContext {
58
80
  readonly devicePixelRatio: number;
59
81
  }
60
82
  interface ElementContext {
83
+ readonly instance?: ElementInstanceContext;
61
84
  readonly tagName: string;
62
85
  readonly selector: string;
63
86
  readonly sanitizedHtml: string;
@@ -99,4 +122,4 @@ interface SpotAnnotation {
99
122
  readonly createdAt: string;
100
123
  }
101
124
 
102
- export { type ContextBudget as C, type ElementContext as E, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, MAX_ANNOTATION_TARGETS as d, MAX_TARGET_INSTRUCTION_CHARACTERS as e, type MatchedStyleRule as f, SPOTPATCH_LOCALES as g, type SourceConfidence as h, type SourceOrigin as i, type SourceRef as j, type SpotPatchLocalePreference as k, type SpotTargetContext as l, type StyleContext as m };
125
+ export { type ContextBudget as C, ELEMENT_INSTANCE_HINT_ATTRIBUTE as E, INSTANCE_SELECTION_INSTRUCTIONS as I, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, ELEMENT_INSTANCE_LIMITS as d, ELEMENT_INSTANCE_STATES as e, type ElementContext as f, type ElementInstanceContext as g, MAX_ANNOTATION_TARGETS as h, MAX_TARGET_INSTRUCTION_CHARACTERS as i, type MatchedStyleRule as j, SPOTPATCH_LOCALES as k, type SourceConfidence as l, type SourceOrigin as m, type SourceRef as n, type SpotPatchLocalePreference as o, type SpotTargetContext as p, type StyleContext as q };
@@ -15,6 +15,28 @@ interface CodeContext {
15
15
  readonly boundary: "component" | "nearby-lines";
16
16
  }
17
17
 
18
+ /** Capture evidence is framework-neutral and never grants source access. */
19
+ declare const ELEMENT_INSTANCE_LIMITS: Readonly<{
20
+ idCharacters: 128;
21
+ contextCharacters: 1200;
22
+ labelCharacters: 160;
23
+ selectorCharacters: 2048;
24
+ ancestorDepth: 8;
25
+ locatorDepth: 32;
26
+ }>;
27
+ declare const ELEMENT_INSTANCE_STATES: readonly ["captured", "changed", "detached", "restored"];
28
+ declare const ELEMENT_INSTANCE_HINT_ATTRIBUTE = "data-spotpatch-instance";
29
+ interface ElementInstanceContext {
30
+ /** Opaque capture identity, not a framework key or a business record ID. */
31
+ readonly id: string;
32
+ readonly state: (typeof ELEMENT_INSTANCE_STATES)[number];
33
+ readonly selectorStatus: "unique-at-capture" | "unavailable";
34
+ readonly label: string;
35
+ /** Sanitized nearby DOM scope; it is not a proven component boundary. */
36
+ readonly context: string;
37
+ }
38
+ declare const INSTANCE_SELECTION_INSTRUCTIONS = "Selected targets can be different rendered instances of the same source. Preserve each target and its instruction even when source locations match. Instance IDs identify captures, not business records. Selectors are capture-time evidence, never stable record IDs. Nearby DOM context is not a proven component boundary. Changed, detached, or restored instances are historical snapshots; verify their identity before changing code. Follow the requested scope: a selected instance does not by itself authorize changes to every instance or imply instance-only changes. For an instance-only request, establish the corresponding record/condition and check the shared component's impact; if evidence is insufficient, explain what is missing rather than guessing.";
39
+
18
40
  type SourceConfidence = "exact" | "probable" | "approximate" | "unknown";
19
41
  type SourceOrigin = "jsx-host" | "astro-host" | "react-fiber" | "dom-ancestor" | "none";
20
42
  interface SourceRef {
@@ -58,6 +80,7 @@ interface PageContext {
58
80
  readonly devicePixelRatio: number;
59
81
  }
60
82
  interface ElementContext {
83
+ readonly instance?: ElementInstanceContext;
61
84
  readonly tagName: string;
62
85
  readonly selector: string;
63
86
  readonly sanitizedHtml: string;
@@ -99,4 +122,4 @@ interface SpotAnnotation {
99
122
  readonly createdAt: string;
100
123
  }
101
124
 
102
- export { type ContextBudget as C, type ElementContext as E, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, MAX_ANNOTATION_TARGETS as d, MAX_TARGET_INSTRUCTION_CHARACTERS as e, type MatchedStyleRule as f, SPOTPATCH_LOCALES as g, type SourceConfidence as h, type SourceOrigin as i, type SourceRef as j, type SpotPatchLocalePreference as k, type SpotTargetContext as l, type StyleContext as m };
125
+ export { type ContextBudget as C, ELEMENT_INSTANCE_HINT_ATTRIBUTE as E, INSTANCE_SELECTION_INSTRUCTIONS as I, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, ELEMENT_INSTANCE_LIMITS as d, ELEMENT_INSTANCE_STATES as e, type ElementContext as f, type ElementInstanceContext as g, MAX_ANNOTATION_TARGETS as h, MAX_TARGET_INSTRUCTION_CHARACTERS as i, type MatchedStyleRule as j, SPOTPATCH_LOCALES as k, type SourceConfidence as l, type SourceOrigin as m, type SourceRef as n, type SpotPatchLocalePreference as o, type SpotTargetContext as p, type StyleContext as q };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MAX_ANNOTATION_TARGETS,
3
3
  spotAnnotationSchema
4
- } from "./chunk-R6QJFNT2.js";
4
+ } from "./chunk-FCY5V76A.js";
5
5
  import {
6
6
  EXTERNAL_HANDOFF_ACTIVE_ADAPTER_KINDS,
7
7
  EXTERNAL_HANDOFF_ACTIVE_ADAPTER_STATES,
@@ -263,4 +263,4 @@ export {
263
263
  externalHandoffStatusResultSchema,
264
264
  SpotPatchError
265
265
  };
266
- //# sourceMappingURL=chunk-JTZFOTPT.js.map
266
+ //# sourceMappingURL=chunk-7777QFBJ.js.map
@@ -17,7 +17,7 @@ import {
17
17
  SPOTPATCH_LOCALES,
18
18
  pageContextSchema,
19
19
  spotTargetContextSchema
20
- } from "./chunk-R6QJFNT2.js";
20
+ } from "./chunk-FCY5V76A.js";
21
21
 
22
22
  // src/model/contextual-ask.ts
23
23
  import { z } from "zod";
@@ -584,4 +584,4 @@ export {
584
584
  askJobResultResponseSchema,
585
585
  askJobEventSchema
586
586
  };
587
- //# sourceMappingURL=chunk-R3BQKCCY.js.map
587
+ //# sourceMappingURL=chunk-D7R32NFF.js.map
@@ -1,3 +1,21 @@
1
+ // src/model/element-instance.ts
2
+ var ELEMENT_INSTANCE_LIMITS = Object.freeze({
3
+ idCharacters: 128,
4
+ contextCharacters: 1200,
5
+ labelCharacters: 160,
6
+ selectorCharacters: 2048,
7
+ ancestorDepth: 8,
8
+ locatorDepth: 32
9
+ });
10
+ var ELEMENT_INSTANCE_STATES = [
11
+ "captured",
12
+ "changed",
13
+ "detached",
14
+ "restored"
15
+ ];
16
+ var ELEMENT_INSTANCE_HINT_ATTRIBUTE = "data-spotpatch-instance";
17
+ var INSTANCE_SELECTION_INSTRUCTIONS = "Selected targets can be different rendered instances of the same source. Preserve each target and its instruction even when source locations match. Instance IDs identify captures, not business records. Selectors are capture-time evidence, never stable record IDs. Nearby DOM context is not a proven component boundary. Changed, detached, or restored instances are historical snapshots; verify their identity before changing code. Follow the requested scope: a selected instance does not by itself authorize changes to every instance or imply instance-only changes. For an instance-only request, establish the corresponding record/condition and check the shared component's impact; if evidence is insufficient, explain what is missing rather than guessing.";
18
+
1
19
  // src/model/annotation.ts
2
20
  var MAX_ANNOTATION_TARGETS = 20;
3
21
  var MAX_TARGET_INSTRUCTION_CHARACTERS = 2e3;
@@ -11,6 +29,13 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
11
29
  // src/model/context-schema.ts
12
30
  import { z } from "zod";
13
31
  var boundedString = (maximum) => z.string().max(maximum);
32
+ var elementInstanceContextSchema = z.strictObject({
33
+ id: z.string().min(1).max(ELEMENT_INSTANCE_LIMITS.idCharacters).regex(/^[A-Za-z0-9_-]+$/u),
34
+ state: z.enum(ELEMENT_INSTANCE_STATES),
35
+ selectorStatus: z.enum(["unique-at-capture", "unavailable"]),
36
+ label: boundedString(ELEMENT_INSTANCE_LIMITS.labelCharacters),
37
+ context: boundedString(ELEMENT_INSTANCE_LIMITS.contextCharacters)
38
+ });
14
39
  var sourceRefSchema = z.strictObject({
15
40
  fileId: boundedString(128).optional(),
16
41
  relativePath: boundedString(1024).optional(),
@@ -55,6 +80,7 @@ var spotTargetContextSchema = z.strictObject({
55
80
  source: sourceRefSchema.optional()
56
81
  }),
57
82
  element: z.strictObject({
83
+ instance: elementInstanceContextSchema.optional(),
58
84
  tagName: boundedString(128),
59
85
  selector: boundedString(2048),
60
86
  sanitizedHtml: boundedString(8192),
@@ -179,6 +205,10 @@ function isErrorCode(value) {
179
205
  }
180
206
 
181
207
  export {
208
+ ELEMENT_INSTANCE_LIMITS,
209
+ ELEMENT_INSTANCE_STATES,
210
+ ELEMENT_INSTANCE_HINT_ATTRIBUTE,
211
+ INSTANCE_SELECTION_INSTRUCTIONS,
182
212
  MAX_ANNOTATION_TARGETS,
183
213
  MAX_TARGET_INSTRUCTION_CHARACTERS,
184
214
  MAX_ANNOTATION_INSTRUCTION_CHARACTERS,
@@ -192,4 +222,4 @@ export {
192
222
  ERROR_CODE_VALUES,
193
223
  isErrorCode
194
224
  };
195
- //# sourceMappingURL=chunk-R6QJFNT2.js.map
225
+ //# sourceMappingURL=chunk-FCY5V76A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/model/element-instance.ts","../src/model/annotation.ts","../src/model/context-schema.ts","../src/errors/error-code.ts"],"sourcesContent":["/** Capture evidence is framework-neutral and never grants source access. */\nexport const ELEMENT_INSTANCE_LIMITS = Object.freeze({\n idCharacters: 128,\n contextCharacters: 1_200,\n labelCharacters: 160,\n selectorCharacters: 2_048,\n ancestorDepth: 8,\n locatorDepth: 32,\n});\n\nexport const ELEMENT_INSTANCE_STATES = [\n \"captured\",\n \"changed\",\n \"detached\",\n \"restored\",\n] as const;\n\nexport const ELEMENT_INSTANCE_HINT_ATTRIBUTE = \"data-spotpatch-instance\";\n\nexport interface ElementInstanceContext {\n /** Opaque capture identity, not a framework key or a business record ID. */\n readonly id: string;\n readonly state: (typeof ELEMENT_INSTANCE_STATES)[number];\n readonly selectorStatus: \"unique-at-capture\" | \"unavailable\";\n readonly label: string;\n /** Sanitized nearby DOM scope; it is not a proven component boundary. */\n readonly context: string;\n}\n\nexport const INSTANCE_SELECTION_INSTRUCTIONS =\n \"Selected targets can be different rendered instances of the same source. Preserve each target and its instruction even when source locations match. Instance IDs identify captures, not business records. Selectors are capture-time evidence, never stable record IDs. Nearby DOM context is not a proven component boundary. Changed, detached, or restored instances are historical snapshots; verify their identity before changing code. Follow the requested scope: a selected instance does not by itself authorize changes to every instance or imply instance-only changes. For an instance-only request, establish the corresponding record/condition and check the shared component's impact; if evidence is insufficient, explain what is missing rather than guessing.\";\n","import type { CodeContext } from \"./code-context.js\";\nimport type { ElementInstanceContext } from \"./element-instance.js\";\nimport type { ReactContext, SourceRef } from \"./source-ref.js\";\nimport type { StyleContext } from \"./style-context.js\";\n\nexport interface PageContext {\n readonly url: string;\n readonly pathname: string;\n readonly title: string;\n readonly viewportWidth: number;\n readonly viewportHeight: number;\n readonly devicePixelRatio: number;\n}\n\nexport interface ElementContext {\n readonly instance?: ElementInstanceContext;\n readonly tagName: string;\n readonly selector: string;\n readonly sanitizedHtml: string;\n readonly textPreview?: string;\n readonly role?: string;\n readonly rect: Readonly<{\n x: number;\n y: number;\n width: number;\n height: number;\n }>;\n}\n\n/** Protocol hard limit. Runtime configuration may choose a smaller limit. */\nexport const MAX_ANNOTATION_TARGETS = 20;\n\n/** Each target owns its requested change; the UI enforces the same bound. */\nexport const MAX_TARGET_INSTRUCTION_CHARACTERS = 2_000;\n\n/** Keeps the complete, atomic user intent within the prompt and request budgets. */\nexport const MAX_ANNOTATION_INSTRUCTION_CHARACTERS = 4_000;\n\nexport const SPOTPATCH_LOCALES = Object.freeze([\"en-US\", \"zh-CN\"] as const);\nexport type SpotPatchLocale = (typeof SPOTPATCH_LOCALES)[number];\nexport const SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([\n \"auto\",\n ...SPOTPATCH_LOCALES,\n] as const);\nexport type SpotPatchLocalePreference = (typeof SPOTPATCH_LOCALE_PREFERENCES)[number];\n\nexport interface SpotTargetContext {\n readonly instruction: string;\n readonly page?: Readonly<PageContext>;\n readonly source: SourceRef;\n readonly react: ReactContext;\n readonly element: ElementContext;\n readonly styles: StyleContext;\n readonly code?: CodeContext;\n readonly warnings: readonly string[];\n}\n\nexport interface SpotAnnotation {\n readonly schemaVersion: 3;\n readonly id: string;\n readonly locale: SpotPatchLocale;\n readonly page: Readonly<PageContext>;\n readonly targets: readonly SpotTargetContext[];\n readonly createdAt: string;\n}\n","import { z } from \"zod\";\nimport {\n ELEMENT_INSTANCE_LIMITS,\n ELEMENT_INSTANCE_STATES,\n} from \"./element-instance.js\";\n\nimport {\n MAX_ANNOTATION_INSTRUCTION_CHARACTERS,\n MAX_ANNOTATION_TARGETS,\n MAX_TARGET_INSTRUCTION_CHARACTERS,\n SPOTPATCH_LOCALES,\n} from \"./annotation.js\";\n\nconst boundedString = (maximum: number): z.ZodString => z.string().max(maximum);\n\nexport const elementInstanceContextSchema = z.strictObject({\n id: z\n .string()\n .min(1)\n .max(ELEMENT_INSTANCE_LIMITS.idCharacters)\n .regex(/^[A-Za-z0-9_-]+$/u),\n state: z.enum(ELEMENT_INSTANCE_STATES),\n selectorStatus: z.enum([\"unique-at-capture\", \"unavailable\"]),\n label: boundedString(ELEMENT_INSTANCE_LIMITS.labelCharacters),\n context: boundedString(ELEMENT_INSTANCE_LIMITS.contextCharacters),\n});\n\nexport const sourceRefSchema = z.strictObject({\n fileId: boundedString(128).optional(),\n relativePath: boundedString(1_024).optional(),\n line: z.number().int().positive().optional(),\n column: z.number().int().positive().optional(),\n origin: z.enum([\"jsx-host\", \"astro-host\", \"react-fiber\", \"dom-ancestor\", \"none\"]),\n confidence: z.enum([\"exact\", \"probable\", \"approximate\", \"unknown\"]),\n});\n\nexport const matchedStyleRuleSchema = z.strictObject({\n selector: boundedString(2_048),\n declarations: boundedString(8_192),\n source: boundedString(1_024).optional(),\n media: boundedString(1_024).optional(),\n});\n\nexport const codeContextSchema = z.strictObject({\n relativePath: boundedString(1_024),\n language: z.enum([\"tsx\", \"jsx\", \"astro\"]),\n startLine: z.number().int().positive(),\n endLine: z.number().int().positive(),\n excerpt: boundedString(16_000),\n boundary: z.enum([\"component\", \"nearby-lines\"]),\n});\n\nexport const pageContextSchema = z.strictObject({\n url: boundedString(2_048),\n pathname: boundedString(2_048),\n title: boundedString(1_024),\n viewportWidth: z.number().nonnegative(),\n viewportHeight: z.number().nonnegative(),\n devicePixelRatio: z.number().positive(),\n});\n\nexport const spotTargetContextSchema = z.strictObject({\n instruction: z.string().trim().min(1).max(MAX_TARGET_INSTRUCTION_CHARACTERS),\n page: pageContextSchema.optional(),\n source: sourceRefSchema,\n react: z.strictObject({\n supported: z.boolean(),\n version: boundedString(64).optional(),\n componentName: boundedString(256).optional(),\n componentSourceId: boundedString(128).optional(),\n sourceVersion: boundedString(128).optional(),\n componentStack: z.array(boundedString(256)).max(64),\n source: sourceRefSchema.optional(),\n }),\n element: z.strictObject({\n instance: elementInstanceContextSchema.optional(),\n tagName: boundedString(128),\n selector: boundedString(2_048),\n sanitizedHtml: boundedString(8_192),\n textPreview: boundedString(2_048).optional(),\n role: boundedString(256).optional(),\n rect: z.strictObject({\n x: z.number(),\n y: z.number(),\n width: z.number().nonnegative(),\n height: z.number().nonnegative(),\n }),\n }),\n styles: z.strictObject({\n classNames: z.array(boundedString(512)).max(256),\n inlineStyle: boundedString(8_192).optional(),\n matchedRules: z.array(matchedStyleRuleSchema).max(256),\n computed: z.record(boundedString(256), boundedString(2_048)),\n warnings: z.array(boundedString(1_024)).max(64),\n }),\n code: codeContextSchema.optional(),\n warnings: z.array(boundedString(1_024)).max(64),\n});\n\nexport const spotAnnotationSchema = z\n .strictObject({\n schemaVersion: z.literal(3),\n id: boundedString(128),\n locale: z.enum(SPOTPATCH_LOCALES),\n page: pageContextSchema,\n targets: z.array(spotTargetContextSchema).min(1).max(MAX_ANNOTATION_TARGETS),\n createdAt: z.iso.datetime(),\n })\n .superRefine((annotation, context) => {\n const total = annotation.targets.reduce(\n (characters, target) => characters + target.instruction.length,\n 0,\n );\n if (total > MAX_ANNOTATION_INSTRUCTION_CHARACTERS) {\n context.addIssue({\n code: \"custom\",\n message: \"Combined target instructions exceed the annotation limit.\",\n path: [\"targets\"],\n });\n }\n });\n","export const ERROR_CODES = {\n INVALID_REQUEST: \"INVALID_REQUEST\",\n INVALID_TOKEN: \"INVALID_TOKEN\",\n ORIGIN_NOT_ALLOWED: \"ORIGIN_NOT_ALLOWED\",\n SOURCE_NOT_FOUND: \"SOURCE_NOT_FOUND\",\n SOURCE_OUTSIDE_ROOT: \"SOURCE_OUTSIDE_ROOT\",\n SOURCE_TOO_LARGE: \"SOURCE_TOO_LARGE\",\n EDITOR_OPEN_FAILED: \"EDITOR_OPEN_FAILED\",\n DATA_FLOW_DISABLED: \"DATA_FLOW_DISABLED\",\n DATA_FLOW_SOURCE_STALE: \"DATA_FLOW_SOURCE_STALE\",\n DATA_FLOW_ANALYSIS_CANCELLED: \"DATA_FLOW_ANALYSIS_CANCELLED\",\n AI_DISABLED: \"AI_DISABLED\",\n PROVIDER_NOT_CONFIGURED: \"PROVIDER_NOT_CONFIGURED\",\n PROVIDER_AUTH_FAILED: \"PROVIDER_AUTH_FAILED\",\n PROVIDER_PROTOCOL_UNSUPPORTED: \"PROVIDER_PROTOCOL_UNSUPPORTED\",\n MODEL_NOT_ALLOWED: \"MODEL_NOT_ALLOWED\",\n MODEL_TOOL_CALL_UNSUPPORTED: \"MODEL_TOOL_CALL_UNSUPPORTED\",\n PROVIDER_RATE_LIMITED: \"PROVIDER_RATE_LIMITED\",\n AGENT_BUSY: \"AGENT_BUSY\",\n AGENT_LIMIT_EXCEEDED: \"AGENT_LIMIT_EXCEEDED\",\n AGENT_CANCELLED: \"AGENT_CANCELLED\",\n EXTERNAL_HANDOFF_DISABLED: \"EXTERNAL_HANDOFF_DISABLED\",\n EXTERNAL_HANDOFF_UNAVAILABLE: \"EXTERNAL_HANDOFF_UNAVAILABLE\",\n HANDOFF_VALIDATION_FAILED: \"HANDOFF_VALIDATION_FAILED\",\n HANDOFF_SOURCE_STALE: \"HANDOFF_SOURCE_STALE\",\n HANDOFF_NOT_FOUND: \"HANDOFF_NOT_FOUND\",\n HANDOFF_EXPIRED: \"HANDOFF_EXPIRED\",\n HANDOFF_CURSOR_INVALID: \"HANDOFF_CURSOR_INVALID\",\n HANDOFF_RESPONSE_TOO_LARGE: \"HANDOFF_RESPONSE_TOO_LARGE\",\n BRIDGE_UNAUTHORIZED: \"BRIDGE_UNAUTHORIZED\",\n BRIDGE_PROTOCOL_MISMATCH: \"BRIDGE_PROTOCOL_MISMATCH\",\n BRIDGE_BUSY: \"BRIDGE_BUSY\",\n EXTERNAL_AGENT_BUSY: \"EXTERNAL_AGENT_BUSY\",\n ACTIVE_ADAPTER_CONFLICT: \"ACTIVE_ADAPTER_CONFLICT\",\n ACTIVE_ADAPTER_LEASE_INVALID: \"ACTIVE_ADAPTER_LEASE_INVALID\",\n ACTIVE_DISPATCH_INVALID: \"ACTIVE_DISPATCH_INVALID\",\n SESSION_NOT_FOUND: \"SESSION_NOT_FOUND\",\n SESSION_AMBIGUOUS: \"SESSION_AMBIGUOUS\",\n SESSION_CLOSED: \"SESSION_CLOSED\",\n WORKTREE_DIRTY: \"WORKTREE_DIRTY\",\n WORKTREE_NOT_REPOSITORY: \"WORKTREE_NOT_REPOSITORY\",\n WORKTREE_OPERATION_IN_PROGRESS: \"WORKTREE_OPERATION_IN_PROGRESS\",\n WORKTREE_CONFLICTED: \"WORKTREE_CONFLICTED\",\n WORKTREE_LOCAL_CHANGES_TOO_LARGE: \"WORKTREE_LOCAL_CHANGES_TOO_LARGE\",\n WORKTREE_UNTRACKED_UNSUPPORTED: \"WORKTREE_UNTRACKED_UNSUPPORTED\",\n WORKTREE_LOCAL_CHANGES_UNSUPPORTED: \"WORKTREE_LOCAL_CHANGES_UNSUPPORTED\",\n TOOL_DENIED: \"TOOL_DENIED\",\n TOOL_INPUT_INVALID: \"TOOL_INPUT_INVALID\",\n TOOL_ARGUMENTS_INVALID: \"TOOL_ARGUMENTS_INVALID\",\n TOOL_CALL_ID_CONFLICT: \"TOOL_CALL_ID_CONFLICT\",\n TOOL_PATH_DENIED: \"TOOL_PATH_DENIED\",\n PATCH_REJECTED: \"PATCH_REJECTED\",\n VALIDATION_FAILED: \"VALIDATION_FAILED\",\n APPLY_CONFLICT: \"APPLY_CONFLICT\",\n INTERNAL_ERROR: \"INTERNAL_ERROR\",\n} as const;\n\nexport const CONTEXTUAL_ASK_ERROR_CODES = Object.freeze([\n \"ASK_DISABLED\",\n \"ASK_SELECTION_REQUIRED\",\n \"ASK_SELECTION_STALE\",\n \"ASK_QUESTION_INVALID\",\n \"ASK_EXECUTOR_UNAVAILABLE\",\n \"ASK_TIMEOUT\",\n \"ASK_CONSENT_REQUIRED\",\n \"ASK_BUSY\",\n \"ASK_IDEMPOTENCY_CONFLICT\",\n \"ASK_SOURCE_SCOPE_DENIED\",\n \"ASK_LIMIT_EXCEEDED\",\n \"ASK_ANSWER_INVALID\",\n \"ASK_WRITE_ATTEMPTED\",\n \"ASK_CANCELLED\",\n \"ASK_RESULT_EXPIRED\",\n \"ASK_PROTOCOL_INCOMPATIBLE\",\n] as const);\n\nexport type ContextualAskErrorCode = (typeof CONTEXTUAL_ASK_ERROR_CODES)[number];\n\nexport type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];\n\nexport const ERROR_CODE_VALUES = Object.freeze(Object.values(ERROR_CODES));\n\nexport function isErrorCode(value: unknown): value is ErrorCode {\n return (\n typeof value === \"string\" &&\n (ERROR_CODE_VALUES as readonly string[]).includes(value)\n );\n}\n"],"mappings":";AACO,IAAM,0BAA0B,OAAO,OAAO;AAAA,EACnD,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,cAAc;AAChB,CAAC;AAEM,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,kCAAkC;AAYxC,IAAM,kCACX;;;ACAK,IAAM,yBAAyB;AAG/B,IAAM,oCAAoC;AAG1C,IAAM,wCAAwC;AAE9C,IAAM,oBAAoB,OAAO,OAAO,CAAC,SAAS,OAAO,CAAU;AAEnE,IAAM,+BAA+B,OAAO,OAAO;AAAA,EACxD;AAAA,EACA,GAAG;AACL,CAAU;;;AC3CV,SAAS,SAAS;AAalB,IAAM,gBAAgB,CAAC,YAAiC,EAAE,OAAO,EAAE,IAAI,OAAO;AAEvE,IAAM,+BAA+B,EAAE,aAAa;AAAA,EACzD,IAAI,EACD,OAAO,EACP,IAAI,CAAC,EACL,IAAI,wBAAwB,YAAY,EACxC,MAAM,mBAAmB;AAAA,EAC5B,OAAO,EAAE,KAAK,uBAAuB;AAAA,EACrC,gBAAgB,EAAE,KAAK,CAAC,qBAAqB,aAAa,CAAC;AAAA,EAC3D,OAAO,cAAc,wBAAwB,eAAe;AAAA,EAC5D,SAAS,cAAc,wBAAwB,iBAAiB;AAClE,CAAC;AAEM,IAAM,kBAAkB,EAAE,aAAa;AAAA,EAC5C,QAAQ,cAAc,GAAG,EAAE,SAAS;AAAA,EACpC,cAAc,cAAc,IAAK,EAA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AqB;AAAA,EACrB,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,yBAAyB;AAAA,EACzB,8BAA8B;AAAA,EAC9B,yBAAyB;AAAA,EACzB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,yBAAyB;AAAA,EACzB,gCAAgC;AAAA,EAChC,qBAAqB;AAAA,EACrB,kCAAkC;AAAA,EAClC,gCAAgC;AAAA,EAChC,oCAAoC;AAAA,EACpC,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAClB;AAEO,IAAM,6BAA6B,OAAO,OAAO;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAU;AAMH,IAAM,oBAAoB,OAAO,OAAO,OAAO,OAAO,WAAW,CAAC;AAElE,SAAS,YAAY,OAAoC;AAC9D,SACE,OAAO,UAAU,YAChB,kBAAwC,SAAS,KAAK;AAE3D;","names":[]}
@@ -121,6 +121,21 @@ declare const spotSelectionTargetSchema: z.ZodObject<{
121
121
  }, z.core.$strict>>;
122
122
  }, z.core.$strict>;
123
123
  element: z.ZodObject<{
124
+ instance: z.ZodOptional<z.ZodObject<{
125
+ id: z.ZodString;
126
+ state: z.ZodEnum<{
127
+ captured: "captured";
128
+ changed: "changed";
129
+ detached: "detached";
130
+ restored: "restored";
131
+ }>;
132
+ selectorStatus: z.ZodEnum<{
133
+ unavailable: "unavailable";
134
+ "unique-at-capture": "unique-at-capture";
135
+ }>;
136
+ label: z.ZodString;
137
+ context: z.ZodString;
138
+ }, z.core.$strict>>;
124
139
  tagName: z.ZodString;
125
140
  selector: z.ZodString;
126
141
  sanitizedHtml: z.ZodString;
@@ -226,6 +241,21 @@ declare const spotSelectionContextSchema: z.ZodObject<{
226
241
  }, z.core.$strict>>;
227
242
  }, z.core.$strict>;
228
243
  element: z.ZodObject<{
244
+ instance: z.ZodOptional<z.ZodObject<{
245
+ id: z.ZodString;
246
+ state: z.ZodEnum<{
247
+ captured: "captured";
248
+ changed: "changed";
249
+ detached: "detached";
250
+ restored: "restored";
251
+ }>;
252
+ selectorStatus: z.ZodEnum<{
253
+ unavailable: "unavailable";
254
+ "unique-at-capture": "unique-at-capture";
255
+ }>;
256
+ label: z.ZodString;
257
+ context: z.ZodString;
258
+ }, z.core.$strict>>;
229
259
  tagName: z.ZodString;
230
260
  selector: z.ZodString;
231
261
  sanitizedHtml: z.ZodString;
@@ -347,6 +377,21 @@ declare const spotAskTaskEnvelopeSchema: z.ZodObject<{
347
377
  }, z.core.$strict>>;
348
378
  }, z.core.$strict>;
349
379
  element: z.ZodObject<{
380
+ instance: z.ZodOptional<z.ZodObject<{
381
+ id: z.ZodString;
382
+ state: z.ZodEnum<{
383
+ captured: "captured";
384
+ changed: "changed";
385
+ detached: "detached";
386
+ restored: "restored";
387
+ }>;
388
+ selectorStatus: z.ZodEnum<{
389
+ unavailable: "unavailable";
390
+ "unique-at-capture": "unique-at-capture";
391
+ }>;
392
+ label: z.ZodString;
393
+ context: z.ZodString;
394
+ }, z.core.$strict>>;
350
395
  tagName: z.ZodString;
351
396
  selector: z.ZodString;
352
397
  sanitizedHtml: z.ZodString;
@@ -473,6 +518,21 @@ declare const spotChangeTaskEnvelopeSchema: z.ZodObject<{
473
518
  }, z.core.$strict>>;
474
519
  }, z.core.$strict>;
475
520
  element: z.ZodObject<{
521
+ instance: z.ZodOptional<z.ZodObject<{
522
+ id: z.ZodString;
523
+ state: z.ZodEnum<{
524
+ captured: "captured";
525
+ changed: "changed";
526
+ detached: "detached";
527
+ restored: "restored";
528
+ }>;
529
+ selectorStatus: z.ZodEnum<{
530
+ unavailable: "unavailable";
531
+ "unique-at-capture": "unique-at-capture";
532
+ }>;
533
+ label: z.ZodString;
534
+ context: z.ZodString;
535
+ }, z.core.$strict>>;
476
536
  tagName: z.ZodString;
477
537
  selector: z.ZodString;
478
538
  sanitizedHtml: z.ZodString;
@@ -589,6 +649,21 @@ declare const spotTaskEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
589
649
  }, z.core.$strict>>;
590
650
  }, z.core.$strict>;
591
651
  element: z.ZodObject<{
652
+ instance: z.ZodOptional<z.ZodObject<{
653
+ id: z.ZodString;
654
+ state: z.ZodEnum<{
655
+ captured: "captured";
656
+ changed: "changed";
657
+ detached: "detached";
658
+ restored: "restored";
659
+ }>;
660
+ selectorStatus: z.ZodEnum<{
661
+ unavailable: "unavailable";
662
+ "unique-at-capture": "unique-at-capture";
663
+ }>;
664
+ label: z.ZodString;
665
+ context: z.ZodString;
666
+ }, z.core.$strict>>;
592
667
  tagName: z.ZodString;
593
668
  selector: z.ZodString;
594
669
  sanitizedHtml: z.ZodString;
@@ -714,6 +789,21 @@ declare const spotTaskEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
714
789
  }, z.core.$strict>>;
715
790
  }, z.core.$strict>;
716
791
  element: z.ZodObject<{
792
+ instance: z.ZodOptional<z.ZodObject<{
793
+ id: z.ZodString;
794
+ state: z.ZodEnum<{
795
+ captured: "captured";
796
+ changed: "changed";
797
+ detached: "detached";
798
+ restored: "restored";
799
+ }>;
800
+ selectorStatus: z.ZodEnum<{
801
+ unavailable: "unavailable";
802
+ "unique-at-capture": "unique-at-capture";
803
+ }>;
804
+ label: z.ZodString;
805
+ context: z.ZodString;
806
+ }, z.core.$strict>>;
717
807
  tagName: z.ZodString;
718
808
  selector: z.ZodString;
719
809
  sanitizedHtml: z.ZodString;
@@ -1104,6 +1194,21 @@ declare const askJobCreateRequestSchema: z.ZodObject<{
1104
1194
  }, z.core.$strict>>;
1105
1195
  }, z.core.$strict>;
1106
1196
  element: z.ZodObject<{
1197
+ instance: z.ZodOptional<z.ZodObject<{
1198
+ id: z.ZodString;
1199
+ state: z.ZodEnum<{
1200
+ captured: "captured";
1201
+ changed: "changed";
1202
+ detached: "detached";
1203
+ restored: "restored";
1204
+ }>;
1205
+ selectorStatus: z.ZodEnum<{
1206
+ unavailable: "unavailable";
1207
+ "unique-at-capture": "unique-at-capture";
1208
+ }>;
1209
+ label: z.ZodString;
1210
+ context: z.ZodString;
1211
+ }, z.core.$strict>>;
1107
1212
  tagName: z.ZodString;
1108
1213
  selector: z.ZodString;
1109
1214
  sanitizedHtml: z.ZodString;
@@ -121,6 +121,21 @@ declare const spotSelectionTargetSchema: z.ZodObject<{
121
121
  }, z.core.$strict>>;
122
122
  }, z.core.$strict>;
123
123
  element: z.ZodObject<{
124
+ instance: z.ZodOptional<z.ZodObject<{
125
+ id: z.ZodString;
126
+ state: z.ZodEnum<{
127
+ captured: "captured";
128
+ changed: "changed";
129
+ detached: "detached";
130
+ restored: "restored";
131
+ }>;
132
+ selectorStatus: z.ZodEnum<{
133
+ unavailable: "unavailable";
134
+ "unique-at-capture": "unique-at-capture";
135
+ }>;
136
+ label: z.ZodString;
137
+ context: z.ZodString;
138
+ }, z.core.$strict>>;
124
139
  tagName: z.ZodString;
125
140
  selector: z.ZodString;
126
141
  sanitizedHtml: z.ZodString;
@@ -226,6 +241,21 @@ declare const spotSelectionContextSchema: z.ZodObject<{
226
241
  }, z.core.$strict>>;
227
242
  }, z.core.$strict>;
228
243
  element: z.ZodObject<{
244
+ instance: z.ZodOptional<z.ZodObject<{
245
+ id: z.ZodString;
246
+ state: z.ZodEnum<{
247
+ captured: "captured";
248
+ changed: "changed";
249
+ detached: "detached";
250
+ restored: "restored";
251
+ }>;
252
+ selectorStatus: z.ZodEnum<{
253
+ unavailable: "unavailable";
254
+ "unique-at-capture": "unique-at-capture";
255
+ }>;
256
+ label: z.ZodString;
257
+ context: z.ZodString;
258
+ }, z.core.$strict>>;
229
259
  tagName: z.ZodString;
230
260
  selector: z.ZodString;
231
261
  sanitizedHtml: z.ZodString;
@@ -347,6 +377,21 @@ declare const spotAskTaskEnvelopeSchema: z.ZodObject<{
347
377
  }, z.core.$strict>>;
348
378
  }, z.core.$strict>;
349
379
  element: z.ZodObject<{
380
+ instance: z.ZodOptional<z.ZodObject<{
381
+ id: z.ZodString;
382
+ state: z.ZodEnum<{
383
+ captured: "captured";
384
+ changed: "changed";
385
+ detached: "detached";
386
+ restored: "restored";
387
+ }>;
388
+ selectorStatus: z.ZodEnum<{
389
+ unavailable: "unavailable";
390
+ "unique-at-capture": "unique-at-capture";
391
+ }>;
392
+ label: z.ZodString;
393
+ context: z.ZodString;
394
+ }, z.core.$strict>>;
350
395
  tagName: z.ZodString;
351
396
  selector: z.ZodString;
352
397
  sanitizedHtml: z.ZodString;
@@ -473,6 +518,21 @@ declare const spotChangeTaskEnvelopeSchema: z.ZodObject<{
473
518
  }, z.core.$strict>>;
474
519
  }, z.core.$strict>;
475
520
  element: z.ZodObject<{
521
+ instance: z.ZodOptional<z.ZodObject<{
522
+ id: z.ZodString;
523
+ state: z.ZodEnum<{
524
+ captured: "captured";
525
+ changed: "changed";
526
+ detached: "detached";
527
+ restored: "restored";
528
+ }>;
529
+ selectorStatus: z.ZodEnum<{
530
+ unavailable: "unavailable";
531
+ "unique-at-capture": "unique-at-capture";
532
+ }>;
533
+ label: z.ZodString;
534
+ context: z.ZodString;
535
+ }, z.core.$strict>>;
476
536
  tagName: z.ZodString;
477
537
  selector: z.ZodString;
478
538
  sanitizedHtml: z.ZodString;
@@ -589,6 +649,21 @@ declare const spotTaskEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
589
649
  }, z.core.$strict>>;
590
650
  }, z.core.$strict>;
591
651
  element: z.ZodObject<{
652
+ instance: z.ZodOptional<z.ZodObject<{
653
+ id: z.ZodString;
654
+ state: z.ZodEnum<{
655
+ captured: "captured";
656
+ changed: "changed";
657
+ detached: "detached";
658
+ restored: "restored";
659
+ }>;
660
+ selectorStatus: z.ZodEnum<{
661
+ unavailable: "unavailable";
662
+ "unique-at-capture": "unique-at-capture";
663
+ }>;
664
+ label: z.ZodString;
665
+ context: z.ZodString;
666
+ }, z.core.$strict>>;
592
667
  tagName: z.ZodString;
593
668
  selector: z.ZodString;
594
669
  sanitizedHtml: z.ZodString;
@@ -714,6 +789,21 @@ declare const spotTaskEnvelopeSchema: z.ZodUnion<readonly [z.ZodObject<{
714
789
  }, z.core.$strict>>;
715
790
  }, z.core.$strict>;
716
791
  element: z.ZodObject<{
792
+ instance: z.ZodOptional<z.ZodObject<{
793
+ id: z.ZodString;
794
+ state: z.ZodEnum<{
795
+ captured: "captured";
796
+ changed: "changed";
797
+ detached: "detached";
798
+ restored: "restored";
799
+ }>;
800
+ selectorStatus: z.ZodEnum<{
801
+ unavailable: "unavailable";
802
+ "unique-at-capture": "unique-at-capture";
803
+ }>;
804
+ label: z.ZodString;
805
+ context: z.ZodString;
806
+ }, z.core.$strict>>;
717
807
  tagName: z.ZodString;
718
808
  selector: z.ZodString;
719
809
  sanitizedHtml: z.ZodString;
@@ -1104,6 +1194,21 @@ declare const askJobCreateRequestSchema: z.ZodObject<{
1104
1194
  }, z.core.$strict>>;
1105
1195
  }, z.core.$strict>;
1106
1196
  element: z.ZodObject<{
1197
+ instance: z.ZodOptional<z.ZodObject<{
1198
+ id: z.ZodString;
1199
+ state: z.ZodEnum<{
1200
+ captured: "captured";
1201
+ changed: "changed";
1202
+ detached: "detached";
1203
+ restored: "restored";
1204
+ }>;
1205
+ selectorStatus: z.ZodEnum<{
1206
+ unavailable: "unavailable";
1207
+ "unique-at-capture": "unique-at-capture";
1208
+ }>;
1209
+ label: z.ZodString;
1210
+ context: z.ZodString;
1211
+ }, z.core.$strict>>;
1107
1212
  tagName: z.ZodString;
1108
1213
  selector: z.ZodString;
1109
1214
  sanitizedHtml: z.ZodString;
@@ -1,4 +1,4 @@
1
- export { A as ASK_ANSWER_WARNING_CODES, a as ASK_EXECUTOR_ANSWER_WARNING_CODES, b as ASK_FILE_COUNT_BUCKETS, c as ASK_JOB_STATUSES, d as ASK_READ_ACTIVITY_STATES, e as ASK_SOURCE_CONFIDENCES, f as AskAnswerBlock, g as AskAnswerResult, h as AskAnswerWarning, i as AskAnswerWarningCode, j as AskDraftOrigin, k as AskExecutorAnswerWarningCode, l as AskFileCountBucket, m as AskJobActionRequest, n as AskJobCreateRequest, o as AskJobEvent, p as AskJobEventsRequest, q as AskJobResultResponse, r as AskJobSnapshot, s as AskJobStatus, t as AskReadActivityState, u as AskSourceConfidence, v as AskSourceReference, C as CONTEXTUAL_ASK_EXECUTOR_KINDS, w as CONTEXTUAL_ASK_EXECUTOR_STATES, x as CONTEXTUAL_ASK_LIMITS, y as CONTEXTUAL_ASK_SCHEMA_VERSION, z as ContextualAskCapability, B as ContextualAskCapabilityRequest, D as ContextualAskExecutorCapability, E as ContextualAskExecutorKind, F as ContextualAskExecutorState, S as SpotAskTaskEnvelope, G as SpotChangeTaskEnvelope, H as SpotSelectionContext, I as SpotSelectionTarget, J as SpotTaskEnvelope } from './contextual-ask-BbmHG3Z8.cjs';
1
+ export { A as ASK_ANSWER_WARNING_CODES, a as ASK_EXECUTOR_ANSWER_WARNING_CODES, b as ASK_FILE_COUNT_BUCKETS, c as ASK_JOB_STATUSES, d as ASK_READ_ACTIVITY_STATES, e as ASK_SOURCE_CONFIDENCES, f as AskAnswerBlock, g as AskAnswerResult, h as AskAnswerWarning, i as AskAnswerWarningCode, j as AskDraftOrigin, k as AskExecutorAnswerWarningCode, l as AskFileCountBucket, m as AskJobActionRequest, n as AskJobCreateRequest, o as AskJobEvent, p as AskJobEventsRequest, q as AskJobResultResponse, r as AskJobSnapshot, s as AskJobStatus, t as AskReadActivityState, u as AskSourceConfidence, v as AskSourceReference, C as CONTEXTUAL_ASK_EXECUTOR_KINDS, w as CONTEXTUAL_ASK_EXECUTOR_STATES, x as CONTEXTUAL_ASK_LIMITS, y as CONTEXTUAL_ASK_SCHEMA_VERSION, z as ContextualAskCapability, B as ContextualAskCapabilityRequest, D as ContextualAskExecutorCapability, E as ContextualAskExecutorKind, F as ContextualAskExecutorState, S as SpotAskTaskEnvelope, G as SpotChangeTaskEnvelope, H as SpotSelectionContext, I as SpotSelectionTarget, J as SpotTaskEnvelope } from './contextual-ask-Dz3Mh9LR.cjs';
2
2
  export { A as AskJobAction, S as SPOTPATCH_ENDPOINTS, a as SPOTPATCH_TOKEN_HEADER, g as getAskJobEndpoint } from './endpoints-O3ohYyAo.cjs';
3
3
  import 'zod';
4
4
 
@@ -1,4 +1,4 @@
1
- export { A as ASK_ANSWER_WARNING_CODES, a as ASK_EXECUTOR_ANSWER_WARNING_CODES, b as ASK_FILE_COUNT_BUCKETS, c as ASK_JOB_STATUSES, d as ASK_READ_ACTIVITY_STATES, e as ASK_SOURCE_CONFIDENCES, f as AskAnswerBlock, g as AskAnswerResult, h as AskAnswerWarning, i as AskAnswerWarningCode, j as AskDraftOrigin, k as AskExecutorAnswerWarningCode, l as AskFileCountBucket, m as AskJobActionRequest, n as AskJobCreateRequest, o as AskJobEvent, p as AskJobEventsRequest, q as AskJobResultResponse, r as AskJobSnapshot, s as AskJobStatus, t as AskReadActivityState, u as AskSourceConfidence, v as AskSourceReference, C as CONTEXTUAL_ASK_EXECUTOR_KINDS, w as CONTEXTUAL_ASK_EXECUTOR_STATES, x as CONTEXTUAL_ASK_LIMITS, y as CONTEXTUAL_ASK_SCHEMA_VERSION, z as ContextualAskCapability, B as ContextualAskCapabilityRequest, D as ContextualAskExecutorCapability, E as ContextualAskExecutorKind, F as ContextualAskExecutorState, S as SpotAskTaskEnvelope, G as SpotChangeTaskEnvelope, H as SpotSelectionContext, I as SpotSelectionTarget, J as SpotTaskEnvelope } from './contextual-ask-BbmHG3Z8.js';
1
+ export { A as ASK_ANSWER_WARNING_CODES, a as ASK_EXECUTOR_ANSWER_WARNING_CODES, b as ASK_FILE_COUNT_BUCKETS, c as ASK_JOB_STATUSES, d as ASK_READ_ACTIVITY_STATES, e as ASK_SOURCE_CONFIDENCES, f as AskAnswerBlock, g as AskAnswerResult, h as AskAnswerWarning, i as AskAnswerWarningCode, j as AskDraftOrigin, k as AskExecutorAnswerWarningCode, l as AskFileCountBucket, m as AskJobActionRequest, n as AskJobCreateRequest, o as AskJobEvent, p as AskJobEventsRequest, q as AskJobResultResponse, r as AskJobSnapshot, s as AskJobStatus, t as AskReadActivityState, u as AskSourceConfidence, v as AskSourceReference, C as CONTEXTUAL_ASK_EXECUTOR_KINDS, w as CONTEXTUAL_ASK_EXECUTOR_STATES, x as CONTEXTUAL_ASK_LIMITS, y as CONTEXTUAL_ASK_SCHEMA_VERSION, z as ContextualAskCapability, B as ContextualAskCapabilityRequest, D as ContextualAskExecutorCapability, E as ContextualAskExecutorKind, F as ContextualAskExecutorState, S as SpotAskTaskEnvelope, G as SpotChangeTaskEnvelope, H as SpotSelectionContext, I as SpotSelectionTarget, J as SpotTaskEnvelope } from './contextual-ask-Dz3Mh9LR.js';
2
2
  export { A as AskJobAction, S as SPOTPATCH_ENDPOINTS, a as SPOTPATCH_TOKEN_HEADER, g as getAskJobEndpoint } from './endpoints-O3ohYyAo.js';
3
3
  import 'zod';
4
4
 
@@ -66,6 +66,22 @@ module.exports = __toCommonJS(contextual_ask_node_exports);
66
66
  // src/model/context-schema.ts
67
67
  var import_zod = require("zod");
68
68
 
69
+ // src/model/element-instance.ts
70
+ var ELEMENT_INSTANCE_LIMITS = Object.freeze({
71
+ idCharacters: 128,
72
+ contextCharacters: 1200,
73
+ labelCharacters: 160,
74
+ selectorCharacters: 2048,
75
+ ancestorDepth: 8,
76
+ locatorDepth: 32
77
+ });
78
+ var ELEMENT_INSTANCE_STATES = [
79
+ "captured",
80
+ "changed",
81
+ "detached",
82
+ "restored"
83
+ ];
84
+
69
85
  // src/model/annotation.ts
70
86
  var MAX_ANNOTATION_TARGETS = 20;
71
87
  var MAX_TARGET_INSTRUCTION_CHARACTERS = 2e3;
@@ -78,6 +94,13 @@ var SPOTPATCH_LOCALE_PREFERENCES = Object.freeze([
78
94
 
79
95
  // src/model/context-schema.ts
80
96
  var boundedString = (maximum) => import_zod.z.string().max(maximum);
97
+ var elementInstanceContextSchema = import_zod.z.strictObject({
98
+ id: import_zod.z.string().min(1).max(ELEMENT_INSTANCE_LIMITS.idCharacters).regex(/^[A-Za-z0-9_-]+$/u),
99
+ state: import_zod.z.enum(ELEMENT_INSTANCE_STATES),
100
+ selectorStatus: import_zod.z.enum(["unique-at-capture", "unavailable"]),
101
+ label: boundedString(ELEMENT_INSTANCE_LIMITS.labelCharacters),
102
+ context: boundedString(ELEMENT_INSTANCE_LIMITS.contextCharacters)
103
+ });
81
104
  var sourceRefSchema = import_zod.z.strictObject({
82
105
  fileId: boundedString(128).optional(),
83
106
  relativePath: boundedString(1024).optional(),
@@ -122,6 +145,7 @@ var spotTargetContextSchema = import_zod.z.strictObject({
122
145
  source: sourceRefSchema.optional()
123
146
  }),
124
147
  element: import_zod.z.strictObject({
148
+ instance: elementInstanceContextSchema.optional(),
125
149
  tagName: boundedString(128),
126
150
  selector: boundedString(2048),
127
151
  sanitizedHtml: boundedString(8192),