@eloxiv/contracts 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/Agent.d.ts +792 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +610 -0
- package/dist/Agent.js.map +1 -0
- package/dist/Analytics.d.ts +46 -0
- package/dist/Analytics.d.ts.map +1 -0
- package/dist/Analytics.js +89 -0
- package/dist/Analytics.js.map +1 -0
- package/dist/Approval.d.ts +70 -0
- package/dist/Approval.d.ts.map +1 -0
- package/dist/Approval.js +127 -0
- package/dist/Approval.js.map +1 -0
- package/dist/Catalog.d.ts +238 -0
- package/dist/Catalog.d.ts.map +1 -0
- package/dist/Catalog.js +169 -0
- package/dist/Catalog.js.map +1 -0
- package/dist/Checklist.d.ts +99 -0
- package/dist/Checklist.d.ts.map +1 -0
- package/dist/Checklist.js +105 -0
- package/dist/Checklist.js.map +1 -0
- package/dist/Data.d.ts +107 -0
- package/dist/Data.d.ts.map +1 -0
- package/dist/Data.js +93 -0
- package/dist/Data.js.map +1 -0
- package/dist/Devices.d.ts +857 -0
- package/dist/Devices.d.ts.map +1 -0
- package/dist/Devices.js +590 -0
- package/dist/Devices.js.map +1 -0
- package/dist/Durable.d.ts +406 -0
- package/dist/Durable.d.ts.map +1 -0
- package/dist/Durable.js +203 -0
- package/dist/Durable.js.map +1 -0
- package/dist/Errors.d.ts +95 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +72 -0
- package/dist/Errors.js.map +1 -0
- package/dist/JsonSchema.d.ts +355 -0
- package/dist/JsonSchema.d.ts.map +1 -0
- package/dist/JsonSchema.js +151 -0
- package/dist/JsonSchema.js.map +1 -0
- package/dist/Manifest.d.ts +353 -0
- package/dist/Manifest.d.ts.map +1 -0
- package/dist/Manifest.js +894 -0
- package/dist/Manifest.js.map +1 -0
- package/dist/Module.d.ts +447 -0
- package/dist/Module.d.ts.map +1 -0
- package/dist/Module.js +221 -0
- package/dist/Module.js.map +1 -0
- package/dist/Optimistic.d.ts +192 -0
- package/dist/Optimistic.d.ts.map +1 -0
- package/dist/Optimistic.js +319 -0
- package/dist/Optimistic.js.map +1 -0
- package/dist/Projection.d.ts +163 -0
- package/dist/Projection.d.ts.map +1 -0
- package/dist/Projection.js +158 -0
- package/dist/Projection.js.map +1 -0
- package/dist/Proposals.d.ts +103 -0
- package/dist/Proposals.d.ts.map +1 -0
- package/dist/Proposals.js +72 -0
- package/dist/Proposals.js.map +1 -0
- package/dist/Receipt.d.ts +243 -0
- package/dist/Receipt.d.ts.map +1 -0
- package/dist/Receipt.js +108 -0
- package/dist/Receipt.js.map +1 -0
- package/dist/Records.d.ts +297 -0
- package/dist/Records.d.ts.map +1 -0
- package/dist/Records.js +171 -0
- package/dist/Records.js.map +1 -0
- package/dist/Render.d.ts +207 -0
- package/dist/Render.d.ts.map +1 -0
- package/dist/Render.js +502 -0
- package/dist/Render.js.map +1 -0
- package/dist/Rpc.d.ts +115 -0
- package/dist/Rpc.d.ts.map +1 -0
- package/dist/Rpc.js +68 -0
- package/dist/Rpc.js.map +1 -0
- package/dist/SearchLanguages.d.ts +4 -0
- package/dist/SearchLanguages.d.ts.map +1 -0
- package/dist/SearchLanguages.js +33 -0
- package/dist/SearchLanguages.js.map +1 -0
- package/dist/Service.d.ts +59 -0
- package/dist/Service.d.ts.map +1 -0
- package/dist/Service.js +38 -0
- package/dist/Service.js.map +1 -0
- package/dist/Versions.d.ts +9 -0
- package/dist/Versions.d.ts.map +1 -0
- package/dist/Versions.js +78 -0
- package/dist/Versions.js.map +1 -0
- package/dist/contracts/ActionConsent.d.ts +189 -0
- package/dist/contracts/ActionConsent.d.ts.map +1 -0
- package/dist/contracts/ActionConsent.js +129 -0
- package/dist/contracts/ActionConsent.js.map +1 -0
- package/dist/contracts/ActionRegistry.d.ts +149 -0
- package/dist/contracts/ActionRegistry.d.ts.map +1 -0
- package/dist/contracts/ActionRegistry.js +37 -0
- package/dist/contracts/ActionRegistry.js.map +1 -0
- package/dist/contracts/Actor.d.ts +129 -0
- package/dist/contracts/Actor.d.ts.map +1 -0
- package/dist/contracts/Actor.js +47 -0
- package/dist/contracts/Actor.js.map +1 -0
- package/dist/contracts/AgentResources.d.ts +248 -0
- package/dist/contracts/AgentResources.d.ts.map +1 -0
- package/dist/contracts/AgentResources.js +158 -0
- package/dist/contracts/AgentResources.js.map +1 -0
- package/dist/contracts/AgentRuntime.d.ts +453 -0
- package/dist/contracts/AgentRuntime.d.ts.map +1 -0
- package/dist/contracts/AgentRuntime.js +117 -0
- package/dist/contracts/AgentRuntime.js.map +1 -0
- package/dist/contracts/Approvals.d.ts +303 -0
- package/dist/contracts/Approvals.d.ts.map +1 -0
- package/dist/contracts/Approvals.js +117 -0
- package/dist/contracts/Approvals.js.map +1 -0
- package/dist/contracts/Audit.d.ts +510 -0
- package/dist/contracts/Audit.d.ts.map +1 -0
- package/dist/contracts/Audit.js +139 -0
- package/dist/contracts/Audit.js.map +1 -0
- package/dist/contracts/CalendarProvider.d.ts +572 -0
- package/dist/contracts/CalendarProvider.d.ts.map +1 -0
- package/dist/contracts/CalendarProvider.js +203 -0
- package/dist/contracts/CalendarProvider.js.map +1 -0
- package/dist/contracts/Capability.d.ts +197 -0
- package/dist/contracts/Capability.d.ts.map +1 -0
- package/dist/contracts/Capability.js +189 -0
- package/dist/contracts/Capability.js.map +1 -0
- package/dist/contracts/ClientSDK.d.ts +250 -0
- package/dist/contracts/ClientSDK.d.ts.map +1 -0
- package/dist/contracts/ClientSDK.js +184 -0
- package/dist/contracts/ClientSDK.js.map +1 -0
- package/dist/contracts/CollabDocument.d.ts +781 -0
- package/dist/contracts/CollabDocument.d.ts.map +1 -0
- package/dist/contracts/CollabDocument.js +364 -0
- package/dist/contracts/CollabDocument.js.map +1 -0
- package/dist/contracts/Command.d.ts +183 -0
- package/dist/contracts/Command.d.ts.map +1 -0
- package/dist/contracts/Command.js +66 -0
- package/dist/contracts/Command.js.map +1 -0
- package/dist/contracts/Connections.d.ts +612 -0
- package/dist/contracts/Connections.d.ts.map +1 -0
- package/dist/contracts/Connections.js +323 -0
- package/dist/contracts/Connections.js.map +1 -0
- package/dist/contracts/ContextAccounting.d.ts +79 -0
- package/dist/contracts/ContextAccounting.d.ts.map +1 -0
- package/dist/contracts/ContextAccounting.js +32 -0
- package/dist/contracts/ContextAccounting.js.map +1 -0
- package/dist/contracts/Daemon.d.ts +486 -0
- package/dist/contracts/Daemon.d.ts.map +1 -0
- package/dist/contracts/Daemon.js +192 -0
- package/dist/contracts/Daemon.js.map +1 -0
- package/dist/contracts/DbTx.d.ts +149 -0
- package/dist/contracts/DbTx.d.ts.map +1 -0
- package/dist/contracts/DbTx.js +94 -0
- package/dist/contracts/DbTx.js.map +1 -0
- package/dist/contracts/Delegation.d.ts +121 -0
- package/dist/contracts/Delegation.d.ts.map +1 -0
- package/dist/contracts/Delegation.js +76 -0
- package/dist/contracts/Delegation.js.map +1 -0
- package/dist/contracts/DeviceControl.d.ts +293 -0
- package/dist/contracts/DeviceControl.d.ts.map +1 -0
- package/dist/contracts/DeviceControl.js +107 -0
- package/dist/contracts/DeviceControl.js.map +1 -0
- package/dist/contracts/Directory.d.ts +492 -0
- package/dist/contracts/Directory.d.ts.map +1 -0
- package/dist/contracts/Directory.js +225 -0
- package/dist/contracts/Directory.js.map +1 -0
- package/dist/contracts/DirectoryProvider.d.ts +214 -0
- package/dist/contracts/DirectoryProvider.d.ts.map +1 -0
- package/dist/contracts/DirectoryProvider.js +73 -0
- package/dist/contracts/DirectoryProvider.js.map +1 -0
- package/dist/contracts/DocumentSource.d.ts +190 -0
- package/dist/contracts/DocumentSource.d.ts.map +1 -0
- package/dist/contracts/DocumentSource.js +64 -0
- package/dist/contracts/DocumentSource.js.map +1 -0
- package/dist/contracts/Files.d.ts +762 -0
- package/dist/contracts/Files.d.ts.map +1 -0
- package/dist/contracts/Files.js +339 -0
- package/dist/contracts/Files.js.map +1 -0
- package/dist/contracts/Flags.d.ts +265 -0
- package/dist/contracts/Flags.d.ts.map +1 -0
- package/dist/contracts/Flags.js +197 -0
- package/dist/contracts/Flags.js.map +1 -0
- package/dist/contracts/Host.d.ts +320 -0
- package/dist/contracts/Host.d.ts.map +1 -0
- package/dist/contracts/Host.js +224 -0
- package/dist/contracts/Host.js.map +1 -0
- package/dist/contracts/HttpApi.d.ts +102 -0
- package/dist/contracts/HttpApi.d.ts.map +1 -0
- package/dist/contracts/HttpApi.js +89 -0
- package/dist/contracts/HttpApi.js.map +1 -0
- package/dist/contracts/Ingestion.d.ts +522 -0
- package/dist/contracts/Ingestion.d.ts.map +1 -0
- package/dist/contracts/Ingestion.js +275 -0
- package/dist/contracts/Ingestion.js.map +1 -0
- package/dist/contracts/Ingress.d.ts +132 -0
- package/dist/contracts/Ingress.d.ts.map +1 -0
- package/dist/contracts/Ingress.js +102 -0
- package/dist/contracts/Ingress.js.map +1 -0
- package/dist/contracts/Invocation.d.ts +361 -0
- package/dist/contracts/Invocation.d.ts.map +1 -0
- package/dist/contracts/Invocation.js +104 -0
- package/dist/contracts/Invocation.js.map +1 -0
- package/dist/contracts/LocalClient.d.ts +878 -0
- package/dist/contracts/LocalClient.d.ts.map +1 -0
- package/dist/contracts/LocalClient.js +423 -0
- package/dist/contracts/LocalClient.js.map +1 -0
- package/dist/contracts/Locale.d.ts +162 -0
- package/dist/contracts/Locale.d.ts.map +1 -0
- package/dist/contracts/Locale.js +123 -0
- package/dist/contracts/Locale.js.map +1 -0
- package/dist/contracts/MachineIdentity.d.ts +434 -0
- package/dist/contracts/MachineIdentity.d.ts.map +1 -0
- package/dist/contracts/MachineIdentity.js +223 -0
- package/dist/contracts/MachineIdentity.js.map +1 -0
- package/dist/contracts/MailProvider.d.ts +791 -0
- package/dist/contracts/MailProvider.d.ts.map +1 -0
- package/dist/contracts/MailProvider.js +237 -0
- package/dist/contracts/MailProvider.js.map +1 -0
- package/dist/contracts/Memory.d.ts +62 -0
- package/dist/contracts/Memory.d.ts.map +1 -0
- package/dist/contracts/Memory.js +43 -0
- package/dist/contracts/Memory.js.map +1 -0
- package/dist/contracts/Messaging.d.ts +154 -0
- package/dist/contracts/Messaging.d.ts.map +1 -0
- package/dist/contracts/Messaging.js +97 -0
- package/dist/contracts/Messaging.js.map +1 -0
- package/dist/contracts/Metering.d.ts +334 -0
- package/dist/contracts/Metering.d.ts.map +1 -0
- package/dist/contracts/Metering.js +202 -0
- package/dist/contracts/Metering.js.map +1 -0
- package/dist/contracts/ModelProvider.d.ts +142 -0
- package/dist/contracts/ModelProvider.d.ts.map +1 -0
- package/dist/contracts/ModelProvider.js +72 -0
- package/dist/contracts/ModelProvider.js.map +1 -0
- package/dist/contracts/ModuleManifest.d.ts +2519 -0
- package/dist/contracts/ModuleManifest.d.ts.map +1 -0
- package/dist/contracts/ModuleManifest.js +272 -0
- package/dist/contracts/ModuleManifest.js.map +1 -0
- package/dist/contracts/NotificationChannel.d.ts +378 -0
- package/dist/contracts/NotificationChannel.d.ts.map +1 -0
- package/dist/contracts/NotificationChannel.js +136 -0
- package/dist/contracts/NotificationChannel.js.map +1 -0
- package/dist/contracts/Notifications.d.ts +417 -0
- package/dist/contracts/Notifications.d.ts.map +1 -0
- package/dist/contracts/Notifications.js +267 -0
- package/dist/contracts/Notifications.js.map +1 -0
- package/dist/contracts/Outbox.d.ts +469 -0
- package/dist/contracts/Outbox.d.ts.map +1 -0
- package/dist/contracts/Outbox.js +215 -0
- package/dist/contracts/Outbox.js.map +1 -0
- package/dist/contracts/Privacy.d.ts +1029 -0
- package/dist/contracts/Privacy.d.ts.map +1 -0
- package/dist/contracts/Privacy.js +437 -0
- package/dist/contracts/Privacy.js.map +1 -0
- package/dist/contracts/Progress.d.ts +305 -0
- package/dist/contracts/Progress.d.ts.map +1 -0
- package/dist/contracts/Progress.js +174 -0
- package/dist/contracts/Progress.js.map +1 -0
- package/dist/contracts/QuerySurface.d.ts +231 -0
- package/dist/contracts/QuerySurface.d.ts.map +1 -0
- package/dist/contracts/QuerySurface.js +113 -0
- package/dist/contracts/QuerySurface.js.map +1 -0
- package/dist/contracts/Readiness.d.ts +105 -0
- package/dist/contracts/Readiness.d.ts.map +1 -0
- package/dist/contracts/Readiness.js +57 -0
- package/dist/contracts/Readiness.js.map +1 -0
- package/dist/contracts/Release.d.ts +295 -0
- package/dist/contracts/Release.d.ts.map +1 -0
- package/dist/contracts/Release.js +175 -0
- package/dist/contracts/Release.js.map +1 -0
- package/dist/contracts/ResultRendering.d.ts +533 -0
- package/dist/contracts/ResultRendering.d.ts.map +1 -0
- package/dist/contracts/ResultRendering.js +59 -0
- package/dist/contracts/ResultRendering.js.map +1 -0
- package/dist/contracts/Sandbox.d.ts +1164 -0
- package/dist/contracts/Sandbox.d.ts.map +1 -0
- package/dist/contracts/Sandbox.js +550 -0
- package/dist/contracts/Sandbox.js.map +1 -0
- package/dist/contracts/Scheduler.d.ts +814 -0
- package/dist/contracts/Scheduler.d.ts.map +1 -0
- package/dist/contracts/Scheduler.js +202 -0
- package/dist/contracts/Scheduler.js.map +1 -0
- package/dist/contracts/ScreenContext.d.ts +514 -0
- package/dist/contracts/ScreenContext.d.ts.map +1 -0
- package/dist/contracts/ScreenContext.js +272 -0
- package/dist/contracts/ScreenContext.js.map +1 -0
- package/dist/contracts/Search.d.ts +308 -0
- package/dist/contracts/Search.d.ts.map +1 -0
- package/dist/contracts/Search.js +107 -0
- package/dist/contracts/Search.js.map +1 -0
- package/dist/contracts/Secrets.d.ts +483 -0
- package/dist/contracts/Secrets.d.ts.map +1 -0
- package/dist/contracts/Secrets.js +136 -0
- package/dist/contracts/Secrets.js.map +1 -0
- package/dist/contracts/Settings.d.ts +221 -0
- package/dist/contracts/Settings.d.ts.map +1 -0
- package/dist/contracts/Settings.js +163 -0
- package/dist/contracts/Settings.js.map +1 -0
- package/dist/contracts/Sharing.d.ts +319 -0
- package/dist/contracts/Sharing.d.ts.map +1 -0
- package/dist/contracts/Sharing.js +172 -0
- package/dist/contracts/Sharing.js.map +1 -0
- package/dist/contracts/Slot.d.ts +162 -0
- package/dist/contracts/Slot.d.ts.map +1 -0
- package/dist/contracts/Slot.js +56 -0
- package/dist/contracts/Slot.js.map +1 -0
- package/dist/contracts/Space.d.ts +256 -0
- package/dist/contracts/Space.d.ts.map +1 -0
- package/dist/contracts/Space.js +133 -0
- package/dist/contracts/Space.js.map +1 -0
- package/dist/contracts/StorageAdapter.d.ts +124 -0
- package/dist/contracts/StorageAdapter.d.ts.map +1 -0
- package/dist/contracts/StorageAdapter.js +96 -0
- package/dist/contracts/StorageAdapter.js.map +1 -0
- package/dist/contracts/StorageBackend.d.ts +310 -0
- package/dist/contracts/StorageBackend.d.ts.map +1 -0
- package/dist/contracts/StorageBackend.js +196 -0
- package/dist/contracts/StorageBackend.js.map +1 -0
- package/dist/contracts/Sync.d.ts +286 -0
- package/dist/contracts/Sync.d.ts.map +1 -0
- package/dist/contracts/Sync.js +157 -0
- package/dist/contracts/Sync.js.map +1 -0
- package/dist/contracts/Telemetry.d.ts +183 -0
- package/dist/contracts/Telemetry.d.ts.map +1 -0
- package/dist/contracts/Telemetry.js +153 -0
- package/dist/contracts/Telemetry.js.map +1 -0
- package/dist/contracts/ThemeTokens.d.ts +212 -0
- package/dist/contracts/ThemeTokens.d.ts.map +1 -0
- package/dist/contracts/ThemeTokens.js +111 -0
- package/dist/contracts/ThemeTokens.js.map +1 -0
- package/dist/contracts/ToolSource.d.ts +135 -0
- package/dist/contracts/ToolSource.d.ts.map +1 -0
- package/dist/contracts/ToolSource.js +81 -0
- package/dist/contracts/ToolSource.js.map +1 -0
- package/dist/contracts/Versioning.d.ts +363 -0
- package/dist/contracts/Versioning.d.ts.map +1 -0
- package/dist/contracts/Versioning.js +201 -0
- package/dist/contracts/Versioning.js.map +1 -0
- package/dist/contracts/View.d.ts +232 -0
- package/dist/contracts/View.d.ts.map +1 -0
- package/dist/contracts/View.js +102 -0
- package/dist/contracts/View.js.map +1 -0
- package/dist/contracts/WorkItems.d.ts +242 -0
- package/dist/contracts/WorkItems.d.ts.map +1 -0
- package/dist/contracts/WorkItems.js +126 -0
- package/dist/contracts/WorkItems.js.map +1 -0
- package/dist/contracts/Workflow.d.ts +191 -0
- package/dist/contracts/Workflow.d.ts.map +1 -0
- package/dist/contracts/Workflow.js +63 -0
- package/dist/contracts/Workflow.js.map +1 -0
- package/dist/contracts/index.d.ts +75 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +196 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/devices/module.d.ts +3777 -0
- package/dist/devices/module.d.ts.map +1 -0
- package/dist/devices/module.js +179 -0
- package/dist/devices/module.js.map +1 -0
- package/dist/drizzle/Entity.d.ts +148 -0
- package/dist/drizzle/Entity.d.ts.map +1 -0
- package/dist/drizzle/Entity.js +396 -0
- package/dist/drizzle/Entity.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -3
- package/schema/Actor.json +46 -0
- package/schema/AuditRecord.json +403 -0
- package/schema/DaemonHealth.json +29 -0
- package/schema/InvocationError.json +257 -0
- package/schema/InvocationReceipt.json +253 -0
- package/schema/Lockfile.json +129 -0
- package/schema/OutboxEvent.json +36 -0
- package/schema/PairingConfirm.json +33 -0
- package/schema/PairingResult.json +18 -0
- package/schema/PairingStart.json +18 -0
- package/schema/ProvenanceEntry.json +110 -0
- package/schema/ReplayEnvelope.json +269 -0
- package/schema/Surface.json +17 -0
- package/schema/codegen/LocalClient.json +1295 -0
- package/schema/codegen/Sandbox.json +320 -0
- package/schema/contracts/ActionConsent.json +1930 -0
- package/schema/contracts/ActionRegistry.json +722 -0
- package/schema/contracts/Actor.json +451 -0
- package/schema/contracts/AgentResources.json +1400 -0
- package/schema/contracts/AgentRuntime.json +4017 -0
- package/schema/contracts/Approvals.json +2916 -0
- package/schema/contracts/Audit.json +3268 -0
- package/schema/contracts/CalendarProvider.json +5557 -0
- package/schema/contracts/ClientSDK.json +1400 -0
- package/schema/contracts/CollabDocument.json +4012 -0
- package/schema/contracts/Command.json +616 -0
- package/schema/contracts/Connections.json +6687 -0
- package/schema/contracts/ContextAccounting.json +685 -0
- package/schema/contracts/Daemon.json +4555 -0
- package/schema/contracts/DbTx.json +321 -0
- package/schema/contracts/Delegation.json +949 -0
- package/schema/contracts/DeviceControl.json +2626 -0
- package/schema/contracts/Directory.json +5168 -0
- package/schema/contracts/DirectoryProvider.json +2090 -0
- package/schema/contracts/DocumentSource.json +2044 -0
- package/schema/contracts/Files.json +4122 -0
- package/schema/contracts/Flags.json +1202 -0
- package/schema/contracts/Host.json +1769 -0
- package/schema/contracts/HttpApi.json +1615 -0
- package/schema/contracts/Ingestion.json +3211 -0
- package/schema/contracts/Ingress.json +819 -0
- package/schema/contracts/Invocation.json +2044 -0
- package/schema/contracts/LocalClient.json +6642 -0
- package/schema/contracts/Locale.json +654 -0
- package/schema/contracts/MachineIdentity.json +2303 -0
- package/schema/contracts/MailProvider.json +6663 -0
- package/schema/contracts/Memory.json +579 -0
- package/schema/contracts/Messaging.json +1764 -0
- package/schema/contracts/Metering.json +3060 -0
- package/schema/contracts/ModelProvider.json +1127 -0
- package/schema/contracts/ModuleManifest.json +9449 -0
- package/schema/contracts/NotificationChannel.json +986 -0
- package/schema/contracts/Notifications.json +4280 -0
- package/schema/contracts/Outbox.json +1451 -0
- package/schema/contracts/Privacy.json +4354 -0
- package/schema/contracts/Progress.json +1524 -0
- package/schema/contracts/QuerySurface.json +661 -0
- package/schema/contracts/Readiness.json +209 -0
- package/schema/contracts/Release.json +805 -0
- package/schema/contracts/ResultRendering.json +2859 -0
- package/schema/contracts/Sandbox.json +2286 -0
- package/schema/contracts/Scheduler.json +6138 -0
- package/schema/contracts/ScreenContext.json +1238 -0
- package/schema/contracts/Search.json +1058 -0
- package/schema/contracts/Secrets.json +2444 -0
- package/schema/contracts/Settings.json +654 -0
- package/schema/contracts/Sharing.json +2854 -0
- package/schema/contracts/Slot.json +537 -0
- package/schema/contracts/Space.json +892 -0
- package/schema/contracts/StorageAdapter.json +623 -0
- package/schema/contracts/StorageBackend.json +2421 -0
- package/schema/contracts/Sync.json +894 -0
- package/schema/contracts/Telemetry.json +696 -0
- package/schema/contracts/ThemeTokens.json +547 -0
- package/schema/contracts/ToolSource.json +1333 -0
- package/schema/contracts/Versioning.json +1481 -0
- package/schema/contracts/View.json +750 -0
- package/schema/contracts/WorkItems.json +1731 -0
- package/schema/contracts/Workflow.json +1242 -0
- package/src/Agent.ts +758 -0
- package/src/Analytics.ts +110 -0
- package/src/Approval.ts +131 -0
- package/src/Catalog.ts +192 -0
- package/src/Checklist.ts +162 -0
- package/src/Data.ts +109 -0
- package/src/Devices.ts +721 -0
- package/src/Durable.ts +240 -0
- package/src/Errors.ts +111 -0
- package/src/JsonSchema.ts +166 -0
- package/src/Manifest.ts +1147 -0
- package/src/Module.ts +640 -0
- package/src/Optimistic.ts +332 -0
- package/src/Projection.ts +207 -0
- package/src/Proposals.ts +89 -0
- package/src/Receipt.ts +125 -0
- package/src/Records.ts +197 -0
- package/src/Render.ts +515 -0
- package/src/Rpc.ts +113 -0
- package/src/SearchLanguages.ts +33 -0
- package/src/Service.ts +102 -0
- package/src/Versions.ts +69 -0
- package/src/contracts/ActionConsent.ts +150 -0
- package/src/contracts/ActionRegistry.ts +39 -0
- package/src/contracts/Actor.ts +53 -0
- package/src/contracts/AgentResources.ts +167 -0
- package/src/contracts/AgentRuntime.ts +154 -0
- package/src/contracts/Approvals.ts +133 -0
- package/src/contracts/Audit.ts +160 -0
- package/src/contracts/CalendarProvider.ts +241 -0
- package/src/contracts/Capability.ts +246 -0
- package/src/contracts/ClientSDK.ts +199 -0
- package/src/contracts/CollabDocument.ts +420 -0
- package/src/contracts/Command.ts +74 -0
- package/src/contracts/Connections.ts +360 -0
- package/src/contracts/ContextAccounting.ts +35 -0
- package/src/contracts/Daemon.ts +247 -0
- package/src/contracts/DbTx.ts +110 -0
- package/src/contracts/Delegation.ts +91 -0
- package/src/contracts/DeviceControl.ts +143 -0
- package/src/contracts/Directory.ts +384 -0
- package/src/contracts/DirectoryProvider.ts +82 -0
- package/src/contracts/DocumentSource.ts +71 -0
- package/src/contracts/Files.ts +395 -0
- package/src/contracts/Flags.ts +241 -0
- package/src/contracts/Host.ts +245 -0
- package/src/contracts/HttpApi.ts +100 -0
- package/src/contracts/Ingestion.ts +315 -0
- package/src/contracts/Ingress.ts +132 -0
- package/src/contracts/Invocation.ts +122 -0
- package/src/contracts/LocalClient.ts +614 -0
- package/src/contracts/Locale.ts +133 -0
- package/src/contracts/MachineIdentity.ts +305 -0
- package/src/contracts/MailProvider.ts +272 -0
- package/src/contracts/Memory.ts +47 -0
- package/src/contracts/Messaging.ts +108 -0
- package/src/contracts/Metering.ts +231 -0
- package/src/contracts/ModelProvider.ts +87 -0
- package/src/contracts/ModuleManifest.ts +310 -0
- package/src/contracts/NotificationChannel.ts +158 -0
- package/src/contracts/Notifications.ts +309 -0
- package/src/contracts/Outbox.ts +246 -0
- package/src/contracts/Privacy.ts +502 -0
- package/src/contracts/Progress.ts +196 -0
- package/src/contracts/QuerySurface.ts +134 -0
- package/src/contracts/Readiness.ts +67 -0
- package/src/contracts/Release.ts +199 -0
- package/src/contracts/ResultRendering.ts +65 -0
- package/src/contracts/Sandbox.ts +648 -0
- package/src/contracts/Scheduler.ts +237 -0
- package/src/contracts/ScreenContext.ts +316 -0
- package/src/contracts/Search.ts +126 -0
- package/src/contracts/Secrets.ts +162 -0
- package/src/contracts/Settings.ts +207 -0
- package/src/contracts/Sharing.ts +205 -0
- package/src/contracts/Slot.ts +61 -0
- package/src/contracts/Space.ts +157 -0
- package/src/contracts/StorageAdapter.ts +104 -0
- package/src/contracts/StorageBackend.ts +220 -0
- package/src/contracts/Sync.ts +180 -0
- package/src/contracts/Telemetry.ts +177 -0
- package/src/contracts/ThemeTokens.ts +136 -0
- package/src/contracts/ToolSource.ts +94 -0
- package/src/contracts/Versioning.ts +237 -0
- package/src/contracts/View.ts +116 -0
- package/src/contracts/WorkItems.ts +144 -0
- package/src/contracts/Workflow.ts +67 -0
- package/src/contracts/index.ts +205 -0
- package/src/devices/module.ts +201 -0
- package/src/drizzle/Entity.ts +524 -0
- package/src/index.ts +19 -0
package/src/Agent.ts
ADDED
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records of the agent (the AgentRuntime, Memory, Delegation, ContextAccounting, AgentResources, ModelProvider
|
|
3
|
+
* and Metering contracts): runs and their events, context inventories, memory entries, resources, budgets and
|
|
4
|
+
* usage, and the errors the agent reports. Shared by the kernel, the client SDK and the conformance kits.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from "effect"
|
|
7
|
+
|
|
8
|
+
/** Where the kernel serves the agent over HTTP (see docs/contracts/agent-runtime.md). */
|
|
9
|
+
export const AGENT_PATHS = {
|
|
10
|
+
messages: "/agent/messages",
|
|
11
|
+
runs: "/agent/runs",
|
|
12
|
+
conversations: "/agent/conversations",
|
|
13
|
+
complete: "/agent/complete",
|
|
14
|
+
resources: "/agent/resources",
|
|
15
|
+
memory: "/agent/memory",
|
|
16
|
+
budgets: "/agent/budgets",
|
|
17
|
+
usage: "/agent/usage",
|
|
18
|
+
insights: "/agent/usage/insights",
|
|
19
|
+
feedback: "/agent/feedback",
|
|
20
|
+
readiness: "/agent/readiness",
|
|
21
|
+
/** Model setup: the catalogue (GET), and `/keys`, `/keys/remove`, `/check`, `/choose`, `/policy` (POST). */
|
|
22
|
+
models: "/agent/models",
|
|
23
|
+
} as const
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether the caller's agent can answer on the deployment's model now, as the kernel decides it (`GET
|
|
27
|
+
* /agent/readiness`, the organisation's model): `configured` (a provider and model are chosen and the provider can
|
|
28
|
+
* be called with the organisation's credentials); `missing` (nothing to call yet: no model chosen, or the provider has
|
|
29
|
+
* no credentials for the organisation: someone must set it up); `unavailable` (configured, but it cannot be used: a
|
|
30
|
+
* provider or model this deployment does not have, or credentials the provider refuses to build a model with).
|
|
31
|
+
* `unknown` is never the kernel's answer: a client that could not ask (no answer, a transport failure) says it, so
|
|
32
|
+
* a failed probe is never mistaken for a missing setup. The check builds the model without calling the provider, so
|
|
33
|
+
* `configured` is not a promise that a call succeeds (that failure is a run's `ModelUnavailable`).
|
|
34
|
+
*/
|
|
35
|
+
export const EngineState = Schema.Literals(["configured", "missing", "unavailable", "unknown"])
|
|
36
|
+
export type EngineState = typeof EngineState.Type
|
|
37
|
+
|
|
38
|
+
export const EngineReadiness = Schema.Struct({
|
|
39
|
+
state: EngineState,
|
|
40
|
+
/** The model the organisation's agent uses, when one is chosen. */
|
|
41
|
+
provider: Schema.NullOr(Schema.String),
|
|
42
|
+
model: Schema.NullOr(Schema.String),
|
|
43
|
+
/** Why, in words a person can act on; never a credential or what a provider said. */
|
|
44
|
+
detail: Schema.String,
|
|
45
|
+
})
|
|
46
|
+
export type EngineReadiness = typeof EngineReadiness.Type
|
|
47
|
+
|
|
48
|
+
// --- Errors -------------------------------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
/** A token or cost budget would be exceeded: the model call was refused before it was made. */
|
|
51
|
+
export class BudgetExceeded extends Schema.TaggedError<BudgetExceeded>()(
|
|
52
|
+
"BudgetExceeded",
|
|
53
|
+
{
|
|
54
|
+
message: Schema.String,
|
|
55
|
+
/** Whose budget: the person's or the organisation's. */
|
|
56
|
+
scope: Schema.Literals(["user", "org"]),
|
|
57
|
+
/** What is limited: tokens or cost (in millionths of the currency unit). */
|
|
58
|
+
meter: Schema.Literals(["agent.tokens", "agent.cost"]),
|
|
59
|
+
limit: Schema.Number,
|
|
60
|
+
used: Schema.Number,
|
|
61
|
+
/** What the refused call would have added (an estimate of its input). */
|
|
62
|
+
requested: Schema.Number,
|
|
63
|
+
},
|
|
64
|
+
{ httpApiStatus: 429 },
|
|
65
|
+
) {}
|
|
66
|
+
|
|
67
|
+
/** The model asked for a tool the run may not use (a sub-agent's narrower set, or no such tool). */
|
|
68
|
+
export class ToolNotAllowed extends Schema.TaggedError<ToolNotAllowed>()(
|
|
69
|
+
"ToolNotAllowed",
|
|
70
|
+
{ message: Schema.String, tool: Schema.String },
|
|
71
|
+
{ httpApiStatus: 403 },
|
|
72
|
+
) {}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Why a model call failed, as clients see it: the provider was unavailable (or not configured for the
|
|
76
|
+
* organisation), limited the rate, refused the credentials or access, took too long, or rejected the request.
|
|
77
|
+
*/
|
|
78
|
+
export const ModelFailureReason = Schema.Literals([
|
|
79
|
+
"unavailable",
|
|
80
|
+
"rate-limited",
|
|
81
|
+
"refused",
|
|
82
|
+
"timeout",
|
|
83
|
+
"invalid-request",
|
|
84
|
+
])
|
|
85
|
+
export type ModelFailureReason = typeof ModelFailureReason.Type
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* No model provider is configured for the deployment or organisation, or the provider refused the call. The
|
|
89
|
+
* `message` is the kernel's own: a provider's error text (which can echo keys or configuration) never reaches it;
|
|
90
|
+
* a provider's failure carries a fixed message per `reason` and a reference to the kernel's log, which holds the
|
|
91
|
+
* detail, redacted.
|
|
92
|
+
*/
|
|
93
|
+
export class ModelUnavailable extends Schema.TaggedError<ModelUnavailable>()(
|
|
94
|
+
"ModelUnavailable",
|
|
95
|
+
{
|
|
96
|
+
message: Schema.String,
|
|
97
|
+
provider: Schema.String,
|
|
98
|
+
model: Schema.String,
|
|
99
|
+
reason: Schema.optionalKey(ModelFailureReason),
|
|
100
|
+
},
|
|
101
|
+
{ httpApiStatus: 503 },
|
|
102
|
+
) {}
|
|
103
|
+
|
|
104
|
+
/** No run (or conversation) with this id that the caller may see. */
|
|
105
|
+
export class UnknownRun extends Schema.TaggedError<UnknownRun>()(
|
|
106
|
+
"UnknownRun",
|
|
107
|
+
{ runId: Schema.String },
|
|
108
|
+
{ httpApiStatus: 404 },
|
|
109
|
+
) {}
|
|
110
|
+
|
|
111
|
+
// --- Models ---------------------------------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
/** Tokens a model call used, as the provider reported them. */
|
|
114
|
+
export const ModelUsage = Schema.Struct({
|
|
115
|
+
inputTokens: Schema.Number,
|
|
116
|
+
outputTokens: Schema.Number,
|
|
117
|
+
})
|
|
118
|
+
export type ModelUsage = typeof ModelUsage.Type
|
|
119
|
+
|
|
120
|
+
/** Which provider and model serve an organisation (or the deployment's default). */
|
|
121
|
+
export const ModelChoice = Schema.Struct({ provider: Schema.String, model: Schema.String })
|
|
122
|
+
export type ModelChoice = typeof ModelChoice.Type
|
|
123
|
+
|
|
124
|
+
/** What a provider charges, in millionths of the currency unit per million tokens (0 when unknown or free). */
|
|
125
|
+
export const ModelPricing = Schema.Struct({
|
|
126
|
+
inputPerMillionMicros: Schema.Number,
|
|
127
|
+
outputPerMillionMicros: Schema.Number,
|
|
128
|
+
})
|
|
129
|
+
export type ModelPricing = typeof ModelPricing.Type
|
|
130
|
+
|
|
131
|
+
/** A message of a one-shot completion or of a conversation, in the provider-neutral form. */
|
|
132
|
+
export const CompletionMessage = Schema.Struct({
|
|
133
|
+
role: Schema.Literals(["system", "user", "assistant"]),
|
|
134
|
+
content: Schema.String,
|
|
135
|
+
})
|
|
136
|
+
export type CompletionMessage = typeof CompletionMessage.Type
|
|
137
|
+
|
|
138
|
+
/** A tool the model may call: its name, description and JSON Schema input. */
|
|
139
|
+
export const ToolDefinition = Schema.Struct({
|
|
140
|
+
name: Schema.String,
|
|
141
|
+
description: Schema.String,
|
|
142
|
+
inputSchema: Schema.Unknown,
|
|
143
|
+
})
|
|
144
|
+
export type ToolDefinition = typeof ToolDefinition.Type
|
|
145
|
+
|
|
146
|
+
/** A tool call the model made. */
|
|
147
|
+
export const ToolCall = Schema.Struct({ toolCallId: Schema.String, toolName: Schema.String, input: Schema.Unknown })
|
|
148
|
+
export type ToolCall = typeof ToolCall.Type
|
|
149
|
+
|
|
150
|
+
// --- Runs -------------------------------------------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
export const RunStatus = Schema.Literals([
|
|
153
|
+
"queued",
|
|
154
|
+
"running",
|
|
155
|
+
"waiting",
|
|
156
|
+
"succeeded",
|
|
157
|
+
"stopped",
|
|
158
|
+
"failed",
|
|
159
|
+
"cancelled",
|
|
160
|
+
])
|
|
161
|
+
export type RunStatus = typeof RunStatus.Type
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Why a run ended without succeeding: a loop limit (`steps`, `tokens`, `wall-time`), a budget, cancellation, a
|
|
165
|
+
* model failure, a failure of the run itself (`error`), or the model's own end (`completed`, for runs that succeeded).
|
|
166
|
+
* `noop`: a run a job or schedule started (`kind: "job"`) that found nothing to do and said so with its `no_op`
|
|
167
|
+
* tool; it succeeded, and its result is the reason.
|
|
168
|
+
*/
|
|
169
|
+
export const StopReason = Schema.Literals([
|
|
170
|
+
"completed",
|
|
171
|
+
"noop",
|
|
172
|
+
"steps",
|
|
173
|
+
"tokens",
|
|
174
|
+
"wall-time",
|
|
175
|
+
"budget",
|
|
176
|
+
"cancelled",
|
|
177
|
+
"model-error",
|
|
178
|
+
"error",
|
|
179
|
+
/** An app's processor tripped its abort guard (`KernelApp.agent.processors`). */
|
|
180
|
+
"processor",
|
|
181
|
+
])
|
|
182
|
+
export type StopReason = typeof StopReason.Type
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* How a run may act. `act` (the default): every tool it may use. `plan`: it reads and plans but changes nothing:
|
|
186
|
+
* only read-only actions (`hints.readOnly`) and the run's own read tools are offered, and a call to any other action
|
|
187
|
+
* is refused before it reaches the invocation path. A sub-agent of a plan-mode run is in plan mode too.
|
|
188
|
+
*/
|
|
189
|
+
export const RunMode = Schema.Literals(["act", "plan"])
|
|
190
|
+
export type RunMode = typeof RunMode.Type
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A write's compact receipt, carried on an agent tool result (`receipt`): did the call change anything, and is what
|
|
194
|
+
* it changed verified? `verified: true` only when the change was checked (by the kernel: an exact action's declared
|
|
195
|
+
* target or written row, authorised in its transaction; or by the action itself); `false` when a check failed (a
|
|
196
|
+
* best-effort action that skipped targets, a check the action reports failed); `unverified` when nothing checked it
|
|
197
|
+
* (a write without a declared target, an external effect the provider has not confirmed yet). An action may return
|
|
198
|
+
* its own receipt as an output field `_receipt` (this schema), which the kernel merges with what it observed: it can
|
|
199
|
+
* lower the kernel's verdict, never raise one the kernel saw fail.
|
|
200
|
+
*/
|
|
201
|
+
export const ReceiptCheck = Schema.Struct({
|
|
202
|
+
id: Schema.String.check(Schema.isMaxLength(100)),
|
|
203
|
+
ok: Schema.Boolean,
|
|
204
|
+
detail: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(300))),
|
|
205
|
+
})
|
|
206
|
+
export type ReceiptCheck = typeof ReceiptCheck.Type
|
|
207
|
+
|
|
208
|
+
export const WriteReceipt = Schema.Struct({
|
|
209
|
+
changed: Schema.Boolean,
|
|
210
|
+
verified: Schema.Union([Schema.Boolean, Schema.Literal("unverified")]),
|
|
211
|
+
summary: Schema.String.check(Schema.isMaxLength(300)),
|
|
212
|
+
/** What it changed (a record reference), so a later verified write to the same subject can supersede a failed one. */
|
|
213
|
+
subject: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(300))),
|
|
214
|
+
checks: Schema.optionalKey(Schema.Array(ReceiptCheck).check(Schema.isMaxLength(8))),
|
|
215
|
+
warnings: Schema.optionalKey(Schema.Array(Schema.String.check(Schema.isMaxLength(300))).check(Schema.isMaxLength(5))),
|
|
216
|
+
})
|
|
217
|
+
export type WriteReceipt = typeof WriteReceipt.Type
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* What the final-answer check found (persisted on a run that ended with an answer after writes): the receipts of
|
|
221
|
+
* its writes that were not verified, and what the check did: `passed` (none), `retried` (the model was challenged
|
|
222
|
+
* once with them and answered again), `annotated` (the answer carries them: `result` ends with a write check).
|
|
223
|
+
*/
|
|
224
|
+
export const RunVerification = Schema.Struct({
|
|
225
|
+
outcome: Schema.Literals(["passed", "retried", "annotated"]),
|
|
226
|
+
receipts: Schema.Array(Schema.Struct({ tool: Schema.String, receipt: WriteReceipt })),
|
|
227
|
+
/** Final-answer processors that challenged the answer (by name). */
|
|
228
|
+
challengedBy: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
229
|
+
})
|
|
230
|
+
export type RunVerification = typeof RunVerification.Type
|
|
231
|
+
|
|
232
|
+
const positiveInt = Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0))
|
|
233
|
+
|
|
234
|
+
export const RunContinuation = Schema.Struct({
|
|
235
|
+
of: Schema.String,
|
|
236
|
+
previous: Schema.String,
|
|
237
|
+
attempt: Schema.Number,
|
|
238
|
+
automatic: Schema.Boolean,
|
|
239
|
+
})
|
|
240
|
+
export type RunContinuation = typeof RunContinuation.Type
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* The organisation's agent loop policy (the setting `agent.loop`, organisation scope: written by members with
|
|
244
|
+
* `eloxiv.settings.manage`, or the deployment's value): each limit given replaces the deployment's for the
|
|
245
|
+
* organisation's runs, capped at the deployment's ceiling (`KernelApp.agent.maxLimits`).
|
|
246
|
+
*/
|
|
247
|
+
export const AgentLoopPolicy = Schema.Struct({
|
|
248
|
+
maxSteps: Schema.optionalKey(positiveInt),
|
|
249
|
+
maxTokens: Schema.optionalKey(positiveInt),
|
|
250
|
+
maxWallMs: Schema.optionalKey(positiveInt),
|
|
251
|
+
})
|
|
252
|
+
export type AgentLoopPolicy = typeof AgentLoopPolicy.Type
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* How the organisation's agent is offered its tools (the setting `agent.tools`, organisation scope). `all`: every
|
|
256
|
+
* tool it may use, with its schema, on every model call. `search`: a compact index of tool names, `tool_search` to
|
|
257
|
+
* find and load tools (ranked by name and description), and the loaded tools' schemas on the run's later calls;
|
|
258
|
+
* `eager` names tools always offered with their schemas.
|
|
259
|
+
*/
|
|
260
|
+
export const AgentToolPolicy = Schema.Struct({
|
|
261
|
+
discovery: Schema.Literals(["all", "search"]),
|
|
262
|
+
eager: Schema.optionalKey(Schema.Array(Schema.String).check(Schema.isMaxLength(50))),
|
|
263
|
+
})
|
|
264
|
+
export type AgentToolPolicy = typeof AgentToolPolicy.Type
|
|
265
|
+
|
|
266
|
+
/** The loop limits of a run. A sub-agent's are at most what its parent has left. */
|
|
267
|
+
export const RunLimits = Schema.Struct({
|
|
268
|
+
/** Model calls. */
|
|
269
|
+
maxSteps: Schema.Number,
|
|
270
|
+
/** Input plus output tokens over all model calls. */
|
|
271
|
+
maxTokens: Schema.Number,
|
|
272
|
+
/** From the run's start to its last model call (ms). */
|
|
273
|
+
maxWallMs: Schema.Number,
|
|
274
|
+
})
|
|
275
|
+
export type RunLimits = typeof RunLimits.Type
|
|
276
|
+
|
|
277
|
+
export const RunKind = Schema.Literals(["turn", "subagent", "job"])
|
|
278
|
+
export type RunKind = typeof RunKind.Type
|
|
279
|
+
|
|
280
|
+
export const Run = Schema.Struct({
|
|
281
|
+
id: Schema.String,
|
|
282
|
+
orgId: Schema.String,
|
|
283
|
+
/** The person the run acts for (`$system` for an organisation's job run). */
|
|
284
|
+
userId: Schema.String,
|
|
285
|
+
conversationId: Schema.String,
|
|
286
|
+
parentRunId: Schema.NullOr(Schema.String),
|
|
287
|
+
kind: RunKind,
|
|
288
|
+
status: RunStatus,
|
|
289
|
+
stopReason: Schema.NullOr(StopReason),
|
|
290
|
+
limits: RunLimits,
|
|
291
|
+
/** The tools the run may call (a sub-agent's set), or null for every tool of the agent. */
|
|
292
|
+
tools: Schema.NullOr(Schema.Array(Schema.String)),
|
|
293
|
+
usage: ModelUsage,
|
|
294
|
+
steps: Schema.Number,
|
|
295
|
+
/** The final answer, once the run has ended. */
|
|
296
|
+
result: Schema.NullOr(Schema.String),
|
|
297
|
+
error: Schema.NullOr(Schema.String),
|
|
298
|
+
/** How the run may act (absent: `act`). */
|
|
299
|
+
mode: Schema.optionalKey(RunMode),
|
|
300
|
+
/**
|
|
301
|
+
* A run that continues an interrupted turn (`agent.continue`, or automatically after a transient model failure): the
|
|
302
|
+
* logical turn's first run (`of`), the run it continues (`previous`), which continuation of the turn it is
|
|
303
|
+
* (`attempt`, from 1) and whether the kernel started it (`automatic`).
|
|
304
|
+
*/
|
|
305
|
+
continuation: Schema.optionalKey(RunContinuation),
|
|
306
|
+
/** What the final-answer check found, once a run that wrote something answered. */
|
|
307
|
+
verification: Schema.optionalKey(Schema.NullOr(RunVerification)),
|
|
308
|
+
/**
|
|
309
|
+
* An active run's progress: when its stream last recorded an event, and whether it is `stalled` (running, not
|
|
310
|
+
* waiting for a person or a sub-agent, with no event for longer than the deployment's `stallAfterMs`).
|
|
311
|
+
*/
|
|
312
|
+
activity: Schema.optionalKey(Schema.Struct({ lastEventAt: Schema.NullOr(Schema.String), stalled: Schema.Boolean })),
|
|
313
|
+
})
|
|
314
|
+
export type Run = typeof Run.Type
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* One event of a run's stream, durably numbered: a client reconnects with the last `seq` it saw and misses
|
|
318
|
+
* nothing. Text deltas are streamed live (not stored); everything else is here.
|
|
319
|
+
*/
|
|
320
|
+
export const RunEvent = Schema.Struct({
|
|
321
|
+
runId: Schema.String,
|
|
322
|
+
seq: Schema.Number,
|
|
323
|
+
type: Schema.Literals([
|
|
324
|
+
"run-started",
|
|
325
|
+
"model-step",
|
|
326
|
+
"tool-call",
|
|
327
|
+
"tool-result",
|
|
328
|
+
"consent-required",
|
|
329
|
+
"consent-decided",
|
|
330
|
+
"compacted",
|
|
331
|
+
"delegated",
|
|
332
|
+
/** A seat of the run's team started (the team tool's `spawn`): its id, name, task, tools and limits. */
|
|
333
|
+
"seat-spawned",
|
|
334
|
+
/** A message the run sent to a member of its team (`to`, `text`). */
|
|
335
|
+
"team-message",
|
|
336
|
+
/** A reply (a model call's or a device's) that arrived after the run's cancellation committed: metered, not applied. */
|
|
337
|
+
"reply-discarded",
|
|
338
|
+
/** The final-answer check: the unverified write receipts it found, and whether it challenged the model. */
|
|
339
|
+
"answer-checked",
|
|
340
|
+
/**
|
|
341
|
+
* A continuation reconciled the run it continues: each tool call that run asked for but never recorded (`completed`
|
|
342
|
+
* before the interruption, by the receipt store; `not-run`; or `unknown`: it ran, and its external effects are not
|
|
343
|
+
* confirmed yet), and the late answers it found.
|
|
344
|
+
*/
|
|
345
|
+
"reconciled",
|
|
346
|
+
/** An app's processor tripped its abort guard: which one, where (chunk, tool result, final answer) and why. */
|
|
347
|
+
"processor-tripped",
|
|
348
|
+
"run-finished",
|
|
349
|
+
"text-delta",
|
|
350
|
+
]),
|
|
351
|
+
data: Schema.Unknown,
|
|
352
|
+
at: Schema.String,
|
|
353
|
+
})
|
|
354
|
+
export type RunEvent = typeof RunEvent.Type
|
|
355
|
+
|
|
356
|
+
/** A reference to a file the person attached (the Files contract will resolve it; until then it is carried as given). */
|
|
357
|
+
export const Attachment = Schema.Struct({
|
|
358
|
+
kind: Schema.Literal("file"),
|
|
359
|
+
/** The Files contract's id for the file. */
|
|
360
|
+
fileId: Schema.String,
|
|
361
|
+
name: Schema.String,
|
|
362
|
+
mediaType: Schema.String,
|
|
363
|
+
})
|
|
364
|
+
export type Attachment = typeof Attachment.Type
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Where a run executes when not on the deployment's model: one of the person's paired devices (the Daemon
|
|
368
|
+
* contract), whose local harness (Claude Code or Codex) runs the turn on the person's own subscription. The run
|
|
369
|
+
* asks the device with `devices.sendTurn` (as the person's agent, so their consent applies), waits for the turn,
|
|
370
|
+
* and takes its answer, events and usage as its own.
|
|
371
|
+
*/
|
|
372
|
+
export const RunDevice = Schema.Struct({
|
|
373
|
+
deviceId: Schema.String,
|
|
374
|
+
harness: Schema.optionalKey(Schema.Literals(["claude-code", "codex", "opencode", "acp"])),
|
|
375
|
+
model: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(200))),
|
|
376
|
+
cwd: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1000))),
|
|
377
|
+
timeoutMs: Schema.optionalKey(Schema.Number.check(Schema.isGreaterThan(0))),
|
|
378
|
+
workspaceTools: Schema.optionalKey(Schema.Boolean),
|
|
379
|
+
/** Keep the harness session so a later run can follow it up (`SendTurn.resumable`). */
|
|
380
|
+
resumable: Schema.optionalKey(Schema.Boolean),
|
|
381
|
+
/** Follow up an earlier resumable turn on the device, resuming its harness session (`SendTurn.followUp`). */
|
|
382
|
+
followUp: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(100))),
|
|
383
|
+
})
|
|
384
|
+
export type RunDevice = typeof RunDevice.Type
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* The record a conversation is about (a thread on that record): its module, entity and id. A reference only, never
|
|
388
|
+
* trusted for authorisation.
|
|
389
|
+
*/
|
|
390
|
+
export const ConversationResource = Schema.Struct({
|
|
391
|
+
module: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100)),
|
|
392
|
+
entity: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100)),
|
|
393
|
+
id: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(300)),
|
|
394
|
+
})
|
|
395
|
+
export type ConversationResource = typeof ConversationResource.Type
|
|
396
|
+
|
|
397
|
+
/** One of a person's conversations with their agent, as their lists show it. */
|
|
398
|
+
export const Conversation = Schema.Struct({
|
|
399
|
+
id: Schema.String,
|
|
400
|
+
title: Schema.String,
|
|
401
|
+
pinned: Schema.Boolean,
|
|
402
|
+
archived: Schema.Boolean,
|
|
403
|
+
hidden: Schema.Boolean,
|
|
404
|
+
createdAt: Schema.String,
|
|
405
|
+
updatedAt: Schema.String,
|
|
406
|
+
/** The record it is about, for a thread on a record. */
|
|
407
|
+
resource: Schema.optionalKey(Schema.NullOr(ConversationResource)),
|
|
408
|
+
})
|
|
409
|
+
export type Conversation = typeof Conversation.Type
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Which of a person's conversations to list (`GET /agent/conversations`), newest first. `q` matches the title or
|
|
413
|
+
* any message's text; `archived` and `hidden` (default false) select those; `pinned: true` only pinned ones;
|
|
414
|
+
* `before` is the `next` cursor of the previous page. Checked before anything is read.
|
|
415
|
+
*/
|
|
416
|
+
export const ConversationQuery = Schema.Struct({
|
|
417
|
+
q: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(200))),
|
|
418
|
+
limit: Schema.optionalKey(Schema.Number.check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 100 }))),
|
|
419
|
+
before: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(500))),
|
|
420
|
+
archived: Schema.optionalKey(Schema.Boolean),
|
|
421
|
+
hidden: Schema.optionalKey(Schema.Boolean),
|
|
422
|
+
pinned: Schema.optionalKey(Schema.Boolean),
|
|
423
|
+
/** Only the threads on one record: `<module>.<entity>:<id>`. */
|
|
424
|
+
about: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(500))),
|
|
425
|
+
})
|
|
426
|
+
export type ConversationQuery = typeof ConversationQuery.Type
|
|
427
|
+
|
|
428
|
+
export const ConversationPage = Schema.Struct({
|
|
429
|
+
conversations: Schema.Array(Conversation),
|
|
430
|
+
/** The cursor for the next page (`before`), or null when this is the last. */
|
|
431
|
+
next: Schema.NullOr(Schema.String),
|
|
432
|
+
})
|
|
433
|
+
export type ConversationPage = typeof ConversationPage.Type
|
|
434
|
+
|
|
435
|
+
/** What `send` returns: the conversation (new or existing), the stored message and the run started for it. */
|
|
436
|
+
export const SentMessage = Schema.Struct({
|
|
437
|
+
conversationId: Schema.String,
|
|
438
|
+
messageId: Schema.String,
|
|
439
|
+
runId: Schema.String,
|
|
440
|
+
/**
|
|
441
|
+
* The message was queued behind the conversation's active run (`queue: true`): the queued message's id. Its message
|
|
442
|
+
* and run take `messageId` and `runId` when it starts.
|
|
443
|
+
*/
|
|
444
|
+
queued: Schema.optionalKey(Schema.Struct({ submissionId: Schema.String })),
|
|
445
|
+
})
|
|
446
|
+
export type SentMessage = typeof SentMessage.Type
|
|
447
|
+
|
|
448
|
+
// --- Context -------------------------------------------------------------------------------------------------------
|
|
449
|
+
|
|
450
|
+
export const ContextCategory = Schema.Literals([
|
|
451
|
+
"instructions",
|
|
452
|
+
"skills",
|
|
453
|
+
"memory",
|
|
454
|
+
"messages",
|
|
455
|
+
"tool-results",
|
|
456
|
+
"tools",
|
|
457
|
+
])
|
|
458
|
+
export type ContextCategory = typeof ContextCategory.Type
|
|
459
|
+
|
|
460
|
+
/** One item of what a model call was sent, with its token count and where it came from. */
|
|
461
|
+
export const ContextItem = Schema.Struct({
|
|
462
|
+
/** Stable within a conversation: `instructions:<path>`, `skill:<id>`, `memory:<id>`, `message:<id>`, `tool:<name>`. */
|
|
463
|
+
ref: Schema.String,
|
|
464
|
+
category: ContextCategory,
|
|
465
|
+
tokens: Schema.Number,
|
|
466
|
+
pinned: Schema.Boolean,
|
|
467
|
+
/** Where the item comes from: a resource scope, a memory entry, a message (or the summary that replaced messages). */
|
|
468
|
+
source: Schema.Unknown,
|
|
469
|
+
})
|
|
470
|
+
export type ContextItem = typeof ContextItem.Type
|
|
471
|
+
|
|
472
|
+
/** An item left out of a model call, and why: over its category's budget, or evicted by a directive. */
|
|
473
|
+
export const EvictedItem = Schema.Struct({
|
|
474
|
+
ref: Schema.String,
|
|
475
|
+
category: ContextCategory,
|
|
476
|
+
tokens: Schema.Number,
|
|
477
|
+
reason: Schema.Literals(["budget", "directive"]),
|
|
478
|
+
})
|
|
479
|
+
export type EvictedItem = typeof EvictedItem.Type
|
|
480
|
+
|
|
481
|
+
/** The context x-ray of one model call: every item sent, per-category totals against budgets, and what was left out. */
|
|
482
|
+
export const ContextInventory = Schema.Struct({
|
|
483
|
+
runId: Schema.String,
|
|
484
|
+
step: Schema.Number,
|
|
485
|
+
items: Schema.Array(ContextItem),
|
|
486
|
+
totals: Schema.Record(Schema.String, Schema.Number),
|
|
487
|
+
budgets: Schema.Record(Schema.String, Schema.Number),
|
|
488
|
+
total: Schema.Number,
|
|
489
|
+
evicted: Schema.Array(EvictedItem),
|
|
490
|
+
})
|
|
491
|
+
export type ContextInventory = typeof ContextInventory.Type
|
|
492
|
+
|
|
493
|
+
/** A person's directive about one context item of a conversation. */
|
|
494
|
+
export const ContextDirective = Schema.Literals(["pin", "evict", "restore"])
|
|
495
|
+
export type ContextDirective = typeof ContextDirective.Type
|
|
496
|
+
|
|
497
|
+
// --- Memory ----------------------------------------------------------------------------------------------------------
|
|
498
|
+
|
|
499
|
+
export const MemoryScope = Schema.Literals(["user", "team", "org"])
|
|
500
|
+
export type MemoryScope = typeof MemoryScope.Type
|
|
501
|
+
|
|
502
|
+
export const MemoryEntry = Schema.Struct({
|
|
503
|
+
id: Schema.String,
|
|
504
|
+
orgId: Schema.String,
|
|
505
|
+
scope: MemoryScope,
|
|
506
|
+
/** The person whose memory it is (`user` scope), or null for the organisation's and a team's. */
|
|
507
|
+
userId: Schema.NullOr(Schema.String),
|
|
508
|
+
/** The team whose memory it is (`team` scope: a Directory team, read by its members, written by its leads). */
|
|
509
|
+
team: Schema.optionalKey(Schema.String),
|
|
510
|
+
key: Schema.String,
|
|
511
|
+
content: Schema.String,
|
|
512
|
+
/** Where it came from: the run that wrote it, or the person. */
|
|
513
|
+
source: Schema.Unknown,
|
|
514
|
+
})
|
|
515
|
+
export type MemoryEntry = typeof MemoryEntry.Type
|
|
516
|
+
|
|
517
|
+
/** A compaction summary: it replaced `covers` (message ids, kept for provenance) in what later calls are sent. */
|
|
518
|
+
export const CompactionSummary = Schema.Struct({
|
|
519
|
+
id: Schema.String,
|
|
520
|
+
conversationId: Schema.String,
|
|
521
|
+
covers: Schema.Array(Schema.String),
|
|
522
|
+
content: Schema.String,
|
|
523
|
+
tokensBefore: Schema.Number,
|
|
524
|
+
tokensAfter: Schema.Number,
|
|
525
|
+
})
|
|
526
|
+
export type CompactionSummary = typeof CompactionSummary.Type
|
|
527
|
+
|
|
528
|
+
// --- Resources -----------------------------------------------------------------------------------------------------
|
|
529
|
+
|
|
530
|
+
export const ResourceScope = Schema.Literals(["personal", "team", "org", "app"])
|
|
531
|
+
export type ResourceScope = typeof ResourceScope.Type
|
|
532
|
+
|
|
533
|
+
export const ResourceKind = Schema.Literals(["instructions", "skill", "file"])
|
|
534
|
+
export type ResourceKind = typeof ResourceKind.Type
|
|
535
|
+
|
|
536
|
+
export const AgentResource = Schema.Struct({
|
|
537
|
+
scope: ResourceScope,
|
|
538
|
+
kind: ResourceKind,
|
|
539
|
+
/** Unique within (scope, kind): a skill's id, an instruction or file path. The same path in a nearer scope overrides it. */
|
|
540
|
+
path: Schema.String,
|
|
541
|
+
description: Schema.String,
|
|
542
|
+
content: Schema.String,
|
|
543
|
+
/** The stored record's id (null for app resources, which come from the registry). */
|
|
544
|
+
id: Schema.NullOr(Schema.String),
|
|
545
|
+
/** The team whose resource it is (`team` scope: read by its members, written by its leads). */
|
|
546
|
+
team: Schema.optionalKey(Schema.String),
|
|
547
|
+
})
|
|
548
|
+
export type AgentResource = typeof AgentResource.Type
|
|
549
|
+
|
|
550
|
+
// --- Metering --------------------------------------------------------------------------------------------------------
|
|
551
|
+
|
|
552
|
+
export const Meter = Schema.Literals(["agent.tokens", "agent.cost"])
|
|
553
|
+
export type Meter = typeof Meter.Type
|
|
554
|
+
|
|
555
|
+
export const BudgetPeriod = Schema.Literals(["day", "month", "total"])
|
|
556
|
+
export type BudgetPeriod = typeof BudgetPeriod.Type
|
|
557
|
+
|
|
558
|
+
export const Budget = Schema.Struct({
|
|
559
|
+
id: Schema.String,
|
|
560
|
+
orgId: Schema.String,
|
|
561
|
+
scope: Schema.Literals(["user", "org"]),
|
|
562
|
+
/** The person a `user` budget limits; null for an organisation budget (or a default for every member). */
|
|
563
|
+
userId: Schema.NullOr(Schema.String),
|
|
564
|
+
meter: Meter,
|
|
565
|
+
period: BudgetPeriod,
|
|
566
|
+
limit: Schema.Number,
|
|
567
|
+
/**
|
|
568
|
+
* A soft threshold, in percent of `limit`: once usage in the period reaches it, the budget's people are notified
|
|
569
|
+
* (category `agent.budget`), once per period; null or absent: no alert.
|
|
570
|
+
*/
|
|
571
|
+
alertAt: Schema.optionalKey(Schema.NullOr(Schema.Number)),
|
|
572
|
+
})
|
|
573
|
+
export type Budget = typeof Budget.Type
|
|
574
|
+
|
|
575
|
+
/** What usage insights group by: model (`provider:model`), UTC day, run, or member (organisation scope only). */
|
|
576
|
+
export const UsageGrouping = Schema.Literals(["model", "day", "run", "member"])
|
|
577
|
+
export type UsageGrouping = typeof UsageGrouping.Type
|
|
578
|
+
|
|
579
|
+
/** One group of usage in a period: its key, how many metered calls, their tokens and cost. */
|
|
580
|
+
export const UsageInsight = Schema.Struct({
|
|
581
|
+
key: Schema.String,
|
|
582
|
+
calls: Schema.Number,
|
|
583
|
+
inputTokens: Schema.Number,
|
|
584
|
+
outputTokens: Schema.Number,
|
|
585
|
+
costMicros: Schema.Number,
|
|
586
|
+
})
|
|
587
|
+
export type UsageInsight = typeof UsageInsight.Type
|
|
588
|
+
|
|
589
|
+
/** Usage in a period grouped by `by`, largest cost first (then tokens), at most `USAGE_INSIGHT_ROWS` groups. */
|
|
590
|
+
export const UsageInsights = Schema.Struct({
|
|
591
|
+
scope: Schema.Literals(["user", "org"]),
|
|
592
|
+
period: BudgetPeriod,
|
|
593
|
+
by: UsageGrouping,
|
|
594
|
+
rows: Schema.Array(UsageInsight),
|
|
595
|
+
})
|
|
596
|
+
export type UsageInsights = typeof UsageInsights.Type
|
|
597
|
+
|
|
598
|
+
export const USAGE_INSIGHT_ROWS = 100
|
|
599
|
+
|
|
600
|
+
/** One metered call of a run, in order: its step and kind (null for usage recorded outside a model call). */
|
|
601
|
+
export const RunUsageCall = Schema.Struct({
|
|
602
|
+
step: Schema.NullOr(Schema.Number),
|
|
603
|
+
kind: Schema.NullOr(Schema.String),
|
|
604
|
+
provider: Schema.String,
|
|
605
|
+
model: Schema.String,
|
|
606
|
+
inputTokens: Schema.Number,
|
|
607
|
+
outputTokens: Schema.Number,
|
|
608
|
+
costMicros: Schema.Number,
|
|
609
|
+
/** Recorded at what the call reserved (its answer was lost). */
|
|
610
|
+
estimated: Schema.Boolean,
|
|
611
|
+
at: Schema.String,
|
|
612
|
+
})
|
|
613
|
+
export type RunUsageCall = typeof RunUsageCall.Type
|
|
614
|
+
|
|
615
|
+
/** A run's usage drilled down to its calls, with their totals. */
|
|
616
|
+
export const RunUsage = Schema.Struct({
|
|
617
|
+
runId: Schema.String,
|
|
618
|
+
calls: Schema.Array(RunUsageCall),
|
|
619
|
+
inputTokens: Schema.Number,
|
|
620
|
+
outputTokens: Schema.Number,
|
|
621
|
+
costMicros: Schema.Number,
|
|
622
|
+
})
|
|
623
|
+
export type RunUsage = typeof RunUsage.Type
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* One span of a run's trace: a model call (`model`, named `provider:model`, with its tokens) or a tool call (`tool`,
|
|
627
|
+
* named by its tool), in step order, with when it started and finished and whether it succeeded (a tool's error tag
|
|
628
|
+
* when it did not). Never a prompt, a reply or a tool's input or output: those are the transcript's.
|
|
629
|
+
*/
|
|
630
|
+
export const TraceSpan = Schema.Struct({
|
|
631
|
+
kind: Schema.Literals(["model", "tool"]),
|
|
632
|
+
step: Schema.Number,
|
|
633
|
+
name: Schema.String,
|
|
634
|
+
startedAt: Schema.String,
|
|
635
|
+
finishedAt: Schema.NullOr(Schema.String),
|
|
636
|
+
durationMs: Schema.NullOr(Schema.Number),
|
|
637
|
+
ok: Schema.Boolean,
|
|
638
|
+
errorTag: Schema.NullOr(Schema.String),
|
|
639
|
+
inputTokens: Schema.NullOr(Schema.Number),
|
|
640
|
+
outputTokens: Schema.NullOr(Schema.Number),
|
|
641
|
+
})
|
|
642
|
+
export type TraceSpan = typeof TraceSpan.Type
|
|
643
|
+
|
|
644
|
+
/** A run's stored trace: its spans in order, its status, and the feedback its owner gave it (if any). */
|
|
645
|
+
export const RunTrace = Schema.Struct({
|
|
646
|
+
runId: Schema.String,
|
|
647
|
+
status: Schema.String,
|
|
648
|
+
spans: Schema.Array(TraceSpan),
|
|
649
|
+
feedback: Schema.NullOr(
|
|
650
|
+
Schema.Struct({ rating: Schema.Literals(["up", "down"]), comment: Schema.NullOr(Schema.String) }),
|
|
651
|
+
),
|
|
652
|
+
})
|
|
653
|
+
export type RunTrace = typeof RunTrace.Type
|
|
654
|
+
|
|
655
|
+
/** A short label a person may put on their feedback (`wrong-tool`, `too-slow`): lower case, digits and hyphens. */
|
|
656
|
+
export const FeedbackTag = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9-]{0,31}$/u))
|
|
657
|
+
|
|
658
|
+
/** A person's feedback on one of their agent's runs (action `agent.feedback`): one per person and run. */
|
|
659
|
+
export const GiveFeedback = Schema.Struct({
|
|
660
|
+
runId: Schema.String,
|
|
661
|
+
rating: Schema.Literals(["up", "down"]),
|
|
662
|
+
comment: Schema.optionalKey(Schema.NullOr(Schema.String.check(Schema.isMaxLength(2_000)))),
|
|
663
|
+
tags: Schema.optionalKey(Schema.Array(FeedbackTag).check(Schema.isMaxLength(10))),
|
|
664
|
+
})
|
|
665
|
+
export type GiveFeedback = typeof GiveFeedback.Type
|
|
666
|
+
|
|
667
|
+
export const FeedbackEntry = Schema.Struct({
|
|
668
|
+
runId: Schema.String,
|
|
669
|
+
userId: Schema.String,
|
|
670
|
+
rating: Schema.Literals(["up", "down"]),
|
|
671
|
+
comment: Schema.NullOr(Schema.String),
|
|
672
|
+
tags: Schema.Array(Schema.String),
|
|
673
|
+
at: Schema.String,
|
|
674
|
+
})
|
|
675
|
+
export type FeedbackEntry = typeof FeedbackEntry.Type
|
|
676
|
+
|
|
677
|
+
/** Feedback in a period, newest first (at most `FEEDBACK_PAGE`), with how many runs were rated up and down. */
|
|
678
|
+
export const FeedbackList = Schema.Struct({
|
|
679
|
+
scope: Schema.Literals(["user", "org"]),
|
|
680
|
+
period: BudgetPeriod,
|
|
681
|
+
up: Schema.Number,
|
|
682
|
+
down: Schema.Number,
|
|
683
|
+
entries: Schema.Array(FeedbackEntry),
|
|
684
|
+
})
|
|
685
|
+
export type FeedbackList = typeof FeedbackList.Type
|
|
686
|
+
|
|
687
|
+
export const FEEDBACK_PAGE = 200
|
|
688
|
+
|
|
689
|
+
export const UsageRecord = Schema.Struct({
|
|
690
|
+
orgId: Schema.String,
|
|
691
|
+
userId: Schema.String,
|
|
692
|
+
runId: Schema.NullOr(Schema.String),
|
|
693
|
+
provider: Schema.String,
|
|
694
|
+
model: Schema.String,
|
|
695
|
+
inputTokens: Schema.Number,
|
|
696
|
+
outputTokens: Schema.Number,
|
|
697
|
+
costMicros: Schema.Number,
|
|
698
|
+
})
|
|
699
|
+
export type UsageRecord = typeof UsageRecord.Type
|
|
700
|
+
|
|
701
|
+
// --- Evals ----------------------------------------------------------------------------------------------------------
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* An eval case a module's skill declares (`skills.<id>.evals`, a JSON file of these): a prompt, the tool calls a
|
|
705
|
+
* good run makes, and assertions on the state it leaves.
|
|
706
|
+
*/
|
|
707
|
+
export const EvalCase = Schema.Struct({
|
|
708
|
+
name: Schema.String,
|
|
709
|
+
prompt: Schema.String,
|
|
710
|
+
/** Tool calls the run must make, in order (other calls may come between): the tool, and a subset of its input. */
|
|
711
|
+
expect: Schema.Struct({
|
|
712
|
+
toolCalls: Schema.Array(Schema.Struct({ tool: Schema.String, input: Schema.optionalKey(Schema.Unknown) })),
|
|
713
|
+
/** Tools the run must not call. */
|
|
714
|
+
forbiddenTools: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
715
|
+
/**
|
|
716
|
+
* Words or phrases the final answer must contain, case-insensitive and whole: not inside a longer word ("not"
|
|
717
|
+
* is not found in "noted").
|
|
718
|
+
*/
|
|
719
|
+
answerIncludes: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
720
|
+
/** Patterns (JavaScript regular expressions, case-insensitive, Unicode) the final answer must match. */
|
|
721
|
+
answerMatches: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
722
|
+
/** Patterns (as `answerMatches`) the final answer must not match. */
|
|
723
|
+
answerExcludes: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
724
|
+
}),
|
|
725
|
+
/**
|
|
726
|
+
* Assertions on state afterwards: a published query view read as the person, and a row it must (`contains`)
|
|
727
|
+
* or must not (`absent`) hold, matching every field given. A value `"$result:<tool>:<path>"` stands for a
|
|
728
|
+
* field of the run's first result of that tool (`output.output.id` is the id an action returned).
|
|
729
|
+
*/
|
|
730
|
+
state: Schema.optionalKey(
|
|
731
|
+
Schema.Array(
|
|
732
|
+
Schema.Struct({
|
|
733
|
+
view: Schema.String,
|
|
734
|
+
contains: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
|
|
735
|
+
absent: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
|
|
736
|
+
}),
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
/**
|
|
740
|
+
* The model turns the scripted provider plays for this case (CI): each turn is text, or tool calls. A real model
|
|
741
|
+
* ignores them.
|
|
742
|
+
*/
|
|
743
|
+
script: Schema.Array(
|
|
744
|
+
Schema.Union([
|
|
745
|
+
Schema.Struct({ text: Schema.String }),
|
|
746
|
+
Schema.Struct({ toolCalls: Schema.Array(Schema.Struct({ tool: Schema.String, input: Schema.Unknown })) }),
|
|
747
|
+
]),
|
|
748
|
+
),
|
|
749
|
+
})
|
|
750
|
+
export type EvalCase = typeof EvalCase.Type
|
|
751
|
+
|
|
752
|
+
/** A skill's eval file: its cases and the score it must reach (0 to 1, the share of cases that pass). */
|
|
753
|
+
export const SkillEvals = Schema.Struct({
|
|
754
|
+
skill: Schema.String,
|
|
755
|
+
threshold: Schema.Number,
|
|
756
|
+
cases: Schema.Array(EvalCase),
|
|
757
|
+
})
|
|
758
|
+
export type SkillEvals = typeof SkillEvals.Type
|