@work-shape/catalyst-asset-schemas 0.8.0-rc.41 → 0.8.0-rc.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -238,7 +238,7 @@ type OperationScope = Exclude<FirstPartyAuthScope, "*">;
238
238
  * Every right of the platform, one file per domain under `contract-values/`. The order is kept:
239
239
  * `GRANTABLE_ACTIONS` filters it, and the rights dialog lists rights in it.
240
240
  */
241
- declare const ACTIONS: readonly ["agent.read", "agent.write", "agent.publish", "agent.approve", "agent.delete", "agent.use", "skill.read", "skill.write", "skill.publish", "skill.delete", "skill.approve", "connection.read", "connection.use", "connection.write", "connection.delete", "connection.approve", "connection.add_own", "app.read", "app.write", "app.publish", "app.approve", "app.delete", "app.use", "workflow.read", "workflow.write", "workflow.publish", "workflow.approve", "workflow.delete", "workflow.use", "workflow.read_run_data", "data_store.read", "data_store.write", "data_store.publish", "data_store.delete", "data_store.insert", "data_store.execute", "data_store.records", "knowledge_base.read", "knowledge_base.write", "knowledge_base.ingest", "knowledge_base.publish", "knowledge_base.delete", "knowledge_base.use", "mail_sender.use", "guardrail.read", "guardrail.write", "guardrail.publish", "guardrail.delete", "operations.approve", "feedback.review", "users.manage", "users.delete", "usage.view", "limits.manage", "policy.manage", "usage.view_users", "audit.view", "system.view", "jobs.retry", "api_access.manage", "service_principals.manage", "agent_models.manage", "roles.edit_built_in", "assets.release", "builder", "publisher", "project.read", "project.write", "project.delete"];
241
+ declare const ACTIONS: readonly ["agent.read", "agent.write", "agent.publish", "agent.approve", "agent.delete", "agent.use", "skill.read", "skill.write", "skill.publish", "skill.delete", "skill.approve", "connection.read", "connection.use", "connection.write", "connection.delete", "connection.approve", "connection.add_own", "app.read", "app.write", "app.publish", "app.approve", "app.delete", "app.use", "workflow.read", "workflow.write", "workflow.publish", "workflow.approve", "workflow.delete", "workflow.use", "workflow.read_run_data", "data_store.read", "data_store.write", "data_store.publish", "data_store.delete", "data_store.insert", "data_store.execute", "data_store.records", "knowledge_base.read", "knowledge_base.write", "knowledge_base.ingest", "knowledge_base.publish", "knowledge_base.delete", "knowledge_base.use", "mail_sender.use", "guardrail.read", "guardrail.write", "guardrail.publish", "guardrail.delete", "tool.read", "tool.write", "tool.publish", "tool.approve", "tool.delete", "operations.approve", "feedback.review", "users.manage", "users.delete", "usage.view", "limits.manage", "policy.manage", "usage.view_users", "audit.view", "system.view", "jobs.retry", "api_access.manage", "service_principals.manage", "agent_models.manage", "roles.edit_built_in", "assets.release", "builder", "publisher", "project.read", "project.write", "project.delete"];
242
242
  type PlatformAction = (typeof ACTIONS)[number];
243
243
  type AppErrorCode = (typeof APP_ERROR_CODES)[number];
244
244
  /** The HTTP status every error code answers with. */
@@ -372,7 +372,7 @@ declare const OPERATION_ORIGIN_KINDS: readonly ["agent", "user", "cli", "mcp", "
372
372
  type OperationOriginKind = (typeof OPERATION_ORIGIN_KINDS)[number];
373
373
  declare const OPERATION_RUN_DECISION_MODES: readonly ["direct", "confirmed", "approved", "declined"];
374
374
  type OperationRunDecisionMode = (typeof OPERATION_RUN_DECISION_MODES)[number];
375
- declare const OPERATION_RUN_DECISION_REASONS: readonly ["inherited_approval_not_applied", "workflow_publish", "approved_by_caller"];
375
+ declare const OPERATION_RUN_DECISION_REASONS: readonly ["inherited_approval_not_applied", "workflow_publish", "approved_by_caller", "tool_call"];
376
376
  type OperationRunDecisionReason = (typeof OPERATION_RUN_DECISION_REASONS)[number];
377
377
  declare const OPERATION_DENIAL_REASONS: readonly ["no_grant", "denied", "unknown_action", "holder_inactive", "holder_not_administrable", "user_only", "outside_key_scope", "not_owner"];
378
378
  type OperationDenialReason = (typeof OPERATION_DENIAL_REASONS)[number];
@@ -814,7 +814,7 @@ declare const WORKSPACE_USE_ASSET_KINDS: readonly ["knowledge_base", "connection
814
814
  * no workspace can own, such as a Connection, is in neither bundle (PMCP-1). A kind a later
815
815
  * release lets a workspace own is added here, and a test holds this list to the registry.
816
816
  */
817
- declare const WORKSPACE_OWNED_RIGHT_KINDS: readonly ["agent", "skill", "app", "workflow", "data_store", "knowledge_base", "guardrail"];
817
+ declare const WORKSPACE_OWNED_RIGHT_KINDS: readonly ["agent", "skill", "app", "workflow", "data_store", "knowledge_base", "guardrail", "tool"];
818
818
  /** Published assets that consume Connections or stored data. Agents hold tools separately. */
819
819
  declare const PUBLISHED_DATA_CONSUMER_KINDS: readonly ["app", "workflow", "knowledge_base"];
820
820
  type PublishedDataConsumerKind = (typeof PUBLISHED_DATA_CONSUMER_KINDS)[number];
@@ -3539,4 +3539,184 @@ type HtmlPdfOutcome = {
3539
3539
  code: HtmlPdfRefusal;
3540
3540
  };
3541
3541
 
3542
- export { ACCESS_SOURCES, ACTIONS, ACTIVE_AGENT_RUN_STATUSES, ADMINISTERED_USER_STATUSES, AGENT_AVAILABILITY_MODES, AGENT_EDITABLE_FIELDS, AGENT_PREVIEW_SOURCES, AGENT_RUN_FAILURE_CATEGORIES, AGENT_RUN_STATUSES, AGENT_STARTERS_MAX, AGENT_USE_SETTINGS, ALWAYS_ALLOW_LOCK_SOURCES, API_CREDENTIAL_SCOPES, APPROVAL_CHECK_FAILURE_OUTCOMES, APPROVAL_CHECK_STATUSES, APPROVAL_EXECUTIONS, APPROVAL_REQUEST_STATUSES, APP_ACTION_CALL_STATUSES, APP_AUDIENCES, APP_ERROR_CODES, APP_ERROR_STATUS_CODES, APP_MODES, ARTIFACT_PREVIEW_IMAGE_FORMATS, ARTIFACT_PREVIEW_IMAGE_MIME_TYPES, ARTIFACT_PREVIEW_STATUSES, ASSET_ACCESS_VERBS, ASSET_LIFECYCLES, ASSET_MOVE_EDITORS, ASSET_MOVE_PATHS, ASSET_MOVE_STATUSES, ASSET_MOVE_USERS, ASSET_NAME_REFUSAL_REASONS, ASSET_OWNER_KINDS, ASSET_OWNER_RUNGS, ASSET_REPO_BUNDLE_KINDS, ASSET_REPRESENTATIONS, ASSET_RIGHT_VERBS, ASSET_SYNC_CHANGE_TYPES, ATTACHMENT_CREATE_OUTCOMES, AUDIT_ACTOR_KINDS, AUDIT_EVENT_STATUSES, AUDIT_OUTCOMES, AUDIT_TIERS, AUTH_PRINCIPAL_KINDS, AUTH_SCOPE_WILDCARD, AWS_ACCOUNT_ID, type AccessSource, type ActiveAgentRunStatus, type AdministeredUserStatus, type AgentAvailabilityMode, type AgentConfig, type AgentEditableField, type AgentInitialPromptConfig, type AgentRunFailureCategory, type AgentRunStatus, type AgentUse, type ApiCredentialScope, type AppActionCallStatus, type AppErrorCode, type AppMode, type ApprovalCheckFailureOutcome, type ApprovalCheckStatus, type ApprovalExecution, type ApprovalRequestStatus, type ArtifactPreviewImageFormat, type ArtifactPreviewImageMimeType, type ArtifactPreviewStatus, type AssetLifecycle, type AssetMoveEditors, type AssetMovePath, type AssetMoveStatus, type AssetMoveUsers, type AssetNameRefusalReason, type AssetOwnerKind, type AssetOwnerRung, type AssetRepoBundleKind, type AssetRepresentation, type AssetSyncChangeType, type AttachmentCreateOutcome, type AuditActorKind, type AuditEventStatus, type AuditOutcome, type AuditTier, type AuthPrincipalKind, BEDROCK_REGION, CATALOGUE_CATEGORIES, CATALOGUE_PARTS, CHAT_MESSAGE_ROLES, CHAT_SESSION_AUTH_SCOPES, COLLABORATION_WORKSPACE_KINDS, CONFIG_ASSET_CHANGE_OPERATIONS, CONFIG_ASSET_KINDS, CONNECTION_BINDING_STATES, CONNECTION_CREDENTIAL_MODES, CONNECTION_EXPOSURES, CONNECTION_HEALTH_STATES, CONNECTION_NAME_MAX_LENGTH, CONNECTION_NAME_PATTERN, CONNECTION_NETWORKS, CONNECTION_OAUTH_REGISTRATIONS, CONNECTION_OPERATION_POLICIES, CONNECTION_OPERATION_STATUSES, CONNECTION_ORIGINS, CONNECTION_OWN_TOKEN_SCHEMES, CONNECTION_OWN_TOKEN_STATES, CONNECTION_PROPOSAL_BINDING_STATES, CONNECTION_PROPOSAL_STATES, CONNECTION_PROVIDER_REVOCATIONS, CONNECTION_SECRET_STATES, CONNECTION_SIGN_IN_NEEDS, CONNECTION_TEST_CREDENTIAL_STATES, CONNECTOR_FORM_FIELD_VALUES, CONNECTOR_TEST_STATUSES, CONVERSATION_ATTACHMENT_STATUSES, CONVERSATION_KINDS, CONVERSATION_TITLE_MAX_CHARS, CONVERSATION_VISIBILITIES, type CallableOperationView, type CallableOperationsPage, type CatalogueCategory, type CataloguePart, type ChatMessageRole, type ChatSessionAuthScope, type CollaborationWorkspaceKind, type ConfigAssetChangeOperation, type ConfigAssetKind, type ConnectionBindingState, type ConnectionCredentialMode, type ConnectionExposure, type ConnectionHealth, type ConnectionNetwork, type ConnectionOAuthRegistration, type ConnectionOperationPolicy, type ConnectionOperationStatus, type ConnectionOrigin, type ConnectionOwnTokenScheme, type ConnectionOwnTokenState, type ConnectionProposalBindingState, type ConnectionProposalState, type ConnectionProviderRevocation, type ConnectionSecretState, type ConnectionSignInNeed, type ConnectionTestCredentialState, type ConnectorTestStatus, type ConversationAttachmentStatus, type ConversationKind, type ConversationVisibility, DATABASE_RELATION_TYPES, DATA_STORE_CONDITIONS, DATA_STORE_DESCRIPTION_TOOL_NAME, DATA_STORE_INSERT_CONFLICT_MODES, DATA_STORE_LOAD_CONFLICT_MODES, DATA_STORE_MIGRATION_OUTCOMES, DATA_STORE_SCALAR_TYPES, DATA_STORE_STATUSES, DECIDED_APPROVAL_REQUEST_STATUSES, DELETION_STATES, DRAFT_TEST_TARGETS, type DataScopes, type DataStoreCondition, type DataStoreInsertConflictMode, type DataStoreLoadConflictMode, type DataStoreMigrationOutcome, type DataStoreRecordField, type DataStoreRecordProposalItem, type DataStoreRecordsDecideInput, type DataStoreRecordsDecideOutput, type DataStoreRecordsFlaggedInput, type DataStoreRecordsFlaggedOutput, type DataStoreRecordsProposeInput, type DataStoreRecordsRule, type DataStoreScalarType, type DataStoreStatus, type DatabaseRelationType, type DecidedApprovalRequestStatus, type DeletionState, ENDED_AGENT_RUN_STATUSES, ENDED_APPROVAL_EXECUTIONS, type EndedAgentRunStatus, type EndedApprovalExecution, FAILED_JOB_STATUSES, FEEDBACK_ASSET_KINDS, FEEDBACK_CATEGORY_MAX_LENGTH, FEEDBACK_NOTE_MAX_LENGTH, FEEDBACK_STATES, FEEDBACK_SUBJECT_KINDS, FEEDBACK_SUMMARY_MAX_LENGTH, FEEDBACK_TEXT_MAX_LENGTH, FIRST_PARTY_AUTH_SCOPES, FOLLOW_UP_MODES, FOLLOW_UP_STATUSES, type FailedJobStatus, type FeedbackAssetKind, type FeedbackState, type FeedbackSubjectKind, type FirstPartyAuthScope, GRANT_EFFECTS, GRANT_HOLDER_KINDS, GRANT_REQUEST_STALE_REASONS, GRANT_SCOPE_KINDS, GUARDRAIL_CHECK_KINDS, GUARDRAIL_HIT_OUTCOMES, GUARDRAIL_NAME_MAX_LENGTH, GUARDRAIL_NAME_PATTERN, GUARDRAIL_OUTCOMES, type GrantEffect, type GrantHolderKind, type GrantRequestStaleReason, type GrantScopeKind, type GuardrailHitOutcome, type GuardrailOutcome, HTML_PDF_MAX_HTML_BYTES, HTML_PDF_MAX_PAGES, HTML_PDF_MAX_PDF_BYTES, HTML_PDF_OPTIONS_HEADER, HTML_PDF_PAGES_HEADER, HTML_PDF_PAGE_FORMATS, HTML_PDF_REFUSALS, HTML_PDF_RENDERS_PER_MINUTE_PER_SESSION, HTML_PDF_RENDER_MS, type HtmlPdfInput, type HtmlPdfOptions, type HtmlPdfOutcome, type HtmlPdfRefusal, IDEMPOTENCY_KEY_MAX_LENGTH, INFRASTRUCTURE_SECRET_STATES, INFRASTRUCTURE_WITHHELD_FIELDS, type InfrastructureSecretState, type InfrastructureWithheldField, JOB_STATUSES, type JobStatus, KNOWLEDGE_BASE_STATUSES, KNOWLEDGE_CHECK_STATUSES, KNOWLEDGE_DOCUMENT_FAILURE_CODES, KNOWLEDGE_DOCUMENT_STATES, KNOWLEDGE_DOCUMENT_TEXT_MAX_BYTES, KNOWLEDGE_DOCUMENT_WAIT_CODES, KNOWLEDGE_EMBEDDING_STATES, KNOWLEDGE_FILE_MAX_BYTES, KNOWLEDGE_FILE_MAX_BYTES_CEILING, KNOWLEDGE_ORIGIN_LINK_CHANGES, KNOWLEDGE_ORIGIN_LINK_MAX_CHARS, KNOWLEDGE_PENDING_MAX_LIMIT, KNOWLEDGE_SEARCH_SIGNALS, KNOWLEDGE_SOURCE_FAILURE_CODES, KNOWLEDGE_SOURCE_ITEM_FAILURE_CODES, KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES, KNOWLEDGE_SOURCE_ITEM_STATES, KNOWLEDGE_SYNC_COUNTS, KNOWLEDGE_SYNC_MODES, KNOWLEDGE_SYNC_RUN_STATES, type KnowledgeBaseStatus, type KnowledgeCheckStatus, type KnowledgeDocumentFailureCode, type KnowledgeDocumentState, type KnowledgeDocumentWaitCode, type KnowledgeExtractFieldsInput, type KnowledgeExtractFieldsOutput, type KnowledgeFirstPassConfirmation, type KnowledgeIngestFetch, type KnowledgeIngestInput, type KnowledgeIngestItem, type KnowledgeIngestOutput, type KnowledgeLocateInput, type KnowledgeLocateOutput, type KnowledgePendingInput, type KnowledgePendingOutput, type KnowledgePendingPageRow, type KnowledgePendingRow, type KnowledgeProcessorOutput, type KnowledgePutProcessedInput, type KnowledgeRetryInput, type KnowledgeRetryOutput, type KnowledgeSearchSignal, type KnowledgeSourceFailureCode, type KnowledgeSourceItemFailureCode, type KnowledgeSourceItemShownState, type KnowledgeSourceItemState, type KnowledgeSourceItemsInput, type KnowledgeSourceItemsOutput, type KnowledgeSourcesOutput, type KnowledgeSyncCount, type KnowledgeSyncInput, type KnowledgeSyncMode, type KnowledgeSyncResult, type KnowledgeSyncRunState, type KnowledgeWithdrawInput, type KnowledgeWithdrawOutput, type KnowledgeWorkflowSource, type KnowledgeWorkflowSourcesOutput, LISTED_DATA_STORE_STATUSES, LIVE_JOB_STATUSES, type ListedDataStoreStatus, type LiveJobStatus, type LocaleCode, type LocalizedStringConfig, MAIL_ADDRESS_MAX_LENGTH, MAIL_ATTACHMENTS_MAX_BYTES, MAIL_ATTACHMENTS_MAX_FILES, MAIL_AUDIT_MAX_DOMAINS, MAIL_BODY_MAX_BYTES, MAIL_OUTBOUND_DEFAULT_LIMITS, MAIL_OUTBOUND_FOOTER_MAX_LENGTH, MAIL_RECIPIENT_DOMAINS_ANY, MAIL_RECIPIENT_DOMAIN_PATTERN, MAIL_RECIPIENT_ID_PATTERN, MAIL_SENDER_CONNECTION_PREFIX, MAIL_SENDER_NAME_MAX_LENGTH, MAIL_SENDER_RESOURCE_KIND, MAIL_SENDER_SYSTEM, MAIL_SENDER_SYSTEM_ICON, MAIL_SENDER_USE_ACTION, MAIL_SEND_ERROR_CODES, MAIL_SEND_MAX_ADDRESSES, MAIL_SEND_OPERATION, MAIL_SEND_REFUSAL_REASONS, MAIL_SUBJECT_MAX_LENGTH, MAIL_WORKFLOW_MESSAGE_TEMPLATE, MANAGED_FILE_STATUSES, MEMBER_BUNDLE_CHANGES, MEMBER_BUNDLE_STATES, MESSAGE_FINISH_STATUSES, MODEL_FALLBACK_REASONS, MODEL_PROVIDER_AUTH_MODES, MODEL_USAGE_EVENT_STATUSES, MODEL_USAGE_LIMIT_METRICS, MODEL_USAGE_LIMIT_PERIODS, MODEL_USAGE_LIMIT_SCOPES, MODEL_USAGE_SOURCES, MODEL_USAGE_TIERS, type MailPreviewRecipient, type MailSendErrorCode, type MailSendInput, type MailSendInputFields, type MailSendOutput, type MailSendPreview, type MailSendRecipient, type MailSendRecipientList, type MailSendRefusalDetails, type MailSendSimulatedOutput, type MailSenderId, type MemberBundleChange, type MemberBundleState, type MessageFinishStatus, type ModelFallbackReason, type ModelProviderAuthMode, type ModelUsageEventStatus, type ModelUsageRefusal, type ModelUsageSource, type ModelUsageTier, NOTIFY_CHANNELS, type NotifyChannel, OPENAI_COMPATIBLE_APIS, OPERATIONS_AUDIENCES, OPERATION_CHANGE_CLASSES, OPERATION_CONFIRMATION_DECISIONS, OPERATION_DENIAL_REASONS, OPERATION_EFFECTS, OPERATION_ORIGIN_KINDS, OPERATION_RUN_DECISION_MODES, OPERATION_RUN_DECISION_REASONS, OPERATION_RUN_STATUSES, OPERATION_SOURCE_KINDS, OPERATION_TARGETS, OWN_SERVER_SIGN_INS, type OpenaiCompatibleApi, type OperationBatchFailure, type OperationBatchResult, type OperationDenialReason, type OperationEffect, type OperationOriginKind, type OperationPaging, type OperationRunDecisionMode, type OperationRunDecisionReason, type OperationRunStatus, type OperationScope, type OperationSourceKind, type OperationSourceView, type OperationTarget, type OperationsAudience, type OwnServerSignIn, PERSONAL_AGENTS_KEY, PERSONAL_WORKSPACES_KEY, PERSON_POLICY_SETTINGS, PLATFORM_REPORT_NOTE_MAX_LENGTH, POLICY_VALUES, PREVIEW_CAPTURES_PER_HOUR, PREVIEW_CAPTURES_PER_RUN, PREVIEW_CAPTURE_MAX_BYTES, PREVIEW_CAPTURE_MAX_HEIGHT, PREVIEW_CAPTURE_MAX_WIDTH, PREVIEW_CAPTURE_REFUSALS, PREVIEW_CAPTURE_SIZES, PREVIEW_CAPTURE_STATUSES, PREVIEW_CAPTURE_TOOL_NAME, PREVIEW_CAPTURE_WAIT_MS, PREVIEW_REPORT_BRIDGE_STATES, PREVIEW_REPORT_ENTRY_KINDS, PREVIEW_REPORT_KEEP_MS, PREVIEW_REPORT_MAX_BYTES, PREVIEW_REPORT_MAX_ENTRIES, PREVIEW_REPORT_MAX_MESSAGE_CHARS, PRINCIPAL_HOLDER_KINDS, PROJECT_ACTIONS, PROJECT_ASSET_KIND, PROJECT_AUDIENCES, PROJECT_CHOICE_REFUSALS, PROJECT_DELETION_CONVERSATIONS, PROJECT_DESCRIPTION_MAX_LENGTH, PROJECT_FILE_CHANGES, PROJECT_FILE_ORIGINS, PROJECT_FOLDER_WRITE_CHANGES, PROJECT_KNOWLEDGE_BASES_MAX, PROJECT_NAME_MAX_LENGTH, PROJECT_NAME_PATTERN, PROJECT_SKILLS_MAX, PROJECT_TITLE_MAX_LENGTH, PROVIDER_CHECK_ERROR_CLASSES, PROVIDER_PORTS, PROVIDER_REGIONS, PUBLISHED_DATA_CONSUMER_KINDS, PUBLISH_CHANGE_KINDS, type PlatformAction, type PolicyValue, type PreviewCaptureRefusal, type PreviewReport, type PreviewReportBridge, type PreviewReportEntry, type PreviewReportEntryKind, type PrincipalHolderKind, type ProjectAudience, type ProjectDeletionConversations, type ProviderCheckErrorClass, type ProviderPort, type ProviderRegion, type PublishedDataConsumerKind, READING_POLICY_VALUES, REASONING_EFFORTS, RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE, RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM, RECORDS_PROPOSE_MAX_ITEMS_PER_CALL, RECORD_FIELD_FAILURE_CODES, RECORD_FIELD_STATES, RECORD_FLAG_REASONS, ROLE_GRANT_SCOPE_KINDS, ROLE_PENDING_CHANGES, ROLE_PENDING_DECISIONS, type ReadingPolicyValue, type ReasoningEffortConfig, type RecordColumn, type RecordEvidenceResult, type RoleGrantScopeKind, type RolePendingDecision, SCHEDULED_START_STATES, SECRET_NAME_EXPECTATION, SERVER_PREVIEW_CAPTURE_REFUSALS, SERVICE_PRINCIPAL_PERMISSIONS, SERVICE_PRINCIPAL_STATUSES, SKILL_CHANGE_TYPES, SKILL_FRONTMATTER_FIELDS, SKILL_FRONTMATTER_MAX_BYTES, SKILL_FRONTMATTER_MAX_DEPTH, SKILL_NAME_PATTERN, SKILL_NAME_RULE, SKILL_ORIGINS, SKILL_PORTABLE_DESCRIPTION_MAX_CHARS, SKILL_PORTABLE_NAME_MAX_CHARS, SKILL_RESOURCE_MEDIA_TYPES, SKILL_STARTERS_MAX, SKILL_STARTER_LINE_MAX_LENGTH, SKILL_SUMMARY_MAX_LENGTH, STRUCTURED_DATA_REVIEW_REASONS, STUDIO_KIND_PATHS, SUPPORTED_IMAGE_MIME_TYPES, type ScopeAssignmentInput, type ScopedTables, type ServerPreviewCaptureInput, type ServerPreviewCaptureOutcome, type ServicePrincipalPermission, type ServicePrincipalStatus, type SkillChangeType, type SkillConfig, type SkillFileEntry, type SkillFrontmatterRefusal, SkillMarkdownError, type SkillOrigin, type SkillResourceConfig, type SkillResourceMediaType, type SkillStarterConfig, type StructuredDataReviewReason, type SupportedImageMimeType, THEME_MODES, THEME_MODE_PREFERENCES, TOOL_CALL_STATES, TOOL_DECISION_MODES, TOOL_DECISION_OUTCOMES, TOOL_DISPLAY_MODES, TOOL_GROUPS, TOOL_INPUT_PARSE_ERROR_CODES, type ThemeMode, type ThemeModePreference, type ToolCallState, type ToolDisplayMode, type ToolGroup, type ToolInputParseErrorCode, USAGE_BREAKDOWN_DIMENSIONS, USAGE_COST_STATUSES, USAGE_ORIGINS, USAGE_SPEND_LIMIT_LEVELS, USER_STATUSES, type UnboundPreviewReport, type UsageCostStatus, type UserStatus, WAITING_OPERATION_RUN_STATUSES, WEB_SOURCE_PROVIDERS, WORKFLOW_CAPABILITY_UNITS, WORKFLOW_CODE_STEP_AVAILABILITY, WORKFLOW_DATASET_DOWNLOAD_FORMATS, WORKFLOW_DATASET_STATES, WORKFLOW_ENDED_STATUSES, WORKFLOW_EXECUTED_STEP_TYPES, WORKFLOW_KINDS, WORKFLOW_MARKDOWN_MAX_COLUMNS, WORKFLOW_MARKDOWN_MAX_ROWS, WORKFLOW_NAME_PATTERN, WORKFLOW_NAME_RULE, WORKFLOW_PACKAGE_MANIFEST_STATES, WORKFLOW_RESERVED_STEP_TYPES, WORKFLOW_RIGHTS_REVISIONS, WORKFLOW_RIGHT_NEEDED_FOR, WORKFLOW_RIGHT_REFUSALS, WORKFLOW_RUN_ACCOUNT_STATUSES, WORKFLOW_RUN_MODES, WORKFLOW_RUN_STATUSES, WORKFLOW_STEP_RUN_STATUSES, WORKFLOW_STEP_SOURCE_KINDS, WORKFLOW_STEP_TYPES, WORKFLOW_TEST_REVISIONS, WORKFLOW_TEXT_FORMAT_MARKDOWN, WORKFLOW_TEXT_MAX_PARTS, WORKFLOW_TRIGGER_KINDS, WORKFLOW_WEBHOOK_HEADERS, WORKFLOW_WEBHOOK_LIMITS, WORKSPACE_ACCENT_COLORS, WORKSPACE_ACCESS_STATES, WORKSPACE_BUNDLES, WORKSPACE_COMMAND_STATUSES, WORKSPACE_FILE_KINDS, WORKSPACE_MEMBERSHIP_ROLES, WORKSPACE_OWNED_RIGHT_KINDS, WORKSPACE_SECTIONS, WORKSPACE_USE_ASSET_KINDS, WORKSPACE_VISIBILITIES, type WebSourceProvider, type WorkflowAssetConfig, type WorkflowCapabilityUnit, type WorkflowDatasetDownloadFormat, type WorkflowDatasetState, type WorkflowEndedStatus, type WorkflowKind, type WorkflowMailSenderFact, type WorkflowMessageMailParams, type WorkflowReservedStepType, type WorkflowRunMode, type WorkflowRunStatus, type WorkflowStepRunStatus, type WorkflowStepSourceKind, type WorkflowStepType, type WorkflowTestRevision, type WorkflowTriggerKind, type WorkspaceAccentColor, type WorkspaceAccessState, type WorkspaceBundle, type WorkspaceCommandStatus, type WorkspaceFileKind, type WorkspaceMembershipRole, type WorkspaceSection, type WorkspaceVisibility, YAML_DATA_MAX_VALUES, YamlDataError, type YamlDataIssue, type YamlDataIssueCode, type YamlDataOptions, type YamlDataResult, agentConfigSchema, appInterfacePath, assetPagePath, bedrockProfileRefusal, boundPreviewReport, callableOperationSchema, callableOperationsPageSchema, checkStorableTexts, conversationInterfacePath, dataScopeNameSchema, dataScopesSchema, dataStoreDescriptionInputSchema, dataStoreDescriptionSchema, dataStoreRecordFieldSchema, dataStoreRecordProposalItemSchema, dataStoreRecordsContracts, dataStoreRecordsDecideInputSchema, dataStoreRecordsDecideOutputSchema, dataStoreRecordsFlaggedInputSchema, dataStoreRecordsFlaggedOutputSchema, dataStoreRecordsProposeInputSchema, dataStoreRecordsRuleSchema, deriveSkillTitle, formatSkillMarkdown, htmlPdfOptionsSchema, inboxItemPath, isPlainConfigObject, isPreviewCaptureWithinBounds, isRecord, isSecretName, isStorableText, knowledgeExtractFieldsInputSchema, knowledgeExtractFieldsOutputSchema, knowledgeFieldValueSchema, knowledgeFirstPassConfirmationSchema, knowledgeIngestFetchSchema, knowledgeIngestInputSchema, knowledgeIngestItemSchema, knowledgeIngestOutputSchema, knowledgeLocateInputSchema, knowledgeLocateOutputSchema, knowledgeOriginLinkSchema, knowledgePendingInputSchema, knowledgePendingOutputSchema, knowledgePendingPageRowSchema, knowledgePendingRowSchema, knowledgeProcessorOutputSchema, knowledgePutProcessedInputSchema, knowledgeRecordsRefusalSchema, knowledgeRetryInputSchema, knowledgeRetryOutputSchema, knowledgeSourceItemsInputSchema, knowledgeSourceItemsOutputSchema, knowledgeSourcesOutputSchema, knowledgeSyncInputSchema, knowledgeSyncResultSchema, knowledgeWithdrawInputSchema, knowledgeWithdrawOutputSchema, knowledgeWorkflowSourceSchema, knowledgeWorkflowSourcesOutputSchema, knowledgeWriteContracts, loadYamlData, localeCodes, localizedStringSchema, mailAddressSchema, mailBodySchema, mailCopyRecipientListSchema, mailPreviewRecipientSchema, mailRecipientDomainSchema, mailRecipientListSchema, mailRecipientSchema, mailReplyToSchema, mailSendContract, mailSendInputSchema, mailSendOutputSchema, mailSendPreviewSchema, mailSendRefusalDetailsSchema, mailSendSimulatedOutputSchema, mailSenderIdSchema, mailSenderNameSchema, mailSubjectSchema, mergeConfigObjects, operationBatchFailureSchema, operationBatchResultSchema, operationPagingSchema, operationSourceSchema, parseSkillMarkdown, previewReportEntrySchema, previewReportSchema, providerRegionSchema, readWebpSize, readYamlData, recordColumnTakes, recordEvidenceResultSchema, scopeAssignmentInputSchema, scopedTablesSchema, scrubPreviewFile, scrubPreviewText, serverPreviewCaptureInputSchema, serverPreviewCaptureOutcomeSchema, skillConfigSchema, skillFileEntrySchema, skillFileFrontmatterSchema, skillNameSchema, skillPortabilityIssues, skillResourceConfigSchema, skillResourceMediaTypeForPath, skillResourcePathSchema, skillStarterSchema, workflowConfigSchema, workflowDataFlowsSchema, workflowDatasetReferenceSchema, workflowFileReferenceSchema, workflowMailSenderFactSchema, workflowMessageMailParamsSchema, writeYamlData, yamlValueIssue, yamlValueIssueSentence };
3542
+ /** The kind's id, as the asset store keeps it. */
3543
+ declare const TOOL_ASSET_KIND = "tool";
3544
+ /** The prefix of every operation of one tool asset: `tool.<name>.call`. */
3545
+ declare const TOOL_OPERATION_PREFIX = "tool.";
3546
+ /** The name of a tool: lowercase letters, digits and `_`, starting with a letter. */
3547
+ declare const TOOL_NAME_PATTERN: RegExp;
3548
+ declare const TOOL_NAME_MAX_LENGTH = 48;
3549
+ declare const TOOL_NAME_RULE = "A tool's name is lowercase letters, digits and _, starts with a letter and is at most 48 characters long";
3550
+ /** A display kind: lowercase words joined by `.`, `_` or `-`, such as `review.document_check`. */
3551
+ declare const TOOL_RESULT_KIND_PATTERN: RegExp;
3552
+ /** How long the agent's description of a tool is at most. */
3553
+ declare const TOOL_DESCRIPTION_MAX_CHARS = 4000;
3554
+ /** How large a tool's input schema is at most, as JSON, in bytes. */
3555
+ declare const TOOL_INPUT_SCHEMA_MAX_BYTES: number;
3556
+ /** How deeply a tool's input schema nests at most, counting objects and arrays. */
3557
+ declare const TOOL_INPUT_SCHEMA_MAX_DEPTH = 24;
3558
+ /** What a call of a `result` tool answers the agent where the tool names no sentence. */
3559
+ declare const TOOL_RESULT_DEFAULT_REPLY = "Done.";
3560
+ /**
3561
+ * The types of tool. `result` hands the agent's finished result to the panel; `code` runs a
3562
+ * handler of its own files in the sandbox.
3563
+ */
3564
+ declare const TOOL_TYPES: readonly ["result", "code"];
3565
+ /** What a code tool's handler is run with: the runner image's `python3` or `node`. */
3566
+ declare const TOOL_CODE_RUNTIMES: readonly ["python", "node"];
3567
+ type ToolCodeRuntime = (typeof TOOL_CODE_RUNTIMES)[number];
3568
+ /** The endings of a handler file of each runtime. */
3569
+ declare const TOOL_CODE_ENTRY_ENDINGS: Readonly<Record<ToolCodeRuntime, readonly string[]>>;
3570
+ /** How long a handler may run where its tool names no time, and at most, in seconds. */
3571
+ declare const TOOL_CODE_TIMEOUT_DEFAULT_SECONDS = 30;
3572
+ declare const TOOL_CODE_TIMEOUT_MAX_SECONDS = 120;
3573
+ /**
3574
+ * How many files a code tool holds at most, how large one is and how large all are. A
3575
+ * TypeScript tool is one bundled module that carries Zod, about 330 KiB minified, so one file
3576
+ * may be as large as all of them.
3577
+ */
3578
+ declare const TOOL_FILES_MAX = 32;
3579
+ declare const TOOL_FILE_MAX_BYTES: number;
3580
+ declare const TOOL_FILES_MAX_BYTES: number;
3581
+ /**
3582
+ * A path in a code tool's folder: `/`-separated parts of letters, digits, `_`, `-` and `.`,
3583
+ * each starting with a letter, a digit or `_`. No part is `..`, none is hidden and none is
3584
+ * empty, so a path never leaves the folder.
3585
+ */
3586
+ declare const TOOL_FILE_PATH_PATTERN: RegExp;
3587
+ /** How many Connection operations one code tool declares at most. */
3588
+ declare const TOOL_CONNECTIONS_MAX = 32;
3589
+ declare const toolConnectionOperationSchema: z.ZodString;
3590
+ declare const toolNameSchema: z.ZodString;
3591
+ /**
3592
+ * A tool's input schema: a JSON Schema of an object, bounded in size and depth. Whether it
3593
+ * compiles is asked where the kind is checked, in the platform's schema checker.
3594
+ */
3595
+ declare const toolInputSchemaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3596
+ declare const toolResultSchema: z.ZodObject<{
3597
+ kind: z.ZodString;
3598
+ key: z.ZodOptional<z.ZodString>;
3599
+ title: z.ZodString;
3600
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
3601
+ reply: z.ZodOptional<z.ZodString>;
3602
+ }, z.core.$strict>;
3603
+ declare const toolFilePathSchema: z.ZodString;
3604
+ /** One file of a code tool's folder, as text. */
3605
+ declare const toolFileSchema: z.ZodObject<{
3606
+ path: z.ZodString;
3607
+ content: z.ZodString;
3608
+ }, z.core.$strict>;
3609
+ declare const toolAssetConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3610
+ type: z.ZodLiteral<"result">;
3611
+ result: z.ZodObject<{
3612
+ kind: z.ZodString;
3613
+ key: z.ZodOptional<z.ZodString>;
3614
+ title: z.ZodString;
3615
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
3616
+ reply: z.ZodOptional<z.ZodString>;
3617
+ }, z.core.$strict>;
3618
+ name: z.ZodString;
3619
+ title: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3620
+ en: z.ZodOptional<z.ZodString>;
3621
+ de: z.ZodOptional<z.ZodString>;
3622
+ }, z.core.$strict>]>;
3623
+ summary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3624
+ en: z.ZodOptional<z.ZodString>;
3625
+ de: z.ZodOptional<z.ZodString>;
3626
+ }, z.core.$strict>]>>;
3627
+ description: z.ZodString;
3628
+ icon: z.ZodOptional<z.ZodString>;
3629
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3630
+ }, z.core.$strict>, z.ZodObject<{
3631
+ type: z.ZodLiteral<"code">;
3632
+ runtime: z.ZodEnum<{
3633
+ python: "python";
3634
+ node: "node";
3635
+ }>;
3636
+ entry: z.ZodString;
3637
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
3638
+ connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
3639
+ files: z.ZodArray<z.ZodObject<{
3640
+ path: z.ZodString;
3641
+ content: z.ZodString;
3642
+ }, z.core.$strict>>;
3643
+ name: z.ZodString;
3644
+ title: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3645
+ en: z.ZodOptional<z.ZodString>;
3646
+ de: z.ZodOptional<z.ZodString>;
3647
+ }, z.core.$strict>]>;
3648
+ summary: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3649
+ en: z.ZodOptional<z.ZodString>;
3650
+ de: z.ZodOptional<z.ZodString>;
3651
+ }, z.core.$strict>]>>;
3652
+ description: z.ZodString;
3653
+ icon: z.ZodOptional<z.ZodString>;
3654
+ input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3655
+ }, z.core.$strict>], "type">;
3656
+ type ToolAssetConfig = z.infer<typeof toolAssetConfigSchema>;
3657
+ type ResultToolConfig = Extract<ToolAssetConfig, {
3658
+ type: "result";
3659
+ }>;
3660
+ type CodeToolConfig = Extract<ToolAssetConfig, {
3661
+ type: "code";
3662
+ }>;
3663
+ /** How long a call of a code tool may run, in seconds. */
3664
+ declare function toolCodeTimeoutSeconds(tool: Pick<CodeToolConfig, "timeoutSeconds">): number;
3665
+ /** The operation a published tool contributes. */
3666
+ declare function toolCallOperationName(tool: string): string;
3667
+ /** The tool a name `tool.<name>.call` names, or nothing for any other name. */
3668
+ declare function toolOfOperationName(name: string): string | undefined;
3669
+
3670
+ /**
3671
+ * The modules a handler imports by name: `catalyst_tool` and `catalyst_tools` in Python,
3672
+ * `catalyst-tool` and `catalyst-tools` in Node.
3673
+ */
3674
+ declare const TOOL_CODE_LIBRARY: readonly {
3675
+ path: string;
3676
+ content: string;
3677
+ }[];
3678
+
3679
+ /** How large a handler's answer may be, as JSON in UTF-8: what it hands the model and a display. */
3680
+ declare const TOOL_CODE_ANSWER_MAX_BYTES: number;
3681
+ /** How large what the model is handed of an answer may be, as JSON in UTF-8. */
3682
+ declare const TOOL_CODE_OUTPUT_MAX_BYTES: number;
3683
+ /** How long a display's HTML may be: what `show_view` takes. */
3684
+ declare const TOOL_CODE_HTML_MAX_CHARS = 200000;
3685
+ /** How many Connection calls one handler makes at most. A further one is refused. */
3686
+ declare const TOOL_CODE_REQUESTS_MAX = 50;
3687
+ /** How large one request of a handler is at most, as one line of JSON in UTF-8. */
3688
+ declare const TOOL_CODE_REQUEST_MAX_BYTES: number;
3689
+ /** How large the answer to one request is at most, as JSON in UTF-8. */
3690
+ declare const TOOL_CODE_REQUEST_ANSWER_MAX_BYTES: number;
3691
+ /** The length of a text in UTF-8, in bytes, in Node and in a browser. */
3692
+ declare function utf8Bytes(text: string): number;
3693
+ /** What a handler shows beside the chat: data of a display kind, or its own HTML. */
3694
+ declare const toolCodeDisplaySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3695
+ type: z.ZodLiteral<"data">;
3696
+ kind: z.ZodString;
3697
+ title: z.ZodString;
3698
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3699
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
3700
+ }, z.core.$strict>, z.ZodObject<{
3701
+ type: z.ZodLiteral<"html">;
3702
+ title: z.ZodOptional<z.ZodString>;
3703
+ html: z.ZodString;
3704
+ }, z.core.$strict>], "type">;
3705
+ type ToolCodeDisplay = z.infer<typeof toolCodeDisplaySchema>;
3706
+ /** What a handler answers: `output` for the model, and at most one display beside the chat. */
3707
+ declare const toolCodeAnswerSchema: z.ZodObject<{
3708
+ output: z.ZodUnknown;
3709
+ display: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
3710
+ type: z.ZodLiteral<"data">;
3711
+ kind: z.ZodString;
3712
+ title: z.ZodString;
3713
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3714
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
3715
+ }, z.core.$strict>, z.ZodObject<{
3716
+ type: z.ZodLiteral<"html">;
3717
+ title: z.ZodOptional<z.ZodString>;
3718
+ html: z.ZodString;
3719
+ }, z.core.$strict>], "type">>;
3720
+ }, z.core.$strict>;
3721
+
3722
+ export { ACCESS_SOURCES, ACTIONS, ACTIVE_AGENT_RUN_STATUSES, ADMINISTERED_USER_STATUSES, AGENT_AVAILABILITY_MODES, AGENT_EDITABLE_FIELDS, AGENT_PREVIEW_SOURCES, AGENT_RUN_FAILURE_CATEGORIES, AGENT_RUN_STATUSES, AGENT_STARTERS_MAX, AGENT_USE_SETTINGS, ALWAYS_ALLOW_LOCK_SOURCES, API_CREDENTIAL_SCOPES, APPROVAL_CHECK_FAILURE_OUTCOMES, APPROVAL_CHECK_STATUSES, APPROVAL_EXECUTIONS, APPROVAL_REQUEST_STATUSES, APP_ACTION_CALL_STATUSES, APP_AUDIENCES, APP_ERROR_CODES, APP_ERROR_STATUS_CODES, APP_MODES, ARTIFACT_PREVIEW_IMAGE_FORMATS, ARTIFACT_PREVIEW_IMAGE_MIME_TYPES, ARTIFACT_PREVIEW_STATUSES, ASSET_ACCESS_VERBS, ASSET_LIFECYCLES, ASSET_MOVE_EDITORS, ASSET_MOVE_PATHS, ASSET_MOVE_STATUSES, ASSET_MOVE_USERS, ASSET_NAME_REFUSAL_REASONS, ASSET_OWNER_KINDS, ASSET_OWNER_RUNGS, ASSET_REPO_BUNDLE_KINDS, ASSET_REPRESENTATIONS, ASSET_RIGHT_VERBS, ASSET_SYNC_CHANGE_TYPES, ATTACHMENT_CREATE_OUTCOMES, AUDIT_ACTOR_KINDS, AUDIT_EVENT_STATUSES, AUDIT_OUTCOMES, AUDIT_TIERS, AUTH_PRINCIPAL_KINDS, AUTH_SCOPE_WILDCARD, AWS_ACCOUNT_ID, type AccessSource, type ActiveAgentRunStatus, type AdministeredUserStatus, type AgentAvailabilityMode, type AgentConfig, type AgentEditableField, type AgentInitialPromptConfig, type AgentRunFailureCategory, type AgentRunStatus, type AgentUse, type ApiCredentialScope, type AppActionCallStatus, type AppErrorCode, type AppMode, type ApprovalCheckFailureOutcome, type ApprovalCheckStatus, type ApprovalExecution, type ApprovalRequestStatus, type ArtifactPreviewImageFormat, type ArtifactPreviewImageMimeType, type ArtifactPreviewStatus, type AssetLifecycle, type AssetMoveEditors, type AssetMovePath, type AssetMoveStatus, type AssetMoveUsers, type AssetNameRefusalReason, type AssetOwnerKind, type AssetOwnerRung, type AssetRepoBundleKind, type AssetRepresentation, type AssetSyncChangeType, type AttachmentCreateOutcome, type AuditActorKind, type AuditEventStatus, type AuditOutcome, type AuditTier, type AuthPrincipalKind, BEDROCK_REGION, CATALOGUE_CATEGORIES, CATALOGUE_PARTS, CHAT_MESSAGE_ROLES, CHAT_SESSION_AUTH_SCOPES, COLLABORATION_WORKSPACE_KINDS, CONFIG_ASSET_CHANGE_OPERATIONS, CONFIG_ASSET_KINDS, CONNECTION_BINDING_STATES, CONNECTION_CREDENTIAL_MODES, CONNECTION_EXPOSURES, CONNECTION_HEALTH_STATES, CONNECTION_NAME_MAX_LENGTH, CONNECTION_NAME_PATTERN, CONNECTION_NETWORKS, CONNECTION_OAUTH_REGISTRATIONS, CONNECTION_OPERATION_POLICIES, CONNECTION_OPERATION_STATUSES, CONNECTION_ORIGINS, CONNECTION_OWN_TOKEN_SCHEMES, CONNECTION_OWN_TOKEN_STATES, CONNECTION_PROPOSAL_BINDING_STATES, CONNECTION_PROPOSAL_STATES, CONNECTION_PROVIDER_REVOCATIONS, CONNECTION_SECRET_STATES, CONNECTION_SIGN_IN_NEEDS, CONNECTION_TEST_CREDENTIAL_STATES, CONNECTOR_FORM_FIELD_VALUES, CONNECTOR_TEST_STATUSES, CONVERSATION_ATTACHMENT_STATUSES, CONVERSATION_KINDS, CONVERSATION_TITLE_MAX_CHARS, CONVERSATION_VISIBILITIES, type CallableOperationView, type CallableOperationsPage, type CatalogueCategory, type CataloguePart, type ChatMessageRole, type ChatSessionAuthScope, type CodeToolConfig, type CollaborationWorkspaceKind, type ConfigAssetChangeOperation, type ConfigAssetKind, type ConnectionBindingState, type ConnectionCredentialMode, type ConnectionExposure, type ConnectionHealth, type ConnectionNetwork, type ConnectionOAuthRegistration, type ConnectionOperationPolicy, type ConnectionOperationStatus, type ConnectionOrigin, type ConnectionOwnTokenScheme, type ConnectionOwnTokenState, type ConnectionProposalBindingState, type ConnectionProposalState, type ConnectionProviderRevocation, type ConnectionSecretState, type ConnectionSignInNeed, type ConnectionTestCredentialState, type ConnectorTestStatus, type ConversationAttachmentStatus, type ConversationKind, type ConversationVisibility, DATABASE_RELATION_TYPES, DATA_STORE_CONDITIONS, DATA_STORE_DESCRIPTION_TOOL_NAME, DATA_STORE_INSERT_CONFLICT_MODES, DATA_STORE_LOAD_CONFLICT_MODES, DATA_STORE_MIGRATION_OUTCOMES, DATA_STORE_SCALAR_TYPES, DATA_STORE_STATUSES, DECIDED_APPROVAL_REQUEST_STATUSES, DELETION_STATES, DRAFT_TEST_TARGETS, type DataScopes, type DataStoreCondition, type DataStoreInsertConflictMode, type DataStoreLoadConflictMode, type DataStoreMigrationOutcome, type DataStoreRecordField, type DataStoreRecordProposalItem, type DataStoreRecordsDecideInput, type DataStoreRecordsDecideOutput, type DataStoreRecordsFlaggedInput, type DataStoreRecordsFlaggedOutput, type DataStoreRecordsProposeInput, type DataStoreRecordsRule, type DataStoreScalarType, type DataStoreStatus, type DatabaseRelationType, type DecidedApprovalRequestStatus, type DeletionState, ENDED_AGENT_RUN_STATUSES, ENDED_APPROVAL_EXECUTIONS, type EndedAgentRunStatus, type EndedApprovalExecution, FAILED_JOB_STATUSES, FEEDBACK_ASSET_KINDS, FEEDBACK_CATEGORY_MAX_LENGTH, FEEDBACK_NOTE_MAX_LENGTH, FEEDBACK_STATES, FEEDBACK_SUBJECT_KINDS, FEEDBACK_SUMMARY_MAX_LENGTH, FEEDBACK_TEXT_MAX_LENGTH, FIRST_PARTY_AUTH_SCOPES, FOLLOW_UP_MODES, FOLLOW_UP_STATUSES, type FailedJobStatus, type FeedbackAssetKind, type FeedbackState, type FeedbackSubjectKind, type FirstPartyAuthScope, GRANT_EFFECTS, GRANT_HOLDER_KINDS, GRANT_REQUEST_STALE_REASONS, GRANT_SCOPE_KINDS, GUARDRAIL_CHECK_KINDS, GUARDRAIL_HIT_OUTCOMES, GUARDRAIL_NAME_MAX_LENGTH, GUARDRAIL_NAME_PATTERN, GUARDRAIL_OUTCOMES, type GrantEffect, type GrantHolderKind, type GrantRequestStaleReason, type GrantScopeKind, type GuardrailHitOutcome, type GuardrailOutcome, HTML_PDF_MAX_HTML_BYTES, HTML_PDF_MAX_PAGES, HTML_PDF_MAX_PDF_BYTES, HTML_PDF_OPTIONS_HEADER, HTML_PDF_PAGES_HEADER, HTML_PDF_PAGE_FORMATS, HTML_PDF_REFUSALS, HTML_PDF_RENDERS_PER_MINUTE_PER_SESSION, HTML_PDF_RENDER_MS, type HtmlPdfInput, type HtmlPdfOptions, type HtmlPdfOutcome, type HtmlPdfRefusal, IDEMPOTENCY_KEY_MAX_LENGTH, INFRASTRUCTURE_SECRET_STATES, INFRASTRUCTURE_WITHHELD_FIELDS, type InfrastructureSecretState, type InfrastructureWithheldField, JOB_STATUSES, type JobStatus, KNOWLEDGE_BASE_STATUSES, KNOWLEDGE_CHECK_STATUSES, KNOWLEDGE_DOCUMENT_FAILURE_CODES, KNOWLEDGE_DOCUMENT_STATES, KNOWLEDGE_DOCUMENT_TEXT_MAX_BYTES, KNOWLEDGE_DOCUMENT_WAIT_CODES, KNOWLEDGE_EMBEDDING_STATES, KNOWLEDGE_FILE_MAX_BYTES, KNOWLEDGE_FILE_MAX_BYTES_CEILING, KNOWLEDGE_ORIGIN_LINK_CHANGES, KNOWLEDGE_ORIGIN_LINK_MAX_CHARS, KNOWLEDGE_PENDING_MAX_LIMIT, KNOWLEDGE_SEARCH_SIGNALS, KNOWLEDGE_SOURCE_FAILURE_CODES, KNOWLEDGE_SOURCE_ITEM_FAILURE_CODES, KNOWLEDGE_SOURCE_ITEM_SHOWN_STATES, KNOWLEDGE_SOURCE_ITEM_STATES, KNOWLEDGE_SYNC_COUNTS, KNOWLEDGE_SYNC_MODES, KNOWLEDGE_SYNC_RUN_STATES, type KnowledgeBaseStatus, type KnowledgeCheckStatus, type KnowledgeDocumentFailureCode, type KnowledgeDocumentState, type KnowledgeDocumentWaitCode, type KnowledgeExtractFieldsInput, type KnowledgeExtractFieldsOutput, type KnowledgeFirstPassConfirmation, type KnowledgeIngestFetch, type KnowledgeIngestInput, type KnowledgeIngestItem, type KnowledgeIngestOutput, type KnowledgeLocateInput, type KnowledgeLocateOutput, type KnowledgePendingInput, type KnowledgePendingOutput, type KnowledgePendingPageRow, type KnowledgePendingRow, type KnowledgeProcessorOutput, type KnowledgePutProcessedInput, type KnowledgeRetryInput, type KnowledgeRetryOutput, type KnowledgeSearchSignal, type KnowledgeSourceFailureCode, type KnowledgeSourceItemFailureCode, type KnowledgeSourceItemShownState, type KnowledgeSourceItemState, type KnowledgeSourceItemsInput, type KnowledgeSourceItemsOutput, type KnowledgeSourcesOutput, type KnowledgeSyncCount, type KnowledgeSyncInput, type KnowledgeSyncMode, type KnowledgeSyncResult, type KnowledgeSyncRunState, type KnowledgeWithdrawInput, type KnowledgeWithdrawOutput, type KnowledgeWorkflowSource, type KnowledgeWorkflowSourcesOutput, LISTED_DATA_STORE_STATUSES, LIVE_JOB_STATUSES, type ListedDataStoreStatus, type LiveJobStatus, type LocaleCode, type LocalizedStringConfig, MAIL_ADDRESS_MAX_LENGTH, MAIL_ATTACHMENTS_MAX_BYTES, MAIL_ATTACHMENTS_MAX_FILES, MAIL_AUDIT_MAX_DOMAINS, MAIL_BODY_MAX_BYTES, MAIL_OUTBOUND_DEFAULT_LIMITS, MAIL_OUTBOUND_FOOTER_MAX_LENGTH, MAIL_RECIPIENT_DOMAINS_ANY, MAIL_RECIPIENT_DOMAIN_PATTERN, MAIL_RECIPIENT_ID_PATTERN, MAIL_SENDER_CONNECTION_PREFIX, MAIL_SENDER_NAME_MAX_LENGTH, MAIL_SENDER_RESOURCE_KIND, MAIL_SENDER_SYSTEM, MAIL_SENDER_SYSTEM_ICON, MAIL_SENDER_USE_ACTION, MAIL_SEND_ERROR_CODES, MAIL_SEND_MAX_ADDRESSES, MAIL_SEND_OPERATION, MAIL_SEND_REFUSAL_REASONS, MAIL_SUBJECT_MAX_LENGTH, MAIL_WORKFLOW_MESSAGE_TEMPLATE, MANAGED_FILE_STATUSES, MEMBER_BUNDLE_CHANGES, MEMBER_BUNDLE_STATES, MESSAGE_FINISH_STATUSES, MODEL_FALLBACK_REASONS, MODEL_PROVIDER_AUTH_MODES, MODEL_USAGE_EVENT_STATUSES, MODEL_USAGE_LIMIT_METRICS, MODEL_USAGE_LIMIT_PERIODS, MODEL_USAGE_LIMIT_SCOPES, MODEL_USAGE_SOURCES, MODEL_USAGE_TIERS, type MailPreviewRecipient, type MailSendErrorCode, type MailSendInput, type MailSendInputFields, type MailSendOutput, type MailSendPreview, type MailSendRecipient, type MailSendRecipientList, type MailSendRefusalDetails, type MailSendSimulatedOutput, type MailSenderId, type MemberBundleChange, type MemberBundleState, type MessageFinishStatus, type ModelFallbackReason, type ModelProviderAuthMode, type ModelUsageEventStatus, type ModelUsageRefusal, type ModelUsageSource, type ModelUsageTier, NOTIFY_CHANNELS, type NotifyChannel, OPENAI_COMPATIBLE_APIS, OPERATIONS_AUDIENCES, OPERATION_CHANGE_CLASSES, OPERATION_CONFIRMATION_DECISIONS, OPERATION_DENIAL_REASONS, OPERATION_EFFECTS, OPERATION_ORIGIN_KINDS, OPERATION_RUN_DECISION_MODES, OPERATION_RUN_DECISION_REASONS, OPERATION_RUN_STATUSES, OPERATION_SOURCE_KINDS, OPERATION_TARGETS, OWN_SERVER_SIGN_INS, type OpenaiCompatibleApi, type OperationBatchFailure, type OperationBatchResult, type OperationDenialReason, type OperationEffect, type OperationOriginKind, type OperationPaging, type OperationRunDecisionMode, type OperationRunDecisionReason, type OperationRunStatus, type OperationScope, type OperationSourceKind, type OperationSourceView, type OperationTarget, type OperationsAudience, type OwnServerSignIn, PERSONAL_AGENTS_KEY, PERSONAL_WORKSPACES_KEY, PERSON_POLICY_SETTINGS, PLATFORM_REPORT_NOTE_MAX_LENGTH, POLICY_VALUES, PREVIEW_CAPTURES_PER_HOUR, PREVIEW_CAPTURES_PER_RUN, PREVIEW_CAPTURE_MAX_BYTES, PREVIEW_CAPTURE_MAX_HEIGHT, PREVIEW_CAPTURE_MAX_WIDTH, PREVIEW_CAPTURE_REFUSALS, PREVIEW_CAPTURE_SIZES, PREVIEW_CAPTURE_STATUSES, PREVIEW_CAPTURE_TOOL_NAME, PREVIEW_CAPTURE_WAIT_MS, PREVIEW_REPORT_BRIDGE_STATES, PREVIEW_REPORT_ENTRY_KINDS, PREVIEW_REPORT_KEEP_MS, PREVIEW_REPORT_MAX_BYTES, PREVIEW_REPORT_MAX_ENTRIES, PREVIEW_REPORT_MAX_MESSAGE_CHARS, PRINCIPAL_HOLDER_KINDS, PROJECT_ACTIONS, PROJECT_ASSET_KIND, PROJECT_AUDIENCES, PROJECT_CHOICE_REFUSALS, PROJECT_DELETION_CONVERSATIONS, PROJECT_DESCRIPTION_MAX_LENGTH, PROJECT_FILE_CHANGES, PROJECT_FILE_ORIGINS, PROJECT_FOLDER_WRITE_CHANGES, PROJECT_KNOWLEDGE_BASES_MAX, PROJECT_NAME_MAX_LENGTH, PROJECT_NAME_PATTERN, PROJECT_SKILLS_MAX, PROJECT_TITLE_MAX_LENGTH, PROVIDER_CHECK_ERROR_CLASSES, PROVIDER_PORTS, PROVIDER_REGIONS, PUBLISHED_DATA_CONSUMER_KINDS, PUBLISH_CHANGE_KINDS, type PlatformAction, type PolicyValue, type PreviewCaptureRefusal, type PreviewReport, type PreviewReportBridge, type PreviewReportEntry, type PreviewReportEntryKind, type PrincipalHolderKind, type ProjectAudience, type ProjectDeletionConversations, type ProviderCheckErrorClass, type ProviderPort, type ProviderRegion, type PublishedDataConsumerKind, READING_POLICY_VALUES, REASONING_EFFORTS, RECORDS_FLAGGED_MAX_ITEMS_PER_PAGE, RECORDS_PROPOSE_MAX_FIELDS_PER_ITEM, RECORDS_PROPOSE_MAX_ITEMS_PER_CALL, RECORD_FIELD_FAILURE_CODES, RECORD_FIELD_STATES, RECORD_FLAG_REASONS, ROLE_GRANT_SCOPE_KINDS, ROLE_PENDING_CHANGES, ROLE_PENDING_DECISIONS, type ReadingPolicyValue, type ReasoningEffortConfig, type RecordColumn, type RecordEvidenceResult, type ResultToolConfig, type RoleGrantScopeKind, type RolePendingDecision, SCHEDULED_START_STATES, SECRET_NAME_EXPECTATION, SERVER_PREVIEW_CAPTURE_REFUSALS, SERVICE_PRINCIPAL_PERMISSIONS, SERVICE_PRINCIPAL_STATUSES, SKILL_CHANGE_TYPES, SKILL_FRONTMATTER_FIELDS, SKILL_FRONTMATTER_MAX_BYTES, SKILL_FRONTMATTER_MAX_DEPTH, SKILL_NAME_PATTERN, SKILL_NAME_RULE, SKILL_ORIGINS, SKILL_PORTABLE_DESCRIPTION_MAX_CHARS, SKILL_PORTABLE_NAME_MAX_CHARS, SKILL_RESOURCE_MEDIA_TYPES, SKILL_STARTERS_MAX, SKILL_STARTER_LINE_MAX_LENGTH, SKILL_SUMMARY_MAX_LENGTH, STRUCTURED_DATA_REVIEW_REASONS, STUDIO_KIND_PATHS, SUPPORTED_IMAGE_MIME_TYPES, type ScopeAssignmentInput, type ScopedTables, type ServerPreviewCaptureInput, type ServerPreviewCaptureOutcome, type ServicePrincipalPermission, type ServicePrincipalStatus, type SkillChangeType, type SkillConfig, type SkillFileEntry, type SkillFrontmatterRefusal, SkillMarkdownError, type SkillOrigin, type SkillResourceConfig, type SkillResourceMediaType, type SkillStarterConfig, type StructuredDataReviewReason, type SupportedImageMimeType, THEME_MODES, THEME_MODE_PREFERENCES, TOOL_ASSET_KIND, TOOL_CALL_STATES, TOOL_CODE_ANSWER_MAX_BYTES, TOOL_CODE_ENTRY_ENDINGS, TOOL_CODE_HTML_MAX_CHARS, TOOL_CODE_LIBRARY, TOOL_CODE_OUTPUT_MAX_BYTES, TOOL_CODE_REQUESTS_MAX, TOOL_CODE_REQUEST_ANSWER_MAX_BYTES, TOOL_CODE_REQUEST_MAX_BYTES, TOOL_CODE_RUNTIMES, TOOL_CODE_TIMEOUT_DEFAULT_SECONDS, TOOL_CODE_TIMEOUT_MAX_SECONDS, TOOL_CONNECTIONS_MAX, TOOL_DECISION_MODES, TOOL_DECISION_OUTCOMES, TOOL_DESCRIPTION_MAX_CHARS, TOOL_DISPLAY_MODES, TOOL_FILES_MAX, TOOL_FILES_MAX_BYTES, TOOL_FILE_MAX_BYTES, TOOL_FILE_PATH_PATTERN, TOOL_GROUPS, TOOL_INPUT_PARSE_ERROR_CODES, TOOL_INPUT_SCHEMA_MAX_BYTES, TOOL_INPUT_SCHEMA_MAX_DEPTH, TOOL_NAME_MAX_LENGTH, TOOL_NAME_PATTERN, TOOL_NAME_RULE, TOOL_OPERATION_PREFIX, TOOL_RESULT_DEFAULT_REPLY, TOOL_RESULT_KIND_PATTERN, TOOL_TYPES, type ThemeMode, type ThemeModePreference, type ToolAssetConfig, type ToolCallState, type ToolCodeDisplay, type ToolCodeRuntime, type ToolDisplayMode, type ToolGroup, type ToolInputParseErrorCode, USAGE_BREAKDOWN_DIMENSIONS, USAGE_COST_STATUSES, USAGE_ORIGINS, USAGE_SPEND_LIMIT_LEVELS, USER_STATUSES, type UnboundPreviewReport, type UsageCostStatus, type UserStatus, WAITING_OPERATION_RUN_STATUSES, WEB_SOURCE_PROVIDERS, WORKFLOW_CAPABILITY_UNITS, WORKFLOW_CODE_STEP_AVAILABILITY, WORKFLOW_DATASET_DOWNLOAD_FORMATS, WORKFLOW_DATASET_STATES, WORKFLOW_ENDED_STATUSES, WORKFLOW_EXECUTED_STEP_TYPES, WORKFLOW_KINDS, WORKFLOW_MARKDOWN_MAX_COLUMNS, WORKFLOW_MARKDOWN_MAX_ROWS, WORKFLOW_NAME_PATTERN, WORKFLOW_NAME_RULE, WORKFLOW_PACKAGE_MANIFEST_STATES, WORKFLOW_RESERVED_STEP_TYPES, WORKFLOW_RIGHTS_REVISIONS, WORKFLOW_RIGHT_NEEDED_FOR, WORKFLOW_RIGHT_REFUSALS, WORKFLOW_RUN_ACCOUNT_STATUSES, WORKFLOW_RUN_MODES, WORKFLOW_RUN_STATUSES, WORKFLOW_STEP_RUN_STATUSES, WORKFLOW_STEP_SOURCE_KINDS, WORKFLOW_STEP_TYPES, WORKFLOW_TEST_REVISIONS, WORKFLOW_TEXT_FORMAT_MARKDOWN, WORKFLOW_TEXT_MAX_PARTS, WORKFLOW_TRIGGER_KINDS, WORKFLOW_WEBHOOK_HEADERS, WORKFLOW_WEBHOOK_LIMITS, WORKSPACE_ACCENT_COLORS, WORKSPACE_ACCESS_STATES, WORKSPACE_BUNDLES, WORKSPACE_COMMAND_STATUSES, WORKSPACE_FILE_KINDS, WORKSPACE_MEMBERSHIP_ROLES, WORKSPACE_OWNED_RIGHT_KINDS, WORKSPACE_SECTIONS, WORKSPACE_USE_ASSET_KINDS, WORKSPACE_VISIBILITIES, type WebSourceProvider, type WorkflowAssetConfig, type WorkflowCapabilityUnit, type WorkflowDatasetDownloadFormat, type WorkflowDatasetState, type WorkflowEndedStatus, type WorkflowKind, type WorkflowMailSenderFact, type WorkflowMessageMailParams, type WorkflowReservedStepType, type WorkflowRunMode, type WorkflowRunStatus, type WorkflowStepRunStatus, type WorkflowStepSourceKind, type WorkflowStepType, type WorkflowTestRevision, type WorkflowTriggerKind, type WorkspaceAccentColor, type WorkspaceAccessState, type WorkspaceBundle, type WorkspaceCommandStatus, type WorkspaceFileKind, type WorkspaceMembershipRole, type WorkspaceSection, type WorkspaceVisibility, YAML_DATA_MAX_VALUES, YamlDataError, type YamlDataIssue, type YamlDataIssueCode, type YamlDataOptions, type YamlDataResult, agentConfigSchema, appInterfacePath, assetPagePath, bedrockProfileRefusal, boundPreviewReport, callableOperationSchema, callableOperationsPageSchema, checkStorableTexts, conversationInterfacePath, dataScopeNameSchema, dataScopesSchema, dataStoreDescriptionInputSchema, dataStoreDescriptionSchema, dataStoreRecordFieldSchema, dataStoreRecordProposalItemSchema, dataStoreRecordsContracts, dataStoreRecordsDecideInputSchema, dataStoreRecordsDecideOutputSchema, dataStoreRecordsFlaggedInputSchema, dataStoreRecordsFlaggedOutputSchema, dataStoreRecordsProposeInputSchema, dataStoreRecordsRuleSchema, deriveSkillTitle, formatSkillMarkdown, htmlPdfOptionsSchema, inboxItemPath, isPlainConfigObject, isPreviewCaptureWithinBounds, isRecord, isSecretName, isStorableText, knowledgeExtractFieldsInputSchema, knowledgeExtractFieldsOutputSchema, knowledgeFieldValueSchema, knowledgeFirstPassConfirmationSchema, knowledgeIngestFetchSchema, knowledgeIngestInputSchema, knowledgeIngestItemSchema, knowledgeIngestOutputSchema, knowledgeLocateInputSchema, knowledgeLocateOutputSchema, knowledgeOriginLinkSchema, knowledgePendingInputSchema, knowledgePendingOutputSchema, knowledgePendingPageRowSchema, knowledgePendingRowSchema, knowledgeProcessorOutputSchema, knowledgePutProcessedInputSchema, knowledgeRecordsRefusalSchema, knowledgeRetryInputSchema, knowledgeRetryOutputSchema, knowledgeSourceItemsInputSchema, knowledgeSourceItemsOutputSchema, knowledgeSourcesOutputSchema, knowledgeSyncInputSchema, knowledgeSyncResultSchema, knowledgeWithdrawInputSchema, knowledgeWithdrawOutputSchema, knowledgeWorkflowSourceSchema, knowledgeWorkflowSourcesOutputSchema, knowledgeWriteContracts, loadYamlData, localeCodes, localizedStringSchema, mailAddressSchema, mailBodySchema, mailCopyRecipientListSchema, mailPreviewRecipientSchema, mailRecipientDomainSchema, mailRecipientListSchema, mailRecipientSchema, mailReplyToSchema, mailSendContract, mailSendInputSchema, mailSendOutputSchema, mailSendPreviewSchema, mailSendRefusalDetailsSchema, mailSendSimulatedOutputSchema, mailSenderIdSchema, mailSenderNameSchema, mailSubjectSchema, mergeConfigObjects, operationBatchFailureSchema, operationBatchResultSchema, operationPagingSchema, operationSourceSchema, parseSkillMarkdown, previewReportEntrySchema, previewReportSchema, providerRegionSchema, readWebpSize, readYamlData, recordColumnTakes, recordEvidenceResultSchema, scopeAssignmentInputSchema, scopedTablesSchema, scrubPreviewFile, scrubPreviewText, serverPreviewCaptureInputSchema, serverPreviewCaptureOutcomeSchema, skillConfigSchema, skillFileEntrySchema, skillFileFrontmatterSchema, skillNameSchema, skillPortabilityIssues, skillResourceConfigSchema, skillResourceMediaTypeForPath, skillResourcePathSchema, skillStarterSchema, toolAssetConfigSchema, toolCallOperationName, toolCodeAnswerSchema, toolCodeDisplaySchema, toolCodeTimeoutSeconds, toolConnectionOperationSchema, toolFilePathSchema, toolFileSchema, toolInputSchemaSchema, toolNameSchema, toolOfOperationName, toolResultSchema, utf8Bytes, workflowConfigSchema, workflowDataFlowsSchema, workflowDatasetReferenceSchema, workflowFileReferenceSchema, workflowMailSenderFactSchema, workflowMessageMailParamsSchema, writeYamlData, yamlValueIssue, yamlValueIssueSentence };
package/dist/index.js CHANGED
@@ -148,6 +148,15 @@ var GUARDRAIL_ACTIONS = [
148
148
  "guardrail.delete"
149
149
  ];
150
150
 
151
+ // src/contract-values/tool.ts
152
+ var TOOL_ACTIONS = [
153
+ "tool.read",
154
+ "tool.write",
155
+ "tool.publish",
156
+ "tool.approve",
157
+ "tool.delete"
158
+ ];
159
+
151
160
  // src/contract-values/operations.ts
152
161
  var OPERATIONS_ACTIONS = ["operations.approve"];
153
162
 
@@ -306,6 +315,7 @@ var ACTIONS = [
306
315
  ...KNOWLEDGE_BASE_ACTIONS,
307
316
  ...MAIL_SENDER_ACTIONS,
308
317
  ...GUARDRAIL_ACTIONS,
318
+ ...TOOL_ACTIONS,
309
319
  ...OPERATIONS_ACTIONS,
310
320
  ...FEEDBACK_ACTIONS,
311
321
  ...ADMINISTRATION_ACTIONS,
@@ -451,7 +461,8 @@ var OPERATION_RUN_DECISION_MODES = [
451
461
  var OPERATION_RUN_DECISION_REASONS = [
452
462
  "inherited_approval_not_applied",
453
463
  "workflow_publish",
454
- "approved_by_caller"
464
+ "approved_by_caller",
465
+ "tool_call"
455
466
  ];
456
467
  var OPERATION_DENIAL_REASONS = [
457
468
  "no_grant",
@@ -986,7 +997,8 @@ var WORKSPACE_OWNED_RIGHT_KINDS = [
986
997
  "workflow",
987
998
  "data_store",
988
999
  "knowledge_base",
989
- "guardrail"
1000
+ "guardrail",
1001
+ "tool"
990
1002
  ];
991
1003
  var PUBLISHED_DATA_CONSUMER_KINDS = ["app", "workflow", "knowledge_base"];
992
1004
  var SCHEDULED_START_STATES = ["active", "paused"];
@@ -1016,7 +1028,8 @@ var STUDIO_KIND_PATHS = {
1016
1028
  connection: "connections",
1017
1029
  data_store: "data-stores",
1018
1030
  knowledge_base: "knowledge-bases",
1019
- guardrail: "guardrails"
1031
+ guardrail: "guardrails",
1032
+ tool: "tools"
1020
1033
  };
1021
1034
  function assetPagePath(asset) {
1022
1035
  const name2 = encodeURIComponent(asset.name);
@@ -2841,6 +2854,954 @@ var htmlPdfOptionsSchema = z14.strictObject({
2841
2854
  left: margin.optional()
2842
2855
  }).optional()
2843
2856
  });
2857
+
2858
+ // src/tool-asset.ts
2859
+ import { z as z15 } from "zod";
2860
+ var TOOL_ASSET_KIND = "tool";
2861
+ var TOOL_OPERATION_PREFIX = "tool.";
2862
+ var TOOL_NAME_PATTERN = /^[a-z][a-z0-9_]*$/u;
2863
+ var TOOL_NAME_MAX_LENGTH = 48;
2864
+ var TOOL_NAME_RULE = "A tool's name is lowercase letters, digits and _, starts with a letter and is at most 48 characters long";
2865
+ var TOOL_RESULT_KIND_PATTERN = /^[a-z][a-z0-9_-]*(?:\.[a-z0-9][a-z0-9_-]*)*$/u;
2866
+ var TOOL_DESCRIPTION_MAX_CHARS = 4e3;
2867
+ var TOOL_INPUT_SCHEMA_MAX_BYTES = 32 * 1024;
2868
+ var TOOL_INPUT_SCHEMA_MAX_DEPTH = 24;
2869
+ var TOOL_RESULT_DEFAULT_REPLY = "Done.";
2870
+ var TOOL_TYPES = ["result", "code"];
2871
+ var TOOL_CODE_RUNTIMES = ["python", "node"];
2872
+ var TOOL_CODE_ENTRY_ENDINGS = {
2873
+ python: [".py"],
2874
+ node: [".js", ".mjs"]
2875
+ };
2876
+ var TOOL_CODE_TIMEOUT_DEFAULT_SECONDS = 30;
2877
+ var TOOL_CODE_TIMEOUT_MAX_SECONDS = 120;
2878
+ var TOOL_FILES_MAX = 32;
2879
+ var TOOL_FILE_MAX_BYTES = 1024 * 1024;
2880
+ var TOOL_FILES_MAX_BYTES = 1024 * 1024;
2881
+ var TOOL_FILE_PATH_PATTERN = /^(?:[A-Za-z0-9_][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_][A-Za-z0-9_.-]*$/u;
2882
+ var TOOL_FILE_PATH_RULE = "A file path is '/'-separated parts of letters, digits, '_', '-' and '.', none of them hidden";
2883
+ var TOOL_CONNECTIONS_MAX = 32;
2884
+ var TOOL_CONNECTION_OPERATION_PATTERN = new RegExp(
2885
+ `^connection\\.${CONNECTION_NAME_PATTERN.source.slice(1, -1)}\\.[A-Za-z][A-Za-z0-9_-]*$`,
2886
+ "u"
2887
+ );
2888
+ var TOOL_CONNECTION_OPERATION_RULE = "A declared Connection operation is named connection.<connection>.<operation>";
2889
+ var toolConnectionOperationSchema = z15.string().max(200, TOOL_CONNECTION_OPERATION_RULE).regex(TOOL_CONNECTION_OPERATION_PATTERN, TOOL_CONNECTION_OPERATION_RULE);
2890
+ var toolNameSchema = z15.string().max(TOOL_NAME_MAX_LENGTH, TOOL_NAME_RULE).regex(TOOL_NAME_PATTERN, TOOL_NAME_RULE);
2891
+ function depthOf(value) {
2892
+ let deepest = 0;
2893
+ const open = [{ value, depth: 0 }];
2894
+ for (let next = open.pop(); next; next = open.pop()) {
2895
+ if (typeof next.value !== "object" || next.value === null) continue;
2896
+ const depth = next.depth + 1;
2897
+ if (depth > deepest) deepest = depth;
2898
+ if (depth > TOOL_INPUT_SCHEMA_MAX_DEPTH) return depth;
2899
+ for (const item of Object.values(next.value)) open.push({ value: item, depth });
2900
+ }
2901
+ return deepest;
2902
+ }
2903
+ var toolInputSchemaSchema = z15.record(z15.string(), z15.unknown()).superRefine((schema, context) => {
2904
+ if (schema.type !== "object") {
2905
+ context.addIssue({
2906
+ code: "custom",
2907
+ message: 'The input schema must describe an object: give it `type: "object"`'
2908
+ });
2909
+ }
2910
+ const bytes = new TextEncoder().encode(JSON.stringify(schema)).byteLength;
2911
+ if (bytes > TOOL_INPUT_SCHEMA_MAX_BYTES) {
2912
+ context.addIssue({
2913
+ code: "custom",
2914
+ message: `The input schema is ${bytes} bytes as JSON; it may be at most ${TOOL_INPUT_SCHEMA_MAX_BYTES}`
2915
+ });
2916
+ }
2917
+ if (depthOf(schema) > TOOL_INPUT_SCHEMA_MAX_DEPTH) {
2918
+ context.addIssue({
2919
+ code: "custom",
2920
+ message: `The input schema nests deeper than ${TOOL_INPUT_SCHEMA_MAX_DEPTH} levels`
2921
+ });
2922
+ }
2923
+ });
2924
+ var toolResultSchema = z15.object({
2925
+ /** The display kind the panel draws the result with. */
2926
+ kind: z15.string().max(120).regex(
2927
+ TOOL_RESULT_KIND_PATTERN,
2928
+ "A result kind is lowercase words joined by '.', '_' or '-', such as review.document_check"
2929
+ ),
2930
+ /** The resource a new call replaces in its conversation. The tool's name where left out. */
2931
+ key: z15.string().max(80).regex(/^[a-z][a-z0-9_-]*$/u, "A result key is lowercase letters, digits, _ and -").optional(),
2932
+ /** The panel's heading. */
2933
+ title: z15.string().trim().min(1).max(120),
2934
+ schemaVersion: z15.number().int().min(1).max(1e3).optional(),
2935
+ /** The sentence the agent is answered with. */
2936
+ reply: z15.string().trim().min(1).max(500).optional()
2937
+ }).strict();
2938
+ var toolFields = {
2939
+ name: toolNameSchema,
2940
+ /** What people read: the agent page and Studio. */
2941
+ title: localizedStringSchema,
2942
+ summary: localizedStringSchema.optional(),
2943
+ /** What the agent reads: when to call it and what it hands over. */
2944
+ description: z15.string().trim().min(1).max(TOOL_DESCRIPTION_MAX_CHARS),
2945
+ icon: z15.string().regex(/^[a-z][a-z0-9-]*$/u).max(40).optional(),
2946
+ input: toolInputSchemaSchema
2947
+ };
2948
+ var toolFilePathSchema = z15.string().max(200, "A file path is at most 200 characters long").regex(TOOL_FILE_PATH_PATTERN, TOOL_FILE_PATH_RULE);
2949
+ var toolFileSchema = z15.object({
2950
+ path: toolFilePathSchema,
2951
+ // Source text: a NUL byte is no text a database column keeps.
2952
+ content: z15.string().refine((text2) => !text2.includes("\0"), "A file is text without NUL")
2953
+ }).strict();
2954
+ var resultToolSchema = z15.object({ ...toolFields, type: z15.literal("result"), result: toolResultSchema }).strict();
2955
+ var codeToolSchema = z15.object({
2956
+ ...toolFields,
2957
+ type: z15.literal("code"),
2958
+ runtime: z15.enum(TOOL_CODE_RUNTIMES),
2959
+ /** The handler: the path of one of `files`. */
2960
+ entry: toolFilePathSchema,
2961
+ timeoutSeconds: z15.number().int().min(1).max(TOOL_CODE_TIMEOUT_MAX_SECONDS).optional(),
2962
+ /**
2963
+ * The Connection operations the handler may call, each `connection.<name>.<operation>`. A
2964
+ * call of any other is refused with `connection_not_declared`. Each must be an operation of
2965
+ * a Connection when the tool is written.
2966
+ */
2967
+ connections: z15.array(toolConnectionOperationSchema).max(TOOL_CONNECTIONS_MAX).optional(),
2968
+ /** The folder of the tool: the handler and whatever it reads or imports. */
2969
+ files: z15.array(toolFileSchema).min(1).max(TOOL_FILES_MAX)
2970
+ }).strict().superRefine((tool, context) => {
2971
+ const endings = TOOL_CODE_ENTRY_ENDINGS[tool.runtime];
2972
+ if (!endings.some((ending) => tool.entry.endsWith(ending))) {
2973
+ context.addIssue({
2974
+ code: "custom",
2975
+ path: ["entry"],
2976
+ message: `A ${tool.runtime} handler is a file ending in ${endings.map((e) => `'${e}'`).join(" or ")}`
2977
+ });
2978
+ }
2979
+ if (!tool.files.some((file) => file.path === tool.entry)) {
2980
+ context.addIssue({
2981
+ code: "custom",
2982
+ path: ["entry"],
2983
+ message: `The files hold no '${tool.entry}': the handler must be among them`
2984
+ });
2985
+ }
2986
+ const declared = /* @__PURE__ */ new Set();
2987
+ tool.connections?.forEach((name2, at) => {
2988
+ if (declared.has(name2)) {
2989
+ context.addIssue({
2990
+ code: "custom",
2991
+ path: ["connections", at],
2992
+ message: `'${name2}' is declared twice`
2993
+ });
2994
+ }
2995
+ declared.add(name2);
2996
+ });
2997
+ let total = 0;
2998
+ const seen = /* @__PURE__ */ new Set();
2999
+ tool.files.forEach((file, at) => {
3000
+ const bytes = new TextEncoder().encode(file.content).byteLength;
3001
+ total += bytes;
3002
+ if (bytes > TOOL_FILE_MAX_BYTES) {
3003
+ context.addIssue({
3004
+ code: "custom",
3005
+ path: ["files", at, "content"],
3006
+ message: `'${file.path}' has ${bytes} bytes; a file of a tool has at most ${TOOL_FILE_MAX_BYTES}`
3007
+ });
3008
+ }
3009
+ const key2 = file.path.toLowerCase();
3010
+ if (seen.has(key2) || [...seen].some((other) => key2.startsWith(`${other}/`) || other.startsWith(`${key2}/`))) {
3011
+ context.addIssue({
3012
+ code: "custom",
3013
+ path: ["files", at, "path"],
3014
+ message: `'${file.path}' is held twice, or as a file and a folder`
3015
+ });
3016
+ }
3017
+ seen.add(key2);
3018
+ });
3019
+ if (total > TOOL_FILES_MAX_BYTES) {
3020
+ context.addIssue({
3021
+ code: "custom",
3022
+ path: ["files"],
3023
+ message: `The files have ${total} bytes together; a tool's files have at most ${TOOL_FILES_MAX_BYTES}`
3024
+ });
3025
+ }
3026
+ });
3027
+ var toolAssetConfigSchema = z15.discriminatedUnion("type", [
3028
+ resultToolSchema,
3029
+ codeToolSchema
3030
+ ]);
3031
+ function toolCodeTimeoutSeconds(tool) {
3032
+ return tool.timeoutSeconds ?? TOOL_CODE_TIMEOUT_DEFAULT_SECONDS;
3033
+ }
3034
+ function toolCallOperationName(tool) {
3035
+ return `${TOOL_OPERATION_PREFIX}${tool}.call`;
3036
+ }
3037
+ function toolOfOperationName(name2) {
3038
+ if (!name2.startsWith(TOOL_OPERATION_PREFIX) || !name2.endsWith(".call")) return void 0;
3039
+ const tool = name2.slice(TOOL_OPERATION_PREFIX.length, -".call".length);
3040
+ return tool.length <= TOOL_NAME_MAX_LENGTH && TOOL_NAME_PATTERN.test(tool) ? tool : void 0;
3041
+ }
3042
+
3043
+ // src/tool-code-library.ts
3044
+ var PYTHON = `"""Calls a Connection operation the tool declares, through the platform."""
3045
+
3046
+ import json
3047
+ import os
3048
+ import select
3049
+ import threading
3050
+
3051
+ __all__ = ["ConnectionCallError", "call", "connection"]
3052
+
3053
+ _lock = threading.Lock()
3054
+ _held = b""
3055
+
3056
+
3057
+ class ConnectionCallError(Exception):
3058
+ """A call the platform refused, or that failed. \`code\` names why."""
3059
+
3060
+ def __init__(self, code, message):
3061
+ super().__init__(f"{code}: {message}")
3062
+ self.code = code
3063
+ self.message = message
3064
+
3065
+
3066
+ def _descriptor(name):
3067
+ value = os.environ.get(name)
3068
+ if value is None:
3069
+ raise ConnectionCallError(
3070
+ "channel_unavailable", "This handler runs without the platform's request channel"
3071
+ )
3072
+ return int(value)
3073
+
3074
+
3075
+ def _write(fd, data):
3076
+ while data:
3077
+ select.select([], [fd], [])
3078
+ try:
3079
+ data = data[os.write(fd, data):]
3080
+ except BlockingIOError:
3081
+ pass
3082
+
3083
+
3084
+ def _read_line(fd):
3085
+ global _held
3086
+ while b"\\n" not in _held:
3087
+ select.select([fd], [], [])
3088
+ try:
3089
+ chunk = os.read(fd, 65536)
3090
+ except BlockingIOError:
3091
+ continue
3092
+ if not chunk:
3093
+ raise ConnectionCallError("channel_closed", "The platform closed the request channel")
3094
+ _held += chunk
3095
+ line, _, _held = _held.partition(b"\\n")
3096
+ return line
3097
+
3098
+
3099
+ def call(connection, operation, input=None):
3100
+ """Calls \`connection.<connection>.<operation>\` and answers its output."""
3101
+ request = json.dumps(
3102
+ {"connection": connection, "operation": operation, "input": {} if input is None else input},
3103
+ separators=(",", ":"),
3104
+ )
3105
+ with _lock:
3106
+ _write(_descriptor("CATALYST_REQUEST_FD"), (request + "\\n").encode("utf-8"))
3107
+ answer = json.loads(_read_line(_descriptor("CATALYST_ANSWER_FD")))
3108
+ if answer.get("ok"):
3109
+ return answer.get("output")
3110
+ error = answer.get("error") or {}
3111
+ raise ConnectionCallError(error.get("code", "failed"), error.get("message", ""))
3112
+
3113
+
3114
+ class _Connection:
3115
+ def __init__(self, name):
3116
+ self.name = name
3117
+
3118
+ def call(self, operation, input=None):
3119
+ return call(self.name, operation, input)
3120
+
3121
+
3122
+ def connection(name):
3123
+ """The Connection \`name\`, whose declared operations \`.call\` calls."""
3124
+ return _Connection(name)
3125
+ `;
3126
+ var NODE = `// Calls a Connection operation the tool declares, through the platform.
3127
+ import { readSync, writeSync } from "node:fs";
3128
+
3129
+ export class ConnectionCallError extends Error {
3130
+ constructor(code, message) {
3131
+ super(\`\${code}: \${message}\`);
3132
+ this.name = "ConnectionCallError";
3133
+ this.code = code;
3134
+ }
3135
+ }
3136
+
3137
+ let held = Buffer.alloc(0);
3138
+ const pause = new Int32Array(new SharedArrayBuffer(4));
3139
+
3140
+ function descriptor(value) {
3141
+ if (value === undefined)
3142
+ throw new ConnectionCallError("channel_unavailable", "This handler runs without the platform's request channel");
3143
+ return Number(value);
3144
+ }
3145
+
3146
+ function again(error) {
3147
+ if (error?.code !== "EAGAIN") throw error;
3148
+ Atomics.wait(pause, 0, 0, 5);
3149
+ }
3150
+
3151
+ function write(fd, data) {
3152
+ let at = 0;
3153
+ while (at < data.length) {
3154
+ try {
3155
+ at += writeSync(fd, data, at);
3156
+ } catch (error) {
3157
+ again(error);
3158
+ }
3159
+ }
3160
+ }
3161
+
3162
+ function readLine(fd) {
3163
+ const chunk = Buffer.alloc(65536);
3164
+ for (;;) {
3165
+ const end = held.indexOf(10);
3166
+ if (end >= 0) {
3167
+ const line = held.subarray(0, end).toString("utf8");
3168
+ held = held.subarray(end + 1);
3169
+ return line;
3170
+ }
3171
+ let read;
3172
+ try {
3173
+ read = readSync(fd, chunk, 0, chunk.length, null);
3174
+ } catch (error) {
3175
+ again(error);
3176
+ continue;
3177
+ }
3178
+ if (read === 0) throw new ConnectionCallError("channel_closed", "The platform closed the request channel");
3179
+ held = Buffer.concat([held, chunk.subarray(0, read)]);
3180
+ }
3181
+ }
3182
+
3183
+ /** Calls \`connection.<connection>.<operation>\` and answers its output. */
3184
+ export async function call(connection, operation, input = {}) {
3185
+ write(descriptor(process.env.CATALYST_REQUEST_FD), Buffer.from(JSON.stringify({ connection, operation, input }) + "\\n", "utf8"));
3186
+ const answer = JSON.parse(readLine(descriptor(process.env.CATALYST_ANSWER_FD)));
3187
+ if (answer.ok) return answer.output;
3188
+ throw new ConnectionCallError(answer.error?.code ?? "failed", answer.error?.message ?? "");
3189
+ }
3190
+
3191
+ /** The Connection \`name\`, whose declared operations \`.call\` calls. */
3192
+ export function connection(name) {
3193
+ return { call: (operation, input) => call(name, operation, input) };
3194
+ }
3195
+ `;
3196
+ var PYTHON_SDK = String.raw`"""Writes a code tool's handler in Python.
3197
+
3198
+ from catalyst_tools import tool
3199
+
3200
+ @tool
3201
+ def find_contact(ctx, email: str, limit: int = 5):
3202
+ '''Finds a contact in the CRM by e-mail.
3203
+
3204
+ Args:
3205
+ email: The contact's e-mail address.
3206
+ limit: How many matches to answer at most.
3207
+ '''
3208
+ found = ctx.connection("crm").call("find_contact", {"email": email})
3209
+ ctx.display.data("crm.contacts", {"contacts": found}, "Contacts")
3210
+ return found
3211
+
3212
+ The input schema comes from the type hints (str, int, float, bool, Literal, list, Optional,
3213
+ TypedDict and dataclasses), the descriptions from the docstring. The function takes ctx first.
3214
+ Run as a tool's main.py, the handler answers the call the platform hands it.
3215
+ """
3216
+
3217
+ import asyncio
3218
+ import atexit
3219
+ import collections.abc
3220
+ import dataclasses
3221
+ import enum
3222
+ import importlib.util
3223
+ import inspect
3224
+ import json
3225
+ import os
3226
+ import re
3227
+ import sys
3228
+ import traceback
3229
+ import types
3230
+ import typing
3231
+
3232
+ from catalyst_tool import ConnectionCallError
3233
+ from catalyst_tool import connection as _connection
3234
+
3235
+ __all__ = ["ConnectionCallError", "Context", "Display", "ToolDefinition", "describe", "tool"]
3236
+
3237
+ _NONE = type(None)
3238
+ _UNION_TYPES = tuple(
3239
+ kind for kind in (typing.Union, getattr(types, "UnionType", None)) if kind is not None
3240
+ )
3241
+ _SETS = (set, frozenset, collections.abc.Set, collections.abc.MutableSet)
3242
+ _SEQUENCES = (list, tuple, collections.abc.Sequence, collections.abc.Iterable, *_SETS)
3243
+ _PARAMETER_SECTIONS = {"args", "arguments", "parameters", "params", "attributes", "fields"}
3244
+ _OTHER_SECTIONS = {
3245
+ "returns", "return", "yields", "raises", "examples", "example", "notes", "note", "see also"
3246
+ }
3247
+ _ENTRY = re.compile(r"^\*{0,2}(\w+)\s*(?:\([^)]*\))?\s*:\s*(.*)$")
3248
+ _PARAM_FIELD = re.compile(r"^:param\s+(?:[^:]*\s)?(\w+)\s*:\s*(.*)$")
3249
+ _TOOL_NAME = re.compile(r"^[a-z][a-z0-9_]*$")
3250
+
3251
+
3252
+ class Display:
3253
+ """What the call shows beside the chat: at most one display, the last one asked for."""
3254
+
3255
+ def __init__(self):
3256
+ self.shown = None
3257
+
3258
+ def data(self, kind, data, title):
3259
+ """Shows data of a display kind, drawn by its widget or the platform's data view."""
3260
+ self.shown = {"type": "data", "kind": kind, "title": title, "data": _jsonable(data)}
3261
+
3262
+ def html(self, html, title=None):
3263
+ """Shows the tool's own HTML in a sandboxed frame without network."""
3264
+ self.shown = {"type": "html", "html": html}
3265
+ if title is not None:
3266
+ self.shown["title"] = title
3267
+
3268
+
3269
+ class Context:
3270
+ """What a handler is handed first: its Connections, its display and its log."""
3271
+
3272
+ def __init__(self):
3273
+ self.display = Display()
3274
+
3275
+ def connection(self, name):
3276
+ """The Connection name, whose declared operations .call(operation, input) calls."""
3277
+ return _connection(name)
3278
+
3279
+ def log(self, *values):
3280
+ """Writes a line to the handler's log, never to the model."""
3281
+ print(*values, file=sys.stderr, flush=True)
3282
+
3283
+
3284
+ def _parse_docstring(doc):
3285
+ """The docstring's text before its sections, and the description of each named entry."""
3286
+ lines = inspect.cleandoc(doc or "").splitlines()
3287
+ summary, entries = [], {}
3288
+ section, indent, current = None, None, None
3289
+ for line in lines:
3290
+ stripped = line.strip()
3291
+ heading = stripped[:-1].strip().lower() if stripped.endswith(":") else None
3292
+ if heading in _PARAMETER_SECTIONS | _OTHER_SECTIONS and line == line.lstrip():
3293
+ section, indent, current = heading, None, None
3294
+ continue
3295
+ field = _PARAM_FIELD.match(stripped)
3296
+ if field:
3297
+ current = field.group(1)
3298
+ entries[current] = field.group(2).strip()
3299
+ section = "fields"
3300
+ indent = len(line) - len(line.lstrip())
3301
+ continue
3302
+ if section is None:
3303
+ if not stripped.startswith(":"):
3304
+ summary.append(line)
3305
+ continue
3306
+ if section not in _PARAMETER_SECTIONS or not stripped:
3307
+ continue
3308
+ depth = len(line) - len(line.lstrip())
3309
+ if indent is None:
3310
+ indent = depth
3311
+ entry = _ENTRY.match(stripped) if depth <= indent else None
3312
+ if entry:
3313
+ current = entry.group(1)
3314
+ entries[current] = entry.group(2).strip()
3315
+ elif current is not None:
3316
+ entries[current] = (entries[current] + " " + stripped).strip()
3317
+ return "\n".join(summary).strip(), entries
3318
+
3319
+
3320
+ def _json_type(value):
3321
+ if isinstance(value, bool):
3322
+ return "boolean"
3323
+ if isinstance(value, int):
3324
+ return "integer"
3325
+ if isinstance(value, float):
3326
+ return "number"
3327
+ if isinstance(value, str):
3328
+ return "string"
3329
+ if value is None:
3330
+ return "null"
3331
+ raise TypeError(f"A Literal value must be a str, int, float, bool or None, not {value!r}")
3332
+
3333
+
3334
+ def _nullable(schema):
3335
+ if isinstance(schema.get("type"), str) and "anyOf" not in schema:
3336
+ widened = dict(schema, type=[schema["type"], "null"])
3337
+ if "enum" in widened and None not in widened["enum"]:
3338
+ widened["enum"] = [*widened["enum"], None]
3339
+ return widened
3340
+ return {"anyOf": [schema, {"type": "null"}]}
3341
+
3342
+
3343
+ def _is_typeddict(hint):
3344
+ is_typeddict = getattr(typing, "is_typeddict", None)
3345
+ if is_typeddict is not None:
3346
+ return is_typeddict(hint)
3347
+ return isinstance(hint, type) and issubclass(hint, dict) and hasattr(hint, "__total__")
3348
+
3349
+
3350
+ def _jsonable_default(value):
3351
+ try:
3352
+ json.dumps(value, allow_nan=False)
3353
+ return True
3354
+ except (TypeError, ValueError):
3355
+ return False
3356
+
3357
+
3358
+ def _object_schema(described, hints, required, defaults, seen):
3359
+ properties = {}
3360
+ for name, hint in hints.items():
3361
+ schema = _schema(hint, seen)
3362
+ if name in described and "description" not in schema:
3363
+ schema = dict(schema, description=described[name])
3364
+ if name in defaults:
3365
+ default = defaults[name]
3366
+ if isinstance(default, enum.Enum):
3367
+ default = default.value
3368
+ if default is not None and _jsonable_default(default):
3369
+ schema = dict(schema, default=default)
3370
+ properties[name] = schema
3371
+ result = {"type": "object", "properties": properties}
3372
+ needed = [name for name in hints if name in required]
3373
+ if needed:
3374
+ result["required"] = needed
3375
+ result["additionalProperties"] = False
3376
+ return result
3377
+
3378
+
3379
+ def _class_schema(hint, seen):
3380
+ if hint in seen:
3381
+ raise TypeError(f"{hint.__name__} refers to itself, which an input schema cannot say")
3382
+ seen = seen | {hint}
3383
+ hints = typing.get_type_hints(hint, include_extras=True)
3384
+ _, described = _parse_docstring(hint.__doc__)
3385
+ if dataclasses.is_dataclass(hint):
3386
+ fields = [field for field in dataclasses.fields(hint) if field.init]
3387
+ hints = {field.name: hints[field.name] for field in fields}
3388
+ missing = dataclasses.MISSING
3389
+ required = {
3390
+ field.name
3391
+ for field in fields
3392
+ if field.default is missing and field.default_factory is missing
3393
+ }
3394
+ defaults = {field.name: field.default for field in fields if field.default is not missing}
3395
+ schema = _object_schema(described, hints, required, defaults, seen)
3396
+ for field in fields:
3397
+ description = field.metadata.get("description")
3398
+ if isinstance(description, str):
3399
+ schema["properties"][field.name]["description"] = description
3400
+ return schema
3401
+ required = set(getattr(hint, "__required_keys__", hints))
3402
+ return _object_schema(described, hints, required, {}, seen)
3403
+
3404
+
3405
+ def _schema(hint, seen=frozenset()):
3406
+ """The JSON Schema of one type hint."""
3407
+ if hint is typing.Any or hint is object or hint is inspect.Parameter.empty:
3408
+ return {}
3409
+ origin = typing.get_origin(hint)
3410
+ args = typing.get_args(hint)
3411
+ if origin is typing.Annotated:
3412
+ schema = _schema(args[0], seen)
3413
+ notes = [note for note in args[1:] if isinstance(note, str)]
3414
+ return dict(schema, description=" ".join(notes)) if notes else schema
3415
+ if hint is _NONE:
3416
+ return {"type": "null"}
3417
+ if origin in _UNION_TYPES:
3418
+ members = [member for member in args if member is not _NONE]
3419
+ inner = (
3420
+ _schema(members[0], seen)
3421
+ if len(members) == 1
3422
+ else {"anyOf": [_schema(member, seen) for member in members]}
3423
+ )
3424
+ return _nullable(inner) if len(members) < len(args) else inner
3425
+ if origin is typing.Literal:
3426
+ values = list(args)
3427
+ kinds = {_json_type(value) for value in values}
3428
+ schema = {"enum": values}
3429
+ if len(kinds) == 1:
3430
+ schema["type"] = kinds.pop()
3431
+ return schema
3432
+ if hint is bool:
3433
+ return {"type": "boolean"}
3434
+ if hint is int:
3435
+ return {"type": "integer"}
3436
+ if hint is float:
3437
+ return {"type": "number"}
3438
+ if hint is str:
3439
+ return {"type": "string"}
3440
+ if isinstance(hint, type) and issubclass(hint, enum.Enum):
3441
+ values = [member.value for member in hint]
3442
+ kinds = {_json_type(value) for value in values}
3443
+ schema = {"enum": values}
3444
+ if len(kinds) == 1:
3445
+ schema["type"] = kinds.pop()
3446
+ return schema
3447
+ if hint in _SEQUENCES or origin in _SEQUENCES:
3448
+ schema = {"type": "array"}
3449
+ items = [item for item in args if item is not Ellipsis]
3450
+ if len(items) == 1:
3451
+ schema["items"] = _schema(items[0], seen)
3452
+ elif items:
3453
+ raise TypeError(f"{hint!r} names several item types: use list[...] of one type")
3454
+ if hint in _SETS or origin in _SETS:
3455
+ schema["uniqueItems"] = True
3456
+ return schema
3457
+ if hint is dict or origin in (dict, collections.abc.Mapping):
3458
+ schema = {"type": "object"}
3459
+ if len(args) == 2:
3460
+ if args[0] is not str:
3461
+ raise TypeError(f"{hint!r} has keys that are no str, which JSON cannot hold")
3462
+ schema["additionalProperties"] = _schema(args[1], seen)
3463
+ return schema
3464
+ if dataclasses.is_dataclass(hint) and isinstance(hint, type):
3465
+ return _class_schema(hint, seen)
3466
+ if _is_typeddict(hint):
3467
+ return _class_schema(hint, seen)
3468
+ raise TypeError(
3469
+ f"catalyst_tools cannot describe the type {hint!r}: use str, int, float, bool, "
3470
+ "Literal, list, Optional, TypedDict or a dataclass"
3471
+ )
3472
+
3473
+
3474
+ def _convert(hint, value):
3475
+ """The value of the input as the hint names it: a dataclass is built from its object."""
3476
+ origin = typing.get_origin(hint)
3477
+ args = typing.get_args(hint)
3478
+ if origin is typing.Annotated:
3479
+ return _convert(args[0], value)
3480
+ if value is None:
3481
+ return None
3482
+ if origin in _UNION_TYPES:
3483
+ members = [member for member in args if member is not _NONE]
3484
+ return _convert(members[0], value) if len(members) == 1 else value
3485
+ if dataclasses.is_dataclass(hint) and isinstance(hint, type) and isinstance(value, dict):
3486
+ hints = typing.get_type_hints(hint, include_extras=True)
3487
+ given = {
3488
+ field.name: _convert(hints[field.name], value[field.name])
3489
+ for field in dataclasses.fields(hint)
3490
+ if field.init and field.name in value
3491
+ }
3492
+ return hint(**given)
3493
+ if isinstance(hint, type) and issubclass(hint, enum.Enum):
3494
+ return hint(value)
3495
+ if (hint in _SEQUENCES or origin in _SEQUENCES) and isinstance(value, list):
3496
+ items = [item for item in args if item is not Ellipsis]
3497
+ converted = [_convert(items[0], item) for item in value] if len(items) == 1 else value
3498
+ kind = origin or hint
3499
+ if kind is tuple:
3500
+ return tuple(converted)
3501
+ if kind is frozenset:
3502
+ return frozenset(converted)
3503
+ if kind in _SETS:
3504
+ return set(converted)
3505
+ return converted
3506
+ if (hint is float) and isinstance(value, int) and not isinstance(value, bool):
3507
+ return float(value)
3508
+ return value
3509
+
3510
+
3511
+ def _jsonable(value):
3512
+ """A value as JSON holds it: a dataclass as its object, an enum as its value."""
3513
+ if dataclasses.is_dataclass(value) and not isinstance(value, type):
3514
+ return {key: _jsonable(item) for key, item in dataclasses.asdict(value).items()}
3515
+ if isinstance(value, enum.Enum):
3516
+ return _jsonable(value.value)
3517
+ if isinstance(value, dict):
3518
+ return {str(key): _jsonable(item) for key, item in value.items()}
3519
+ if isinstance(value, (list, tuple, set, frozenset)):
3520
+ return [_jsonable(item) for item in value]
3521
+ return value
3522
+
3523
+
3524
+ class ToolDefinition:
3525
+ """A function @tool marked: its name, its description and its input schema."""
3526
+
3527
+ def __init__(self, function, name=None, description=None):
3528
+ if not callable(function):
3529
+ raise TypeError("@tool marks a function")
3530
+ self.function = function
3531
+ self.explicit_name = name
3532
+ self.name = name or function.__name__
3533
+ if name is not None and not _TOOL_NAME.match(name):
3534
+ raise ValueError(
3535
+ f"The tool name {name!r} is no name: lowercase letters, digits and _, "
3536
+ "starting with a letter"
3537
+ )
3538
+ summary, described = _parse_docstring(function.__doc__)
3539
+ self.description = description or summary or None
3540
+ signature = inspect.signature(function)
3541
+ parameters = list(signature.parameters.values())
3542
+ if not parameters or parameters[0].kind not in (
3543
+ inspect.Parameter.POSITIONAL_ONLY,
3544
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
3545
+ ):
3546
+ raise TypeError(f"{function.__name__} takes ctx as its first argument")
3547
+ hints = typing.get_type_hints(function, include_extras=True)
3548
+ self.hints = {}
3549
+ required, defaults = set(), {}
3550
+ for parameter in parameters[1:]:
3551
+ if parameter.kind in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD):
3552
+ raise TypeError(
3553
+ f"{function.__name__} takes *{parameter.name}: a tool's input is named fields"
3554
+ )
3555
+ if parameter.kind is inspect.Parameter.POSITIONAL_ONLY:
3556
+ raise TypeError(f"{parameter.name} of {function.__name__} must be passable by name")
3557
+ if parameter.name not in hints:
3558
+ raise TypeError(
3559
+ f"{parameter.name} of {function.__name__} has no type hint, which its "
3560
+ "input schema is made from"
3561
+ )
3562
+ self.hints[parameter.name] = hints[parameter.name]
3563
+ if parameter.default is inspect.Parameter.empty:
3564
+ required.add(parameter.name)
3565
+ else:
3566
+ defaults[parameter.name] = parameter.default
3567
+ self.required = required
3568
+ self.input = _object_schema(described, self.hints, required, defaults, frozenset())
3569
+
3570
+ def arguments(self, given):
3571
+ """The keyword arguments a call with the input given passes the function."""
3572
+ if not isinstance(given, dict):
3573
+ raise TypeError("A tool's input is a JSON object")
3574
+ missing = sorted(name for name in self.required if name not in given)
3575
+ if missing:
3576
+ raise TypeError(f"The input has no {', '.join(missing)}")
3577
+ return {
3578
+ name: _convert(hint, given[name]) for name, hint in self.hints.items() if name in given
3579
+ }
3580
+
3581
+ def run(self, given, ctx=None):
3582
+ """Calls the function with the input given, and answers what the platform reads."""
3583
+ ctx = ctx or Context()
3584
+ output = self.function(ctx, **self.arguments(given))
3585
+ if inspect.isawaitable(output):
3586
+ output = asyncio.run(_awaited(output))
3587
+ answer = {"output": _jsonable(output)}
3588
+ if ctx.display.shown is not None:
3589
+ answer["display"] = ctx.display.shown
3590
+ return answer
3591
+
3592
+ def describe(self):
3593
+ """The fields the CLI writes into the tool's definition."""
3594
+ described = {"input": self.input, "function": self.function.__name__}
3595
+ if self.explicit_name is not None:
3596
+ described["name"] = self.explicit_name
3597
+ if self.description:
3598
+ described["description"] = self.description
3599
+ return described
3600
+
3601
+
3602
+ async def _awaited(awaitable):
3603
+ return await awaitable
3604
+
3605
+
3606
+ _failed = []
3607
+
3608
+
3609
+ def _note_failure(previous):
3610
+ def hook(kind, value, trace):
3611
+ _failed.append(kind)
3612
+ previous(kind, value, trace)
3613
+
3614
+ return hook
3615
+
3616
+
3617
+ def _serve(definition):
3618
+ """Answers the platform's call of the tool, once the handler's file has run to its end."""
3619
+ if _failed:
3620
+ return
3621
+ try:
3622
+ source = os.environ.get("WORKFLOW_INPUT_FILE")
3623
+ if source:
3624
+ with open(source, encoding="utf-8") as handle:
3625
+ given = json.load(handle)
3626
+ else:
3627
+ given = json.load(sys.stdin)
3628
+ text = json.dumps(definition.run(given), ensure_ascii=False, allow_nan=False)
3629
+ target = os.environ.get("WORKFLOW_OUTPUT_FILE")
3630
+ if target:
3631
+ with open(target, "w", encoding="utf-8") as handle:
3632
+ handle.write(text)
3633
+ else:
3634
+ sys.stdout.write(text)
3635
+ sys.stdout.flush()
3636
+ except BaseException:
3637
+ traceback.print_exc()
3638
+ sys.stderr.flush()
3639
+ sys.stdout.flush()
3640
+ os._exit(1)
3641
+
3642
+
3643
+ _served = []
3644
+
3645
+
3646
+ def tool(function=None, *, name=None, description=None):
3647
+ """Marks the function a tool. Its file, run as the tool's main.py, answers the call."""
3648
+
3649
+ def mark(function):
3650
+ definition = ToolDefinition(function, name, description)
3651
+ function.__catalyst_tool__ = definition
3652
+ if function.__module__ == "__main__":
3653
+ if _served:
3654
+ raise TypeError("main.py marks one function with @tool")
3655
+ _served.append(definition)
3656
+ sys.excepthook = _note_failure(sys.excepthook)
3657
+ atexit.register(_serve, definition)
3658
+ return function
3659
+
3660
+ return mark if function is None else mark(function)
3661
+
3662
+
3663
+ def describe(path):
3664
+ """The definition fields of the one @tool function of the file at path."""
3665
+ folder = os.path.dirname(os.path.abspath(path))
3666
+ if folder not in sys.path:
3667
+ sys.path.insert(0, folder)
3668
+ spec = importlib.util.spec_from_file_location("catalyst_tool_handler", path)
3669
+ module = importlib.util.module_from_spec(spec)
3670
+ # A dataclass reads its module from sys.modules while it is made.
3671
+ sys.modules[spec.name] = module
3672
+ spec.loader.exec_module(module)
3673
+ found = [
3674
+ value.__catalyst_tool__
3675
+ for value in vars(module).values()
3676
+ if isinstance(getattr(value, "__catalyst_tool__", None), ToolDefinition)
3677
+ and getattr(value, "__module__", None) == module.__name__
3678
+ ]
3679
+ if len(found) != 1:
3680
+ raise TypeError(
3681
+ f"{os.path.basename(path)} marks {len(found)} functions with @tool; it must mark one"
3682
+ )
3683
+ return found[0].describe()
3684
+
3685
+
3686
+ if __name__ == "__main__":
3687
+ if len(sys.argv) != 3 or sys.argv[1] != "describe":
3688
+ sys.stderr.write("Usage: python3 -m catalyst_tools describe <main.py>\n")
3689
+ sys.exit(2)
3690
+ # The handler imports this module by its name: its marks are that module's, not __main__'s.
3691
+ import catalyst_tools
3692
+
3693
+ try:
3694
+ json.dump(catalyst_tools.describe(sys.argv[2]), sys.stdout)
3695
+ except Exception as error:
3696
+ sys.stderr.write(f"{type(error).__name__}: {error}\n")
3697
+ sys.exit(1)
3698
+ `;
3699
+ var NODE_SDK = String.raw`// Answers the platform's call of a code tool written with defineTool. The CLI bundles a
3700
+ // tool's index.ts into one module that hands its tool to serve().
3701
+ import { readFileSync, writeFileSync } from "node:fs";
3702
+ import { connection } from "./catalyst-tool.mjs";
3703
+
3704
+ /** What a handler is handed beside its input: its Connections, its display and its log. */
3705
+ export function createContext() {
3706
+ const context = {
3707
+ shown: undefined,
3708
+ connection,
3709
+ display: {
3710
+ data(kind, data, title) {
3711
+ context.shown = { type: "data", kind, title, data };
3712
+ },
3713
+ html(html, title) {
3714
+ context.shown = title === undefined ? { type: "html", html } : { type: "html", html, title };
3715
+ }
3716
+ },
3717
+ log: (...values) => console.error(...values)
3718
+ };
3719
+ return context;
3720
+ }
3721
+
3722
+ /** Calls the tool with the input given, and answers what the platform reads. */
3723
+ export async function run(tool, given, context = createContext()) {
3724
+ const parsed = tool.inputSchema?.safeParse ? tool.inputSchema.safeParse(given) : { success: true, data: given };
3725
+ if (!parsed.success) throw new Error("The input does not fit the tool's schema: " + parsed.error.message);
3726
+ const output = await tool.execute(parsed.data, {
3727
+ connection: context.connection,
3728
+ display: context.display,
3729
+ log: context.log
3730
+ });
3731
+ return context.shown === undefined
3732
+ ? { output: output === undefined ? null : output }
3733
+ : { output: output === undefined ? null : output, display: context.shown };
3734
+ }
3735
+
3736
+ /** Answers the call the platform hands this process. */
3737
+ export async function serve(tool) {
3738
+ try {
3739
+ const source = process.env.WORKFLOW_INPUT_FILE;
3740
+ const given = JSON.parse(readFileSync(source === undefined || source === "" ? 0 : source, "utf8"));
3741
+ const text = JSON.stringify(await run(tool, given));
3742
+ const target = process.env.WORKFLOW_OUTPUT_FILE;
3743
+ if (target) writeFileSync(target, text);
3744
+ else process.stdout.write(text);
3745
+ } catch (error) {
3746
+ console.error(error instanceof Error ? (error.stack ?? error.message) : String(error));
3747
+ process.exitCode = 1;
3748
+ }
3749
+ }
3750
+ `;
3751
+ var TOOL_CODE_LIBRARY = [
3752
+ { path: "catalyst_tool.py", content: PYTHON },
3753
+ { path: "catalyst-tool.mjs", content: NODE },
3754
+ { path: "catalyst_tools.py", content: PYTHON_SDK },
3755
+ { path: "catalyst-tools.mjs", content: NODE_SDK }
3756
+ ];
3757
+
3758
+ // src/tool-code-answer.ts
3759
+ import { z as z16 } from "zod";
3760
+ var TOOL_CODE_ANSWER_MAX_BYTES = 512 * 1024;
3761
+ var TOOL_CODE_OUTPUT_MAX_BYTES = 64 * 1024;
3762
+ var TOOL_CODE_HTML_MAX_CHARS = 2e5;
3763
+ var TOOL_CODE_REQUESTS_MAX = 50;
3764
+ var TOOL_CODE_REQUEST_MAX_BYTES = 256 * 1024;
3765
+ var TOOL_CODE_REQUEST_ANSWER_MAX_BYTES = 1024 * 1024;
3766
+ function utf8Bytes(text2) {
3767
+ return new TextEncoder().encode(text2).byteLength;
3768
+ }
3769
+ var dataDisplaySchema = z16.strictObject({
3770
+ type: z16.literal("data"),
3771
+ kind: z16.string().max(120).regex(
3772
+ TOOL_RESULT_KIND_PATTERN,
3773
+ "A display kind is lowercase words joined by '.', '_' or '-', such as review.document_check"
3774
+ ),
3775
+ title: z16.string().trim().min(1).max(120),
3776
+ data: z16.record(z16.string(), z16.unknown()),
3777
+ schemaVersion: z16.number().int().min(1).max(1e3).optional()
3778
+ });
3779
+ var htmlDisplaySchema = z16.strictObject({
3780
+ type: z16.literal("html"),
3781
+ title: z16.string().trim().min(1).max(160).optional(),
3782
+ html: z16.string().min(1).max(TOOL_CODE_HTML_MAX_CHARS)
3783
+ });
3784
+ var toolCodeDisplaySchema = z16.discriminatedUnion("type", [
3785
+ dataDisplaySchema,
3786
+ htmlDisplaySchema
3787
+ ]);
3788
+ var toolCodeAnswerSchema = z16.strictObject({
3789
+ output: z16.unknown(),
3790
+ display: toolCodeDisplaySchema.optional()
3791
+ }).superRefine((answer, context) => {
3792
+ if (answer.output === void 0) {
3793
+ context.addIssue({ code: "custom", path: ["output"], message: "The answer has no output" });
3794
+ return;
3795
+ }
3796
+ const bytes = utf8Bytes(JSON.stringify(answer.output));
3797
+ if (bytes > TOOL_CODE_OUTPUT_MAX_BYTES) {
3798
+ context.addIssue({
3799
+ code: "custom",
3800
+ path: ["output"],
3801
+ message: `The output has ${bytes} bytes as JSON; a tool hands the model at most ${TOOL_CODE_OUTPUT_MAX_BYTES}`
3802
+ });
3803
+ }
3804
+ });
2844
3805
  export {
2845
3806
  ACCESS_SOURCES,
2846
3807
  ACTIONS,
@@ -3113,12 +4074,39 @@ export {
3113
4074
  SkillMarkdownError,
3114
4075
  THEME_MODES,
3115
4076
  THEME_MODE_PREFERENCES,
4077
+ TOOL_ASSET_KIND,
3116
4078
  TOOL_CALL_STATES,
4079
+ TOOL_CODE_ANSWER_MAX_BYTES,
4080
+ TOOL_CODE_ENTRY_ENDINGS,
4081
+ TOOL_CODE_HTML_MAX_CHARS,
4082
+ TOOL_CODE_LIBRARY,
4083
+ TOOL_CODE_OUTPUT_MAX_BYTES,
4084
+ TOOL_CODE_REQUESTS_MAX,
4085
+ TOOL_CODE_REQUEST_ANSWER_MAX_BYTES,
4086
+ TOOL_CODE_REQUEST_MAX_BYTES,
4087
+ TOOL_CODE_RUNTIMES,
4088
+ TOOL_CODE_TIMEOUT_DEFAULT_SECONDS,
4089
+ TOOL_CODE_TIMEOUT_MAX_SECONDS,
4090
+ TOOL_CONNECTIONS_MAX,
3117
4091
  TOOL_DECISION_MODES,
3118
4092
  TOOL_DECISION_OUTCOMES,
4093
+ TOOL_DESCRIPTION_MAX_CHARS,
3119
4094
  TOOL_DISPLAY_MODES,
4095
+ TOOL_FILES_MAX,
4096
+ TOOL_FILES_MAX_BYTES,
4097
+ TOOL_FILE_MAX_BYTES,
4098
+ TOOL_FILE_PATH_PATTERN,
3120
4099
  TOOL_GROUPS,
3121
4100
  TOOL_INPUT_PARSE_ERROR_CODES,
4101
+ TOOL_INPUT_SCHEMA_MAX_BYTES,
4102
+ TOOL_INPUT_SCHEMA_MAX_DEPTH,
4103
+ TOOL_NAME_MAX_LENGTH,
4104
+ TOOL_NAME_PATTERN,
4105
+ TOOL_NAME_RULE,
4106
+ TOOL_OPERATION_PREFIX,
4107
+ TOOL_RESULT_DEFAULT_REPLY,
4108
+ TOOL_RESULT_KIND_PATTERN,
4109
+ TOOL_TYPES,
3122
4110
  USAGE_BREAKDOWN_DIMENSIONS,
3123
4111
  USAGE_COST_STATUSES,
3124
4112
  USAGE_ORIGINS,
@@ -3275,6 +4263,19 @@ export {
3275
4263
  skillResourceMediaTypeForPath,
3276
4264
  skillResourcePathSchema,
3277
4265
  skillStarterSchema,
4266
+ toolAssetConfigSchema,
4267
+ toolCallOperationName,
4268
+ toolCodeAnswerSchema,
4269
+ toolCodeDisplaySchema,
4270
+ toolCodeTimeoutSeconds,
4271
+ toolConnectionOperationSchema,
4272
+ toolFilePathSchema,
4273
+ toolFileSchema,
4274
+ toolInputSchemaSchema,
4275
+ toolNameSchema,
4276
+ toolOfOperationName,
4277
+ toolResultSchema,
4278
+ utf8Bytes,
3278
4279
  workflowConfigSchema,
3279
4280
  workflowDataFlowsSchema,
3280
4281
  workflowDatasetReferenceSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@work-shape/catalyst-asset-schemas",
3
- "version": "0.8.0-rc.41",
3
+ "version": "0.8.0-rc.43",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",