@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
package/dist/kortix.js
ADDED
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createKortix — the single opinionated entry point to the Kortix data layer.
|
|
3
|
+
*
|
|
4
|
+
* One client. Every action a method. The host app imports ONLY from `@kortix/sdk`
|
|
5
|
+
* — never `@opencode-ai/sdk`, never `backendApi`/`authenticatedFetch` directly.
|
|
6
|
+
*
|
|
7
|
+
* const kortix = createKortix({ getToken });
|
|
8
|
+
* await kortix.projects.list();
|
|
9
|
+
* await kortix.project(pid).secrets.upsert({ name, value });
|
|
10
|
+
* const s = kortix.session(pid, sid);
|
|
11
|
+
* await s.start();
|
|
12
|
+
* s.runtime.session.prompt({ sessionID: sid, parts }); // typed opencode, via the SDK
|
|
13
|
+
*
|
|
14
|
+
* REST methods are direct references to the platform client, so they keep their
|
|
15
|
+
* exact types with zero re-typing. The `project()`/`session()` handles bind ids
|
|
16
|
+
* for ergonomics. Reactive data still comes from `@kortix/sdk/react` hooks.
|
|
17
|
+
*/
|
|
18
|
+
import * as F from './files/client.js';
|
|
19
|
+
import { getClient, getClientForUrl } from './opencode/client.js';
|
|
20
|
+
import { ApiError } from './platform/api/errors.js';
|
|
21
|
+
import { configureKortix, platformConfig } from './platform/config.js';
|
|
22
|
+
import * as P from './platform/projects-client/index.js';
|
|
23
|
+
import { getSessionHealth } from './session/health.js';
|
|
24
|
+
import { proxyLocalhostUrl, rewriteLocalhostUrl } from './session/url.js';
|
|
25
|
+
import { setCurrentRuntime } from './state/current-runtime.js';
|
|
26
|
+
import { clearSessionRuntime, getSessionRuntime, } from './state/session-runtime-registry.js';
|
|
27
|
+
import { getSandboxUrlForExternalId } from './state/server-store/url-helpers.js';
|
|
28
|
+
import { openEventStream, } from './state/event-stream.js';
|
|
29
|
+
/** The opencode runtime client for the currently-active sandbox (set by the host). */
|
|
30
|
+
function runtime() {
|
|
31
|
+
return getClient();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown by a session handle's runtime-scoped operations (`.runtime`,
|
|
35
|
+
* `.health()`, `.previewUrl()`, `.proxyUrl()`) when called before the handle
|
|
36
|
+
* has resolved its own sandbox runtime. These never fall back to whatever
|
|
37
|
+
* sandbox happens to be globally active (a different session's runtime) —
|
|
38
|
+
* the caller must resolve THIS handle's runtime first.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Dedupes concurrent `ensureReady()` calls that would otherwise both drive a
|
|
42
|
+
* `/start` long-poll for the SAME (projectId, sessionId) — e.g. two session
|
|
43
|
+
* handles for the same session (or the facade racing the React `useSession`
|
|
44
|
+
* hook) both calling `ensureReady()`/`start()` before either has resolved a
|
|
45
|
+
* runtime. Keyed by `${projectId}\n${sessionId}` (not the process-global
|
|
46
|
+
* "active runtime" — every other handle for a DIFFERENT session gets its own
|
|
47
|
+
* entry and is unaffected). Cleared on settle (success or failure) so a
|
|
48
|
+
* transient failure doesn't wedge the key — the next call issues a fresh
|
|
49
|
+
* `/start` instead of replaying a stale rejected promise forever.
|
|
50
|
+
*/
|
|
51
|
+
const inFlightSessionStarts = new Map();
|
|
52
|
+
export class SessionNotReadyError extends Error {
|
|
53
|
+
constructor(action) {
|
|
54
|
+
super(`Session runtime not ready — call \`await session.ensureReady()\` (it drives \`start()\` to completion and resolves this session's own sandbox runtime) before calling \`${action}\`.`);
|
|
55
|
+
this.name = 'SessionNotReadyError';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function createKortix(config, opts) {
|
|
59
|
+
// Wire the platform seam once. All wrapped functions read it.
|
|
60
|
+
//
|
|
61
|
+
// `opts.global === false` (used by `@kortix/sdk/server`'s `createScopedKortix`)
|
|
62
|
+
// skips the process-wide write entirely — that caller relies solely on the
|
|
63
|
+
// `AsyncLocalStorage` scope `createScopedKortix` wraps every method call in,
|
|
64
|
+
// so this returned facade never touches (or is affected by) the module-global
|
|
65
|
+
// singleton other concurrent `createKortix()` calls in the same process share.
|
|
66
|
+
configureKortix(config, opts);
|
|
67
|
+
/**
|
|
68
|
+
* Parse `backendUrl` for its port (used by the subdomain preview scheme).
|
|
69
|
+
* `backendUrl` is normally absolute, but the BFF pattern — a Next.js API
|
|
70
|
+
* route (or any same-origin proxy) fronting the real Kortix API — legitimately
|
|
71
|
+
* configures it as a relative path like `/api/kortix`. `new URL()` throws on
|
|
72
|
+
* a bare relative string (no base to resolve against). In a browser that's
|
|
73
|
+
* recoverable: resolve it against the page's own origin. Server-side there
|
|
74
|
+
* is no implicit origin, so a relative `backendUrl` is a real misconfiguration
|
|
75
|
+
* — fail loudly instead of silently defaulting to port 80.
|
|
76
|
+
*/
|
|
77
|
+
function parseBackendUrlForPort(apiBaseUrl) {
|
|
78
|
+
try {
|
|
79
|
+
return new URL(apiBaseUrl);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
if (typeof window !== 'undefined' && window.location?.origin) {
|
|
83
|
+
try {
|
|
84
|
+
return new URL(apiBaseUrl, window.location.origin);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
throw new ApiError(`Kortix SDK: backendUrl must be an absolute URL outside the browser (got ${JSON.stringify(apiBaseUrl)}). Relative paths like "/api/kortix" only resolve against a page origin — configure an absolute backendUrl for server-side hosts.`, { code: 'INVALID_BACKEND_URL' });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Resolve the proxy/preview URL context (sandboxId + api base) from config +
|
|
95
|
+
* a THIS-handle's own resolved sandbox id, so a session's `previewUrl`/
|
|
96
|
+
* `proxyUrl` never make the host name a sandbox — and never reads whichever
|
|
97
|
+
* sandbox happens to be globally active (which may belong to a different
|
|
98
|
+
* session handle).
|
|
99
|
+
*/
|
|
100
|
+
function resolvePreviewOptsForSandbox(sandboxId) {
|
|
101
|
+
// Read the LIVE platform config, not the `config` captured at
|
|
102
|
+
// `createKortix()` time: a host may re-point the seam after creation
|
|
103
|
+
// (calling `configureKortix()` again — e.g. the whitelabel app switching
|
|
104
|
+
// its `backendUrl` to a same-origin BFF proxy once it learns wrapper mode
|
|
105
|
+
// is on), and preview/proxy URLs must follow the reconfigured base like
|
|
106
|
+
// every other call path already does.
|
|
107
|
+
const apiBaseUrl = platformConfig().backendUrl ?? config.backendUrl;
|
|
108
|
+
let backendPort = 80;
|
|
109
|
+
const u = parseBackendUrlForPort(apiBaseUrl);
|
|
110
|
+
if (u) {
|
|
111
|
+
backendPort = u.port ? Number(u.port) : u.protocol === 'https:' ? 443 : 80;
|
|
112
|
+
}
|
|
113
|
+
return { sandboxId, backendPort, apiBaseUrl };
|
|
114
|
+
}
|
|
115
|
+
/** Account-scoped operations. */
|
|
116
|
+
const accounts = {
|
|
117
|
+
list: P.listAccounts,
|
|
118
|
+
get: P.getAccount,
|
|
119
|
+
create: P.createAccount,
|
|
120
|
+
updateName: P.updateAccountName,
|
|
121
|
+
leave: P.leaveAccount,
|
|
122
|
+
members: P.listAccountMembers,
|
|
123
|
+
invite: P.inviteAccountMember,
|
|
124
|
+
removeMember: P.removeAccountMember,
|
|
125
|
+
updateMemberRole: P.updateAccountMemberRole,
|
|
126
|
+
invites: P.listAccountInvites,
|
|
127
|
+
/** Cancel a pending account invite (accountId still known/scoped). */
|
|
128
|
+
cancelInvite: P.cancelAccountInvite,
|
|
129
|
+
/** Resend a pending account invite (accountId still known/scoped). */
|
|
130
|
+
resendInvite: P.resendAccountInvite,
|
|
131
|
+
/** CLI PAT minting — account-scoped personal access tokens (`kortix_pat_...`). */
|
|
132
|
+
tokens: {
|
|
133
|
+
list: P.listAccountTokens,
|
|
134
|
+
create: P.createAccountToken,
|
|
135
|
+
revoke: P.revokeAccountToken,
|
|
136
|
+
},
|
|
137
|
+
/** Enterprise audit log — events + CSV/JSONL export + SIEM webhooks. */
|
|
138
|
+
audit: {
|
|
139
|
+
log: P.listAccountAudit,
|
|
140
|
+
export: P.exportAccountAudit,
|
|
141
|
+
webhooks: {
|
|
142
|
+
list: P.listAccountAuditWebhooks,
|
|
143
|
+
create: P.createAccountAuditWebhook,
|
|
144
|
+
update: P.updateAccountAuditWebhook,
|
|
145
|
+
remove: P.removeAccountAuditWebhook,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Billing read surface — credits, subscription, tier, and transaction
|
|
151
|
+
* history for entitlement-gating + a billing/usage UI. Checkout/portal/
|
|
152
|
+
* credit-purchase/subscription MUTATIONS stay app-owned (Stripe flows) —
|
|
153
|
+
* this is reads only.
|
|
154
|
+
*/
|
|
155
|
+
const billing = {
|
|
156
|
+
accountState: P.getAccountState,
|
|
157
|
+
accountStateMinimal: P.getAccountStateMinimal,
|
|
158
|
+
transactions: P.listBillingTransactions,
|
|
159
|
+
transactionsSummary: P.getBillingTransactionsSummary,
|
|
160
|
+
creditBreakdown: P.getBillingCreditBreakdown,
|
|
161
|
+
usageHistory: P.getBillingUsageHistory,
|
|
162
|
+
tierConfigurations: P.getBillingTierConfigurations,
|
|
163
|
+
/** Stripe checkout — start a subscription and confirm it post-redirect. */
|
|
164
|
+
checkout: {
|
|
165
|
+
createSession: (input) => P.createCheckoutSession(input),
|
|
166
|
+
confirmSession: (sessionId, accountId) => P.confirmCheckoutSession(sessionId, accountId),
|
|
167
|
+
},
|
|
168
|
+
/** Manage an existing subscription (portal, cancel/reactivate, downgrade). */
|
|
169
|
+
subscription: {
|
|
170
|
+
createPortalSession: (returnUrl, accountId) => P.createPortalSession(returnUrl, accountId),
|
|
171
|
+
cancel: (feedback, accountId) => P.cancelSubscription(feedback, accountId),
|
|
172
|
+
reactivate: (accountId) => P.reactivateSubscription(accountId),
|
|
173
|
+
scheduleDowngrade: (targetTierKey, commitmentType, accountId) => P.scheduleDowngrade(targetTierKey, commitmentType, accountId),
|
|
174
|
+
cancelScheduledChange: (accountId) => P.cancelScheduledChange(accountId),
|
|
175
|
+
prorationPreview: (newPriceId, accountId) => P.getProrationPreview(newPriceId, accountId),
|
|
176
|
+
},
|
|
177
|
+
/** One-off credit purchases + recurring auto-topup configuration. */
|
|
178
|
+
credits: {
|
|
179
|
+
purchase: (input) => P.purchaseCredits(input),
|
|
180
|
+
autoTopupSettings: (accountId) => P.getAutoTopupSettings(accountId),
|
|
181
|
+
configureAutoTopup: (input) => P.configureAutoTopup(input),
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Account-invite lifecycle reached by invite token alone — accept/decline/
|
|
186
|
+
* describe are called by the invitee (who may not be an account member, or
|
|
187
|
+
* even signed into this account, yet), so they take only `inviteId` and
|
|
188
|
+
* genuinely don't fit account- or project-scoping.
|
|
189
|
+
*/
|
|
190
|
+
const accountInvites = {
|
|
191
|
+
describe: P.describeAccountInvite,
|
|
192
|
+
accept: P.acceptAccountInvite,
|
|
193
|
+
decline: P.declineAccountInvite,
|
|
194
|
+
};
|
|
195
|
+
/** Top-level project operations (not bound to an id). */
|
|
196
|
+
const projects = {
|
|
197
|
+
list: P.listProjects,
|
|
198
|
+
listForAccount: P.listProjectsForAccount,
|
|
199
|
+
get: P.getProject,
|
|
200
|
+
detail: P.getProjectDetail,
|
|
201
|
+
create: P.createProject,
|
|
202
|
+
/** Create a project backed by a brand-new Kortix-managed GitHub repo. */
|
|
203
|
+
createRepo: P.createProjectRepo,
|
|
204
|
+
provision: P.provisionProject,
|
|
205
|
+
update: P.updateProject,
|
|
206
|
+
archive: P.archiveProject,
|
|
207
|
+
llmCatalog: P.getProjectLlmCatalog,
|
|
208
|
+
sandboxHealth: P.getProjectSandboxHealth,
|
|
209
|
+
sandboxTemplates: P.listProjectSandboxTemplates,
|
|
210
|
+
sessions: P.listProjectSessions,
|
|
211
|
+
createSession: P.createProjectSession,
|
|
212
|
+
};
|
|
213
|
+
/** GitHub App installation + repository linking — account-scoped, not project-scoped. */
|
|
214
|
+
const github = {
|
|
215
|
+
linkRepository: P.linkRepository,
|
|
216
|
+
getInstallation: P.getGitHubInstallation,
|
|
217
|
+
listInstallations: P.listGitHubInstallations,
|
|
218
|
+
listRepositories: P.listGitHubRepositories,
|
|
219
|
+
saveInstallation: P.saveGitHubInstallation,
|
|
220
|
+
deleteInstallation: P.deleteGitHubInstallation,
|
|
221
|
+
};
|
|
222
|
+
/** Public share links for a sandbox port (`/v1/p/share`) — sandbox-scoped, not project-scoped. */
|
|
223
|
+
const sandboxShares = {
|
|
224
|
+
list: P.listSandboxShares,
|
|
225
|
+
create: P.createSandboxShare,
|
|
226
|
+
revoke: P.revokeSandboxShare,
|
|
227
|
+
};
|
|
228
|
+
/** Deployment-wide flag: is the easy-connect (Pipedream) provider configured? Not project-scoped. */
|
|
229
|
+
const connectStatus = P.getConnectStatus;
|
|
230
|
+
/**
|
|
231
|
+
* Public marketplace catalog browse (`/v1/marketplace/*`) — top-level and
|
|
232
|
+
* distinct from `project(id).marketplace`, which is install-scoped (commits
|
|
233
|
+
* an item onto a specific project's branch). This is read-only browsing +
|
|
234
|
+
* the authed "add a marketplace source" surface.
|
|
235
|
+
*/
|
|
236
|
+
const marketplace = {
|
|
237
|
+
items: (options) => P.listMarketplaceCatalogItems(options),
|
|
238
|
+
item: (id) => P.getMarketplaceCatalogItem(id),
|
|
239
|
+
itemFile: (id, path) => P.getMarketplaceCatalogItemFile(id, path),
|
|
240
|
+
marketplaces: () => P.listMarketplaces(),
|
|
241
|
+
featured: () => P.listFeaturedMarketplaces(),
|
|
242
|
+
sources: {
|
|
243
|
+
list: () => P.listMarketplaceSources(),
|
|
244
|
+
add: (input) => P.addMarketplaceSource(input),
|
|
245
|
+
remove: (id) => P.removeMarketplaceSource(id),
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
/** Id-bound handle for a single project: every sub-resource, projectId pre-applied. */
|
|
249
|
+
function project(projectId) {
|
|
250
|
+
return {
|
|
251
|
+
get: (opts) => P.getProject(projectId, opts),
|
|
252
|
+
detail: () => P.getProjectDetail(projectId),
|
|
253
|
+
update: (input) => P.updateProject(projectId, input),
|
|
254
|
+
archive: () => P.archiveProject(projectId),
|
|
255
|
+
llmCatalog: () => P.getProjectLlmCatalog(projectId),
|
|
256
|
+
sandboxHealth: () => P.getProjectSandboxHealth(projectId),
|
|
257
|
+
onboardingComplete: (...a) => P.setProjectOnboardingComplete(projectId, ...a),
|
|
258
|
+
/** Project-scoped CLI PATs (auto-minted at session-create as `KORTIX_TOKEN`; can also be minted by hand). */
|
|
259
|
+
tokens: {
|
|
260
|
+
list: () => P.listProjectCliTokens(projectId),
|
|
261
|
+
create: (input) => P.createProjectCliToken(projectId, input),
|
|
262
|
+
revoke: (tokenId) => P.revokeProjectCliToken(projectId, tokenId),
|
|
263
|
+
},
|
|
264
|
+
/** Agent-minted setup links — hand a human a link to enter a secret value or 1-click connect an app. */
|
|
265
|
+
setupLinks: {
|
|
266
|
+
requestSecret: (input) => P.requestProjectSecret(projectId, input),
|
|
267
|
+
requestConnector: (input) => P.requestProjectConnector(projectId, input),
|
|
268
|
+
},
|
|
269
|
+
/** Validate a `kortix.toml` manifest's raw TOML text server-side (same schema `kortix ship`/CR-merge use). */
|
|
270
|
+
validateManifest: (raw) => P.validateProjectManifest(projectId, raw),
|
|
271
|
+
/** Mint a fresh scoped git push token for a managed project (409 for BYO repos). */
|
|
272
|
+
gitToken: () => P.getProjectGitToken(projectId),
|
|
273
|
+
/** Marketplace install/updates — commits an item's files (+ lock) straight onto the default branch. */
|
|
274
|
+
marketplace: {
|
|
275
|
+
list: () => P.listInstalledMarketplaceItems(projectId),
|
|
276
|
+
install: (id) => P.installMarketplaceItem(projectId, id),
|
|
277
|
+
updates: () => P.getMarketplaceUpdates(projectId),
|
|
278
|
+
update: (name) => P.updateMarketplaceItem(projectId, name),
|
|
279
|
+
updateAll: () => P.updateAllMarketplaceItems(projectId),
|
|
280
|
+
remove: (name) => P.removeMarketplaceItem(projectId, name),
|
|
281
|
+
},
|
|
282
|
+
/** `registry.*` — compatibility alias of `marketplace.*` (identical server-side handlers). */
|
|
283
|
+
registry: {
|
|
284
|
+
list: () => P.listInstalledRegistryItems(projectId),
|
|
285
|
+
install: (id) => P.installRegistryItem(projectId, id),
|
|
286
|
+
updates: () => P.getRegistryUpdates(projectId),
|
|
287
|
+
update: (name) => P.updateRegistryItem(projectId, name),
|
|
288
|
+
updateAll: () => P.updateAllRegistryItems(projectId),
|
|
289
|
+
remove: (name) => P.removeRegistryItem(projectId, name),
|
|
290
|
+
},
|
|
291
|
+
secrets: {
|
|
292
|
+
list: () => P.listProjectSecrets(projectId),
|
|
293
|
+
upsert: (input) => P.upsertProjectSecret(projectId, input),
|
|
294
|
+
remove: (name) => P.deleteProjectSecret(projectId, name),
|
|
295
|
+
setPersonal: (...a) => P.setPersonalProjectSecret(projectId, ...a),
|
|
296
|
+
removePersonal: (name) => P.deletePersonalProjectSecret(projectId, name),
|
|
297
|
+
setGitCredential: (input) => P.upsertProjectGitCredential(projectId, input),
|
|
298
|
+
/** Device-code OAuth flow to connect a subscription-backed provider (e.g. ChatGPT). */
|
|
299
|
+
startProviderOAuth: (...a) => P.startProjectProviderOAuth(projectId, ...a),
|
|
300
|
+
pollProviderOAuth: (...a) => P.pollProjectProviderOAuth(projectId, ...a),
|
|
301
|
+
},
|
|
302
|
+
access: {
|
|
303
|
+
list: () => P.listProjectAccess(projectId),
|
|
304
|
+
invite: (...a) => P.inviteProjectMember(projectId, ...a),
|
|
305
|
+
update: (...a) => P.updateProjectAccess(projectId, ...a),
|
|
306
|
+
revoke: (userId) => P.revokeProjectAccess(projectId, userId),
|
|
307
|
+
pendingInvites: () => P.listPendingProjectInvites(projectId),
|
|
308
|
+
resendInvite: (...a) => P.resendPendingProjectInvite(projectId, ...a),
|
|
309
|
+
revokeInvite: (...a) => P.revokePendingProjectInvite(projectId, ...a),
|
|
310
|
+
requests: () => P.listProjectAccessRequests(projectId),
|
|
311
|
+
approveRequest: (...a) => P.approveProjectAccessRequest(projectId, ...a),
|
|
312
|
+
rejectRequest: (...a) => P.rejectProjectAccessRequest(projectId, ...a),
|
|
313
|
+
groupGrants: () => P.listProjectGroupGrants(projectId),
|
|
314
|
+
attachGroupGrant: (...a) => P.attachGroupToProject(projectId, ...a),
|
|
315
|
+
updateGroupGrant: (...a) => P.updateProjectGroupGrant(projectId, ...a),
|
|
316
|
+
detachGroupGrant: (groupId) => P.detachGroupFromProject(projectId, groupId),
|
|
317
|
+
/** Per-resource (agent/skill/secret) grants to a member or a group. */
|
|
318
|
+
resourceGrants: {
|
|
319
|
+
list: () => P.listProjectResourceGrants(projectId),
|
|
320
|
+
create: (input) => P.createProjectResourceGrant(projectId, input),
|
|
321
|
+
remove: (grantId) => P.deleteProjectResourceGrant(projectId, grantId),
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
connectors: {
|
|
325
|
+
list: () => P.listConnectors(projectId),
|
|
326
|
+
config: (...a) => P.getConnectorConfig(projectId, ...a),
|
|
327
|
+
create: (...a) => P.createConnector(projectId, ...a),
|
|
328
|
+
remove: (...a) => P.deleteConnector(projectId, ...a),
|
|
329
|
+
sync: () => P.syncConnectors(projectId),
|
|
330
|
+
setName: (...a) => P.setConnectorName(projectId, ...a),
|
|
331
|
+
setCredentialMode: (...a) => P.setConnectorCredentialMode(projectId, ...a),
|
|
332
|
+
setCredential: (...a) => P.setConnectorCredential(projectId, ...a),
|
|
333
|
+
setSensitive: (...a) => P.setConnectorSensitive(projectId, ...a),
|
|
334
|
+
policies: {
|
|
335
|
+
get: (...a) => P.getConnectorPolicies(projectId, ...a),
|
|
336
|
+
set: (...a) => P.setConnectorPolicies(projectId, ...a),
|
|
337
|
+
},
|
|
338
|
+
/** Easy-connect (Pipedream): app catalog + connect/finalize handshake. */
|
|
339
|
+
pipedream: {
|
|
340
|
+
listApps: (...a) => P.listPipedreamApps(projectId, ...a),
|
|
341
|
+
connect: (...a) => P.pipedreamConnect(projectId, ...a),
|
|
342
|
+
finalize: (...a) => P.pipedreamFinalize(projectId, ...a),
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
policies: {
|
|
346
|
+
list: () => P.listProjectPolicies(projectId),
|
|
347
|
+
set: (...a) => P.setProjectPolicies(projectId, ...a),
|
|
348
|
+
},
|
|
349
|
+
triggers: {
|
|
350
|
+
list: () => P.listProjectTriggers(projectId),
|
|
351
|
+
create: (...a) => P.createProjectTrigger(projectId, ...a),
|
|
352
|
+
update: (...a) => P.updateProjectTrigger(projectId, ...a),
|
|
353
|
+
remove: (...a) => P.deleteProjectTrigger(projectId, ...a),
|
|
354
|
+
fire: (...a) => P.fireProjectTrigger(projectId, ...a),
|
|
355
|
+
setActivation: (...a) => P.setProjectTriggersActivation(projectId, ...a),
|
|
356
|
+
},
|
|
357
|
+
files: {
|
|
358
|
+
list: (options) => P.listProjectFiles(projectId, options),
|
|
359
|
+
read: (path, ref) => P.readProjectFile(projectId, path, ref),
|
|
360
|
+
search: (...a) => P.searchProjectFiles(projectId, ...a),
|
|
361
|
+
archive: (...a) => P.fetchProjectArchive(projectId, ...a),
|
|
362
|
+
history: (...a) => P.getProjectFileHistory(projectId, ...a),
|
|
363
|
+
},
|
|
364
|
+
git: {
|
|
365
|
+
commits: () => P.listProjectCommits(projectId),
|
|
366
|
+
commit: (sha) => P.getProjectCommit(projectId, sha),
|
|
367
|
+
commitDiff: (sha) => P.getProjectCommitDiff(projectId, sha),
|
|
368
|
+
branches: () => P.listProjectBranches(projectId),
|
|
369
|
+
versionDiff: (...a) => P.getVersionDiff(projectId, ...a),
|
|
370
|
+
/** Invite a GitHub user as a collaborator on a Kortix-managed repo. */
|
|
371
|
+
inviteCollaborator: (...a) => P.inviteRepoCollaborator(projectId, ...a),
|
|
372
|
+
},
|
|
373
|
+
changeRequests: {
|
|
374
|
+
list: () => P.listChangeRequests(projectId),
|
|
375
|
+
get: (crId) => P.getChangeRequest(projectId, crId),
|
|
376
|
+
diff: (crId) => P.getChangeRequestDiff(projectId, crId),
|
|
377
|
+
mergePreview: (crId) => P.getChangeRequestMergePreview(projectId, crId),
|
|
378
|
+
open: (...a) => P.openChangeRequest(projectId, ...a),
|
|
379
|
+
merge: (...a) => P.mergeChangeRequest(projectId, ...a),
|
|
380
|
+
close: (...a) => P.closeChangeRequest(projectId, ...a),
|
|
381
|
+
reopen: (...a) => P.reopenChangeRequest(projectId, ...a),
|
|
382
|
+
/** Request changes on a CR (Review Center) — records feedback + optionally delivers it back to the originating session. */
|
|
383
|
+
requestChanges: (...a) => P.requestChangesOnChangeRequest(projectId, ...a),
|
|
384
|
+
},
|
|
385
|
+
sessions: {
|
|
386
|
+
list: () => P.listProjectSessions(projectId),
|
|
387
|
+
create: (input) => P.createProjectSession(projectId, input),
|
|
388
|
+
},
|
|
389
|
+
/** Review Center — the per-project human-in-the-loop inbox (change requests, tool approvals, agent outputs/decisions). */
|
|
390
|
+
review: {
|
|
391
|
+
list: (params) => P.listReviewItems(projectId, params),
|
|
392
|
+
get: (reviewItemId) => P.getReviewItem(projectId, reviewItemId),
|
|
393
|
+
submit: (input) => P.submitReviewItem(projectId, input),
|
|
394
|
+
act: (...a) => P.actReviewItem(projectId, ...a),
|
|
395
|
+
bulkAct: (input) => P.bulkActReviewItems(projectId, input),
|
|
396
|
+
},
|
|
397
|
+
/** The manager inbox of executor-gated actions awaiting approve/deny (APPROVE / ASK / BLOCK). */
|
|
398
|
+
approvals: {
|
|
399
|
+
list: (options) => P.listPendingApprovals(projectId, options),
|
|
400
|
+
resolve: (...a) => P.resolveApproval(projectId, ...a),
|
|
401
|
+
sessionsNeedingInput: (options) => P.listSessionsNeedingInput(projectId, options),
|
|
402
|
+
},
|
|
403
|
+
/** Gateway observability — LLM request logs, cost/latency rollups, budgets, gateway API keys. */
|
|
404
|
+
gateway: {
|
|
405
|
+
logs: (opts) => P.listGatewayLogs(projectId, opts),
|
|
406
|
+
log: (logId) => P.getGatewayLog(projectId, logId),
|
|
407
|
+
overview: (days) => P.getGatewayOverview(projectId, days),
|
|
408
|
+
series: (days) => P.getGatewaySeries(projectId, days),
|
|
409
|
+
breakdown: (days) => P.getGatewayBreakdown(projectId, days),
|
|
410
|
+
sessions: (days) => P.getGatewaySessions(projectId, days),
|
|
411
|
+
errors: (days) => P.getGatewayErrors(projectId, days),
|
|
412
|
+
budgets: () => P.getGatewayBudgets(projectId),
|
|
413
|
+
setBudget: (input) => P.setGatewayBudget(projectId, input),
|
|
414
|
+
deleteBudget: (budgetId) => P.deleteGatewayBudget(projectId, budgetId),
|
|
415
|
+
keys: () => P.getGatewayKeys(projectId),
|
|
416
|
+
createKey: (name) => P.createGatewayKey(projectId, name),
|
|
417
|
+
revokeKey: (keyId) => P.revokeGatewayKey(projectId, keyId),
|
|
418
|
+
/** Run one prompt against up to 6 models side by side (a model-comparison playground). */
|
|
419
|
+
playground: (prompt, models) => P.runGatewayPlayground(projectId, prompt, models),
|
|
420
|
+
},
|
|
421
|
+
/** Slack + email + Meet channel integrations. */
|
|
422
|
+
channels: {
|
|
423
|
+
slack: {
|
|
424
|
+
installation: () => P.getSlackInstallation(projectId),
|
|
425
|
+
connect: (input) => P.connectSlack(projectId, input),
|
|
426
|
+
mode: () => P.getSlackMode(projectId),
|
|
427
|
+
manifest: () => P.getSlackManifest(projectId),
|
|
428
|
+
disconnect: () => P.disconnectSlack(projectId),
|
|
429
|
+
/** Download a Slack-hosted file through the server-side proxy (bot token stays server-side). */
|
|
430
|
+
getFile: (url) => P.getSlackChannelFile(projectId, url),
|
|
431
|
+
/** Upload a file to Slack through the server-side 3-step external-upload proxy. */
|
|
432
|
+
uploadFile: (input) => P.uploadSlackChannelFile(projectId, input),
|
|
433
|
+
},
|
|
434
|
+
email: {
|
|
435
|
+
installation: (connectorSlug) => P.getEmailInstallation(projectId, connectorSlug),
|
|
436
|
+
mode: () => P.getEmailMode(projectId),
|
|
437
|
+
connect: (input) => P.connectEmail(projectId, input),
|
|
438
|
+
disconnect: (connectorSlug) => P.disconnectEmail(projectId, connectorSlug),
|
|
439
|
+
updatePolicy: (...a) => P.updateEmailPolicy(projectId, ...a),
|
|
440
|
+
},
|
|
441
|
+
meet: {
|
|
442
|
+
voices: () => P.getMeetVoices(projectId),
|
|
443
|
+
setVoice: (voice) => P.setMeetVoice(projectId, voice),
|
|
444
|
+
setBotName: (name) => P.setMeetBotName(projectId, name),
|
|
445
|
+
previewVoice: (voiceId) => P.previewMeetVoice(projectId, voiceId),
|
|
446
|
+
/** Make the meeting bot speak text (text → ElevenLabs → Recall `output_audio`). */
|
|
447
|
+
speak: (botId, text, voice) => P.speakInMeeting(projectId, botId, text, voice),
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
/** Project apps/deployments — the `/projects/:id/apps/*` family. */
|
|
451
|
+
apps: {
|
|
452
|
+
list: () => P.listProjectApps(projectId),
|
|
453
|
+
create: (input) => P.createProjectApp(projectId, input),
|
|
454
|
+
update: (...a) => P.updateProjectApp(projectId, ...a),
|
|
455
|
+
remove: (slug) => P.deleteProjectApp(projectId, slug),
|
|
456
|
+
deploy: (slug) => P.deployProjectApp(projectId, slug),
|
|
457
|
+
stop: (slug) => P.stopProjectApp(projectId, slug),
|
|
458
|
+
logs: (slug) => P.getProjectAppLogs(projectId, slug),
|
|
459
|
+
/** @deprecated Use `updateExperimentalFeature('apps', enabled)` — kept for parity with the underlying client. */
|
|
460
|
+
updateConfig: (input) => P.updateAppsConfig(projectId, input),
|
|
461
|
+
},
|
|
462
|
+
/** Toggle an experimental feature (Customize → Settings → Experimental). Pass `enabled: null` to clear the override. */
|
|
463
|
+
updateExperimentalFeature: (...a) => P.updateExperimentalFeature(projectId, ...a),
|
|
464
|
+
/** Default model preferences (account/agent/project scope, gateway-resolved). */
|
|
465
|
+
modelDefaults: {
|
|
466
|
+
get: () => P.getModelDefaults(projectId),
|
|
467
|
+
set: (input) => P.setModelDefault(projectId, input),
|
|
468
|
+
clear: (params) => P.clearModelDefault(projectId, params),
|
|
469
|
+
},
|
|
470
|
+
/** Sandbox templates + snapshot builds — Dockerfile/image/warm-pool config, beyond `sandboxHealth`/`sandboxTemplates`. */
|
|
471
|
+
sandbox: {
|
|
472
|
+
list: () => P.listProjectSandboxes(projectId),
|
|
473
|
+
snapshots: () => P.listProjectSnapshots(projectId),
|
|
474
|
+
rebuildSnapshot: (slug) => P.rebuildProjectSnapshot(projectId, slug),
|
|
475
|
+
fixWithAgent: () => P.fixSandboxWithAgent(projectId),
|
|
476
|
+
createTemplate: (input) => P.createSandboxTemplate(projectId, input),
|
|
477
|
+
updateTemplate: (...a) => P.updateSandboxTemplate(projectId, ...a),
|
|
478
|
+
removeTemplate: (templateId) => P.deleteSandboxTemplate(projectId, templateId),
|
|
479
|
+
buildTemplate: (templateId) => P.buildSandboxTemplate(projectId, templateId),
|
|
480
|
+
/** Pin/clear the per-project sandbox provider (null = follow the platform default). */
|
|
481
|
+
setProvider: (provider) => P.updateProjectSandboxProvider(projectId, provider),
|
|
482
|
+
},
|
|
483
|
+
/** Bind specific secrets + connectors to an agent (the inheritance pyramid's declaration step). */
|
|
484
|
+
setAgentScope: (...a) => P.setAgentScope(projectId, ...a),
|
|
485
|
+
session: (sessionId) => session(projectId, sessionId),
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
/** Id-bound handle for a single session: lifecycle (REST) + runtime (opencode). */
|
|
489
|
+
function session(projectId, sessionId) {
|
|
490
|
+
// Opinionated-action state, scoped to THIS handle. The opencode runtime is
|
|
491
|
+
// keyed by the OpenCode session id (resolved server-side at /start), NOT the
|
|
492
|
+
// Kortix `sessionId` — they differ. We resolve+cache it once (including the
|
|
493
|
+
// resolved runtime URL + sandbox id), and remember a chosen model so `send`
|
|
494
|
+
// carries it. Every runtime-scoped operation below reads ONLY this cached
|
|
495
|
+
// record — never the module-global "currently active" runtime — so two
|
|
496
|
+
// session handles pointed at two different sandboxes never cross wires.
|
|
497
|
+
let _ready = null;
|
|
498
|
+
let _model;
|
|
499
|
+
let _agent;
|
|
500
|
+
/**
|
|
501
|
+
* Adopt an already-resolved runtime for THIS (projectId, sessionId) from
|
|
502
|
+
* the shared session-runtime registry, if this handle hasn't resolved one
|
|
503
|
+
* itself yet. This is what lets a brand-new `kortix.session(pid, sid)`
|
|
504
|
+
* handle — e.g. a one-off poll tick, or a handle created independently of
|
|
505
|
+
* the one that actually drove `/start` — use a session another handle (or
|
|
506
|
+
* the React `useSession` hook) already brought up, instead of throwing
|
|
507
|
+
* `SessionNotReadyError` or re-provisioning.
|
|
508
|
+
*/
|
|
509
|
+
function tryResolveReady() {
|
|
510
|
+
if (_ready)
|
|
511
|
+
return _ready;
|
|
512
|
+
const cached = getSessionRuntime(projectId, sessionId);
|
|
513
|
+
if (cached)
|
|
514
|
+
_ready = cached;
|
|
515
|
+
return _ready;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Make this session's runtime reachable and return its OpenCode session id
|
|
519
|
+
* (plus this handle's own resolved runtime URL + sandbox id). Idempotent:
|
|
520
|
+
* adopts the registry entry if another handle already resolved this
|
|
521
|
+
* session; otherwise `start` provisions/resumes the sandbox (long-poll
|
|
522
|
+
* until ready) — which itself populates the registry on success — and we
|
|
523
|
+
* cache the resolved runtime for THIS handle. Also points the app's shared
|
|
524
|
+
* "current runtime" store there, for React hosts that still read it.
|
|
525
|
+
*/
|
|
526
|
+
async function ensureReady() {
|
|
527
|
+
const cached = tryResolveReady();
|
|
528
|
+
if (cached)
|
|
529
|
+
return cached;
|
|
530
|
+
// Dedup concurrent starts for this (projectId, sessionId) — see
|
|
531
|
+
// `inFlightSessionStarts`'s doc comment. If another call (this handle or
|
|
532
|
+
// a different one) already kicked off `/start`, ride its result instead
|
|
533
|
+
// of issuing a second POST.
|
|
534
|
+
const key = `${projectId}\n${sessionId}`;
|
|
535
|
+
const inFlight = inFlightSessionStarts.get(key);
|
|
536
|
+
if (inFlight) {
|
|
537
|
+
_ready = await inFlight;
|
|
538
|
+
return _ready;
|
|
539
|
+
}
|
|
540
|
+
const startPromise = (async () => {
|
|
541
|
+
const started = await P.startProjectSession(projectId, sessionId, 30_000);
|
|
542
|
+
if (!started ||
|
|
543
|
+
started.stage !== 'ready' ||
|
|
544
|
+
!started.sandbox ||
|
|
545
|
+
!started.opencode_session_id) {
|
|
546
|
+
throw new ApiError(`Session runtime not ready (stage: ${started?.stage ?? 'unknown'})`, {
|
|
547
|
+
code: 'RUNTIME_UNAVAILABLE',
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const externalId = started.sandbox.external_id;
|
|
551
|
+
if (!externalId) {
|
|
552
|
+
throw new ApiError('Session sandbox has no external_id — cannot resolve its runtime URL', {
|
|
553
|
+
code: 'RUNTIME_UNAVAILABLE',
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
const runtimeUrl = getSandboxUrlForExternalId(externalId);
|
|
557
|
+
// Point the app's shared runtime store at this session too, so React
|
|
558
|
+
// hosts (which read the global current-runtime) keep working — but this
|
|
559
|
+
// handle's own operations never read it back, only `_ready` below.
|
|
560
|
+
setCurrentRuntime(runtimeUrl, externalId);
|
|
561
|
+
return { opencodeSessionId: started.opencode_session_id, runtimeUrl, sandboxId: externalId };
|
|
562
|
+
})();
|
|
563
|
+
inFlightSessionStarts.set(key, startPromise);
|
|
564
|
+
try {
|
|
565
|
+
_ready = await startPromise;
|
|
566
|
+
return _ready;
|
|
567
|
+
}
|
|
568
|
+
finally {
|
|
569
|
+
if (inFlightSessionStarts.get(key) === startPromise) {
|
|
570
|
+
inFlightSessionStarts.delete(key);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
/** Throw `SessionNotReadyError` if neither this handle nor the registry has resolved a runtime yet. */
|
|
575
|
+
function requireReady(action) {
|
|
576
|
+
const ready = tryResolveReady();
|
|
577
|
+
if (!ready)
|
|
578
|
+
throw new SessionNotReadyError(action);
|
|
579
|
+
return ready;
|
|
580
|
+
}
|
|
581
|
+
/** Clear this handle's cached runtime + the shared registry entry (restart/delete). */
|
|
582
|
+
function forgetReady() {
|
|
583
|
+
_ready = null;
|
|
584
|
+
clearSessionRuntime(projectId, sessionId);
|
|
585
|
+
}
|
|
586
|
+
return {
|
|
587
|
+
// ── lifecycle (Kortix REST) ──────────────────────────────────────────
|
|
588
|
+
get: (opts) => P.getProjectSession(projectId, sessionId, opts),
|
|
589
|
+
update: (input) => P.updateProjectSession(projectId, sessionId, input),
|
|
590
|
+
delete: () => {
|
|
591
|
+
// A deleted session's sandbox is gone — never let a later handle for
|
|
592
|
+
// this (projectId, sessionId) resolve a runtime that no longer exists.
|
|
593
|
+
forgetReady();
|
|
594
|
+
return P.deleteProjectSession(projectId, sessionId);
|
|
595
|
+
},
|
|
596
|
+
start: (...a) => P.startProjectSession(projectId, sessionId, ...a),
|
|
597
|
+
restart: () => {
|
|
598
|
+
// Restart may re-provision a DIFFERENT sandbox — a stale cached/
|
|
599
|
+
// registered runtime would route subsequent calls at a dead box.
|
|
600
|
+
forgetReady();
|
|
601
|
+
return P.restartProjectSession(projectId, sessionId);
|
|
602
|
+
},
|
|
603
|
+
stop: () => {
|
|
604
|
+
forgetReady();
|
|
605
|
+
return P.stopProjectSession(projectId, sessionId);
|
|
606
|
+
},
|
|
607
|
+
setSharing: (intent) => P.setProjectSessionSharing(projectId, sessionId, intent),
|
|
608
|
+
previews: () => P.getSessionPreviewCandidates(projectId, sessionId),
|
|
609
|
+
commit: (input) => P.commitSessionChanges(projectId, sessionId, input),
|
|
610
|
+
publicShares: {
|
|
611
|
+
list: () => P.listSessionPublicShares(projectId, sessionId),
|
|
612
|
+
create: (...a) => P.createSessionPublicShare(projectId, sessionId, ...a),
|
|
613
|
+
revoke: (...a) => P.revokeSessionPublicShare(projectId, sessionId, ...a),
|
|
614
|
+
},
|
|
615
|
+
/** Per-session audit trail of executor-gated agent actions. */
|
|
616
|
+
audit: (limit, options) => P.getSessionAudit(projectId, sessionId, limit, options),
|
|
617
|
+
/** Compact server-side transcript read (text + tool calls, no tool inputs/outputs) — callable with project-scoped session tokens. */
|
|
618
|
+
transcript: (options) => P.getSessionTranscript(projectId, sessionId, options),
|
|
619
|
+
/**
|
|
620
|
+
* Resolve THIS handle's own runtime (idempotent): provisions/resumes the
|
|
621
|
+
* sandbox (long-poll until ready) and caches the resolved OpenCode session
|
|
622
|
+
* id + runtime URL + sandbox id for every other call on this handle. Call
|
|
623
|
+
* this (or `send`/`abort`, which call it internally) before `.runtime`,
|
|
624
|
+
* `.health()`, `.previewUrl()`, or `.proxyUrl()` — those throw
|
|
625
|
+
* `SessionNotReadyError` instead of falling back to whatever sandbox
|
|
626
|
+
* happens to be globally active.
|
|
627
|
+
*/
|
|
628
|
+
ensureReady,
|
|
629
|
+
// ── runtime health + preview (the session owns its runtime) ──────────
|
|
630
|
+
/**
|
|
631
|
+
* Liveness/readiness of THIS session's runtime (`GET /kortix/health`).
|
|
632
|
+
* Unlike `.previewUrl()`/`.proxyUrl()`/`.runtime`, this never throws
|
|
633
|
+
* `SessionNotReadyError` — a health poller (e.g. a header dot ticking
|
|
634
|
+
* every 15s on a fresh inline handle) needs to be callable BEFORE the
|
|
635
|
+
* session has ever resolved a runtime. It degrades to the same graceful
|
|
636
|
+
* `{ status: 0, ok: false }` shape `getSessionHealth` already returns for
|
|
637
|
+
* "no URL yet", instead of forcing every caller to guard with `ensureReady()`.
|
|
638
|
+
*/
|
|
639
|
+
health: (init) => getSessionHealth(tryResolveReady()?.runtimeUrl ?? null, init),
|
|
640
|
+
/** Proxy/preview URL for a port THIS session's runtime exposes. */
|
|
641
|
+
previewUrl: (port, path = '/') => rewriteLocalhostUrl(port, path, resolvePreviewOptsForSandbox(requireReady('previewUrl').sandboxId)),
|
|
642
|
+
/** Rewrite a localhost URL the agent printed into a reachable proxy URL. */
|
|
643
|
+
proxyUrl: (url) => proxyLocalhostUrl(url, resolvePreviewOptsForSandbox(requireReady('proxyUrl').sandboxId)),
|
|
644
|
+
// ── agent actions (opinionated wrappers over the runtime) ────────────
|
|
645
|
+
// These do the right thing end-to-end for scripts/non-React hosts: ensure
|
|
646
|
+
// the runtime is up, resolve the OpenCode session id, and act through a
|
|
647
|
+
// client bound to THIS handle's own runtime URL (never the module-global
|
|
648
|
+
// "active" one, so parallel handles on different sandboxes never cross
|
|
649
|
+
// wires). React hosts use `@kortix/sdk/react` hooks instead, which bind to
|
|
650
|
+
// the same resolved id reactively (see the white-label reference app).
|
|
651
|
+
/** Pick the model `send` will use for subsequent prompts (until changed). */
|
|
652
|
+
setModel: (model) => {
|
|
653
|
+
_model = model;
|
|
654
|
+
},
|
|
655
|
+
/** Pick the agent `send` will use for subsequent prompts (until changed). */
|
|
656
|
+
setAgent: (agent) => {
|
|
657
|
+
_agent = agent;
|
|
658
|
+
},
|
|
659
|
+
/**
|
|
660
|
+
* Provision/resume if needed, then send a text prompt to the agent. A
|
|
661
|
+
* per-call `{ model, agent }` overrides the sticky setModel/setAgent
|
|
662
|
+
* choices for this message only.
|
|
663
|
+
*/
|
|
664
|
+
send: async (text, opts) => {
|
|
665
|
+
const { opencodeSessionId, runtimeUrl } = await ensureReady();
|
|
666
|
+
const model = opts?.model ?? _model;
|
|
667
|
+
const agent = opts?.agent ?? _agent;
|
|
668
|
+
return getClientForUrl(runtimeUrl).session.prompt({
|
|
669
|
+
sessionID: opencodeSessionId,
|
|
670
|
+
parts: [{ type: 'text', text }],
|
|
671
|
+
...(model ? { model } : {}),
|
|
672
|
+
...(agent ? { agent } : {}),
|
|
673
|
+
});
|
|
674
|
+
},
|
|
675
|
+
/** Abort the agent's current run in this session. */
|
|
676
|
+
abort: async () => {
|
|
677
|
+
const { opencodeSessionId, runtimeUrl } = await ensureReady();
|
|
678
|
+
return getClientForUrl(runtimeUrl).session.abort({ sessionID: opencodeSessionId });
|
|
679
|
+
},
|
|
680
|
+
/**
|
|
681
|
+
* Live SSE stream of THIS session's runtime events (message/part
|
|
682
|
+
* updates, session status, permissions/questions, lsp diagnostics, …).
|
|
683
|
+
* A thin facade over the framework-free `openEventStream` primitive
|
|
684
|
+
* (`@kortix/sdk`'s `openEventStream`, also used verbatim by
|
|
685
|
+
* `@kortix/sdk/react`'s `useOpenCodeEventStream`): resolves THIS
|
|
686
|
+
* handle's own runtime first (`ensureReady()`), then connects a client
|
|
687
|
+
* bound to that runtime URL — never the module-global "active" one, so
|
|
688
|
+
* two session handles on two different sandboxes never cross wires.
|
|
689
|
+
* Framework-free — safe to call from a server-side "Kortix as a
|
|
690
|
+
* Backend" wrapper (Node/Bun), a worker, a CLI, or any non-React host.
|
|
691
|
+
*
|
|
692
|
+
* Handles connect/reconnect/backoff, a 15s heartbeat watchdog, and
|
|
693
|
+
* event coalescing internally. Call `handle.close()` to stop.
|
|
694
|
+
*
|
|
695
|
+
* const handle = await session.stream({ onEvent: (e) => console.log(e) });
|
|
696
|
+
* // later
|
|
697
|
+
* handle.close();
|
|
698
|
+
*/
|
|
699
|
+
stream: async (opts) => {
|
|
700
|
+
const { runtimeUrl } = await ensureReady();
|
|
701
|
+
return openEventStream({
|
|
702
|
+
client: getClientForUrl(runtimeUrl),
|
|
703
|
+
onEvent: opts.onEvent,
|
|
704
|
+
onGapRehydrate: opts.onGapRehydrate,
|
|
705
|
+
signal: opts.signal,
|
|
706
|
+
});
|
|
707
|
+
},
|
|
708
|
+
// ── runtime (opencode v2, THIS session's own sandbox) ────────────────
|
|
709
|
+
// The typed opencode client, reached ONLY through the SDK. The host never
|
|
710
|
+
// imports `@opencode-ai/sdk`. Opinionated wrappers (prompt/abort/setModel
|
|
711
|
+
// with server-owned side-effects) layer on top of this as they land.
|
|
712
|
+
get runtime() {
|
|
713
|
+
return getClientForUrl(requireReady('runtime').runtimeUrl);
|
|
714
|
+
},
|
|
715
|
+
/**
|
|
716
|
+
* Workspace file operations (daemon `/file` + `/find`) bound to THIS
|
|
717
|
+
* session's own resolved runtime — never the module-global "active"
|
|
718
|
+
* sandbox the top-level `@kortix/sdk` `files` export follows. Fixes a
|
|
719
|
+
* cross-session bleed: a host juggling multiple open sessions (e.g. a
|
|
720
|
+
* server wrapping several concurrent agent sessions) that called the
|
|
721
|
+
* global `files.list()` while a DIFFERENT session was "active" would
|
|
722
|
+
* silently read/write the wrong sandbox. Each call here auto-provisions
|
|
723
|
+
* via `ensureReady()` (same as `send`/`abort`/`stream`), then runs
|
|
724
|
+
* against this handle's own runtime URL. Same 12-op surface as the
|
|
725
|
+
* global `files` namespace, built from the same parameterized core
|
|
726
|
+
* (`@kortix/sdk/files`'s exports all take an optional trailing
|
|
727
|
+
* `baseUrl` — this just always supplies THIS session's).
|
|
728
|
+
*/
|
|
729
|
+
files: {
|
|
730
|
+
list: async (dirPath) => F.listFiles(dirPath, (await ensureReady()).runtimeUrl),
|
|
731
|
+
read: async (filePath) => F.readFile(filePath, (await ensureReady()).runtimeUrl),
|
|
732
|
+
readBlob: async (filePath) => F.readBlob(filePath, (await ensureReady()).runtimeUrl),
|
|
733
|
+
status: async () => F.getFileStatus((await ensureReady()).runtimeUrl),
|
|
734
|
+
findFiles: async (query, options) => F.findFiles(query, options, (await ensureReady()).runtimeUrl),
|
|
735
|
+
findText: async (pattern) => F.findText(pattern, (await ensureReady()).runtimeUrl),
|
|
736
|
+
upload: async (file, targetPath, filename) => F.uploadFile(file, targetPath, filename, (await ensureReady()).runtimeUrl),
|
|
737
|
+
create: async (filePath) => F.createFile(filePath, (await ensureReady()).runtimeUrl),
|
|
738
|
+
copy: async (sourcePath, destPath) => F.copyFile(sourcePath, destPath, (await ensureReady()).runtimeUrl),
|
|
739
|
+
remove: async (filePath) => F.deleteFile(filePath, (await ensureReady()).runtimeUrl),
|
|
740
|
+
mkdir: async (dirPath) => F.mkdir(dirPath, (await ensureReady()).runtimeUrl),
|
|
741
|
+
rename: async (from, to) => F.renameFile(from, to, (await ensureReady()).runtimeUrl),
|
|
742
|
+
},
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return {
|
|
746
|
+
/** The platform config in effect (for diagnostics). */
|
|
747
|
+
config,
|
|
748
|
+
accounts,
|
|
749
|
+
/** Account-invite lifecycle reached by invite token alone (accept/decline/describe). */
|
|
750
|
+
accountInvites,
|
|
751
|
+
projects,
|
|
752
|
+
project,
|
|
753
|
+
session,
|
|
754
|
+
/** GitHub App installation + repository linking (account-scoped). */
|
|
755
|
+
github,
|
|
756
|
+
/** Billing read surface — credits/subscription/tier/transactions (not project-scoped). */
|
|
757
|
+
billing,
|
|
758
|
+
/** Public share links for a sandbox port (`/v1/p/share`, sandbox-scoped). */
|
|
759
|
+
sandboxShares,
|
|
760
|
+
/** Speech-to-text transcription (`/transcription` — not project-scoped). */
|
|
761
|
+
transcribe: P.transcribeAudio,
|
|
762
|
+
/** Deployment-wide Pipedream/easy-connect availability flag (not project-scoped). */
|
|
763
|
+
connectStatus,
|
|
764
|
+
/** Public marketplace catalog browse + sources (`/v1/marketplace/*`, not project-scoped). */
|
|
765
|
+
marketplace,
|
|
766
|
+
/** The pasted-API-key UX check — `GET /accounts/me`, never throws. */
|
|
767
|
+
validateToken: P.validateToken,
|
|
768
|
+
/** Escape hatch: the typed opencode client for the active sandbox. */
|
|
769
|
+
runtime,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
//# sourceMappingURL=kortix.js.map
|