@keystrokehq/cli 0.0.1 → 0.0.3
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/AGENTS-blurb.md +1 -1
- package/LICENSE +0 -21
- package/README.md +14 -6
- package/dist/accept.handler-DFtM0IuO.mjs +22 -0
- package/dist/admin-D_7tenRC.mjs +208 -0
- package/dist/{agent-manifest-CDnbkR2f.mjs → agent-manifest-Bfa3DBgc.mjs} +4 -4
- package/dist/{agents-CZJGxVqV.mjs → agents-DMEo-6QB.mjs} +8 -8
- package/dist/api-keys-BThGvtdn.mjs +58 -0
- package/dist/{auth-DN2VusyU.mjs → auth-CY0Gg9sN.mjs} +7 -11
- package/dist/{auth.handler-CT1BQUvu.mjs → auth.handler-CbhiLOG1.mjs} +83 -8
- package/dist/{build-agents-BmM_AsSd-BGi9wtzt.mjs → build-agents-DfbiMZ_e-CRnzruSu.mjs} +7 -7
- package/dist/{build-metadata-BWS7uhd_-DR8gJjTX.mjs → build-metadata-zidV9Cai-RgG4ndIH.mjs} +11 -11
- package/dist/{build-progress-DgYKb4hB.mjs → build-progress-Cn2j1LqF.mjs} +1 -1
- package/dist/{build-tasks-CdihpudT-D5r5HUHe.mjs → build-tasks-O1jYtlv1-Y65uGWuz.mjs} +4 -5
- package/dist/{build-workflows-CfxBnIWh-CdYPv8w2.mjs → build-workflows-3fdvdHHf-DJ_lH1NH.mjs} +9 -9
- package/dist/{build.handler-4799CjWH.mjs → build.handler-Tb3IpABI.mjs} +5 -5
- package/dist/{clear-cache.handler-B9tqSoSM.mjs → clear-cache.handler-BEbPz5Ej.mjs} +1 -1
- package/dist/{clear.handler-BydlX-zE.mjs → clear.handler-CtOZ4aRn.mjs} +1 -1
- package/dist/{clear.handler-BTIXXPTJ.mjs → clear.handler-YS8gPriq.mjs} +2 -2
- package/dist/{commander-DfTVqQ-3.mjs → commander-DZ3F3CVq.mjs} +6 -5
- package/dist/common-BrVAdUyD.mjs +20 -0
- package/dist/{connect-BUXkeH0F.mjs → connect-DpQgYg8z.mjs} +3 -3
- package/dist/{connect.handler-CYel9cy6.mjs → connect.handler-DuRr_yyN.mjs} +5 -5
- package/dist/{context-T7HZuB97.mjs → context-Y1f1hGYy.mjs} +7 -7
- package/dist/create.handler-uNG3I4wS.mjs +24 -0
- package/dist/credential-requirements-DjDFthio.mjs +480 -0
- package/dist/{credential-schema-mismatch-BKo5PjcQ.mjs → credential-schema-mismatch-B-wwbCvw.mjs} +2 -2
- package/dist/{credentials-OfVHOtG3.mjs → credentials-DHlK_O4L.mjs} +823 -14
- package/dist/{credentials-CvmjU0lK.mjs → credentials-UpgEcaub.mjs} +7 -7
- package/dist/{current-deployment-workflow-poHt27i3.mjs → current-deployment-workflow-M8GEIHxv.mjs} +5 -5
- package/dist/{current.handler-B8zKzfPp.mjs → current.handler-BqPUKCvn.mjs} +1 -1
- package/dist/declared-credential-requirements-Bwlb-KZE.mjs +132 -0
- package/dist/default-urls-BS4twrsS.mjs +7 -0
- package/dist/{delete.handler-bAu1iXVQ.mjs → delete.handler-CJTHVZaz.mjs} +1 -1
- package/dist/{deploy-7Jjls436.mjs → deploy-CdnaZY3s.mjs} +1 -1
- package/dist/{deploy-BOPIpRWm.mjs → deploy-Gw0KPrkf.mjs} +2 -2
- package/dist/{deploy-progress-BmGUNFKg.mjs → deploy-progress-CZ2rPlOj.mjs} +1 -1
- package/dist/{deploy.handler-BAzgiNhd.mjs → deploy.handler-zzFAt7pp.mjs} +18 -18
- package/dist/{detect-env-access-CwkOYeYM-D_BCZqV6.mjs → detect-env-access-CwkOYeYM-h2W05D_Q.mjs} +1 -1
- package/dist/{diff.handler-Du7SY8K4.mjs → diff.handler--zdSkUnK.mjs} +5 -5
- package/dist/{dist-CUK7yBM0.mjs → dist-BF6r1hfv.mjs} +3 -3
- package/dist/{dist-BkJUoBiG.mjs → dist-C2Dq_nx3.mjs} +12 -12
- package/dist/{env-91KwMKov.mjs → env-YTZGKGIu.mjs} +9 -10
- package/dist/{env.handler-BAzBuMzQ.mjs → env.handler-d4sJ706C.mjs} +8 -8
- package/dist/{error-boundary-VL-JLfIa.mjs → error-boundary-B9PgBkv8.mjs} +2 -2
- package/dist/{file-metadata-D1vm-XY2.mjs → file-metadata-CdFXMMIw.mjs} +1 -1
- package/dist/hosted-action-dispatcher-registry-TOVzMhUR.mjs +126 -0
- package/dist/iam-command-utils-CNC8JfZ5.mjs +72 -0
- package/dist/{import-module-CV84H5fZ-B_CBCmb4.mjs → import-module-DDPnzlJ1-CYJD2n2b.mjs} +395 -10
- package/dist/{init-DpMCotSK.mjs → init-C0sps8R7.mjs} +2 -2
- package/dist/{init.handler-CPRnif52.mjs → init.handler-DSW6XFZn.mjs} +17 -17
- package/dist/{inspect.handler-DT_cD036.mjs → inspect.handler-DbN0ZVTh.mjs} +5 -5
- package/dist/{integration-catalog-Bt-L3GjF.mjs → integration-catalog-DFlytKJS.mjs} +2 -2
- package/dist/{integrations-DlatPK4W.mjs → integrations-Dcadds2b.mjs} +5 -5
- package/dist/invites-DvsxTRAb.mjs +44 -0
- package/dist/invites.list.handler-B5quln3m.mjs +43 -0
- package/dist/invites.resend.handler-CSpj7bQ5.mjs +23 -0
- package/dist/invites.revoke.handler-_hdEkBdO.mjs +28 -0
- package/dist/keystroke.mjs +31 -22
- package/dist/{list-enrichment-y-cwizLr.mjs → list-enrichment-CTqx0Rk_.mjs} +1 -1
- package/dist/{list.handler-CWF_Dj15.mjs → list.handler-08GY-wnx.mjs} +1 -1
- package/dist/{list.handler-DWaQkJaR.mjs → list.handler-20v4uRMk.mjs} +2 -2
- package/dist/{list.handler-BTWvCyjA.mjs → list.handler-BRq-nScx.mjs} +5 -5
- package/dist/{list.handler-lq3ZGAn4.mjs → list.handler-CWO6DExh.mjs} +3 -3
- package/dist/{list.handler-CZ6G2x_G.mjs → list.handler-DAiJtW20.mjs} +3 -3
- package/dist/list.handler-DLl8ca6F.mjs +42 -0
- package/dist/{list.handler-DqbFcBW7.mjs → list.handler-DSPr0OxS.mjs} +7 -7
- package/dist/{logs-BEg9L5l8.mjs → logs-D_48skmi.mjs} +3 -3
- package/dist/{logs.handler-BD_dXiL1.mjs → logs.handler-4ctMVYMj.mjs} +3 -3
- package/dist/{logs.handler-6hoMBzqw.mjs → logs.handler-C3QnSCaH.mjs} +1 -1
- package/dist/members.add.handler-Dq_giQ8g.mjs +31 -0
- package/dist/members.invite.handler-v404bUsq.mjs +32 -0
- package/dist/members.list.handler-D6TE0yp8.mjs +43 -0
- package/dist/members.remove.handler-BhQ3cyeR.mjs +28 -0
- package/dist/members.update.handler-BVy2cv1K.mjs +28 -0
- package/dist/{metadata-layout-GUYIUo0i-_aG2zjue.mjs → metadata-layout-C6ed-9dl-aBmqqvD5.mjs} +2 -2
- package/dist/{normalize-path-CojS-CgQ-DLCOvnD1.mjs → normalize-path-CojS-CgQ-BKRFUzWW.mjs} +1 -1
- package/dist/org-CkRr-f3S.mjs +234 -0
- package/dist/orgs.create.handler-swGnT2ce.mjs +26 -0
- package/dist/orgs.get.handler-ClAqYTH0.mjs +28 -0
- package/dist/orgs.list.handler-D-ptz8It.mjs +41 -0
- package/dist/{paused.handler-BMFm9Cff.mjs → paused.handler-B3aVqw-m.mjs} +2 -2
- package/dist/{project-config-D1qsQlO7.mjs → project-config-opj6DsPF.mjs} +2 -2
- package/dist/{projects-CHkRE9rS.mjs → projects-Bdl6-Z8l.mjs} +2 -2
- package/dist/{projects-Cjb7sovS.mjs → projects-yA9AAaDM.mjs} +5 -5
- package/dist/{register.handler-BPCdor1_.mjs → register.handler-WzpvVXHx.mjs} +1 -1
- package/dist/{requirements.handler-DPXdSks3.mjs → requirements.handler-coArDE8x.mjs} +7 -7
- package/dist/{resolve-project-DDJ29sCF.mjs → resolve-project-DgfftdPm.mjs} +2 -2
- package/dist/{runs-D9hNLb9A.mjs → runs-B8mW4PqP.mjs} +3 -3
- package/dist/schedule-BRN4hzQM.mjs +505 -0
- package/dist/schema-_FQrHcIS.mjs +17 -0
- package/dist/schema-kbMHVnhm.mjs +81 -0
- package/dist/schemas-DsvCZfF0.mjs +42 -0
- package/dist/{skills-sync.handler-DIy8GR16.mjs → skills-sync.handler-C2faeat-.mjs} +2 -2
- package/dist/{skills.command-CrjI2dN9.mjs → skills.command-DWxcc3Ui.mjs} +4 -4
- package/dist/source-analysis-BspLa3E5.mjs +75 -0
- package/dist/{source-analysis-Cj-ADyu--BJQcFPCG.mjs → source-analysis-DEEChuND-eixwPnPP.mjs} +5 -5
- package/dist/{src-eHwu-Gfw.mjs → src-J09NGJ6Z.mjs} +42 -6
- package/dist/{switch.handler-D_9213Vf.mjs → switch.handler-C4hgbhcH.mjs} +2 -2
- package/dist/{sync-BL_Mo5st.mjs → sync-CL6zXiiA.mjs} +2 -2
- package/dist/{sync.handler-BUFPdzWz.mjs → sync.handler-D1uF8E8I.mjs} +8 -8
- package/dist/{schemas-CDib1RhE.mjs → task-DsrXI6XH.mjs} +10 -39
- package/dist/{task-target-build-CBeCKbu2.mjs → task-target-build-DTzz4fpG.mjs} +4 -4
- package/dist/task-target-deploy-BPLlP__P.mjs +4 -0
- package/dist/{task-target-deploy-CA6elFpF-BEr4gkol.mjs → task-target-deploy-Bf5i3ox1-BU16VPsE.mjs} +2 -3
- package/dist/task-target-deploy-runner.mjs +15 -14
- package/dist/{test-BHTgR3UA.mjs → test-BsTLXIPB.mjs} +31 -31
- package/dist/{test.handler-BcPQ8b74.mjs → test.handler-D25kziPi.mjs} +1 -1
- package/dist/{trigger-artifacts-DQPbQNqC-B4yeeFBY.mjs → trigger-artifacts-B3OCTX9K-DG-FGGJT.mjs} +5 -5
- package/dist/{trigger-manifest-CY7brZeg.mjs → trigger-manifest-CXD9I7Rb.mjs} +1 -2
- package/dist/{try-deploy.handler-DqybNhXx.mjs → try-deploy.handler-2aX5TmLk.mjs} +11 -11
- package/dist/{upload.handler-DCtiznQp.mjs → upload.handler-CqProKVJ.mjs} +10 -10
- package/dist/users.get.handler-C_d2GWKX.mjs +24 -0
- package/dist/users.list.handler-DXAsO8Yk.mjs +36 -0
- package/dist/users.set-role.handler-Bn_yV4RI.mjs +27 -0
- package/dist/{utils-CywxCDM7.mjs → utils-DlYHjGg9.mjs} +2 -2
- package/dist/{validate.handler-DOcTaJL0.mjs → validate.handler-CGD6GttR.mjs} +5 -5
- package/dist/{workflow-build-DBQaBfnn.mjs → workflow-build-BcaIdRR6.mjs} +22 -45
- package/dist/{workflow-bundler-BPiqVscj-X1PFFAuP.mjs → workflow-bundler-BzHk73PM-Cde7cKiU.mjs} +4 -4
- package/dist/{_manifest-JSRE3H8k.mjs → workflow-manifest-CAW5FlX0.mjs} +7 -131
- package/dist/{workflows-g9z87AJJ.mjs → workflows-S-gbfw8f.mjs} +16 -15
- package/dist/{writer-BG8poUm3-BbXlU2kI.mjs → writer-CtvttJdP-DrJruQgR.mjs} +8 -8
- package/package.json +9 -11
- package/THIRD_PARTY_NOTICES.md +0 -16
- package/dist/api-keys-D2lgguuY.mjs +0 -40
- package/dist/org-xLzBtt2_.mjs +0 -41
- package/dist/schedule-BXx3uXwr.mjs +0 -1142
- package/dist/src-C0X6u_Mw.mjs +0 -1340
- package/dist/task-B2sZMaZu.mjs +0 -8
- package/dist/task-target-deploy-C5X-USeR.mjs +0 -4
- /package/dist/{agent-bundle-package-DWV6B_5q-BtV7Xycc.mjs → agent-bundle-package-DWV6B_5q-FPT0bJaA.mjs} +0 -0
- /package/dist/{browser-qwFrUH82.mjs → browser-gddMccBQ.mjs} +0 -0
- /package/dist/{concurrency-gXn9Rw8x-DNl2YtrS.mjs → concurrency-gXn9Rw8x-BTlfau8D.mjs} +0 -0
- /package/dist/{constants-CPpPdSNg.mjs → constants-DHdiT5hc.mjs} +0 -0
- /package/dist/{credential-env-map-CI8yWHVy.mjs → credential-env-map-C8P7uTD-.mjs} +0 -0
- /package/dist/{diff-utils-NEfcjqxt.mjs → diff-utils-DWNcRA8g.mjs} +0 -0
- /package/dist/{get-intrinsic-zLxwtrLK.mjs → get-intrinsic-ZMBBjBEr.mjs} +0 -0
- /package/dist/{layout-CbMtQ2tm.mjs → layout-B95Tku8F.mjs} +0 -0
- /package/dist/{options-CeaTcFxP.mjs → options-Dn9t3K4a.mjs} +0 -0
- /package/dist/{output-DM4b7KgY.mjs → output-q4KljAhu.mjs} +0 -0
- /package/dist/{oxc-B3KI3rf_-n9d1hKNq.mjs → oxc-B3KI3rf_-BeimiQ2U.mjs} +0 -0
- /package/dist/{read-credential-keys-77a91T8M-KA0Iw0Z1.mjs → read-credential-keys-77a91T8M-CAJLnMRi.mjs} +0 -0
- /package/dist/{rolldown-runtime-twds-ZHy-BWWzu8VG.mjs → rolldown-runtime-twds-ZHy-8uqgIurC.mjs} +0 -0
- /package/dist/{run-polling-CAgFRdK3.mjs → run-polling-CTzhTgyN.mjs} +0 -0
- /package/dist/{schema-17qMfNyI.mjs → schema-Di90TXoX.mjs} +0 -0
- /package/dist/{schema-display-CgmeKigW.mjs → schema-display-D4A1gQEM.mjs} +0 -0
- /package/dist/{skills.handler-Bz8bJKql.mjs → skills.handler-8KCSF7wp.mjs} +0 -0
- /package/dist/{spinner-progress-DMVwgqO9.mjs → spinner-progress-bvKd1jXc.mjs} +0 -0
- /package/dist/{status.handler-BO4nwvWn.mjs → status.handler-D9GBEmao.mjs} +0 -0
- /package/dist/{sync-keystroke-agent-skills-Kx_H7UTd.mjs → sync-keystroke-agent-skills-CY9h25_5.mjs} +0 -0
- /package/dist/{upload-CkU--iDC.mjs → upload-B8fiWveA.mjs} +0 -0
package/AGENTS-blurb.md
CHANGED
|
@@ -23,7 +23,7 @@ Triggers, tasks, and agent conversations are different entry models:
|
|
|
23
23
|
|
|
24
24
|
Keystroke also has one shared unit-of-work primitive: `Operation`.
|
|
25
25
|
|
|
26
|
-
- `Operation`, `Step`, and `Tool` are aliases for the same class from `@
|
|
26
|
+
- `Operation`, `Step`, and `Tool` are aliases for the same class from `@keystrokehq/core`.
|
|
27
27
|
- Use the `Step` name when teaching workflow-side usage.
|
|
28
28
|
- Use the `Tool` name when teaching agent-side usage.
|
|
29
29
|
- Use the `Operation` name when describing shared infrastructure, integrations, or a reusable unit that can be used in both places.
|
package/LICENSE
CHANGED
|
@@ -19,24 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
-
MIT License
|
|
23
|
-
|
|
24
|
-
Copyright (c) Keystroke
|
|
25
|
-
|
|
26
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
28
|
-
in the Software without restriction, including without limitation the rights
|
|
29
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
31
|
-
furnished to do so, subject to the following conditions:
|
|
32
|
-
|
|
33
|
-
The above copyright notice and this permission notice shall be included in all
|
|
34
|
-
copies or substantial portions of the Software.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
-
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ For automation, you can provide credentials through environment variables or roo
|
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
68
|
KEYSTROKE_API_KEY=sk_... keystroke deploy
|
|
69
|
-
keystroke --api-key sk_... --
|
|
69
|
+
keystroke --api-key sk_... --server-url https://api.example.com workflows list
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## Common Commands
|
|
@@ -129,12 +129,20 @@ keystroke test tool <tool-name> --agent <agent-id-or-name> --input-file ./input.
|
|
|
129
129
|
|
|
130
130
|
## Configuration
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
`keystroke auth` works out of the box against the hosted Keystroke service:
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
- Web URL: `https://keystroke.ai`
|
|
135
|
+
- API URL: `https://api.kestroke.ai`
|
|
136
|
+
|
|
137
|
+
Use `WEB_URL` / `SERVER_URL` or the `--web-url` / `--server-url` flags when pointing the CLI at a local, staging, or preview environment.
|
|
138
|
+
|
|
139
|
+
The relevant configuration sources are:
|
|
140
|
+
|
|
141
|
+
- Command-line flags such as `--api-key`, `--server-url`, `--org`, and command-specific options.
|
|
142
|
+
- Environment variables such as `KEYSTROKE_API_KEY`, `SERVER_URL`, `WEB_URL`, and `KEYSTROKE_ORG_ID`.
|
|
143
|
+
- Credentials saved by `keystroke auth`.
|
|
144
|
+
- Built-in hosted URL defaults for web/API endpoints.
|
|
145
|
+
- Project configuration in `keystroke.config.ts`.
|
|
138
146
|
|
|
139
147
|
Use `--debug` on any command to show diagnostic output.
|
|
140
148
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { t as ui } from "./keystroke.mjs";
|
|
4
|
+
import { i as writeJson } from "./output-q4KljAhu.mjs";
|
|
5
|
+
import { i as requireClient } from "./context-Y1f1hGYy.mjs";
|
|
6
|
+
import { n as isIamJsonMode, t as handleIamError } from "./iam-command-utils-CNC8JfZ5.mjs";
|
|
7
|
+
//#region src/commands/invites/accept.handler.ts
|
|
8
|
+
async function handleInvitesAccept(options, ctx) {
|
|
9
|
+
const client = requireClient(ctx);
|
|
10
|
+
try {
|
|
11
|
+
const result = await client.users.invites.accept(options.inviteId);
|
|
12
|
+
if (isIamJsonMode(options, ctx)) {
|
|
13
|
+
writeJson(result);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
ui.success(`Joined organization ${result.membership.organizationId} as ${result.membership.role}`);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
await handleIamError(error, ctx, "Failed to accept invite");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { handleInvitesAccept };
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-q4KljAhu.mjs";
|
|
4
|
+
import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
|
|
5
|
+
import { t as OrgRoleSchema } from "./schema-_FQrHcIS.mjs";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
//#region src/commands/admin/orgs.command.ts
|
|
8
|
+
const AdminOrgsCreateOptionsSchema = JsonOptionSchema.extend({ name: z.string().min(1) });
|
|
9
|
+
const CREATE_OPTIONS_CONFIG = {
|
|
10
|
+
...JSON_OPTION_CONFIG,
|
|
11
|
+
name: {
|
|
12
|
+
flag: "--name <name>",
|
|
13
|
+
description: "Organization name"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const AdminOrgsListOptionsSchema = JsonOptionSchema;
|
|
17
|
+
const AdminOrgsGetOptionsSchema = JsonOptionSchema.extend({ orgId: z.string().min(1) });
|
|
18
|
+
const GET_OPTIONS_CONFIG$1 = {
|
|
19
|
+
...JSON_OPTION_CONFIG,
|
|
20
|
+
orgId: {
|
|
21
|
+
flag: "",
|
|
22
|
+
description: ""
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function createAdminOrgsCommand() {
|
|
26
|
+
return createTypedCommand({
|
|
27
|
+
name: "orgs",
|
|
28
|
+
description: "Manage organizations as a platform admin",
|
|
29
|
+
schema: AdminOrgsListOptionsSchema,
|
|
30
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
31
|
+
loadHandler: async () => (await import("./orgs.list.handler-D-ptz8It.mjs")).handleAdminOrgsList,
|
|
32
|
+
subcommands: [
|
|
33
|
+
createTypedCommand({
|
|
34
|
+
name: "create",
|
|
35
|
+
description: "Create an organization (requires system.create_org)",
|
|
36
|
+
schema: AdminOrgsCreateOptionsSchema,
|
|
37
|
+
optionsConfig: CREATE_OPTIONS_CONFIG,
|
|
38
|
+
loadHandler: async () => (await import("./orgs.create.handler-swGnT2ce.mjs")).handleAdminOrgsCreate
|
|
39
|
+
}),
|
|
40
|
+
createTypedCommand({
|
|
41
|
+
name: "list",
|
|
42
|
+
description: "List organizations (requires system.view_orgs)",
|
|
43
|
+
schema: AdminOrgsListOptionsSchema,
|
|
44
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
45
|
+
loadHandler: async () => (await import("./orgs.list.handler-D-ptz8It.mjs")).handleAdminOrgsList
|
|
46
|
+
}),
|
|
47
|
+
createTypedCommand({
|
|
48
|
+
name: "get",
|
|
49
|
+
description: "Get organization details (requires system.view_orgs)",
|
|
50
|
+
schema: AdminOrgsGetOptionsSchema,
|
|
51
|
+
optionsConfig: GET_OPTIONS_CONFIG$1,
|
|
52
|
+
argument: {
|
|
53
|
+
name: "org-id",
|
|
54
|
+
description: "Organization ID",
|
|
55
|
+
key: "orgId"
|
|
56
|
+
},
|
|
57
|
+
loadHandler: async () => (await import("./orgs.get.handler-ClAqYTH0.mjs")).handleAdminOrgsGet
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const OrgActionSchema = z.enum([
|
|
63
|
+
"org.manage",
|
|
64
|
+
"org.manage_members",
|
|
65
|
+
"org.manage_billing",
|
|
66
|
+
"org.view_billing",
|
|
67
|
+
"org.create_project",
|
|
68
|
+
"org.create_user_group",
|
|
69
|
+
"org.manage_api_keys",
|
|
70
|
+
"user_group.edit",
|
|
71
|
+
"user_group.delete",
|
|
72
|
+
"user_group.manage_members"
|
|
73
|
+
]);
|
|
74
|
+
const ResourceTypeSchema = z.enum([
|
|
75
|
+
"workflow",
|
|
76
|
+
"agent",
|
|
77
|
+
"trigger",
|
|
78
|
+
"credential_set",
|
|
79
|
+
"project"
|
|
80
|
+
]);
|
|
81
|
+
z.enum([
|
|
82
|
+
"user",
|
|
83
|
+
"user_group",
|
|
84
|
+
"public"
|
|
85
|
+
]);
|
|
86
|
+
const GrantPermissionSchema = z.enum([
|
|
87
|
+
"view",
|
|
88
|
+
"execute",
|
|
89
|
+
"edit",
|
|
90
|
+
"admin"
|
|
91
|
+
]);
|
|
92
|
+
const UserRoleSchema = z.enum(["user", "admin"]);
|
|
93
|
+
const UserBaseSchema = z.object({
|
|
94
|
+
email: z.email(),
|
|
95
|
+
name: z.string().min(2).max(255),
|
|
96
|
+
role: UserRoleSchema.default("user")
|
|
97
|
+
});
|
|
98
|
+
UserBaseSchema.extend({
|
|
99
|
+
id: z.uuid(),
|
|
100
|
+
createdAt: z.date()
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Direct resource grant the signed-in user has on a specific resource. Used
|
|
104
|
+
* by `GET /api/v1/users/me` to surface per-resource access alongside roles.
|
|
105
|
+
*/
|
|
106
|
+
const UserResourceGrantSchema = z.object({
|
|
107
|
+
resourceType: ResourceTypeSchema,
|
|
108
|
+
resourceId: z.string(),
|
|
109
|
+
permission: GrantPermissionSchema,
|
|
110
|
+
organizationId: z.uuid()
|
|
111
|
+
});
|
|
112
|
+
UserBaseSchema.extend({
|
|
113
|
+
id: z.uuid(),
|
|
114
|
+
createdAt: z.iso.datetime(),
|
|
115
|
+
organizations: z.array(z.object({
|
|
116
|
+
id: z.string(),
|
|
117
|
+
name: z.string(),
|
|
118
|
+
role: OrgRoleSchema,
|
|
119
|
+
actionGrants: z.array(OrgActionSchema).optional()
|
|
120
|
+
})),
|
|
121
|
+
resourceGrants: z.array(UserResourceGrantSchema).optional()
|
|
122
|
+
});
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/commands/admin/users.command.ts
|
|
125
|
+
const AdminUsersListOptionsSchema = JsonOptionSchema;
|
|
126
|
+
const AdminUsersGetOptionsSchema = JsonOptionSchema.extend({ userId: z.string().min(1) });
|
|
127
|
+
const GET_OPTIONS_CONFIG = {
|
|
128
|
+
...JSON_OPTION_CONFIG,
|
|
129
|
+
userId: {
|
|
130
|
+
flag: "",
|
|
131
|
+
description: ""
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const AdminUsersSetRoleOptionsSchema = JsonOptionSchema.extend({
|
|
135
|
+
userId: z.string().min(1),
|
|
136
|
+
role: UserRoleSchema,
|
|
137
|
+
confirm: z.boolean().optional()
|
|
138
|
+
});
|
|
139
|
+
const SET_ROLE_OPTIONS_CONFIG = {
|
|
140
|
+
...JSON_OPTION_CONFIG,
|
|
141
|
+
userId: {
|
|
142
|
+
flag: "",
|
|
143
|
+
description: ""
|
|
144
|
+
},
|
|
145
|
+
role: {
|
|
146
|
+
flag: "--role <role>",
|
|
147
|
+
description: "System role: user or admin"
|
|
148
|
+
},
|
|
149
|
+
confirm: {
|
|
150
|
+
flag: "--confirm",
|
|
151
|
+
description: "Confirm system-role change"
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
function createAdminUsersCommand() {
|
|
155
|
+
return createTypedCommand({
|
|
156
|
+
name: "users",
|
|
157
|
+
description: "Manage platform users",
|
|
158
|
+
schema: AdminUsersListOptionsSchema,
|
|
159
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
160
|
+
loadHandler: async () => (await import("./users.list.handler-DXAsO8Yk.mjs")).handleAdminUsersList,
|
|
161
|
+
subcommands: [
|
|
162
|
+
createTypedCommand({
|
|
163
|
+
name: "list",
|
|
164
|
+
description: "List platform users",
|
|
165
|
+
schema: AdminUsersListOptionsSchema,
|
|
166
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
167
|
+
loadHandler: async () => (await import("./users.list.handler-DXAsO8Yk.mjs")).handleAdminUsersList
|
|
168
|
+
}),
|
|
169
|
+
createTypedCommand({
|
|
170
|
+
name: "get",
|
|
171
|
+
description: "Get platform user details",
|
|
172
|
+
schema: AdminUsersGetOptionsSchema,
|
|
173
|
+
optionsConfig: GET_OPTIONS_CONFIG,
|
|
174
|
+
argument: {
|
|
175
|
+
name: "user-id",
|
|
176
|
+
description: "User ID",
|
|
177
|
+
key: "userId"
|
|
178
|
+
},
|
|
179
|
+
loadHandler: async () => (await import("./users.get.handler-C_d2GWKX.mjs")).handleAdminUsersGet
|
|
180
|
+
}),
|
|
181
|
+
createTypedCommand({
|
|
182
|
+
name: "set-role",
|
|
183
|
+
description: "Set a platform system role",
|
|
184
|
+
schema: AdminUsersSetRoleOptionsSchema,
|
|
185
|
+
optionsConfig: SET_ROLE_OPTIONS_CONFIG,
|
|
186
|
+
argument: {
|
|
187
|
+
name: "user-id",
|
|
188
|
+
description: "User ID",
|
|
189
|
+
key: "userId"
|
|
190
|
+
},
|
|
191
|
+
loadHandler: async () => (await import("./users.set-role.handler-Bn_yV4RI.mjs")).handleAdminUsersSetRole
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/commands/admin/admin.command.ts
|
|
198
|
+
function createAdminCommand() {
|
|
199
|
+
return createTypedCommand({
|
|
200
|
+
name: "admin",
|
|
201
|
+
description: "Platform administration commands",
|
|
202
|
+
schema: z.object({}),
|
|
203
|
+
optionsConfig: {},
|
|
204
|
+
subcommands: [createAdminOrgsCommand(), createAdminUsersCommand()]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { createAdminCommand };
|
|
@@ -101,9 +101,9 @@ const AgentRuntimeSchema = z.object({
|
|
|
101
101
|
placement: AgentRuntimePlacementSchema
|
|
102
102
|
});
|
|
103
103
|
/**
|
|
104
|
-
* Mirrors `SandboxFileSourceSchema` from `@
|
|
105
|
-
* package stays free of a runtime dependency on
|
|
106
|
-
* with `packages/
|
|
104
|
+
* Mirrors `SandboxFileSourceSchema` from `@keystrokehq/core` so this
|
|
105
|
+
* package stays free of a runtime dependency on core. Keep in sync
|
|
106
|
+
* with `packages/core/src/sandbox/schemas.ts`.
|
|
107
107
|
*/
|
|
108
108
|
const AgentSandboxFileSourceSchema = z.discriminatedUnion("type", [z.object({
|
|
109
109
|
type: z.literal("git"),
|
|
@@ -119,7 +119,7 @@ const AgentSandboxFileSourceSchema = z.discriminatedUnion("type", [z.object({
|
|
|
119
119
|
target: z.string().optional()
|
|
120
120
|
})]);
|
|
121
121
|
/**
|
|
122
|
-
* `workdir` here mirrors the
|
|
122
|
+
* `workdir` here mirrors the core constraint: must be `/workspace`
|
|
123
123
|
* or a subdirectory so it lands inside the persistent bind mount.
|
|
124
124
|
*/
|
|
125
125
|
const AgentSandboxWorkdirSchema = z.string().trim().min(1).refine((value) => value === "/workspace" || value.startsWith("/workspace/"), { error: "workdir must be \"/workspace\" or a subdirectory of \"/workspace\"" });
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { D as throwReportedCliExit, h as toErrorMessage, o as ANSI, s as style, t as ui } from "./keystroke.mjs";
|
|
4
|
-
import { d as trackProject } from "./dist-
|
|
5
|
-
import { i as writeJson, n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-
|
|
6
|
-
import { t as createTypedCommand } from "./commander-
|
|
7
|
-
import { i as readAgentManifestsFromOutDir } from "./dist-
|
|
8
|
-
import { t as requireWorkflowsDir } from "./resolve-project-
|
|
9
|
-
import { t as createSpinnerProgress } from "./spinner-progress-
|
|
10
|
-
import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-
|
|
11
|
-
import { i as resolveTypeHint } from "./schema-display-
|
|
4
|
+
import { d as trackProject } from "./dist-BF6r1hfv.mjs";
|
|
5
|
+
import { i as writeJson, n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-q4KljAhu.mjs";
|
|
6
|
+
import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
|
|
7
|
+
import { i as readAgentManifestsFromOutDir } from "./dist-C2Dq_nx3.mjs";
|
|
8
|
+
import { t as requireWorkflowsDir } from "./resolve-project-DgfftdPm.mjs";
|
|
9
|
+
import { t as createSpinnerProgress } from "./spinner-progress-bvKd1jXc.mjs";
|
|
10
|
+
import { a as runWorkflowBuild, n as renderBuildFailure } from "./workflow-build-BcaIdRR6.mjs";
|
|
11
|
+
import { i as resolveTypeHint } from "./schema-display-D4A1gQEM.mjs";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
//#region src/commands/agents/inspect-display.ts
|
|
14
14
|
function renderAgentManifestInspect(manifest, options = {}) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { n as JsonOptionSchema, t as JSON_OPTION_CONFIG } from "./output-q4KljAhu.mjs";
|
|
4
|
+
import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/commands/api-keys/api-keys.command.ts
|
|
7
|
+
const ApiKeysCreateOptionsSchema = JsonOptionSchema.extend({ name: z.string().optional() });
|
|
8
|
+
const CREATE_OPTIONS_CONFIG = {
|
|
9
|
+
...JSON_OPTION_CONFIG,
|
|
10
|
+
name: {
|
|
11
|
+
flag: "--name <name>",
|
|
12
|
+
description: "Optional API key name"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const ApiKeysDeleteOptionsSchema = z.object({ apiKeyId: z.string() });
|
|
16
|
+
const DELETE_OPTIONS_CONFIG = { apiKeyId: {
|
|
17
|
+
flag: "",
|
|
18
|
+
description: ""
|
|
19
|
+
} };
|
|
20
|
+
function createApiKeysCommand() {
|
|
21
|
+
return createTypedCommand({
|
|
22
|
+
name: "api-keys",
|
|
23
|
+
description: "Manage API keys for your organization",
|
|
24
|
+
schema: JsonOptionSchema,
|
|
25
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
26
|
+
loadHandler: async () => (await import("./list.handler-20v4uRMk.mjs")).handleApiKeysList,
|
|
27
|
+
subcommands: [
|
|
28
|
+
createTypedCommand({
|
|
29
|
+
name: "list",
|
|
30
|
+
description: "List all API keys for your organization",
|
|
31
|
+
schema: JsonOptionSchema,
|
|
32
|
+
optionsConfig: { ...JSON_OPTION_CONFIG },
|
|
33
|
+
loadHandler: async () => (await import("./list.handler-20v4uRMk.mjs")).handleApiKeysList
|
|
34
|
+
}),
|
|
35
|
+
createTypedCommand({
|
|
36
|
+
name: "create",
|
|
37
|
+
description: "Create a new API key (raw key shown once)",
|
|
38
|
+
schema: ApiKeysCreateOptionsSchema,
|
|
39
|
+
optionsConfig: CREATE_OPTIONS_CONFIG,
|
|
40
|
+
loadHandler: async () => (await import("./create.handler-uNG3I4wS.mjs")).handleApiKeysCreate
|
|
41
|
+
}),
|
|
42
|
+
createTypedCommand({
|
|
43
|
+
name: "delete",
|
|
44
|
+
description: "Delete an API key by ID",
|
|
45
|
+
schema: ApiKeysDeleteOptionsSchema,
|
|
46
|
+
optionsConfig: DELETE_OPTIONS_CONFIG,
|
|
47
|
+
argument: {
|
|
48
|
+
name: "api-key-id",
|
|
49
|
+
description: "API key ID to delete",
|
|
50
|
+
key: "apiKeyId"
|
|
51
|
+
},
|
|
52
|
+
loadHandler: async () => (await import("./delete.handler-CJTHVZaz.mjs")).handleApiKeysDelete
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { createApiKeysCommand };
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { n as DEFAULT_CLI_WEB_URL } from "./default-urls-BS4twrsS.mjs";
|
|
3
4
|
import { g as AUTH_TIMEOUT_SECONDS } from "./keystroke.mjs";
|
|
4
|
-
import { t as createTypedCommand } from "./commander-
|
|
5
|
+
import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
//#region src/commands/auth/auth.command.ts
|
|
7
8
|
const AuthOptionsSchema = z.object({
|
|
8
9
|
webUrl: z.url().optional().describe("Keystroke web URL"),
|
|
9
|
-
serverUrl: z.url().optional().describe("Keystroke API URL"),
|
|
10
10
|
timeout: z.coerce.number().int().min(AUTH_TIMEOUT_SECONDS.min).max(AUTH_TIMEOUT_SECONDS.max).default(AUTH_TIMEOUT_SECONDS.default).describe("Timeout in seconds")
|
|
11
11
|
});
|
|
12
12
|
const AUTH_OPTIONS_CONFIG = {
|
|
13
13
|
webUrl: {
|
|
14
14
|
flag: "--web-url <url>",
|
|
15
|
-
description:
|
|
16
|
-
},
|
|
17
|
-
serverUrl: {
|
|
18
|
-
flag: "--server-url <url>",
|
|
19
|
-
description: "Keystroke API URL (default: SERVER_URL env)"
|
|
15
|
+
description: `Keystroke web URL (default: saved credentials, WEB_URL env, or ${DEFAULT_CLI_WEB_URL})`
|
|
20
16
|
},
|
|
21
17
|
timeout: {
|
|
22
18
|
flag: "--timeout <seconds>",
|
|
@@ -29,28 +25,28 @@ function createAuthCommand() {
|
|
|
29
25
|
description: "Authenticate Keystroke CLI via device flow",
|
|
30
26
|
schema: AuthOptionsSchema,
|
|
31
27
|
optionsConfig: AUTH_OPTIONS_CONFIG,
|
|
32
|
-
loadHandler: async () => (await import("./auth.handler-
|
|
28
|
+
loadHandler: async () => (await import("./auth.handler-CbhiLOG1.mjs")).handleAuth,
|
|
33
29
|
subcommands: [
|
|
34
30
|
createTypedCommand({
|
|
35
31
|
name: "clear",
|
|
36
32
|
description: "Revoke the saved API key and remove local credentials",
|
|
37
33
|
schema: z.object({}),
|
|
38
34
|
optionsConfig: {},
|
|
39
|
-
loadHandler: async () => (await import("./clear.handler-
|
|
35
|
+
loadHandler: async () => (await import("./clear.handler-YS8gPriq.mjs")).handleAuthClear
|
|
40
36
|
}),
|
|
41
37
|
createTypedCommand({
|
|
42
38
|
name: "test",
|
|
43
39
|
description: "Verify that the saved API key is valid",
|
|
44
40
|
schema: z.object({}),
|
|
45
41
|
optionsConfig: {},
|
|
46
|
-
loadHandler: async () => (await import("./test.handler-
|
|
42
|
+
loadHandler: async () => (await import("./test.handler-D25kziPi.mjs")).handleAuthTest
|
|
47
43
|
}),
|
|
48
44
|
createTypedCommand({
|
|
49
45
|
name: "status",
|
|
50
46
|
description: "Show the current signed-in identity and organization context",
|
|
51
47
|
schema: z.object({}),
|
|
52
48
|
optionsConfig: {},
|
|
53
|
-
loadHandler: async () => (await import("./status.handler-
|
|
49
|
+
loadHandler: async () => (await import("./status.handler-D9GBEmao.mjs")).handleAuthStatus
|
|
54
50
|
})
|
|
55
51
|
]
|
|
56
52
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { n as DEFAULT_CLI_WEB_URL, t as DEFAULT_CLI_SERVER_URL } from "./default-urls-BS4twrsS.mjs";
|
|
4
|
+
import { C as CliExitError, _ as AUTH_URL_PATH, b as CALLBACK_PATH, h as toErrorMessage, i as logger, t as ui, v as CALLBACK_LOOPBACK_HOST, x as CLI_AUTH_COMMAND, y as CALLBACK_LOOPBACK_ORIGIN } from "./keystroke.mjs";
|
|
5
|
+
import { f as upsertOrgCredentials, i as getCredentialsFilePath } from "./dist-BF6r1hfv.mjs";
|
|
6
|
+
import { a as resolveCliWebUrl, i as resolveCliServerUrl } from "./env-YTZGKGIu.mjs";
|
|
7
|
+
import { t as openBrowser } from "./browser-gddMccBQ.mjs";
|
|
7
8
|
import { hostname } from "node:os";
|
|
8
9
|
import { z } from "zod";
|
|
10
|
+
import { confirm, isCancel } from "@clack/prompts";
|
|
9
11
|
import { randomBytes } from "node:crypto";
|
|
10
12
|
import { createServer } from "node:http";
|
|
11
13
|
//#region src/commands/auth/device-auth.ts
|
|
@@ -237,6 +239,74 @@ async function createDeviceCallbackListener(expectedState, timeoutMs) {
|
|
|
237
239
|
}
|
|
238
240
|
//#endregion
|
|
239
241
|
//#region src/commands/auth/auth.handler.ts
|
|
242
|
+
const LOOPBACK_HOSTNAMES = new Set([
|
|
243
|
+
"localhost",
|
|
244
|
+
"127.0.0.1",
|
|
245
|
+
"::1"
|
|
246
|
+
]);
|
|
247
|
+
function isLoopbackUrl(rawUrl) {
|
|
248
|
+
try {
|
|
249
|
+
const parsed = new URL(rawUrl);
|
|
250
|
+
const host = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
251
|
+
return LOOPBACK_HOSTNAMES.has(host);
|
|
252
|
+
} catch {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function resolveAuthHosts(options, ctx) {
|
|
257
|
+
const savedWeb = ctx.storedCredentials?.webUrl;
|
|
258
|
+
const savedServer = ctx.storedCredentials?.serverUrl;
|
|
259
|
+
const webUrl = resolveCliWebUrl(options.webUrl, savedWeb);
|
|
260
|
+
const serverUrl = resolveCliServerUrl(ctx.baseUrl);
|
|
261
|
+
return {
|
|
262
|
+
webUrl,
|
|
263
|
+
serverUrl,
|
|
264
|
+
webFromFlag: typeof options.webUrl === "string" && options.webUrl.length > 0,
|
|
265
|
+
webMatchesSaved: savedWeb === webUrl,
|
|
266
|
+
serverMatchesSaved: savedServer === serverUrl
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function shouldConfirmLoopback(hosts) {
|
|
270
|
+
if (isLoopbackUrl("https://keystroke.ai") && isLoopbackUrl("https://api.kestroke.ai")) return false;
|
|
271
|
+
const webNeedsConfirm = !hosts.webFromFlag && isLoopbackUrl(hosts.webUrl);
|
|
272
|
+
const serverNeedsConfirm = isLoopbackUrl(hosts.serverUrl);
|
|
273
|
+
return webNeedsConfirm || serverNeedsConfirm;
|
|
274
|
+
}
|
|
275
|
+
function describeHostSource(matchesSaved, fromFlag = false) {
|
|
276
|
+
if (fromFlag) return "flag";
|
|
277
|
+
if (matchesSaved) return "saved credentials";
|
|
278
|
+
return "env or default";
|
|
279
|
+
}
|
|
280
|
+
function printResolvedHosts(hosts) {
|
|
281
|
+
ui.hint(`Web URL: ${hosts.webUrl} (${describeHostSource(hosts.webMatchesSaved, hosts.webFromFlag)})`);
|
|
282
|
+
ui.hint(`API URL: ${hosts.serverUrl} (${describeHostSource(hosts.serverMatchesSaved)})`);
|
|
283
|
+
}
|
|
284
|
+
async function confirmLoopbackHostsOrExit(hosts) {
|
|
285
|
+
ui.br();
|
|
286
|
+
ui.warn("About to authenticate against a local development environment");
|
|
287
|
+
if (hosts.webMatchesSaved || hosts.serverMatchesSaved) ui.hint(`Saved at: ${getCredentialsFilePath()} (from a previous keystroke auth run)`);
|
|
288
|
+
else ui.hint("Resolved from your environment (WEB_URL / SERVER_URL).");
|
|
289
|
+
ui.hint(`CLI default is ${DEFAULT_CLI_WEB_URL} / ${DEFAULT_CLI_SERVER_URL}.`);
|
|
290
|
+
ui.hint("To switch hosts:");
|
|
291
|
+
ui.hint(` - Reset and re-auth: ${CLI_AUTH_COMMAND} clear, then ${CLI_AUTH_COMMAND}`);
|
|
292
|
+
ui.hint(` - Override once: ${CLI_AUTH_COMMAND} --web-url <url> --server-url <url>`);
|
|
293
|
+
ui.br();
|
|
294
|
+
if (process.stdin.isTTY !== true) {
|
|
295
|
+
ui.warn("Non-interactive shell detected — continuing with the local URLs.");
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const proceed = await confirm({
|
|
299
|
+
message: "Continue signing in against these local URLs?",
|
|
300
|
+
initialValue: false
|
|
301
|
+
});
|
|
302
|
+
if (isCancel(proceed) || proceed !== true) {
|
|
303
|
+
ui.hint("Cancelled. No credentials were changed.");
|
|
304
|
+
throw new CliExitError("Auth cancelled by user.", {
|
|
305
|
+
exitCode: 0,
|
|
306
|
+
reported: true
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
240
310
|
function getVerificationCode(state) {
|
|
241
311
|
return state.slice(0, 8).toUpperCase();
|
|
242
312
|
}
|
|
@@ -266,17 +336,22 @@ async function warnIfAlreadyAuthenticated(ctx) {
|
|
|
266
336
|
} catch {
|
|
267
337
|
return;
|
|
268
338
|
}
|
|
269
|
-
const
|
|
339
|
+
const stored = ctx.storedCredentials;
|
|
340
|
+
const identity = stored?.user?.email ?? "unknown user";
|
|
341
|
+
const activeOrg = stored?.orgs.find((o) => o.organizationId === stored?.activeOrgId);
|
|
270
342
|
ui.br();
|
|
271
343
|
ui.warn("Already authenticated");
|
|
272
|
-
ui.hint(`Signed in as ${identity}`);
|
|
344
|
+
ui.hint(`Signed in as ${identity}${activeOrg ? ` (${activeOrg.organizationName})` : ""}`);
|
|
345
|
+
if (stored?.webUrl || stored?.serverUrl) ui.hint(`Saved hosts: web ${stored.webUrl ?? "(none)"} | api ${stored.serverUrl ?? "(none)"}`);
|
|
273
346
|
ui.hint("Continuing will add or replace credentials for the selected organization.");
|
|
274
347
|
ui.br();
|
|
275
348
|
}
|
|
276
349
|
async function handleAuth(options, ctx, overrides) {
|
|
277
350
|
await warnIfAlreadyAuthenticated(ctx);
|
|
278
|
-
const
|
|
279
|
-
|
|
351
|
+
const hosts = resolveAuthHosts(options, ctx);
|
|
352
|
+
printResolvedHosts(hosts);
|
|
353
|
+
if (shouldConfirmLoopback(hosts)) await confirmLoopbackHostsOrExit(hosts);
|
|
354
|
+
const { webUrl, serverUrl } = hosts;
|
|
280
355
|
const timeoutMs = options.timeout * 1e3;
|
|
281
356
|
const state = createDeviceAuthState();
|
|
282
357
|
logger.info("Starting auth flow", {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as readOptionalJsonSchemaKeys, t as manifestToDeclaredCredentialRequirement } from "./
|
|
4
|
-
import { t as AgentVersionManifestSchema } from "./agent-manifest-
|
|
5
|
-
import { i as createAgentSandboxPackage, n as AGENT_VM_PI_SKILLS_ROOT, r as AGENT_VM_TOOLS_RUNTIME_RELATIVE_PATH, t as AGENT_VM_HOST_CALL_RELATIVE_PATH } from "./agent-bundle-package-DWV6B_5q-
|
|
6
|
-
import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-
|
|
7
|
-
import { t as bundleSandboxAgentTarget } from "./workflow-bundler-
|
|
3
|
+
import { n as readOptionalJsonSchemaKeys, t as manifestToDeclaredCredentialRequirement } from "./declared-credential-requirements-Bwlb-KZE.mjs";
|
|
4
|
+
import { t as AgentVersionManifestSchema } from "./agent-manifest-Bfa3DBgc.mjs";
|
|
5
|
+
import { i as createAgentSandboxPackage, n as AGENT_VM_PI_SKILLS_ROOT, r as AGENT_VM_TOOLS_RUNTIME_RELATIVE_PATH, t as AGENT_VM_HOST_CALL_RELATIVE_PATH } from "./agent-bundle-package-DWV6B_5q-FPT0bJaA.mjs";
|
|
6
|
+
import { t as readCredentialKeysFromSchemaObject } from "./read-credential-keys-77a91T8M-CAJLnMRi.mjs";
|
|
7
|
+
import { t as bundleSandboxAgentTarget } from "./workflow-bundler-BzHk73PM-Cde7cKiU.mjs";
|
|
8
8
|
import { builtinModules } from "node:module";
|
|
9
9
|
import { lstat, readFile, readdir, realpath } from "node:fs/promises";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import * as crypto from "node:crypto";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { performance } from "node:perf_hooks";
|
|
14
|
-
//#region ../../packages/
|
|
14
|
+
//#region ../../packages/core/src/sandbox/host-call-stub-source.ts
|
|
15
15
|
const HOST_CALL_STUB_SOURCE = [
|
|
16
16
|
"const __pendingHostCalls = new Map();",
|
|
17
17
|
"let __hostCallCounter = 0;",
|
|
@@ -166,7 +166,7 @@ const HOST_CALL_STUB_SOURCE = [
|
|
|
166
166
|
"}"
|
|
167
167
|
].join("\n");
|
|
168
168
|
//#endregion
|
|
169
|
-
//#region ../../packages/workflow-builder/dist/build-agents-
|
|
169
|
+
//#region ../../packages/workflow-builder/dist/build-agents-DfbiMZ_e.mjs
|
|
170
170
|
const STAGED_LOCAL_SOURCES_PREFIX = ".keystroke/staged-local-sources";
|
|
171
171
|
function normalizeRelativeSandboxPath(targetPath) {
|
|
172
172
|
const normalized = path.posix.normalize(targetPath);
|