@keystrokehq/cli 0.1.171 → 0.1.173
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 +24 -1
- package/dist/dist-BOlrsYA4.mjs +3 -0
- package/dist/{dist-CnddVrzY.mjs → dist-BUDyVVbj.mjs} +642 -6
- package/dist/dist-BUDyVVbj.mjs.map +1 -0
- package/dist/{dist-B8ZXKNXj.mjs → dist-D2xubfXd.mjs} +3560 -2633
- package/dist/dist-D2xubfXd.mjs.map +1 -0
- package/dist/{dist-C5ooQsTQ.mjs → dist-DRSCtW8V.mjs} +40 -4
- package/dist/dist-DRSCtW8V.mjs.map +1 -0
- package/dist/dist-n16MYIv2.mjs +4 -0
- package/dist/index.mjs +1 -1
- package/dist/{maybe-auto-update-28IpqxhP.mjs → maybe-auto-update-Dmcj8aoh.mjs} +2 -2
- package/dist/{maybe-auto-update-28IpqxhP.mjs.map → maybe-auto-update-Dmcj8aoh.mjs.map} +1 -1
- package/dist/{program-Ckl_ELbL.mjs → program-DO7ZQHjx.mjs} +651 -14
- package/dist/program-DO7ZQHjx.mjs.map +1 -0
- package/dist/{run-package-manager-update-CcJWW5xj.mjs → run-package-manager-update-Dvl8GJr2.mjs} +2 -2
- package/dist/{run-package-manager-update-CcJWW5xj.mjs.map → run-package-manager-update-Dvl8GJr2.mjs.map} +1 -1
- package/package.json +5 -4
- package/dist/dist-B8ZXKNXj.mjs.map +0 -1
- package/dist/dist-Brtmx-yx.mjs +0 -3
- package/dist/dist-C5ooQsTQ.mjs.map +0 -1
- package/dist/dist-CPGQbDRC.mjs +0 -4
- package/dist/dist-CnddVrzY.mjs.map +0 -1
- package/dist/program-Ckl_ELbL.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-
|
|
3
|
-
import { $ as DeclineOrganizationInvitationResponseSchema, $i as ConfirmCheckoutResponseSchema, $r as WorkflowRunResponseSchema, $t as McpDiscoverResponseSchema, A as CreateApiKeyRequestSchema, Ai as CredentialAssignmentListResponseSchema, An as ProjectGitRemoteResponseSchema, Ar as UpdateOrganizationMemberResponseSchema, At as ListAgentWorkspaceFilesResponseSchema, B as CreateOrganizationResponseSchema, Bn as PublicFormSubmitBodySchema, Br as UserAvatarSchema, Bt as ListOrganizationMembersPageQuerySchema, C as CompleteManagedDeployArtifactRequestSchema, Cn as PresignOrgLogoResponseSchema, Cr as TriggerRunDetailResponseSchema, Ct as HistoryRunListQuerySchema, D as ConnectAuthorizeUrlResponseSchema, Dn as PresignUserAvatarResponseSchema, Dr as UpdateCredentialRequestSchema, Dt as InviteProjectMembersRequestSchema, E as CompleteProjectArtifactResponseSchema, Ei as slugifyAppName, En as PresignUserAvatarRequestSchema, Er as UpdateCredentialInstanceBodySchema, Et as InviteOrganizationMembersResponseSchema, F as CreateCustomAppRequestSchema, Fn as ProjectSettingsResponseSchema, Fr as UpdateProjectSettingsRequestSchema, Ft as ListCredentialsPageResponseSchema, G as CreateSlackAppRequestSchema, Gn as PublishedFormSchema, Gr as WorkflowCanvasSchema, Gt as ListProjectMembersResponseSchema, H as CreateProjectArtifactResponseSchema, Hi as CLIENT_CHANNEL_HEADER, Hn as PublishManagedDeployCandidateRequestSchema, Hr as UserPreferencesSchema, Ht as ListOrganizationsResponseSchema, I as CreateCustomAppResponseSchema, In as ProjectSlugAvailabilityResponseSchema, Ir as UploadProjectSourceManifestRequestSchema, It as ListDraftFilesResponseSchema, J as CreateSlackChannelResponseSchema, Ji as BillingInvoiceUrlResponseSchema, Jn as RecentResourceListResponseSchema, Jr as WorkflowRunDetailResponseSchema, Jt as ListTemplatesResponseSchema, K as CreateSlackAppResponseSchema, Ki as AutoTopupSummarySchema, Kn as QueuedAgentPromptResponseSchema, Kr as WorkflowFormResponseSchema, Kt as ListProjectMetricsResponseSchema, L as CreateDraftCommitRequestSchema, Ln as PromptInputSchema, Lr as UploadProjectSourceResponseSchema, Lt as ListManagedServiceCredentialsResponseSchema, M as CreateCredentialInstanceBodySchema, Mi as CredentialConsumerListQuerySchema, Mn as ProjectPullStateSchema, Mr as UpdateProjectMemberRequestSchema, Mt as ListAppsResponseSchema, N as CreateCredentialsRequestSchema, Ni as CredentialConsumerListResponseSchema, Nn as ProjectReachabilityResponseSchema, Nr as UpdateProjectMemberResponseSchema, Nt as ListChannelPlatformsResponseSchema, O as ConnectManagedServiceCredentialRequestSchema, Oi as AssignCredentialBodySchema, Or as UpdateManagedServiceCredentialRequestSchema, Ot as InviteProjectMembersResponseSchema, P as CreateCredentialsResponseSchema, Pi as ExecuteKeystrokeToolRequestSchema, Pn as ProjectResponseSchema, Pr as UpdateProjectRequestSchema, Pt as ListCredentialsPageQuerySchema, Q as DOCS_SEARCH_TOOL, Qi as ConfirmCheckoutRequestSchema, Qn as SLACK_PERSONAL_APP_SLUG, Qr as WorkflowRunListResponseSchema, Qt as ManagedServiceKindSchema, R as CreateDraftDiffCommitRequestSchema, Rn as PromptResponseSchema, Rr as UpsertGatewayAttachmentBodySchema, Rt as ListMcpAppToolsResponseSchema, S as ChannelDirectoryListResponseSchema, Si as parseSlackConnectFlow, Sn as PresignOrgLogoRequestSchema, Sr as TriggerListResponseSchema, St as HistoryRunDetailResponseSchema, T as CompleteProjectArtifactRequestSchema, Ti as resolveDocsMcpUrl, Tn as PresignProjectSourceResponseSchema, Tr as UpdateChannelBindingBodySchema, Tt as InviteOrganizationMembersRequestSchema, U as CreateProjectRequestSchema, Ui as PresignChatAttachmentRequestSchema, Un as PublishManagedDeployCandidateResponseSchema, Ur as WorkflowCanvasCredentialBindingsSchema, Ut as ListProjectDeploymentsResponseSchema, V as CreateProjectArtifactRequestSchema, Vi as ACTIVE_ORG_HEADER, Vn as PublicFormSubmitResponseSchema, Vr as UserPreferencesPatchSchema, Vt as ListOrganizationMembersPageResponseSchema, W as CreateProjectResponseSchema, Wi as PresignChatAttachmentResponseSchema, Wn as PublishedFormListResponseSchema, Wr as WorkflowCanvasRunSchema, Wt as ListProjectFilesResponseSchema, X as CredentialInstanceRecordSchema, Xi as BillingSummaryResponseSchema, Xn as RenewManagedDeployUploadResponseSchema, Xr as WorkflowRunInputsPutBodySchema, Xt as ManagedDeployResourceKeySchema, Y as CredentialInstanceListResponseSchema, Yi as BillingRedirectResponseSchema, Yn as RenewManagedDeployUploadRequestSchema, Yr as WorkflowRunHooksResponseSchema, Yt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, Z as DOCS_QUERY_TOOL, Zi as BillingUsageResponseSchema, Zr as WorkflowRunInputsSchema, Zt as ManagedServiceCredentialSchema, _ as CatalogAppDetailResponseSchema, _i as normalizeDocsSearchPaths, _n as PlatformAgentSessionListResponseSchema, _r as SubmitTeamRequestRequestSchema, _t as GraphqlDiscoverResponseSchema, a as AgentSessionDetailResponseSchema, ai as WorkspaceTriggerOverviewSchema, an as PROJECT_DRAFT_DIFF_MAX_BYTES, ar as SlackAppManifestRequestSchema, at as DraftRevisionResponseSchema, b as ChannelConnectionListResponseSchema, bi as parseErrorResponse, bn as PresignCustomAppLogoRequestSchema, br as TriggerInvokeInputsSchema, bt as HeartbeatManagedDeployResponseSchema, c as AgentSummaryListResponseSchema, ci as buildAgentSlackDeeplink, cn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, cr as SlugAvailabilityResponseSchema, ct as DuplicateCredentialsResponseSchema, d as BindAgentSlackAppBodySchema, di as detectProjectPackageManagerFromSnapshot, dr as StartMcpOAuthConnectionInputSchema, dt as FormFieldConfigSchema, ea as CreateBillingPortalRequestSchema, ei as WorkflowSummaryDetailResponseSchema, en as OpenApiDiscoverResponseSchema, er as SkillSummaryDetailResponseSchema, et as DownloadActiveProjectArtifactResponseSchema, f as BindChannelBodySchema, fi as gitPorcelainLineTouchesManagedDraftPublishPath, fr as StartMcpOAuthConnectionResultSchema, ft as GatewayAttachmentRecordSchema, g as CatalogActionsPageResponseSchema, gn as PlatformAgentSessionDetailResponseSchema, gr as SubmitMarketingContactRequestSchema, gt as GetTemplateResponseSchema, h as CatalogActionDetailResponseSchema, hi as isIgnoredProjectSourcePath, hn as PlatformAgentPromptResponseSchema, hr as SubmitAgentFeedbackRequestSchema, ht as GetCustomAppResponseSchema, i as AgentEnvImageSnapshotResponseSchema, ii as WorkspaceTriggerListResponseSchema, in as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, ir as SlackAppListResponseSchema, it as DraftFileContentResponseSchema, j as CreateApiKeyResponseSchema, ji as CredentialAssignmentRecordSchema, jn as ProjectGitStatusResponseSchema, jr as UpdateOrganizationRequestSchema, jt as ListApiKeysResponseSchema, k as ConnectProvidersResponseSchema, ki as CredentialAssignmentListQuerySchema, kn as ProjectGitRemoteRequestSchema, kr as UpdateOrganizationMemberRequestSchema, kt as ListAgentMemoryFilesResponseSchema, l as AgentTriggerSummaryListResponseSchema, li as buildConnectDeeplink, lr as StartKeystrokeConnectionInputSchema, lt as FinalizeCustomAppLogoRequestSchema, m as CancelManagedDeployResponseSchema, mn as PlatformAgentPromptInputSchema, mr as StartOAuthConnectionResultSchema, mt as GetCredentialResponseSchema, n as ActiveOrganizationResponseSchema, na as CreateSubscriptionCheckoutRequestSchema, ni as WorkspaceTriggerDetailSchema, nn as OrganizationSidebarBrandingSchema, nr as SlackAgentMembershipsResponseSchema, nt as DraftCommitResponseSchema, o as AgentSessionListResponseSchema, oi as WorkspaceTriggerRunListResponseSchema, or as SlackAppManifestResponseSchema, ot as DraftUpdateEventSchema, p as CancelManagedDeployRequestSchema, pi as isAcceptableInstallExit, pn as PlatformAgentCancelResponseSchema, pr as StartOAuthConnectionInputSchema, pt as GetAppCatalogEntryResponseSchema, q as CreateSlackChannelBodySchema, qi as BillingActivityResponseSchema, qn as QueuedRunResponseSchema, qr as WorkflowFormUpsertBodySchema, qt as ListProjectsResponseSchema, r as ActiveProjectSourceRevisionSchema, ra as UpdateAutoTopupRequestSchema, ri as WorkspaceTriggerFileSchema, rn as PNPM_FROZEN_INSTALL_ARGS, rr as SlackAppInstallStartResponseSchema, rt as DraftConflictResponseSchema, s as AgentSummaryDetailResponseSchema, si as WorkspaceWorkflowOverviewSchema, sn as PROJECT_PULL_STATE_RELATIVE_PATH, sr as SlackMembershipChannelBodySchema, st as DuplicateCredentialRequestSchema, t as AcceptOrganizationInvitationResponseSchema, ta as CreateCreditsCheckoutRequestSchema, ti as WorkflowSummaryListResponseSchema, tn as OrganizationSidebarBrandingPatchSchema, tr as SkillSummaryListResponseSchema, tt as DownloadActiveProjectSourceResponseSchema, u as AppSlugAvailabilityResponseSchema, ui as deriveCustomAppDisplay, ur as StartKeystrokeConnectionResultSchema, ut as FinalizeCustomAppLogoResponseSchema, v as CatalogAppsPageResponseSchema, vn as PrepareManagedDeployRequestSchema, vr as TemplateFilesResponseSchema, vt as HealthResponseSchema, w as CompleteManagedDeployArtifactResponseSchema, wi as resolveConnectAppSlug, wn as PresignProjectSourceRequestSchema, wr as TriggerRunListResponseSchema, wt as HistoryRunListResponseSchema, x as ChannelConnectionSchema, xn as PresignCustomAppLogoResponseSchema, xr as TriggerInvokeResponseSchema, xt as HistoryRunCancelResponseSchema, y as ChannelAccountListResponseSchema, yi as parseAppSlug, yn as PrepareManagedDeployResponseSchema, yr as TriggerDetailResponseSchema, yt as HeartbeatManagedDeployRequestSchema, z as CreateOrganizationRequestSchema, zn as PublicFormMetadataSchema, zr as UserAvatarPatchSchema, zt as ListOrganizationInvitationsResponseSchema } from "./dist-CnddVrzY.mjs";
|
|
4
|
-
import { $ as withMcpReadClient, Q as assertPublicHttpUrl, Z as PublicHttpUrlError, _t as
|
|
5
|
-
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-
|
|
2
|
+
import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-Dvl8GJr2.mjs";
|
|
3
|
+
import { $ as CreateProjectArtifactRequestSchema, $i as parseErrorResponse, $n as PresignUserAvatarRequestSchema, $r as UpdateBrainDocumentMetadataRequestSchema, $t as ListBrainFiltersResponseSchema, A as ChannelConnectionSchema, Aa as BillingUsageResponseSchema, Ai as WorkflowRunInputsSchema, An as PROJECT_DRAFT_DIFF_MAX_BYTES, Ar as SlackAgentMembershipsResponseSchema, At as GetCredentialResponseSchema, B as CreateApiKeyResponseSchema, Bi as WorkspaceWorkflowOverviewSchema, Bn as PlatformAgentPromptResponseSchema, Br as StartMcpOAuthConnectionResultSchema, Bt as HistoryRunListResponseSchema, C as CancelManagedDeployResponseSchema, Ca as PresignChatAttachmentResponseSchema, Ci as WorkflowCanvasRunSchema, Cn as ManagedServiceKindSchema, Cr as RenewManagedDeployUploadRequestSchema, Ct as FinalizeBrainUploadsRequestSchema, D as CatalogAppsPageResponseSchema, Da as BillingInvoiceUrlResponseSchema, Di as WorkflowRunDetailResponseSchema, Dn as OrganizationSidebarBrandingSchema, Dt as FormFieldConfigSchema, E as CatalogAppDetailResponseSchema, Ea as BillingActivityResponseSchema, Ei as WorkflowFormUpsertBodySchema, En as OrganizationSidebarBrandingPatchSchema, Er as SLACK_PERSONAL_APP_SLUG, Et as FinalizeCustomAppLogoResponseSchema, F as CompleteProjectArtifactResponseSchema, Fa as CreateSubscriptionCheckoutRequestSchema, Fi as WorkspaceTriggerDetailSchema, Fr as SlackMembershipChannelBodySchema, Ft as HeartbeatManagedDeployRequestSchema, G as CreateCredentialsRequestSchema, Gi as gitPorcelainLineTouchesManagedDraftPublishPath, Gn as PrepareManagedDeployRequestSchema, Gr as SubmitTeamRequestRequestSchema, Gt as ListAgentMemoryFilesResponseSchema, H as CreateBrainGrantRequestSchema, Hi as buildConnectDeeplink, Hn as PlatformAgentSessionListResponseSchema, Hr as StartOAuthConnectionResultSchema, Ht as InviteOrganizationMembersResponseSchema, I as ConnectAuthorizeUrlResponseSchema, Ia as UpdateAutoTopupRequestSchema, Ii as WorkspaceTriggerFileSchema, Ir as SlugAvailabilityResponseSchema, It as HeartbeatManagedDeployResponseSchema, J as CreateCustomAppResponseSchema, Ji as isIgnoredProjectSourcePath, Jn as PresignCustomAppLogoResponseSchema, Jr as TriggerInvokeInputsSchema, Jt as ListAppsResponseSchema, K as CreateCredentialsResponseSchema, Ki as isAcceptableInstallExit, Kn as PrepareManagedDeployResponseSchema, Kr as TemplateFilesResponseSchema, Kt as ListAgentWorkspaceFilesResponseSchema, L as ConnectManagedServiceCredentialRequestSchema, Li as WorkspaceTriggerListResponseSchema, Lr as StartKeystrokeConnectionInputSchema, Lt as HistoryRunCancelResponseSchema, M as CompleteManagedDeployArtifactRequestSchema, Ma as ConfirmCheckoutResponseSchema, Mi as WorkflowRunResponseSchema, Mn as PROJECT_PULL_STATE_RELATIVE_PATH, Mr as SlackAppListResponseSchema, Mt as GetTemplateResponseSchema, N as CompleteManagedDeployArtifactResponseSchema, Na as CreateBillingPortalRequestSchema, Ni as WorkflowSummaryDetailResponseSchema, Nn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, Nr as SlackAppManifestRequestSchema, Nt as GraphqlDiscoverResponseSchema, O as ChannelAccountListResponseSchema, Oa as BillingRedirectResponseSchema, Oi as WorkflowRunHooksResponseSchema, On as PNPM_FROZEN_INSTALL_ARGS, Or as SkillSummaryDetailResponseSchema, Ot as GatewayAttachmentRecordSchema, P as CompleteProjectArtifactRequestSchema, Pa as CreateCreditsCheckoutRequestSchema, Pi as WorkflowSummaryListResponseSchema, Pr as SlackAppManifestResponseSchema, Pt as HealthResponseSchema, Q as CreateOrganizationResponseSchema, Qi as parseAppSlug, Qn as PresignProjectSourceResponseSchema, Qr as TriggerRunListResponseSchema, Qt as ListBrainDocumentsResponseSchema, R as ConnectProvidersResponseSchema, Ri as WorkspaceTriggerOverviewSchema, Rn as PlatformAgentCancelResponseSchema, Rr as StartKeystrokeConnectionResultSchema, Rt as HistoryRunDetailResponseSchema, S as CancelManagedDeployRequestSchema, Sa as PresignChatAttachmentRequestSchema, Si as WorkflowCanvasCredentialBindingsSchema, Sn as ManagedServiceCredentialSchema, Sr as RecentResourceListResponseSchema, St as DuplicateCredentialsResponseSchema, T as CatalogActionsPageResponseSchema, Ta as AutoTopupSummarySchema, Ti as WorkflowFormResponseSchema, Tn as OpenApiDiscoverResponseSchema, Tt as FinalizeCustomAppLogoRequestSchema, U as CreateBrainRequestSchema, Ui as deriveCustomAppDisplay, Un as PrepareBrainUploadsRequestSchema, Ur as SubmitAgentFeedbackRequestSchema, Ut as InviteProjectMembersRequestSchema, V as CreateBrainFilterRequestSchema, Vi as buildAgentSlackDeeplink, Vn as PlatformAgentSessionDetailResponseSchema, Vr as StartOAuthConnectionInputSchema, Vt as InviteOrganizationMembersRequestSchema, W as CreateCredentialInstanceBodySchema, Wi as detectProjectPackageManagerFromSnapshot, Wn as PrepareBrainUploadsResponseSchema, Wr as SubmitMarketingContactRequestSchema, Wt as InviteProjectMembersResponseSchema, X as CreateDraftDiffCommitRequestSchema, Xi as normalizeDocsSearchPaths, Xn as PresignOrgLogoResponseSchema, Xr as TriggerListResponseSchema, Xt as ListBrainDocumentWritesResponseSchema, Y as CreateDraftCommitRequestSchema, Yn as PresignOrgLogoRequestSchema, Yr as TriggerInvokeResponseSchema, Yt as ListBrainDocumentWritesQuerySchema, Z as CreateOrganizationRequestSchema, Zn as PresignProjectSourceRequestSchema, Zr as TriggerRunDetailResponseSchema, Zt as ListBrainDocumentsQuerySchema, _ as BrainFilterExpressionSchema, _i as UpsertGatewayAttachmentBodySchema, _n as ListProjectMetricsResponseSchema, _r as PublishedFormListResponseSchema, _t as DraftConflictResponseSchema, a as AgentEnvImageSnapshotResponseSchema, aa as slugifyAppName, ai as UpdateCredentialInstanceBodySchema, an as ListCredentialsPageResponseSchema, ar as ProjectPullStateSchema, at as CreateSlackChannelBodySchema, b as BrainIndexConfigSchema, ba as ACTIVE_ORG_HEADER, bi as UserPreferencesPatchSchema, bn as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, br as QueuedRunResponseSchema, bt as DraftUpdateEventSchema, c as AgentSummaryDetailResponseSchema, ca as CredentialAssignmentListQuerySchema, ci as UpdateOrganizationMemberRequestSchema, cn as ListManagedServiceCredentialsResponseSchema, cr as ProjectSettingsResponseSchema, ct as CredentialInstanceRecordSchema, d as AppSlugAvailabilityResponseSchema, da as CredentialConsumerListQuerySchema, di as UpdateProjectMemberRequestSchema, dn as ListOrganizationMembersPageQuerySchema, dr as PromptResponseSchema, dt as DeclineOrganizationInvitationResponseSchema, ei as UpdateBrainFilterRequestSchema, en as ListBrainGrantsResponseSchema, er as PresignUserAvatarResponseSchema, et as CreateProjectArtifactResponseSchema, f as BindAgentSlackAppBodySchema, fa as CredentialConsumerListResponseSchema, fi as UpdateProjectMemberResponseSchema, fn as ListOrganizationMembersPageResponseSchema, fr as PublicFormMetadataSchema, ft as DeleteBrainDocumentsRequestSchema, gi as UploadProjectSourceResponseSchema, gn as ListProjectMembersResponseSchema, gr as PublishManagedDeployCandidateResponseSchema, gt as DraftCommitResponseSchema, h as BrainDocumentDetailSchema, hi as UploadProjectSourceManifestRequestSchema, hn as ListProjectFilesResponseSchema, hr as PublishManagedDeployCandidateRequestSchema, ht as DownloadActiveProjectSourceResponseSchema, i as AddBrainMemberRequestSchema, ia as resolveDocsMcpUrl, ii as UpdateChannelBindingBodySchema, in as ListCredentialsPageQuerySchema, ir as ProjectGitStatusResponseSchema, it as CreateSlackAppResponseSchema, j as ChannelDirectoryListResponseSchema, ja as ConfirmCheckoutRequestSchema, ji as WorkflowRunListResponseSchema, jr as SlackAppInstallStartResponseSchema, jt as GetCustomAppResponseSchema, k as ChannelConnectionListResponseSchema, ka as BillingSummaryResponseSchema, ki as WorkflowRunInputsPutBodySchema, kn as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, kr as SkillSummaryListResponseSchema, kt as GetAppCatalogEntryResponseSchema, l as AgentSummaryListResponseSchema, la as CredentialAssignmentListResponseSchema, li as UpdateOrganizationMemberResponseSchema, ln as ListMcpAppToolsResponseSchema, lr as ProjectSlugAvailabilityResponseSchema, lt as DOCS_QUERY_TOOL, m as BrainDetailSchema, mi as UpdateProjectSettingsRequestSchema, mn as ListProjectDeploymentsResponseSchema, mr as PublicFormSubmitResponseSchema, mt as DownloadActiveProjectArtifactResponseSchema, n as ActiveOrganizationResponseSchema, ni as UpdateBrainRequestSchema, nn as ListBrainsResponseSchema, nr as ProjectGitRemoteRequestSchema, nt as CreateProjectResponseSchema, o as AgentSessionDetailResponseSchema, oi as UpdateCredentialRequestSchema, on as ListDraftFilesResponseSchema, or as ProjectReachabilityResponseSchema, ot as CreateSlackChannelResponseSchema, p as BindChannelBodySchema, pa as ExecuteKeystrokeToolRequestSchema, pi as UpdateProjectRequestSchema, pn as ListOrganizationsResponseSchema, pr as PublicFormSubmitBodySchema, pt as DeleteBrainDocumentsResponseSchema, q as CreateCustomAppRequestSchema, qn as PresignCustomAppLogoRequestSchema, qr as TriggerDetailResponseSchema, qt as ListApiKeysResponseSchema, r as ActiveProjectSourceRevisionSchema, ra as resolveConnectAppSlug, ri as UpdateBrainResponseSchema, rn as ListChannelPlatformsResponseSchema, rr as ProjectGitRemoteResponseSchema, rt as CreateSlackAppRequestSchema, s as AgentSessionListResponseSchema, sa as AssignCredentialBodySchema, si as UpdateManagedServiceCredentialRequestSchema, sn as ListEmbeddingModelsResponseSchema, sr as ProjectResponseSchema, st as CredentialInstanceListResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ta as parseSlackConnectFlow, ti as UpdateBrainMemberRequestSchema, tn as ListBrainMembersResponseSchema, tt as CreateProjectRequestSchema, u as AgentTriggerSummaryListResponseSchema, ua as CredentialAssignmentRecordSchema, ui as UpdateOrganizationRequestSchema, un as ListOrganizationInvitationsResponseSchema, ur as PromptInputSchema, ut as DOCS_SEARCH_TOOL, v as BrainFilterSummarySchema, vi as UserAvatarPatchSchema, vn as ListProjectsResponseSchema, vr as PublishedFormSchema, vt as DraftFileContentResponseSchema, w as CatalogActionDetailResponseSchema, wi as WorkflowCanvasSchema, wn as McpDiscoverResponseSchema, wr as RenewManagedDeployUploadResponseSchema, wt as FinalizeBrainUploadsResponseSchema, x as BrainMemberSchema, xa as CLIENT_CHANNEL_HEADER, xi as UserPreferencesSchema, xn as ManagedDeployResourceKeySchema, xr as RebuildBrainResponseSchema, xt as DuplicateCredentialRequestSchema, y as BrainGrantSchema, yi as UserAvatarSchema, yn as ListTemplatesResponseSchema, yr as QueuedAgentPromptResponseSchema, yt as DraftRevisionResponseSchema, z as CreateApiKeyRequestSchema, zi as WorkspaceTriggerRunListResponseSchema, zn as PlatformAgentPromptInputSchema, zr as StartMcpOAuthConnectionInputSchema, zt as HistoryRunListQuerySchema } from "./dist-BUDyVVbj.mjs";
|
|
4
|
+
import { $ as withMcpReadClient, Ct as stopBrowserUseSession, Dt as event, Et as configureTelemetry, Ot as flushTelemetry, Q as assertPublicHttpUrl, St as runAgentBrowser, Tt as captureException, Z as PublicHttpUrlError, _t as defaultBrowserProfilesRoot, bt as resolveBrowserContext, et as artifactIndexFromModules, gt as agentBrowserProfilePath, kt as shutdownTelemetry, nt as moduleBlobRefsFromModules, rt as mapInParallelBatches, tt as collectArtifactModules, vt as deleteBrowserUseProfile, wt as alias, xt as resolveBrowserProvider, yt as openCloudBrowserLogin } from "./dist-D2xubfXd.mjs";
|
|
5
|
+
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-DRSCtW8V.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import { homedir, platform, release, tmpdir } from "node:os";
|
|
@@ -4865,6 +4865,24 @@ function createAgentsResource(http) {
|
|
|
4865
4865
|
} catch (error) {
|
|
4866
4866
|
throw await toPlatformError(error);
|
|
4867
4867
|
}
|
|
4868
|
+
},
|
|
4869
|
+
/** Live browser session metadata (liveUrl, recordings) for the agent session. */
|
|
4870
|
+
async getBrowserSession(projectId, agentSlug, sessionId) {
|
|
4871
|
+
try {
|
|
4872
|
+
return await http.get(`api/projects/${encodeURIComponent(projectId)}/agents/${encodeURIComponent(agentSlug)}/browser/sessions/${encodeURIComponent(sessionId)}`).json();
|
|
4873
|
+
} catch (error) {
|
|
4874
|
+
const platformError = await toPlatformError(error);
|
|
4875
|
+
if (platformError.status === 404) return null;
|
|
4876
|
+
throw platformError;
|
|
4877
|
+
}
|
|
4878
|
+
},
|
|
4879
|
+
/** Open a Browser Use live session for login (platform holds the API key). */
|
|
4880
|
+
async openBrowserSession(projectId, agentSlug, body) {
|
|
4881
|
+
try {
|
|
4882
|
+
return await http.post(`api/projects/${encodeURIComponent(projectId)}/agents/${encodeURIComponent(agentSlug)}/browser/open`, { json: body ?? {} }).json();
|
|
4883
|
+
} catch (error) {
|
|
4884
|
+
throw await toPlatformError(error);
|
|
4885
|
+
}
|
|
4868
4886
|
}
|
|
4869
4887
|
};
|
|
4870
4888
|
}
|
|
@@ -5996,6 +6014,254 @@ function createBillingResource(http) {
|
|
|
5996
6014
|
}
|
|
5997
6015
|
};
|
|
5998
6016
|
}
|
|
6017
|
+
/**
|
|
6018
|
+
* Organization-scoped Brains resource.
|
|
6019
|
+
*
|
|
6020
|
+
* Human Brain management is served by the org-scoped platform routes under
|
|
6021
|
+
* `/api/brains*`; the active organization travels on the client's
|
|
6022
|
+
* organization header (same as `triggers` / `members`). Access is
|
|
6023
|
+
* membership-based: the caller must hold a Brain `owner`/`admin` membership —
|
|
6024
|
+
* project grants only authorize deployed project runtimes and are managed
|
|
6025
|
+
* here as the `/projects` sub-resource.
|
|
6026
|
+
*/
|
|
6027
|
+
function brainPath(brainSlug) {
|
|
6028
|
+
const base = "/api/brains";
|
|
6029
|
+
return brainSlug === void 0 ? base : `${base}/${encodeURIComponent(brainSlug)}`;
|
|
6030
|
+
}
|
|
6031
|
+
/** documentIds are relative paths (`reports/q1.pdf`): keep `/`, escape each segment. */
|
|
6032
|
+
function encodeDocumentPath(documentId) {
|
|
6033
|
+
return documentId.split("/").map(encodeURIComponent).join("/");
|
|
6034
|
+
}
|
|
6035
|
+
function appendQueryValues(query, key, values) {
|
|
6036
|
+
for (const value of values ?? []) query.append(key, value);
|
|
6037
|
+
}
|
|
6038
|
+
function documentsQueryString(input) {
|
|
6039
|
+
const parsed = ListBrainDocumentsQuerySchema.parse(input);
|
|
6040
|
+
const query = new URLSearchParams({ limit: String(parsed.limit) });
|
|
6041
|
+
if (parsed.prefix) query.set("prefix", parsed.prefix);
|
|
6042
|
+
if (parsed.search) query.set("search", parsed.search);
|
|
6043
|
+
appendQueryValues(query, "source", parsed.source);
|
|
6044
|
+
appendQueryValues(query, "provisionerKind", parsed.provisionerKind);
|
|
6045
|
+
if (parsed.filterSlug) query.set("filterSlug", parsed.filterSlug);
|
|
6046
|
+
if (parsed.cursor) query.set("cursor", parsed.cursor);
|
|
6047
|
+
return query.toString();
|
|
6048
|
+
}
|
|
6049
|
+
function documentWritesQueryString(input) {
|
|
6050
|
+
const parsed = ListBrainDocumentWritesQuerySchema.parse(input);
|
|
6051
|
+
const query = new URLSearchParams({
|
|
6052
|
+
documentId: parsed.documentId,
|
|
6053
|
+
limit: String(parsed.limit)
|
|
6054
|
+
});
|
|
6055
|
+
if (parsed.cursor) query.set("cursor", parsed.cursor);
|
|
6056
|
+
return query.toString();
|
|
6057
|
+
}
|
|
6058
|
+
function createBrainsResource(http) {
|
|
6059
|
+
return {
|
|
6060
|
+
/** Brains the caller owns or administers (membership, not project grants). */
|
|
6061
|
+
async list() {
|
|
6062
|
+
try {
|
|
6063
|
+
const data = await http.get(brainPath()).json();
|
|
6064
|
+
return ListBrainsResponseSchema.parse(data).brains;
|
|
6065
|
+
} catch (error) {
|
|
6066
|
+
throw await toPlatformError(error);
|
|
6067
|
+
}
|
|
6068
|
+
},
|
|
6069
|
+
async get(brainSlug) {
|
|
6070
|
+
try {
|
|
6071
|
+
return BrainDetailSchema.parse(await http.get(brainPath(brainSlug)).json());
|
|
6072
|
+
} catch (error) {
|
|
6073
|
+
throw await toPlatformError(error);
|
|
6074
|
+
}
|
|
6075
|
+
},
|
|
6076
|
+
/** Creates a base Brain; the caller becomes its sole owner. No project is granted. */
|
|
6077
|
+
async create(input) {
|
|
6078
|
+
const body = CreateBrainRequestSchema.parse(input);
|
|
6079
|
+
try {
|
|
6080
|
+
return BrainDetailSchema.parse(await http.post(brainPath(), { json: body }).json());
|
|
6081
|
+
} catch (error) {
|
|
6082
|
+
throw await toPlatformError(error);
|
|
6083
|
+
}
|
|
6084
|
+
},
|
|
6085
|
+
async update(brainSlug, input) {
|
|
6086
|
+
const body = UpdateBrainRequestSchema.parse(input);
|
|
6087
|
+
try {
|
|
6088
|
+
return UpdateBrainResponseSchema.parse(await http.patch(brainPath(brainSlug), { json: body }).json());
|
|
6089
|
+
} catch (error) {
|
|
6090
|
+
throw await toPlatformError(error);
|
|
6091
|
+
}
|
|
6092
|
+
},
|
|
6093
|
+
async delete(brainSlug) {
|
|
6094
|
+
try {
|
|
6095
|
+
await http.delete(brainPath(brainSlug));
|
|
6096
|
+
} catch (error) {
|
|
6097
|
+
throw await toPlatformError(error);
|
|
6098
|
+
}
|
|
6099
|
+
},
|
|
6100
|
+
async rebuild(brainSlug) {
|
|
6101
|
+
try {
|
|
6102
|
+
return RebuildBrainResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/rebuild`).json());
|
|
6103
|
+
} catch (error) {
|
|
6104
|
+
throw await toPlatformError(error);
|
|
6105
|
+
}
|
|
6106
|
+
},
|
|
6107
|
+
async listMembers(brainSlug) {
|
|
6108
|
+
try {
|
|
6109
|
+
const data = await http.get(`${brainPath(brainSlug)}/members`).json();
|
|
6110
|
+
return ListBrainMembersResponseSchema.parse(data).members;
|
|
6111
|
+
} catch (error) {
|
|
6112
|
+
throw await toPlatformError(error);
|
|
6113
|
+
}
|
|
6114
|
+
},
|
|
6115
|
+
async addMember(brainSlug, input) {
|
|
6116
|
+
const body = AddBrainMemberRequestSchema.parse(input);
|
|
6117
|
+
try {
|
|
6118
|
+
return BrainMemberSchema.parse(await http.post(`${brainPath(brainSlug)}/members`, { json: body }).json());
|
|
6119
|
+
} catch (error) {
|
|
6120
|
+
throw await toPlatformError(error);
|
|
6121
|
+
}
|
|
6122
|
+
},
|
|
6123
|
+
async updateMember(brainSlug, userId, input) {
|
|
6124
|
+
const body = UpdateBrainMemberRequestSchema.parse(input);
|
|
6125
|
+
try {
|
|
6126
|
+
return BrainMemberSchema.parse(await http.patch(`${brainPath(brainSlug)}/members/${encodeURIComponent(userId)}`, { json: body }).json());
|
|
6127
|
+
} catch (error) {
|
|
6128
|
+
throw await toPlatformError(error);
|
|
6129
|
+
}
|
|
6130
|
+
},
|
|
6131
|
+
async removeMember(brainSlug, userId) {
|
|
6132
|
+
try {
|
|
6133
|
+
await http.delete(`${brainPath(brainSlug)}/members/${encodeURIComponent(userId)}`);
|
|
6134
|
+
} catch (error) {
|
|
6135
|
+
throw await toPlatformError(error);
|
|
6136
|
+
}
|
|
6137
|
+
},
|
|
6138
|
+
async listGrants(brainSlug) {
|
|
6139
|
+
try {
|
|
6140
|
+
const data = await http.get(`${brainPath(brainSlug)}/projects`).json();
|
|
6141
|
+
return ListBrainGrantsResponseSchema.parse(data).grants;
|
|
6142
|
+
} catch (error) {
|
|
6143
|
+
throw await toPlatformError(error);
|
|
6144
|
+
}
|
|
6145
|
+
},
|
|
6146
|
+
async createGrant(brainSlug, input) {
|
|
6147
|
+
const body = CreateBrainGrantRequestSchema.parse(input);
|
|
6148
|
+
try {
|
|
6149
|
+
return BrainGrantSchema.parse(await http.post(`${brainPath(brainSlug)}/projects`, { json: body }).json());
|
|
6150
|
+
} catch (error) {
|
|
6151
|
+
throw await toPlatformError(error);
|
|
6152
|
+
}
|
|
6153
|
+
},
|
|
6154
|
+
async revokeGrant(brainSlug, projectId) {
|
|
6155
|
+
try {
|
|
6156
|
+
await http.delete(`${brainPath(brainSlug)}/projects/${encodeURIComponent(projectId)}`);
|
|
6157
|
+
} catch (error) {
|
|
6158
|
+
throw await toPlatformError(error);
|
|
6159
|
+
}
|
|
6160
|
+
},
|
|
6161
|
+
async listFilters(brainSlug) {
|
|
6162
|
+
try {
|
|
6163
|
+
const data = await http.get(`${brainPath(brainSlug)}/filters`).json();
|
|
6164
|
+
return ListBrainFiltersResponseSchema.parse(data).filters;
|
|
6165
|
+
} catch (error) {
|
|
6166
|
+
throw await toPlatformError(error);
|
|
6167
|
+
}
|
|
6168
|
+
},
|
|
6169
|
+
async createFilter(brainSlug, input) {
|
|
6170
|
+
const body = CreateBrainFilterRequestSchema.parse(input);
|
|
6171
|
+
try {
|
|
6172
|
+
return BrainFilterSummarySchema.parse(await http.post(`${brainPath(brainSlug)}/filters`, { json: body }).json());
|
|
6173
|
+
} catch (error) {
|
|
6174
|
+
throw await toPlatformError(error);
|
|
6175
|
+
}
|
|
6176
|
+
},
|
|
6177
|
+
async updateFilter(brainSlug, filterSlug, input) {
|
|
6178
|
+
const body = UpdateBrainFilterRequestSchema.parse(input);
|
|
6179
|
+
try {
|
|
6180
|
+
return BrainFilterSummarySchema.parse(await http.patch(`${brainPath(brainSlug)}/filters/${encodeURIComponent(filterSlug)}`, { json: body }).json());
|
|
6181
|
+
} catch (error) {
|
|
6182
|
+
throw await toPlatformError(error);
|
|
6183
|
+
}
|
|
6184
|
+
},
|
|
6185
|
+
async deleteFilter(brainSlug, filterSlug) {
|
|
6186
|
+
try {
|
|
6187
|
+
await http.delete(`${brainPath(brainSlug)}/filters/${encodeURIComponent(filterSlug)}`);
|
|
6188
|
+
} catch (error) {
|
|
6189
|
+
throw await toPlatformError(error);
|
|
6190
|
+
}
|
|
6191
|
+
},
|
|
6192
|
+
async listDocuments(brainSlug, input = {}) {
|
|
6193
|
+
const query = documentsQueryString(input);
|
|
6194
|
+
try {
|
|
6195
|
+
return ListBrainDocumentsResponseSchema.parse(await http.get(`${brainPath(brainSlug)}/documents?${query}`).json());
|
|
6196
|
+
} catch (error) {
|
|
6197
|
+
throw await toPlatformError(error);
|
|
6198
|
+
}
|
|
6199
|
+
},
|
|
6200
|
+
async getDocument(brainSlug, documentId) {
|
|
6201
|
+
try {
|
|
6202
|
+
return BrainDocumentDetailSchema.parse(await http.get(`${brainPath(brainSlug)}/documents/detail/${encodeDocumentPath(documentId)}`).json());
|
|
6203
|
+
} catch (error) {
|
|
6204
|
+
throw await toPlatformError(error);
|
|
6205
|
+
}
|
|
6206
|
+
},
|
|
6207
|
+
async listDocumentWrites(brainSlug, input) {
|
|
6208
|
+
const query = documentWritesQueryString(input);
|
|
6209
|
+
try {
|
|
6210
|
+
return ListBrainDocumentWritesResponseSchema.parse(await http.get(`${brainPath(brainSlug)}/documents/writes?${query}`).json());
|
|
6211
|
+
} catch (error) {
|
|
6212
|
+
throw await toPlatformError(error);
|
|
6213
|
+
}
|
|
6214
|
+
},
|
|
6215
|
+
async updateDocumentMetadata(brainSlug, documentId, metadata) {
|
|
6216
|
+
const body = UpdateBrainDocumentMetadataRequestSchema.parse({ metadata });
|
|
6217
|
+
try {
|
|
6218
|
+
await http.patch(`${brainPath(brainSlug)}/documents/${encodeDocumentPath(documentId)}`, { json: body });
|
|
6219
|
+
} catch (error) {
|
|
6220
|
+
throw await toPlatformError(error);
|
|
6221
|
+
}
|
|
6222
|
+
},
|
|
6223
|
+
async deleteDocuments(brainSlug, documentIds) {
|
|
6224
|
+
const body = DeleteBrainDocumentsRequestSchema.parse({ documentIds });
|
|
6225
|
+
try {
|
|
6226
|
+
const data = await http.post(`${brainPath(brainSlug)}/documents/delete`, { json: body }).json();
|
|
6227
|
+
return DeleteBrainDocumentsResponseSchema.parse(data).deletedDocumentIds;
|
|
6228
|
+
} catch (error) {
|
|
6229
|
+
throw await toPlatformError(error);
|
|
6230
|
+
}
|
|
6231
|
+
},
|
|
6232
|
+
async prepareUploads(brainSlug, input) {
|
|
6233
|
+
const body = PrepareBrainUploadsRequestSchema.parse(input);
|
|
6234
|
+
try {
|
|
6235
|
+
return PrepareBrainUploadsResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/documents/prepare`, { json: body }).json());
|
|
6236
|
+
} catch (error) {
|
|
6237
|
+
throw await toPlatformError(error);
|
|
6238
|
+
}
|
|
6239
|
+
},
|
|
6240
|
+
async finalizeUploads(brainSlug, versionIds) {
|
|
6241
|
+
const body = FinalizeBrainUploadsRequestSchema.parse({ versionIds });
|
|
6242
|
+
try {
|
|
6243
|
+
return FinalizeBrainUploadsResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/documents/finalize`, { json: body }).json());
|
|
6244
|
+
} catch (error) {
|
|
6245
|
+
throw await toPlatformError(error);
|
|
6246
|
+
}
|
|
6247
|
+
}
|
|
6248
|
+
};
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Embedding-model catalog for Brain create/update pickers. Served from the
|
|
6252
|
+
* platform's cached AI Gateway catalog (`GET /api/embedding-models`); any
|
|
6253
|
+
* returned id is a valid Brain `indexConfig.embeddingModel`.
|
|
6254
|
+
*/
|
|
6255
|
+
function createEmbeddingModelsResource(http) {
|
|
6256
|
+
return { async list() {
|
|
6257
|
+
try {
|
|
6258
|
+
const data = await http.get("api/embedding-models").json();
|
|
6259
|
+
return ListEmbeddingModelsResponseSchema.parse(data).models;
|
|
6260
|
+
} catch (error) {
|
|
6261
|
+
throw await toPlatformError(error);
|
|
6262
|
+
}
|
|
6263
|
+
} };
|
|
6264
|
+
}
|
|
5999
6265
|
function createHistoryResource(http) {
|
|
6000
6266
|
return {
|
|
6001
6267
|
/** Runs across projects the current user can access in the active org. */
|
|
@@ -6413,6 +6679,8 @@ function createPlatformClient(options) {
|
|
|
6413
6679
|
apiKeys: createApiKeysResource(http),
|
|
6414
6680
|
managedServiceCredentials: createManagedServiceCredentialsResource(http),
|
|
6415
6681
|
billing: createBillingResource(http),
|
|
6682
|
+
brains: createBrainsResource(http),
|
|
6683
|
+
embeddingModels: createEmbeddingModelsResource(http),
|
|
6416
6684
|
recents: createRecentsResource(http),
|
|
6417
6685
|
userPreferences: createUserPreferencesResource(http),
|
|
6418
6686
|
userAvatar: createUserAvatarResource(http),
|
|
@@ -7583,6 +7851,146 @@ Examples:
|
|
|
7583
7851
|
}, void 0, { orgScoped: true }));
|
|
7584
7852
|
}
|
|
7585
7853
|
//#endregion
|
|
7854
|
+
//#region src/commands/agents/browser.ts
|
|
7855
|
+
function profilesRoot() {
|
|
7856
|
+
return process.env.KEYSTROKE_BROWSER_PROFILES_ROOT?.trim() || defaultBrowserProfilesRoot();
|
|
7857
|
+
}
|
|
7858
|
+
function profileMetaPath(agentSlug) {
|
|
7859
|
+
return join(agentBrowserProfilePath(profilesRoot(), agentSlug), ".keystroke-profile.json");
|
|
7860
|
+
}
|
|
7861
|
+
function readProfileMeta(agentSlug) {
|
|
7862
|
+
const path = profileMetaPath(agentSlug);
|
|
7863
|
+
if (!existsSync(path)) return {};
|
|
7864
|
+
try {
|
|
7865
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
7866
|
+
} catch (error) {
|
|
7867
|
+
throw new Error(`Invalid browser profile metadata at ${path}`, { cause: error });
|
|
7868
|
+
}
|
|
7869
|
+
}
|
|
7870
|
+
function writeProfileMeta(agentSlug, meta) {
|
|
7871
|
+
mkdirSync(agentBrowserProfilePath(profilesRoot(), agentSlug), { recursive: true });
|
|
7872
|
+
writeFileSync(profileMetaPath(agentSlug), JSON.stringify({
|
|
7873
|
+
...meta,
|
|
7874
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7875
|
+
}, null, 2));
|
|
7876
|
+
}
|
|
7877
|
+
function openUrl$1(url) {
|
|
7878
|
+
spawn(process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open", [url], {
|
|
7879
|
+
stdio: "ignore",
|
|
7880
|
+
detached: true
|
|
7881
|
+
}).unref();
|
|
7882
|
+
}
|
|
7883
|
+
function registerAgentBrowserCommand(agent) {
|
|
7884
|
+
const browser = agent.command("browser").description("Manage the agent's durable browser profile");
|
|
7885
|
+
browser.command("open").description("Open a headed / live browser on this agent's profile for login").argument("<slug>", "Agent slug").option("--url <url>", "Navigate to this URL", "about:blank").option("--no-open", "Print the live URL without opening a system browser").addHelpText("after", `
|
|
7886
|
+
Examples:
|
|
7887
|
+
keystroke agents browser open recruiter --url https://linkedin.com/login
|
|
7888
|
+
keystroke agents browser open recruiter --url https://x.com/login
|
|
7889
|
+
`).action((slug, options) => runProjectCliCommand("Open agent browser failed", async ({ config, apiTarget }) => {
|
|
7890
|
+
const url = options.url ?? "about:blank";
|
|
7891
|
+
if (apiTarget.projectId) {
|
|
7892
|
+
const opened = await createCliPlatformClient(config).agents.openBrowserSession(apiTarget.projectId, slug, { url });
|
|
7893
|
+
writeProfileMeta(slug, {
|
|
7894
|
+
...readProfileMeta(slug),
|
|
7895
|
+
cloudProfileId: opened.cloudProfileId,
|
|
7896
|
+
lastBrowserUseSessionId: opened.browserUseSessionId,
|
|
7897
|
+
lastLiveUrl: opened.liveUrl
|
|
7898
|
+
});
|
|
7899
|
+
process.stdout.write(`${JSON.stringify(opened, null, 2)}\n`);
|
|
7900
|
+
if (options.open !== false && opened.liveUrl) openUrl$1(opened.liveUrl);
|
|
7901
|
+
else if (opened.liveUrl) process.stdout.write(`Live view: ${opened.liveUrl}\n`);
|
|
7902
|
+
return;
|
|
7903
|
+
}
|
|
7904
|
+
if ((resolveBrowserProvider({ ...process.env.BROWSER_USE_API_KEY ? { browserUseApiKey: process.env.BROWSER_USE_API_KEY } : {} }) === "browseruse" || Boolean(process.env.BROWSER_USE_API_KEY?.trim())) && process.env.BROWSER_USE_API_KEY) {
|
|
7905
|
+
const apiKey = process.env.BROWSER_USE_API_KEY;
|
|
7906
|
+
const existing = readProfileMeta(slug);
|
|
7907
|
+
const opened = await openCloudBrowserLogin({
|
|
7908
|
+
apiKey,
|
|
7909
|
+
agentSlug: slug,
|
|
7910
|
+
url,
|
|
7911
|
+
...existing.cloudProfileId ? { cloudProfileId: existing.cloudProfileId } : {}
|
|
7912
|
+
});
|
|
7913
|
+
writeProfileMeta(slug, {
|
|
7914
|
+
...existing,
|
|
7915
|
+
cloudProfileId: opened.cloudProfileId,
|
|
7916
|
+
lastBrowserUseSessionId: opened.browserUseSessionId,
|
|
7917
|
+
lastLiveUrl: opened.liveUrl
|
|
7918
|
+
});
|
|
7919
|
+
process.stdout.write(`${JSON.stringify({
|
|
7920
|
+
agentSlug: slug,
|
|
7921
|
+
provider: "browseruse",
|
|
7922
|
+
liveUrl: opened.liveUrl ?? null,
|
|
7923
|
+
browserUseSessionId: opened.browserUseSessionId,
|
|
7924
|
+
cloudProfileId: opened.cloudProfileId,
|
|
7925
|
+
sessionId: opened.sessionId,
|
|
7926
|
+
url,
|
|
7927
|
+
hint: "Sign in in the live view, then close when done. Profile cookies persist."
|
|
7928
|
+
}, null, 2)}\n`);
|
|
7929
|
+
if (options.open !== false && opened.liveUrl) openUrl$1(opened.liveUrl);
|
|
7930
|
+
else process.stdout.write(`Live view: ${opened.liveUrl ?? "(none)"}\n`);
|
|
7931
|
+
return;
|
|
7932
|
+
}
|
|
7933
|
+
const ctx = resolveBrowserContext({
|
|
7934
|
+
agentSlug: slug,
|
|
7935
|
+
sessionId: `cli-${Date.now()}`,
|
|
7936
|
+
profilesRoot: profilesRoot(),
|
|
7937
|
+
provider: "local"
|
|
7938
|
+
});
|
|
7939
|
+
mkdirSync(ctx.profilePath, { recursive: true });
|
|
7940
|
+
const result = await runAgentBrowser({
|
|
7941
|
+
context: ctx,
|
|
7942
|
+
args: [
|
|
7943
|
+
"--headed",
|
|
7944
|
+
"open",
|
|
7945
|
+
url
|
|
7946
|
+
]
|
|
7947
|
+
});
|
|
7948
|
+
process.stdout.write(`${JSON.stringify({
|
|
7949
|
+
agentSlug: slug,
|
|
7950
|
+
provider: "local",
|
|
7951
|
+
profilePath: ctx.profilePath,
|
|
7952
|
+
url,
|
|
7953
|
+
exitCode: result.exitCode,
|
|
7954
|
+
stdout: result.stdout.trim() || null,
|
|
7955
|
+
stderr: result.stderr.trim() || null,
|
|
7956
|
+
hint: "Sign in in the headed window. Profile cookies persist for this agent."
|
|
7957
|
+
}, null, 2)}\n`);
|
|
7958
|
+
if (result.exitCode !== 0) process.exitCode = result.exitCode;
|
|
7959
|
+
}));
|
|
7960
|
+
browser.command("reset").description("Wipe this agent's browser profile (force re-login)").argument("<slug>", "Agent slug").action((slug) => runProjectCliCommand("Reset agent browser failed", async () => {
|
|
7961
|
+
const meta = readProfileMeta(slug);
|
|
7962
|
+
if (meta.lastBrowserUseSessionId && process.env.BROWSER_USE_API_KEY) await stopBrowserUseSession({
|
|
7963
|
+
apiKey: process.env.BROWSER_USE_API_KEY,
|
|
7964
|
+
sessionId: meta.lastBrowserUseSessionId
|
|
7965
|
+
});
|
|
7966
|
+
if (meta.cloudProfileId && process.env.BROWSER_USE_API_KEY) await deleteBrowserUseProfile({
|
|
7967
|
+
apiKey: process.env.BROWSER_USE_API_KEY,
|
|
7968
|
+
profileId: meta.cloudProfileId
|
|
7969
|
+
});
|
|
7970
|
+
const path = agentBrowserProfilePath(profilesRoot(), slug);
|
|
7971
|
+
if (existsSync(path)) rmSync(path, {
|
|
7972
|
+
recursive: true,
|
|
7973
|
+
force: true
|
|
7974
|
+
});
|
|
7975
|
+
process.stdout.write(`${JSON.stringify({
|
|
7976
|
+
agentSlug: slug,
|
|
7977
|
+
reset: true,
|
|
7978
|
+
profilePath: path
|
|
7979
|
+
}, null, 2)}\n`);
|
|
7980
|
+
}));
|
|
7981
|
+
browser.command("status").description("Show this agent's browser profile status").argument("<slug>", "Agent slug").action((slug) => runProjectCliCommand("Agent browser status failed", async () => {
|
|
7982
|
+
const path = agentBrowserProfilePath(profilesRoot(), slug);
|
|
7983
|
+
const meta = readProfileMeta(slug);
|
|
7984
|
+
process.stdout.write(`${JSON.stringify({
|
|
7985
|
+
agentSlug: slug,
|
|
7986
|
+
profilePath: path,
|
|
7987
|
+
exists: existsSync(path),
|
|
7988
|
+
providerHint: resolveBrowserProvider({ ...process.env.BROWSER_USE_API_KEY ? { browserUseApiKey: process.env.BROWSER_USE_API_KEY } : {} }),
|
|
7989
|
+
...meta
|
|
7990
|
+
}, null, 2)}\n`);
|
|
7991
|
+
}));
|
|
7992
|
+
}
|
|
7993
|
+
//#endregion
|
|
7586
7994
|
//#region src/commands/agents/index.ts
|
|
7587
7995
|
function registerAgentsCommand(program) {
|
|
7588
7996
|
const agents = program.command("agents").description("Invoke and inspect agents");
|
|
@@ -7590,6 +7998,7 @@ function registerAgentsCommand(program) {
|
|
|
7590
7998
|
registerAgentPromptCommand(agents);
|
|
7591
7999
|
registerAgentSessionsCommand(agents);
|
|
7592
8000
|
registerAgentSnapshotCommand(agents);
|
|
8001
|
+
registerAgentBrowserCommand(agents);
|
|
7593
8002
|
}
|
|
7594
8003
|
//#endregion
|
|
7595
8004
|
//#region src/commands/api-key/run-api-key.ts
|
|
@@ -9048,7 +9457,7 @@ function registerBuildCommand(program) {
|
|
|
9048
9457
|
try {
|
|
9049
9458
|
const root = resolveProjectRoot(options.dir);
|
|
9050
9459
|
await ensureSdkCurrent(root);
|
|
9051
|
-
const { buildApp } = await import("./dist-
|
|
9460
|
+
const { buildApp } = await import("./dist-BOlrsYA4.mjs");
|
|
9052
9461
|
await buildApp({ root });
|
|
9053
9462
|
process.stdout.write(`Built ${root}\n`);
|
|
9054
9463
|
} catch (error) {
|
|
@@ -9059,17 +9468,207 @@ function registerBuildCommand(program) {
|
|
|
9059
9468
|
});
|
|
9060
9469
|
}
|
|
9061
9470
|
//#endregion
|
|
9471
|
+
//#region src/commands/brains/with-brains.ts
|
|
9472
|
+
/**
|
|
9473
|
+
* Brain management is organization-scoped: commands need the active
|
|
9474
|
+
* organization but never a linked project. Project references only appear as
|
|
9475
|
+
* explicit cross-references on grant commands.
|
|
9476
|
+
*/
|
|
9477
|
+
async function withBrains(label, action) {
|
|
9478
|
+
await runCliCommand(label, async () => {
|
|
9479
|
+
const client = createCliPlatformClient(createCliConfig());
|
|
9480
|
+
const result = await action({
|
|
9481
|
+
brains: client.brains,
|
|
9482
|
+
projects: client.projects
|
|
9483
|
+
});
|
|
9484
|
+
if (result !== void 0) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
9485
|
+
}, void 0, { orgScoped: true });
|
|
9486
|
+
}
|
|
9487
|
+
function collectRepeatable(value, previous) {
|
|
9488
|
+
return [...previous, value];
|
|
9489
|
+
}
|
|
9490
|
+
function parseFilterExpression(value) {
|
|
9491
|
+
let parsed;
|
|
9492
|
+
try {
|
|
9493
|
+
parsed = JSON.parse(value);
|
|
9494
|
+
} catch {
|
|
9495
|
+
throw new Error("--filter must be a JSON object");
|
|
9496
|
+
}
|
|
9497
|
+
return BrainFilterExpressionSchema.parse(parsed);
|
|
9498
|
+
}
|
|
9499
|
+
function parseGrantAccess(value) {
|
|
9500
|
+
if (value !== "read" && value !== "write") throw new Error("--access must be read or write");
|
|
9501
|
+
return value;
|
|
9502
|
+
}
|
|
9503
|
+
function parseMemberRole(value) {
|
|
9504
|
+
if (value !== "owner" && value !== "admin") throw new Error("--role must be owner or admin");
|
|
9505
|
+
return value;
|
|
9506
|
+
}
|
|
9507
|
+
/** Resolves a project slug or id cross-reference to the project id. */
|
|
9508
|
+
async function resolveProjectId(projects, reference) {
|
|
9509
|
+
const match = (await projects.list({ admin: true })).find((project) => project.slug === reference || project.id === reference);
|
|
9510
|
+
if (!match) throw new Error(`Project "${reference}" not found`);
|
|
9511
|
+
return match.id;
|
|
9512
|
+
}
|
|
9513
|
+
//#endregion
|
|
9514
|
+
//#region src/commands/brains/documents.ts
|
|
9515
|
+
function parseProvisionerKinds(values) {
|
|
9516
|
+
return values.map((value) => {
|
|
9517
|
+
if (value !== "workflow" && value !== "manual") throw new Error("--provisioner must be workflow or manual");
|
|
9518
|
+
return value;
|
|
9519
|
+
});
|
|
9520
|
+
}
|
|
9521
|
+
function registerBrainDocumentsCommands(brains) {
|
|
9522
|
+
const documents = brains.command("documents").description("Inspect and remove Brain documents");
|
|
9523
|
+
documents.command("list <slug>").description("List documents in a Brain").option("--search <text>", "Case-insensitive substring over title and document ID").option("--source <source>", "Filter by document source (repeatable)", collectRepeatable, []).option("--provisioner <kind>", "Filter by provisioner: workflow or manual (repeatable)", collectRepeatable, []).option("--filter <filter-slug>", "Apply a saved Brain filter").option("--prefix <prefix>", "Filter document IDs by prefix").option("--cursor <cursor>", "Pagination cursor").option("--limit <count>", "Page size", "100").action((slug, options) => withBrains("List Brain documents failed", ({ brains: api }) => api.listDocuments(slug, {
|
|
9524
|
+
...options.search ? { search: options.search } : {},
|
|
9525
|
+
...options.source.length > 0 ? { source: options.source } : {},
|
|
9526
|
+
...options.provisioner.length > 0 ? { provisionerKind: parseProvisionerKinds(options.provisioner) } : {},
|
|
9527
|
+
...options.filter ? { filterSlug: options.filter } : {},
|
|
9528
|
+
...options.prefix ? { prefix: options.prefix } : {},
|
|
9529
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
9530
|
+
limit: Number(options.limit)
|
|
9531
|
+
})));
|
|
9532
|
+
documents.command("get <slug> <document-id>").description("Get a document's metadata, source, and provenance").action((slug, documentId) => withBrains("Get Brain document failed", ({ brains: api }) => api.getDocument(slug, documentId)));
|
|
9533
|
+
documents.command("delete <slug> <document-ids...>").description("Delete documents from a Brain").option("-y, --yes", "Confirm deletion").action((slug, documentIds, options) => withBrains("Delete Brain documents failed", ({ brains: api }) => {
|
|
9534
|
+
if (!options.yes) throw new Error("Pass --yes to confirm document deletion");
|
|
9535
|
+
return api.deleteDocuments(slug, documentIds);
|
|
9536
|
+
}));
|
|
9537
|
+
}
|
|
9538
|
+
//#endregion
|
|
9539
|
+
//#region src/commands/brains/filters.ts
|
|
9540
|
+
function registerBrainFiltersCommands(brains) {
|
|
9541
|
+
const filters = brains.command("filters").description("Manage saved read filters, addressable as {brain-slug}:{filter-slug}");
|
|
9542
|
+
filters.command("list <slug>").description("List filters on a Brain").action((slug) => withBrains("List Brain filters failed", ({ brains: api }) => api.listFilters(slug)));
|
|
9543
|
+
filters.command("create <slug>").description("Create a filter on a Brain").requiredOption("--name <name>", "Filter name").requiredOption("--description <description>", "Filter description").requiredOption("--filter <json>", "Filter expression JSON (source and/or metadata)").option("--slug <filter-slug>", "Filter slug (defaults to a slugified name)").action((slug, options) => withBrains("Create Brain filter failed", ({ brains: api }) => api.createFilter(slug, {
|
|
9544
|
+
name: options.name,
|
|
9545
|
+
description: options.description,
|
|
9546
|
+
filter: parseFilterExpression(options.filter),
|
|
9547
|
+
...options.slug ? { slug: options.slug } : {}
|
|
9548
|
+
})));
|
|
9549
|
+
filters.command("update <slug> <filter-slug>").description("Update a filter's name, description, or expression").option("--name <name>", "Filter name").option("--description <description>", "Filter description").option("--filter <json>", "Replacement filter expression JSON").action((slug, filterSlug, options) => withBrains("Update Brain filter failed", ({ brains: api }) => {
|
|
9550
|
+
const input = {
|
|
9551
|
+
...options.name ? { name: options.name } : {},
|
|
9552
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
9553
|
+
...options.filter ? { filter: parseFilterExpression(options.filter) } : {}
|
|
9554
|
+
};
|
|
9555
|
+
if (Object.keys(input).length === 0) throw new Error("At least one update option is required");
|
|
9556
|
+
return api.updateFilter(slug, filterSlug, input);
|
|
9557
|
+
}));
|
|
9558
|
+
filters.command("delete <slug> <filter-slug>").description("Delete a filter (documents and grants are unaffected)").action((slug, filterSlug) => withBrains("Delete Brain filter failed", async ({ brains: api }) => {
|
|
9559
|
+
await api.deleteFilter(slug, filterSlug);
|
|
9560
|
+
return { deleted: filterSlug };
|
|
9561
|
+
}));
|
|
9562
|
+
}
|
|
9563
|
+
//#endregion
|
|
9564
|
+
//#region src/commands/brains/members.ts
|
|
9565
|
+
function registerBrainMembersCommands(brains) {
|
|
9566
|
+
const members = brains.command("members").description("Manage Brain owner/admin memberships (owner-only)");
|
|
9567
|
+
members.command("list <slug>").description("List members of a Brain").action((slug) => withBrains("List Brain members failed", ({ brains: api }) => api.listMembers(slug)));
|
|
9568
|
+
members.command("create <slug> <user-id>").description("Add a Brain member").option("--role <role>", "owner or admin", "admin").action((slug, userId, options) => withBrains("Add Brain member failed", ({ brains: api }) => api.addMember(slug, {
|
|
9569
|
+
userId,
|
|
9570
|
+
role: parseMemberRole(options.role)
|
|
9571
|
+
})));
|
|
9572
|
+
members.command("update <slug> <user-id>").description("Change a Brain member's role (promote to owner to transfer ownership)").requiredOption("--role <role>", "owner or admin").action((slug, userId, options) => withBrains("Update Brain member failed", ({ brains: api }) => api.updateMember(slug, userId, { role: parseMemberRole(options.role) })));
|
|
9573
|
+
members.command("delete <slug> <user-id>").description("Remove a Brain member").action((slug, userId) => withBrains("Remove Brain member failed", async ({ brains: api }) => {
|
|
9574
|
+
await api.removeMember(slug, userId);
|
|
9575
|
+
return { deleted: userId };
|
|
9576
|
+
}));
|
|
9577
|
+
}
|
|
9578
|
+
//#endregion
|
|
9579
|
+
//#region src/commands/brains/projects.ts
|
|
9580
|
+
function registerBrainProjectsCommands(brains) {
|
|
9581
|
+
const projects = brains.command("projects").description("Share a Brain with project runtimes (read/write grants)");
|
|
9582
|
+
projects.command("list <slug>").description("List project grants for a Brain").action((slug) => withBrains("List Brain project grants failed", ({ brains: api }) => api.listGrants(slug)));
|
|
9583
|
+
projects.command("create <slug> <project>").description("Grant a project's runtime access to a Brain (upserts existing grants)").option("--access <access>", "read or write (write implies read)", "read").action((slug, projectRef, options) => withBrains("Create Brain project grant failed", async ({ brains: api, projects: refs }) => api.createGrant(slug, {
|
|
9584
|
+
projectId: await resolveProjectId(refs, projectRef),
|
|
9585
|
+
access: parseGrantAccess(options.access)
|
|
9586
|
+
})));
|
|
9587
|
+
projects.command("delete <slug> <project>").description("Revoke a project's grant on a Brain").action((slug, projectRef) => withBrains("Revoke Brain project grant failed", async ({ brains: api, projects: refs }) => {
|
|
9588
|
+
const projectId = await resolveProjectId(refs, projectRef);
|
|
9589
|
+
await api.revokeGrant(slug, projectId);
|
|
9590
|
+
return { deleted: projectId };
|
|
9591
|
+
}));
|
|
9592
|
+
}
|
|
9593
|
+
//#endregion
|
|
9594
|
+
//#region src/commands/brains/index.ts
|
|
9595
|
+
function parseOptionalInteger(value, flag) {
|
|
9596
|
+
if (value === void 0) return;
|
|
9597
|
+
const parsed = Number(value);
|
|
9598
|
+
if (!Number.isInteger(parsed)) throw new Error(`${flag} must be an integer`);
|
|
9599
|
+
return parsed;
|
|
9600
|
+
}
|
|
9601
|
+
function hasIndexOptions(options) {
|
|
9602
|
+
return options.embeddingModel !== void 0 || options.language !== void 0 || options.maxCharacters !== void 0 || options.overlapCharacters !== void 0 || options.separator !== void 0;
|
|
9603
|
+
}
|
|
9604
|
+
function indexConfigFromOptions(options, base) {
|
|
9605
|
+
if (!hasIndexOptions(options)) return;
|
|
9606
|
+
const maxCharacters = parseOptionalInteger(options.maxCharacters, "--max-characters");
|
|
9607
|
+
const overlapCharacters = parseOptionalInteger(options.overlapCharacters, "--overlap-characters");
|
|
9608
|
+
return BrainIndexConfigSchema.parse({
|
|
9609
|
+
...base ?? {},
|
|
9610
|
+
...options.embeddingModel ? { embeddingModel: options.embeddingModel } : {},
|
|
9611
|
+
...options.language ? { language: options.language } : {},
|
|
9612
|
+
chunking: {
|
|
9613
|
+
...base?.chunking ?? {},
|
|
9614
|
+
...maxCharacters !== void 0 ? { maxCharacters } : {},
|
|
9615
|
+
...overlapCharacters !== void 0 ? { overlapCharacters } : {},
|
|
9616
|
+
...options.separator !== void 0 ? { separator: options.separator } : {}
|
|
9617
|
+
}
|
|
9618
|
+
});
|
|
9619
|
+
}
|
|
9620
|
+
function addIndexOptions(command) {
|
|
9621
|
+
return command.option("--embedding-model <model>", "Embedding model (validated against the live catalog)").option("--language <language>", "Full-text search language").option("--max-characters <count>", "Maximum characters per chunk").option("--overlap-characters <count>", "Character overlap between adjacent chunks").option("--separator <text>", "Exact preferred chunk separator");
|
|
9622
|
+
}
|
|
9623
|
+
function registerBrainsCommand(program) {
|
|
9624
|
+
const brains = program.command("brains").description("Create, inspect, share, and rebuild hosted Brains (organization-scoped)");
|
|
9625
|
+
brains.command("list").description("List Brains you own or administer").action(() => withBrains("List Brains failed", ({ brains: api }) => api.list()));
|
|
9626
|
+
brains.command("get <slug>").description("Get a Brain").action((slug) => withBrains("Get Brain failed", ({ brains: api }) => api.get(slug)));
|
|
9627
|
+
addIndexOptions(brains.command("create").description("Create a Brain; you become its sole owner").requiredOption("--name <name>", "Brain name").requiredOption("--description <description>", "Brain description").option("--slug <slug>", "Brain slug")).action((options) => withBrains("Create Brain failed", ({ brains: api }) => {
|
|
9628
|
+
const indexConfig = indexConfigFromOptions(options);
|
|
9629
|
+
return api.create({
|
|
9630
|
+
name: options.name,
|
|
9631
|
+
description: options.description,
|
|
9632
|
+
...options.slug ? { slug: options.slug } : {},
|
|
9633
|
+
...indexConfig ? { indexConfig } : {}
|
|
9634
|
+
});
|
|
9635
|
+
}));
|
|
9636
|
+
addIndexOptions(brains.command("update <slug>").description("Update Brain metadata or index configuration (index changes rebuild)").option("--name <name>", "Brain name").option("--description <description>", "Brain description")).action((slug, options) => withBrains("Update Brain failed", async ({ brains: api }) => {
|
|
9637
|
+
const indexConfig = indexConfigFromOptions(options, (hasIndexOptions(options) ? await api.get(slug) : void 0)?.indexConfig);
|
|
9638
|
+
const input = {
|
|
9639
|
+
...options.name ? { name: options.name } : {},
|
|
9640
|
+
...options.description !== void 0 ? { description: options.description } : {},
|
|
9641
|
+
...indexConfig ? { indexConfig } : {}
|
|
9642
|
+
};
|
|
9643
|
+
if (Object.keys(input).length === 0) throw new Error("At least one update option is required");
|
|
9644
|
+
return api.update(slug, input);
|
|
9645
|
+
}));
|
|
9646
|
+
brains.command("delete <slug>").description("Delete a Brain and all of its indexed data (owner-only)").option("-y, --yes", "Confirm deletion").action((slug, options) => withBrains("Delete Brain failed", async ({ brains: api }) => {
|
|
9647
|
+
if (!options.yes) throw new Error("Pass --yes to confirm Brain deletion");
|
|
9648
|
+
await api.delete(slug);
|
|
9649
|
+
return { deleted: slug };
|
|
9650
|
+
}));
|
|
9651
|
+
brains.command("rebuild <slug>").description("Rebuild a Brain's index from stored documents").action((slug) => withBrains("Rebuild Brain failed", ({ brains: api }) => api.rebuild(slug)));
|
|
9652
|
+
registerBrainMembersCommands(brains);
|
|
9653
|
+
registerBrainProjectsCommands(brains);
|
|
9654
|
+
registerBrainFiltersCommands(brains);
|
|
9655
|
+
registerBrainDocumentsCommands(brains);
|
|
9656
|
+
}
|
|
9657
|
+
//#endregion
|
|
9062
9658
|
//#region src/deploy/assert-portable-dependencies.ts
|
|
9063
9659
|
const LINK_SPEC = /^link:/i;
|
|
9660
|
+
const WORKSPACE_SPEC = /^workspace:/i;
|
|
9661
|
+
const FILE_SPEC = /^file:(?:\.\.?(?:\/|$)|\/|[A-Za-z]:\\|~)/i;
|
|
9064
9662
|
const NONPORTABLE_SPEC = /^(?:link:|workspace:|file:(?:\.\.?(?:\/|$)|\/|[A-Za-z]:\\|~))/i;
|
|
9065
9663
|
/**
|
|
9066
9664
|
* Reject tracked dependency specs that cannot resolve in disposable/server
|
|
9067
9665
|
* checkouts (absolute/local link:, external file:, unresolved workspace:).
|
|
9068
9666
|
*
|
|
9069
9667
|
* `KEYSTROKE_ALLOW_NONPORTABLE_DEPS=1` (local packs / soak deploys) permits
|
|
9070
|
-
* `link:` only
|
|
9668
|
+
* `link:` only. Explicit options allow `workspace:`, `link:`, and local `file:`
|
|
9669
|
+
* specs when deploy deliberately builds from the current checkout.
|
|
9071
9670
|
*/
|
|
9072
|
-
async function assertPortableProjectDependencies(projectRoot) {
|
|
9671
|
+
async function assertPortableProjectDependencies(projectRoot, options = {}) {
|
|
9073
9672
|
const allowLinkDeps = process.env.KEYSTROKE_ALLOW_NONPORTABLE_DEPS === "1";
|
|
9074
9673
|
const packageJsonPath = join(projectRoot, "package.json");
|
|
9075
9674
|
let raw;
|
|
@@ -9099,7 +9698,7 @@ async function assertPortableProjectDependencies(projectRoot) {
|
|
|
9099
9698
|
for (const [name, spec] of Object.entries(deps)) {
|
|
9100
9699
|
if (typeof spec !== "string") continue;
|
|
9101
9700
|
const trimmed = spec.trim();
|
|
9102
|
-
if (allowLinkDeps && LINK_SPEC.test(trimmed)) continue;
|
|
9701
|
+
if ((allowLinkDeps || options.allowLink) && LINK_SPEC.test(trimmed) || options.allowWorkspace && WORKSPACE_SPEC.test(trimmed) || options.allowFile && FILE_SPEC.test(trimmed)) continue;
|
|
9103
9702
|
if (NONPORTABLE_SPEC.test(trimmed)) offenders.push(`${name}@${spec}`);
|
|
9104
9703
|
}
|
|
9105
9704
|
}
|
|
@@ -11019,6 +11618,25 @@ async function buildExactCandidate(input) {
|
|
|
11019
11618
|
const depsRoot = input.depsRoot ?? input.cwd;
|
|
11020
11619
|
const cleanEnv = worktreeGitEnv();
|
|
11021
11620
|
const skipVerify = input.skipVerify === true;
|
|
11621
|
+
if (input.buildFromWorkspace) {
|
|
11622
|
+
await rm(join(input.cwd, "dist"), {
|
|
11623
|
+
recursive: true,
|
|
11624
|
+
force: true
|
|
11625
|
+
});
|
|
11626
|
+
await buildInRoot({
|
|
11627
|
+
buildRoot: input.cwd,
|
|
11628
|
+
env: cleanEnv,
|
|
11629
|
+
skipVerify,
|
|
11630
|
+
manager: await detectPackageManager(input.cwd),
|
|
11631
|
+
needInstall: false
|
|
11632
|
+
});
|
|
11633
|
+
const modules = collectArtifactModules(input.cwd);
|
|
11634
|
+
return {
|
|
11635
|
+
modules,
|
|
11636
|
+
index: artifactIndexFromModules(modules),
|
|
11637
|
+
blobs: moduleBlobRefsFromModules(modules)
|
|
11638
|
+
};
|
|
11639
|
+
}
|
|
11022
11640
|
if (input.allowInPlace) {
|
|
11023
11641
|
const head = await runGit(["rev-parse", "HEAD"], {
|
|
11024
11642
|
cwd: input.cwd,
|
|
@@ -11515,7 +12133,13 @@ async function pollProjectActive(client, projectId, options = {}) {
|
|
|
11515
12133
|
async function runManagedDeploy(client, config, options) {
|
|
11516
12134
|
const deployStarted = Date.now();
|
|
11517
12135
|
const root = resolveProjectRoot(options.dir);
|
|
11518
|
-
|
|
12136
|
+
if (options.buildFromWorkspace && process.env["KEYSTROKE_DEPLOY_GIT_MODE"] === "checkout") throw new ExpectedCliError("--build-from-workspace is only available from a local monorepo checkout");
|
|
12137
|
+
await assertPortableProjectDependencies(root, {
|
|
12138
|
+
allowWorkspace: options.buildFromWorkspace === true,
|
|
12139
|
+
allowFile: options.buildFromWorkspace === true,
|
|
12140
|
+
allowLink: options.buildFromWorkspace === true
|
|
12141
|
+
});
|
|
12142
|
+
if (options.buildFromWorkspace) process.stderr.write("Warning: --build-from-workspace builds with local workspace dependencies that are not captured in Keystroke's managed source. Use published dependencies for reproducible deploys.\n");
|
|
11519
12143
|
const verbose = options.verbose === true;
|
|
11520
12144
|
const phase = (label, started) => {
|
|
11521
12145
|
if (!verbose) return;
|
|
@@ -11563,6 +12187,10 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11563
12187
|
env: gitContext.env,
|
|
11564
12188
|
...filter ? { filter } : {}
|
|
11565
12189
|
});
|
|
12190
|
+
if (options.buildFromWorkspace && plan.mode === "no_op") plan = {
|
|
12191
|
+
...plan,
|
|
12192
|
+
mode: "full"
|
|
12193
|
+
};
|
|
11566
12194
|
phase("plan", planStarted);
|
|
11567
12195
|
writePlan(plan);
|
|
11568
12196
|
if (plan.mode === "no_op") {
|
|
@@ -11707,7 +12335,8 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11707
12335
|
candidateSha: composed.candidateSha,
|
|
11708
12336
|
depsRoot: root,
|
|
11709
12337
|
skipVerify: verifyOutside,
|
|
11710
|
-
allowInPlace: hostedCheckout && prepared.mode === "full"
|
|
12338
|
+
allowInPlace: hostedCheckout && prepared.mode === "full",
|
|
12339
|
+
buildFromWorkspace: options.buildFromWorkspace === true
|
|
11711
12340
|
});
|
|
11712
12341
|
buildMs = Date.now() - buildStarted;
|
|
11713
12342
|
return result;
|
|
@@ -11744,7 +12373,8 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11744
12373
|
candidateSha: publishedCandidateSha,
|
|
11745
12374
|
depsRoot: root,
|
|
11746
12375
|
skipVerify: verifyOutside,
|
|
11747
|
-
allowInPlace: false
|
|
12376
|
+
allowInPlace: false,
|
|
12377
|
+
buildFromWorkspace: options.buildFromWorkspace === true
|
|
11748
12378
|
});
|
|
11749
12379
|
buildMs += Date.now() - rebuildStarted;
|
|
11750
12380
|
}
|
|
@@ -11817,6 +12447,10 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11817
12447
|
env: gitContext.env,
|
|
11818
12448
|
...filter ? { filter } : {}
|
|
11819
12449
|
});
|
|
12450
|
+
if (options.buildFromWorkspace && plan.mode === "no_op") plan = {
|
|
12451
|
+
...plan,
|
|
12452
|
+
mode: "full"
|
|
12453
|
+
};
|
|
11820
12454
|
writePlan(plan);
|
|
11821
12455
|
if (plan.mode === "no_op") {
|
|
11822
12456
|
process.stdout.write("Nothing to deploy — draft matches main.\n");
|
|
@@ -11870,6 +12504,7 @@ async function resolveTrustedDeployGitEnv(input) {
|
|
|
11870
12504
|
}
|
|
11871
12505
|
async function runDeploy(options) {
|
|
11872
12506
|
if (options.acceptImpact && !options.filter?.length) throw new ExpectedCliError("--accept-impact requires at least one --filter");
|
|
12507
|
+
if (options.buildFromWorkspace && options.filter?.length) throw new ExpectedCliError("--build-from-workspace cannot be combined with --filter");
|
|
11873
12508
|
const root = resolveProjectRoot(options.dir);
|
|
11874
12509
|
await ensureSdkCurrent(root);
|
|
11875
12510
|
const config = createCliConfig();
|
|
@@ -11879,7 +12514,7 @@ async function runDeploy(options) {
|
|
|
11879
12514
|
await runManagedDeploy(client, config, options);
|
|
11880
12515
|
}
|
|
11881
12516
|
function registerDeployCommand(program) {
|
|
11882
|
-
program.command("deploy").description("Deploy the project via managed Git (draft sync, local analyze/build, cutover)").option("--dir <path>", "Project directory", process.cwd()).option("--filter <entry>", "Deploy only matching workflow/agent keys (repeatable; e.g. workflows/ping)", (value, previous) => [...previous, value], []).option("--accept-impact", "Accept the current filtered deploy impact (required for non-TTY expansion)").option("--verbose", "Show phase timings, pin SHAs, and deploy detail").action(async (options) => {
|
|
12517
|
+
program.command("deploy").description("Deploy the project via managed Git (draft sync, local analyze/build, cutover)").option("--dir <path>", "Project directory", process.cwd()).option("--filter <entry>", "Deploy only matching workflow/agent keys (repeatable; e.g. workflows/ping)", (value, previous) => [...previous, value], []).option("--accept-impact", "Accept the current filtered deploy impact (required for non-TTY expansion)").option("--build-from-workspace", "Build from the current monorepo checkout (full deploys only; non-reproducible)").option("--verbose", "Show phase timings, pin SHAs, and deploy detail").action(async (options) => {
|
|
11883
12518
|
let config;
|
|
11884
12519
|
try {
|
|
11885
12520
|
config = createCliConfig();
|
|
@@ -11891,6 +12526,7 @@ function registerDeployCommand(program) {
|
|
|
11891
12526
|
projectId,
|
|
11892
12527
|
filter: options.filter.length > 0 ? options.filter : void 0,
|
|
11893
12528
|
acceptImpact: options.acceptImpact === true,
|
|
12529
|
+
buildFromWorkspace: options.buildFromWorkspace === true,
|
|
11894
12530
|
verbose: options.verbose === true
|
|
11895
12531
|
});
|
|
11896
12532
|
await trackCliEvent("cli:deploy", { projectId });
|
|
@@ -14307,6 +14943,7 @@ function createProgram() {
|
|
|
14307
14943
|
registerApiKeyCommand(program);
|
|
14308
14944
|
registerManagedServicesCommand(program);
|
|
14309
14945
|
registerProjectsCommand(program);
|
|
14946
|
+
registerBrainsCommand(program);
|
|
14310
14947
|
registerHistoryCommand(program);
|
|
14311
14948
|
registerCredentialsCommand(program);
|
|
14312
14949
|
registerHealthCommand(program);
|
|
@@ -14331,7 +14968,7 @@ function createProgram() {
|
|
|
14331
14968
|
async function runCli(argv) {
|
|
14332
14969
|
initCliTelemetry();
|
|
14333
14970
|
try {
|
|
14334
|
-
const { maybeAutoUpdate } = await import("./maybe-auto-update-
|
|
14971
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-Dmcj8aoh.mjs");
|
|
14335
14972
|
await maybeAutoUpdate(argv);
|
|
14336
14973
|
await createProgram().parseAsync(argv);
|
|
14337
14974
|
} finally {
|
|
@@ -14341,4 +14978,4 @@ async function runCli(argv) {
|
|
|
14341
14978
|
//#endregion
|
|
14342
14979
|
export { runCli };
|
|
14343
14980
|
|
|
14344
|
-
//# sourceMappingURL=program-
|
|
14981
|
+
//# sourceMappingURL=program-DO7ZQHjx.mjs.map
|