@kortix/sdk 0.9.98
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/README.md +313 -0
- package/dist/files/client.d.ts +96 -0
- package/dist/files/client.d.ts.map +1 -0
- package/dist/files/client.js +346 -0
- package/dist/files/client.js.map +1 -0
- package/dist/files/types.d.ts +82 -0
- package/dist/files/types.d.ts.map +1 -0
- package/dist/files/types.js +6 -0
- package/dist/files/types.js.map +1 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/kortix.d.ts +897 -0
- package/dist/kortix.d.ts.map +1 -0
- package/dist/kortix.js +772 -0
- package/dist/kortix.js.map +1 -0
- package/dist/opencode/client.d.ts +89 -0
- package/dist/opencode/client.d.ts.map +1 -0
- package/dist/opencode/client.js +191 -0
- package/dist/opencode/client.js.map +1 -0
- package/dist/opencode/env.d.ts +13 -0
- package/dist/opencode/env.d.ts.map +1 -0
- package/dist/opencode/env.js +63 -0
- package/dist/opencode/env.js.map +1 -0
- package/dist/opencode/kortix-master.d.ts +487 -0
- package/dist/opencode/kortix-master.d.ts.map +1 -0
- package/dist/opencode/kortix-master.js +313 -0
- package/dist/opencode/kortix-master.js.map +1 -0
- package/dist/opencode/triggers.d.ts +6 -0
- package/dist/opencode/triggers.d.ts.map +1 -0
- package/dist/opencode/triggers.js +34 -0
- package/dist/opencode/triggers.js.map +1 -0
- package/dist/platform/api/errors.d.ts +106 -0
- package/dist/platform/api/errors.d.ts.map +1 -0
- package/dist/platform/api/errors.js +137 -0
- package/dist/platform/api/errors.js.map +1 -0
- package/dist/platform/api-client.d.ts +35 -0
- package/dist/platform/api-client.d.ts.map +1 -0
- package/dist/platform/api-client.js +279 -0
- package/dist/platform/api-client.js.map +1 -0
- package/dist/platform/auth-core.d.ts +60 -0
- package/dist/platform/auth-core.d.ts.map +1 -0
- package/dist/platform/auth-core.js +104 -0
- package/dist/platform/auth-core.js.map +1 -0
- package/dist/platform/auth.d.ts +88 -0
- package/dist/platform/auth.d.ts.map +1 -0
- package/dist/platform/auth.js +161 -0
- package/dist/platform/auth.js.map +1 -0
- package/dist/platform/config-node.d.ts +33 -0
- package/dist/platform/config-node.d.ts.map +1 -0
- package/dist/platform/config-node.js +63 -0
- package/dist/platform/config-node.js.map +1 -0
- package/dist/platform/config.d.ts +77 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/config.js +62 -0
- package/dist/platform/config.js.map +1 -0
- package/dist/platform/feature-flags.d.ts +25 -0
- package/dist/platform/feature-flags.d.ts.map +1 -0
- package/dist/platform/feature-flags.js +114 -0
- package/dist/platform/feature-flags.js.map +1 -0
- package/dist/platform/fresh-sessions.d.ts +4 -0
- package/dist/platform/fresh-sessions.d.ts.map +1 -0
- package/dist/platform/fresh-sessions.js +22 -0
- package/dist/platform/fresh-sessions.js.map +1 -0
- package/dist/platform/instance-routes.d.ts +17 -0
- package/dist/platform/instance-routes.d.ts.map +1 -0
- package/dist/platform/instance-routes.js +105 -0
- package/dist/platform/instance-routes.js.map +1 -0
- package/dist/platform/logger.d.ts +20 -0
- package/dist/platform/logger.d.ts.map +1 -0
- package/dist/platform/logger.js +44 -0
- package/dist/platform/logger.js.map +1 -0
- package/dist/platform/opencode-errors.d.ts +20 -0
- package/dist/platform/opencode-errors.d.ts.map +1 -0
- package/dist/platform/opencode-errors.js +71 -0
- package/dist/platform/opencode-errors.js.map +1 -0
- package/dist/platform/platform-client/backups.d.ts +22 -0
- package/dist/platform/platform-client/backups.d.ts.map +1 -0
- package/dist/platform/platform-client/backups.js +16 -0
- package/dist/platform/platform-client/backups.js.map +1 -0
- package/dist/platform/platform-client/index.d.ts +21 -0
- package/dist/platform/platform-client/index.d.ts.map +1 -0
- package/dist/platform/platform-client/index.js +21 -0
- package/dist/platform/platform-client/index.js.map +1 -0
- package/dist/platform/platform-client/instance-admin.d.ts +67 -0
- package/dist/platform/platform-client/instance-admin.d.ts.map +1 -0
- package/dist/platform/platform-client/instance-admin.js +59 -0
- package/dist/platform/platform-client/instance-admin.js.map +1 -0
- package/dist/platform/platform-client/invites.d.ts +35 -0
- package/dist/platform/platform-client/invites.d.ts.map +1 -0
- package/dist/platform/platform-client/invites.js +25 -0
- package/dist/platform/platform-client/invites.js.map +1 -0
- package/dist/platform/platform-client/lifecycle.d.ts +78 -0
- package/dist/platform/platform-client/lifecycle.d.ts.map +1 -0
- package/dist/platform/platform-client/lifecycle.js +151 -0
- package/dist/platform/platform-client/lifecycle.js.map +1 -0
- package/dist/platform/platform-client/members.d.ts +81 -0
- package/dist/platform/platform-client/members.d.ts.map +1 -0
- package/dist/platform/platform-client/members.js +59 -0
- package/dist/platform/platform-client/members.js.map +1 -0
- package/dist/platform/platform-client/shared.d.ts +44 -0
- package/dist/platform/platform-client/shared.d.ts.map +1 -0
- package/dist/platform/platform-client/shared.js +177 -0
- package/dist/platform/platform-client/shared.js.map +1 -0
- package/dist/platform/platform-client/ssh.d.ts +29 -0
- package/dist/platform/platform-client/ssh.d.ts.map +1 -0
- package/dist/platform/platform-client/ssh.js +14 -0
- package/dist/platform/platform-client/ssh.js.map +1 -0
- package/dist/platform/platform-client/types.d.ts +56 -0
- package/dist/platform/platform-client/types.d.ts.map +1 -0
- package/dist/platform/platform-client/types.js +19 -0
- package/dist/platform/platform-client/types.js.map +1 -0
- package/dist/platform/platform-client/updates.d.ts +117 -0
- package/dist/platform/platform-client/updates.d.ts.map +1 -0
- package/dist/platform/platform-client/updates.js +97 -0
- package/dist/platform/platform-client/updates.js.map +1 -0
- package/dist/platform/platform-client/urls.d.ts +18 -0
- package/dist/platform/platform-client/urls.d.ts.map +1 -0
- package/dist/platform/platform-client/urls.js +31 -0
- package/dist/platform/platform-client/urls.js.map +1 -0
- package/dist/platform/projects-client/access.d.ts +273 -0
- package/dist/platform/projects-client/access.d.ts.map +1 -0
- package/dist/platform/projects-client/access.js +89 -0
- package/dist/platform/projects-client/access.js.map +1 -0
- package/dist/platform/projects-client/accounts.d.ts +184 -0
- package/dist/platform/projects-client/accounts.d.ts.map +1 -0
- package/dist/platform/projects-client/accounts.js +78 -0
- package/dist/platform/projects-client/accounts.js.map +1 -0
- package/dist/platform/projects-client/agent-config.d.ts +58 -0
- package/dist/platform/projects-client/agent-config.d.ts.map +1 -0
- package/dist/platform/projects-client/agent-config.js +9 -0
- package/dist/platform/projects-client/agent-config.js.map +1 -0
- package/dist/platform/projects-client/agent-scope.d.ts +12 -0
- package/dist/platform/projects-client/agent-scope.d.ts.map +1 -0
- package/dist/platform/projects-client/agent-scope.js +6 -0
- package/dist/platform/projects-client/agent-scope.js.map +1 -0
- package/dist/platform/projects-client/apps.d.ts +98 -0
- package/dist/platform/projects-client/apps.d.ts.map +1 -0
- package/dist/platform/projects-client/apps.js +29 -0
- package/dist/platform/projects-client/apps.js.map +1 -0
- package/dist/platform/projects-client/audit.d.ts +85 -0
- package/dist/platform/projects-client/audit.d.ts.map +1 -0
- package/dist/platform/projects-client/audit.js +51 -0
- package/dist/platform/projects-client/audit.js.map +1 -0
- package/dist/platform/projects-client/billing.d.ts +336 -0
- package/dist/platform/projects-client/billing.d.ts.map +1 -0
- package/dist/platform/projects-client/billing.js +260 -0
- package/dist/platform/projects-client/billing.js.map +1 -0
- package/dist/platform/projects-client/change-requests.d.ts +119 -0
- package/dist/platform/projects-client/change-requests.d.ts.map +1 -0
- package/dist/platform/projects-client/change-requests.js +56 -0
- package/dist/platform/projects-client/change-requests.js.map +1 -0
- package/dist/platform/projects-client/channels.d.ts +135 -0
- package/dist/platform/projects-client/channels.d.ts.map +1 -0
- package/dist/platform/projects-client/channels.js +103 -0
- package/dist/platform/projects-client/channels.js.map +1 -0
- package/dist/platform/projects-client/connectors.d.ts +148 -0
- package/dist/platform/projects-client/connectors.d.ts.map +1 -0
- package/dist/platform/projects-client/connectors.js +66 -0
- package/dist/platform/projects-client/connectors.js.map +1 -0
- package/dist/platform/projects-client/files.d.ts +37 -0
- package/dist/platform/projects-client/files.d.ts.map +1 -0
- package/dist/platform/projects-client/files.js +58 -0
- package/dist/platform/projects-client/files.js.map +1 -0
- package/dist/platform/projects-client/gateway.d.ts +177 -0
- package/dist/platform/projects-client/gateway.d.ts.map +1 -0
- package/dist/platform/projects-client/gateway.js +59 -0
- package/dist/platform/projects-client/gateway.js.map +1 -0
- package/dist/platform/projects-client/git-history.d.ts +74 -0
- package/dist/platform/projects-client/git-history.d.ts.map +1 -0
- package/dist/platform/projects-client/git-history.js +40 -0
- package/dist/platform/projects-client/git-history.js.map +1 -0
- package/dist/platform/projects-client/github.d.ts +62 -0
- package/dist/platform/projects-client/github.d.ts.map +1 -0
- package/dist/platform/projects-client/github.js +30 -0
- package/dist/platform/projects-client/github.js.map +1 -0
- package/dist/platform/projects-client/index.d.ts +32 -0
- package/dist/platform/projects-client/index.d.ts.map +1 -0
- package/dist/platform/projects-client/index.js +34 -0
- package/dist/platform/projects-client/index.js.map +1 -0
- package/dist/platform/projects-client/marketplace-catalog.d.ts +76 -0
- package/dist/platform/projects-client/marketplace-catalog.d.ts.map +1 -0
- package/dist/platform/projects-client/marketplace-catalog.js +48 -0
- package/dist/platform/projects-client/marketplace-catalog.js.map +1 -0
- package/dist/platform/projects-client/marketplace.d.ts +80 -0
- package/dist/platform/projects-client/marketplace.d.ts.map +1 -0
- package/dist/platform/projects-client/marketplace.js +52 -0
- package/dist/platform/projects-client/marketplace.js.map +1 -0
- package/dist/platform/projects-client/model-defaults.d.ts +36 -0
- package/dist/platform/projects-client/model-defaults.d.ts.map +1 -0
- package/dist/platform/projects-client/model-defaults.js +16 -0
- package/dist/platform/projects-client/model-defaults.js.map +1 -0
- package/dist/platform/projects-client/policies.d.ts +21 -0
- package/dist/platform/projects-client/policies.d.ts.map +1 -0
- package/dist/platform/projects-client/policies.js +10 -0
- package/dist/platform/projects-client/policies.js.map +1 -0
- package/dist/platform/projects-client/projects.d.ts +235 -0
- package/dist/platform/projects-client/projects.d.ts.map +1 -0
- package/dist/platform/projects-client/projects.js +161 -0
- package/dist/platform/projects-client/projects.js.map +1 -0
- package/dist/platform/projects-client/public-session-shares.d.ts +52 -0
- package/dist/platform/projects-client/public-session-shares.d.ts.map +1 -0
- package/dist/platform/projects-client/public-session-shares.js +54 -0
- package/dist/platform/projects-client/public-session-shares.js.map +1 -0
- package/dist/platform/projects-client/review.d.ts +57 -0
- package/dist/platform/projects-client/review.d.ts.map +1 -0
- package/dist/platform/projects-client/review.js +28 -0
- package/dist/platform/projects-client/review.js.map +1 -0
- package/dist/platform/projects-client/sandbox-shares.d.ts +25 -0
- package/dist/platform/projects-client/sandbox-shares.d.ts.map +1 -0
- package/dist/platform/projects-client/sandbox-shares.js +29 -0
- package/dist/platform/projects-client/sandbox-shares.js.map +1 -0
- package/dist/platform/projects-client/sandbox.d.ts +123 -0
- package/dist/platform/projects-client/sandbox.d.ts.map +1 -0
- package/dist/platform/projects-client/sandbox.js +45 -0
- package/dist/platform/projects-client/sandbox.js.map +1 -0
- package/dist/platform/projects-client/secrets.d.ts +122 -0
- package/dist/platform/projects-client/secrets.d.ts.map +1 -0
- package/dist/platform/projects-client/secrets.js +34 -0
- package/dist/platform/projects-client/secrets.js.map +1 -0
- package/dist/platform/projects-client/session-sandbox.d.ts +61 -0
- package/dist/platform/projects-client/session-sandbox.d.ts.map +1 -0
- package/dist/platform/projects-client/session-sandbox.js +82 -0
- package/dist/platform/projects-client/session-sandbox.js.map +1 -0
- package/dist/platform/projects-client/sessions.d.ts +216 -0
- package/dist/platform/projects-client/sessions.d.ts.map +1 -0
- package/dist/platform/projects-client/sessions.js +74 -0
- package/dist/platform/projects-client/sessions.js.map +1 -0
- package/dist/platform/projects-client/setup-links.d.ts +35 -0
- package/dist/platform/projects-client/setup-links.d.ts.map +1 -0
- package/dist/platform/projects-client/setup-links.js +24 -0
- package/dist/platform/projects-client/setup-links.js.map +1 -0
- package/dist/platform/projects-client/shared.d.ts +66 -0
- package/dist/platform/projects-client/shared.d.ts.map +1 -0
- package/dist/platform/projects-client/shared.js +44 -0
- package/dist/platform/projects-client/shared.js.map +1 -0
- package/dist/platform/projects-client/tokens.d.ts +77 -0
- package/dist/platform/projects-client/tokens.d.ts.map +1 -0
- package/dist/platform/projects-client/tokens.js +43 -0
- package/dist/platform/projects-client/tokens.js.map +1 -0
- package/dist/platform/projects-client/transcription.d.ts +5 -0
- package/dist/platform/projects-client/transcription.d.ts.map +1 -0
- package/dist/platform/projects-client/transcription.js +14 -0
- package/dist/platform/projects-client/transcription.js.map +1 -0
- package/dist/platform/projects-client/triggers.d.ts +102 -0
- package/dist/platform/projects-client/triggers.d.ts.map +1 -0
- package/dist/platform/projects-client/triggers.js +27 -0
- package/dist/platform/projects-client/triggers.js.map +1 -0
- package/dist/platform/session-id.d.ts +9 -0
- package/dist/platform/session-id.d.ts.map +1 -0
- package/dist/platform/session-id.js +23 -0
- package/dist/platform/session-id.js.map +1 -0
- package/dist/platform/storage/managed-storage.d.ts +97 -0
- package/dist/platform/storage/managed-storage.d.ts.map +1 -0
- package/dist/platform/storage/managed-storage.js +271 -0
- package/dist/platform/storage/managed-storage.js.map +1 -0
- package/dist/platform/strings.d.ts +12 -0
- package/dist/platform/strings.d.ts.map +1 -0
- package/dist/platform/strings.js +17 -0
- package/dist/platform/strings.js.map +1 -0
- package/dist/platform/ui.d.ts +11 -0
- package/dist/platform/ui.d.ts.map +1 -0
- package/dist/platform/ui.js +22 -0
- package/dist/platform/ui.js.map +1 -0
- package/dist/react/chat/index.d.ts +3 -0
- package/dist/react/chat/index.d.ts.map +1 -0
- package/dist/react/chat/index.js +7 -0
- package/dist/react/chat/index.js.map +1 -0
- package/dist/react/chat/render-parts.d.ts +39 -0
- package/dist/react/chat/render-parts.d.ts.map +1 -0
- package/dist/react/chat/render-parts.js +34 -0
- package/dist/react/chat/render-parts.js.map +1 -0
- package/dist/react/chat/use-chat-turns.d.ts +19 -0
- package/dist/react/chat/use-chat-turns.d.ts.map +1 -0
- package/dist/react/chat/use-chat-turns.js +27 -0
- package/dist/react/chat/use-chat-turns.js.map +1 -0
- package/dist/react/file-keys.d.ts +18 -0
- package/dist/react/file-keys.d.ts.map +1 -0
- package/dist/react/file-keys.js +18 -0
- package/dist/react/file-keys.js.map +1 -0
- package/dist/react/index.d.ts +12 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +49 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/model-flatten.d.ts +33 -0
- package/dist/react/model-flatten.d.ts.map +1 -0
- package/dist/react/model-flatten.js +59 -0
- package/dist/react/model-flatten.js.map +1 -0
- package/dist/react/opencode.d.ts +43 -0
- package/dist/react/opencode.d.ts.map +1 -0
- package/dist/react/opencode.js +100 -0
- package/dist/react/opencode.js.map +1 -0
- package/dist/react/prefetch-session-start.d.ts +10 -0
- package/dist/react/prefetch-session-start.d.ts.map +1 -0
- package/dist/react/prefetch-session-start.js +17 -0
- package/dist/react/prefetch-session-start.js.map +1 -0
- package/dist/react/provider-refresh.d.ts +7 -0
- package/dist/react/provider-refresh.d.ts.map +1 -0
- package/dist/react/provider-refresh.js +28 -0
- package/dist/react/provider-refresh.js.map +1 -0
- package/dist/react/provider-selection.d.ts +31 -0
- package/dist/react/provider-selection.d.ts.map +1 -0
- package/dist/react/provider-selection.js +135 -0
- package/dist/react/provider-selection.js.map +1 -0
- package/dist/react/route-project.d.ts +7 -0
- package/dist/react/route-project.d.ts.map +1 -0
- package/dist/react/route-project.js +19 -0
- package/dist/react/route-project.js.map +1 -0
- package/dist/react/session-start-stash.d.ts +56 -0
- package/dist/react/session-start-stash.d.ts.map +1 -0
- package/dist/react/session-start-stash.js +202 -0
- package/dist/react/session-start-stash.js.map +1 -0
- package/dist/react/use-canonical-opencode-session.d.ts +35 -0
- package/dist/react/use-canonical-opencode-session.d.ts.map +1 -0
- package/dist/react/use-canonical-opencode-session.js +52 -0
- package/dist/react/use-canonical-opencode-session.js.map +1 -0
- package/dist/react/use-change-requests.d.ts +321 -0
- package/dist/react/use-change-requests.d.ts.map +1 -0
- package/dist/react/use-change-requests.js +43 -0
- package/dist/react/use-change-requests.js.map +1 -0
- package/dist/react/use-current-runtime.d.ts +8 -0
- package/dist/react/use-current-runtime.d.ts.map +1 -0
- package/dist/react/use-current-runtime.js +12 -0
- package/dist/react/use-current-runtime.js.map +1 -0
- package/dist/react/use-gateway-catalog-sync.d.ts +2 -0
- package/dist/react/use-gateway-catalog-sync.d.ts.map +1 -0
- package/dist/react/use-gateway-catalog-sync.js +39 -0
- package/dist/react/use-gateway-catalog-sync.js.map +1 -0
- package/dist/react/use-kortix-master.d.ts +384 -0
- package/dist/react/use-kortix-master.d.ts.map +1 -0
- package/dist/react/use-kortix-master.js +958 -0
- package/dist/react/use-kortix-master.js.map +1 -0
- package/dist/react/use-model-store.d.ts +71 -0
- package/dist/react/use-model-store.d.ts.map +1 -0
- package/dist/react/use-model-store.js +411 -0
- package/dist/react/use-model-store.js.map +1 -0
- package/dist/react/use-opencode-config.d.ts +15 -0
- package/dist/react/use-opencode-config.d.ts.map +1 -0
- package/dist/react/use-opencode-config.js +79 -0
- package/dist/react/use-opencode-config.js.map +1 -0
- package/dist/react/use-opencode-events/diagnostics.d.ts +11 -0
- package/dist/react/use-opencode-events/diagnostics.d.ts.map +1 -0
- package/dist/react/use-opencode-events/diagnostics.js +58 -0
- package/dist/react/use-opencode-events/diagnostics.js.map +1 -0
- package/dist/react/use-opencode-events/handle-event.d.ts +20 -0
- package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -0
- package/dist/react/use-opencode-events/handle-event.js +450 -0
- package/dist/react/use-opencode-events/handle-event.js.map +1 -0
- package/dist/react/use-opencode-events/helpers.d.ts +30 -0
- package/dist/react/use-opencode-events/helpers.d.ts.map +1 -0
- package/dist/react/use-opencode-events/helpers.js +93 -0
- package/dist/react/use-opencode-events/helpers.js.map +1 -0
- package/dist/react/use-opencode-events/index.d.ts +25 -0
- package/dist/react/use-opencode-events/index.d.ts.map +1 -0
- package/dist/react/use-opencode-events/index.js +242 -0
- package/dist/react/use-opencode-events/index.js.map +1 -0
- package/dist/react/use-opencode-events/types.d.ts +10 -0
- package/dist/react/use-opencode-events/types.d.ts.map +1 -0
- package/dist/react/use-opencode-events/types.js +2 -0
- package/dist/react/use-opencode-events/types.js.map +1 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +22 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.js +158 -0
- package/dist/react/use-opencode-events/use-event-stream-refs.js.map +1 -0
- package/dist/react/use-opencode-local.d.ts +139 -0
- package/dist/react/use-opencode-local.d.ts.map +1 -0
- package/dist/react/use-opencode-local.js +484 -0
- package/dist/react/use-opencode-local.js.map +1 -0
- package/dist/react/use-opencode-mcp.d.ts +34 -0
- package/dist/react/use-opencode-mcp.d.ts.map +1 -0
- package/dist/react/use-opencode-mcp.js +190 -0
- package/dist/react/use-opencode-mcp.js.map +1 -0
- package/dist/react/use-opencode-pty.d.ts +30 -0
- package/dist/react/use-opencode-pty.d.ts.map +1 -0
- package/dist/react/use-opencode-pty.js +126 -0
- package/dist/react/use-opencode-pty.js.map +1 -0
- package/dist/react/use-opencode-sessions/agents.d.ts +14 -0
- package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/agents.js +82 -0
- package/dist/react/use-opencode-sessions/agents.js.map +1 -0
- package/dist/react/use-opencode-sessions/commands.d.ts +8 -0
- package/dist/react/use-opencode-sessions/commands.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/commands.js +46 -0
- package/dist/react/use-opencode-sessions/commands.js.map +1 -0
- package/dist/react/use-opencode-sessions/files.d.ts +2 -0
- package/dist/react/use-opencode-sessions/files.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/files.js +181 -0
- package/dist/react/use-opencode-sessions/files.js.map +1 -0
- package/dist/react/use-opencode-sessions/index.d.ts +15 -0
- package/dist/react/use-opencode-sessions/index.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/index.js +21 -0
- package/dist/react/use-opencode-sessions/index.js.map +1 -0
- package/dist/react/use-opencode-sessions/keys.d.ts +94 -0
- package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/keys.js +39 -0
- package/dist/react/use-opencode-sessions/keys.js.map +1 -0
- package/dist/react/use-opencode-sessions/mcp.d.ts +3 -0
- package/dist/react/use-opencode-sessions/mcp.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/mcp.js +23 -0
- package/dist/react/use-opencode-sessions/mcp.js.map +1 -0
- package/dist/react/use-opencode-sessions/messages.d.ts +75 -0
- package/dist/react/use-opencode-sessions/messages.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/messages.js +319 -0
- package/dist/react/use-opencode-sessions/messages.js.map +1 -0
- package/dist/react/use-opencode-sessions/parts.d.ts +23 -0
- package/dist/react/use-opencode-sessions/parts.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/parts.js +49 -0
- package/dist/react/use-opencode-sessions/parts.js.map +1 -0
- package/dist/react/use-opencode-sessions/permissions.d.ts +17 -0
- package/dist/react/use-opencode-sessions/permissions.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/permissions.js +66 -0
- package/dist/react/use-opencode-sessions/permissions.js.map +1 -0
- package/dist/react/use-opencode-sessions/projects.d.ts +5 -0
- package/dist/react/use-opencode-sessions/projects.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/projects.js +54 -0
- package/dist/react/use-opencode-sessions/projects.js.map +1 -0
- package/dist/react/use-opencode-sessions/providers.d.ts +10 -0
- package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/providers.js +98 -0
- package/dist/react/use-opencode-sessions/providers.js.map +1 -0
- package/dist/react/use-opencode-sessions/sessions.d.ts +35 -0
- package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/sessions.js +380 -0
- package/dist/react/use-opencode-sessions/sessions.js.map +1 -0
- package/dist/react/use-opencode-sessions/shared.d.ts +43 -0
- package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/shared.js +109 -0
- package/dist/react/use-opencode-sessions/shared.js.map +1 -0
- package/dist/react/use-opencode-sessions/sharing.d.ts +4 -0
- package/dist/react/use-opencode-sessions/sharing.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/sharing.js +57 -0
- package/dist/react/use-opencode-sessions/sharing.js.map +1 -0
- package/dist/react/use-opencode-sessions/tools.d.ts +5 -0
- package/dist/react/use-opencode-sessions/tools.d.ts.map +1 -0
- package/dist/react/use-opencode-sessions/tools.js +54 -0
- package/dist/react/use-opencode-sessions/tools.js.map +1 -0
- package/dist/react/use-permission-self-heal.d.ts +45 -0
- package/dist/react/use-permission-self-heal.d.ts.map +1 -0
- package/dist/react/use-permission-self-heal.js +144 -0
- package/dist/react/use-permission-self-heal.js.map +1 -0
- package/dist/react/use-project-config.d.ts +11 -0
- package/dist/react/use-project-config.d.ts.map +1 -0
- package/dist/react/use-project-config.js +22 -0
- package/dist/react/use-project-config.js.map +1 -0
- package/dist/react/use-project-models.d.ts +11 -0
- package/dist/react/use-project-models.d.ts.map +1 -0
- package/dist/react/use-project-models.js +25 -0
- package/dist/react/use-project-models.js.map +1 -0
- package/dist/react/use-project-secrets.d.ts +265 -0
- package/dist/react/use-project-secrets.d.ts.map +1 -0
- package/dist/react/use-project-secrets.js +41 -0
- package/dist/react/use-project-secrets.js.map +1 -0
- package/dist/react/use-project-triggers.d.ts +228 -0
- package/dist/react/use-project-triggers.d.ts.map +1 -0
- package/dist/react/use-project-triggers.js +42 -0
- package/dist/react/use-project-triggers.js.map +1 -0
- package/dist/react/use-question-self-heal.d.ts +36 -0
- package/dist/react/use-question-self-heal.d.ts.map +1 -0
- package/dist/react/use-question-self-heal.js +95 -0
- package/dist/react/use-question-self-heal.js.map +1 -0
- package/dist/react/use-runtime-phase.d.ts +9 -0
- package/dist/react/use-runtime-phase.d.ts.map +1 -0
- package/dist/react/use-runtime-phase.js +20 -0
- package/dist/react/use-runtime-phase.js.map +1 -0
- package/dist/react/use-runtime-reconnect.d.ts +90 -0
- package/dist/react/use-runtime-reconnect.d.ts.map +1 -0
- package/dist/react/use-runtime-reconnect.js +234 -0
- package/dist/react/use-runtime-reconnect.js.map +1 -0
- package/dist/react/use-session-picks.d.ts +17 -0
- package/dist/react/use-session-picks.d.ts.map +1 -0
- package/dist/react/use-session-picks.js +36 -0
- package/dist/react/use-session-picks.js.map +1 -0
- package/dist/react/use-session-prefetch.d.ts +18 -0
- package/dist/react/use-session-prefetch.d.ts.map +1 -0
- package/dist/react/use-session-prefetch.js +84 -0
- package/dist/react/use-session-prefetch.js.map +1 -0
- package/dist/react/use-session-send.d.ts +183 -0
- package/dist/react/use-session-send.d.ts.map +1 -0
- package/dist/react/use-session-send.js +287 -0
- package/dist/react/use-session-send.js.map +1 -0
- package/dist/react/use-session-sync.d.ts +24 -0
- package/dist/react/use-session-sync.d.ts.map +1 -0
- package/dist/react/use-session-sync.js +375 -0
- package/dist/react/use-session-sync.js.map +1 -0
- package/dist/react/use-session.d.ts +171 -0
- package/dist/react/use-session.d.ts.map +1 -0
- package/dist/react/use-session.js +396 -0
- package/dist/react/use-session.js.map +1 -0
- package/dist/react/use-visible-agents.d.ts +22 -0
- package/dist/react/use-visible-agents.d.ts.map +1 -0
- package/dist/react/use-visible-agents.js +45 -0
- package/dist/react/use-visible-agents.js.map +1 -0
- package/dist/server.d.ts +55 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +122 -0
- package/dist/server.js.map +1 -0
- package/dist/session/health.d.ts +49 -0
- package/dist/session/health.d.ts.map +1 -0
- package/dist/session/health.js +57 -0
- package/dist/session/health.js.map +1 -0
- package/dist/session/index.d.ts +19 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +19 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/preview.d.ts +24 -0
- package/dist/session/preview.d.ts.map +1 -0
- package/dist/session/preview.js +85 -0
- package/dist/session/preview.js.map +1 -0
- package/dist/session/url.d.ts +160 -0
- package/dist/session/url.d.ts.map +1 -0
- package/dist/session/url.js +522 -0
- package/dist/session/url.js.map +1 -0
- package/dist/state/chat-events.d.ts +141 -0
- package/dist/state/chat-events.d.ts.map +1 -0
- package/dist/state/chat-events.js +135 -0
- package/dist/state/chat-events.js.map +1 -0
- package/dist/state/current-runtime.d.ts +44 -0
- package/dist/state/current-runtime.d.ts.map +1 -0
- package/dist/state/current-runtime.js +44 -0
- package/dist/state/current-runtime.js.map +1 -0
- package/dist/state/diagnostics-store.d.ts +114 -0
- package/dist/state/diagnostics-store.d.ts.map +1 -0
- package/dist/state/diagnostics-store.js +319 -0
- package/dist/state/diagnostics-store.js.map +1 -0
- package/dist/state/event-stream.d.ts +134 -0
- package/dist/state/event-stream.d.ts.map +1 -0
- package/dist/state/event-stream.js +424 -0
- package/dist/state/event-stream.js.map +1 -0
- package/dist/state/idb-sync-cache.d.ts +18 -0
- package/dist/state/idb-sync-cache.d.ts.map +1 -0
- package/dist/state/idb-sync-cache.js +209 -0
- package/dist/state/idb-sync-cache.js.map +1 -0
- package/dist/state/opencode-compaction-store.d.ts +10 -0
- package/dist/state/opencode-compaction-store.d.ts.map +1 -0
- package/dist/state/opencode-compaction-store.js +32 -0
- package/dist/state/opencode-compaction-store.js.map +1 -0
- package/dist/state/opencode-pending-store.d.ts +19 -0
- package/dist/state/opencode-pending-store.d.ts.map +1 -0
- package/dist/state/opencode-pending-store.js +76 -0
- package/dist/state/opencode-pending-store.js.map +1 -0
- package/dist/state/sandbox-connection-store.d.ts +62 -0
- package/dist/state/sandbox-connection-store.d.ts.map +1 -0
- package/dist/state/sandbox-connection-store.js +290 -0
- package/dist/state/sandbox-connection-store.js.map +1 -0
- package/dist/state/server-store/active.d.ts +49 -0
- package/dist/state/server-store/active.d.ts.map +1 -0
- package/dist/state/server-store/active.js +76 -0
- package/dist/state/server-store/active.js.map +1 -0
- package/dist/state/server-store/types.d.ts +12 -0
- package/dist/state/server-store/types.d.ts.map +1 -0
- package/dist/state/server-store/types.js +2 -0
- package/dist/state/server-store/types.js.map +1 -0
- package/dist/state/server-store/url-helpers.d.ts +33 -0
- package/dist/state/server-store/url-helpers.d.ts.map +1 -0
- package/dist/state/server-store/url-helpers.js +55 -0
- package/dist/state/server-store/url-helpers.js.map +1 -0
- package/dist/state/server-store.d.ts +18 -0
- package/dist/state/server-store.d.ts.map +1 -0
- package/dist/state/server-store.js +23 -0
- package/dist/state/server-store.js.map +1 -0
- package/dist/state/session-runtime-registry.d.ts +49 -0
- package/dist/state/session-runtime-registry.d.ts.map +1 -0
- package/dist/state/session-runtime-registry.js +85 -0
- package/dist/state/session-runtime-registry.js.map +1 -0
- package/dist/state/sync-store/ascending-id.d.ts +2 -0
- package/dist/state/sync-store/ascending-id.d.ts.map +1 -0
- package/dist/state/sync-store/ascending-id.js +21 -0
- package/dist/state/sync-store/ascending-id.js.map +1 -0
- package/dist/state/sync-store/binary.d.ts +7 -0
- package/dist/state/sync-store/binary.d.ts.map +1 -0
- package/dist/state/sync-store/binary.js +21 -0
- package/dist/state/sync-store/binary.js.map +1 -0
- package/dist/state/sync-store/stream-cache.d.ts +2 -0
- package/dist/state/sync-store/stream-cache.d.ts.map +1 -0
- package/dist/state/sync-store/stream-cache.js +29 -0
- package/dist/state/sync-store/stream-cache.js.map +1 -0
- package/dist/state/sync-store/types.d.ts +29 -0
- package/dist/state/sync-store/types.d.ts.map +1 -0
- package/dist/state/sync-store/types.js +2 -0
- package/dist/state/sync-store/types.js.map +1 -0
- package/dist/state/sync-store.d.ts +39 -0
- package/dist/state/sync-store.d.ts.map +1 -0
- package/dist/state/sync-store.js +692 -0
- package/dist/state/sync-store.js.map +1 -0
- package/dist/state/tab-store.d.ts +91 -0
- package/dist/state/tab-store.d.ts.map +1 -0
- package/dist/state/tab-store.js +369 -0
- package/dist/state/tab-store.js.map +1 -0
- package/dist/transcript.d.ts +40 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transcript.js +126 -0
- package/dist/transcript.js.map +1 -0
- package/dist/turns/classify.d.ts +166 -0
- package/dist/turns/classify.d.ts.map +1 -0
- package/dist/turns/classify.js +259 -0
- package/dist/turns/classify.js.map +1 -0
- package/dist/turns/errors.d.ts +11 -0
- package/dist/turns/errors.d.ts.map +1 -0
- package/dist/turns/errors.js +85 -0
- package/dist/turns/errors.js.map +1 -0
- package/dist/turns/index.d.ts +264 -0
- package/dist/turns/index.d.ts.map +1 -0
- package/dist/turns/index.js +1243 -0
- package/dist/turns/index.js.map +1 -0
- package/dist/turns/tool-registry.d.ts +33 -0
- package/dist/turns/tool-registry.d.ts.map +1 -0
- package/dist/turns/tool-registry.js +108 -0
- package/dist/turns/tool-registry.js.map +1 -0
- package/dist/turns/types.d.ts +125 -0
- package/dist/turns/types.d.ts.map +1 -0
- package/dist/turns/types.js +12 -0
- package/dist/turns/types.js.map +1 -0
- package/dist/turns/view-model.d.ts +127 -0
- package/dist/turns/view-model.d.ts.map +1 -0
- package/dist/turns/view-model.js +401 -0
- package/dist/turns/view-model.js.map +1 -0
- package/package.json +155 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Speech-to-text transcription — POSTs an audio file as multipart form-data.
|
|
2
|
+
import { backendApi } from '../api-client.js';
|
|
3
|
+
export async function transcribeAudio(audioFile) {
|
|
4
|
+
const formData = new FormData();
|
|
5
|
+
formData.append('audio_file', audioFile);
|
|
6
|
+
const response = await backendApi.upload('/transcription', formData, {
|
|
7
|
+
showErrors: true,
|
|
8
|
+
});
|
|
9
|
+
if (response.error) {
|
|
10
|
+
throw new Error(`Error transcribing audio: ${response.error.message} (${response.error.status})`);
|
|
11
|
+
}
|
|
12
|
+
return response.data;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=transcription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcription.js","sourceRoot":"","sources":["../../../src/platform/projects-client/transcription.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAe;IACnD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,MAAM,CAAwB,gBAAgB,EAAE,QAAQ,EAAE;QAC1F,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CACjF,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC,IAAK,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type ProjectTriggerType = 'cron' | 'webhook';
|
|
2
|
+
/** Parsed trigger spec — what the listing endpoint returns. */
|
|
3
|
+
export interface ProjectTrigger {
|
|
4
|
+
/** URL-safe slug (the filename minus `.md`). */
|
|
5
|
+
slug: string;
|
|
6
|
+
/** Where the entry is sourced from. Always `kortix.toml#triggers.<slug>`
|
|
7
|
+
* now that triggers are centralized in the manifest. */
|
|
8
|
+
path: string;
|
|
9
|
+
name: string;
|
|
10
|
+
type: ProjectTriggerType;
|
|
11
|
+
agent: string;
|
|
12
|
+
/** Wire-form model (`provider/model`) pinned to this trigger's runs, or
|
|
13
|
+
* null to resolve the default chain (agent → project → account →
|
|
14
|
+
* platform) at fire time. */
|
|
15
|
+
model: string | null;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
cron: string | null;
|
|
18
|
+
/** ISO-8601 instant for a one-off ("run once") schedule; null for recurring/webhook. */
|
|
19
|
+
run_at: string | null;
|
|
20
|
+
timezone: string;
|
|
21
|
+
/** project_secrets key holding the webhook HMAC secret. */
|
|
22
|
+
secret_env: string | null;
|
|
23
|
+
prompt_template: string;
|
|
24
|
+
last_fired_at: string | null;
|
|
25
|
+
/** Public fire URL for webhook triggers; null for cron. */
|
|
26
|
+
webhook_url: string | null;
|
|
27
|
+
}
|
|
28
|
+
/** Parse error surfaced by the listing endpoint so the UI can render
|
|
29
|
+
* broken triggers next to green ones. */
|
|
30
|
+
export interface ProjectTriggerParseError {
|
|
31
|
+
slug: string;
|
|
32
|
+
path: string;
|
|
33
|
+
error: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ProjectTriggerListing {
|
|
36
|
+
triggers: ProjectTrigger[];
|
|
37
|
+
errors: ProjectTriggerParseError[];
|
|
38
|
+
/**
|
|
39
|
+
* Server-side, per-project kill-switch (`projects.metadata.triggers_paused`).
|
|
40
|
+
* When true the platform auto-runs NONE of this project's triggers — the cron
|
|
41
|
+
* sweep skips it and inbound webhooks are acknowledged-but-ignored, regardless
|
|
42
|
+
* of each trigger's repo `enabled`. Manual `fire` still works. Use it to stop
|
|
43
|
+
* ONE repo deployed to two control planes (e.g. dev + prod) from double-firing.
|
|
44
|
+
*/
|
|
45
|
+
triggers_paused?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface CreateProjectTriggerInput {
|
|
48
|
+
/** Required — used as the title and shown in the UI. */
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional slug override. When omitted, derived from `name`. Once
|
|
52
|
+
* created, the slug is immutable (changing it would orphan runtime state).
|
|
53
|
+
*/
|
|
54
|
+
slug?: string;
|
|
55
|
+
type: ProjectTriggerType;
|
|
56
|
+
prompt_template: string;
|
|
57
|
+
/** Defaults to 'default'. */
|
|
58
|
+
agent?: string;
|
|
59
|
+
/** Wire-form model (`provider/model`). Omit or pass null to resolve the
|
|
60
|
+
* default chain (agent → project → account → platform) at fire time. */
|
|
61
|
+
model?: string | null;
|
|
62
|
+
enabled?: boolean;
|
|
63
|
+
/** For type='cron'. 6-field croner expression. Omit when using `run_at`. */
|
|
64
|
+
cron?: string;
|
|
65
|
+
/** For type='cron'. ISO-8601 instant for a one-off run. Mutually exclusive with `cron`. */
|
|
66
|
+
run_at?: string;
|
|
67
|
+
/** For type='cron'. IANA timezone. Defaults to 'UTC'. */
|
|
68
|
+
timezone?: string;
|
|
69
|
+
/** For type='webhook'. Name of a project_secrets entry. */
|
|
70
|
+
secret_env?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface UpdateProjectTriggerInput {
|
|
73
|
+
name?: string;
|
|
74
|
+
prompt_template?: string;
|
|
75
|
+
agent?: string;
|
|
76
|
+
/** Wire-form model (`provider/model`). null resets to the default chain. */
|
|
77
|
+
model?: string | null;
|
|
78
|
+
enabled?: boolean;
|
|
79
|
+
cron?: string;
|
|
80
|
+
timezone?: string;
|
|
81
|
+
secret_env?: string;
|
|
82
|
+
}
|
|
83
|
+
export declare function listProjectTriggers(projectId: string): Promise<ProjectTriggerListing>;
|
|
84
|
+
export declare function createProjectTrigger(projectId: string, input: CreateProjectTriggerInput): Promise<ProjectTriggerListing>;
|
|
85
|
+
export declare function updateProjectTrigger(projectId: string, slug: string, input: UpdateProjectTriggerInput): Promise<ProjectTriggerListing>;
|
|
86
|
+
export declare function deleteProjectTrigger(projectId: string, slug: string): Promise<{
|
|
87
|
+
ok: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Pause or resume ALL of a project's triggers server-side (the per-project
|
|
91
|
+
* kill-switch — see {@link ProjectTriggerListing.triggers_paused}). Returns the
|
|
92
|
+
* updated trigger listing, including the new `triggers_paused` value.
|
|
93
|
+
*/
|
|
94
|
+
export declare function setProjectTriggersActivation(projectId: string, paused: boolean): Promise<ProjectTriggerListing>;
|
|
95
|
+
export interface FireProjectTriggerResponse {
|
|
96
|
+
status: 'fired' | 'queued' | 'failed';
|
|
97
|
+
session_id?: string | null;
|
|
98
|
+
reason?: string;
|
|
99
|
+
error?: string;
|
|
100
|
+
}
|
|
101
|
+
export declare function fireProjectTrigger(projectId: string, slug: string): Promise<FireProjectTriggerResponse>;
|
|
102
|
+
//# sourceMappingURL=triggers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../src/platform/projects-client/triggers.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpD,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb;6DACyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd;;kCAE8B;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,wFAAwF;IACxF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;yCACyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,EAAE,wBAAwB,EAAE,CAAC;IACnC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAA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AIG;AACH,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,kCAQhB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uCAOvE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Triggers — cron/webhook triggers defined in the project manifest.
|
|
2
|
+
import { backendApi } from '../api-client.js';
|
|
3
|
+
import { unwrap } from './shared.js';
|
|
4
|
+
export async function listProjectTriggers(projectId) {
|
|
5
|
+
return unwrap(await backendApi.get(`/projects/${projectId}/triggers`));
|
|
6
|
+
}
|
|
7
|
+
export async function createProjectTrigger(projectId, input) {
|
|
8
|
+
return unwrap(await backendApi.post(`/projects/${projectId}/triggers`, input));
|
|
9
|
+
}
|
|
10
|
+
export async function updateProjectTrigger(projectId, slug, input) {
|
|
11
|
+
return unwrap(await backendApi.patch(`/projects/${projectId}/triggers/${slug}`, input));
|
|
12
|
+
}
|
|
13
|
+
export async function deleteProjectTrigger(projectId, slug) {
|
|
14
|
+
return unwrap(await backendApi.delete(`/projects/${projectId}/triggers/${slug}`));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pause or resume ALL of a project's triggers server-side (the per-project
|
|
18
|
+
* kill-switch — see {@link ProjectTriggerListing.triggers_paused}). Returns the
|
|
19
|
+
* updated trigger listing, including the new `triggers_paused` value.
|
|
20
|
+
*/
|
|
21
|
+
export async function setProjectTriggersActivation(projectId, paused) {
|
|
22
|
+
return unwrap(await backendApi.patch(`/projects/${projectId}/triggers/activation`, { paused }));
|
|
23
|
+
}
|
|
24
|
+
export async function fireProjectTrigger(projectId, slug) {
|
|
25
|
+
return unwrap(await backendApi.post(`/projects/${projectId}/triggers/${slug}/fire`, {}));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../../src/platform/projects-client/triggers.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAkGlC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,SAAiB;IACzD,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,GAAG,CAClB,aAAa,SAAS,WAAW,CAClC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,SAAiB,EACjB,KAAgC;IAEhC,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,IAAI,CACnB,aAAa,SAAS,WAAW,EACjC,KAAK,CACN,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,SAAiB,EACjB,IAAY,EACZ,KAAgC;IAEhC,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,KAAK,CACpB,aAAa,SAAS,aAAa,IAAI,EAAE,EACzC,KAAK,CACN,CACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,SAAiB,EAAE,IAAY;IACxE,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,MAAM,CACrB,aAAa,SAAS,aAAa,IAAI,EAAE,CAC1C,CACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,SAAiB,EACjB,MAAe;IAEf,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,KAAK,CACpB,aAAa,SAAS,sBAAsB,EAC5C,EAAE,MAAM,EAAE,CACX,CACF,CAAC;AACJ,CAAC;AASD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,SAAiB,EAAE,IAAY;IACtE,OAAO,MAAM,CACX,MAAM,UAAU,CAAC,IAAI,CACnB,aAAa,SAAS,aAAa,IAAI,OAAO,EAC9C,EAAE,CACH,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 4122 v4 id for a new session. `crypto.randomUUID` only exists in secure
|
|
3
|
+
* contexts (https or localhost), so a self-hosted white-label served over plain
|
|
4
|
+
* http on a LAN would throw. Fall back to `getRandomValues` (broadly available)
|
|
5
|
+
* and only then to `Math.random`. Owned by the SDK so every host generates
|
|
6
|
+
* session ids the same way instead of reimplementing the fallback.
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateSessionId(): string;
|
|
9
|
+
//# sourceMappingURL=session-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-id.d.ts","sourceRoot":"","sources":["../../src/platform/session-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RFC 4122 v4 id for a new session. `crypto.randomUUID` only exists in secure
|
|
3
|
+
* contexts (https or localhost), so a self-hosted white-label served over plain
|
|
4
|
+
* http on a LAN would throw. Fall back to `getRandomValues` (broadly available)
|
|
5
|
+
* and only then to `Math.random`. Owned by the SDK so every host generates
|
|
6
|
+
* session ids the same way instead of reimplementing the fallback.
|
|
7
|
+
*/
|
|
8
|
+
export function generateSessionId() {
|
|
9
|
+
const c = typeof crypto !== 'undefined' ? crypto : undefined;
|
|
10
|
+
if (c?.randomUUID)
|
|
11
|
+
return c.randomUUID();
|
|
12
|
+
const b = new Uint8Array(16);
|
|
13
|
+
if (c?.getRandomValues)
|
|
14
|
+
c.getRandomValues(b);
|
|
15
|
+
else
|
|
16
|
+
for (let i = 0; i < 16; i++)
|
|
17
|
+
b[i] = Math.floor(Math.random() * 256);
|
|
18
|
+
b[6] = (b[6] & 0x0f) | 0x40; // version 4
|
|
19
|
+
b[8] = (b[8] & 0x3f) | 0x80; // variant
|
|
20
|
+
const h = [...b].map((x) => x.toString(16).padStart(2, '0'));
|
|
21
|
+
return `${h[0]}${h[1]}${h[2]}${h[3]}-${h[4]}${h[5]}-${h[6]}${h[7]}-${h[8]}${h[9]}-${h.slice(10).join('')}`;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=session-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-id.js","sourceRoot":"","sources":["../../src/platform/session-id.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,CAAC,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7D,IAAI,CAAC,EAAE,UAAU;QAAE,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,eAAe;QAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;;QACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;YAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,YAAY;IACzC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,UAAU;IACvC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized, quota-resilient localStorage.
|
|
3
|
+
*
|
|
4
|
+
* The whole origin shares ONE ~5–10MB localStorage bucket. Every store, cache
|
|
5
|
+
* and feature flag writes into it. Historically a few caches were keyed by the
|
|
6
|
+
* *ephemeral* per-sandbox server id (`kortix_cache_sessions:<serverId>`, …) and
|
|
7
|
+
* never evicted — so every new session minted a fresh set of keys that piled up
|
|
8
|
+
* forever. Eventually the bucket saturated and the *next* `setItem` from *any*
|
|
9
|
+
* store threw `QuotaExceededError` synchronously, crashing whatever happened to
|
|
10
|
+
* write next (often something tiny and innocent, like the tab list).
|
|
11
|
+
*
|
|
12
|
+
* This module is the single chokepoint that keeps the bucket healthy:
|
|
13
|
+
*
|
|
14
|
+
* 1. `safeSetItem` NEVER throws. On a quota error it reclaims space by evicting
|
|
15
|
+
* the oldest *disposable* cache entries (across every registered family),
|
|
16
|
+
* then retries — and if it still can't fit, it gives up silently instead of
|
|
17
|
+
* crashing the UI. Losing a disposable cache is free; it just refetches.
|
|
18
|
+
* 2. `ScopedCache` is the right way to write a per-scope cache: it stamps each
|
|
19
|
+
* entry with a timestamp and prunes its family to the N most-recent scopes
|
|
20
|
+
* on every write, so an ephemeral key space can't grow unbounded.
|
|
21
|
+
* 3. `createSafeJSONStorage` gives every zustand `persist` store the same
|
|
22
|
+
* never-throw guarantee, so no store can ever be the crash site again.
|
|
23
|
+
*
|
|
24
|
+
* Anything that should be sacrificed under memory pressure must register its
|
|
25
|
+
* key family here (ScopedCache does this for you). Durable user preferences are
|
|
26
|
+
* deliberately NOT registered, so they survive a reclaim.
|
|
27
|
+
*/
|
|
28
|
+
import { type StateStorage } from 'zustand/middleware';
|
|
29
|
+
/**
|
|
30
|
+
* Register a `<prefix>:<scope>` key family as disposable. Entries under it may
|
|
31
|
+
* be evicted (oldest first) when the bucket is full. Idempotent.
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerDisposableFamily(prefix: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Register a single exact key (a self-contained cache blob, e.g. an internally
|
|
36
|
+
* LRU'd map) as disposable. These are evicted only as a LAST resort — after
|
|
37
|
+
* every scoped-family entry — since they tend to be already-bounded and more
|
|
38
|
+
* valuable than a stale per-sandbox snapshot. Idempotent.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerDisposableKey(key: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Write to localStorage without ever throwing. On a quota error, evict the
|
|
43
|
+
* oldest disposable entries one at a time, retrying after each eviction, until
|
|
44
|
+
* the write fits or there's nothing left to drop. The key being written is
|
|
45
|
+
* never evicted. Returns whether the value was ultimately persisted.
|
|
46
|
+
*/
|
|
47
|
+
export declare function safeSetItem(key: string, value: string): boolean;
|
|
48
|
+
export declare function safeGetItem(key: string): string | null;
|
|
49
|
+
export declare function safeRemoveItem(key: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* A localStorage-backed cache for data keyed by a *scope* (a server id, a
|
|
52
|
+
* directory, `'global'`, …). Each family is automatically capped to its
|
|
53
|
+
* `maxScopes` most-recently-written scopes, so an ephemeral scope space (e.g.
|
|
54
|
+
* per-sandbox server ids) can never grow without bound. Entries are also
|
|
55
|
+
* globally evictable under quota pressure (the family is registered as
|
|
56
|
+
* disposable on construction).
|
|
57
|
+
*
|
|
58
|
+
* Values are stored wrapped as `{ v, t }`; callers see only the unwrapped
|
|
59
|
+
* value. Legacy un-wrapped entries from before this layer existed simply read
|
|
60
|
+
* as a miss (and get rewritten in the new shape on the next set).
|
|
61
|
+
*/
|
|
62
|
+
export declare class ScopedCache<T> {
|
|
63
|
+
private readonly family;
|
|
64
|
+
private readonly maxScopes;
|
|
65
|
+
constructor(family: string, maxScopes: number);
|
|
66
|
+
private keyFor;
|
|
67
|
+
get(scope: string): T | undefined;
|
|
68
|
+
set(scope: string, value: T): void;
|
|
69
|
+
remove(scope: string): void;
|
|
70
|
+
/** Drop all but the `maxScopes` most-recently-written scopes in this family. */
|
|
71
|
+
prune(): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Prune every registered disposable family back to its cap and drop foreign /
|
|
75
|
+
* legacy un-stamped entries within those families. Call once on boot to reclaim
|
|
76
|
+
* space left by older builds that never evicted; cheap and idempotent.
|
|
77
|
+
*
|
|
78
|
+
* Pass the live ScopedCache instances so each family's own `maxScopes` is
|
|
79
|
+
* respected.
|
|
80
|
+
*/
|
|
81
|
+
export declare function pruneDisposableCaches(caches: ReadonlyArray<ScopedCache<unknown>>): void;
|
|
82
|
+
/**
|
|
83
|
+
* Prune every ScopedCache constructed so far back to its cap. Safe to call on
|
|
84
|
+
* boot to reclaim space left by older builds that never evicted. Only sees
|
|
85
|
+
* caches whose modules have loaded — but those are the large per-sandbox
|
|
86
|
+
* families, and they're imported as soon as the app shell mounts.
|
|
87
|
+
*/
|
|
88
|
+
export declare function pruneAllRegisteredCaches(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Shared zustand `StateStorage` that never throws. Every `persist(...)` store
|
|
91
|
+
* should route through this via `createSafeJSONStorage()` so a full bucket
|
|
92
|
+
* degrades to "preferences didn't save" instead of crashing the render.
|
|
93
|
+
*/
|
|
94
|
+
export declare const safeLocalStorage: StateStorage;
|
|
95
|
+
/** Drop-in replacement for `createJSONStorage(() => localStorage)`. */
|
|
96
|
+
export declare function createSafeJSONStorage<S>(): import("zustand/middleware").PersistStorage<S, unknown> | undefined;
|
|
97
|
+
//# sourceMappingURL=managed-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-storage.d.ts","sourceRoot":"","sources":["../../../src/platform/storage/managed-storage.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAO1E;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvD;AAyDD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAuB/D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOtD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOhD;AAYD;;;;;;;;;;;GAWG;AACH,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ7C,OAAO,CAAC,MAAM;IAId,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAejC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAOlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI3B,gFAAgF;IAChF,KAAK,IAAI,IAAI;CAcd;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAGvF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAM9B,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,CAAC,yEAEtC"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* Centralized, quota-resilient localStorage.
|
|
4
|
+
*
|
|
5
|
+
* The whole origin shares ONE ~5–10MB localStorage bucket. Every store, cache
|
|
6
|
+
* and feature flag writes into it. Historically a few caches were keyed by the
|
|
7
|
+
* *ephemeral* per-sandbox server id (`kortix_cache_sessions:<serverId>`, …) and
|
|
8
|
+
* never evicted — so every new session minted a fresh set of keys that piled up
|
|
9
|
+
* forever. Eventually the bucket saturated and the *next* `setItem` from *any*
|
|
10
|
+
* store threw `QuotaExceededError` synchronously, crashing whatever happened to
|
|
11
|
+
* write next (often something tiny and innocent, like the tab list).
|
|
12
|
+
*
|
|
13
|
+
* This module is the single chokepoint that keeps the bucket healthy:
|
|
14
|
+
*
|
|
15
|
+
* 1. `safeSetItem` NEVER throws. On a quota error it reclaims space by evicting
|
|
16
|
+
* the oldest *disposable* cache entries (across every registered family),
|
|
17
|
+
* then retries — and if it still can't fit, it gives up silently instead of
|
|
18
|
+
* crashing the UI. Losing a disposable cache is free; it just refetches.
|
|
19
|
+
* 2. `ScopedCache` is the right way to write a per-scope cache: it stamps each
|
|
20
|
+
* entry with a timestamp and prunes its family to the N most-recent scopes
|
|
21
|
+
* on every write, so an ephemeral key space can't grow unbounded.
|
|
22
|
+
* 3. `createSafeJSONStorage` gives every zustand `persist` store the same
|
|
23
|
+
* never-throw guarantee, so no store can ever be the crash site again.
|
|
24
|
+
*
|
|
25
|
+
* Anything that should be sacrificed under memory pressure must register its
|
|
26
|
+
* key family here (ScopedCache does this for you). Durable user preferences are
|
|
27
|
+
* deliberately NOT registered, so they survive a reclaim.
|
|
28
|
+
*/
|
|
29
|
+
import { createJSONStorage } from 'zustand/middleware';
|
|
30
|
+
/** Registered prefixes for caches that are safe to evict to reclaim quota. */
|
|
31
|
+
const disposableFamilies = new Set();
|
|
32
|
+
/** Registered exact keys (single-blob caches) that are safe to evict. */
|
|
33
|
+
const disposableKeys = new Set();
|
|
34
|
+
/**
|
|
35
|
+
* Register a `<prefix>:<scope>` key family as disposable. Entries under it may
|
|
36
|
+
* be evicted (oldest first) when the bucket is full. Idempotent.
|
|
37
|
+
*/
|
|
38
|
+
export function registerDisposableFamily(prefix) {
|
|
39
|
+
disposableFamilies.add(prefix);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Register a single exact key (a self-contained cache blob, e.g. an internally
|
|
43
|
+
* LRU'd map) as disposable. These are evicted only as a LAST resort — after
|
|
44
|
+
* every scoped-family entry — since they tend to be already-bounded and more
|
|
45
|
+
* valuable than a stale per-sandbox snapshot. Idempotent.
|
|
46
|
+
*/
|
|
47
|
+
export function registerDisposableKey(key) {
|
|
48
|
+
disposableKeys.add(key);
|
|
49
|
+
}
|
|
50
|
+
function hasWindow() {
|
|
51
|
+
return typeof window !== 'undefined' && typeof localStorage !== 'undefined';
|
|
52
|
+
}
|
|
53
|
+
/** Every localStorage key currently present (snapshot — safe to mutate during). */
|
|
54
|
+
function allKeys() {
|
|
55
|
+
const keys = [];
|
|
56
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
57
|
+
const k = localStorage.key(i);
|
|
58
|
+
if (k !== null)
|
|
59
|
+
keys.push(k);
|
|
60
|
+
}
|
|
61
|
+
return keys;
|
|
62
|
+
}
|
|
63
|
+
/** A scope key belongs to a family iff it starts with `<family>:`. */
|
|
64
|
+
function keyBelongsToFamily(key, family) {
|
|
65
|
+
return key.startsWith(`${family}:`);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Read the timestamp a ScopedCache stamped into an entry. Legacy / foreign
|
|
69
|
+
* entries (raw arrays, un-stamped values) report 0 so they're evicted first.
|
|
70
|
+
*/
|
|
71
|
+
function entryTimestamp(raw) {
|
|
72
|
+
if (!raw)
|
|
73
|
+
return 0;
|
|
74
|
+
try {
|
|
75
|
+
const parsed = JSON.parse(raw);
|
|
76
|
+
return parsed && typeof parsed.t === 'number' ? parsed.t : 0;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* All disposable entries currently in storage, oldest first. Used both for the
|
|
84
|
+
* under-pressure reclaim and as the eviction order for any single family.
|
|
85
|
+
*/
|
|
86
|
+
function disposableEntriesOldestFirst() {
|
|
87
|
+
const entries = [];
|
|
88
|
+
for (const key of allKeys()) {
|
|
89
|
+
if (disposableKeys.has(key)) {
|
|
90
|
+
// Exact-key blobs are evicted last (sort to the end).
|
|
91
|
+
entries.push({ key, t: Number.MAX_SAFE_INTEGER });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
for (const family of disposableFamilies) {
|
|
95
|
+
if (keyBelongsToFamily(key, family)) {
|
|
96
|
+
entries.push({ key, t: entryTimestamp(localStorage.getItem(key)) });
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return entries.sort((a, b) => a.t - b.t);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Write to localStorage without ever throwing. On a quota error, evict the
|
|
105
|
+
* oldest disposable entries one at a time, retrying after each eviction, until
|
|
106
|
+
* the write fits or there's nothing left to drop. The key being written is
|
|
107
|
+
* never evicted. Returns whether the value was ultimately persisted.
|
|
108
|
+
*/
|
|
109
|
+
export function safeSetItem(key, value) {
|
|
110
|
+
if (!hasWindow())
|
|
111
|
+
return false;
|
|
112
|
+
try {
|
|
113
|
+
localStorage.setItem(key, value);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Likely QuotaExceededError. Reclaim space from disposable caches.
|
|
118
|
+
const victims = disposableEntriesOldestFirst().filter((e) => e.key !== key);
|
|
119
|
+
for (const victim of victims) {
|
|
120
|
+
try {
|
|
121
|
+
localStorage.removeItem(victim.key);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
/* ignore — try the next victim */
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
localStorage.setItem(key, value);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
/* still over quota — keep evicting */
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function safeGetItem(key) {
|
|
138
|
+
if (!hasWindow())
|
|
139
|
+
return null;
|
|
140
|
+
try {
|
|
141
|
+
return localStorage.getItem(key);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export function safeRemoveItem(key) {
|
|
148
|
+
if (!hasWindow())
|
|
149
|
+
return;
|
|
150
|
+
try {
|
|
151
|
+
localStorage.removeItem(key);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
/* ignore */
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Every ScopedCache constructed this session — drives the global boot sweep. */
|
|
158
|
+
const registeredCaches = [];
|
|
159
|
+
/**
|
|
160
|
+
* A localStorage-backed cache for data keyed by a *scope* (a server id, a
|
|
161
|
+
* directory, `'global'`, …). Each family is automatically capped to its
|
|
162
|
+
* `maxScopes` most-recently-written scopes, so an ephemeral scope space (e.g.
|
|
163
|
+
* per-sandbox server ids) can never grow without bound. Entries are also
|
|
164
|
+
* globally evictable under quota pressure (the family is registered as
|
|
165
|
+
* disposable on construction).
|
|
166
|
+
*
|
|
167
|
+
* Values are stored wrapped as `{ v, t }`; callers see only the unwrapped
|
|
168
|
+
* value. Legacy un-wrapped entries from before this layer existed simply read
|
|
169
|
+
* as a miss (and get rewritten in the new shape on the next set).
|
|
170
|
+
*/
|
|
171
|
+
export class ScopedCache {
|
|
172
|
+
family;
|
|
173
|
+
maxScopes;
|
|
174
|
+
constructor(family, maxScopes) {
|
|
175
|
+
if (maxScopes < 1)
|
|
176
|
+
throw new Error('ScopedCache maxScopes must be >= 1');
|
|
177
|
+
this.family = family;
|
|
178
|
+
this.maxScopes = maxScopes;
|
|
179
|
+
registerDisposableFamily(family);
|
|
180
|
+
registeredCaches.push(this);
|
|
181
|
+
}
|
|
182
|
+
keyFor(scope) {
|
|
183
|
+
return `${this.family}:${scope}`;
|
|
184
|
+
}
|
|
185
|
+
get(scope) {
|
|
186
|
+
const raw = safeGetItem(this.keyFor(scope));
|
|
187
|
+
if (!raw)
|
|
188
|
+
return undefined;
|
|
189
|
+
try {
|
|
190
|
+
const parsed = JSON.parse(raw);
|
|
191
|
+
// Only honor entries written in the wrapped shape; anything else is a miss.
|
|
192
|
+
if (parsed && typeof parsed === 'object' && 't' in parsed) {
|
|
193
|
+
return parsed.v;
|
|
194
|
+
}
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
set(scope, value) {
|
|
202
|
+
if (!hasWindow())
|
|
203
|
+
return;
|
|
204
|
+
const wrapped = { v: value, t: Date.now() };
|
|
205
|
+
safeSetItem(this.keyFor(scope), JSON.stringify(wrapped));
|
|
206
|
+
this.prune();
|
|
207
|
+
}
|
|
208
|
+
remove(scope) {
|
|
209
|
+
safeRemoveItem(this.keyFor(scope));
|
|
210
|
+
}
|
|
211
|
+
/** Drop all but the `maxScopes` most-recently-written scopes in this family. */
|
|
212
|
+
prune() {
|
|
213
|
+
if (!hasWindow())
|
|
214
|
+
return;
|
|
215
|
+
const entries = [];
|
|
216
|
+
for (const key of allKeys()) {
|
|
217
|
+
if (keyBelongsToFamily(key, this.family)) {
|
|
218
|
+
entries.push({ key, t: entryTimestamp(localStorage.getItem(key)) });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (entries.length <= this.maxScopes)
|
|
222
|
+
return;
|
|
223
|
+
entries
|
|
224
|
+
.sort((a, b) => b.t - a.t) // newest first
|
|
225
|
+
.slice(this.maxScopes) // everything past the cap
|
|
226
|
+
.forEach((e) => safeRemoveItem(e.key));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Prune every registered disposable family back to its cap and drop foreign /
|
|
231
|
+
* legacy un-stamped entries within those families. Call once on boot to reclaim
|
|
232
|
+
* space left by older builds that never evicted; cheap and idempotent.
|
|
233
|
+
*
|
|
234
|
+
* Pass the live ScopedCache instances so each family's own `maxScopes` is
|
|
235
|
+
* respected.
|
|
236
|
+
*/
|
|
237
|
+
export function pruneDisposableCaches(caches) {
|
|
238
|
+
if (!hasWindow())
|
|
239
|
+
return;
|
|
240
|
+
for (const cache of caches)
|
|
241
|
+
cache.prune();
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Prune every ScopedCache constructed so far back to its cap. Safe to call on
|
|
245
|
+
* boot to reclaim space left by older builds that never evicted. Only sees
|
|
246
|
+
* caches whose modules have loaded — but those are the large per-sandbox
|
|
247
|
+
* families, and they're imported as soon as the app shell mounts.
|
|
248
|
+
*/
|
|
249
|
+
export function pruneAllRegisteredCaches() {
|
|
250
|
+
if (!hasWindow())
|
|
251
|
+
return;
|
|
252
|
+
for (const cache of registeredCaches)
|
|
253
|
+
cache.prune();
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Shared zustand `StateStorage` that never throws. Every `persist(...)` store
|
|
257
|
+
* should route through this via `createSafeJSONStorage()` so a full bucket
|
|
258
|
+
* degrades to "preferences didn't save" instead of crashing the render.
|
|
259
|
+
*/
|
|
260
|
+
export const safeLocalStorage = {
|
|
261
|
+
getItem: (name) => safeGetItem(name),
|
|
262
|
+
setItem: (name, value) => {
|
|
263
|
+
safeSetItem(name, value);
|
|
264
|
+
},
|
|
265
|
+
removeItem: (name) => safeRemoveItem(name),
|
|
266
|
+
};
|
|
267
|
+
/** Drop-in replacement for `createJSONStorage(() => localStorage)`. */
|
|
268
|
+
export function createSafeJSONStorage() {
|
|
269
|
+
return createJSONStorage(() => safeLocalStorage);
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=managed-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-storage.js","sourceRoot":"","sources":["../../../src/platform/storage/managed-storage.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AAE1E,8EAA8E;AAC9E,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;AAC7C,yEAAyE;AACzE,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAc;IACrD,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC/C,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,YAAY,KAAK,WAAW,CAAC;AAC9E,CAAC;AAED,mFAAmF;AACnF,SAAS,OAAO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AAC,0BAA0B;aAChD,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA2C;IAC/E,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO;IACzB,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB;IACtC,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO;IACzB,KAAK,MAAM,KAAK,IAAI,gBAAgB;QAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACvB,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC;CAC3C,CAAC;AAEF,uEAAuE;AACvE,MAAM,UAAU,qBAAqB;IACnC,OAAO,iBAAiB,CAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free string helpers shared across the SDK (and its hosts).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Strip trailing '/' characters in linear time. The idiomatic regex form
|
|
6
|
+
* (`.replace(/\/+$/, '')`) backtracks quadratically on adversarial inputs
|
|
7
|
+
* with many repeated slashes (CodeQL `js/polynomial-redos`) — URLs here come
|
|
8
|
+
* from config/runtime state, but every call site sits on a hot request path,
|
|
9
|
+
* so the SDK standardizes on this loop instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function stripTrailingSlashes(s: string): string;
|
|
12
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/platform/strings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAItD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free string helpers shared across the SDK (and its hosts).
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Strip trailing '/' characters in linear time. The idiomatic regex form
|
|
6
|
+
* (`.replace(/\/+$/, '')`) backtracks quadratically on adversarial inputs
|
|
7
|
+
* with many repeated slashes (CodeQL `js/polynomial-redos`) — URLs here come
|
|
8
|
+
* from config/runtime state, but every call site sits on a hot request path,
|
|
9
|
+
* so the SDK standardizes on this loop instead.
|
|
10
|
+
*/
|
|
11
|
+
export function stripTrailingSlashes(s) {
|
|
12
|
+
let end = s.length;
|
|
13
|
+
while (end > 0 && s.charCodeAt(end - 1) === 47 /* '/' */)
|
|
14
|
+
end--;
|
|
15
|
+
return end === s.length ? s : s.slice(0, end);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=strings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/platform/strings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAS;IAC7C,IAAI,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;IACnB,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS;QAAE,GAAG,EAAE,CAAC;IAChE,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI side-effect sink. The SDK fires these during event handling; the host wires
|
|
3
|
+
* them to its real toast / OS-notification surfaces via `configureKortix`. No
|
|
4
|
+
* UI components live in the SDK — these just forward to injected callbacks.
|
|
5
|
+
*/
|
|
6
|
+
export declare function infoToast(message: string, options?: unknown): void;
|
|
7
|
+
export declare function notifyTaskComplete(sessionId: string, sessionTitle?: string): void;
|
|
8
|
+
export declare function notifySessionError(sessionId: string, errorTitle: string, sessionTitle?: string): void;
|
|
9
|
+
export declare function notifyQuestion(sessionId: string, questionText: string, sessionTitle?: string): void;
|
|
10
|
+
export declare function notifyPermissionRequest(sessionId: string, toolName: string, sessionTitle?: string): void;
|
|
11
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/platform/ui.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAElE;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAEjF;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,CAEN;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,CAEN;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,IAAI,CAEN"}
|