@keystrokehq/cli 0.1.172 → 0.1.174

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.
@@ -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-CcJWW5xj.mjs";
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 captureException, bt as flushTelemetry, et as artifactIndexFromModules, gt as alias, nt as mapInParallelBatches, rt as moduleBlobRefsFromModules, tt as collectArtifactModules, vt as configureTelemetry, xt as shutdownTelemetry, yt as event } from "./dist-B8ZXKNXj.mjs";
5
- import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-C5ooQsTQ.mjs";
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-DUTKqYW0.mjs";
3
+ import { $ as CreateOrganizationResponseSchema, $i as parseAppSlug, $n as PresignProjectSourceResponseSchema, $r as TriggerRunListResponseSchema, $t as ListBrainDocumentsResponseSchema, A as ChannelConnectionListResponseSchema, Aa as BillingSummaryResponseSchema, Ai as WorkflowRunInputsPutBodySchema, An as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, Ar as SkillSummaryListResponseSchema, At as GetAppCatalogEntryResponseSchema, B as CreateApiKeyRequestSchema, Bi as WorkspaceTriggerRunListResponseSchema, Bn as PlatformAgentPromptInputSchema, Br as StartMcpOAuthConnectionInputSchema, Bt as HistoryRunListQuerySchema, C as CancelManagedDeployRequestSchema, Ca as PresignChatAttachmentRequestSchema, Ci as WorkflowCanvasCredentialBindingsSchema, Cn as ManagedServiceCredentialSchema, Cr as RecentResourceListResponseSchema, Ct as DuplicateCredentialsResponseSchema, D as CatalogAppDetailResponseSchema, Da as BillingActivityResponseSchema, Di as WorkflowFormUpsertBodySchema, Dn as OrganizationSidebarBrandingPatchSchema, Dr as SLACK_PERSONAL_APP_SLUG, Dt as FinalizeCustomAppLogoResponseSchema, E as CatalogActionsPageResponseSchema, Ea as AutoTopupSummarySchema, Ei as WorkflowFormResponseSchema, En as OpenApiDiscoverResponseSchema, Et as FinalizeCustomAppLogoRequestSchema, F as CompleteProjectArtifactRequestSchema, Fa as CreateCreditsCheckoutRequestSchema, Fi as WorkflowSummaryListResponseSchema, Fr as SlackAppManifestResponseSchema, Ft as HealthResponseSchema, G as CreateCredentialInstanceBodySchema, Gi as detectProjectPackageManagerFromSnapshot, Gn as PrepareBrainUploadsResponseSchema, Gr as SubmitMarketingContactRequestSchema, Gt as InviteProjectMembersResponseSchema, H as CreateBrainFilterRequestSchema, Hi as buildAgentSlackDeeplink, Hn as PlatformAgentSessionDetailResponseSchema, Hr as StartOAuthConnectionInputSchema, Ht as InviteOrganizationMembersRequestSchema, I as CompleteProjectArtifactResponseSchema, Ia as CreateSubscriptionCheckoutRequestSchema, Ii as WorkspaceTriggerDetailSchema, Ir as SlackMembershipChannelBodySchema, It as HeartbeatManagedDeployRequestSchema, J as CreateCustomAppRequestSchema, Jn as PresignCustomAppLogoRequestSchema, Jr as TriggerDetailResponseSchema, Jt as ListApiKeysResponseSchema, K as CreateCredentialsRequestSchema, Ki as gitPorcelainLineTouchesManagedDraftPublishPath, Kn as PrepareManagedDeployRequestSchema, Kr as SubmitTeamRequestRequestSchema, Kt as ListAgentMemoryFilesResponseSchema, L as ConnectAuthorizeUrlResponseSchema, La as UpdateAutoTopupRequestSchema, Li as WorkspaceTriggerFileSchema, Lr as SlugAvailabilityResponseSchema, Lt as HeartbeatManagedDeployResponseSchema, M as ChannelDirectoryListResponseSchema, Ma as ConfirmCheckoutRequestSchema, Mi as WorkflowRunListResponseSchema, Mr as SlackAppInstallStartResponseSchema, Mt as GetCustomAppResponseSchema, N as CompleteManagedDeployArtifactRequestSchema, Na as ConfirmCheckoutResponseSchema, Ni as WorkflowRunResponseSchema, Nn as PROJECT_PULL_STATE_RELATIVE_PATH, Nr as SlackAppListResponseSchema, Nt as GetTemplateResponseSchema, O as CatalogAppsPageResponseSchema, Oa as BillingInvoiceUrlResponseSchema, Oi as WorkflowRunDetailResponseSchema, On as OrganizationSidebarBrandingSchema, Ot as FormFieldConfigSchema, P as CompleteManagedDeployArtifactResponseSchema, Pa as CreateBillingPortalRequestSchema, Pi as WorkflowSummaryDetailResponseSchema, Pn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, Pr as SlackAppManifestRequestSchema, Pt as GraphqlDiscoverResponseSchema, Q as CreateOrganizationRequestSchema, Qn as PresignProjectSourceRequestSchema, Qr as TriggerRunDetailResponseSchema, Qt as ListBrainDocumentsQuerySchema, R as ConnectManagedServiceCredentialRequestSchema, Ri as WorkspaceTriggerListResponseSchema, Rr as StartKeystrokeConnectionInputSchema, Rt as HistoryRunCancelResponseSchema, S as BrainSlugAvailabilityResponseSchema, Sa as CLIENT_CHANNEL_HEADER, Si as UserPreferencesSchema, Sn as ManagedDeployResourceKeySchema, Sr as RebuildBrainResponseSchema, St as DuplicateCredentialRequestSchema, T as CatalogActionDetailResponseSchema, Ti as WorkflowCanvasSchema, Tn as McpDiscoverResponseSchema, Tr as RenewManagedDeployUploadResponseSchema, Tt as FinalizeBrainUploadsResponseSchema, U as CreateBrainGrantRequestSchema, Ui as buildConnectDeeplink, Un as PlatformAgentSessionListResponseSchema, Ur as StartOAuthConnectionResultSchema, Ut as InviteOrganizationMembersResponseSchema, V as CreateApiKeyResponseSchema, Vi as WorkspaceWorkflowOverviewSchema, Vn as PlatformAgentPromptResponseSchema, Vr as StartMcpOAuthConnectionResultSchema, Vt as HistoryRunListResponseSchema, W as CreateBrainRequestSchema, Wi as deriveCustomAppDisplay, Wn as PrepareBrainUploadsRequestSchema, Wr as SubmitAgentFeedbackRequestSchema, Wt as InviteProjectMembersRequestSchema, X as CreateDraftCommitRequestSchema, Xn as PresignOrgLogoRequestSchema, Xr as TriggerInvokeResponseSchema, Xt as ListBrainDocumentWritesQuerySchema, Y as CreateCustomAppResponseSchema, Yi as isIgnoredProjectSourcePath, Yn as PresignCustomAppLogoResponseSchema, Yr as TriggerInvokeInputsSchema, Yt as ListAppsResponseSchema, Z as CreateDraftDiffCommitRequestSchema, Zi as normalizeDocsSearchPaths, Zn as PresignOrgLogoResponseSchema, Zr as TriggerListResponseSchema, Zt as ListBrainDocumentWritesResponseSchema, _ as BrainFilterExpressionSchema, _i as UploadProjectSourceResponseSchema, _n as ListProjectMembersResponseSchema, _r as PublishManagedDeployCandidateResponseSchema, _t as DraftCommitResponseSchema, a as AgentEnvImageSnapshotResponseSchema, aa as resolveDocsMcpUrl, ai as UpdateChannelBindingBodySchema, an as ListCredentialsPageQuerySchema, ar as ProjectGitStatusResponseSchema, at as CreateSlackAppResponseSchema, b as BrainIndexConfigSchema, bi as UserAvatarSchema, bn as ListTemplatesResponseSchema, br as QueuedAgentPromptResponseSchema, bt as DraftRevisionResponseSchema, c as AgentSummaryDetailResponseSchema, ca as AssignCredentialBodySchema, ci as UpdateManagedServiceCredentialRequestSchema, cn as ListEmbeddingModelsResponseSchema, cr as ProjectResponseSchema, ct as CredentialInstanceListResponseSchema, d as AppSlugAvailabilityResponseSchema, da as CredentialAssignmentRecordSchema, di as UpdateOrganizationRequestSchema, dn as ListOrganizationInvitationsResponseSchema, dr as PromptInputSchema, dt as DOCS_SEARCH_TOOL, ea as parseErrorResponse, ei as UpdateBrainDocumentMetadataRequestSchema, en as ListBrainFiltersResponseSchema, er as PresignUserAvatarRequestSchema, et as CreateProjectArtifactRequestSchema, f as BindAgentSlackAppBodySchema, fa as CredentialConsumerListQuerySchema, fi as UpdateProjectMemberRequestSchema, fn as ListOrganizationMembersPageQuerySchema, fr as PromptResponseSchema, ft as DeclineOrganizationInvitationResponseSchema, gi as UploadProjectSourceManifestRequestSchema, gn as ListProjectFilesResponseSchema, gr as PublishManagedDeployCandidateRequestSchema, gt as DownloadActiveProjectSourceResponseSchema, h as BrainDocumentDetailSchema, hi as UpdateProjectSettingsRequestSchema, hn as ListProjectDeploymentsResponseSchema, hr as PublicFormSubmitResponseSchema, ht as DownloadActiveProjectArtifactResponseSchema, i as AddBrainMemberRequestSchema, ia as resolveConnectAppSlug, ii as UpdateBrainResponseSchema, in as ListChannelPlatformsResponseSchema, ir as ProjectGitRemoteResponseSchema, it as CreateSlackAppRequestSchema, j as ChannelConnectionSchema, ja as BillingUsageResponseSchema, ji as WorkflowRunInputsSchema, jn as PROJECT_DRAFT_DIFF_MAX_BYTES, jr as SlackAgentMembershipsResponseSchema, jt as GetCredentialResponseSchema, k as ChannelAccountListResponseSchema, ka as BillingRedirectResponseSchema, ki as WorkflowRunHooksResponseSchema, kn as PNPM_FROZEN_INSTALL_ARGS, kr as SkillSummaryDetailResponseSchema, kt as GatewayAttachmentRecordSchema, l as AgentSummaryListResponseSchema, la as CredentialAssignmentListQuerySchema, li as UpdateOrganizationMemberRequestSchema, ln as ListManagedServiceCredentialsResponseSchema, lr as ProjectSettingsResponseSchema, lt as CredentialInstanceRecordSchema, m as BrainDetailSchema, ma as ExecuteKeystrokeToolRequestSchema, mi as UpdateProjectRequestSchema, mn as ListOrganizationsResponseSchema, mr as PublicFormSubmitBodySchema, mt as DeleteBrainDocumentsResponseSchema, n as ActiveOrganizationResponseSchema, na as parseSlackConnectFlow, ni as UpdateBrainMemberRequestSchema, nn as ListBrainMembersResponseSchema, nt as CreateProjectRequestSchema, o as AgentSessionDetailResponseSchema, oa as slugifyAppName, oi as UpdateCredentialInstanceBodySchema, on as ListCredentialsPageResponseSchema, or as ProjectPullStateSchema, ot as CreateSlackChannelBodySchema, p as BindChannelBodySchema, pa as CredentialConsumerListResponseSchema, pi as UpdateProjectMemberResponseSchema, pn as ListOrganizationMembersPageResponseSchema, pr as PublicFormMetadataSchema, pt as DeleteBrainDocumentsRequestSchema, q as CreateCredentialsResponseSchema, qi as isAcceptableInstallExit, qn as PrepareManagedDeployResponseSchema, qr as TemplateFilesResponseSchema, qt as ListAgentWorkspaceFilesResponseSchema, r as ActiveProjectSourceRevisionSchema, ri as UpdateBrainRequestSchema, rn as ListBrainsResponseSchema, rr as ProjectGitRemoteRequestSchema, rt as CreateProjectResponseSchema, s as AgentSessionListResponseSchema, si as UpdateCredentialRequestSchema, sn as ListDraftFilesResponseSchema, sr as ProjectReachabilityResponseSchema, st as CreateSlackChannelResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ti as UpdateBrainFilterRequestSchema, tn as ListBrainGrantsResponseSchema, tr as PresignUserAvatarResponseSchema, tt as CreateProjectArtifactResponseSchema, u as AgentTriggerSummaryListResponseSchema, ua as CredentialAssignmentListResponseSchema, ui as UpdateOrganizationMemberResponseSchema, un as ListMcpAppToolsResponseSchema, ur as ProjectSlugAvailabilityResponseSchema, ut as DOCS_QUERY_TOOL, v as BrainFilterSummarySchema, vi as UpsertGatewayAttachmentBodySchema, vn as ListProjectMetricsResponseSchema, vr as PublishedFormListResponseSchema, vt as DraftConflictResponseSchema, w as CancelManagedDeployResponseSchema, wa as PresignChatAttachmentResponseSchema, wi as WorkflowCanvasRunSchema, wn as ManagedServiceKindSchema, wr as RenewManagedDeployUploadRequestSchema, wt as FinalizeBrainUploadsRequestSchema, x as BrainMemberSchema, xa as ACTIVE_ORG_HEADER, xi as UserPreferencesPatchSchema, xn as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, xr as QueuedRunResponseSchema, xt as DraftUpdateEventSchema, y as BrainGrantSchema, yi as UserAvatarPatchSchema, yn as ListProjectsResponseSchema, yr as PublishedFormSchema, yt as DraftFileContentResponseSchema, z as ConnectProvidersResponseSchema, zi as WorkspaceTriggerOverviewSchema, zn as PlatformAgentCancelResponseSchema, zr as StartKeystrokeConnectionResultSchema, zt as HistoryRunDetailResponseSchema } from "./dist-TgqInfge.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-aOn-HftZ.mjs";
5
+ import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-GlNKf6iY.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,262 @@ 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
+ async checkSlug(brainSlug, slug) {
6077
+ const query = new URLSearchParams({ slug });
6078
+ try {
6079
+ return BrainSlugAvailabilityResponseSchema.parse(await http.get(`${brainPath(brainSlug)}/slug-available?${query}`).json());
6080
+ } catch (error) {
6081
+ throw await toPlatformError(error);
6082
+ }
6083
+ },
6084
+ /** Creates a base Brain; the caller becomes its sole owner. No project is granted. */
6085
+ async create(input) {
6086
+ const body = CreateBrainRequestSchema.parse(input);
6087
+ try {
6088
+ return BrainDetailSchema.parse(await http.post(brainPath(), { json: body }).json());
6089
+ } catch (error) {
6090
+ throw await toPlatformError(error);
6091
+ }
6092
+ },
6093
+ async update(brainSlug, input) {
6094
+ const body = UpdateBrainRequestSchema.parse(input);
6095
+ try {
6096
+ return UpdateBrainResponseSchema.parse(await http.patch(brainPath(brainSlug), { json: body }).json());
6097
+ } catch (error) {
6098
+ throw await toPlatformError(error);
6099
+ }
6100
+ },
6101
+ async delete(brainSlug) {
6102
+ try {
6103
+ await http.delete(brainPath(brainSlug));
6104
+ } catch (error) {
6105
+ throw await toPlatformError(error);
6106
+ }
6107
+ },
6108
+ async rebuild(brainSlug) {
6109
+ try {
6110
+ return RebuildBrainResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/rebuild`).json());
6111
+ } catch (error) {
6112
+ throw await toPlatformError(error);
6113
+ }
6114
+ },
6115
+ async listMembers(brainSlug) {
6116
+ try {
6117
+ const data = await http.get(`${brainPath(brainSlug)}/members`).json();
6118
+ return ListBrainMembersResponseSchema.parse(data).members;
6119
+ } catch (error) {
6120
+ throw await toPlatformError(error);
6121
+ }
6122
+ },
6123
+ async addMember(brainSlug, input) {
6124
+ const body = AddBrainMemberRequestSchema.parse(input);
6125
+ try {
6126
+ return BrainMemberSchema.parse(await http.post(`${brainPath(brainSlug)}/members`, { json: body }).json());
6127
+ } catch (error) {
6128
+ throw await toPlatformError(error);
6129
+ }
6130
+ },
6131
+ async updateMember(brainSlug, userId, input) {
6132
+ const body = UpdateBrainMemberRequestSchema.parse(input);
6133
+ try {
6134
+ return BrainMemberSchema.parse(await http.patch(`${brainPath(brainSlug)}/members/${encodeURIComponent(userId)}`, { json: body }).json());
6135
+ } catch (error) {
6136
+ throw await toPlatformError(error);
6137
+ }
6138
+ },
6139
+ async removeMember(brainSlug, userId) {
6140
+ try {
6141
+ await http.delete(`${brainPath(brainSlug)}/members/${encodeURIComponent(userId)}`);
6142
+ } catch (error) {
6143
+ throw await toPlatformError(error);
6144
+ }
6145
+ },
6146
+ async listGrants(brainSlug) {
6147
+ try {
6148
+ const data = await http.get(`${brainPath(brainSlug)}/projects`).json();
6149
+ return ListBrainGrantsResponseSchema.parse(data).grants;
6150
+ } catch (error) {
6151
+ throw await toPlatformError(error);
6152
+ }
6153
+ },
6154
+ async createGrant(brainSlug, input) {
6155
+ const body = CreateBrainGrantRequestSchema.parse(input);
6156
+ try {
6157
+ return BrainGrantSchema.parse(await http.post(`${brainPath(brainSlug)}/projects`, { json: body }).json());
6158
+ } catch (error) {
6159
+ throw await toPlatformError(error);
6160
+ }
6161
+ },
6162
+ async revokeGrant(brainSlug, projectId) {
6163
+ try {
6164
+ await http.delete(`${brainPath(brainSlug)}/projects/${encodeURIComponent(projectId)}`);
6165
+ } catch (error) {
6166
+ throw await toPlatformError(error);
6167
+ }
6168
+ },
6169
+ async listFilters(brainSlug) {
6170
+ try {
6171
+ const data = await http.get(`${brainPath(brainSlug)}/filters`).json();
6172
+ return ListBrainFiltersResponseSchema.parse(data).filters;
6173
+ } catch (error) {
6174
+ throw await toPlatformError(error);
6175
+ }
6176
+ },
6177
+ async createFilter(brainSlug, input) {
6178
+ const body = CreateBrainFilterRequestSchema.parse(input);
6179
+ try {
6180
+ return BrainFilterSummarySchema.parse(await http.post(`${brainPath(brainSlug)}/filters`, { json: body }).json());
6181
+ } catch (error) {
6182
+ throw await toPlatformError(error);
6183
+ }
6184
+ },
6185
+ async updateFilter(brainSlug, filterSlug, input) {
6186
+ const body = UpdateBrainFilterRequestSchema.parse(input);
6187
+ try {
6188
+ return BrainFilterSummarySchema.parse(await http.patch(`${brainPath(brainSlug)}/filters/${encodeURIComponent(filterSlug)}`, { json: body }).json());
6189
+ } catch (error) {
6190
+ throw await toPlatformError(error);
6191
+ }
6192
+ },
6193
+ async deleteFilter(brainSlug, filterSlug) {
6194
+ try {
6195
+ await http.delete(`${brainPath(brainSlug)}/filters/${encodeURIComponent(filterSlug)}`);
6196
+ } catch (error) {
6197
+ throw await toPlatformError(error);
6198
+ }
6199
+ },
6200
+ async listDocuments(brainSlug, input = {}) {
6201
+ const query = documentsQueryString(input);
6202
+ try {
6203
+ return ListBrainDocumentsResponseSchema.parse(await http.get(`${brainPath(brainSlug)}/documents?${query}`).json());
6204
+ } catch (error) {
6205
+ throw await toPlatformError(error);
6206
+ }
6207
+ },
6208
+ async getDocument(brainSlug, documentId) {
6209
+ try {
6210
+ return BrainDocumentDetailSchema.parse(await http.get(`${brainPath(brainSlug)}/documents/detail/${encodeDocumentPath(documentId)}`).json());
6211
+ } catch (error) {
6212
+ throw await toPlatformError(error);
6213
+ }
6214
+ },
6215
+ async listDocumentWrites(brainSlug, input) {
6216
+ const query = documentWritesQueryString(input);
6217
+ try {
6218
+ return ListBrainDocumentWritesResponseSchema.parse(await http.get(`${brainPath(brainSlug)}/documents/writes?${query}`).json());
6219
+ } catch (error) {
6220
+ throw await toPlatformError(error);
6221
+ }
6222
+ },
6223
+ async updateDocumentMetadata(brainSlug, documentId, metadata) {
6224
+ const body = UpdateBrainDocumentMetadataRequestSchema.parse({ metadata });
6225
+ try {
6226
+ await http.patch(`${brainPath(brainSlug)}/documents/${encodeDocumentPath(documentId)}`, { json: body });
6227
+ } catch (error) {
6228
+ throw await toPlatformError(error);
6229
+ }
6230
+ },
6231
+ async deleteDocuments(brainSlug, documentIds) {
6232
+ const body = DeleteBrainDocumentsRequestSchema.parse({ documentIds });
6233
+ try {
6234
+ const data = await http.post(`${brainPath(brainSlug)}/documents/delete`, { json: body }).json();
6235
+ return DeleteBrainDocumentsResponseSchema.parse(data).deletedDocumentIds;
6236
+ } catch (error) {
6237
+ throw await toPlatformError(error);
6238
+ }
6239
+ },
6240
+ async prepareUploads(brainSlug, input) {
6241
+ const body = PrepareBrainUploadsRequestSchema.parse(input);
6242
+ try {
6243
+ return PrepareBrainUploadsResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/documents/prepare`, { json: body }).json());
6244
+ } catch (error) {
6245
+ throw await toPlatformError(error);
6246
+ }
6247
+ },
6248
+ async finalizeUploads(brainSlug, versionIds) {
6249
+ const body = FinalizeBrainUploadsRequestSchema.parse({ versionIds });
6250
+ try {
6251
+ return FinalizeBrainUploadsResponseSchema.parse(await http.post(`${brainPath(brainSlug)}/documents/finalize`, { json: body }).json());
6252
+ } catch (error) {
6253
+ throw await toPlatformError(error);
6254
+ }
6255
+ }
6256
+ };
6257
+ }
6258
+ /**
6259
+ * Embedding-model catalog for Brain create/update pickers. Served from the
6260
+ * platform's cached AI Gateway catalog (`GET /api/embedding-models`); any
6261
+ * returned id is a valid Brain `indexConfig.embeddingModel`.
6262
+ */
6263
+ function createEmbeddingModelsResource(http) {
6264
+ return { async list() {
6265
+ try {
6266
+ const data = await http.get("api/embedding-models").json();
6267
+ return ListEmbeddingModelsResponseSchema.parse(data).models;
6268
+ } catch (error) {
6269
+ throw await toPlatformError(error);
6270
+ }
6271
+ } };
6272
+ }
5999
6273
  function createHistoryResource(http) {
6000
6274
  return {
6001
6275
  /** Runs across projects the current user can access in the active org. */
@@ -6413,6 +6687,8 @@ function createPlatformClient(options) {
6413
6687
  apiKeys: createApiKeysResource(http),
6414
6688
  managedServiceCredentials: createManagedServiceCredentialsResource(http),
6415
6689
  billing: createBillingResource(http),
6690
+ brains: createBrainsResource(http),
6691
+ embeddingModels: createEmbeddingModelsResource(http),
6416
6692
  recents: createRecentsResource(http),
6417
6693
  userPreferences: createUserPreferencesResource(http),
6418
6694
  userAvatar: createUserAvatarResource(http),
@@ -7583,6 +7859,146 @@ Examples:
7583
7859
  }, void 0, { orgScoped: true }));
7584
7860
  }
7585
7861
  //#endregion
7862
+ //#region src/commands/agents/browser.ts
7863
+ function profilesRoot() {
7864
+ return process.env.KEYSTROKE_BROWSER_PROFILES_ROOT?.trim() || defaultBrowserProfilesRoot();
7865
+ }
7866
+ function profileMetaPath(agentSlug) {
7867
+ return join(agentBrowserProfilePath(profilesRoot(), agentSlug), ".keystroke-profile.json");
7868
+ }
7869
+ function readProfileMeta(agentSlug) {
7870
+ const path = profileMetaPath(agentSlug);
7871
+ if (!existsSync(path)) return {};
7872
+ try {
7873
+ return JSON.parse(readFileSync(path, "utf8"));
7874
+ } catch (error) {
7875
+ throw new Error(`Invalid browser profile metadata at ${path}`, { cause: error });
7876
+ }
7877
+ }
7878
+ function writeProfileMeta(agentSlug, meta) {
7879
+ mkdirSync(agentBrowserProfilePath(profilesRoot(), agentSlug), { recursive: true });
7880
+ writeFileSync(profileMetaPath(agentSlug), JSON.stringify({
7881
+ ...meta,
7882
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
7883
+ }, null, 2));
7884
+ }
7885
+ function openUrl$1(url) {
7886
+ spawn(process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open", [url], {
7887
+ stdio: "ignore",
7888
+ detached: true
7889
+ }).unref();
7890
+ }
7891
+ function registerAgentBrowserCommand(agent) {
7892
+ const browser = agent.command("browser").description("Manage the agent's durable browser profile");
7893
+ 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", `
7894
+ Examples:
7895
+ keystroke agents browser open recruiter --url https://linkedin.com/login
7896
+ keystroke agents browser open recruiter --url https://x.com/login
7897
+ `).action((slug, options) => runProjectCliCommand("Open agent browser failed", async ({ config, apiTarget }) => {
7898
+ const url = options.url ?? "about:blank";
7899
+ if (apiTarget.projectId) {
7900
+ const opened = await createCliPlatformClient(config).agents.openBrowserSession(apiTarget.projectId, slug, { url });
7901
+ writeProfileMeta(slug, {
7902
+ ...readProfileMeta(slug),
7903
+ cloudProfileId: opened.cloudProfileId,
7904
+ lastBrowserUseSessionId: opened.browserUseSessionId,
7905
+ lastLiveUrl: opened.liveUrl
7906
+ });
7907
+ process.stdout.write(`${JSON.stringify(opened, null, 2)}\n`);
7908
+ if (options.open !== false && opened.liveUrl) openUrl$1(opened.liveUrl);
7909
+ else if (opened.liveUrl) process.stdout.write(`Live view: ${opened.liveUrl}\n`);
7910
+ return;
7911
+ }
7912
+ 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) {
7913
+ const apiKey = process.env.BROWSER_USE_API_KEY;
7914
+ const existing = readProfileMeta(slug);
7915
+ const opened = await openCloudBrowserLogin({
7916
+ apiKey,
7917
+ agentSlug: slug,
7918
+ url,
7919
+ ...existing.cloudProfileId ? { cloudProfileId: existing.cloudProfileId } : {}
7920
+ });
7921
+ writeProfileMeta(slug, {
7922
+ ...existing,
7923
+ cloudProfileId: opened.cloudProfileId,
7924
+ lastBrowserUseSessionId: opened.browserUseSessionId,
7925
+ lastLiveUrl: opened.liveUrl
7926
+ });
7927
+ process.stdout.write(`${JSON.stringify({
7928
+ agentSlug: slug,
7929
+ provider: "browseruse",
7930
+ liveUrl: opened.liveUrl ?? null,
7931
+ browserUseSessionId: opened.browserUseSessionId,
7932
+ cloudProfileId: opened.cloudProfileId,
7933
+ sessionId: opened.sessionId,
7934
+ url,
7935
+ hint: "Sign in in the live view, then close when done. Profile cookies persist."
7936
+ }, null, 2)}\n`);
7937
+ if (options.open !== false && opened.liveUrl) openUrl$1(opened.liveUrl);
7938
+ else process.stdout.write(`Live view: ${opened.liveUrl ?? "(none)"}\n`);
7939
+ return;
7940
+ }
7941
+ const ctx = resolveBrowserContext({
7942
+ agentSlug: slug,
7943
+ sessionId: `cli-${Date.now()}`,
7944
+ profilesRoot: profilesRoot(),
7945
+ provider: "local"
7946
+ });
7947
+ mkdirSync(ctx.profilePath, { recursive: true });
7948
+ const result = await runAgentBrowser({
7949
+ context: ctx,
7950
+ args: [
7951
+ "--headed",
7952
+ "open",
7953
+ url
7954
+ ]
7955
+ });
7956
+ process.stdout.write(`${JSON.stringify({
7957
+ agentSlug: slug,
7958
+ provider: "local",
7959
+ profilePath: ctx.profilePath,
7960
+ url,
7961
+ exitCode: result.exitCode,
7962
+ stdout: result.stdout.trim() || null,
7963
+ stderr: result.stderr.trim() || null,
7964
+ hint: "Sign in in the headed window. Profile cookies persist for this agent."
7965
+ }, null, 2)}\n`);
7966
+ if (result.exitCode !== 0) process.exitCode = result.exitCode;
7967
+ }));
7968
+ 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 () => {
7969
+ const meta = readProfileMeta(slug);
7970
+ if (meta.lastBrowserUseSessionId && process.env.BROWSER_USE_API_KEY) await stopBrowserUseSession({
7971
+ apiKey: process.env.BROWSER_USE_API_KEY,
7972
+ sessionId: meta.lastBrowserUseSessionId
7973
+ });
7974
+ if (meta.cloudProfileId && process.env.BROWSER_USE_API_KEY) await deleteBrowserUseProfile({
7975
+ apiKey: process.env.BROWSER_USE_API_KEY,
7976
+ profileId: meta.cloudProfileId
7977
+ });
7978
+ const path = agentBrowserProfilePath(profilesRoot(), slug);
7979
+ if (existsSync(path)) rmSync(path, {
7980
+ recursive: true,
7981
+ force: true
7982
+ });
7983
+ process.stdout.write(`${JSON.stringify({
7984
+ agentSlug: slug,
7985
+ reset: true,
7986
+ profilePath: path
7987
+ }, null, 2)}\n`);
7988
+ }));
7989
+ browser.command("status").description("Show this agent's browser profile status").argument("<slug>", "Agent slug").action((slug) => runProjectCliCommand("Agent browser status failed", async () => {
7990
+ const path = agentBrowserProfilePath(profilesRoot(), slug);
7991
+ const meta = readProfileMeta(slug);
7992
+ process.stdout.write(`${JSON.stringify({
7993
+ agentSlug: slug,
7994
+ profilePath: path,
7995
+ exists: existsSync(path),
7996
+ providerHint: resolveBrowserProvider({ ...process.env.BROWSER_USE_API_KEY ? { browserUseApiKey: process.env.BROWSER_USE_API_KEY } : {} }),
7997
+ ...meta
7998
+ }, null, 2)}\n`);
7999
+ }));
8000
+ }
8001
+ //#endregion
7586
8002
  //#region src/commands/agents/index.ts
7587
8003
  function registerAgentsCommand(program) {
7588
8004
  const agents = program.command("agents").description("Invoke and inspect agents");
@@ -7590,6 +8006,7 @@ function registerAgentsCommand(program) {
7590
8006
  registerAgentPromptCommand(agents);
7591
8007
  registerAgentSessionsCommand(agents);
7592
8008
  registerAgentSnapshotCommand(agents);
8009
+ registerAgentBrowserCommand(agents);
7593
8010
  }
7594
8011
  //#endregion
7595
8012
  //#region src/commands/api-key/run-api-key.ts
@@ -9048,7 +9465,7 @@ function registerBuildCommand(program) {
9048
9465
  try {
9049
9466
  const root = resolveProjectRoot(options.dir);
9050
9467
  await ensureSdkCurrent(root);
9051
- const { buildApp } = await import("./dist-Brtmx-yx.mjs");
9468
+ const { buildApp } = await import("./dist-DoQQmUk7.mjs");
9052
9469
  await buildApp({ root });
9053
9470
  process.stdout.write(`Built ${root}\n`);
9054
9471
  } catch (error) {
@@ -9059,6 +9476,193 @@ function registerBuildCommand(program) {
9059
9476
  });
9060
9477
  }
9061
9478
  //#endregion
9479
+ //#region src/commands/brains/with-brains.ts
9480
+ /**
9481
+ * Brain management is organization-scoped: commands need the active
9482
+ * organization but never a linked project. Project references only appear as
9483
+ * explicit cross-references on grant commands.
9484
+ */
9485
+ async function withBrains(label, action) {
9486
+ await runCliCommand(label, async () => {
9487
+ const client = createCliPlatformClient(createCliConfig());
9488
+ const result = await action({
9489
+ brains: client.brains,
9490
+ projects: client.projects
9491
+ });
9492
+ if (result !== void 0) process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
9493
+ }, void 0, { orgScoped: true });
9494
+ }
9495
+ function collectRepeatable(value, previous) {
9496
+ return [...previous, value];
9497
+ }
9498
+ function parseFilterExpression(value) {
9499
+ let parsed;
9500
+ try {
9501
+ parsed = JSON.parse(value);
9502
+ } catch {
9503
+ throw new Error("--filter must be a JSON object");
9504
+ }
9505
+ return BrainFilterExpressionSchema.parse(parsed);
9506
+ }
9507
+ function parseGrantAccess(value) {
9508
+ if (value !== "read" && value !== "write") throw new Error("--access must be read or write");
9509
+ return value;
9510
+ }
9511
+ function parseMemberRole(value) {
9512
+ if (value !== "owner" && value !== "admin") throw new Error("--role must be owner or admin");
9513
+ return value;
9514
+ }
9515
+ /** Resolves a project slug or id cross-reference to the project id. */
9516
+ async function resolveProjectId(projects, reference) {
9517
+ const match = (await projects.list({ admin: true })).find((project) => project.slug === reference || project.id === reference);
9518
+ if (!match) throw new Error(`Project "${reference}" not found`);
9519
+ return match.id;
9520
+ }
9521
+ //#endregion
9522
+ //#region src/commands/brains/documents.ts
9523
+ function parseProvisionerKinds(values) {
9524
+ return values.map((value) => {
9525
+ if (value !== "workflow" && value !== "manual") throw new Error("--provisioner must be workflow or manual");
9526
+ return value;
9527
+ });
9528
+ }
9529
+ function registerBrainDocumentsCommands(brains) {
9530
+ const documents = brains.command("documents").description("Inspect and remove Brain documents");
9531
+ 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, {
9532
+ ...options.search ? { search: options.search } : {},
9533
+ ...options.source.length > 0 ? { source: options.source } : {},
9534
+ ...options.provisioner.length > 0 ? { provisionerKind: parseProvisionerKinds(options.provisioner) } : {},
9535
+ ...options.filter ? { filterSlug: options.filter } : {},
9536
+ ...options.prefix ? { prefix: options.prefix } : {},
9537
+ ...options.cursor ? { cursor: options.cursor } : {},
9538
+ limit: Number(options.limit)
9539
+ })));
9540
+ 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)));
9541
+ 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 }) => {
9542
+ if (!options.yes) throw new Error("Pass --yes to confirm document deletion");
9543
+ return api.deleteDocuments(slug, documentIds);
9544
+ }));
9545
+ }
9546
+ //#endregion
9547
+ //#region src/commands/brains/filters.ts
9548
+ function registerBrainFiltersCommands(brains) {
9549
+ const filters = brains.command("filters").description("Manage saved read filters, addressable as {brain-slug}:{filter-slug}");
9550
+ filters.command("list <slug>").description("List filters on a Brain").action((slug) => withBrains("List Brain filters failed", ({ brains: api }) => api.listFilters(slug)));
9551
+ 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, {
9552
+ name: options.name,
9553
+ description: options.description,
9554
+ filter: parseFilterExpression(options.filter),
9555
+ ...options.slug ? { slug: options.slug } : {}
9556
+ })));
9557
+ 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 }) => {
9558
+ const input = {
9559
+ ...options.name ? { name: options.name } : {},
9560
+ ...options.description !== void 0 ? { description: options.description } : {},
9561
+ ...options.filter ? { filter: parseFilterExpression(options.filter) } : {}
9562
+ };
9563
+ if (Object.keys(input).length === 0) throw new Error("At least one update option is required");
9564
+ return api.updateFilter(slug, filterSlug, input);
9565
+ }));
9566
+ 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 }) => {
9567
+ await api.deleteFilter(slug, filterSlug);
9568
+ return { deleted: filterSlug };
9569
+ }));
9570
+ }
9571
+ //#endregion
9572
+ //#region src/commands/brains/members.ts
9573
+ function registerBrainMembersCommands(brains) {
9574
+ const members = brains.command("members").description("Manage Brain owner/admin memberships (owner-only)");
9575
+ members.command("list <slug>").description("List members of a Brain").action((slug) => withBrains("List Brain members failed", ({ brains: api }) => api.listMembers(slug)));
9576
+ 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, {
9577
+ userId,
9578
+ role: parseMemberRole(options.role)
9579
+ })));
9580
+ 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) })));
9581
+ members.command("delete <slug> <user-id>").description("Remove a Brain member").action((slug, userId) => withBrains("Remove Brain member failed", async ({ brains: api }) => {
9582
+ await api.removeMember(slug, userId);
9583
+ return { deleted: userId };
9584
+ }));
9585
+ }
9586
+ //#endregion
9587
+ //#region src/commands/brains/projects.ts
9588
+ function registerBrainProjectsCommands(brains) {
9589
+ const projects = brains.command("projects").description("Share a Brain with project runtimes (read/write grants)");
9590
+ projects.command("list <slug>").description("List project grants for a Brain").action((slug) => withBrains("List Brain project grants failed", ({ brains: api }) => api.listGrants(slug)));
9591
+ 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, {
9592
+ projectId: await resolveProjectId(refs, projectRef),
9593
+ access: parseGrantAccess(options.access)
9594
+ })));
9595
+ 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 }) => {
9596
+ const projectId = await resolveProjectId(refs, projectRef);
9597
+ await api.revokeGrant(slug, projectId);
9598
+ return { deleted: projectId };
9599
+ }));
9600
+ }
9601
+ //#endregion
9602
+ //#region src/commands/brains/index.ts
9603
+ function parseOptionalInteger(value, flag) {
9604
+ if (value === void 0) return;
9605
+ const parsed = Number(value);
9606
+ if (!Number.isInteger(parsed)) throw new Error(`${flag} must be an integer`);
9607
+ return parsed;
9608
+ }
9609
+ function hasIndexOptions(options) {
9610
+ return options.embeddingModel !== void 0 || options.language !== void 0 || options.maxCharacters !== void 0 || options.overlapCharacters !== void 0 || options.separator !== void 0;
9611
+ }
9612
+ function indexConfigFromOptions(options, base) {
9613
+ if (!hasIndexOptions(options)) return;
9614
+ const maxCharacters = parseOptionalInteger(options.maxCharacters, "--max-characters");
9615
+ const overlapCharacters = parseOptionalInteger(options.overlapCharacters, "--overlap-characters");
9616
+ return BrainIndexConfigSchema.parse({
9617
+ ...base ?? {},
9618
+ ...options.embeddingModel ? { embeddingModel: options.embeddingModel } : {},
9619
+ ...options.language ? { language: options.language } : {},
9620
+ chunking: {
9621
+ ...base?.chunking ?? {},
9622
+ ...maxCharacters !== void 0 ? { maxCharacters } : {},
9623
+ ...overlapCharacters !== void 0 ? { overlapCharacters } : {},
9624
+ ...options.separator !== void 0 ? { separator: options.separator } : {}
9625
+ }
9626
+ });
9627
+ }
9628
+ function addIndexOptions(command) {
9629
+ 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");
9630
+ }
9631
+ function registerBrainsCommand(program) {
9632
+ const brains = program.command("brains").description("Create, inspect, share, and rebuild hosted Brains (organization-scoped)");
9633
+ brains.command("list").description("List Brains you own or administer").action(() => withBrains("List Brains failed", ({ brains: api }) => api.list()));
9634
+ brains.command("get <slug>").description("Get a Brain").action((slug) => withBrains("Get Brain failed", ({ brains: api }) => api.get(slug)));
9635
+ 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 }) => {
9636
+ const indexConfig = indexConfigFromOptions(options);
9637
+ return api.create({
9638
+ name: options.name,
9639
+ description: options.description,
9640
+ ...options.slug ? { slug: options.slug } : {},
9641
+ ...indexConfig ? { indexConfig } : {}
9642
+ });
9643
+ }));
9644
+ 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 }) => {
9645
+ const indexConfig = indexConfigFromOptions(options, (hasIndexOptions(options) ? await api.get(slug) : void 0)?.indexConfig);
9646
+ const input = {
9647
+ ...options.name ? { name: options.name } : {},
9648
+ ...options.description !== void 0 ? { description: options.description } : {},
9649
+ ...indexConfig ? { indexConfig } : {}
9650
+ };
9651
+ if (Object.keys(input).length === 0) throw new Error("At least one update option is required");
9652
+ return api.update(slug, input);
9653
+ }));
9654
+ 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 }) => {
9655
+ if (!options.yes) throw new Error("Pass --yes to confirm Brain deletion");
9656
+ await api.delete(slug);
9657
+ return { deleted: slug };
9658
+ }));
9659
+ brains.command("rebuild <slug>").description("Rebuild a Brain's index from stored documents").action((slug) => withBrains("Rebuild Brain failed", ({ brains: api }) => api.rebuild(slug)));
9660
+ registerBrainMembersCommands(brains);
9661
+ registerBrainProjectsCommands(brains);
9662
+ registerBrainFiltersCommands(brains);
9663
+ registerBrainDocumentsCommands(brains);
9664
+ }
9665
+ //#endregion
9062
9666
  //#region src/deploy/assert-portable-dependencies.ts
9063
9667
  const LINK_SPEC = /^link:/i;
9064
9668
  const WORKSPACE_SPEC = /^workspace:/i;
@@ -14347,6 +14951,7 @@ function createProgram() {
14347
14951
  registerApiKeyCommand(program);
14348
14952
  registerManagedServicesCommand(program);
14349
14953
  registerProjectsCommand(program);
14954
+ registerBrainsCommand(program);
14350
14955
  registerHistoryCommand(program);
14351
14956
  registerCredentialsCommand(program);
14352
14957
  registerHealthCommand(program);
@@ -14371,7 +14976,7 @@ function createProgram() {
14371
14976
  async function runCli(argv) {
14372
14977
  initCliTelemetry();
14373
14978
  try {
14374
- const { maybeAutoUpdate } = await import("./maybe-auto-update-28IpqxhP.mjs");
14979
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-Dwn9LbQT.mjs");
14375
14980
  await maybeAutoUpdate(argv);
14376
14981
  await createProgram().parseAsync(argv);
14377
14982
  } finally {
@@ -14381,4 +14986,4 @@ async function runCli(argv) {
14381
14986
  //#endregion
14382
14987
  export { runCli };
14383
14988
 
14384
- //# sourceMappingURL=program-BfapxNQ4.mjs.map
14989
+ //# sourceMappingURL=program-CI7XG0Yv.mjs.map