@copilotkit/shared 1.55.3-canary.1776260990 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2ui-prompts.cjs +31 -22
- package/dist/a2ui-prompts.cjs.map +1 -1
- package/dist/a2ui-prompts.d.cts +2 -2
- package/dist/a2ui-prompts.d.cts.map +1 -1
- package/dist/a2ui-prompts.d.mts +2 -2
- package/dist/a2ui-prompts.d.mts.map +1 -1
- package/dist/a2ui-prompts.mjs +31 -22
- package/dist/a2ui-prompts.mjs.map +1 -1
- package/dist/debug.cjs +38 -0
- package/dist/debug.cjs.map +1 -0
- package/dist/debug.d.cts +29 -0
- package/dist/debug.d.cts.map +1 -0
- package/dist/debug.d.mts +29 -0
- package/dist/debug.d.mts.map +1 -0
- package/dist/debug.mjs +37 -0
- package/dist/debug.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +69 -23
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +1 -1
- package/src/__tests__/debug.test.ts +116 -0
- package/src/a2ui-prompts.ts +31 -22
- package/src/debug.ts +55 -0
- package/src/index.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safePa
|
|
|
16
16
|
import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.mjs";
|
|
17
17
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
18
18
|
import "./telemetry/index.mjs";
|
|
19
|
+
import { DebugConfig, ResolvedDebugConfig, resolveDebugConfig } from "./debug.mjs";
|
|
19
20
|
import { InferSchemaOutput, SchemaToJsonSchemaOptions, StandardJSONSchemaV1, StandardSchemaV1, schemaToJsonSchema } from "./standard-schema.mjs";
|
|
20
21
|
import { Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig } from "./attachments/types.mjs";
|
|
21
22
|
import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
|
|
@@ -42,5 +43,5 @@ declare function createLicenseContextValue(status: null): {
|
|
|
42
43
|
getLimit: (feature: string) => number | null;
|
|
43
44
|
};
|
|
44
45
|
//#endregion
|
|
45
|
-
export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
46
|
+
export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, AIMessage, Action, ActivityMessage, AgentDescription, AssistantMessage, Attachment, AttachmentModality, AttachmentUploadError, AttachmentUploadErrorReason, AttachmentUploadResult, AttachmentsConfig, AudioInputPart, BANNER_ERROR_NAMES, BaseCondition, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, ComparisonCondition, ComparisonRule, Condition, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotCloudConfig, CopilotErrorEvent, CopilotErrorHandler, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, CopilotRequestContext, DEFAULT_AGENT_ID, DebugConfig, DeveloperMessage, DocumentInputPart, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, ExistenceCondition, ExistenceRule, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, ImageData, ImageInputPart, InferSchemaOutput, InputContent, InputContentDataSource, InputContentSource, InputContentUrlSource, IntelligenceRuntimeInfo, JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, JSONValue, type LicenseChecker, type LicenseContextValue, type LicenseFeatures, type LicenseMode, type LicenseOwner, type LicensePayload, type LicenseStatus, type LicenseTier, LogicalCondition, LogicalRule, MappedParameterTypes, MaybePromise, Message, MissingPublicApiKeyError, NonEmptyRecord, Parameter, PartialBy, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ReasoningMessage, RequiredBy, ResolvedCopilotKitError, ResolvedDebugConfig, Role, Rule, RuntimeInfo, RuntimeLicenseStatus, RuntimeMode, SchemaToJsonSchemaOptions, Severity, StandardJSONSchemaV1, StandardSchemaV1, SystemMessage, TelemetryClient, TextInputPart, ToolCall, ToolDefinition, ToolResult, TranscriptionErrorCode, type TranscriptionErrorResponse, TranscriptionErrors, UpgradeRequiredError, UserMessage, VideoInputPart, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
46
47
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBa,kBAAA;;;;;;;;;iBA0BG,yBAAA,CAA0B,MAAA;EACxC,MAAA;EACA,OAAA;EACA,YAAA,GAAe,OAAA;EACf,QAAA,GAAW,OAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { isMacOS, parseJson, partialJSONParse, phoenixExponentialBackoff, safePa
|
|
|
10
10
|
import { AG_UI_CHANNEL_EVENT, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, DEFAULT_AGENT_ID } from "./constants/index.mjs";
|
|
11
11
|
import { version } from "./package.mjs";
|
|
12
12
|
import { TelemetryClient, isTelemetryDisabled } from "./telemetry/telemetry-client.mjs";
|
|
13
|
+
import { resolveDebugConfig } from "./debug.mjs";
|
|
13
14
|
import { schemaToJsonSchema } from "./standard-schema.mjs";
|
|
14
15
|
import { exceedsMaxSize, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getSourceUrl, matchesAcceptFilter, readFileAsBase64 } from "./attachments/utils.mjs";
|
|
15
16
|
import { logger } from "./logger.mjs";
|
|
@@ -37,5 +38,5 @@ function createLicenseContextValue(status) {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
//#endregion
|
|
40
|
-
export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, DEFAULT_AGENT_ID, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ResolvedCopilotKitError, Severity, TelemetryClient, TranscriptionErrorCode, TranscriptionErrors, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
41
|
+
export { A2UI_DEFAULT_DESIGN_GUIDELINES, A2UI_DEFAULT_GENERATION_GUIDELINES, AG_UI_CHANNEL_EVENT, BANNER_ERROR_NAMES, COPILOTKIT_VERSION, COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_ERROR_NAMES, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION, ConfigurationError, ConsoleColors, ConsoleStyles, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, CopilotKitVersionMismatchError, DEFAULT_AGENT_ID, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, RUNTIME_MODE_INTELLIGENCE, RUNTIME_MODE_SSE, ResolvedCopilotKitError, Severity, TelemetryClient, TranscriptionErrorCode, TranscriptionErrors, UpgradeRequiredError, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, copyToClipboard, createLicenseContextValue, dataToUUID, ensureStructuredError, exceedsMaxSize, executeConditions, finalizeRunEvents, formatFileSize, generateVideoThumbnail, getDocumentIcon, getModalityFromMimeType, getPossibleVersionMismatch, getSourceUrl, getZodParameters, isMacOS, isStructuredCopilotKitError, isTelemetryDisabled, isValidUUID, jsonSchemaToActionParameters, logCopilotKitPlatformMessage, logStyled, logger, matchesAcceptFilter, parseJson, partialJSONParse, phoenixExponentialBackoff, publicApiKeyRequired, randomId, randomUUID, readBody, readFileAsBase64, resolveDebugConfig, safeParseToolArgs, schemaToJsonSchema, styledConsole, tryMap };
|
|
41
42
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["packageJson.version"],"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\nexport * from \"./debug\";\nexport * from \"./standard-schema\";\nexport * from \"./attachments\";\n\nexport { logger } from \"./logger\";\nexport { finalizeRunEvents } from \"./finalize-events\";\n\nexport {\n TranscriptionErrorCode,\n TranscriptionErrors,\n type TranscriptionErrorResponse,\n} from \"./transcription-errors\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n\n// Re-export only types from license-verifier (types are erased at compile time,\n// so they don't pull in the Node-only `crypto` dependency into client bundles).\n// Server-side packages (e.g. @copilotkit/runtime) should import runtime functions\n// like createLicenseChecker and getLicenseWarningHeader directly from\n// @copilotkit/license-verifier.\nexport type {\n LicenseContextValue,\n LicenseChecker,\n LicenseStatus,\n LicensePayload,\n LicenseFeatures,\n LicenseTier,\n LicenseOwner,\n LicenseMode,\n} from \"@copilotkit/license-verifier\";\n\n/**\n * Client-safe license context factory.\n *\n * When status is null (no token provided), all features return true\n * (unlicensed = unrestricted, with branding). This is inlined here to\n * avoid importing the full license-verifier bundle (which depends on\n * Node's `crypto`) into browser bundles.\n */\nexport function createLicenseContextValue(status: null): {\n status: null;\n license: null;\n checkFeature: (feature: string) => boolean;\n getLimit: (feature: string) => number | null;\n} {\n return {\n status: null,\n license: null,\n checkFeature: () => true,\n getLimit: () => null,\n };\n}\n\nexport {\n A2UI_DEFAULT_GENERATION_GUIDELINES,\n A2UI_DEFAULT_DESIGN_GUIDELINES,\n} from \"./a2ui-prompts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa,qBAAqBA;;;;;;;;;AA0BlC,SAAgB,0BAA0B,QAKxC;AACA,QAAO;EACL,QAAQ;EACR,SAAS;EACT,oBAAoB;EACpB,gBAAgB;EACjB"}
|
package/dist/index.umd.js
CHANGED
|
@@ -969,7 +969,7 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
969
969
|
|
|
970
970
|
//#endregion
|
|
971
971
|
//#region package.json
|
|
972
|
-
var version = "1.
|
|
972
|
+
var version = "1.56.0";
|
|
973
973
|
|
|
974
974
|
//#endregion
|
|
975
975
|
//#region src/telemetry/scarf-client.ts
|
|
@@ -1074,6 +1074,42 @@ ${getSeeMoreMarkdown(troubleshootingLink)}`;
|
|
|
1074
1074
|
}
|
|
1075
1075
|
};
|
|
1076
1076
|
|
|
1077
|
+
//#endregion
|
|
1078
|
+
//#region src/debug.ts
|
|
1079
|
+
/** The all-off config used when debug is falsy. */
|
|
1080
|
+
const DEBUG_OFF = {
|
|
1081
|
+
enabled: false,
|
|
1082
|
+
events: false,
|
|
1083
|
+
lifecycle: false,
|
|
1084
|
+
verbose: false
|
|
1085
|
+
};
|
|
1086
|
+
/**
|
|
1087
|
+
* Normalizes a DebugConfig value into a ResolvedDebugConfig.
|
|
1088
|
+
*
|
|
1089
|
+
* - `false` / `undefined` → all off
|
|
1090
|
+
* - `true` → events + lifecycle on, verbose off (no PII in logs)
|
|
1091
|
+
* - object → merges with defaults (events: true, lifecycle: true, verbose: false)
|
|
1092
|
+
*/
|
|
1093
|
+
function resolveDebugConfig(debug) {
|
|
1094
|
+
var _debug$events, _debug$lifecycle, _debug$verbose;
|
|
1095
|
+
if (!debug) return DEBUG_OFF;
|
|
1096
|
+
if (debug === true) return {
|
|
1097
|
+
enabled: true,
|
|
1098
|
+
events: true,
|
|
1099
|
+
lifecycle: true,
|
|
1100
|
+
verbose: false
|
|
1101
|
+
};
|
|
1102
|
+
const events = (_debug$events = debug.events) !== null && _debug$events !== void 0 ? _debug$events : true;
|
|
1103
|
+
const lifecycle = (_debug$lifecycle = debug.lifecycle) !== null && _debug$lifecycle !== void 0 ? _debug$lifecycle : true;
|
|
1104
|
+
const enabled = events || lifecycle;
|
|
1105
|
+
return {
|
|
1106
|
+
enabled,
|
|
1107
|
+
events,
|
|
1108
|
+
lifecycle,
|
|
1109
|
+
verbose: enabled && ((_debug$verbose = debug.verbose) !== null && _debug$verbose !== void 0 ? _debug$verbose : false)
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1077
1113
|
//#endregion
|
|
1078
1114
|
//#region src/standard-schema.ts
|
|
1079
1115
|
/**
|
|
@@ -1463,29 +1499,38 @@ CRITICAL: Do NOT use "/name" (absolute) inside templates — use "name" (relativ
|
|
|
1463
1499
|
The container's path ("/items") uses a leading slash (absolute), but all
|
|
1464
1500
|
components INSIDE the template use paths WITHOUT leading slash.
|
|
1465
1501
|
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1502
|
+
COMPONENT VALUES — DEFAULT RULE:
|
|
1503
|
+
Use inline literal values for ALL component properties. Pass strings, numbers,
|
|
1504
|
+
arrays, and objects directly on the component. Do NOT use { "path": "..." }
|
|
1505
|
+
objects unless the property's schema explicitly allows it (see exception below).
|
|
1506
|
+
CRITICAL: USING { "path": "..." } ON A PROPERTY THAT DOES NOT DECLARE PATH
|
|
1507
|
+
SUPPORT IN ITS SCHEMA WILL CAUSE A RUNTIME CRASH AND BREAK THE ENTIRE UI.
|
|
1508
|
+
ALWAYS CHECK THE COMPONENT SCHEMA FIRST — IF THE PROPERTY ONLY ACCEPTS A
|
|
1509
|
+
PLAIN TYPE, YOU MUST USE A LITERAL VALUE.
|
|
1510
|
+
VERY IMPORTANT: THE APPLICATION WILL BREAK IF YOU DO NOT FOLLOW THIS RULE!
|
|
1473
1511
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
You MUST use { "path": "..." } to make inputs editable.
|
|
1512
|
+
For example, a chart's "data" must always be an inline array:
|
|
1513
|
+
"data": [{"label": "Jan", "value": 100}, {"label": "Feb", "value": 200}]
|
|
1514
|
+
A metric's "value" must always be an inline string:
|
|
1515
|
+
"value": "$1,200"
|
|
1479
1516
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1517
|
+
PATH BINDING EXCEPTION — SCHEMA-DRIVEN:
|
|
1518
|
+
A few properties accept { "path": "/some/path" } as an alternative to a literal
|
|
1519
|
+
value. You can identify these in the Available Components schema: the property
|
|
1520
|
+
will list BOTH a literal type AND an object-with-path option. If a property only
|
|
1521
|
+
shows a single type (string, number, array, etc.), it does NOT support path
|
|
1522
|
+
binding — use a literal value only.
|
|
1482
1523
|
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1524
|
+
Path binding is typically used for editable form inputs so the client can write
|
|
1525
|
+
user input back to the data model. When building forms:
|
|
1526
|
+
- Bind input "value" to a data model path: "value": { "path": "/form/name" }
|
|
1527
|
+
- Pre-fill via the "data" tool argument: "data": { "form": { "name": "Alice" } }
|
|
1528
|
+
- Capture values on submit via button action context:
|
|
1529
|
+
"action": { "event": { "name": "submit", "context": { "name": { "path": "/form/name" } } } }
|
|
1486
1530
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1531
|
+
REPEATING CONTENT uses a structural children format (not the same as value binding):
|
|
1532
|
+
children: { componentId: "card-id", path: "/items" }
|
|
1533
|
+
Components inside templates use RELATIVE paths (no leading slash): { "path": "name" }.`;
|
|
1489
1534
|
/**
|
|
1490
1535
|
* Design guidelines — visual design rules, component hierarchy tips,
|
|
1491
1536
|
* and action handler patterns.
|
|
@@ -1509,9 +1554,9 @@ Design principles:
|
|
|
1509
1554
|
"action": { "event": { "name": "myAction", "context": { "key": "value" } } }
|
|
1510
1555
|
The "event" key holds an OBJECT with "name" (required) and "context" (optional).
|
|
1511
1556
|
Do NOT use a flat format like {"event": "name"} — "event" must be an object.
|
|
1512
|
-
- For forms:
|
|
1513
|
-
|
|
1514
|
-
action context
|
|
1557
|
+
- For forms: check the component schema — if an input's "value" property
|
|
1558
|
+
supports path binding, use it for editable fields. The submit button's
|
|
1559
|
+
action context should reference the same paths to capture user input.
|
|
1515
1560
|
|
|
1516
1561
|
Use the SAME surfaceId as the main surface. Match action names to button action event names.`;
|
|
1517
1562
|
|
|
@@ -1603,6 +1648,7 @@ exports.randomId = randomId;
|
|
|
1603
1648
|
exports.randomUUID = randomUUID;
|
|
1604
1649
|
exports.readBody = readBody;
|
|
1605
1650
|
exports.readFileAsBase64 = readFileAsBase64;
|
|
1651
|
+
exports.resolveDebugConfig = resolveDebugConfig;
|
|
1606
1652
|
exports.safeParseToolArgs = safeParseToolArgs;
|
|
1607
1653
|
exports.schemaToJsonSchema = schemaToJsonSchema;
|
|
1608
1654
|
exports.styledConsole = styledConsole;
|