@raybase/core 0.0.2 → 0.3.4
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/dist/.admin-build/AdminApp.css +2 -0
- package/dist/.admin-build/AdminApp.js +77 -0
- package/dist/.admin-docs-build/AdminDocsApp.css +2 -0
- package/dist/.admin-docs-build/AdminDocsApp.js +45 -0
- package/dist/actions.d.ts +347 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +661 -0
- package/dist/actions.js.map +1 -0
- package/dist/admin-assets/admin.7738f50720a8ed7b.css +2 -0
- package/dist/admin-assets/admin.8678cb61db34dc81.js +77 -0
- package/dist/admin-boot.d.ts +94 -0
- package/dist/admin-boot.d.ts.map +1 -0
- package/dist/admin-boot.js +139 -0
- package/dist/admin-boot.js.map +1 -0
- package/dist/admin-docs-content.d.ts +95 -0
- package/dist/admin-docs-content.d.ts.map +1 -0
- package/dist/admin-docs-content.js +463 -0
- package/dist/admin-docs-content.js.map +1 -0
- package/dist/admin-docs-ui.d.ts +11 -0
- package/dist/admin-docs-ui.d.ts.map +1 -0
- package/dist/admin-docs-ui.js +23 -0
- package/dist/admin-docs-ui.js.map +1 -0
- package/dist/admin-kit.d.ts +29 -0
- package/dist/admin-kit.js +1557 -0
- package/dist/admin-role.d.ts +8 -0
- package/dist/admin-role.d.ts.map +1 -0
- package/dist/admin-role.js +22 -0
- package/dist/admin-role.js.map +1 -0
- package/dist/admin-ui.d.ts +3 -0
- package/dist/admin-ui.d.ts.map +1 -0
- package/dist/admin-ui.js +16 -0
- package/dist/admin-ui.js.map +1 -0
- package/dist/agent-ai-chat.d.ts +127 -0
- package/dist/agent-ai-chat.d.ts.map +1 -0
- package/dist/agent-ai-chat.js +5975 -0
- package/dist/agent-ai-chat.js.map +1 -0
- package/dist/agent-chapter-archive.d.ts +214 -0
- package/dist/agent-chapter-archive.d.ts.map +1 -0
- package/dist/agent-chapter-archive.js +696 -0
- package/dist/agent-chapter-archive.js.map +1 -0
- package/dist/agent-chapter-search.d.ts +116 -0
- package/dist/agent-chapter-search.d.ts.map +1 -0
- package/dist/agent-chapter-search.js +605 -0
- package/dist/agent-chapter-search.js.map +1 -0
- package/dist/agent-chapter-tools.d.ts +45 -0
- package/dist/agent-chapter-tools.d.ts.map +1 -0
- package/dist/agent-chapter-tools.js +344 -0
- package/dist/agent-chapter-tools.js.map +1 -0
- package/dist/agent-chapters.d.ts +228 -0
- package/dist/agent-chapters.d.ts.map +1 -0
- package/dist/agent-chapters.js +737 -0
- package/dist/agent-chapters.js.map +1 -0
- package/dist/agent-data-parts.d.ts +167 -0
- package/dist/agent-data-parts.d.ts.map +1 -0
- package/dist/agent-data-parts.js +68 -0
- package/dist/agent-data-parts.js.map +1 -0
- package/dist/agent-errors.d.ts +41 -0
- package/dist/agent-errors.d.ts.map +1 -0
- package/dist/agent-errors.js +191 -0
- package/dist/agent-errors.js.map +1 -0
- package/dist/agent-follow-up-store.d.ts +273 -0
- package/dist/agent-follow-up-store.d.ts.map +1 -0
- package/dist/agent-follow-up-store.js +703 -0
- package/dist/agent-follow-up-store.js.map +1 -0
- package/dist/agent-follow-ups.d.ts +314 -0
- package/dist/agent-follow-ups.d.ts.map +1 -0
- package/dist/agent-follow-ups.js +840 -0
- package/dist/agent-follow-ups.js.map +1 -0
- package/dist/agent-memory.d.ts +323 -0
- package/dist/agent-memory.d.ts.map +1 -0
- package/dist/agent-memory.js +1270 -0
- package/dist/agent-memory.js.map +1 -0
- package/dist/agent-message-parts.d.ts +58 -0
- package/dist/agent-message-parts.d.ts.map +1 -0
- package/dist/agent-message-parts.js +163 -0
- package/dist/agent-message-parts.js.map +1 -0
- package/dist/agent-remote-mcp-credentials.d.ts +154 -0
- package/dist/agent-remote-mcp-credentials.d.ts.map +1 -0
- package/dist/agent-remote-mcp-credentials.js +287 -0
- package/dist/agent-remote-mcp-credentials.js.map +1 -0
- package/dist/agent-remote-mcp-crypto.d.ts +32 -0
- package/dist/agent-remote-mcp-crypto.d.ts.map +1 -0
- package/dist/agent-remote-mcp-crypto.js +101 -0
- package/dist/agent-remote-mcp-crypto.js.map +1 -0
- package/dist/agent-remote-mcp-install.d.ts +299 -0
- package/dist/agent-remote-mcp-install.d.ts.map +1 -0
- package/dist/agent-remote-mcp-install.js +785 -0
- package/dist/agent-remote-mcp-install.js.map +1 -0
- package/dist/agent-remote-mcp-oauth.d.ts +73 -0
- package/dist/agent-remote-mcp-oauth.d.ts.map +1 -0
- package/dist/agent-remote-mcp-oauth.js +344 -0
- package/dist/agent-remote-mcp-oauth.js.map +1 -0
- package/dist/agent-remote-mcp-transport.d.ts +46 -0
- package/dist/agent-remote-mcp-transport.d.ts.map +1 -0
- package/dist/agent-remote-mcp-transport.js +225 -0
- package/dist/agent-remote-mcp-transport.js.map +1 -0
- package/dist/agent-remote-mcp.d.ts +147 -0
- package/dist/agent-remote-mcp.d.ts.map +1 -0
- package/dist/agent-remote-mcp.js +681 -0
- package/dist/agent-remote-mcp.js.map +1 -0
- package/dist/agent-room-redaction.d.ts +66 -0
- package/dist/agent-room-redaction.d.ts.map +1 -0
- package/dist/agent-room-redaction.js +264 -0
- package/dist/agent-room-redaction.js.map +1 -0
- package/dist/agent-rooms.d.ts +209 -0
- package/dist/agent-rooms.d.ts.map +1 -0
- package/dist/agent-rooms.js +244 -0
- package/dist/agent-rooms.js.map +1 -0
- package/dist/agent-runtime.d.ts +541 -0
- package/dist/agent-runtime.d.ts.map +1 -0
- package/dist/agent-runtime.js +4260 -0
- package/dist/agent-runtime.js.map +1 -0
- package/dist/agent-skill-archive.d.ts +20 -0
- package/dist/agent-skill-archive.d.ts.map +1 -0
- package/dist/agent-skill-archive.js +316 -0
- package/dist/agent-skill-archive.js.map +1 -0
- package/dist/agent-skill-discovery.d.ts +96 -0
- package/dist/agent-skill-discovery.d.ts.map +1 -0
- package/dist/agent-skill-discovery.js +464 -0
- package/dist/agent-skill-discovery.js.map +1 -0
- package/dist/agent-skill-format.d.ts +57 -0
- package/dist/agent-skill-format.d.ts.map +1 -0
- package/dist/agent-skill-format.js +238 -0
- package/dist/agent-skill-format.js.map +1 -0
- package/dist/agent-skill-import.d.ts +64 -0
- package/dist/agent-skill-import.d.ts.map +1 -0
- package/dist/agent-skill-import.js +295 -0
- package/dist/agent-skill-import.js.map +1 -0
- package/dist/agent-skill-publish.d.ts +51 -0
- package/dist/agent-skill-publish.d.ts.map +1 -0
- package/dist/agent-skill-publish.js +136 -0
- package/dist/agent-skill-publish.js.map +1 -0
- package/dist/agent-skill-store.d.ts +252 -0
- package/dist/agent-skill-store.d.ts.map +1 -0
- package/dist/agent-skill-store.js +514 -0
- package/dist/agent-skill-store.js.map +1 -0
- package/dist/agent-skills.d.ts +85 -0
- package/dist/agent-skills.d.ts.map +1 -0
- package/dist/agent-skills.js +291 -0
- package/dist/agent-skills.js.map +1 -0
- package/dist/agent-transcript-pager.d.ts +77 -0
- package/dist/agent-transcript-pager.d.ts.map +1 -0
- package/dist/agent-transcript-pager.js +210 -0
- package/dist/agent-transcript-pager.js.map +1 -0
- package/dist/agent-user-data-parts.d.ts +20 -0
- package/dist/agent-user-data-parts.d.ts.map +1 -0
- package/dist/agent-user-data-parts.js +161 -0
- package/dist/agent-user-data-parts.js.map +1 -0
- package/dist/agent-user-transcript.d.ts +46 -0
- package/dist/agent-user-transcript.d.ts.map +1 -0
- package/dist/agent-user-transcript.js +106 -0
- package/dist/agent-user-transcript.js.map +1 -0
- package/dist/agent-voice-notes.d.ts +15 -0
- package/dist/agent-voice-notes.d.ts.map +1 -0
- package/dist/agent-voice-notes.js +17 -0
- package/dist/agent-voice-notes.js.map +1 -0
- package/dist/agent-wakes.d.ts +213 -0
- package/dist/agent-wakes.d.ts.map +1 -0
- package/dist/agent-wakes.js +534 -0
- package/dist/agent-wakes.js.map +1 -0
- package/dist/agent.d.ts +1780 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +3123 -0
- package/dist/agent.js.map +1 -0
- package/dist/ai.d.ts +583 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +1858 -0
- package/dist/ai.js.map +1 -0
- package/dist/app-manifest.d.ts +255 -0
- package/dist/app-manifest.d.ts.map +1 -0
- package/dist/app-manifest.js +372 -0
- package/dist/app-manifest.js.map +1 -0
- package/dist/app-users.d.ts +30 -0
- package/dist/app-users.d.ts.map +1 -0
- package/dist/app-users.js +91 -0
- package/dist/app-users.js.map +1 -0
- package/dist/audit-archive.d.ts +85 -0
- package/dist/audit-archive.d.ts.map +1 -0
- package/dist/audit-archive.js +178 -0
- package/dist/audit-archive.js.map +1 -0
- package/dist/audit.d.ts +54 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +95 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth-logger.d.ts +28 -0
- package/dist/auth-logger.d.ts.map +1 -0
- package/dist/auth-logger.js +53 -0
- package/dist/auth-logger.js.map +1 -0
- package/dist/auth-password-secret.d.ts +59 -0
- package/dist/auth-password-secret.d.ts.map +1 -0
- package/dist/auth-password-secret.js +409 -0
- package/dist/auth-password-secret.js.map +1 -0
- package/dist/auth-schema.d.ts +120 -0
- package/dist/auth-schema.d.ts.map +1 -0
- package/dist/auth-schema.js +285 -0
- package/dist/auth-schema.js.map +1 -0
- package/dist/auth.d.ts +321 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +1562 -0
- package/dist/auth.js.map +1 -0
- package/dist/backup-archive.d.ts +257 -0
- package/dist/backup-archive.d.ts.map +1 -0
- package/dist/backup-archive.js +2068 -0
- package/dist/backup-archive.js.map +1 -0
- package/dist/backup-crypto.d.ts +313 -0
- package/dist/backup-crypto.d.ts.map +1 -0
- package/dist/backup-crypto.js +693 -0
- package/dist/backup-crypto.js.map +1 -0
- package/dist/backup-format.d.ts +200 -0
- package/dist/backup-format.d.ts.map +1 -0
- package/dist/backup-format.js +1247 -0
- package/dist/backup-format.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/clock.d.ts +35 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +83 -0
- package/dist/clock.js.map +1 -0
- package/dist/data-client.d.ts +187 -0
- package/dist/data-client.d.ts.map +1 -0
- package/dist/data-client.js +590 -0
- package/dist/data-client.js.map +1 -0
- package/dist/data-secrets.d.ts +164 -0
- package/dist/data-secrets.d.ts.map +1 -0
- package/dist/data-secrets.js +383 -0
- package/dist/data-secrets.js.map +1 -0
- package/dist/db.d.ts +453 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +324 -0
- package/dist/db.js.map +1 -0
- package/dist/dev-activity.d.ts +48 -0
- package/dist/dev-activity.d.ts.map +1 -0
- package/dist/dev-activity.js +50 -0
- package/dist/dev-activity.js.map +1 -0
- package/dist/do.d.ts +429 -0
- package/dist/do.d.ts.map +1 -0
- package/dist/do.js +4526 -0
- package/dist/do.js.map +1 -0
- package/dist/email.d.ts +137 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +527 -0
- package/dist/email.js.map +1 -0
- package/dist/generated/admin-assets.d.ts +16 -0
- package/dist/generated/admin-assets.d.ts.map +1 -0
- package/dist/generated/admin-assets.js +16 -0
- package/dist/generated/admin-assets.js.map +1 -0
- package/dist/generated/admin-docs-assets.d.ts +3 -0
- package/dist/generated/admin-docs-assets.d.ts.map +1 -0
- package/dist/generated/admin-docs-assets.js +3 -0
- package/dist/generated/admin-docs-assets.js.map +1 -0
- package/dist/handoff-consumer.d.ts +79 -0
- package/dist/handoff-consumer.d.ts.map +1 -0
- package/dist/handoff-consumer.js +300 -0
- package/dist/handoff-consumer.js.map +1 -0
- package/dist/handoff.d.ts +70 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +228 -0
- package/dist/handoff.js.map +1 -0
- package/dist/host-auth.d.ts +47 -0
- package/dist/host-auth.d.ts.map +1 -0
- package/dist/host-auth.js +59 -0
- package/dist/host-auth.js.map +1 -0
- package/dist/host-user.d.ts +15 -0
- package/dist/host-user.d.ts.map +1 -0
- package/dist/host-user.js +23 -0
- package/dist/host-user.js.map +1 -0
- package/dist/html.d.ts +35 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +634 -0
- package/dist/html.js.map +1 -0
- package/dist/http-error.d.ts +13 -0
- package/dist/http-error.d.ts.map +1 -0
- package/dist/http-error.js +15 -0
- package/dist/http-error.js.map +1 -0
- package/dist/imports.d.ts +219 -0
- package/dist/imports.d.ts.map +1 -0
- package/dist/imports.js +571 -0
- package/dist/imports.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/inference-tape.d.ts +64 -0
- package/dist/inference-tape.d.ts.map +1 -0
- package/dist/inference-tape.js +278 -0
- package/dist/inference-tape.js.map +1 -0
- package/dist/internal.d.ts +15 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +48 -0
- package/dist/internal.js.map +1 -0
- package/dist/jobs.d.ts +796 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +538 -0
- package/dist/jobs.js.map +1 -0
- package/dist/json-schema.d.ts +91 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +884 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/knowledge.d.ts +33 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +348 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/local-dev-chrome.d.ts +29 -0
- package/dist/local-dev-chrome.d.ts.map +1 -0
- package/dist/local-dev-chrome.js +514 -0
- package/dist/local-dev-chrome.js.map +1 -0
- package/dist/local-dev-personas.d.ts +15 -0
- package/dist/local-dev-personas.d.ts.map +1 -0
- package/dist/local-dev-personas.js +46 -0
- package/dist/local-dev-personas.js.map +1 -0
- package/dist/mcp.d.ts +567 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +2480 -0
- package/dist/mcp.js.map +1 -0
- package/dist/modules.d.ts +145 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +164 -0
- package/dist/modules.js.map +1 -0
- package/dist/notification-client.d.ts +94 -0
- package/dist/notification-client.d.ts.map +1 -0
- package/dist/notification-client.js +127 -0
- package/dist/notification-client.js.map +1 -0
- package/dist/notifications.d.ts +447 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +1625 -0
- package/dist/notifications.js.map +1 -0
- package/dist/operator-data-query.d.ts +117 -0
- package/dist/operator-data-query.d.ts.map +1 -0
- package/dist/operator-data-query.js +431 -0
- package/dist/operator-data-query.js.map +1 -0
- package/dist/operator-mcp.d.ts +63 -0
- package/dist/operator-mcp.d.ts.map +1 -0
- package/dist/operator-mcp.js +2828 -0
- package/dist/operator-mcp.js.map +1 -0
- package/dist/outbound-https.d.ts +24 -0
- package/dist/outbound-https.d.ts.map +1 -0
- package/dist/outbound-https.js +172 -0
- package/dist/outbound-https.js.map +1 -0
- package/dist/pitr.d.ts +60 -0
- package/dist/pitr.d.ts.map +1 -0
- package/dist/pitr.js +94 -0
- package/dist/pitr.js.map +1 -0
- package/dist/platform.d.ts +199 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +196 -0
- package/dist/platform.js.map +1 -0
- package/dist/policies.d.ts +115 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +158 -0
- package/dist/policies.js.map +1 -0
- package/dist/principal.d.ts +143 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/principal.js +174 -0
- package/dist/principal.js.map +1 -0
- package/dist/realtime.d.ts +280 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +578 -0
- package/dist/realtime.js.map +1 -0
- package/dist/retrieval.d.ts +263 -0
- package/dist/retrieval.d.ts.map +1 -0
- package/dist/retrieval.js +602 -0
- package/dist/retrieval.js.map +1 -0
- package/dist/runtime-error-client.d.ts +10 -0
- package/dist/runtime-error-client.d.ts.map +1 -0
- package/dist/runtime-error-client.js +70 -0
- package/dist/runtime-error-client.js.map +1 -0
- package/dist/runtime-errors.d.ts +180 -0
- package/dist/runtime-errors.d.ts.map +1 -0
- package/dist/runtime-errors.js +572 -0
- package/dist/runtime-errors.js.map +1 -0
- package/dist/schema.d.ts +434 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +232 -0
- package/dist/schema.js.map +1 -0
- package/dist/search.d.ts +216 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +785 -0
- package/dist/search.js.map +1 -0
- package/dist/settings.d.ts +191 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +478 -0
- package/dist/settings.js.map +1 -0
- package/dist/sql.d.ts +7 -0
- package/dist/sql.d.ts.map +1 -0
- package/dist/sql.js +30 -0
- package/dist/sql.js.map +1 -0
- package/dist/storage-client.d.ts +69 -0
- package/dist/storage-client.d.ts.map +1 -0
- package/dist/storage-client.js +469 -0
- package/dist/storage-client.js.map +1 -0
- package/dist/storage.d.ts +21 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +82 -0
- package/dist/storage.js.map +1 -0
- package/dist/subject-domains.d.ts +15 -0
- package/dist/subject-domains.d.ts.map +1 -0
- package/dist/subject-domains.js +38 -0
- package/dist/subject-domains.js.map +1 -0
- package/dist/support.d.ts +132 -0
- package/dist/support.d.ts.map +1 -0
- package/dist/support.js +483 -0
- package/dist/support.js.map +1 -0
- package/dist/system-tables.d.ts +12 -0
- package/dist/system-tables.d.ts.map +1 -0
- package/dist/system-tables.js +225 -0
- package/dist/system-tables.js.map +1 -0
- package/dist/test.d.ts +57 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +454 -0
- package/dist/test.js.map +1 -0
- package/dist/vite.d.ts +82 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +82 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpush-crypto.d.ts +39 -0
- package/dist/webpush-crypto.d.ts.map +1 -0
- package/dist/webpush-crypto.js +213 -0
- package/dist/webpush-crypto.js.map +1 -0
- package/dist/webpush-private.d.ts +11 -0
- package/dist/webpush-private.d.ts.map +1 -0
- package/dist/webpush-private.js +11 -0
- package/dist/webpush-private.js.map +1 -0
- package/dist/webpush.d.ts +86 -0
- package/dist/webpush.d.ts.map +1 -0
- package/dist/webpush.js +375 -0
- package/dist/webpush.js.map +1 -0
- package/dist/worker.d.ts +185 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +13021 -0
- package/dist/worker.js.map +1 -0
- package/package.json +161 -8
- package/README.md +0 -3
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,1780 @@
|
|
|
1
|
+
import { type Tool } from "ai";
|
|
2
|
+
import { type RaybaseAction, type RaybaseActionContext, type RaybaseAgentActionRegistration } from "./actions.js";
|
|
3
|
+
import type { RaybaseAuditContextEvent } from "./audit.js";
|
|
4
|
+
import { type RaybaseAgentSkillRegistration, type RaybaseAgentSkillSummary } from "./agent-skills.js";
|
|
5
|
+
import { type RaybaseAgentRemoteMcpBinding, type RaybaseAgentRemoteMcpBindingSummary, type RaybaseRemoteMcpServer } from "./agent-remote-mcp.js";
|
|
6
|
+
import { type RaybaseAgentMemoryConfig, type RaybaseAgentMemoryServerRuntime, type RaybaseAgentMemorySpaceSummary } from "./agent-memory.js";
|
|
7
|
+
import { type RaybaseAgentSkillStoreConfig } from "./agent-skill-store.js";
|
|
8
|
+
import { type RaybaseAgentWakeOptions, type RaybaseAgentWakeResult, type RaybaseAgentWakesConfig } from "./agent-wakes.js";
|
|
9
|
+
import { type RaybaseAgentFollowUpsConfig, type RaybaseAgentFollowUpsRuntime } from "./agent-follow-ups.js";
|
|
10
|
+
import type { RaybaseAgentMessageAttachment } from "./agent-message-parts.js";
|
|
11
|
+
import { type RaybaseAgentRoomEligibility, type RaybaseAgentRoomEligibilityMessage, type RaybaseAgentRoomMemberRow, type RaybaseAgentRoomMemberSummary, type RaybaseAgentRoomsConfig } from "./agent-rooms.js";
|
|
12
|
+
import { type AgentChapterSynopsis, type RaybaseAgentRetentionConfig } from "./agent-chapters.js";
|
|
13
|
+
import { type NormalizedRaybaseAgentConversationVoiceNotesConfig, type RaybaseAgentConversationVoiceNotesConfig } from "./agent-voice-notes.js";
|
|
14
|
+
import { type RaybaseAgentUserDataPartsConfig } from "./agent-user-data-parts.js";
|
|
15
|
+
export { isAgentUserDataPartType, isReservedAgentDataPartType, maxAgentUserDataBytesPerMessage, maxAgentUserDataPartBytes, maxAgentUserDataPartsPerMessage, type RaybaseAgentUserDataPartDefinition, type RaybaseAgentUserDataPartsConfig } from "./agent-user-data-parts.js";
|
|
16
|
+
import { type RaybaseStorageConfig } from "./storage.js";
|
|
17
|
+
import { type RaybaseAI, type RaybaseAgentCommitAI, type RaybaseAIModelParams, type RaybaseAIProviderParams, type RaybaseChatResponseFormat, type RaybaseAgentPrincipal } from "./ai.js";
|
|
18
|
+
import type { RaybaseActionDataClient, RaybaseDataClient } from "./data-client.js";
|
|
19
|
+
import type { DoMigration, SqlExecutor } from "./db.js";
|
|
20
|
+
import type { RaybaseAgentDataPart } from "./agent-data-parts.js";
|
|
21
|
+
import { type JsonSchemaObject } from "./json-schema.js";
|
|
22
|
+
import type { RaybaseNotificationsRuntime } from "./notifications.js";
|
|
23
|
+
import type { RaybaseUser } from "./policies.js";
|
|
24
|
+
import { type RaybaseJobsRuntime } from "./jobs.js";
|
|
25
|
+
import { type RaybaseConfig, type RaybaseSchema, type RaybaseSystemTable } from "./schema.js";
|
|
26
|
+
import { type RaybaseRuntimeSettings, type RaybaseSettingsDefinitions } from "./settings.js";
|
|
27
|
+
import { type SqlValue } from "./sql.js";
|
|
28
|
+
export type { RaybaseAgentRoomAuthor, RaybaseAgentRoomAuthorKind, RaybaseAgentRoomCommitHookContext, RaybaseAgentRoomMembershipHookContext, RaybaseAgentRoomMemberRow, RaybaseAgentRoomMemberSummary, RaybaseAgentRoomsConfig } from "./agent-rooms.js";
|
|
29
|
+
export type RaybaseAgentRuntime = "ai-chat";
|
|
30
|
+
export type RaybaseAgentTrigger = {
|
|
31
|
+
type: "chat";
|
|
32
|
+
} | {
|
|
33
|
+
type: "schedule";
|
|
34
|
+
cron: string;
|
|
35
|
+
timezone?: string;
|
|
36
|
+
input?: unknown;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
userMessage?: string;
|
|
39
|
+
/** Core-owned marker synthesized from memory.maintenance. */
|
|
40
|
+
maintenance?: string;
|
|
41
|
+
} | {
|
|
42
|
+
type: "data";
|
|
43
|
+
event: `${string}.create` | `${string}.update` | `${string}.delete`;
|
|
44
|
+
includeAdmin?: boolean;
|
|
45
|
+
input?: unknown;
|
|
46
|
+
};
|
|
47
|
+
export type RaybaseAgentTriggerType = RaybaseAgentTrigger["type"];
|
|
48
|
+
export type RaybaseAgentExecutionTriggerType = RaybaseAgentTriggerType | "direct" | "wake" | "follow-up" | "composed";
|
|
49
|
+
export type RaybaseAgentAudienceKind = "signed-in" | "public";
|
|
50
|
+
export type RaybaseAgentAudience = RaybaseAgentAudienceKind | RaybaseAgentAudienceKind[] | Record<string, RaybaseAgentAudienceKind | RaybaseAgentAudienceKind[] | undefined>;
|
|
51
|
+
export type RaybaseAgentEntrySource = "inline" | "notification";
|
|
52
|
+
export type RaybaseAgentEntryDefinition = {
|
|
53
|
+
description: string;
|
|
54
|
+
payloadSchema?: JsonSchemaObject;
|
|
55
|
+
source?: RaybaseAgentEntrySource;
|
|
56
|
+
userMessage?: string;
|
|
57
|
+
audience?: RaybaseAgentAudienceKind[];
|
|
58
|
+
};
|
|
59
|
+
export type RaybaseAgentEntryNotificationSnapshot = {
|
|
60
|
+
id: string;
|
|
61
|
+
kind: string | null;
|
|
62
|
+
title: string;
|
|
63
|
+
body: string | null;
|
|
64
|
+
metadata: unknown;
|
|
65
|
+
target?: {
|
|
66
|
+
href?: string;
|
|
67
|
+
entity?: {
|
|
68
|
+
type: string;
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
createdAt: string;
|
|
73
|
+
};
|
|
74
|
+
export type RaybaseAgentEntrySnapshot = {
|
|
75
|
+
kind: string;
|
|
76
|
+
source: RaybaseAgentEntrySource;
|
|
77
|
+
payload?: unknown;
|
|
78
|
+
notification?: RaybaseAgentEntryNotificationSnapshot;
|
|
79
|
+
};
|
|
80
|
+
export type RaybaseAgentLimits = {
|
|
81
|
+
maxInputChars?: number;
|
|
82
|
+
maxOutputTokens?: number;
|
|
83
|
+
maxToolCallsPerTurn?: number;
|
|
84
|
+
maxLoopStepsPerTurn?: number;
|
|
85
|
+
maxConversationMessages?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Input characters the turn pre-flight holds back for the tool loop to
|
|
88
|
+
* spend. Unset means derived: maxToolCallsPerTurn multiplied by the largest
|
|
89
|
+
* result cap among the tools actually offered on the turn, clamped to a
|
|
90
|
+
* share of the room the assembly's floor leaves. Set it only to override a
|
|
91
|
+
* derivation that does not match a specific app's tools.
|
|
92
|
+
*/
|
|
93
|
+
loopReserveChars?: number;
|
|
94
|
+
/** Receive-only conversation subscriptions. Clamped to the platform cap of 64. Default 16. */
|
|
95
|
+
maxConversationSockets?: number;
|
|
96
|
+
publicIpHourlyRequests?: number;
|
|
97
|
+
publicIpHourlyOutputTokens?: number;
|
|
98
|
+
publicDailyRequests?: number;
|
|
99
|
+
publicDailyOutputTokens?: number;
|
|
100
|
+
signedInDailyRequests?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Model-composed turns per conversation and rolling day. Unset means
|
|
103
|
+
* unlimited: the runtime already runs one turn at a time per conversation
|
|
104
|
+
* and bounds loop steps per turn, so a daily quota is a slow, invisible
|
|
105
|
+
* guard rather than a loop stop. Set it only when an app wants the cap.
|
|
106
|
+
*/
|
|
107
|
+
composedPerDay?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Agent entry kickoff turns per signed-in user and rolling day. Unset means
|
|
110
|
+
* unlimited, on the same reasoning as composedPerDay.
|
|
111
|
+
*/
|
|
112
|
+
entryKickoffPerDay?: number;
|
|
113
|
+
};
|
|
114
|
+
export type RaybaseAgentCompaction = {
|
|
115
|
+
/** Compact old history into a persisted synopsis when the assembled prompt nears maxInputChars. Default true. */
|
|
116
|
+
enabled?: boolean;
|
|
117
|
+
/** Model for the synopsis summarization call. Defaults to the agent's resolved model. */
|
|
118
|
+
model?: string;
|
|
119
|
+
/** Newest conversation messages kept verbatim when compacting. Default 8. */
|
|
120
|
+
keepRecentMessages?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Fraction of the compactable budget at which compaction triggers.
|
|
123
|
+
* Default 0.7.
|
|
124
|
+
*
|
|
125
|
+
* The denominator is `maxInputChars` minus the assembly's floor — the system
|
|
126
|
+
* prompt, synopsis, sentinels, and tool schemas that compaction cannot
|
|
127
|
+
* reach — so the ratio means "the history has used this share of the room
|
|
128
|
+
* the history has". Measured against the whole cap, an agent whose floor
|
|
129
|
+
* already exceeds the ratio would trip the trigger on every turn and never
|
|
130
|
+
* get back under it.
|
|
131
|
+
*/
|
|
132
|
+
triggerRatio?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Floor of the summary output-token budget. Default 800 — the old flat
|
|
135
|
+
* budget, so no span ever gets a smaller summary than it did before the
|
|
136
|
+
* budget became proportional.
|
|
137
|
+
*/
|
|
138
|
+
minSummaryOutputTokens?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Fraction of the closed span's estimated tokens (chars/4) granted to the
|
|
141
|
+
* summary. Default 0.12. The budget for one summarization call is
|
|
142
|
+
* clamp(minSummaryOutputTokens, round(summarySpanRatio × spanTokens),
|
|
143
|
+
* maxSummaryOutputTokens) — see `agentSummaryBudgetTokens`.
|
|
144
|
+
*/
|
|
145
|
+
summarySpanRatio?: number;
|
|
146
|
+
/**
|
|
147
|
+
* Ceiling of the summary output-token budget. Default 4,000. A ceiling is
|
|
148
|
+
* still wanted: summaries ride every later prompt and are re-summarized at
|
|
149
|
+
* subsequent closes, so unbounded growth compounds. Pinning this alone pins
|
|
150
|
+
* the whole budget whenever it sits at or below the floor — the clamp
|
|
151
|
+
* collapses onto the pin, which is exactly the pre-proportional behavior.
|
|
152
|
+
*/
|
|
153
|
+
maxSummaryOutputTokens?: number;
|
|
154
|
+
};
|
|
155
|
+
export type RaybaseAgentHookFailure = "fail-turn" | "continue-empty";
|
|
156
|
+
export type RaybaseAgentRetrievalReader = {
|
|
157
|
+
search(indexName: string, query: string, options?: {
|
|
158
|
+
topK?: number;
|
|
159
|
+
minScore?: number;
|
|
160
|
+
}): Promise<unknown[]>;
|
|
161
|
+
};
|
|
162
|
+
export declare const defaultAgentCompaction: Required<Omit<RaybaseAgentCompaction, "model">>;
|
|
163
|
+
export type RaybaseAgentPromptContext<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
164
|
+
request: Request;
|
|
165
|
+
env: Env;
|
|
166
|
+
config: RaybaseConfig;
|
|
167
|
+
schema: Schema;
|
|
168
|
+
appMigrations?: DoMigration[];
|
|
169
|
+
agent: RaybaseAgent<Env, Schema>;
|
|
170
|
+
principal: RaybaseAgentPrincipal;
|
|
171
|
+
user?: RaybaseUser;
|
|
172
|
+
organizationId?: string | null;
|
|
173
|
+
route: string;
|
|
174
|
+
surface: string;
|
|
175
|
+
conversationId: string;
|
|
176
|
+
trigger?: {
|
|
177
|
+
type: RaybaseAgentExecutionTriggerType;
|
|
178
|
+
event?: string;
|
|
179
|
+
input?: unknown;
|
|
180
|
+
data?: Record<string, unknown>;
|
|
181
|
+
userMessage?: string | null;
|
|
182
|
+
entry?: RaybaseAgentEntrySnapshot;
|
|
183
|
+
};
|
|
184
|
+
/** Present only for a declared memory-maintenance run. */
|
|
185
|
+
maintenance?: {
|
|
186
|
+
run: string;
|
|
187
|
+
};
|
|
188
|
+
chapters?: {
|
|
189
|
+
lastClosed: {
|
|
190
|
+
id: string;
|
|
191
|
+
ordinal: number;
|
|
192
|
+
endedAt: string;
|
|
193
|
+
} | null;
|
|
194
|
+
currentOrdinal: number;
|
|
195
|
+
};
|
|
196
|
+
userMessage?: string;
|
|
197
|
+
/**
|
|
198
|
+
* The agent run that owns this turn, and the same value agent-lane actions
|
|
199
|
+
* read as `ctx.runId`. Stable across delivery-gate retries and replacements
|
|
200
|
+
* within one turn, and fresh for every run. `null` only where the
|
|
201
|
+
* invocation has no durable run row, which today means the admin prompt
|
|
202
|
+
* preview.
|
|
203
|
+
*
|
|
204
|
+
* Server-side context: it is never rendered into the model-visible prompt
|
|
205
|
+
* and the model is never asked to echo it. Apps that need idempotent
|
|
206
|
+
* per-turn side effects build keys as `turn:<runId>:<ordinal>`.
|
|
207
|
+
*/
|
|
208
|
+
runId: string | null;
|
|
209
|
+
/** Immutable app-defined state loaded once for this turn before prompt assembly. */
|
|
210
|
+
turnState: Readonly<Record<string, unknown>>;
|
|
211
|
+
/** System-attributed inference lane for assembly-time app judgment. */
|
|
212
|
+
ai: RaybaseAI;
|
|
213
|
+
};
|
|
214
|
+
export type RaybaseAgentTurnStateLoadContext<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Omit<RaybaseAgentPromptContext<Env, Schema>, "turnState"> & {
|
|
215
|
+
/**
|
|
216
|
+
* Structured facts for the arriving member message's attachments, in part
|
|
217
|
+
* order and identical to what the eligibility hook is handed for the same
|
|
218
|
+
* message. Present exactly when a member message arrives: a composed or
|
|
219
|
+
* wake turn carries the app's instruction in `userMessage` and no member
|
|
220
|
+
* parts to describe, so it carries neither this nor `userMessageBodyText`.
|
|
221
|
+
*/
|
|
222
|
+
userMessageAttachments?: RaybaseAgentMessageAttachment[];
|
|
223
|
+
/**
|
|
224
|
+
* What the member actually wrote — the text parts alone, matching the
|
|
225
|
+
* eligibility message's `bodyText`. `userMessage` keeps the flattened
|
|
226
|
+
* form with Core's `[image …]` stand-in, so a loader that wants the words
|
|
227
|
+
* need not parse the stand-in back out of it.
|
|
228
|
+
*/
|
|
229
|
+
userMessageBodyText?: string;
|
|
230
|
+
data: RaybaseDataClient<Schema>;
|
|
231
|
+
/** Present only when turnState.servicePrincipals declares at least one name. */
|
|
232
|
+
dataAsService?(name: string): RaybaseDataClient<Schema>;
|
|
233
|
+
settings?: RaybaseRuntimeSettings<Env, RaybaseSettingsDefinitions<Env>>;
|
|
234
|
+
retrieval: RaybaseAgentRetrievalReader;
|
|
235
|
+
/** Bounded terminal-run summaries for this invocation's conversation only. */
|
|
236
|
+
runs: RaybaseAgentRunHistoryReader;
|
|
237
|
+
/**
|
|
238
|
+
* Live attributed tail for the conversation Core bound to this turn.
|
|
239
|
+
* Absent for invocations that have no live conversation transcript.
|
|
240
|
+
*/
|
|
241
|
+
transcript?: RaybaseAgentActiveTranscriptReader;
|
|
242
|
+
/**
|
|
243
|
+
* Direct turns only. Room turns deliberately do not receive this handle,
|
|
244
|
+
* so private history cannot flow into a shared room transcript.
|
|
245
|
+
*/
|
|
246
|
+
conversations?: {
|
|
247
|
+
read(conversationId: string, options?: {
|
|
248
|
+
limit?: number;
|
|
249
|
+
before?: string;
|
|
250
|
+
}): Promise<RaybaseAgentAttributedTranscriptSlice>;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export type RaybaseAgentDescribeContext<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Omit<RaybaseAgentPromptContext<Env, Schema>, "agent"> & {
|
|
254
|
+
agent: Pick<RaybaseAgent<Env, Schema>, "name" | "title" | "description" | "runtime">;
|
|
255
|
+
data: RaybaseDataClient<Schema>;
|
|
256
|
+
settings?: RaybaseRuntimeSettings<Env, RaybaseSettingsDefinitions<Env>>;
|
|
257
|
+
};
|
|
258
|
+
type RaybaseAgentDescribeContextHook<Env, Schema extends RaybaseSchema> = {
|
|
259
|
+
bivarianceHack(ctx: RaybaseAgentDescribeContext<Env, Schema>): unknown | Promise<unknown>;
|
|
260
|
+
}["bivarianceHack"];
|
|
261
|
+
export type RaybaseAgentTurnState<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
262
|
+
load(ctx: RaybaseAgentTurnStateLoadContext<Env, Schema>): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
263
|
+
/** Core aborts cooperative work at this deadline. Default 10 seconds. */
|
|
264
|
+
timeoutMs?: number;
|
|
265
|
+
/** Default fail-turn. */
|
|
266
|
+
onFailure?: RaybaseAgentHookFailure;
|
|
267
|
+
/**
|
|
268
|
+
* Exact named table-policy principals the loader may opt into through
|
|
269
|
+
* dataAsService(name). Undeclared names fail closed.
|
|
270
|
+
*/
|
|
271
|
+
servicePrincipals?: string[];
|
|
272
|
+
};
|
|
273
|
+
export type RaybaseAgentPromptBandEpoch = "chapter" | "turn";
|
|
274
|
+
/** Default cap for custom prompt bands. The built-in head has no default cap. */
|
|
275
|
+
export declare const defaultAgentPromptBandMaxChars = 16000;
|
|
276
|
+
export type RaybaseAgentPromptHead = {
|
|
277
|
+
/** Controls when the built-in prompt head content is recomputed. Default chapter. */
|
|
278
|
+
epoch: RaybaseAgentPromptBandEpoch;
|
|
279
|
+
/**
|
|
280
|
+
* Opt-in cap on the built-in prompt head. Undeclared leaves the head
|
|
281
|
+
* uncapped at the band level; the whole assembled turn is still bounded by
|
|
282
|
+
* `ai.defaults.maxInputChars`.
|
|
283
|
+
*/
|
|
284
|
+
maxChars?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Overflow behavior once `maxChars` is declared. Default error: opting into
|
|
287
|
+
* a cap opts into a loud failure, never a silent trim.
|
|
288
|
+
*/
|
|
289
|
+
onOverflow?: "truncate" | "error";
|
|
290
|
+
};
|
|
291
|
+
export type RaybaseAgentPromptBand<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
292
|
+
name: string;
|
|
293
|
+
render(ctx: RaybaseAgentPromptContext<Env, Schema>): string | null | undefined | Promise<string | null | undefined>;
|
|
294
|
+
when?(ctx: RaybaseAgentPromptContext<Env, Schema>): boolean | Promise<boolean>;
|
|
295
|
+
/** Content is frozen for the current chapter unless explicitly made per-turn. Default chapter. */
|
|
296
|
+
epoch?: RaybaseAgentPromptBandEpoch;
|
|
297
|
+
/** Default 16,000 characters. */
|
|
298
|
+
maxChars?: number;
|
|
299
|
+
/** Default truncate. */
|
|
300
|
+
onOverflow?: "truncate" | "error";
|
|
301
|
+
};
|
|
302
|
+
export type RaybaseAgentSentinel<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
303
|
+
name: string;
|
|
304
|
+
render(ctx: RaybaseAgentPromptContext<Env, Schema>): string | null | undefined | Promise<string | null | undefined>;
|
|
305
|
+
when?(ctx: RaybaseAgentPromptContext<Env, Schema>): boolean | Promise<boolean>;
|
|
306
|
+
maxChars?: number;
|
|
307
|
+
onOverflow?: "truncate" | "error";
|
|
308
|
+
/** App instructions are authoritative steering; data remains untrusted context. Default data. */
|
|
309
|
+
trust?: "app" | "data";
|
|
310
|
+
};
|
|
311
|
+
export type RaybaseAgentDeliveryMode = "stream" | "buffered";
|
|
312
|
+
export declare const defaultAgentDeliveryMaxReplacementChars = 32000;
|
|
313
|
+
export declare const maxAgentDeliveryReplacementChars = 128000;
|
|
314
|
+
export type RaybaseAgentGateVerdict = {
|
|
315
|
+
verdict: "deliver";
|
|
316
|
+
} | {
|
|
317
|
+
verdict: "retry";
|
|
318
|
+
note: string;
|
|
319
|
+
} | {
|
|
320
|
+
verdict: "replace";
|
|
321
|
+
text: string;
|
|
322
|
+
} | {
|
|
323
|
+
verdict: "drop";
|
|
324
|
+
silence?: string;
|
|
325
|
+
};
|
|
326
|
+
export type RaybaseAgentComposedTurnOrigin = {
|
|
327
|
+
type: "action" | "job" | "wake" | "follow-up" | "reaction";
|
|
328
|
+
id: string;
|
|
329
|
+
};
|
|
330
|
+
export type RaybaseAgentComposedRequest = {
|
|
331
|
+
requestKey: string;
|
|
332
|
+
origin: RaybaseAgentComposedTurnOrigin;
|
|
333
|
+
};
|
|
334
|
+
export type RaybaseAgentGateContext<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = RaybaseAgentPromptContext<Env, Schema> & {
|
|
335
|
+
/**
|
|
336
|
+
* Live attributed tail for the conversation Core bound to this turn.
|
|
337
|
+
* Absent for invocations that have no live conversation transcript.
|
|
338
|
+
*/
|
|
339
|
+
transcript?: RaybaseAgentActiveTranscriptReader;
|
|
340
|
+
attempt: number;
|
|
341
|
+
maxRetries: number;
|
|
342
|
+
/** Messages persisted after the immutable draft snapshot was captured. */
|
|
343
|
+
transcriptGrewBy: number;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* A reply the app has taught its model to give when it has nothing to say.
|
|
347
|
+
*
|
|
348
|
+
* A buffered gate can read a whole draft and turn such a reply into a labeled
|
|
349
|
+
* silence; a streaming turn has no gate, so without this the word itself
|
|
350
|
+
* would stream to every subscriber and persist as the reply. With it, Core
|
|
351
|
+
* holds back the leading characters of a streamed turn while they can still
|
|
352
|
+
* be the sentinel, releases them the moment they diverge, and — when the
|
|
353
|
+
* whole reply is exactly the sentinel — commits no message and reports the
|
|
354
|
+
* silence as `sentinel:<silence>`. A buffered turn is not affected: its gate
|
|
355
|
+
* still sees the draft as the model wrote it.
|
|
356
|
+
*/
|
|
357
|
+
export type RaybaseAgentSilenceSentinel = {
|
|
358
|
+
/** The exact reply text, compared after trimming. Trimmed, 1–64 characters. */
|
|
359
|
+
text: string;
|
|
360
|
+
/** The silence label, reported as `sentinel:<silence>`; trimmed, 1–64 characters. */
|
|
361
|
+
silence: string;
|
|
362
|
+
};
|
|
363
|
+
export type RaybaseAgentDelivery<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
364
|
+
mode?(ctx: RaybaseAgentPromptContext<Env, Schema>): RaybaseAgentDeliveryMode | Promise<RaybaseAgentDeliveryMode>;
|
|
365
|
+
/** Gates assistant text only; drafting-attempt tool effects are already committed. */
|
|
366
|
+
gate?(draft: string, ctx: RaybaseAgentGateContext<Env, Schema>): RaybaseAgentGateVerdict | Promise<RaybaseAgentGateVerdict>;
|
|
367
|
+
/** Streamed turns only: a reply that is exactly this text is a labeled silence, and its characters never stream. */
|
|
368
|
+
silenceSentinel?: RaybaseAgentSilenceSentinel;
|
|
369
|
+
maxRetries?: number;
|
|
370
|
+
/** Maximum accepted replacement text. Default 32,000; hard maximum 128,000 characters. */
|
|
371
|
+
maxReplacementChars?: number;
|
|
372
|
+
fallback?: "deliver" | "drop";
|
|
373
|
+
timeoutMs?: number;
|
|
374
|
+
onFailure?: RaybaseAgentHookFailure;
|
|
375
|
+
};
|
|
376
|
+
export type RaybaseAgentChapterClose = {
|
|
377
|
+
/** Overrides the stock chapter-close system prompt. */
|
|
378
|
+
prompt?: string;
|
|
379
|
+
};
|
|
380
|
+
export type RaybaseAgentRuntimeControl = {
|
|
381
|
+
configurable?: boolean;
|
|
382
|
+
defaultEnabled?: boolean;
|
|
383
|
+
};
|
|
384
|
+
export type RaybaseAgentPromptVariable = {
|
|
385
|
+
path: string;
|
|
386
|
+
description: string;
|
|
387
|
+
example?: unknown;
|
|
388
|
+
source?: "raybase" | "trigger" | "agent";
|
|
389
|
+
};
|
|
390
|
+
export type RaybaseAgentPrompt<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
391
|
+
default: string;
|
|
392
|
+
configurable?: boolean;
|
|
393
|
+
renderer?: "liquid";
|
|
394
|
+
variables?: RaybaseAgentPromptVariable[];
|
|
395
|
+
context?: (ctx: RaybaseAgentPromptContext<Env, Schema>) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
396
|
+
};
|
|
397
|
+
export type RaybaseAgentConversationTitles = "auto" | {
|
|
398
|
+
model?: string;
|
|
399
|
+
};
|
|
400
|
+
export type RaybaseAgentConversationCommitHookContext<Env = unknown> = {
|
|
401
|
+
env: Env;
|
|
402
|
+
ai: RaybaseAgentCommitAI;
|
|
403
|
+
agents: RaybaseAgentInvocationRuntime;
|
|
404
|
+
jobs: RaybaseJobsRuntime;
|
|
405
|
+
notifications: RaybaseNotificationsRuntime<Env>;
|
|
406
|
+
audit(event: RaybaseAuditContextEvent): Promise<void>;
|
|
407
|
+
/**
|
|
408
|
+
* The run that committed these messages — the same id this turn's prompt,
|
|
409
|
+
* skill, eligibility, delivery, and action contexts saw.
|
|
410
|
+
*/
|
|
411
|
+
runId: string;
|
|
412
|
+
conversation: {
|
|
413
|
+
agentName: string;
|
|
414
|
+
conversationId: string;
|
|
415
|
+
kind: "room" | null;
|
|
416
|
+
requestKey: string | null;
|
|
417
|
+
composedOrigin: RaybaseAgentComposedTurnOrigin | null;
|
|
418
|
+
composedRequests: RaybaseAgentComposedRequest[];
|
|
419
|
+
messageId: string;
|
|
420
|
+
/**
|
|
421
|
+
* Every message this run committed, `messageId` first. Enough, with
|
|
422
|
+
* `runId`, to attach run-scoped state to committed messages without
|
|
423
|
+
* scanning recent rows.
|
|
424
|
+
*/
|
|
425
|
+
messageIds: string[];
|
|
426
|
+
text: string;
|
|
427
|
+
triggeredByUserId: string | null;
|
|
428
|
+
connectedUserIds: string[];
|
|
429
|
+
memberUserIds: string[];
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
export type RaybaseAgentConversationSilenceHookContext<Env = unknown> = {
|
|
433
|
+
env: Env;
|
|
434
|
+
agents: RaybaseAgentInvocationRuntime;
|
|
435
|
+
jobs: RaybaseJobsRuntime;
|
|
436
|
+
notifications: RaybaseNotificationsRuntime<Env>;
|
|
437
|
+
audit(event: RaybaseAuditContextEvent): Promise<void>;
|
|
438
|
+
runId: string;
|
|
439
|
+
silenceKind: string;
|
|
440
|
+
conversation: {
|
|
441
|
+
agentName: string;
|
|
442
|
+
conversationId: string;
|
|
443
|
+
kind: "room" | null;
|
|
444
|
+
requestKey: string | null;
|
|
445
|
+
composedOrigin: RaybaseAgentComposedTurnOrigin | null;
|
|
446
|
+
composedRequests: RaybaseAgentComposedRequest[];
|
|
447
|
+
triggeredByUserId: string | null;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
export type RaybaseAgentConversationReadHookContext<Env = unknown> = {
|
|
451
|
+
env: Env;
|
|
452
|
+
agents: RaybaseAgentInvocationRuntime;
|
|
453
|
+
notifications: RaybaseNotificationsRuntime<Env>;
|
|
454
|
+
audit(event: RaybaseAuditContextEvent): Promise<void>;
|
|
455
|
+
conversation: {
|
|
456
|
+
agentName: string;
|
|
457
|
+
conversationId: string;
|
|
458
|
+
userId: string;
|
|
459
|
+
lastReadAt: string;
|
|
460
|
+
newlySeenMessageIds: string[];
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* The app's server-side wire into sequenced conversation message mutations.
|
|
465
|
+
* Edit and removal are the only variants that expose prior content; reaction
|
|
466
|
+
* mutations lose no message content and instead carry their post-mutation map.
|
|
467
|
+
*/
|
|
468
|
+
export type RaybaseAgentConversationMessageMutation = {
|
|
469
|
+
type: "message.updated" | "message.removed";
|
|
470
|
+
messageId: string;
|
|
471
|
+
at: string;
|
|
472
|
+
previous: Record<string, unknown>;
|
|
473
|
+
message: Record<string, unknown>;
|
|
474
|
+
} | {
|
|
475
|
+
type: "message.reaction";
|
|
476
|
+
messageId: string;
|
|
477
|
+
at: string;
|
|
478
|
+
/** The signed-in user id, or `agent:<name>` for the built-in reaction tool. */
|
|
479
|
+
userId: string;
|
|
480
|
+
/** `null` means that the actor cleared their reaction. */
|
|
481
|
+
emoji: string | null;
|
|
482
|
+
/** Post-mutation reaction map, keyed by user or agent reaction identity. */
|
|
483
|
+
reactions: Record<string, string>;
|
|
484
|
+
message: Record<string, unknown>;
|
|
485
|
+
};
|
|
486
|
+
type RaybaseAgentConversationMessageMutationHookContextBase<Env> = {
|
|
487
|
+
env: Env;
|
|
488
|
+
notifications: RaybaseNotificationsRuntime<Env>;
|
|
489
|
+
audit(event: RaybaseAuditContextEvent): Promise<void>;
|
|
490
|
+
conversation: {
|
|
491
|
+
agentName: string;
|
|
492
|
+
conversationId: string;
|
|
493
|
+
kind: "room" | null;
|
|
494
|
+
actorUserId: string | null;
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* Runs inline on the mutation request and is bounded. Reaction hooks receive
|
|
499
|
+
* an invocation runtime because they always have a user or service actor;
|
|
500
|
+
* edit and removal hooks remain capture-only and runtime-free.
|
|
501
|
+
*/
|
|
502
|
+
export type RaybaseAgentConversationMessageMutationHookContext<Env = unknown> = (RaybaseAgentConversationMessageMutationHookContextBase<Env> & {
|
|
503
|
+
agents: RaybaseAgentInvocationRuntime;
|
|
504
|
+
mutation: Extract<RaybaseAgentConversationMessageMutation, {
|
|
505
|
+
type: "message.reaction";
|
|
506
|
+
}>;
|
|
507
|
+
}) | (RaybaseAgentConversationMessageMutationHookContextBase<Env> & {
|
|
508
|
+
agents?: never;
|
|
509
|
+
mutation: Extract<RaybaseAgentConversationMessageMutation, {
|
|
510
|
+
type: "message.updated" | "message.removed";
|
|
511
|
+
}>;
|
|
512
|
+
});
|
|
513
|
+
/**
|
|
514
|
+
* A user, app, or agent utterance suitable for app turn assembly. Raybase
|
|
515
|
+
* framework turn-error notices remain in the user-visible conversation but
|
|
516
|
+
* are omitted from this attributed projection.
|
|
517
|
+
*/
|
|
518
|
+
export type RaybaseAgentAttributedTranscriptMessage = {
|
|
519
|
+
id: string;
|
|
520
|
+
createdAt: string;
|
|
521
|
+
role: "user" | "assistant";
|
|
522
|
+
author: {
|
|
523
|
+
kind: "user" | "agent" | "app";
|
|
524
|
+
userId: string | null;
|
|
525
|
+
name: string | null;
|
|
526
|
+
};
|
|
527
|
+
text: string;
|
|
528
|
+
/**
|
|
529
|
+
* Attachment identity for this utterance; empty when it carried none.
|
|
530
|
+
* `text` still reads the attachment as its stand-in, so a reader that only
|
|
531
|
+
* puts the line in a prompt is unaffected.
|
|
532
|
+
*/
|
|
533
|
+
attachments: RaybaseAgentMessageAttachment[];
|
|
534
|
+
};
|
|
535
|
+
/** A cursor-paginated slice of eligible attributed conversation utterances. */
|
|
536
|
+
export type RaybaseAgentAttributedTranscriptSlice = {
|
|
537
|
+
conversationId: string;
|
|
538
|
+
messages: RaybaseAgentAttributedTranscriptMessage[];
|
|
539
|
+
nextBefore: string | null;
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* Reads the attributed transcript for the conversation Core bound to the
|
|
543
|
+
* current invocation. The active conversation is intentionally not caller
|
|
544
|
+
* selectable.
|
|
545
|
+
*/
|
|
546
|
+
export type RaybaseAgentActiveTranscriptReader = {
|
|
547
|
+
read(options?: {
|
|
548
|
+
limit?: number;
|
|
549
|
+
before?: string;
|
|
550
|
+
}): Promise<RaybaseAgentAttributedTranscriptSlice>;
|
|
551
|
+
};
|
|
552
|
+
export type RaybaseAgentConversationReadState = {
|
|
553
|
+
conversationId: string;
|
|
554
|
+
members: Array<{
|
|
555
|
+
userId: string;
|
|
556
|
+
lastReadAt: string | null;
|
|
557
|
+
}>;
|
|
558
|
+
messages: Array<{
|
|
559
|
+
messageId: string;
|
|
560
|
+
seen: Record<string, string>;
|
|
561
|
+
}>;
|
|
562
|
+
};
|
|
563
|
+
export type RaybaseAgentConversationMessagesConfig = {
|
|
564
|
+
edit?: {
|
|
565
|
+
windowMs: number;
|
|
566
|
+
};
|
|
567
|
+
remove?: {
|
|
568
|
+
windowMs: number;
|
|
569
|
+
};
|
|
570
|
+
reactions?: {
|
|
571
|
+
enabled: true;
|
|
572
|
+
agentTool?: boolean;
|
|
573
|
+
};
|
|
574
|
+
attachments?: RaybaseAgentConversationAttachmentsConfig;
|
|
575
|
+
voiceNotes?: RaybaseAgentConversationVoiceNotesConfig;
|
|
576
|
+
userDataParts?: RaybaseAgentUserDataPartsConfig;
|
|
577
|
+
};
|
|
578
|
+
export type RaybaseAgentConversationAttachmentsConfig = {
|
|
579
|
+
enabled: true;
|
|
580
|
+
bucket: string;
|
|
581
|
+
maxPerMessage?: number;
|
|
582
|
+
maxBytesPerFile?: number;
|
|
583
|
+
mediaTypes?: string[];
|
|
584
|
+
resolveForModel?: {
|
|
585
|
+
recentMessages?: number;
|
|
586
|
+
};
|
|
587
|
+
};
|
|
588
|
+
export type NormalizedRaybaseAgentConversationAttachmentsConfig = {
|
|
589
|
+
enabled: true;
|
|
590
|
+
bucket: string;
|
|
591
|
+
maxPerMessage: number;
|
|
592
|
+
maxBytesPerFile: number;
|
|
593
|
+
mediaTypes: string[];
|
|
594
|
+
resolveForModel: {
|
|
595
|
+
recentMessages: number;
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
export declare const defaultAgentAttachmentMediaTypes: readonly ["image/jpeg", "image/png", "image/webp", "image/gif"];
|
|
599
|
+
export declare const defaultAgentAttachmentMaxPerMessage = 4;
|
|
600
|
+
export declare const defaultAgentAttachmentMaxBytesPerFile: number;
|
|
601
|
+
export declare const defaultAgentAttachmentRecentMessages = 8;
|
|
602
|
+
export type RaybaseAgentConversationsConfig<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
603
|
+
eligibility?(ctx: RaybaseAgentPromptContext<Env, Schema>, message: RaybaseAgentRoomEligibilityMessage): RaybaseAgentRoomEligibility | Promise<RaybaseAgentRoomEligibility>;
|
|
604
|
+
eligibilityTimeoutMs?: number;
|
|
605
|
+
/** Defaults to continue-empty, which degrades a failed hook to respond. */
|
|
606
|
+
onEligibilityFailure?: RaybaseAgentHookFailure;
|
|
607
|
+
onCommit?(ctx: RaybaseAgentConversationCommitHookContext<Env>): void | Promise<void>;
|
|
608
|
+
onSilence?(ctx: RaybaseAgentConversationSilenceHookContext<Env>): void | Promise<void>;
|
|
609
|
+
onRead?(ctx: RaybaseAgentConversationReadHookContext<Env>): void | Promise<void>;
|
|
610
|
+
/**
|
|
611
|
+
* Server-side seam for message edits, removals, and reactions. Fires once
|
|
612
|
+
* per sequenced mutation. Prior edit/removal content is delivered only here;
|
|
613
|
+
* reactions additionally receive `ctx.agents` but never start a turn alone.
|
|
614
|
+
*/
|
|
615
|
+
onMessageMutation?(ctx: RaybaseAgentConversationMessageMutationHookContext<Env>): void | Promise<void>;
|
|
616
|
+
messages?: RaybaseAgentConversationMessagesConfig;
|
|
617
|
+
};
|
|
618
|
+
export type RaybaseAgentComposeConfig = {
|
|
619
|
+
/**
|
|
620
|
+
* Whether a composed turn's `context` is rendered for the model as a
|
|
621
|
+
* `composed-context` data sentinel. Defaults to true: the context is
|
|
622
|
+
* otherwise only merged into turn state, where nothing shows it to the
|
|
623
|
+
* model. Set false when the agent renders those facts itself.
|
|
624
|
+
*/
|
|
625
|
+
renderContext?: boolean;
|
|
626
|
+
};
|
|
627
|
+
export type RaybaseAgent<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
628
|
+
name: string;
|
|
629
|
+
title?: string;
|
|
630
|
+
description?: string;
|
|
631
|
+
runtime: RaybaseAgentRuntime;
|
|
632
|
+
triggers: RaybaseAgentTrigger[];
|
|
633
|
+
audience?: RaybaseAgentAudience;
|
|
634
|
+
/**
|
|
635
|
+
* Capability labels this agent carries into every action it invokes,
|
|
636
|
+
* surfaced as `ctx.principal.scopes` on the agent principal. Raybase does
|
|
637
|
+
* not interpret them; an action checks them with `agentPrincipalHasScope`
|
|
638
|
+
* to refuse or allow agent-driven calls by name.
|
|
639
|
+
*/
|
|
640
|
+
scopes?: string[];
|
|
641
|
+
model?: string;
|
|
642
|
+
modelParams?: RaybaseAIModelParams;
|
|
643
|
+
responseFormat?: RaybaseChatResponseFormat;
|
|
644
|
+
providerParams?: RaybaseAIProviderParams;
|
|
645
|
+
system?: string | ((ctx: RaybaseAgentPromptContext<Env, Schema>) => string | Promise<string>);
|
|
646
|
+
prompt?: RaybaseAgentPrompt<Env, Schema>;
|
|
647
|
+
turnState?: RaybaseAgentTurnState<Env, Schema>;
|
|
648
|
+
/** Loads app-defined data once when building the model-facing action toolset. */
|
|
649
|
+
describeContext?: RaybaseAgentDescribeContextHook<Env, Schema>;
|
|
650
|
+
promptHead?: RaybaseAgentPromptHead;
|
|
651
|
+
promptBands?: RaybaseAgentPromptBand<Env, Schema>[];
|
|
652
|
+
sentinels?: RaybaseAgentSentinel<Env, Schema>[];
|
|
653
|
+
/**
|
|
654
|
+
* Whether Core renders its `time` sentinel as the final block of the
|
|
655
|
+
* ephemeral system message — one clock line in the principal's zone, or one
|
|
656
|
+
* per member in room turns. Defaults to true. Set false when the agent
|
|
657
|
+
* renders its own clock, so the prompt does not carry two.
|
|
658
|
+
*/
|
|
659
|
+
timeSentinel?: boolean;
|
|
660
|
+
compose?: RaybaseAgentComposeConfig;
|
|
661
|
+
delivery?: RaybaseAgentDelivery<Env, Schema>;
|
|
662
|
+
conversations?: RaybaseAgentConversationsConfig<Env, Schema>;
|
|
663
|
+
conversationTitles?: RaybaseAgentConversationTitles;
|
|
664
|
+
runtimeControl?: RaybaseAgentRuntimeControl;
|
|
665
|
+
/**
|
|
666
|
+
* Direct actions registered on this agent. Each entry is a bare action, or
|
|
667
|
+
* a binding with `offerWhen` and/or `disclosure`. `offerWhen` gates the
|
|
668
|
+
* model-facing tool per turn; `disclosure` chooses its full schema or a
|
|
669
|
+
* callable stub that fetches the full schema before execution. Function
|
|
670
|
+
* forms are synchronous and deterministic — they read the same per-turn
|
|
671
|
+
* context prompt band `when` predicates receive and must not do I/O.
|
|
672
|
+
* Presentation never affects registration, other surfaces, permission
|
|
673
|
+
* checks, admin listings, or tool-name uniqueness.
|
|
674
|
+
*/
|
|
675
|
+
actions?: RaybaseAgentActionRegistration<Env, Schema>[];
|
|
676
|
+
skills?: RaybaseAgentSkillRegistration<Env, Schema>[];
|
|
677
|
+
skillStore?: RaybaseAgentSkillStoreConfig<Env, Schema>;
|
|
678
|
+
remoteMcpServers?: Array<RaybaseRemoteMcpServer | RaybaseAgentRemoteMcpBinding>;
|
|
679
|
+
memory?: RaybaseAgentMemoryConfig;
|
|
680
|
+
wakes?: RaybaseAgentWakesConfig;
|
|
681
|
+
followUps?: RaybaseAgentFollowUpsConfig<Env, Schema>;
|
|
682
|
+
rooms?: RaybaseAgentRoomsConfig<Env, Schema>;
|
|
683
|
+
entries?: Record<string, RaybaseAgentEntryDefinition>;
|
|
684
|
+
limits?: RaybaseAgentLimits;
|
|
685
|
+
compaction?: RaybaseAgentCompaction;
|
|
686
|
+
chapterClose?: RaybaseAgentChapterClose;
|
|
687
|
+
retention?: RaybaseAgentRetentionConfig;
|
|
688
|
+
owner?: {
|
|
689
|
+
moduleId?: string;
|
|
690
|
+
packageName?: string;
|
|
691
|
+
};
|
|
692
|
+
};
|
|
693
|
+
export type RaybaseAgentDefinition<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Omit<RaybaseAgent<Env, Schema>, "triggers"> & {
|
|
694
|
+
triggers?: RaybaseAgentTrigger[];
|
|
695
|
+
};
|
|
696
|
+
export type RaybaseAgentCollectionDefinition<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Omit<RaybaseAgent<Env, Schema>, "name" | "triggers"> & {
|
|
697
|
+
name?: string;
|
|
698
|
+
triggers?: RaybaseAgentTrigger[];
|
|
699
|
+
};
|
|
700
|
+
export type RaybaseAgents<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Record<string, RaybaseAgent<Env, Schema>>;
|
|
701
|
+
export type RaybaseAgentDefinitions<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = Record<string, RaybaseAgent<Env, Schema> | RaybaseAgentCollectionDefinition<Env, Schema>>;
|
|
702
|
+
export type RaybaseAgentRuntimeHarness = {
|
|
703
|
+
runtime: "ai-chat";
|
|
704
|
+
durableObjectBinding: "RAYBASE_AI_CHAT_AGENT";
|
|
705
|
+
triggerType: RaybaseAgentTriggerType;
|
|
706
|
+
instanceStrategy: "conversation";
|
|
707
|
+
};
|
|
708
|
+
export declare const raybaseAiChatHarness: RaybaseAgentRuntimeHarness;
|
|
709
|
+
export declare const raybaseAgentInternalReadPath = "/__raybase_agent_read";
|
|
710
|
+
export declare const raybaseAgentInternalUserReadPath = "/__raybase_agent_user_read";
|
|
711
|
+
export declare const raybaseAgentInternalCleanupPath = "/__raybase_agent_cleanup";
|
|
712
|
+
export declare const raybaseAgentInternalUserPurgePath = "/__raybase_agent_user_purge";
|
|
713
|
+
export declare const raybaseAgentInternalRehydratePath = "/__raybase_agent_rehydrate";
|
|
714
|
+
export declare const raybaseAgentInternalRoomNoticePath = "/__raybase_agent_room_notice";
|
|
715
|
+
export declare const raybaseAgentInternalRoomActivityPath = "/__raybase_agent_room_activity";
|
|
716
|
+
export declare const raybaseAgentInternalRoomMembershipPath = "/__raybase_agent_room_membership";
|
|
717
|
+
export declare const raybaseAgentInternalRoomRedactPath = "/__raybase_agent_room_redact";
|
|
718
|
+
export declare const raybaseAgentSystemTables: RaybaseSystemTable[];
|
|
719
|
+
export type RaybaseAgentInstanceStatus = "active" | "cleanupRequested" | "deleting" | "cleanupError" | "deleted" | "archived";
|
|
720
|
+
export type RaybaseAgentRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed" | "skipped";
|
|
721
|
+
export type RaybaseAgentInstanceRow = {
|
|
722
|
+
id: string;
|
|
723
|
+
conversationId: string;
|
|
724
|
+
agentName: string;
|
|
725
|
+
agentTitle: string;
|
|
726
|
+
agentOwner: string | null;
|
|
727
|
+
moduleId: string | null;
|
|
728
|
+
runtime: RaybaseAgentRuntime;
|
|
729
|
+
triggerType: RaybaseAgentTriggerType;
|
|
730
|
+
instanceKey: string;
|
|
731
|
+
principalKind: "user" | "public";
|
|
732
|
+
userId: string | null;
|
|
733
|
+
publicScopeHash: string | null;
|
|
734
|
+
organizationId: string | null;
|
|
735
|
+
route: string | null;
|
|
736
|
+
surface: string;
|
|
737
|
+
status: RaybaseAgentInstanceStatus;
|
|
738
|
+
cleanupRequestedAt: string | null;
|
|
739
|
+
hotStorageDeletedAt: string | null;
|
|
740
|
+
deletedAt: string | null;
|
|
741
|
+
retentionReason: string | null;
|
|
742
|
+
pinnedAt: string | null;
|
|
743
|
+
createdAt: string;
|
|
744
|
+
updatedAt: string;
|
|
745
|
+
lastActiveAt: string;
|
|
746
|
+
expiresAt: string | null;
|
|
747
|
+
lastRunId: string | null;
|
|
748
|
+
lastError: string | null;
|
|
749
|
+
metadataJson: string | null;
|
|
750
|
+
entryKind: string | null;
|
|
751
|
+
entryJson: string | null;
|
|
752
|
+
kind?: "room" | null;
|
|
753
|
+
roomMembershipRev?: number | null;
|
|
754
|
+
lastReadAt?: string | null;
|
|
755
|
+
};
|
|
756
|
+
export type RaybaseAgentConversationSummary = {
|
|
757
|
+
agentName: string;
|
|
758
|
+
conversationId: string;
|
|
759
|
+
runtime: RaybaseAgentRuntime;
|
|
760
|
+
triggerType: "chat";
|
|
761
|
+
title: string | null;
|
|
762
|
+
agentTitle: string;
|
|
763
|
+
route: string | null;
|
|
764
|
+
surface: string;
|
|
765
|
+
status: RaybaseAgentInstanceStatus;
|
|
766
|
+
createdAt: string;
|
|
767
|
+
updatedAt: string;
|
|
768
|
+
lastActiveAt: string;
|
|
769
|
+
expiresAt: string | null;
|
|
770
|
+
pinnedAt: string | null;
|
|
771
|
+
archived: boolean;
|
|
772
|
+
lastRunId: string | null;
|
|
773
|
+
lastRunStatus: RaybaseAgentRunStatus | null;
|
|
774
|
+
entryKind: string | null;
|
|
775
|
+
kind: "room" | null;
|
|
776
|
+
lastReadAt: string | null;
|
|
777
|
+
};
|
|
778
|
+
export type RaybaseAgentRunRow = {
|
|
779
|
+
runId: string;
|
|
780
|
+
conversationId: string;
|
|
781
|
+
agentName: string;
|
|
782
|
+
requestId: string;
|
|
783
|
+
triggerType: RaybaseAgentExecutionTriggerType;
|
|
784
|
+
inputMessageId: string | null;
|
|
785
|
+
status: RaybaseAgentRunStatus;
|
|
786
|
+
startedAt: string;
|
|
787
|
+
/** Last known progress. Null on rows written before the column existed. */
|
|
788
|
+
heartbeatAt: string | null;
|
|
789
|
+
finishedAt: string | null;
|
|
790
|
+
error: string | null;
|
|
791
|
+
usageEventId: string | null;
|
|
792
|
+
auditEventId: string | null;
|
|
793
|
+
metadataJson: string | null;
|
|
794
|
+
};
|
|
795
|
+
export declare const defaultAgentRunHistoryLimit = 20;
|
|
796
|
+
export declare const maxAgentRunHistoryLimit = 100;
|
|
797
|
+
export type RaybaseAgentRunDeliveryEvidence = {
|
|
798
|
+
verdict: "deliver" | "drop";
|
|
799
|
+
retries: number;
|
|
800
|
+
replaced?: true;
|
|
801
|
+
silence?: string;
|
|
802
|
+
};
|
|
803
|
+
export type RaybaseAgentTerminalRunStatus = Exclude<RaybaseAgentRunStatus, "queued" | "running">;
|
|
804
|
+
export type RaybaseAgentRunSummary = {
|
|
805
|
+
runId: string;
|
|
806
|
+
triggerType: RaybaseAgentExecutionTriggerType;
|
|
807
|
+
status: RaybaseAgentTerminalRunStatus;
|
|
808
|
+
startedAt: string;
|
|
809
|
+
finishedAt: string;
|
|
810
|
+
delivery?: RaybaseAgentRunDeliveryEvidence;
|
|
811
|
+
};
|
|
812
|
+
export type RaybaseAgentRunHistoryOptions = {
|
|
813
|
+
/** Inclusive lower bound. */
|
|
814
|
+
finishedAfter?: string;
|
|
815
|
+
/** Exclusive upper bound. */
|
|
816
|
+
finishedBefore?: string;
|
|
817
|
+
/** Default 20; maximum 100. */
|
|
818
|
+
limit?: number;
|
|
819
|
+
};
|
|
820
|
+
export type RaybaseAgentRunHistoryReader = {
|
|
821
|
+
recent(options?: RaybaseAgentRunHistoryOptions): Promise<ReadonlyArray<Readonly<RaybaseAgentRunSummary>>>;
|
|
822
|
+
};
|
|
823
|
+
export type RaybaseAgentInvocationRunHistoryReader = {
|
|
824
|
+
/**
|
|
825
|
+
* Bounded terminal-run summaries for one exact registered-agent conversation.
|
|
826
|
+
* A registered agent paired with another agent's conversation returns no rows.
|
|
827
|
+
* A commit hook observes every terminal row present at query time, including
|
|
828
|
+
* the run whose commit hook is executing because Core finalizes it first.
|
|
829
|
+
*/
|
|
830
|
+
recent(agentName: string, conversationId: string, options?: RaybaseAgentRunHistoryOptions): Promise<ReadonlyArray<Readonly<RaybaseAgentRunSummary>>>;
|
|
831
|
+
};
|
|
832
|
+
export type RaybaseAgentRequestDisposition = "run" | "coalesced" | "ignored";
|
|
833
|
+
export type RaybaseAgentRequestKind = "send" | "retry" | "composed";
|
|
834
|
+
export type RaybaseAgentRequestRow = {
|
|
835
|
+
id: string;
|
|
836
|
+
conversationId: string;
|
|
837
|
+
requestKey: string;
|
|
838
|
+
messageId: string;
|
|
839
|
+
kind: RaybaseAgentRequestKind | null;
|
|
840
|
+
authorUserId: string | null;
|
|
841
|
+
disposition: RaybaseAgentRequestDisposition | null;
|
|
842
|
+
runId: string | null;
|
|
843
|
+
seq: number | null;
|
|
844
|
+
createdAt: string;
|
|
845
|
+
updatedAt: string;
|
|
846
|
+
};
|
|
847
|
+
export type RaybaseAgentAccess = {
|
|
848
|
+
audience: RaybaseAgentAudienceKind;
|
|
849
|
+
principal: RaybaseAgentPrincipal;
|
|
850
|
+
surface: string;
|
|
851
|
+
route: string;
|
|
852
|
+
origin?: string;
|
|
853
|
+
organizationId?: string | null;
|
|
854
|
+
};
|
|
855
|
+
export type RaybaseAgentTokenPurpose = "agent-conversation" | "agent-websocket" | "agent-internal";
|
|
856
|
+
export type RaybaseAgentTokenClaims = {
|
|
857
|
+
v: 1;
|
|
858
|
+
purpose: RaybaseAgentTokenPurpose;
|
|
859
|
+
aud: "raybase-agent-chat";
|
|
860
|
+
agentName: string;
|
|
861
|
+
conversationId: string;
|
|
862
|
+
runtime: "ai-chat";
|
|
863
|
+
triggerType: "chat";
|
|
864
|
+
principalKind: "user" | "public";
|
|
865
|
+
userId?: string;
|
|
866
|
+
publicScopeHash?: string;
|
|
867
|
+
organizationId?: string;
|
|
868
|
+
route?: string;
|
|
869
|
+
surface: string;
|
|
870
|
+
/** Present only on short-lived tokens minted for the receive subscription socket. */
|
|
871
|
+
socketMode?: "subscription";
|
|
872
|
+
iat: number;
|
|
873
|
+
exp: number;
|
|
874
|
+
nonce: string;
|
|
875
|
+
};
|
|
876
|
+
export type RaybaseAgentScheduleRow = {
|
|
877
|
+
id: string;
|
|
878
|
+
agentName: string;
|
|
879
|
+
triggerIndex: number;
|
|
880
|
+
triggerKey: string;
|
|
881
|
+
inputJson: string | null;
|
|
882
|
+
cron: string;
|
|
883
|
+
timezone: string | null;
|
|
884
|
+
enabled: number;
|
|
885
|
+
userMessage: string | null;
|
|
886
|
+
cronOverride: string | null;
|
|
887
|
+
timezoneOverride: string | null;
|
|
888
|
+
enabledOverride: number | null;
|
|
889
|
+
inputJsonOverride: string | null;
|
|
890
|
+
inputJsonOverrideEnabled: number | null;
|
|
891
|
+
userMessageOverride: string | null;
|
|
892
|
+
lastRunAt: string | null;
|
|
893
|
+
nextRunAt: string | null;
|
|
894
|
+
service: string | null;
|
|
895
|
+
dispatchGeneration: number | null;
|
|
896
|
+
dispatchAttempts: number | null;
|
|
897
|
+
dispatchLeaseExpiresAt: string | null;
|
|
898
|
+
lastDispatchAt: string | null;
|
|
899
|
+
lastDispatchError: string | null;
|
|
900
|
+
createdAt: string;
|
|
901
|
+
updatedAt: string;
|
|
902
|
+
};
|
|
903
|
+
export type RaybaseAgentTriggerEventStatus = "queued" | "skipped" | "running" | "completed" | "failed";
|
|
904
|
+
export type RaybaseAgentTriggerEventRow = {
|
|
905
|
+
id: string;
|
|
906
|
+
/** Optional tenant scope supplied by a composed runtime such as Raybase Pro. */
|
|
907
|
+
organizationId?: string;
|
|
908
|
+
agentName: string;
|
|
909
|
+
triggerType: "schedule" | "data" | "direct" | "wake" | "follow-up";
|
|
910
|
+
triggerKey: string;
|
|
911
|
+
sourceTable: string | null;
|
|
912
|
+
sourceOp: string | null;
|
|
913
|
+
rowId: string | null;
|
|
914
|
+
inputJson: string | null;
|
|
915
|
+
idempotencyKey: string | null;
|
|
916
|
+
status: RaybaseAgentTriggerEventStatus;
|
|
917
|
+
runId: string | null;
|
|
918
|
+
error: string | null;
|
|
919
|
+
createdAt: string;
|
|
920
|
+
updatedAt: string;
|
|
921
|
+
};
|
|
922
|
+
export type RaybaseAgentRunQueueMessage = {
|
|
923
|
+
kind: "raybase.agent.run";
|
|
924
|
+
version: 1;
|
|
925
|
+
eventId: string;
|
|
926
|
+
agentName: string;
|
|
927
|
+
triggerType: "schedule" | "data" | "direct" | "wake" | "follow-up";
|
|
928
|
+
organizationId?: string;
|
|
929
|
+
claimedBy?: "sweep" | "alarm";
|
|
930
|
+
claimedAt?: string;
|
|
931
|
+
};
|
|
932
|
+
export type RaybaseAgentFollowUpLapseQueueMessage = {
|
|
933
|
+
kind: "raybase.agent.follow_up.lapse";
|
|
934
|
+
version: 1;
|
|
935
|
+
followUpId: string;
|
|
936
|
+
agentName: string;
|
|
937
|
+
/** Optional tenant scope supplied by a composed runtime such as Raybase Pro. */
|
|
938
|
+
organizationId?: string;
|
|
939
|
+
claimedBy?: "sweep" | "alarm";
|
|
940
|
+
lapsedAt?: string;
|
|
941
|
+
};
|
|
942
|
+
export type RaybaseAgentWakeDispatchMessage = {
|
|
943
|
+
kind: "raybase.agent.wake";
|
|
944
|
+
version: 1;
|
|
945
|
+
wakeId: string;
|
|
946
|
+
agentName: string;
|
|
947
|
+
generation: number;
|
|
948
|
+
runAt: string;
|
|
949
|
+
organizationId?: string;
|
|
950
|
+
claimedBy: "sweep" | "alarm";
|
|
951
|
+
claimedAt: string;
|
|
952
|
+
};
|
|
953
|
+
export type RaybaseAgentScheduleDispatchMessage = {
|
|
954
|
+
kind: "raybase.agent.schedule";
|
|
955
|
+
version: 1;
|
|
956
|
+
scheduleId: string;
|
|
957
|
+
agentName: string;
|
|
958
|
+
generation: number;
|
|
959
|
+
bookedAt: string;
|
|
960
|
+
organizationId?: string;
|
|
961
|
+
claimedBy: "sweep" | "alarm";
|
|
962
|
+
claimedAt: string;
|
|
963
|
+
};
|
|
964
|
+
export type RaybaseAgentQueueMessage = RaybaseAgentRunQueueMessage | RaybaseAgentFollowUpLapseQueueMessage | RaybaseAgentWakeDispatchMessage | RaybaseAgentScheduleDispatchMessage;
|
|
965
|
+
export type EffectiveAgentSchedule = {
|
|
966
|
+
id: string;
|
|
967
|
+
agentName: string;
|
|
968
|
+
triggerIndex: number;
|
|
969
|
+
triggerKey: string;
|
|
970
|
+
cron: string;
|
|
971
|
+
timezone: string | null;
|
|
972
|
+
enabled: boolean;
|
|
973
|
+
input: unknown;
|
|
974
|
+
userMessage?: string;
|
|
975
|
+
};
|
|
976
|
+
export type AgentScheduleOverrideField = "cron" | "timezone" | "enabled" | "input" | "userMessage";
|
|
977
|
+
export type AgentScheduleOverrideState = Record<AgentScheduleOverrideField, boolean>;
|
|
978
|
+
export type AgentScheduleAdminSnapshot = {
|
|
979
|
+
id: string;
|
|
980
|
+
agentName: string;
|
|
981
|
+
triggerIndex: number;
|
|
982
|
+
triggerKey: string;
|
|
983
|
+
source: {
|
|
984
|
+
cron: string;
|
|
985
|
+
timezone: string | null;
|
|
986
|
+
enabled: boolean;
|
|
987
|
+
input: unknown;
|
|
988
|
+
userMessage: string | null;
|
|
989
|
+
};
|
|
990
|
+
overrides: {
|
|
991
|
+
cron: string | null;
|
|
992
|
+
timezone: string | null;
|
|
993
|
+
enabled: boolean | null;
|
|
994
|
+
input: unknown;
|
|
995
|
+
userMessage: string | null;
|
|
996
|
+
};
|
|
997
|
+
overrideEnabled: AgentScheduleOverrideState;
|
|
998
|
+
effective: {
|
|
999
|
+
cron: string;
|
|
1000
|
+
timezone: string | null;
|
|
1001
|
+
enabled: boolean;
|
|
1002
|
+
input: unknown;
|
|
1003
|
+
userMessage: string | null;
|
|
1004
|
+
};
|
|
1005
|
+
lastRunAt: string | null;
|
|
1006
|
+
nextRunAt: string | null;
|
|
1007
|
+
service: string | null;
|
|
1008
|
+
createdAt: string;
|
|
1009
|
+
updatedAt: string;
|
|
1010
|
+
};
|
|
1011
|
+
export type RaybaseAgentRunOptions = {
|
|
1012
|
+
input?: unknown;
|
|
1013
|
+
/** First-class user text for an in-process chat-bound direct run. */
|
|
1014
|
+
userMessage?: string;
|
|
1015
|
+
idempotencyKey?: string;
|
|
1016
|
+
timeout?: string | number;
|
|
1017
|
+
metadata?: unknown;
|
|
1018
|
+
conversation?: RaybaseAgentDirectConversationBinding;
|
|
1019
|
+
organizationId?: string | null;
|
|
1020
|
+
surface?: string;
|
|
1021
|
+
route?: string;
|
|
1022
|
+
requestId?: string;
|
|
1023
|
+
signal?: AbortSignal;
|
|
1024
|
+
};
|
|
1025
|
+
export type RaybaseAgentEnqueueOptions = {
|
|
1026
|
+
input?: unknown;
|
|
1027
|
+
idempotencyKey?: string;
|
|
1028
|
+
metadata?: unknown;
|
|
1029
|
+
conversation?: RaybaseAgentDirectConversationBinding;
|
|
1030
|
+
organizationId?: string | null;
|
|
1031
|
+
surface?: string;
|
|
1032
|
+
route?: string;
|
|
1033
|
+
requestId?: string;
|
|
1034
|
+
};
|
|
1035
|
+
export type RaybaseAgentDirectConversationBinding = {
|
|
1036
|
+
mode?: "new";
|
|
1037
|
+
} | {
|
|
1038
|
+
mode: "thread";
|
|
1039
|
+
key: string;
|
|
1040
|
+
metadata?: unknown;
|
|
1041
|
+
} | {
|
|
1042
|
+
mode: "chat";
|
|
1043
|
+
conversationId: string;
|
|
1044
|
+
};
|
|
1045
|
+
export type RaybaseAgentRunResult = {
|
|
1046
|
+
eventId: string;
|
|
1047
|
+
runId: string;
|
|
1048
|
+
agentName: string;
|
|
1049
|
+
conversationId: string;
|
|
1050
|
+
status: "completed";
|
|
1051
|
+
output: string;
|
|
1052
|
+
parts?: RaybaseAgentDataPart[];
|
|
1053
|
+
idempotencyKey?: string | null;
|
|
1054
|
+
};
|
|
1055
|
+
export type RaybaseAgentEnqueueResult = {
|
|
1056
|
+
eventId: string;
|
|
1057
|
+
runId: string;
|
|
1058
|
+
agentName: string;
|
|
1059
|
+
conversationId: string;
|
|
1060
|
+
status: "queued" | "existing" | "skipped";
|
|
1061
|
+
idempotencyKey?: string | null;
|
|
1062
|
+
};
|
|
1063
|
+
export type RaybaseAgentComposeOptions = {
|
|
1064
|
+
conversationId: string;
|
|
1065
|
+
instruction: string;
|
|
1066
|
+
context?: Record<string, unknown>;
|
|
1067
|
+
requestKey?: string;
|
|
1068
|
+
};
|
|
1069
|
+
/**
|
|
1070
|
+
* How a compose request landed. `pending` started a turn of its own and
|
|
1071
|
+
* `existing` replayed a request already on file. A turn already running for
|
|
1072
|
+
* the conversation is never a refusal: `steered` means the instruction was
|
|
1073
|
+
* handed to the turn named by `runId`, and `queued` means `runId` is a run
|
|
1074
|
+
* waiting to start once that turn lands.
|
|
1075
|
+
*/
|
|
1076
|
+
export type RaybaseAgentComposeResult = {
|
|
1077
|
+
conversationId: string;
|
|
1078
|
+
requestKey: string;
|
|
1079
|
+
status: "pending" | "existing" | "steered" | "queued";
|
|
1080
|
+
runId?: string | null;
|
|
1081
|
+
};
|
|
1082
|
+
export type RaybaseAgentComposeOutcome = {
|
|
1083
|
+
state: "unknown";
|
|
1084
|
+
} | {
|
|
1085
|
+
state: "accepted";
|
|
1086
|
+
runId: string | null;
|
|
1087
|
+
} | {
|
|
1088
|
+
state: "spoke";
|
|
1089
|
+
runId: string;
|
|
1090
|
+
messageId: string;
|
|
1091
|
+
finishedAt: string;
|
|
1092
|
+
} | {
|
|
1093
|
+
state: "silent";
|
|
1094
|
+
runId: string;
|
|
1095
|
+
silenceKind: string;
|
|
1096
|
+
finishedAt: string;
|
|
1097
|
+
};
|
|
1098
|
+
export type RaybaseAgentConversationRewindResult = {
|
|
1099
|
+
conversationId: string;
|
|
1100
|
+
targetMessageId: string;
|
|
1101
|
+
lastMessageId: string | null;
|
|
1102
|
+
deletedMessageCount: number;
|
|
1103
|
+
releasedRequestKeys: string[];
|
|
1104
|
+
};
|
|
1105
|
+
export type RaybaseAgentConversationRerunResult = {
|
|
1106
|
+
conversationId: string;
|
|
1107
|
+
messageId: string;
|
|
1108
|
+
requestKey: string;
|
|
1109
|
+
status: "pending";
|
|
1110
|
+
};
|
|
1111
|
+
export type RaybaseAgentInvocationRuntime = {
|
|
1112
|
+
memory: RaybaseAgentMemoryServerRuntime;
|
|
1113
|
+
runs: RaybaseAgentInvocationRunHistoryReader;
|
|
1114
|
+
run(agentName: string, options?: RaybaseAgentRunOptions): Promise<RaybaseAgentRunResult>;
|
|
1115
|
+
enqueue(agentName: string, options?: RaybaseAgentEnqueueOptions): Promise<RaybaseAgentEnqueueResult>;
|
|
1116
|
+
compose(agentName: string, options: RaybaseAgentComposeOptions): Promise<RaybaseAgentComposeResult>;
|
|
1117
|
+
wake(agentName: string, options: RaybaseAgentWakeOptions): Promise<RaybaseAgentWakeResult>;
|
|
1118
|
+
cancelWake(agentName: string, purpose: string): Promise<{
|
|
1119
|
+
cancelled: boolean;
|
|
1120
|
+
}>;
|
|
1121
|
+
followUps(agentName: string): RaybaseAgentFollowUpsRuntime;
|
|
1122
|
+
conversations: {
|
|
1123
|
+
readState(conversationId: string): Promise<RaybaseAgentConversationReadState>;
|
|
1124
|
+
/**
|
|
1125
|
+
* Bring an expired or archived user conversation back to `active` so a
|
|
1126
|
+
* server lane (a job, a scheduled pass) can compose into it — the same
|
|
1127
|
+
* rehydration the member-facing bootstrap performs, without a member
|
|
1128
|
+
* session. Trusted server context only; never resurrects deleted
|
|
1129
|
+
* conversations.
|
|
1130
|
+
*/
|
|
1131
|
+
resume(agentName: string, conversationId: string): Promise<{
|
|
1132
|
+
status: "active" | "resumed";
|
|
1133
|
+
}>;
|
|
1134
|
+
composeOutcome(agentName: string, conversationId: string, requestKey: string): Promise<RaybaseAgentComposeOutcome>;
|
|
1135
|
+
removeMessage(agentName: string, conversationId: string, messageId: string): Promise<{
|
|
1136
|
+
removed: boolean;
|
|
1137
|
+
messageId: string;
|
|
1138
|
+
}>;
|
|
1139
|
+
rewind(agentName: string, conversationId: string, messageId: string): Promise<RaybaseAgentConversationRewindResult>;
|
|
1140
|
+
rerun(agentName: string, conversationId: string): Promise<RaybaseAgentConversationRerunResult>;
|
|
1141
|
+
};
|
|
1142
|
+
rooms: {
|
|
1143
|
+
create(agentName: string, options: {
|
|
1144
|
+
ownerUserId: string;
|
|
1145
|
+
memberUserIds?: string[];
|
|
1146
|
+
title?: string;
|
|
1147
|
+
}): Promise<{
|
|
1148
|
+
conversationId: string;
|
|
1149
|
+
}>;
|
|
1150
|
+
addMember(agentName: string, conversationId: string, userId: string, options?: {
|
|
1151
|
+
byUserId?: string;
|
|
1152
|
+
}): Promise<void>;
|
|
1153
|
+
removeMember(agentName: string, conversationId: string, userId: string, options?: {
|
|
1154
|
+
byUserId?: string;
|
|
1155
|
+
}): Promise<void>;
|
|
1156
|
+
leave(agentName: string, conversationId: string, userId: string): Promise<void>;
|
|
1157
|
+
redactMember(agentName: string, conversationId: string, userId: string): Promise<{
|
|
1158
|
+
status: "complete" | "pending";
|
|
1159
|
+
pending: number;
|
|
1160
|
+
}>;
|
|
1161
|
+
transferOwner(agentName: string, conversationId: string, toUserId: string): Promise<void>;
|
|
1162
|
+
members(agentName: string, conversationId: string): Promise<RaybaseAgentRoomMemberSummary[]>;
|
|
1163
|
+
};
|
|
1164
|
+
};
|
|
1165
|
+
export declare const maxAgentEntryPayloadBytes: number;
|
|
1166
|
+
export declare const maxAgentEntryKickoffChars: number;
|
|
1167
|
+
export declare function defineAgent<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema>(definition: RaybaseAgentDefinition<Env, Schema>): RaybaseAgent<Env, Schema>;
|
|
1168
|
+
export declare function agentConversationAttachmentsConfig<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>): NormalizedRaybaseAgentConversationAttachmentsConfig | null;
|
|
1169
|
+
export declare function agentConversationVoiceNotesConfig<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>): NormalizedRaybaseAgentConversationVoiceNotesConfig | null;
|
|
1170
|
+
export declare function validateAgentAttachmentStorage<Env, Schema extends RaybaseSchema = RaybaseSchema>(agents: RaybaseAgents<Env, Schema>, storage: RaybaseStorageConfig | undefined): void;
|
|
1171
|
+
export declare function agentConversationEligibilityConfig<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>, conversationKind: "room" | null | undefined): {
|
|
1172
|
+
eligibility?: RaybaseAgentConversationsConfig<Env, Schema>["eligibility"];
|
|
1173
|
+
eligibilityTimeoutMs?: number;
|
|
1174
|
+
onEligibilityFailure?: RaybaseAgentHookFailure;
|
|
1175
|
+
};
|
|
1176
|
+
export declare function validateAgentEntriesForAgent<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>): void;
|
|
1177
|
+
export declare function agentEntryDefinition<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>, kind: string): RaybaseAgentEntryDefinition;
|
|
1178
|
+
export declare function agentEntryAudiences(definition: RaybaseAgentEntryDefinition): RaybaseAgentAudienceKind[];
|
|
1179
|
+
export declare function validateInlineAgentEntryPayload(definition: RaybaseAgentEntryDefinition, payload: unknown): unknown;
|
|
1180
|
+
export declare function agentEntryFromInstance(instance: Pick<RaybaseAgentInstanceRow, "entryKind" | "entryJson">): RaybaseAgentEntrySnapshot | undefined;
|
|
1181
|
+
export declare function agentConversationTitlesConfig<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: Pick<RaybaseAgent<Env, Schema>, "conversationTitles">): {
|
|
1182
|
+
model: string | null;
|
|
1183
|
+
} | null;
|
|
1184
|
+
export declare function validateAgentTriggers<Env, Schema extends RaybaseSchema = RaybaseSchema>(agents: RaybaseAgents<Env, Schema> | undefined, schema: Schema): void;
|
|
1185
|
+
export declare function parseAgentDataTriggerEvent(event: string): {
|
|
1186
|
+
tableName: string;
|
|
1187
|
+
op: "create" | "update" | "delete";
|
|
1188
|
+
};
|
|
1189
|
+
export declare function defineAgents<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema>(agents: RaybaseAgentDefinitions<Env, Schema>): RaybaseAgents<Env, Schema>;
|
|
1190
|
+
export declare function validateAgentName(name: string): void;
|
|
1191
|
+
export declare function agentSummaries<Env, Schema extends RaybaseSchema = RaybaseSchema>(agents?: RaybaseAgents<Env, Schema>): {
|
|
1192
|
+
name: string;
|
|
1193
|
+
title: string;
|
|
1194
|
+
description: string;
|
|
1195
|
+
runtime: "ai-chat";
|
|
1196
|
+
triggers: RaybaseAgentTrigger[];
|
|
1197
|
+
model: string | null;
|
|
1198
|
+
limits: RaybaseAgentLimits | null;
|
|
1199
|
+
scopes: string[];
|
|
1200
|
+
owner: {
|
|
1201
|
+
moduleId?: string;
|
|
1202
|
+
packageName?: string;
|
|
1203
|
+
} | null;
|
|
1204
|
+
actions: {
|
|
1205
|
+
name: string;
|
|
1206
|
+
description: string;
|
|
1207
|
+
}[];
|
|
1208
|
+
skills: RaybaseAgentSkillSummary[];
|
|
1209
|
+
skillStore: RaybaseAgentSkillStoreConfig<Env, Schema> | null;
|
|
1210
|
+
remoteMcpBindings: RaybaseAgentRemoteMcpBindingSummary[];
|
|
1211
|
+
memorySpaces: RaybaseAgentMemorySpaceSummary[];
|
|
1212
|
+
rooms: boolean;
|
|
1213
|
+
entries: {
|
|
1214
|
+
kind: string;
|
|
1215
|
+
description: string;
|
|
1216
|
+
source: RaybaseAgentEntrySource;
|
|
1217
|
+
audience: RaybaseAgentAudienceKind[];
|
|
1218
|
+
hasKickoff: boolean;
|
|
1219
|
+
payloadSchema: JsonSchemaObject | null;
|
|
1220
|
+
}[];
|
|
1221
|
+
runtimeControl: {
|
|
1222
|
+
configurable: boolean;
|
|
1223
|
+
defaultEnabled: boolean;
|
|
1224
|
+
};
|
|
1225
|
+
prompt: {
|
|
1226
|
+
configurable: boolean;
|
|
1227
|
+
renderer: "liquid";
|
|
1228
|
+
default: string;
|
|
1229
|
+
} | null;
|
|
1230
|
+
}[];
|
|
1231
|
+
export declare function agentFor<Env, Schema extends RaybaseSchema = RaybaseSchema>(agents: RaybaseAgents<Env, Schema> | undefined, name: string): RaybaseAgent<Env, Schema>;
|
|
1232
|
+
export declare class AgentHttpError extends Error {
|
|
1233
|
+
readonly status: number;
|
|
1234
|
+
readonly retryable: boolean;
|
|
1235
|
+
constructor(message: string, status: number, retryable?: boolean);
|
|
1236
|
+
}
|
|
1237
|
+
export declare function agentAudienceKinds(audience: RaybaseAgentAudience | undefined, surface: string): RaybaseAgentAudienceKind[];
|
|
1238
|
+
export declare function agentAudienceAllows(audience: RaybaseAgentAudience | undefined, surface: string, kind: RaybaseAgentAudienceKind): boolean;
|
|
1239
|
+
export declare function agentRequestSurface(request: Request, surfaces?: Array<{
|
|
1240
|
+
surface: string;
|
|
1241
|
+
pathPrefix: string;
|
|
1242
|
+
}>): {
|
|
1243
|
+
surface: string;
|
|
1244
|
+
route: string;
|
|
1245
|
+
origin?: string;
|
|
1246
|
+
};
|
|
1247
|
+
export declare function resolveAgentAccess(input: {
|
|
1248
|
+
request: Request;
|
|
1249
|
+
user?: RaybaseUser;
|
|
1250
|
+
organizationId?: string | null;
|
|
1251
|
+
agent: Pick<RaybaseAgent, "audience">;
|
|
1252
|
+
surfaces?: Array<{
|
|
1253
|
+
surface: string;
|
|
1254
|
+
pathPrefix: string;
|
|
1255
|
+
}>;
|
|
1256
|
+
principalKind?: "user" | "public";
|
|
1257
|
+
}): Promise<RaybaseAgentAccess>;
|
|
1258
|
+
export declare function publicAgentUser(principal: Extract<RaybaseAgentPrincipal, {
|
|
1259
|
+
kind: "public";
|
|
1260
|
+
}>): RaybaseUser;
|
|
1261
|
+
export declare function agentInstanceKey(agentName: string, conversationId: string): string;
|
|
1262
|
+
export declare function agentExpiresAt(ttlSeconds?: number | null): string | null;
|
|
1263
|
+
export declare function createOrResumeAgentInstance<Env, Schema extends RaybaseSchema = RaybaseSchema>(input: {
|
|
1264
|
+
organizationId?: string | null;
|
|
1265
|
+
control: SqlExecutor;
|
|
1266
|
+
agent: RaybaseAgent<Env, Schema>;
|
|
1267
|
+
access: RaybaseAgentAccess;
|
|
1268
|
+
conversationId?: string;
|
|
1269
|
+
title?: string | null;
|
|
1270
|
+
ttlSeconds?: number;
|
|
1271
|
+
rehydrateArchived?: (instance: RaybaseAgentInstanceRow, synopsis: AgentChapterSynopsis) => Promise<void>;
|
|
1272
|
+
metadata?: unknown;
|
|
1273
|
+
entry?: RaybaseAgentEntrySnapshot;
|
|
1274
|
+
}): Promise<RaybaseAgentInstanceRow>;
|
|
1275
|
+
export declare function buildAgentRoomInstance<Env, Schema extends RaybaseSchema = RaybaseSchema>(input: {
|
|
1276
|
+
agent: RaybaseAgent<Env, Schema>;
|
|
1277
|
+
ownerUserId: string;
|
|
1278
|
+
conversationId: string;
|
|
1279
|
+
title?: string;
|
|
1280
|
+
organizationId?: string | null;
|
|
1281
|
+
route?: string | null;
|
|
1282
|
+
surface?: string;
|
|
1283
|
+
now?: string;
|
|
1284
|
+
}): RaybaseAgentInstanceRow;
|
|
1285
|
+
export declare function agentRoomInstanceInsertStatement(row: RaybaseAgentInstanceRow): {
|
|
1286
|
+
sql: string;
|
|
1287
|
+
params: SqlValue[];
|
|
1288
|
+
};
|
|
1289
|
+
export declare function createAgentRoomInstance<Env, Schema extends RaybaseSchema = RaybaseSchema>(input: {
|
|
1290
|
+
control: SqlExecutor;
|
|
1291
|
+
agent: RaybaseAgent<Env, Schema>;
|
|
1292
|
+
ownerUserId: string;
|
|
1293
|
+
conversationId: string;
|
|
1294
|
+
title?: string;
|
|
1295
|
+
organizationId?: string | null;
|
|
1296
|
+
route?: string | null;
|
|
1297
|
+
surface?: string;
|
|
1298
|
+
now?: string;
|
|
1299
|
+
}): Promise<RaybaseAgentInstanceRow>;
|
|
1300
|
+
export declare function findAgentInstance(control: SqlExecutor, agentName: string, conversationId: string): Promise<RaybaseAgentInstanceRow | null>;
|
|
1301
|
+
export declare function listAgentConversations(control: SqlExecutor, input: {
|
|
1302
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1303
|
+
organizationId?: string | null;
|
|
1304
|
+
agentName: string;
|
|
1305
|
+
access: RaybaseAgentAccess;
|
|
1306
|
+
limit?: number;
|
|
1307
|
+
offset?: number;
|
|
1308
|
+
now?: string;
|
|
1309
|
+
includeArchived?: boolean;
|
|
1310
|
+
q?: string;
|
|
1311
|
+
}): Promise<RaybaseAgentConversationSummary[]>;
|
|
1312
|
+
export declare function loadAgentConversationForAccess(control: SqlExecutor, input: {
|
|
1313
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1314
|
+
organizationId?: string | null;
|
|
1315
|
+
agentName: string;
|
|
1316
|
+
conversationId: string;
|
|
1317
|
+
access: RaybaseAgentAccess;
|
|
1318
|
+
}): Promise<RaybaseAgentInstanceRow>;
|
|
1319
|
+
export declare function requestAgentConversationDeletion(control: SqlExecutor, input: {
|
|
1320
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1321
|
+
organizationId?: string | null;
|
|
1322
|
+
agentName: string;
|
|
1323
|
+
conversationId: string;
|
|
1324
|
+
access: RaybaseAgentAccess;
|
|
1325
|
+
deleteHotStorage: (instance: RaybaseAgentInstanceRow) => Promise<void>;
|
|
1326
|
+
now?: string;
|
|
1327
|
+
}): Promise<{
|
|
1328
|
+
agentName: string;
|
|
1329
|
+
conversationId: string;
|
|
1330
|
+
status: "deleted";
|
|
1331
|
+
}>;
|
|
1332
|
+
export declare function loadAgentInstance(control: SqlExecutor, agentName: string, conversationId: string): Promise<RaybaseAgentInstanceRow>;
|
|
1333
|
+
export declare function agentInstanceMetadataJson(input: {
|
|
1334
|
+
organizationId?: string | null;
|
|
1335
|
+
current?: string | null;
|
|
1336
|
+
metadata?: unknown;
|
|
1337
|
+
title?: string | null;
|
|
1338
|
+
}): string | null;
|
|
1339
|
+
export declare function agentConversationTitle(metadataJson: string | null): string | null;
|
|
1340
|
+
export declare function updateAgentConversationTitle(control: SqlExecutor, instance: Pick<RaybaseAgentInstanceRow, "id" | "metadataJson">, title: string | null, now?: string): Promise<string | null>;
|
|
1341
|
+
export declare function updateAgentConversationPinned(control: SqlExecutor, instance: Pick<RaybaseAgentInstanceRow, "id">, pinned: boolean, now?: string): Promise<string | null>;
|
|
1342
|
+
export declare function markAgentDirectConversationRead(control: SqlExecutor, instance: Pick<RaybaseAgentInstanceRow, "id" | "kind">, now?: string): Promise<string>;
|
|
1343
|
+
export declare function renameAgentConversation(control: SqlExecutor, input: {
|
|
1344
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1345
|
+
organizationId?: string | null;
|
|
1346
|
+
agentName: string;
|
|
1347
|
+
conversationId: string;
|
|
1348
|
+
access: RaybaseAgentAccess;
|
|
1349
|
+
title: unknown;
|
|
1350
|
+
now?: string;
|
|
1351
|
+
}): Promise<{
|
|
1352
|
+
agentName: string;
|
|
1353
|
+
conversationId: string;
|
|
1354
|
+
title: string | null;
|
|
1355
|
+
}>;
|
|
1356
|
+
export declare function pinAgentConversation(control: SqlExecutor, input: {
|
|
1357
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1358
|
+
organizationId?: string | null;
|
|
1359
|
+
agentName: string;
|
|
1360
|
+
conversationId: string;
|
|
1361
|
+
access: RaybaseAgentAccess;
|
|
1362
|
+
pinned: unknown;
|
|
1363
|
+
now?: string;
|
|
1364
|
+
}): Promise<{
|
|
1365
|
+
agentName: string;
|
|
1366
|
+
conversationId: string;
|
|
1367
|
+
pinned: boolean;
|
|
1368
|
+
pinnedAt: string | null;
|
|
1369
|
+
}>;
|
|
1370
|
+
export declare function cleanAgentConversationTitle(value: unknown): string | undefined;
|
|
1371
|
+
export declare function createAgentRun(input: {
|
|
1372
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1373
|
+
organizationId?: string | null;
|
|
1374
|
+
control: SqlExecutor;
|
|
1375
|
+
instance: RaybaseAgentInstanceRow;
|
|
1376
|
+
requestId: string;
|
|
1377
|
+
/**
|
|
1378
|
+
* A run id reserved before the row exists. The chat harness mints one ahead
|
|
1379
|
+
* of the pre-run eligibility gate so the hook that decides whether to answer
|
|
1380
|
+
* sees the same turn identity as everything downstream of it. Omitted
|
|
1381
|
+
* elsewhere, and minted here.
|
|
1382
|
+
*/
|
|
1383
|
+
runId?: string;
|
|
1384
|
+
triggerType?: RaybaseAgentExecutionTriggerType;
|
|
1385
|
+
inputMessageId?: string | null;
|
|
1386
|
+
metadata?: unknown;
|
|
1387
|
+
/**
|
|
1388
|
+
* Refreshes ordinary conversations while preserving the structural NULL
|
|
1389
|
+
* expiry used by keep-hot. When omitted, an existing NULL is still kept so
|
|
1390
|
+
* direct/internal callers cannot accidentally open a sweep crash window.
|
|
1391
|
+
*/
|
|
1392
|
+
ttlSeconds?: number | null;
|
|
1393
|
+
}): Promise<RaybaseAgentRunRow>;
|
|
1394
|
+
export declare function agentEnabledSettingKey(agentName: string): string;
|
|
1395
|
+
export declare function agentPromptSettingKey(agentName: string): string;
|
|
1396
|
+
export declare const raybaseAgentTimezoneSettingKey = "raybase.agent.timezone";
|
|
1397
|
+
export declare function agentGeneratedSettingDefinitions<Env, Schema extends RaybaseSchema = RaybaseSchema>(agents: RaybaseAgents<Env, Schema> | undefined): RaybaseSettingsDefinitions<Env>;
|
|
1398
|
+
export declare function isAgentRuntimeEnabled<Env, Schema extends RaybaseSchema = RaybaseSchema>(settings: RaybaseRuntimeSettings<Env, RaybaseSettingsDefinitions<Env>> | undefined, agent: RaybaseAgent<Env, Schema>): Promise<boolean>;
|
|
1399
|
+
export declare function agentScheduleId(agentName: string, triggerIndex: number, trigger?: Extract<RaybaseAgentTrigger, {
|
|
1400
|
+
type: "schedule";
|
|
1401
|
+
}>): string;
|
|
1402
|
+
export declare function agentTriggerKey(agentName: string, triggerIndex: number, trigger: RaybaseAgentTrigger): string;
|
|
1403
|
+
export declare function parseAgentScheduleSourceInput(row: RaybaseAgentScheduleRow): unknown;
|
|
1404
|
+
export declare function parseAgentScheduleInput(row: RaybaseAgentScheduleRow): unknown;
|
|
1405
|
+
export declare function agentScheduleOverrideState(row: RaybaseAgentScheduleRow): AgentScheduleOverrideState;
|
|
1406
|
+
export declare function effectiveAgentSchedule(row: RaybaseAgentScheduleRow): EffectiveAgentSchedule;
|
|
1407
|
+
export declare function agentScheduleRuntimeTrigger(row: RaybaseAgentScheduleRow): Extract<RaybaseAgentTrigger, {
|
|
1408
|
+
type: "schedule";
|
|
1409
|
+
}>;
|
|
1410
|
+
export declare function agentScheduleAdminSnapshot(row: RaybaseAgentScheduleRow): AgentScheduleAdminSnapshot;
|
|
1411
|
+
export declare function scheduleNextRunFrom(now: string, cron: string, timezone?: string | null): string | null;
|
|
1412
|
+
export declare function loadAgentSchedule(control: SqlExecutor, idValue: string): Promise<RaybaseAgentScheduleRow>;
|
|
1413
|
+
export declare function listAgentSchedulesForAgent(control: SqlExecutor, agentName: string): Promise<RaybaseAgentScheduleRow[]>;
|
|
1414
|
+
export type AgentScheduleOverrideWriteResult = {
|
|
1415
|
+
row: RaybaseAgentScheduleRow;
|
|
1416
|
+
before: AgentScheduleAdminSnapshot;
|
|
1417
|
+
after: AgentScheduleAdminSnapshot;
|
|
1418
|
+
changedFields: AgentScheduleOverrideField[];
|
|
1419
|
+
};
|
|
1420
|
+
export declare function setAgentScheduleOverrides(control: SqlExecutor, input: {
|
|
1421
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1422
|
+
organizationId?: string | null;
|
|
1423
|
+
id: string;
|
|
1424
|
+
overrides?: Record<string, unknown> | null;
|
|
1425
|
+
reset?: unknown;
|
|
1426
|
+
now?: string;
|
|
1427
|
+
}): Promise<AgentScheduleOverrideWriteResult>;
|
|
1428
|
+
export declare function resetAgentScheduleOverrides(control: SqlExecutor, input: {
|
|
1429
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1430
|
+
organizationId?: string | null;
|
|
1431
|
+
id: string;
|
|
1432
|
+
fields?: AgentScheduleOverrideField[];
|
|
1433
|
+
now?: string;
|
|
1434
|
+
}): Promise<AgentScheduleOverrideWriteResult>;
|
|
1435
|
+
export declare function upsertAgentSchedule(control: SqlExecutor, input: {
|
|
1436
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1437
|
+
organizationId?: string | null;
|
|
1438
|
+
agentName: string;
|
|
1439
|
+
triggerIndex: number;
|
|
1440
|
+
trigger: Extract<RaybaseAgentTrigger, {
|
|
1441
|
+
type: "schedule";
|
|
1442
|
+
}>;
|
|
1443
|
+
nextRunAt: string | null;
|
|
1444
|
+
service?: string | null;
|
|
1445
|
+
now?: string;
|
|
1446
|
+
}): Promise<RaybaseAgentScheduleRow>;
|
|
1447
|
+
export declare function listDueAgentSchedules(control: SqlExecutor, input: {
|
|
1448
|
+
organizationId?: string | null;
|
|
1449
|
+
now: string;
|
|
1450
|
+
limit?: number;
|
|
1451
|
+
}): Promise<RaybaseAgentScheduleRow[]>;
|
|
1452
|
+
export declare const agentScheduleMaxDispatchAttempts = 5;
|
|
1453
|
+
export type RaybaseAgentScheduleDispatch = {
|
|
1454
|
+
id: string;
|
|
1455
|
+
agentName: string;
|
|
1456
|
+
generation: number;
|
|
1457
|
+
bookedAt: string;
|
|
1458
|
+
};
|
|
1459
|
+
export declare function claimDueAgentSchedules(control: SqlExecutor, input: {
|
|
1460
|
+
organizationId?: string | null;
|
|
1461
|
+
now: string;
|
|
1462
|
+
wallNow: string;
|
|
1463
|
+
leaseExpiresAt: string;
|
|
1464
|
+
limit?: number;
|
|
1465
|
+
maxAttempts?: number;
|
|
1466
|
+
}): Promise<RaybaseAgentScheduleDispatch[]>;
|
|
1467
|
+
export declare function loadClaimedAgentSchedule(control: SqlExecutor, input: {
|
|
1468
|
+
id: string;
|
|
1469
|
+
generation: number;
|
|
1470
|
+
bookedAt: string;
|
|
1471
|
+
}): Promise<RaybaseAgentScheduleRow | null>;
|
|
1472
|
+
export declare function releaseAgentScheduleDispatch(control: SqlExecutor, input: {
|
|
1473
|
+
id: string;
|
|
1474
|
+
generation: number;
|
|
1475
|
+
bookedAt: string;
|
|
1476
|
+
error: string;
|
|
1477
|
+
now?: string;
|
|
1478
|
+
}): Promise<void>;
|
|
1479
|
+
export declare function advanceAgentSchedule(control: SqlExecutor, input: {
|
|
1480
|
+
organizationId?: string | null;
|
|
1481
|
+
id: string;
|
|
1482
|
+
lastRunAt: string;
|
|
1483
|
+
nextRunAt: string | null;
|
|
1484
|
+
generation?: number;
|
|
1485
|
+
now?: string;
|
|
1486
|
+
}): Promise<void>;
|
|
1487
|
+
export declare function createAgentTriggerEvent(control: SqlExecutor, input: {
|
|
1488
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1489
|
+
organizationId?: string | null;
|
|
1490
|
+
agentName: string;
|
|
1491
|
+
triggerType: "schedule" | "data" | "direct" | "wake" | "follow-up";
|
|
1492
|
+
triggerKey: string;
|
|
1493
|
+
sourceTable?: string | null;
|
|
1494
|
+
sourceOp?: "create" | "update" | "delete" | null;
|
|
1495
|
+
rowId?: string | null;
|
|
1496
|
+
input?: unknown;
|
|
1497
|
+
idempotencyKey?: string | null;
|
|
1498
|
+
status?: RaybaseAgentTriggerEventStatus;
|
|
1499
|
+
error?: string | null;
|
|
1500
|
+
now?: string;
|
|
1501
|
+
}): Promise<RaybaseAgentTriggerEventRow>;
|
|
1502
|
+
declare function markAgentTriggerEvent(control: SqlExecutor, eventId: string, input: {
|
|
1503
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1504
|
+
organizationId?: string | null;
|
|
1505
|
+
status: RaybaseAgentTriggerEventStatus;
|
|
1506
|
+
runId?: string | null;
|
|
1507
|
+
error?: string | null;
|
|
1508
|
+
now?: string;
|
|
1509
|
+
}): Promise<void>;
|
|
1510
|
+
export declare const markAgentTriggerEventQueued: (control: SqlExecutor, eventId: string, input?: Omit<Parameters<typeof markAgentTriggerEvent>[2], "status">) => Promise<void>;
|
|
1511
|
+
export declare const markAgentTriggerEventRunning: (control: SqlExecutor, eventId: string, input?: Omit<Parameters<typeof markAgentTriggerEvent>[2], "status">) => Promise<void>;
|
|
1512
|
+
export declare const markAgentTriggerEventCompleted: (control: SqlExecutor, eventId: string, input?: Omit<Parameters<typeof markAgentTriggerEvent>[2], "status">) => Promise<void>;
|
|
1513
|
+
export declare const markAgentTriggerEventFailed: (control: SqlExecutor, eventId: string, input?: Omit<Parameters<typeof markAgentTriggerEvent>[2], "status">) => Promise<void>;
|
|
1514
|
+
export declare const markAgentTriggerEventSkipped: (control: SqlExecutor, eventId: string, input?: Omit<Parameters<typeof markAgentTriggerEvent>[2], "status">) => Promise<void>;
|
|
1515
|
+
export declare function loadAgentTriggerEvent(control: SqlExecutor, eventId: string): Promise<RaybaseAgentTriggerEventRow>;
|
|
1516
|
+
export declare function findAgentTriggerEventByIdempotencyKey(control: SqlExecutor, idempotencyKey: string): Promise<RaybaseAgentTriggerEventRow | null>;
|
|
1517
|
+
export declare function directAgentTriggerKey(agentName: string): string;
|
|
1518
|
+
export declare function findAgentRun(control: SqlExecutor, runId: string): Promise<RaybaseAgentRunRow | null>;
|
|
1519
|
+
export declare function loadAgentRun(control: SqlExecutor, runId: string): Promise<RaybaseAgentRunRow>;
|
|
1520
|
+
export declare function createOrLoadDirectAgentInvocationRecord(input: {
|
|
1521
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1522
|
+
organizationId?: string | null;
|
|
1523
|
+
control: SqlExecutor;
|
|
1524
|
+
agent: Pick<RaybaseAgent, "name">;
|
|
1525
|
+
invocationInput?: unknown;
|
|
1526
|
+
idempotencyKey?: string | null;
|
|
1527
|
+
requestId?: string;
|
|
1528
|
+
metadata?: unknown;
|
|
1529
|
+
conversationId?: string;
|
|
1530
|
+
bindingFingerprint?: string;
|
|
1531
|
+
}): Promise<{
|
|
1532
|
+
created: boolean;
|
|
1533
|
+
event: RaybaseAgentTriggerEventRow;
|
|
1534
|
+
run: RaybaseAgentRunRow | null;
|
|
1535
|
+
}>;
|
|
1536
|
+
export declare function createAgentAutomationRun(input: {
|
|
1537
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1538
|
+
organizationId?: string | null;
|
|
1539
|
+
control: SqlExecutor;
|
|
1540
|
+
agent: Pick<RaybaseAgent, "name">;
|
|
1541
|
+
triggerType: "schedule" | "data" | "direct" | "wake" | "follow-up";
|
|
1542
|
+
eventId: string;
|
|
1543
|
+
requestId?: string;
|
|
1544
|
+
metadata?: unknown;
|
|
1545
|
+
conversationId?: string;
|
|
1546
|
+
}): Promise<RaybaseAgentRunRow>;
|
|
1547
|
+
export declare const activeAgentRunStaleSeconds: number;
|
|
1548
|
+
export declare const queuedAgentRunStaleSeconds: number;
|
|
1549
|
+
export declare function findActiveAgentRun(control: SqlExecutor, input: {
|
|
1550
|
+
organizationId?: string | null;
|
|
1551
|
+
agentName: string;
|
|
1552
|
+
conversationId: string;
|
|
1553
|
+
now?: string;
|
|
1554
|
+
}): Promise<RaybaseAgentRunRow | null>;
|
|
1555
|
+
/**
|
|
1556
|
+
* A run whose writer is known to be gone rather than merely late.
|
|
1557
|
+
*
|
|
1558
|
+
* The staleness sweep does not write this and must not: from a horizon it
|
|
1559
|
+
* cannot tell a restart from a turn that simply ran long, and claiming a
|
|
1560
|
+
* restart sends debugging after reloads that never happened. The conversation
|
|
1561
|
+
* object can tell, because it knows which runs the isolate it is running in
|
|
1562
|
+
* actually holds, so it settles its own orphans under this label the moment it
|
|
1563
|
+
* next reconciles (`isOrphanedRun` in agent-ai-chat.ts). Rows written by
|
|
1564
|
+
* earlier builds carry it too, which is why isReapedAgentRunError still
|
|
1565
|
+
* matches it.
|
|
1566
|
+
*/
|
|
1567
|
+
export declare const interruptedAgentRunError = "Interrupted by restart or deployment";
|
|
1568
|
+
/**
|
|
1569
|
+
* What the execution sweep actually knows: the run was still running when it
|
|
1570
|
+
* passed the horizon. Names the configured horizon so a reader can tell
|
|
1571
|
+
* "this turn was too slow" from "something killed the isolate".
|
|
1572
|
+
*/
|
|
1573
|
+
export declare function staleAgentRunError(staleSeconds?: number): string;
|
|
1574
|
+
/** Truthful terminal label for work that remained queued without starting. */
|
|
1575
|
+
export declare function staleQueuedAgentRunError(staleSeconds?: number): string;
|
|
1576
|
+
/**
|
|
1577
|
+
* True for any run the staleness sweep marked failed, under either current
|
|
1578
|
+
* label or the legacy one. Retry, redispatch and coverage checks
|
|
1579
|
+
* treat such a run as "no live writer" rather than as a real turn outcome, so
|
|
1580
|
+
* they must match both.
|
|
1581
|
+
*/
|
|
1582
|
+
export declare function isReapedAgentRunError(error: string | null | undefined): boolean;
|
|
1583
|
+
/**
|
|
1584
|
+
* Terminal bookkeeping for runs no writer is left to finish. A deploy or
|
|
1585
|
+
* crash kills the writer between run creation and the completed/failed
|
|
1586
|
+
* update, so the row sits at running with finishedAt null forever and runs
|
|
1587
|
+
* evidence reports a turn that is not executing.
|
|
1588
|
+
*
|
|
1589
|
+
* A running row is judged on `heartbeatAt`, not on when it started (2026-08-25).
|
|
1590
|
+
* On `startedAt` this swept up **live** turns: a turn is not late because it is
|
|
1591
|
+
* long, and a nine-round tool loop passes five minutes without anything being
|
|
1592
|
+
* wrong with it. What that cost was not a stray row — it was a member reading
|
|
1593
|
+
* "Birch ran into a problem while answering" twenty-four seconds before the
|
|
1594
|
+
* same run delivered its answer, because the sweep's terminal write is what the
|
|
1595
|
+
* conversation reports. The heartbeat is touched per model step, so a wedged
|
|
1596
|
+
* turn stops beating and is still reaped on time, which is the whole point of
|
|
1597
|
+
* having a horizon. Rows written before the column coalesce to `startedAt` and
|
|
1598
|
+
* are swept exactly as they were.
|
|
1599
|
+
*
|
|
1600
|
+
* A queued row keeps its own queue-wait horizon against `startedAt` and its own
|
|
1601
|
+
* label, because its execution has not begun and there is nothing to beat.
|
|
1602
|
+
* Status and timestamp predicates are re-checked in each UPDATE so adoption
|
|
1603
|
+
* cannot be reaped using its former queue clock.
|
|
1604
|
+
*/
|
|
1605
|
+
export declare function sweepStaleAgentRuns(control: SqlExecutor, input?: {
|
|
1606
|
+
organizationId?: string | null;
|
|
1607
|
+
now?: string;
|
|
1608
|
+
limit?: number;
|
|
1609
|
+
}): Promise<string[]>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Deletes poll/idempotency evidence after each owning Agent's configured
|
|
1612
|
+
* evidence window. Request replay and outcome polling are guaranteed only
|
|
1613
|
+
* while their receipt and run evidence remain inside that window.
|
|
1614
|
+
*/
|
|
1615
|
+
export declare function sweepAgentRunEvidence(control: SqlExecutor, input?: {
|
|
1616
|
+
now?: string;
|
|
1617
|
+
limit?: number;
|
|
1618
|
+
runEvidenceTtlMsForAgent?: (agentName: string) => number;
|
|
1619
|
+
}): Promise<{
|
|
1620
|
+
runIds: string[];
|
|
1621
|
+
requestIds: string[];
|
|
1622
|
+
}>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Mark a run as still working, without touching anything else about it.
|
|
1625
|
+
*
|
|
1626
|
+
* One column, one row, no read first — it runs once per model step inside a
|
|
1627
|
+
* turn that is already doing far more expensive things, and it must never be
|
|
1628
|
+
* the reason a turn fails. A run that has already reached a terminal status is
|
|
1629
|
+
* left alone by the status predicate rather than by a check here, so a beat
|
|
1630
|
+
* that lands in the teardown race cannot resurrect a finished row.
|
|
1631
|
+
*/
|
|
1632
|
+
export declare function touchAgentRunHeartbeat(control: SqlExecutor, runId: string, now?: string): Promise<void>;
|
|
1633
|
+
export declare function updateAgentRun(control: SqlExecutor, runId: string, input: {
|
|
1634
|
+
organizationId?: string | null;
|
|
1635
|
+
status?: RaybaseAgentRunStatus;
|
|
1636
|
+
error?: string | null;
|
|
1637
|
+
finishedAt?: string | null;
|
|
1638
|
+
metadata?: unknown;
|
|
1639
|
+
/** Explicit execution start for callers that must share the exact timestamp. */
|
|
1640
|
+
startedAt?: string;
|
|
1641
|
+
}): Promise<void>;
|
|
1642
|
+
export declare function touchAgentInstance(control: SqlExecutor, instanceId: string, input?: {
|
|
1643
|
+
organizationId?: string | null;
|
|
1644
|
+
lastError?: string | null;
|
|
1645
|
+
ttlSeconds?: number | null;
|
|
1646
|
+
}): Promise<void>;
|
|
1647
|
+
export declare function listExpiredAgentInstances(control: SqlExecutor, input?: {
|
|
1648
|
+
organizationId?: string | null;
|
|
1649
|
+
now?: string;
|
|
1650
|
+
limit?: number;
|
|
1651
|
+
}): Promise<RaybaseAgentInstanceRow[]>;
|
|
1652
|
+
export declare function markAgentCleanupRequested(control: SqlExecutor, instanceId: string, input?: {
|
|
1653
|
+
organizationId?: string | null;
|
|
1654
|
+
now?: string;
|
|
1655
|
+
reason?: string | null;
|
|
1656
|
+
error?: string | null;
|
|
1657
|
+
}): Promise<void>;
|
|
1658
|
+
export declare function beginAgentHotCleanup(control: SqlExecutor, input: {
|
|
1659
|
+
organizationId?: string | null;
|
|
1660
|
+
instance: RaybaseAgentInstanceRow;
|
|
1661
|
+
now?: string;
|
|
1662
|
+
reason?: string | null;
|
|
1663
|
+
}): Promise<{
|
|
1664
|
+
status: "delete" | "reschedule" | "terminal" | "busy";
|
|
1665
|
+
instance: RaybaseAgentInstanceRow;
|
|
1666
|
+
}>;
|
|
1667
|
+
export declare function completeAgentHotCleanup(control: SqlExecutor, instanceId: string, input?: {
|
|
1668
|
+
organizationId?: string | null;
|
|
1669
|
+
now?: string;
|
|
1670
|
+
outcome?: "archived" | "deleted";
|
|
1671
|
+
}): Promise<void>;
|
|
1672
|
+
export declare function completeAgentUserErasureAfterArtifactDrain(control: SqlExecutor, userId: string, input?: {
|
|
1673
|
+
organizationId?: string | null;
|
|
1674
|
+
now?: string;
|
|
1675
|
+
}): Promise<boolean>;
|
|
1676
|
+
export declare function countPendingAgentRoomMemberRedactions(control: SqlExecutor, userId: string): Promise<number>;
|
|
1677
|
+
export declare function failAgentHotCleanup(control: SqlExecutor, instanceId: string, input: {
|
|
1678
|
+
organizationId?: string | null;
|
|
1679
|
+
error: string;
|
|
1680
|
+
now?: string;
|
|
1681
|
+
}): Promise<void>;
|
|
1682
|
+
export declare function claimAgentGuideLimits<Env, Schema extends RaybaseSchema = RaybaseSchema>(input: {
|
|
1683
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1684
|
+
organizationId?: string | null;
|
|
1685
|
+
control: SqlExecutor;
|
|
1686
|
+
agent: RaybaseAgent<Env, Schema>;
|
|
1687
|
+
instance: RaybaseAgentInstanceRow;
|
|
1688
|
+
estimatedOutputTokens: number;
|
|
1689
|
+
}): Promise<void>;
|
|
1690
|
+
/** `limit` unset means unlimited; the window row is still counted so usage stays visible. */
|
|
1691
|
+
export declare function claimAgentEntryKickoffLimit(control: SqlExecutor, instance: RaybaseAgentInstanceRow, limit?: number): Promise<void>;
|
|
1692
|
+
/** `limit` unset means unlimited; the window row is still counted so usage stays visible. */
|
|
1693
|
+
export declare function claimAgentComposedLimit(control: SqlExecutor, instance: RaybaseAgentInstanceRow, limit?: number): Promise<void>;
|
|
1694
|
+
export declare function signAgentToken(secret: string, claims: Omit<RaybaseAgentTokenClaims, "iat" | "exp" | "nonce"> & {
|
|
1695
|
+
ttlSeconds: number;
|
|
1696
|
+
}): Promise<string>;
|
|
1697
|
+
export declare function verifyAgentToken(secret: string, token: string, purpose: RaybaseAgentTokenPurpose): Promise<RaybaseAgentTokenClaims>;
|
|
1698
|
+
export declare function agentTokenClaims(input: {
|
|
1699
|
+
organizationId?: string | null;
|
|
1700
|
+
purpose: RaybaseAgentTokenPurpose;
|
|
1701
|
+
agent: Pick<RaybaseAgent<any>, "name">;
|
|
1702
|
+
instance: RaybaseAgentInstanceRow;
|
|
1703
|
+
userId?: string;
|
|
1704
|
+
ttlSeconds?: number;
|
|
1705
|
+
socketMode?: "subscription";
|
|
1706
|
+
}): Omit<RaybaseAgentTokenClaims, "iat" | "exp" | "nonce"> & {
|
|
1707
|
+
ttlSeconds: number;
|
|
1708
|
+
};
|
|
1709
|
+
export declare function assertAgentTokenMatchesInstance(claims: RaybaseAgentTokenClaims, instance: RaybaseAgentInstanceRow): void;
|
|
1710
|
+
export declare function assertAgentTokenConversationAccess(control: SqlExecutor, claims: RaybaseAgentTokenClaims, instance: RaybaseAgentInstanceRow): Promise<{
|
|
1711
|
+
membership: RaybaseAgentRoomMemberRow | null;
|
|
1712
|
+
}>;
|
|
1713
|
+
export declare function extractBearerToken(request: Request): string | null;
|
|
1714
|
+
export declare function raybaseActionToAiTool<Env, Schema extends RaybaseSchema = RaybaseSchema>(action: RaybaseAction<unknown, unknown, Env, Schema>, contextFactory: (input: {
|
|
1715
|
+
organizationId?: string | null;
|
|
1716
|
+
toolCallId: string;
|
|
1717
|
+
}) => Promise<RaybaseAgentActionContext<Env, Schema>> | RaybaseAgentActionContext<Env, Schema>): Tool;
|
|
1718
|
+
export type RaybaseAgentActionContext<Env = unknown, Schema extends RaybaseSchema = RaybaseSchema> = {
|
|
1719
|
+
request: Request;
|
|
1720
|
+
env: Env;
|
|
1721
|
+
config: RaybaseConfig;
|
|
1722
|
+
user?: RaybaseUser;
|
|
1723
|
+
principal: RaybaseAgentPrincipal;
|
|
1724
|
+
agentName: string;
|
|
1725
|
+
/** The agent definition's `scopes`, carried onto the agent principal. */
|
|
1726
|
+
agentScopes?: readonly string[];
|
|
1727
|
+
/** The owning run's execution trigger, so actions can gate by run type. */
|
|
1728
|
+
trigger?: {
|
|
1729
|
+
type: RaybaseAgentExecutionTriggerType;
|
|
1730
|
+
purpose?: string;
|
|
1731
|
+
};
|
|
1732
|
+
conversationId: string;
|
|
1733
|
+
/**
|
|
1734
|
+
* Membership-checked reader for another conversation the acting user
|
|
1735
|
+
* belongs to. Direct turns only; a room turn's action context leaves it out.
|
|
1736
|
+
*/
|
|
1737
|
+
conversations?: RaybaseActionContext<Env, Schema>["conversations"];
|
|
1738
|
+
runId: string;
|
|
1739
|
+
requestId: string;
|
|
1740
|
+
toolCallId: string;
|
|
1741
|
+
route: string;
|
|
1742
|
+
surface: string;
|
|
1743
|
+
organizationId?: string | null;
|
|
1744
|
+
db: RaybaseActionDataClient<Schema>;
|
|
1745
|
+
agents?: RaybaseAgentInvocationRuntime;
|
|
1746
|
+
ai: RaybaseAI;
|
|
1747
|
+
audit: (event: RaybaseAuditContextEvent) => Promise<void>;
|
|
1748
|
+
agentInstanceId?: string;
|
|
1749
|
+
} & Pick<RaybaseActionContext<Env, Schema>, "settings" | "notifications" | "jobs">;
|
|
1750
|
+
export declare function executeRaybaseAgentAction<Env, Schema extends RaybaseSchema = RaybaseSchema>(action: RaybaseAction<unknown, unknown, Env, Schema>, rawInput: unknown, ctx: RaybaseAgentActionContext<Env, Schema> & {
|
|
1751
|
+
control?: SqlExecutor;
|
|
1752
|
+
}): Promise<unknown>;
|
|
1753
|
+
export declare function agentLimits<Env, Schema extends RaybaseSchema = RaybaseSchema>(config: RaybaseConfig, agent: RaybaseAgent<Env, Schema>): Required<Pick<RaybaseAgentLimits, "maxInputChars" | "maxOutputTokens" | "maxToolCallsPerTurn" | "maxLoopStepsPerTurn" | "maxConversationMessages">> & RaybaseAgentLimits;
|
|
1754
|
+
export declare function agentCompaction<Env, Schema extends RaybaseSchema = RaybaseSchema>(agent: RaybaseAgent<Env, Schema>): Required<Omit<RaybaseAgentCompaction, "model">> & Pick<RaybaseAgentCompaction, "model">;
|
|
1755
|
+
/**
|
|
1756
|
+
* Output-token budget for one chapter-close summarization call, proportional
|
|
1757
|
+
* to the span being summarized:
|
|
1758
|
+
* clamp(minSummaryOutputTokens, round(summarySpanRatio × spanChars/4),
|
|
1759
|
+
* maxSummaryOutputTokens). `spanChars` is the total content length of the
|
|
1760
|
+
* messages actually being closed, so a three-message exchange keeps the floor
|
|
1761
|
+
* while a twenty-turn working session gets room for its settled facts.
|
|
1762
|
+
* The ceiling wins over the floor when a pinned `maxSummaryOutputTokens`
|
|
1763
|
+
* sits below the (defaulted) floor: an app that pinned the old flat budget
|
|
1764
|
+
* keeps exactly its pre-proportional summaries.
|
|
1765
|
+
*/
|
|
1766
|
+
export declare function agentSummaryBudgetTokens(compaction: RaybaseAgentCompaction | undefined, spanChars: number): number;
|
|
1767
|
+
export declare function agentModel<Env, Schema extends RaybaseSchema = RaybaseSchema>(config: RaybaseConfig, agent: RaybaseAgent<Env, Schema>, runtimeDefaultModel?: string | null): string;
|
|
1768
|
+
export declare function actionEventUserId(principal: RaybaseAgentPrincipal): string;
|
|
1769
|
+
export declare function assertAgentConversationAccess(input: {
|
|
1770
|
+
/** Opaque first-party runtime scope metadata; Core leaves this unset. */
|
|
1771
|
+
organizationId?: string | null;
|
|
1772
|
+
control: SqlExecutor;
|
|
1773
|
+
instance: RaybaseAgentInstanceRow;
|
|
1774
|
+
access: RaybaseAgentAccess;
|
|
1775
|
+
require?: "member" | "owner";
|
|
1776
|
+
}): Promise<{
|
|
1777
|
+
membership: RaybaseAgentRoomMemberRow | null;
|
|
1778
|
+
}>;
|
|
1779
|
+
export declare function jsonSchemaObject(schema: JsonSchemaObject): JsonSchemaObject;
|
|
1780
|
+
//# sourceMappingURL=agent.d.ts.map
|