anniedrawing 0.3.1

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 (97) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +292 -0
  4. package/README.md +162 -0
  5. package/dist/agent/describe.d.ts +12 -0
  6. package/dist/agent/index.d.ts +10 -0
  7. package/dist/agent/index.js +2 -0
  8. package/dist/agent/index.js.map +1 -0
  9. package/dist/agent/place.d.ts +4 -0
  10. package/dist/agent/query.d.ts +3 -0
  11. package/dist/agent/toolDefs.d.ts +343 -0
  12. package/dist/board.d.ts +193 -0
  13. package/dist/core/catalog.d.ts +22 -0
  14. package/dist/core/clipboard.d.ts +2 -0
  15. package/dist/core/defaults.d.ts +19 -0
  16. package/dist/core/doc.d.ts +2 -0
  17. package/dist/core/ids.d.ts +5 -0
  18. package/dist/core/index.d.ts +16 -0
  19. package/dist/core/index.js +1 -0
  20. package/dist/core/item.d.ts +25 -0
  21. package/dist/core/links.d.ts +21 -0
  22. package/dist/core/locks.d.ts +3 -0
  23. package/dist/core/migrate.d.ts +5 -0
  24. package/dist/core/paste.d.ts +27 -0
  25. package/dist/core/schema.d.ts +644 -0
  26. package/dist/core/types.d.ts +313 -0
  27. package/dist/docs/agents-repository.md +56 -0
  28. package/dist/docs/agents.md +157 -0
  29. package/dist/docs/api.md +258 -0
  30. package/dist/docs/board-js.md +345 -0
  31. package/dist/docs/code-of-conduct.md +11 -0
  32. package/dist/docs/contributing.md +35 -0
  33. package/dist/docs/decisions.md +107 -0
  34. package/dist/docs/extensions.md +122 -0
  35. package/dist/docs/format.md +79 -0
  36. package/dist/docs/index.html +993 -0
  37. package/dist/docs/license.txt +21 -0
  38. package/dist/docs/llms-full.txt +345 -0
  39. package/dist/docs/llms.txt +90 -0
  40. package/dist/docs/mcp.md +97 -0
  41. package/dist/docs/notice.txt +292 -0
  42. package/dist/docs/nunito-OFL.txt +93 -0
  43. package/dist/docs/releasing.md +38 -0
  44. package/dist/docs/security.md +33 -0
  45. package/dist/favicon.svg +1 -0
  46. package/dist/fellow.d.ts +7 -0
  47. package/dist/fellow.js +2 -0
  48. package/dist/fellow.js.map +1 -0
  49. package/dist/geo/box.d.ts +13 -0
  50. package/dist/geo/index.d.ts +5 -0
  51. package/dist/geo/picker.d.ts +25 -0
  52. package/dist/geo/router.d.ts +11 -0
  53. package/dist/geo/vec.d.ts +8 -0
  54. package/dist/index.d.ts +7 -0
  55. package/dist/index.js +1 -0
  56. package/dist/input/autosave.d.ts +2 -0
  57. package/dist/input/cursors.d.ts +8 -0
  58. package/dist/input/measure.d.ts +6 -0
  59. package/dist/input/urlPaste.d.ts +18 -0
  60. package/dist/kinds/index.d.ts +2 -0
  61. package/dist/kinds/registry.d.ts +45 -0
  62. package/dist/porter/index.d.ts +5 -0
  63. package/dist/porter/indexedPng.d.ts +13 -0
  64. package/dist/porter/json.d.ts +3 -0
  65. package/dist/porter/png.d.ts +10 -0
  66. package/dist/porter/svg.d.ts +9 -0
  67. package/dist/shared/board-Bya0O1I7.js +2 -0
  68. package/dist/shared/board-Bya0O1I7.js.map +1 -0
  69. package/dist/shared/cards-DWgSVE54.js +2 -0
  70. package/dist/shared/cards-DWgSVE54.js.map +1 -0
  71. package/dist/shared/defaults-C-aC_B4z.js +2 -0
  72. package/dist/shared/defaults-C-aC_B4z.js.map +1 -0
  73. package/dist/shared/describe-DaWyf3qV.js +3 -0
  74. package/dist/shared/describe-DaWyf3qV.js.map +1 -0
  75. package/dist/shared/paste-C22i8o-g.js +2 -0
  76. package/dist/shared/paste-C22i8o-g.js.map +1 -0
  77. package/dist/shared/picker-Dv_i4iNP.js +2 -0
  78. package/dist/shared/picker-Dv_i4iNP.js.map +1 -0
  79. package/dist/shared/ui-Cay6AVqT.js +2 -0
  80. package/dist/shared/ui-Cay6AVqT.js.map +1 -0
  81. package/dist/shared/urlPaste-DN4JtgeB.js +2 -0
  82. package/dist/shared/urlPaste-DN4JtgeB.js.map +1 -0
  83. package/dist/stage/cards.d.ts +2 -0
  84. package/dist/stage/index.d.ts +3 -0
  85. package/dist/stage/itemView.d.ts +22 -0
  86. package/dist/stage/lens.d.ts +26 -0
  87. package/dist/stage/paint.d.ts +23 -0
  88. package/dist/stage/presence.d.ts +50 -0
  89. package/dist/stage/stage.d.ts +60 -0
  90. package/dist/style.css +2 -0
  91. package/dist/ui/icons.d.ts +2 -0
  92. package/dist/ui/index.d.ts +16 -0
  93. package/dist/ui/index.js +1 -0
  94. package/dist/ui/version.d.ts +3 -0
  95. package/llms-full.txt +345 -0
  96. package/llms.txt +90 -0
  97. package/package.json +120 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../node_modules/@valibot/to-json-schema/dist/index.mjs","../../src/agent/toolDefs.ts"],"sourcesContent":["//#region src/utils/addError.ts\n/**\n* Adds an error message to the errors array.\n*\n* @param errors The array of error messages.\n* @param message The error message to add.\n*\n* @returns The new errors.\n*/\nfunction addError(errors, message) {\n\tif (errors) {\n\t\terrors.push(message);\n\t\treturn errors;\n\t}\n\treturn [message];\n}\n\n//#endregion\n//#region src/utils/escapeRegExp.ts\nconst ESCAPE_REGEX = /[.*+?^${}()|[\\]\\\\]/g;\n/**\n* Escapes special regex characters in a string.\n*\n* @param string The string to escape.\n*\n* @returns The escaped string.\n*/\nfunction escapeRegExp(string) {\n\treturn string.replace(ESCAPE_REGEX, \"\\\\$&\");\n}\n\n//#endregion\n//#region src/utils/handleError.ts\n/**\n* Throws an error or logs a warning based on the configuration.\n*\n* @param message The message to throw or log.\n* @param config The conversion configuration.\n*/\nfunction handleError(message, config) {\n\tswitch (config?.errorMode) {\n\t\tcase \"ignore\": break;\n\t\tcase \"warn\":\n\t\t\tconsole.warn(message);\n\t\t\tbreak;\n\t\tdefault: throw new Error(message);\n\t}\n}\n\n//#endregion\n//#region src/utils/isJsonConstValue.ts\n/**\n* Whether a value is JSON compatible for a const keyword.\n*\n* @param value The value to check.\n*\n* @returns Whether the value is JSON compatible.\n*/\nfunction isJsonConstValue(value) {\n\treturn typeof value === \"boolean\" || typeof value === \"number\" && Number.isFinite(value) || typeof value === \"string\";\n}\n\n//#endregion\n//#region src/utils/isJsonEnumValues.ts\n/**\n* Whether values are JSON compatible for an enum keyword.\n*\n* @param values The values to check.\n*\n* @returns Whether the values are JSON compatible.\n*/\nfunction isJsonEnumValues(values) {\n\treturn values.every(isJsonConstValue);\n}\n\n//#endregion\n//#region src/utils/ReferenceMap.ts\n/**\n* Schema reference map with collision-free reference ID allocation.\n*/\nvar ReferenceMap = class extends Map {\n\t/**\n\t* Creates an empty schema reference map.\n\t*/\n\tconstructor() {\n\t\tsuper();\n\t\tthis.count = 0;\n\t\tthis.usedIds = /* @__PURE__ */ new Set();\n\t}\n\t/**\n\t* Adds a schema reference and reserves its ID.\n\t*\n\t* @param schema The Valibot schema.\n\t* @param referenceId The reference ID.\n\t*\n\t* @returns The reference map.\n\t*/\n\tset(schema, referenceId) {\n\t\tthis.usedIds.add(referenceId);\n\t\treturn super.set(schema, referenceId);\n\t}\n\t/**\n\t* Creates a reference ID that is not yet used.\n\t*\n\t* @param definitions The JSON Schema definitions.\n\t*\n\t* @returns The unused reference ID.\n\t*/\n\tcreateId(definitions) {\n\t\twhile (this.usedIds.has(`${this.count}`) || `${this.count}` in definitions) this.count++;\n\t\treturn `${this.count++}`;\n\t}\n};\n\n//#endregion\n//#region src/converters/convertAction/convertAction.ts\n/**\n* Returns the stricter lower bound.\n*\n* @param current The current lower bound.\n* @param value The new lower bound.\n*\n* @returns The stricter lower bound.\n*/\nfunction getLowerBound(current, value) {\n\tif (typeof current !== \"number\" || !Number.isFinite(current) || value > current) return value;\n\treturn current;\n}\n/**\n* Returns the stricter upper bound.\n*\n* @param current The current upper bound.\n* @param value The new upper bound.\n*\n* @returns The stricter upper bound.\n*/\nfunction getUpperBound(current, value) {\n\tif (typeof current !== \"number\" || !Number.isFinite(current) || value < current) return value;\n\treturn current;\n}\n/**\n* Returns the combined not restriction.\n*\n* @param current The current not restriction.\n* @param value The new not restriction.\n*\n* @returns The combined not restriction.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getNotRestriction(current, value) {\n\treturn current !== void 0 ? { anyOf: [current, value] } : value;\n}\n/**\n* Intersects allowed values with an existing enum restriction.\n*\n* @param jsonSchema The JSON Schema object.\n* @param values The allowed values.\n*/\nfunction intersectEnum(jsonSchema, values) {\n\tlet enumValues = jsonSchema.enum ?? values;\n\tif (jsonSchema.enum) {\n\t\tconst valueSet = new Set(values);\n\t\tenumValues = enumValues.filter((value) => valueSet.has(value));\n\t}\n\tif (enumValues.length) jsonSchema.enum = [...new Set(enumValues)];\n\telse {\n\t\tdelete jsonSchema.enum;\n\t\tjsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, {});\n\t}\n}\n/**\n* Converts any supported Valibot action to the JSON Schema format.\n*\n* @param jsonSchema The JSON Schema object.\n* @param valibotAction The Valibot action object.\n* @param config The conversion configuration.\n*\n* @returns The converted JSON Schema.\n*/\nfunction convertAction(jsonSchema, valibotAction, config) {\n\tif (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;\n\tlet errors;\n\tswitch (valibotAction.type) {\n\t\tcase \"base64\":\n\t\t\tjsonSchema.contentEncoding = \"base64\";\n\t\t\tbreak;\n\t\tcase \"bic\":\n\t\tcase \"cuid2\":\n\t\tcase \"decimal\":\n\t\tcase \"digits\":\n\t\tcase \"domain\":\n\t\tcase \"emoji\":\n\t\tcase \"hash\":\n\t\tcase \"hexadecimal\":\n\t\tcase \"hex_color\":\n\t\tcase \"isrc\":\n\t\tcase \"iso_time_second\":\n\t\tcase \"iso_week\":\n\t\tcase \"ksuid\":\n\t\tcase \"mac\":\n\t\tcase \"mac48\":\n\t\tcase \"mac64\":\n\t\tcase \"nanoid\":\n\t\tcase \"octal\":\n\t\tcase \"slug\":\n\t\tcase \"ulid\":\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = valibotAction.requirement.source;\n\t\t\tbreak;\n\t\tcase \"description\":\n\t\t\tjsonSchema.description = valibotAction.description;\n\t\t\tbreak;\n\t\tcase \"email\":\n\t\tcase \"rfc_email\":\n\t\t\tjsonSchema.format = \"email\";\n\t\t\tbreak;\n\t\tcase \"ends_with\":\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = `${escapeRegExp(valibotAction.requirement)}$`;\n\t\t\tbreak;\n\t\tcase \"empty\":\n\t\t\tif (jsonSchema.type === \"array\") jsonSchema.maxItems = 0;\n\t\t\telse {\n\t\t\t\tif (jsonSchema.type !== \"string\") errors = addError(errors, `The \"${valibotAction.type}\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tjsonSchema.maxLength = 0;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"entries\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"entries\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);\n\t\t\tjsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"examples\":\n\t\t\tif (Array.isArray(jsonSchema.examples)) jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.examples];\n\t\t\telse jsonSchema.examples = valibotAction.examples;\n\t\t\tbreak;\n\t\tcase \"gt_value\":\n\t\t\tif (jsonSchema.type !== \"number\" && jsonSchema.type !== \"integer\") {\n\t\t\t\terrors = addError(errors, `The \"gt_value\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!Number.isFinite(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"gt_value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (config?.target === \"openapi-3.0\") {\n\t\t\t\terrors = addError(errors, \"The \\\"gt_value\\\" action is not supported for OpenAPI 3.0.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.exclusiveMinimum = getLowerBound(jsonSchema.exclusiveMinimum, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"includes\":\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = escapeRegExp(valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"integer\":\n\t\t\tjsonSchema.type = \"integer\";\n\t\t\tbreak;\n\t\tcase \"ipv4\":\n\t\t\tjsonSchema.format = \"ipv4\";\n\t\t\tbreak;\n\t\tcase \"ipv6\":\n\t\t\tjsonSchema.format = \"ipv6\";\n\t\t\tbreak;\n\t\tcase \"iso_date\":\n\t\t\tjsonSchema.format = \"date\";\n\t\t\tbreak;\n\t\tcase \"iso_date_time\":\n\t\tcase \"iso_timestamp\":\n\t\t\tjsonSchema.format = \"date-time\";\n\t\t\tbreak;\n\t\tcase \"iso_time\":\n\t\t\tjsonSchema.format = \"time\";\n\t\t\tbreak;\n\t\tcase \"jws_compact\":\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = valibotAction.requirement.source;\n\t\t\tbreak;\n\t\tcase \"length\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"length\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (jsonSchema.type === \"array\") {\n\t\t\t\tjsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);\n\t\t\t\tjsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);\n\t\t\t} else {\n\t\t\t\tif (jsonSchema.type !== \"string\") errors = addError(errors, `The \"${valibotAction.type}\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tjsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);\n\t\t\t\tjsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"lt_value\":\n\t\t\tif (jsonSchema.type !== \"number\" && jsonSchema.type !== \"integer\") {\n\t\t\t\terrors = addError(errors, `The \"lt_value\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!Number.isFinite(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"lt_value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (config?.target === \"openapi-3.0\") {\n\t\t\t\terrors = addError(errors, \"The \\\"lt_value\\\" action is not supported for OpenAPI 3.0.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.exclusiveMaximum = getUpperBound(jsonSchema.exclusiveMaximum, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"max_entries\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"max_entries\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.maxProperties = getUpperBound(jsonSchema.maxProperties, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"max_length\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"max_length\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (jsonSchema.type === \"array\") jsonSchema.maxItems = getUpperBound(jsonSchema.maxItems, valibotAction.requirement);\n\t\t\telse {\n\t\t\t\tif (jsonSchema.type !== \"string\") errors = addError(errors, `The \"${valibotAction.type}\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tjsonSchema.maxLength = getUpperBound(jsonSchema.maxLength, valibotAction.requirement);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"max_value\":\n\t\t\tif (jsonSchema.type !== \"number\" && jsonSchema.type !== \"integer\") {\n\t\t\t\terrors = addError(errors, `The \"max_value\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!Number.isFinite(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"max_value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.maximum = getUpperBound(jsonSchema.maximum, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"metadata\":\n\t\t\tif (typeof valibotAction.metadata.title === \"string\") jsonSchema.title = valibotAction.metadata.title;\n\t\t\tif (typeof valibotAction.metadata.description === \"string\") jsonSchema.description = valibotAction.metadata.description;\n\t\t\tif (Array.isArray(valibotAction.metadata.examples)) if (Array.isArray(jsonSchema.examples)) jsonSchema.examples = [...jsonSchema.examples, ...valibotAction.metadata.examples];\n\t\t\telse jsonSchema.examples = valibotAction.metadata.examples;\n\t\t\tfor (const key of Object.keys(valibotAction.metadata)) if (key !== \"title\" && key !== \"description\" && key !== \"examples\" && key !== \"__proto__\") jsonSchema[key] = valibotAction.metadata[key];\n\t\t\tbreak;\n\t\tcase \"min_entries\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"min_entries\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.minProperties = getLowerBound(jsonSchema.minProperties, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"min_length\":\n\t\t\tif (!Number.isInteger(valibotAction.requirement) || valibotAction.requirement < 0) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"min_length\\\" action must be a non-negative integer.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (jsonSchema.type === \"array\") jsonSchema.minItems = getLowerBound(jsonSchema.minItems, valibotAction.requirement);\n\t\t\telse {\n\t\t\t\tif (jsonSchema.type !== \"string\") errors = addError(errors, `The \"${valibotAction.type}\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tjsonSchema.minLength = getLowerBound(jsonSchema.minLength, valibotAction.requirement);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"min_value\":\n\t\t\tif (jsonSchema.type !== \"number\" && jsonSchema.type !== \"integer\") {\n\t\t\t\terrors = addError(errors, `The \"min_value\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!Number.isFinite(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"min_value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.minimum = getLowerBound(jsonSchema.minimum, valibotAction.requirement);\n\t\t\tbreak;\n\t\tcase \"multiple_of\":\n\t\t\tjsonSchema.multipleOf = valibotAction.requirement;\n\t\t\tbreak;\n\t\tcase \"non_empty\":\n\t\t\tif (jsonSchema.type === \"array\") jsonSchema.minItems = getLowerBound(jsonSchema.minItems, 1);\n\t\t\telse {\n\t\t\t\tif (jsonSchema.type !== \"string\") errors = addError(errors, `The \"${valibotAction.type}\" action is not supported on type \"${jsonSchema.type}\".`);\n\t\t\t\tjsonSchema.minLength = getLowerBound(jsonSchema.minLength, 1);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"not_value\":\n\t\t\tif (!isJsonConstValue(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"not_value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, config?.target === \"openapi-3.0\" ? { enum: [valibotAction.requirement] } : { const: valibotAction.requirement });\n\t\t\tbreak;\n\t\tcase \"not_values\":\n\t\t\tif (!isJsonEnumValues(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"A requirement of the \\\"not_values\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (valibotAction.requirement.length) jsonSchema.not = /* @__PURE__ */ getNotRestriction(jsonSchema.not, { enum: [...new Set(valibotAction.requirement)] });\n\t\t\tbreak;\n\t\tcase \"regex\":\n\t\t\tif (valibotAction.requirement.flags) errors = addError(errors, \"RegExp flags are not supported by JSON Schema.\");\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = valibotAction.requirement.source;\n\t\t\tbreak;\n\t\tcase \"safe_integer\":\n\t\t\tjsonSchema.type = \"integer\";\n\t\t\tjsonSchema.minimum = getLowerBound(jsonSchema.minimum, Number.MIN_SAFE_INTEGER);\n\t\t\tjsonSchema.maximum = getUpperBound(jsonSchema.maximum, Number.MAX_SAFE_INTEGER);\n\t\t\tbreak;\n\t\tcase \"starts_with\":\n\t\t\tif (jsonSchema.pattern) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with another regex action.`);\n\t\t\telse jsonSchema.pattern = `^${escapeRegExp(valibotAction.requirement)}`;\n\t\t\tbreak;\n\t\tcase \"title\":\n\t\t\tjsonSchema.title = valibotAction.title;\n\t\t\tbreak;\n\t\tcase \"url\":\n\t\t\tjsonSchema.format = \"uri\";\n\t\t\tbreak;\n\t\tcase \"uuid\":\n\t\t\tjsonSchema.format = \"uuid\";\n\t\t\tbreak;\n\t\tcase \"value\":\n\t\t\tif (!isJsonConstValue(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"The requirement of the \\\"value\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (config?.target === \"openapi-3.0\") intersectEnum(jsonSchema, [valibotAction.requirement]);\n\t\t\telse if (\"const\" in jsonSchema && jsonSchema.const !== valibotAction.requirement) errors = addError(errors, `The \"${valibotAction.type}\" action is not supported in combination with a different \"const\" restriction.`);\n\t\t\telse jsonSchema.const = valibotAction.requirement;\n\t\t\tbreak;\n\t\tcase \"values\":\n\t\t\tif (!isJsonEnumValues(valibotAction.requirement)) {\n\t\t\t\terrors = addError(errors, \"A requirement of the \\\"values\\\" action is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tintersectEnum(jsonSchema, valibotAction.requirement);\n\t\t\tbreak;\n\t\tdefault: errors = addError(errors, `The \"${valibotAction.type}\" action cannot be converted to JSON Schema.`);\n\t}\n\tif (config?.overrideAction) {\n\t\tconst actionOverride = config.overrideAction({\n\t\t\tvalibotAction,\n\t\t\tjsonSchema,\n\t\t\terrors\n\t\t});\n\t\tif (actionOverride) return { ...actionOverride };\n\t}\n\tif (errors) for (const message of errors) handleError(message, config);\n\treturn jsonSchema;\n}\n\n//#endregion\n//#region src/converters/convertSchema/convertSchema.ts\n/**\n* Flattens a Valibot pipe by recursively expanding nested pipes.\n*\n* @param pipe The pipeline to flatten.\n*\n* @returns A flat pipeline.\n*/\nfunction flattenPipe(pipe) {\n\treturn pipe.flatMap((item) => \"pipe\" in item ? flattenPipe(item.pipe) : item);\n}\n/**\n* Returns the JSON Pointer reference for a definition key.\n*\n* @param referenceId The unescaped definition key.\n*\n* @returns The encoded JSON Pointer fragment.\n*/\nfunction getDefinitionRef(referenceId) {\n\treturn `#/$defs/${referenceId.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\")}`;\n}\n/**\n* Converts any supported Valibot schema to the JSON Schema format.\n*\n* @param jsonSchema The JSON Schema object.\n* @param valibotSchema The Valibot schema object.\n* @param config The conversion configuration.\n* @param context The conversion context.\n* @param skipRef Whether to skip using a reference.\n*\n* @returns The converted JSON Schema.\n*/\nfunction convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {\n\tif (!skipRef) {\n\t\tconst referenceId = context.referenceMap.get(valibotSchema);\n\t\tif (referenceId) {\n\t\t\tjsonSchema.$ref = getDefinitionRef(referenceId);\n\t\t\tif (config?.overrideRef) {\n\t\t\t\tconst refOverride = config.overrideRef({\n\t\t\t\t\t...context,\n\t\t\t\t\treferenceId,\n\t\t\t\t\tvalibotSchema,\n\t\t\t\t\tjsonSchema\n\t\t\t\t});\n\t\t\t\tif (refOverride) jsonSchema.$ref = refOverride;\n\t\t\t}\n\t\t\treturn jsonSchema;\n\t\t}\n\t}\n\tif (\"pipe\" in valibotSchema) {\n\t\tconst flatPipe = flattenPipe(valibotSchema.pipe);\n\t\tlet startIndex = 0;\n\t\tlet stopIndex = flatPipe.length - 1;\n\t\tif (config?.typeMode === \"input\") {\n\t\t\tconst inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === \"schema\" || item.kind === \"transformation\" && (item.type === \"find_item\" || item.type === \"parse_json\" || item.type === \"raw_transform\" || item.type === \"reduce_items\" || item.type === \"stringify_json\" || item.type === \"to_bigint\" || item.type === \"to_boolean\" || item.type === \"to_date\" || item.type === \"to_number\" || item.type === \"to_string\" || item.type === \"transform\"));\n\t\t\tif (inputStopIndex !== -1) stopIndex = inputStopIndex;\n\t\t} else if (config?.typeMode === \"output\") {\n\t\t\tconst outputStartIndex = flatPipe.findLastIndex((item) => item.kind === \"schema\");\n\t\t\tif (outputStartIndex !== -1) startIndex = outputStartIndex;\n\t\t}\n\t\tfor (let index = startIndex; index <= stopIndex; index++) {\n\t\t\tconst valibotPipeItem = flatPipe[index];\n\t\t\tif (valibotPipeItem.kind === \"schema\") {\n\t\t\t\tif (index > startIndex) handleError(\"Set the \\\"typeMode\\\" config to \\\"input\\\" or \\\"output\\\" to convert pipelines with multiple schemas.\", config);\n\t\t\t\tjsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);\n\t\t\t} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);\n\t\t}\n\t\treturn jsonSchema;\n\t}\n\tlet errors;\n\tswitch (valibotSchema.type) {\n\t\tcase \"boolean\":\n\t\t\tjsonSchema.type = \"boolean\";\n\t\t\tbreak;\n\t\tcase \"null\":\n\t\t\tif (config?.target === \"openapi-3.0\") jsonSchema.enum = [null];\n\t\t\telse jsonSchema.type = \"null\";\n\t\t\tbreak;\n\t\tcase \"number\":\n\t\t\tjsonSchema.type = \"number\";\n\t\t\tbreak;\n\t\tcase \"string\":\n\t\t\tjsonSchema.type = \"string\";\n\t\t\tbreak;\n\t\tcase \"array\":\n\t\t\tjsonSchema.type = \"array\";\n\t\t\tjsonSchema.items = convertSchema({}, valibotSchema.item, config, context);\n\t\t\tbreak;\n\t\tcase \"tuple\":\n\t\tcase \"tuple_with_rest\":\n\t\tcase \"loose_tuple\":\n\t\tcase \"strict_tuple\":\n\t\t\tjsonSchema.type = \"array\";\n\t\t\tif (config?.target === \"openapi-3.0\") {\n\t\t\t\tjsonSchema.items = { anyOf: [] };\n\t\t\t\tjsonSchema.minItems = valibotSchema.items.length;\n\t\t\t\tfor (const item of valibotSchema.items) jsonSchema.items.anyOf.push(convertSchema({}, item, config, context));\n\t\t\t\tif (valibotSchema.type === \"tuple_with_rest\") jsonSchema.items.anyOf.push(convertSchema({}, valibotSchema.rest, config, context));\n\t\t\t\telse if (valibotSchema.type === \"strict_tuple\" || valibotSchema.type === \"tuple\") jsonSchema.maxItems = valibotSchema.items.length;\n\t\t\t} else if (config?.target === \"draft-2020-12\") {\n\t\t\t\tjsonSchema.prefixItems = [];\n\t\t\t\tjsonSchema.minItems = valibotSchema.items.length;\n\t\t\t\tfor (const item of valibotSchema.items) jsonSchema.prefixItems.push(convertSchema({}, item, config, context));\n\t\t\t\tif (valibotSchema.type === \"tuple_with_rest\") jsonSchema.items = convertSchema({}, valibotSchema.rest, config, context);\n\t\t\t\telse if (valibotSchema.type === \"strict_tuple\") jsonSchema.items = false;\n\t\t\t} else {\n\t\t\t\tjsonSchema.items = [];\n\t\t\t\tjsonSchema.minItems = valibotSchema.items.length;\n\t\t\t\tfor (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));\n\t\t\t\tif (valibotSchema.type === \"tuple_with_rest\") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);\n\t\t\t\telse if (valibotSchema.type === \"strict_tuple\") jsonSchema.additionalItems = false;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"object\":\n\t\tcase \"object_with_rest\":\n\t\tcase \"loose_object\":\n\t\tcase \"strict_object\":\n\t\t\tjsonSchema.type = \"object\";\n\t\t\tjsonSchema.properties = {};\n\t\t\tjsonSchema.required = [];\n\t\t\tfor (const key in valibotSchema.entries) {\n\t\t\t\tconst entry = valibotSchema.entries[key];\n\t\t\t\tjsonSchema.properties[key] = convertSchema({}, entry, config, context);\n\t\t\t\tif (entry.type !== \"exact_optional\" && entry.type !== \"nullish\" && entry.type !== \"optional\") jsonSchema.required.push(key);\n\t\t\t}\n\t\t\tif (valibotSchema.type === \"object_with_rest\") jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);\n\t\t\telse if (valibotSchema.type === \"strict_object\") jsonSchema.additionalProperties = false;\n\t\t\tbreak;\n\t\tcase \"record\":\n\t\t\tif (config?.target === \"openapi-3.0\" && \"pipe\" in valibotSchema.key) errors = addError(errors, \"The \\\"record\\\" schema with a schema for the key that contains a \\\"pipe\\\" cannot be converted to JSON Schema.\");\n\t\t\tif (valibotSchema.key.type !== \"string\") errors = addError(errors, `The \"record\" schema with the \"${valibotSchema.key.type}\" schema for the key cannot be converted to JSON Schema.`);\n\t\t\tjsonSchema.type = \"object\";\n\t\t\tif (config?.target !== \"openapi-3.0\") jsonSchema.propertyNames = convertSchema({}, valibotSchema.key, config, context);\n\t\t\tjsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);\n\t\t\tbreak;\n\t\tcase \"any\":\n\t\tcase \"unknown\": break;\n\t\tcase \"never\":\n\t\t\tjsonSchema.not = {};\n\t\t\tbreak;\n\t\tcase \"nullable\":\n\t\tcase \"nullish\":\n\t\t\tif (config?.target === \"openapi-3.0\") {\n\t\t\t\tconst innerSchema = convertSchema({}, valibotSchema.wrapped, config, context);\n\t\t\t\tObject.assign(jsonSchema, innerSchema);\n\t\t\t\tjsonSchema.nullable = true;\n\t\t\t} else jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: \"null\" }];\n\t\t\tif (valibotSchema.default !== void 0) jsonSchema.default = typeof valibotSchema.default === \"function\" ? valibotSchema.default() : valibotSchema.default;\n\t\t\tbreak;\n\t\tcase \"exact_optional\":\n\t\tcase \"optional\":\n\t\tcase \"undefinedable\":\n\t\t\tjsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);\n\t\t\tif (valibotSchema.default !== void 0) jsonSchema.default = typeof valibotSchema.default === \"function\" ? valibotSchema.default() : valibotSchema.default;\n\t\t\tbreak;\n\t\tcase \"literal\":\n\t\t\tif (!isJsonConstValue(valibotSchema.literal)) {\n\t\t\t\terrors = addError(errors, \"The value of the \\\"literal\\\" schema is not JSON compatible.\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (config?.target === \"openapi-3.0\") jsonSchema.enum = [valibotSchema.literal];\n\t\t\telse jsonSchema.const = valibotSchema.literal;\n\t\t\tbreak;\n\t\tcase \"enum\":\n\t\tcase \"picklist\": {\n\t\t\tconst options = valibotSchema.options;\n\t\t\tif (!options.every((option) => typeof option === \"string\" || typeof option === \"number\" && Number.isFinite(option))) {\n\t\t\t\terrors = addError(errors, `An option of the \"${valibotSchema.type}\" schema is not JSON compatible.`);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tjsonSchema.enum = options;\n\t\t\tif (options.every((option) => typeof option === \"string\")) jsonSchema.type = \"string\";\n\t\t\telse if (options.every((option) => typeof option === \"number\")) jsonSchema.type = \"number\";\n\t\t\telse if (config?.target !== \"openapi-3.0\") jsonSchema.type = [\"string\", \"number\"];\n\t\t\tbreak;\n\t\t}\n\t\tcase \"union\":\n\t\t\tjsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));\n\t\t\tbreak;\n\t\tcase \"variant\":\n\t\t\tjsonSchema.oneOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));\n\t\t\tbreak;\n\t\tcase \"intersect\":\n\t\t\tjsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));\n\t\t\tbreak;\n\t\tcase \"lazy\": {\n\t\t\tlet wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);\n\t\t\tif (!wrappedValibotSchema) {\n\t\t\t\twrappedValibotSchema = valibotSchema.getter(void 0);\n\t\t\t\tcontext.getterMap.set(valibotSchema.getter, wrappedValibotSchema);\n\t\t\t}\n\t\t\tlet referenceId = context.referenceMap.get(wrappedValibotSchema);\n\t\t\tif (!referenceId) {\n\t\t\t\treferenceId = context.referenceMap.createId(context.definitions);\n\t\t\t\tcontext.referenceMap.set(wrappedValibotSchema, referenceId);\n\t\t\t\tcontext.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);\n\t\t\t}\n\t\t\tjsonSchema.$ref = getDefinitionRef(referenceId);\n\t\t\tif (config?.overrideRef) {\n\t\t\t\tconst refOverride = config.overrideRef({\n\t\t\t\t\t...context,\n\t\t\t\t\treferenceId,\n\t\t\t\t\tvalibotSchema: wrappedValibotSchema,\n\t\t\t\t\tjsonSchema\n\t\t\t\t});\n\t\t\t\tif (refOverride) jsonSchema.$ref = refOverride;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault: errors = addError(errors, `The \"${valibotSchema.type}\" schema cannot be converted to JSON Schema.`);\n\t}\n\tif (config?.overrideSchema) {\n\t\tconst schemaOverride = config.overrideSchema({\n\t\t\t...context,\n\t\t\treferenceId: context.referenceMap.get(valibotSchema),\n\t\t\tvalibotSchema,\n\t\t\tjsonSchema,\n\t\t\terrors\n\t\t});\n\t\tif (schemaOverride) return { ...schemaOverride };\n\t}\n\tif (errors) for (const message of errors) handleError(message, config);\n\treturn jsonSchema;\n}\n\n//#endregion\n//#region src/storages/globalDefs/globalDefs.ts\nlet store;\n/**\n* Adds new definitions to the global schema definitions.\n*\n* @param definitions The schema definitions.\n*\n* @beta\n*/\nfunction addGlobalDefs(definitions) {\n\tstore = {\n\t\t...store ?? {},\n\t\t...definitions\n\t};\n}\n/**\n* Returns the current global schema definitions.\n*\n* @returns The schema definitions.\n*\n* @beta\n*/\nfunction getGlobalDefs() {\n\treturn store;\n}\n\n//#endregion\n//#region src/functions/toJsonSchema/toJsonSchema.ts\n/**\n* Converts a Valibot schema to the JSON Schema format.\n*\n* @param schema The Valibot schema object.\n* @param config The JSON Schema configuration.\n*\n* @returns The converted JSON Schema.\n*/\nfunction toJsonSchema(schema, config) {\n\tconst context = {\n\t\tdefinitions: {},\n\t\treferenceMap: new ReferenceMap(),\n\t\tgetterMap: /* @__PURE__ */ new Map()\n\t};\n\tconst definitions = config?.definitions ?? getGlobalDefs();\n\tif (definitions) {\n\t\tfor (const key in definitions) context.referenceMap.set(definitions[key], key);\n\t\tfor (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);\n\t}\n\tconst jsonSchema = convertSchema({}, schema, config, context);\n\tconst target = config?.target ?? \"draft-07\";\n\tif (target === \"draft-2020-12\") jsonSchema.$schema = \"https://json-schema.org/draft/2020-12/schema\";\n\telse if (target === \"draft-07\") jsonSchema.$schema = \"http://json-schema.org/draft-07/schema#\";\n\tif (context.referenceMap.size) jsonSchema.$defs = context.definitions;\n\treturn jsonSchema;\n}\n\n//#endregion\n//#region src/functions/toJsonSchemaDefs/toJsonSchemaDefs.ts\n/**\n* Converts Valibot schema definitions to JSON Schema definitions.\n*\n* @param definitions The Valibot schema definitions.\n* @param config The JSON Schema configuration.\n*\n* @returns The converted JSON Schema definitions.\n*/\nfunction toJsonSchemaDefs(definitions, config) {\n\tconst context = {\n\t\tdefinitions: {},\n\t\treferenceMap: new ReferenceMap(),\n\t\tgetterMap: /* @__PURE__ */ new Map()\n\t};\n\tfor (const key in definitions) context.referenceMap.set(definitions[key], key);\n\tfor (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);\n\treturn context.definitions;\n}\n\n//#endregion\n//#region src/functions/toStandardJsonSchema/toStandardJsonSchema.ts\nconst SUPPORTED_TARGETS = [\n\t\"draft-07\",\n\t\"draft-2020-12\",\n\t\"openapi-3.0\"\n];\n/**\n* Converts a Valibot schema to the Standard JSON Schema format.\n*\n* @param schema The Valibot schema object.\n*\n* @returns The Standard JSON Schema.\n*/\nfunction toStandardJsonSchema(schema) {\n\treturn { \"~standard\": {\n\t\t...schema[\"~standard\"],\n\t\tjsonSchema: {\n\t\t\tinput(options) {\n\t\t\t\tif (SUPPORTED_TARGETS.includes(options.target)) return toJsonSchema(schema, {\n\t\t\t\t\ttypeMode: \"input\",\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\t...options.libraryOptions\n\t\t\t\t});\n\t\t\t\tthrow new Error(`Unsupported target: ${options.target}`);\n\t\t\t},\n\t\t\toutput(options) {\n\t\t\t\tif (SUPPORTED_TARGETS.includes(options.target)) return toJsonSchema(schema, {\n\t\t\t\t\ttypeMode: \"output\",\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\t...options.libraryOptions\n\t\t\t\t});\n\t\t\t\tthrow new Error(`Unsupported target: ${options.target}`);\n\t\t\t}\n\t\t}\n\t} };\n}\n\n//#endregion\nexport { addGlobalDefs, getGlobalDefs, toJsonSchema, toJsonSchemaDefs, toStandardJsonSchema };","import * as v from 'valibot';\nimport { toJsonSchema } from '@valibot/to-json-schema';\nimport type {\n AnnieDoc,\n ApplyOptions,\n DescribeOptions,\n DocModel,\n ExportOptions,\n Op,\n Query,\n Scope,\n} from '../core/types';\nimport { DescribeSchema, OpsSchema, QuerySchema, VISION_PNG } from '../core/schema';\nconst scope = v.optional(v.picklist(['doc', 'page', 'selection', 'viewport']));\nconst ReadSchema = v.object({ scope });\nconst ApplySchema = v.object({\n ops: OpsSchema,\n origin: v.optional(v.string()),\n label: v.optional(v.string()),\n dryRun: v.optional(v.boolean()),\n agentName: v.optional(v.string()),\n reveal: v.optional(v.picklist(['none', 'fit'])),\n});\nconst SnapshotSchema = v.object({\n scope: v.optional(v.picklist(['doc', 'page', 'selection', 'viewport']), 'viewport'),\n scale: v.optional(v.pipe(v.number(), v.minValue(0.1), v.maxValue(4)), 2),\n labels: v.optional(v.boolean(), true),\n colors: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(2), v.maxValue(256)),\n VISION_PNG.colors,\n ),\n maxBytes: v.optional(v.pipe(v.number(), v.minValue(1)), VISION_PNG.maxBytes),\n});\nconst FitSchema = v.object({ ids: v.optional(v.array(v.string())) });\nexport const toolSchemas = {\n board_describe: DescribeSchema,\n board_read: ReadSchema,\n board_query: QuerySchema,\n board_apply: ApplySchema,\n board_snapshot: SnapshotSchema,\n board_view_fit: FitSchema,\n};\nconst descriptions: Record<keyof typeof toolSchemas, string> = {\n board_describe:\n 'Read a deterministic text description of the board, item IDs, connections, and layout. Start here before editing.',\n board_read: 'Read a deep JSON copy of the drawing. Use item IDs in subsequent operations.',\n board_query:\n 'Find items by kind, text, bounds, parent, metadata, or connected endpoint. Filters combine with AND.',\n board_apply:\n 'Atomically apply drawing operations. Supply IDs when later operations reference new items. Relative placement avoids coordinate guessing. Use dryRun to validate before editing.',\n board_snapshot:\n 'Export a labeled PNG of a live browser board for vision models. Defaults to the viewport, item ID labels, a 32-color indexed PNG, and a 240 KiB budget. Requires a board with export support.',\n board_view_fit:\n 'Fit the live board camera to all content or the supplied item IDs. Requires a live browser board.',\n};\nexport interface ToolDefinition {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n}\nexport const toolDefs: ToolDefinition[] = Object.entries(toolSchemas).map(([name, schema]) => {\n const inputSchema = toJsonSchema(schema, { errorMode: 'ignore' }) as unknown as Record<\n string,\n unknown\n >;\n if (name === 'board_snapshot') {\n const properties = (inputSchema.properties ?? {}) as Record<string, Record<string, unknown>>;\n properties.scope = { ...properties.scope, default: 'viewport' };\n properties.scale = { ...properties.scale, default: 2 };\n properties.labels = { ...properties.labels, default: true };\n properties.colors = { ...properties.colors, default: VISION_PNG.colors };\n properties.maxBytes = { ...properties.maxBytes, default: VISION_PNG.maxBytes };\n }\n return {\n name,\n description: descriptions[name as keyof typeof toolSchemas],\n inputSchema,\n };\n});\nexport interface AgentBoard {\n get: DocModel['get'];\n query: DocModel['query'];\n describe: DocModel['describe'];\n apply: DocModel['apply'];\n agentName?: string;\n toJSON?: () => AnnieDoc;\n read?: (scope?: Scope) => AnnieDoc;\n export?: (\n format: 'png' | 'jpeg' | 'webp',\n options?: ExportOptions,\n ) => Promise<Blob | string> | Blob | string;\n view?: {\n fit: (ids?: string[]) => unknown;\n };\n}\nexport async function runTool(\n board: AgentBoard,\n name: string,\n input: unknown = {},\n): Promise<unknown> {\n if (!Object.hasOwn(toolSchemas, name))\n return {\n ok: false,\n error: {\n code: 'UNKNOWN_TOOL',\n message: `Unknown tool ${name}. Available tools: ${toolDefs.map((t) => t.name).join(', ')}.`,\n },\n };\n const schema = toolSchemas[name as keyof typeof toolSchemas],\n result = v.safeParse(schema, input);\n if (!result.success)\n return {\n ok: false,\n error: {\n code: 'INVALID_INPUT',\n message: result.issues.map((issue) => issue.message).join('; '),\n },\n };\n const args = result.output as Record<string, unknown>;\n try {\n if (name === 'board_describe') return board.describe(args as DescribeOptions);\n if (name === 'board_read') {\n if (board.read) return board.read(args.scope as Scope | undefined);\n if (args.scope && args.scope !== 'doc')\n return {\n ok: false,\n error: {\n code: 'UNSUPPORTED_SCOPE',\n message:\n 'Headless documents support doc scope. Use query with page or inside for narrower results.',\n },\n };\n return board.toJSON?.();\n }\n if (name === 'board_query') return board.query(args as Query);\n if (name === 'board_apply')\n return board.apply(\n args.ops as Op[],\n {\n origin:\n typeof args.origin === 'string' && args.origin.startsWith('agent:')\n ? args.origin\n : 'agent:tool',\n label: args.label,\n dryRun: args.dryRun,\n reveal: args.reveal,\n ...(board.agentName ? {} : { agentName: args.agentName }),\n } as ApplyOptions,\n );\n if (name === 'board_snapshot') {\n if (!board.export)\n return {\n ok: false,\n error: {\n code: 'BROWSER_REQUIRED',\n message:\n 'PNG snapshots require a live browser board. Use board_read or board_describe for a headless document.',\n },\n };\n return await board.export('png', {\n scope: (args.scope as Scope) ?? 'viewport',\n scale: (args.scale as number) ?? 2,\n labels: args.labels !== false,\n colors: (args.colors as number) ?? VISION_PNG.colors,\n maxBytes: (args.maxBytes as number) ?? VISION_PNG.maxBytes,\n });\n }\n if (name === 'board_view_fit') {\n if (!board.view)\n return {\n ok: false,\n error: {\n code: 'BROWSER_REQUIRED',\n message: 'Camera controls require a live browser board.',\n },\n };\n board.view.fit(args.ids as string[] | undefined);\n return { ok: true };\n }\n } catch (error) {\n return {\n ok: false,\n error: {\n code: 'TOOL_FAILED',\n message: error instanceof Error ? error.message : String(error),\n },\n };\n }\n}\n"],"x_google_ignoreList":[0],"mappings":"gRASA,SAAS,EAAS,EAAQ,GACzB,OAAI,GACH,EAAO,KAAK,GACL,GAED,CAAC,EACT,CAIA,IAAM,EAAe,sBAQrB,SAAS,EAAa,GACrB,OAAO,EAAO,QAAQ,EAAc,OACrC,CAUA,SAAS,EAAY,EAAS,GAC7B,OAAQ,GAAQ,WACf,IAAK,SAAU,MACf,IAAK,OACJ,QAAQ,KAAK,GACb,MACD,QAAS,MAAM,IAAI,MAAM,GAE3B,CAWA,SAAS,EAAiB,GACzB,MAAwB,kBAAV,GAAwC,iBAAV,GAAsB,OAAO,SAAS,IAA2B,iBAAV,CACpG,CAWA,SAAS,EAAiB,GACzB,OAAO,EAAO,MAAM,EACrB,CAOA,IAAI,EAAe,cAAc,IAIhC,WAAA,GACC,QACA,KAAK,MAAQ,EACb,KAAK,uBAA0B,IAAI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AAM,MAQX,EAAM,KAAK,IAAI,EAAK,KACb,CAAE,IAAI,IARJ,CACL,IAAI,EACJ,MAAO,CACL,KAAM,mBACN,QAAS,iDAMnB,CAAA,MAAS,GACP,MAAO,CACL,IAAI,EACJ,MAAO,CACL,KAAM,cACN,QAAS,aAAiB,MAAQ,EAAM,QAAU,OAAO,IAG/D,CACF"}
@@ -0,0 +1,4 @@
1
+ import type { Item, Placement } from '../core/types.js';
2
+ import { type ItemLookup } from '../geo/box.js';
3
+ /** Exactly one of rightOf, leftOf, above, below, inside, or near. */
4
+ export declare function placeItem(item: Item, place: Placement, items: Item[], lookup?: ItemLookup): Item;
@@ -0,0 +1,3 @@
1
+ import type { AnnieDoc, Item, Query } from '../core/types.js';
2
+ /** Filters combine with AND. A `RegExp` `g`/`y` flag is stripped so lastIndex cannot skip matches. */
3
+ export declare function queryDoc(doc: AnnieDoc, selector?: Query): Item[];
@@ -0,0 +1,343 @@
1
+ import * as v from 'valibot';
2
+ import type { AnnieDoc, DocModel, ExportOptions, Scope } from '../core/types.js';
3
+ export declare const toolSchemas: {
4
+ board_describe: v.ObjectSchema<{
5
+ readonly scope: v.OptionalSchema<v.PicklistSchema<["doc", "page", "selection", "viewport"], undefined>, undefined>;
6
+ readonly detail: v.OptionalSchema<v.PicklistSchema<["brief", "normal", "full"], undefined>, undefined>;
7
+ readonly relations: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
8
+ readonly freeSpace: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
9
+ readonly maxItems: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
10
+ readonly selection: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>, undefined>;
11
+ readonly page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
12
+ readonly since: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, undefined>;
13
+ }, undefined>;
14
+ board_read: v.ObjectSchema<{
15
+ readonly scope: v.OptionalSchema<v.PicklistSchema<["doc", "page", "selection", "viewport"], undefined>, undefined>;
16
+ }, undefined>;
17
+ board_query: v.ObjectSchema<{
18
+ readonly kind: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>, undefined>;
19
+ readonly text: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
20
+ readonly within: v.OptionalSchema<v.ObjectSchema<{
21
+ readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
22
+ readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
23
+ readonly w: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
24
+ readonly h: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
25
+ }, undefined>, undefined>;
26
+ readonly connectedTo: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
27
+ readonly direction: v.OptionalSchema<v.PicklistSchema<["in", "out", "both"], undefined>, undefined>;
28
+ readonly inside: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
29
+ readonly data: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
30
+ readonly hidden: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
31
+ readonly locked: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
32
+ readonly page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
33
+ }, undefined>;
34
+ board_apply: v.ObjectSchema<{
35
+ readonly ops: v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"op", [v.ObjectSchema<{
36
+ readonly op: v.LiteralSchema<"add", undefined>;
37
+ readonly item: v.GenericSchema;
38
+ readonly page: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
39
+ readonly parent: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
40
+ readonly index: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
41
+ readonly place: v.OptionalSchema<v.ObjectSchema<{
42
+ readonly rightOf: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
43
+ readonly leftOf: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
44
+ readonly above: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
45
+ readonly below: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
46
+ readonly inside: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
47
+ readonly near: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
48
+ readonly gap: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
49
+ readonly align: v.OptionalSchema<v.PicklistSchema<["start", "middle", "end"], undefined>, undefined>;
50
+ }, undefined>, undefined>;
51
+ }, undefined>, v.ObjectSchema<{
52
+ readonly op: v.LiteralSchema<"set", undefined>;
53
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
54
+ readonly patch: v.LooseObjectSchema<{
55
+ readonly x: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
56
+ readonly y: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
57
+ readonly w: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
58
+ readonly h: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
59
+ readonly rotation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
60
+ readonly style: v.OptionalSchema<v.ObjectSchema<{
61
+ readonly stroke: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
62
+ readonly strokeWidth: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
63
+ readonly dash: v.OptionalSchema<v.PicklistSchema<["solid", "dashed", "dotted"], undefined>, undefined>;
64
+ readonly fill: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
65
+ readonly fillMode: v.OptionalSchema<v.PicklistSchema<["solid", "tint", "hatch"], undefined>, undefined>;
66
+ readonly corner: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>, undefined>;
67
+ readonly opacity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
68
+ }, undefined>, undefined>;
69
+ readonly text: v.OptionalSchema<Omit<v.ObjectSchema<{
70
+ readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>;
71
+ readonly align: v.OptionalSchema<v.PicklistSchema<["start", "center", "end"], undefined>, undefined>;
72
+ readonly valign: v.OptionalSchema<v.PicklistSchema<["top", "middle", "bottom"], undefined>, undefined>;
73
+ readonly size: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["s", "m", "l", "xl"], undefined>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>], undefined>, undefined>;
74
+ readonly font: v.OptionalSchema<v.PicklistSchema<["sans", "serif", "mono", "hand"], undefined>, undefined>;
75
+ }, undefined>, "entries" | "~run" | "~standard" | "~types"> & {
76
+ readonly entries: {
77
+ readonly value: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>, undefined>;
78
+ readonly align: v.OptionalSchema<v.OptionalSchema<v.PicklistSchema<["start", "center", "end"], undefined>, undefined>, undefined>;
79
+ readonly valign: v.OptionalSchema<v.OptionalSchema<v.PicklistSchema<["top", "middle", "bottom"], undefined>, undefined>, undefined>;
80
+ readonly size: v.OptionalSchema<v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["s", "m", "l", "xl"], undefined>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>], undefined>, undefined>, undefined>;
81
+ readonly font: v.OptionalSchema<v.OptionalSchema<v.PicklistSchema<["sans", "serif", "mono", "hand"], undefined>, undefined>, undefined>;
82
+ };
83
+ readonly "~standard": v.StandardProps<{
84
+ value?: string | undefined;
85
+ align?: "center" | "end" | "start" | undefined;
86
+ valign?: "bottom" | "middle" | "top" | undefined;
87
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
88
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
89
+ }, {
90
+ value?: string | undefined;
91
+ align?: "center" | "end" | "start" | undefined;
92
+ valign?: "bottom" | "middle" | "top" | undefined;
93
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
94
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
95
+ }>;
96
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
97
+ value?: string | undefined;
98
+ align?: "center" | "end" | "start" | undefined;
99
+ valign?: "bottom" | "middle" | "top" | undefined;
100
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
101
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
102
+ }, v.FiniteIssue<number> | v.MaxLengthIssue<string, 100000> | v.MaxValueIssue<number, 1000> | v.MinValueIssue<number, 1> | v.NumberIssue | v.ObjectIssue | v.PicklistIssue | v.StringIssue | v.UnionIssue<v.FiniteIssue<number> | v.MaxValueIssue<number, 1000> | v.MinValueIssue<number, 1> | v.NumberIssue | v.PicklistIssue>>;
103
+ readonly "~types"?: {
104
+ readonly input: {
105
+ value?: string | undefined;
106
+ align?: "center" | "end" | "start" | undefined;
107
+ valign?: "bottom" | "middle" | "top" | undefined;
108
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
109
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
110
+ };
111
+ readonly output: {
112
+ value?: string | undefined;
113
+ align?: "center" | "end" | "start" | undefined;
114
+ valign?: "bottom" | "middle" | "top" | undefined;
115
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
116
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
117
+ };
118
+ readonly issue: v.FiniteIssue<number> | v.MaxLengthIssue<string, 100000> | v.MaxValueIssue<number, 1000> | v.MinValueIssue<number, 1> | v.NumberIssue | v.ObjectIssue | v.PicklistIssue | v.StringIssue | v.UnionIssue<v.FiniteIssue<number> | v.MaxValueIssue<number, 1000> | v.MinValueIssue<number, 1> | v.NumberIssue | v.PicklistIssue>;
119
+ } | undefined;
120
+ }, undefined>;
121
+ readonly href: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>, undefined>;
122
+ readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>, undefined>;
123
+ readonly data: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
124
+ readonly from: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, v.ObjectSchema<{
125
+ readonly item: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
126
+ readonly side: v.OptionalSchema<v.PicklistSchema<["auto", "top", "right", "bottom", "left"], undefined>, undefined>;
127
+ readonly anchor: v.OptionalSchema<v.TupleSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>], undefined>, undefined>;
128
+ }, undefined>, v.ObjectSchema<{
129
+ readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
130
+ readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
131
+ }, undefined>], undefined>, undefined>;
132
+ readonly to: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, v.ObjectSchema<{
133
+ readonly item: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
134
+ readonly side: v.OptionalSchema<v.PicklistSchema<["auto", "top", "right", "bottom", "left"], undefined>, undefined>;
135
+ readonly anchor: v.OptionalSchema<v.TupleSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>], undefined>, undefined>;
136
+ }, undefined>, v.ObjectSchema<{
137
+ readonly x: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
138
+ readonly y: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, number, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
139
+ }, undefined>], undefined>, undefined>;
140
+ }, undefined>;
141
+ }, undefined>, v.ObjectSchema<{
142
+ readonly op: v.LiteralSchema<"remove", undefined>;
143
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
144
+ }, undefined>, v.ObjectSchema<{
145
+ readonly op: v.LiteralSchema<"order", undefined>;
146
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
147
+ readonly to: v.UnionSchema<[v.PicklistSchema<["front", "back", "forward", "backward"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>], undefined>;
148
+ }, undefined>, v.ObjectSchema<{
149
+ readonly op: v.LiteralSchema<"reparent", undefined>;
150
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
151
+ readonly parent: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
152
+ readonly index: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
153
+ }, undefined>, v.ObjectSchema<{
154
+ readonly op: v.LiteralSchema<"page.add", undefined>;
155
+ readonly index: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
156
+ readonly page: v.ObjectSchema<{
157
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>, undefined>;
158
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>;
159
+ readonly background: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
160
+ readonly items: v.OptionalSchema<v.ArraySchema<v.GenericSchema, undefined>, undefined>;
161
+ }, undefined>;
162
+ }, undefined>, v.ObjectSchema<{
163
+ readonly op: v.LiteralSchema<"page.set", undefined>;
164
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
165
+ readonly patch: v.ObjectSchema<{
166
+ readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>, undefined>;
167
+ readonly background: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
168
+ }, undefined>;
169
+ }, undefined>, v.ObjectSchema<{
170
+ readonly op: v.LiteralSchema<"page.remove", undefined>;
171
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
172
+ }, undefined>, v.ObjectSchema<{
173
+ readonly op: v.LiteralSchema<"meta.set", undefined>;
174
+ readonly patch: v.LooseObjectSchema<{
175
+ readonly title: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 100000, undefined>]>, undefined>;
176
+ readonly modified: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
177
+ }, undefined>;
178
+ }, undefined>, v.ObjectSchema<{
179
+ readonly op: v.LiteralSchema<"media.set", undefined>;
180
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
181
+ readonly media: v.ObjectSchema<{
182
+ readonly mime: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
183
+ readonly w: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
184
+ readonly h: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000000, undefined>]>;
185
+ readonly src: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 20000000, undefined>]>;
186
+ }, undefined>;
187
+ }, undefined>, v.ObjectSchema<{
188
+ readonly op: v.LiteralSchema<"media.remove", undefined>;
189
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 160, undefined>]>;
190
+ }, undefined>], undefined>, undefined>, v.MaxLengthAction<({
191
+ op: "add";
192
+ item: unknown;
193
+ page?: string | undefined;
194
+ parent?: string | undefined;
195
+ index?: number | undefined;
196
+ place?: {
197
+ rightOf?: string | undefined;
198
+ leftOf?: string | undefined;
199
+ above?: string | undefined;
200
+ below?: string | undefined;
201
+ inside?: string | undefined;
202
+ near?: string | undefined;
203
+ gap?: number | undefined;
204
+ align?: "end" | "middle" | "start" | undefined;
205
+ } | undefined;
206
+ } | {
207
+ op: "set";
208
+ id: string;
209
+ patch: {
210
+ x?: number | undefined;
211
+ y?: number | undefined;
212
+ w?: number | undefined;
213
+ h?: number | undefined;
214
+ rotation?: number | undefined;
215
+ style?: {
216
+ stroke?: string | undefined;
217
+ strokeWidth?: number | undefined;
218
+ dash?: "dashed" | "dotted" | "solid" | undefined;
219
+ fill?: string | undefined;
220
+ fillMode?: "hatch" | "solid" | "tint" | undefined;
221
+ corner?: number | undefined;
222
+ opacity?: number | undefined;
223
+ } | undefined;
224
+ text?: {
225
+ value?: string | undefined;
226
+ align?: "center" | "end" | "start" | undefined;
227
+ valign?: "bottom" | "middle" | "top" | undefined;
228
+ size?: number | "l" | "m" | "s" | "xl" | undefined;
229
+ font?: "hand" | "mono" | "sans" | "serif" | undefined;
230
+ } | undefined;
231
+ href?: string | undefined;
232
+ description?: string | undefined;
233
+ data?: {
234
+ [x: string]: unknown;
235
+ } | undefined;
236
+ from?: string | {
237
+ item: string;
238
+ side?: "auto" | "bottom" | "left" | "right" | "top" | undefined;
239
+ anchor?: [number, number] | undefined;
240
+ } | {
241
+ x: number;
242
+ y: number;
243
+ } | undefined;
244
+ to?: string | {
245
+ item: string;
246
+ side?: "auto" | "bottom" | "left" | "right" | "top" | undefined;
247
+ anchor?: [number, number] | undefined;
248
+ } | {
249
+ x: number;
250
+ y: number;
251
+ } | undefined;
252
+ } & {
253
+ [key: string]: unknown;
254
+ };
255
+ } | {
256
+ op: "remove";
257
+ id: string;
258
+ } | {
259
+ op: "order";
260
+ id: string;
261
+ to: number | "back" | "backward" | "forward" | "front";
262
+ } | {
263
+ op: "reparent";
264
+ id: string;
265
+ parent: string | null;
266
+ index?: number | undefined;
267
+ } | {
268
+ op: "page.add";
269
+ index?: number | undefined;
270
+ page: {
271
+ id?: string | undefined;
272
+ name: string;
273
+ background?: string | undefined;
274
+ items?: unknown[] | undefined;
275
+ };
276
+ } | {
277
+ op: "page.set";
278
+ id: string;
279
+ patch: {
280
+ name?: string | undefined;
281
+ background?: string | undefined;
282
+ };
283
+ } | {
284
+ op: "page.remove";
285
+ id: string;
286
+ } | {
287
+ op: "meta.set";
288
+ patch: {
289
+ title?: string | undefined;
290
+ modified?: string | undefined;
291
+ } & {
292
+ [key: string]: unknown;
293
+ };
294
+ } | {
295
+ op: "media.set";
296
+ id: string;
297
+ media: {
298
+ mime: string;
299
+ w: number;
300
+ h: number;
301
+ src: string;
302
+ };
303
+ } | {
304
+ op: "media.remove";
305
+ id: string;
306
+ })[], 1000, undefined>]>;
307
+ readonly origin: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
308
+ readonly label: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
309
+ readonly dryRun: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
310
+ readonly agentName: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
311
+ readonly reveal: v.OptionalSchema<v.PicklistSchema<["none", "fit"], undefined>, undefined>;
312
+ }, undefined>;
313
+ board_snapshot: v.ObjectSchema<{
314
+ readonly scope: v.OptionalSchema<v.PicklistSchema<["doc", "page", "selection", "viewport"], undefined>, "viewport">;
315
+ readonly scale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0.1, undefined>, v.MaxValueAction<number, 4, undefined>]>, 2>;
316
+ readonly labels: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
317
+ readonly colors: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 2, undefined>, v.MaxValueAction<number, 256, undefined>]>, 32>;
318
+ readonly maxBytes: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, 245760>;
319
+ }, undefined>;
320
+ board_view_fit: v.ObjectSchema<{
321
+ readonly ids: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
322
+ }, undefined>;
323
+ };
324
+ export interface ToolDefinition {
325
+ name: string;
326
+ description: string;
327
+ inputSchema: Record<string, unknown>;
328
+ }
329
+ export declare const toolDefs: ToolDefinition[];
330
+ export interface AgentBoard {
331
+ get: DocModel['get'];
332
+ query: DocModel['query'];
333
+ describe: DocModel['describe'];
334
+ apply: DocModel['apply'];
335
+ agentName?: string;
336
+ toJSON?: () => AnnieDoc;
337
+ read?: (scope?: Scope) => AnnieDoc;
338
+ export?: (format: 'png' | 'jpeg' | 'webp', options?: ExportOptions) => Promise<Blob | string> | Blob | string;
339
+ view?: {
340
+ fit: (ids?: string[]) => unknown;
341
+ };
342
+ }
343
+ export declare function runTool(board: AgentBoard, name: string, input?: unknown): Promise<unknown>;