@keystrokehq/cli 0.0.1 → 0.0.2
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-Byry35LJ.mjs} +7 -11
- package/dist/{auth.handler-CT1BQUvu.mjs → auth.handler-BBPObKwk.mjs} +5 -5
- 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
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
//#region ../../packages/core/src/operation/integration-metadata-registry.ts
|
|
4
|
+
const REGISTRY_KEY$1 = "__ks_official_integration_metadata_registry";
|
|
5
|
+
function getRegistry() {
|
|
6
|
+
const g = globalThis;
|
|
7
|
+
if (!g[REGISTRY_KEY$1]) g[REGISTRY_KEY$1] = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
return g[REGISTRY_KEY$1];
|
|
9
|
+
}
|
|
10
|
+
/** Register by instance identity. Parameters use `object` so consumers are not blocked when `.d.ts` bundles duplicate `Operation` (e.g. `_runtime` vs `./operation`). */
|
|
11
|
+
function registerOfficialIntegrationOperation(operation, metadata) {
|
|
12
|
+
getRegistry().set(operation, Object.freeze({ ...metadata }));
|
|
13
|
+
}
|
|
14
|
+
function getOfficialIntegrationMetadata(operation) {
|
|
15
|
+
return getRegistry().get(operation);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../../packages/core/src/internal/execution-scope.ts
|
|
19
|
+
const SCOPE_STACK_KEY = "__ks_execution_scope_stack__";
|
|
20
|
+
function getScopeStack() {
|
|
21
|
+
const g = globalThis;
|
|
22
|
+
if (!g[SCOPE_STACK_KEY]) g[SCOPE_STACK_KEY] = [];
|
|
23
|
+
return g[SCOPE_STACK_KEY];
|
|
24
|
+
}
|
|
25
|
+
function getCurrentScope() {
|
|
26
|
+
const stack = getScopeStack();
|
|
27
|
+
return stack[stack.length - 1] ?? getDefaultScope();
|
|
28
|
+
}
|
|
29
|
+
const DEFAULT_SCOPE_KEY = "__ks_execution_scope_default__";
|
|
30
|
+
function getDefaultScope() {
|
|
31
|
+
const g = globalThis;
|
|
32
|
+
if (!g[DEFAULT_SCOPE_KEY]) g[DEFAULT_SCOPE_KEY] = { stepContextProviders: [] };
|
|
33
|
+
return g[DEFAULT_SCOPE_KEY];
|
|
34
|
+
}
|
|
35
|
+
function getExecutionScopeWorkflowRuntime() {
|
|
36
|
+
return getCurrentScope().workflowRuntimeProvider?.();
|
|
37
|
+
}
|
|
38
|
+
function setExecutionScopeWorkflowRuntime(provider) {
|
|
39
|
+
const scope = getCurrentScope();
|
|
40
|
+
scope.workflowRuntimeProvider = provider;
|
|
41
|
+
}
|
|
42
|
+
function pushExecutionScopeStepContext(provider) {
|
|
43
|
+
const scope = getCurrentScope();
|
|
44
|
+
scope.stepContextProviders = [...scope.stepContextProviders, provider];
|
|
45
|
+
}
|
|
46
|
+
function clearExecutionScopeStepContexts() {
|
|
47
|
+
const scope = getCurrentScope();
|
|
48
|
+
scope.stepContextProviders = [];
|
|
49
|
+
}
|
|
50
|
+
function getExecutionScopeStepContextProvider() {
|
|
51
|
+
return getCurrentScope().stepContextProviders.at(-1);
|
|
52
|
+
}
|
|
53
|
+
function setExecutionScopeStepCredentialResolver(resolver) {
|
|
54
|
+
const scope = getCurrentScope();
|
|
55
|
+
scope.stepCredentialResolver = resolver;
|
|
56
|
+
}
|
|
57
|
+
function getExecutionScopeStepCredentialResolver() {
|
|
58
|
+
return getCurrentScope().stepCredentialResolver;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region ../../packages/core/src/workflow/context-registry.ts
|
|
62
|
+
function registerRuntime(registry) {
|
|
63
|
+
setExecutionScopeWorkflowRuntime(registry.getRuntime);
|
|
64
|
+
}
|
|
65
|
+
function clearRuntime() {
|
|
66
|
+
setExecutionScopeWorkflowRuntime(void 0);
|
|
67
|
+
}
|
|
68
|
+
function getRegisteredRuntime() {
|
|
69
|
+
return getExecutionScopeWorkflowRuntime();
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region ../../packages/core/src/operation/context-registry.ts
|
|
73
|
+
function getCurrentRegistry() {
|
|
74
|
+
const provider = getExecutionScopeStepContextProvider();
|
|
75
|
+
if (!provider) return;
|
|
76
|
+
return { getOperationContext: provider };
|
|
77
|
+
}
|
|
78
|
+
function registerOperationContext(registry) {
|
|
79
|
+
pushExecutionScopeStepContext(registry.getOperationContext);
|
|
80
|
+
}
|
|
81
|
+
function clearOperationContext() {
|
|
82
|
+
clearExecutionScopeStepContexts();
|
|
83
|
+
}
|
|
84
|
+
function getRegisteredOperationContext(operation) {
|
|
85
|
+
return getCurrentRegistry()?.getOperationContext(operation);
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../../packages/core/src/operation/credential-resolver-registry.ts
|
|
89
|
+
function registerOperationCredentialResolver(resolver) {
|
|
90
|
+
setExecutionScopeStepCredentialResolver(resolver.resolveOperationCredentials);
|
|
91
|
+
}
|
|
92
|
+
function clearOperationCredentialResolver() {
|
|
93
|
+
setExecutionScopeStepCredentialResolver(void 0);
|
|
94
|
+
}
|
|
95
|
+
function getRegisteredOperationCredentialResolver() {
|
|
96
|
+
const resolveOperationCredentials = getExecutionScopeStepCredentialResolver();
|
|
97
|
+
if (!resolveOperationCredentials) return;
|
|
98
|
+
return { resolveOperationCredentials };
|
|
99
|
+
}
|
|
100
|
+
async function resolveRegisteredOperationCredentials(operation, partialContext) {
|
|
101
|
+
return getRegisteredOperationCredentialResolver()?.resolveOperationCredentials(operation, partialContext);
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region ../../packages/core/src/operation/hosted-action-dispatcher-registry.ts
|
|
105
|
+
const REGISTRY_KEY = "__ks_hosted_action_dispatcher";
|
|
106
|
+
const EXECUTION_POLICY_KEY = "__ks_hosted_action_execution_policy";
|
|
107
|
+
function registerHostedActionDispatcher(dispatcher) {
|
|
108
|
+
globalThis[REGISTRY_KEY] = dispatcher;
|
|
109
|
+
}
|
|
110
|
+
function clearHostedActionDispatcher() {
|
|
111
|
+
globalThis[REGISTRY_KEY] = void 0;
|
|
112
|
+
}
|
|
113
|
+
function getRegisteredHostedActionDispatcher() {
|
|
114
|
+
return globalThis[REGISTRY_KEY];
|
|
115
|
+
}
|
|
116
|
+
function registerHostedActionExecutionPolicy(policy) {
|
|
117
|
+
globalThis[EXECUTION_POLICY_KEY] = policy;
|
|
118
|
+
}
|
|
119
|
+
function clearHostedActionExecutionPolicy() {
|
|
120
|
+
globalThis[EXECUTION_POLICY_KEY] = void 0;
|
|
121
|
+
}
|
|
122
|
+
function getHostedActionExecutionPolicy() {
|
|
123
|
+
return globalThis[EXECUTION_POLICY_KEY] ?? "permissive";
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { registerOfficialIntegrationOperation as _, registerHostedActionDispatcher as a, registerOperationCredentialResolver as c, getRegisteredOperationContext as d, registerOperationContext as f, getOfficialIntegrationMetadata as g, registerRuntime as h, getRegisteredHostedActionDispatcher as i, resolveRegisteredOperationCredentials as l, getRegisteredRuntime as m, clearHostedActionExecutionPolicy as n, registerHostedActionExecutionPolicy as o, clearRuntime as p, getHostedActionExecutionPolicy as r, clearOperationCredentialResolver as s, clearHostedActionDispatcher as t, clearOperationContext as u };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { D as throwReportedCliExit, f as getHttpStatus, h as toErrorMessage, t as ui } from "./keystroke.mjs";
|
|
4
|
+
import { a as writeJsonError } from "./output-q4KljAhu.mjs";
|
|
5
|
+
//#region src/lib/iam-command-utils.ts
|
|
6
|
+
function requireOrganizationId(ctx) {
|
|
7
|
+
if (ctx.organizationId) return ctx.organizationId;
|
|
8
|
+
const message = "Organization context is required. Pass --org or run `keystroke org switch`.";
|
|
9
|
+
if (ctx.jsonMode) writeJsonError(message, {
|
|
10
|
+
code: "ORG_REQUIRED",
|
|
11
|
+
hint: "Pass --org <organization-id> or run `keystroke org switch`."
|
|
12
|
+
});
|
|
13
|
+
ui.error(message);
|
|
14
|
+
throwReportedCliExit(message);
|
|
15
|
+
}
|
|
16
|
+
function isIamJsonMode(options, ctx) {
|
|
17
|
+
return options.json === true || ctx.jsonMode;
|
|
18
|
+
}
|
|
19
|
+
function requireConfirmation({ confirmed, message, ctx }) {
|
|
20
|
+
if (confirmed === true) return;
|
|
21
|
+
const fullMessage = `${message} Re-run with --confirm to proceed.`;
|
|
22
|
+
if (ctx.jsonMode) writeJsonError(fullMessage, {
|
|
23
|
+
code: "CONFIRMATION_REQUIRED",
|
|
24
|
+
hint: "Pass --confirm to confirm this mutation."
|
|
25
|
+
});
|
|
26
|
+
ui.error(fullMessage);
|
|
27
|
+
throwReportedCliExit(fullMessage);
|
|
28
|
+
}
|
|
29
|
+
async function handleIamError(error, ctx, fallback) {
|
|
30
|
+
const status = getHttpStatus(error);
|
|
31
|
+
const apiBody = await readApiErrorBody(error);
|
|
32
|
+
const code = apiBody?.code ?? apiBody?.errorCode;
|
|
33
|
+
let message = fallback;
|
|
34
|
+
let hint;
|
|
35
|
+
let errorCode;
|
|
36
|
+
if (status === 403 && fallback === "Failed to create organization") {
|
|
37
|
+
message = `${fallback}: system.create_org is required.`;
|
|
38
|
+
hint = "Use credentials owned by a Keystroke platform admin.";
|
|
39
|
+
errorCode = "SYSTEM_PERMISSION_REQUIRED";
|
|
40
|
+
} else if (status === 403) {
|
|
41
|
+
message = `${fallback}: org.manage_members permission is required.`;
|
|
42
|
+
hint = "Use credentials for an organization owner/admin, or a user with an action grant.";
|
|
43
|
+
errorCode = "ORG_PERMISSION_REQUIRED";
|
|
44
|
+
} else if (status === 409 && code === "LAST_OWNER") {
|
|
45
|
+
message = `${fallback}: another owner must be added before this operation can proceed.`;
|
|
46
|
+
hint = "Add or promote another owner first.";
|
|
47
|
+
errorCode = "LAST_OWNER";
|
|
48
|
+
} else {
|
|
49
|
+
message = `${fallback}: ${apiBody?.message ?? apiBody?.error ?? toErrorMessage(error)}`;
|
|
50
|
+
errorCode = code ?? (status ? `HTTP_${status}` : void 0);
|
|
51
|
+
}
|
|
52
|
+
if (ctx.jsonMode) writeJsonError(message, {
|
|
53
|
+
code: errorCode,
|
|
54
|
+
hint,
|
|
55
|
+
cause: error
|
|
56
|
+
});
|
|
57
|
+
ui.error(message);
|
|
58
|
+
if (hint) ui.hint(hint);
|
|
59
|
+
throwReportedCliExit(message, { cause: error });
|
|
60
|
+
}
|
|
61
|
+
async function readApiErrorBody(error) {
|
|
62
|
+
if (!error || typeof error !== "object" || !("response" in error)) return null;
|
|
63
|
+
const response = error.response;
|
|
64
|
+
if (typeof response?.clone !== "function") return null;
|
|
65
|
+
try {
|
|
66
|
+
return await response.clone().json();
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { requireOrganizationId as i, isIamJsonMode as n, requireConfirmation as r, handleIamError as t };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { n as findProjectRoot } from "./project-config-
|
|
4
|
-
import { o as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { n as findProjectRoot } from "./project-config-opj6DsPF.mjs";
|
|
4
|
+
import { a as idNoSpacesString, c as optionalDescriptionString, f as trimmedNonEmptyString, i as descriptionString, l as optionalTrimmedNonEmptyString, n as createStructuralSchema, o as jsonSchemaObject, s as jsonValueSchema, t as anyZodSchemaSchema } from "./schema-kbMHVnhm.mjs";
|
|
5
|
+
import { m as CredentialSetManifestSchema, n as DeclaredCredentialRequirementSchema } from "./credential-requirements-DjDFthio.mjs";
|
|
6
|
+
import { a as FlowGraphSchema, n as WORKFLOW_MANIFEST_SCHEMA_VERSION, r as WorkflowCoreManifestSchema } from "./workflow-manifest-CAW5FlX0.mjs";
|
|
7
|
+
import { n as IANATimezoneSchema, r as ScheduleSchema } from "./schedule-BRN4hzQM.mjs";
|
|
8
|
+
import { n as TriggerRuntimeDescriptorSchema, r as triggerBaseConfigSchema } from "./schemas-DsvCZfF0.mjs";
|
|
9
|
+
import { t as runWithConcurrency } from "./concurrency-gXn9Rw8x-BTlfau8D.mjs";
|
|
8
10
|
import { createRequire } from "node:module";
|
|
9
11
|
import * as os from "node:os";
|
|
10
12
|
import * as path$1 from "node:path";
|
|
@@ -13,7 +15,390 @@ import { pathToFileURL } from "node:url";
|
|
|
13
15
|
import { execFile } from "node:child_process";
|
|
14
16
|
import { randomUUID } from "node:crypto";
|
|
15
17
|
import { promisify } from "node:util";
|
|
16
|
-
//#region ../../packages/
|
|
18
|
+
//#region ../../packages/core/src/mcp-server/schemas.ts
|
|
19
|
+
const credentialSetInstanceSchema$2 = createStructuralSchema([
|
|
20
|
+
"id",
|
|
21
|
+
"auth",
|
|
22
|
+
"needsResolve"
|
|
23
|
+
], "a CredentialSet instance");
|
|
24
|
+
const McpTransportSchema = z.discriminatedUnion("type", [
|
|
25
|
+
z.object({
|
|
26
|
+
type: z.literal("stdio"),
|
|
27
|
+
command: trimmedNonEmptyString("Command"),
|
|
28
|
+
args: z.array(z.string()).optional(),
|
|
29
|
+
env: z.record(z.string(), z.string()).optional()
|
|
30
|
+
}),
|
|
31
|
+
z.object({
|
|
32
|
+
type: z.literal("http"),
|
|
33
|
+
url: trimmedNonEmptyString("URL"),
|
|
34
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
type: z.literal("sse"),
|
|
38
|
+
url: trimmedNonEmptyString("URL"),
|
|
39
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
40
|
+
})
|
|
41
|
+
]);
|
|
42
|
+
z.object({
|
|
43
|
+
id: trimmedNonEmptyString("MCP server ID"),
|
|
44
|
+
name: optionalTrimmedNonEmptyString("MCP server name"),
|
|
45
|
+
description: optionalDescriptionString("MCP server description"),
|
|
46
|
+
transport: McpTransportSchema,
|
|
47
|
+
credentialSets: z.array(credentialSetInstanceSchema$2).optional(),
|
|
48
|
+
credentials: z.function().optional()
|
|
49
|
+
});
|
|
50
|
+
const McpServerManifestSchema = z.object({
|
|
51
|
+
manifestVersion: z.literal(1),
|
|
52
|
+
type: z.literal("mcpServer"),
|
|
53
|
+
id: z.string().min(1),
|
|
54
|
+
name: z.string().min(1),
|
|
55
|
+
description: z.string().optional(),
|
|
56
|
+
transport: McpTransportSchema,
|
|
57
|
+
credentialSets: z.array(CredentialSetManifestSchema),
|
|
58
|
+
credentialInjection: z.object({
|
|
59
|
+
env: z.record(z.string(), z.object({
|
|
60
|
+
credentialSetId: z.string().min(1),
|
|
61
|
+
key: z.string().min(1)
|
|
62
|
+
})).optional(),
|
|
63
|
+
headers: z.record(z.string(), z.object({
|
|
64
|
+
credentialSetId: z.string().min(1),
|
|
65
|
+
key: z.string().min(1)
|
|
66
|
+
})).optional()
|
|
67
|
+
}).optional()
|
|
68
|
+
});
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region ../../packages/core/src/messaging-gateway/schemas.ts
|
|
71
|
+
const credentialSetInstanceSchema$1 = createStructuralSchema([
|
|
72
|
+
"id",
|
|
73
|
+
"auth",
|
|
74
|
+
"needsResolve"
|
|
75
|
+
], "a CredentialSet instance");
|
|
76
|
+
const MessagingGatewayModeSchema = z.enum(["platform", "custom"]);
|
|
77
|
+
const MessagingGatewayCredentialScopeSchema = z.enum(["organization", "project"]);
|
|
78
|
+
z.object({
|
|
79
|
+
id: idNoSpacesString("MessagingGateway id"),
|
|
80
|
+
name: optionalDescriptionString("MessagingGateway name"),
|
|
81
|
+
description: optionalDescriptionString("MessagingGateway description"),
|
|
82
|
+
provider: z.string().min(1, "MessagingGateway provider is required"),
|
|
83
|
+
mode: MessagingGatewayModeSchema,
|
|
84
|
+
credentialSet: credentialSetInstanceSchema$1,
|
|
85
|
+
credentialScope: MessagingGatewayCredentialScopeSchema.optional(),
|
|
86
|
+
appRef: z.string().min(1).optional()
|
|
87
|
+
});
|
|
88
|
+
const MessagingGatewayManifestSchema = z.object({
|
|
89
|
+
manifestVersion: z.literal(1),
|
|
90
|
+
type: z.literal("messaging-gateway"),
|
|
91
|
+
id: z.string().min(1),
|
|
92
|
+
name: z.string().min(1),
|
|
93
|
+
description: z.string().optional(),
|
|
94
|
+
provider: z.string().min(1),
|
|
95
|
+
mode: MessagingGatewayModeSchema,
|
|
96
|
+
credentialSet: CredentialSetManifestSchema,
|
|
97
|
+
credentialScope: MessagingGatewayCredentialScopeSchema.optional(),
|
|
98
|
+
appRef: z.string().min(1).optional()
|
|
99
|
+
});
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../../packages/core/src/sandbox/schemas.ts
|
|
102
|
+
/**
|
|
103
|
+
* `workdir` must be `/workspace` or a subdirectory so it lands inside the
|
|
104
|
+
* persistent bind mount used by `bootSandbox`. Anything outside `/workspace`
|
|
105
|
+
* is ephemeral today (and not captured by future snapshots' instance state).
|
|
106
|
+
*/
|
|
107
|
+
const WorkdirSchema = z.string().trim().min(1).refine((value) => value === "/workspace" || value.startsWith("/workspace/"), { error: "workdir must be \"/workspace\" or a subdirectory of \"/workspace\"" });
|
|
108
|
+
const SandboxRuntimeSchema = z.object({
|
|
109
|
+
/**
|
|
110
|
+
* Commands the runtime executes inside the sandbox on EVERY boot, after
|
|
111
|
+
* `setupCommands` (and after a snapshot warm-boot, where setupCommands are
|
|
112
|
+
* skipped). Use for `git pull`, `pnpm build`, or anything that should
|
|
113
|
+
* refresh on each invocation. Each command runs with `cwd = workdir`.
|
|
114
|
+
*/
|
|
115
|
+
runCommands: z.array(z.string().trim().min(1)).default([]),
|
|
116
|
+
env: z.record(z.string(), z.string()).default({}),
|
|
117
|
+
workdir: WorkdirSchema.optional()
|
|
118
|
+
});
|
|
119
|
+
const SandboxFileSourceSchema = z.discriminatedUnion("type", [z.object({
|
|
120
|
+
type: z.literal("git"),
|
|
121
|
+
/** Remote git URL to clone. */
|
|
122
|
+
url: trimmedNonEmptyString("Git URL"),
|
|
123
|
+
/** Branch to clone. Omit for default branch. */
|
|
124
|
+
branch: z.string().optional(),
|
|
125
|
+
/**
|
|
126
|
+
* Where to clone inside the VM. Relative paths resolve against the
|
|
127
|
+
* sandbox `workdir`; absolute paths must stay under `/workspace`. Omit
|
|
128
|
+
* to default to `<workdir>/<repo-basename>`.
|
|
129
|
+
*/
|
|
130
|
+
target: z.string().optional()
|
|
131
|
+
}), z.object({
|
|
132
|
+
type: z.literal("local"),
|
|
133
|
+
/** Source path on the host (the dev's machine), resolved against project root. */
|
|
134
|
+
path: trimmedNonEmptyString("Local path"),
|
|
135
|
+
/**
|
|
136
|
+
* Where the file/dir lands inside the VM. Relative paths resolve
|
|
137
|
+
* against the sandbox `workdir`; absolute paths must stay under
|
|
138
|
+
* `/workspace`. Omit to default to `<workdir>/<basename(path)>`.
|
|
139
|
+
*/
|
|
140
|
+
target: z.string().optional()
|
|
141
|
+
})]);
|
|
142
|
+
z.object({
|
|
143
|
+
id: optionalTrimmedNonEmptyString("Sandbox ID"),
|
|
144
|
+
name: optionalTrimmedNonEmptyString("Sandbox name"),
|
|
145
|
+
description: optionalDescriptionString("Sandbox description"),
|
|
146
|
+
runtime: SandboxRuntimeSchema.optional(),
|
|
147
|
+
fileSources: z.array(SandboxFileSourceSchema).optional(),
|
|
148
|
+
setupCommands: z.array(z.string()).optional()
|
|
149
|
+
});
|
|
150
|
+
const SandboxManifestSchema = z.object({
|
|
151
|
+
manifestVersion: z.literal(1),
|
|
152
|
+
type: z.literal("sandbox"),
|
|
153
|
+
id: z.string().min(1),
|
|
154
|
+
name: z.string().min(1),
|
|
155
|
+
description: z.string().optional(),
|
|
156
|
+
runtime: SandboxRuntimeSchema,
|
|
157
|
+
fileSources: z.array(SandboxFileSourceSchema),
|
|
158
|
+
setupCommands: z.array(z.string())
|
|
159
|
+
});
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region ../../packages/core/src/agent/types.ts
|
|
162
|
+
const AGENT_RUNTIME_KIND_DECLARATIVE = "declarative";
|
|
163
|
+
const AGENT_RUNTIME_KIND_RUNNABLE = "runnable";
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region ../../packages/core/src/agent/schemas.ts
|
|
166
|
+
const AgentThinkingLevelSchema = z.enum([
|
|
167
|
+
"off",
|
|
168
|
+
"minimal",
|
|
169
|
+
"low",
|
|
170
|
+
"medium",
|
|
171
|
+
"high",
|
|
172
|
+
"xhigh"
|
|
173
|
+
]);
|
|
174
|
+
const mcpServerInstanceSchema = createStructuralSchema([
|
|
175
|
+
"id",
|
|
176
|
+
"transport",
|
|
177
|
+
"credentialSets"
|
|
178
|
+
], "a McpServer instance");
|
|
179
|
+
const sandboxInstanceSchema = createStructuralSchema([
|
|
180
|
+
"id",
|
|
181
|
+
"runtime",
|
|
182
|
+
"fileSources",
|
|
183
|
+
"setupCommands"
|
|
184
|
+
], "a Sandbox instance");
|
|
185
|
+
const messagingGatewayInstanceSchema = createStructuralSchema([
|
|
186
|
+
"id",
|
|
187
|
+
"provider",
|
|
188
|
+
"mode",
|
|
189
|
+
"credentialSet"
|
|
190
|
+
], "a MessagingGateway instance");
|
|
191
|
+
const SkillSourceSchema = z.object({ path: z.string() });
|
|
192
|
+
const AgentHooksSchema = z.object({
|
|
193
|
+
onToolStart: z.function().optional(),
|
|
194
|
+
onToolEnd: z.function().optional(),
|
|
195
|
+
onStep: z.function().optional()
|
|
196
|
+
}).strict();
|
|
197
|
+
const AgentToolSourceKindSchema = z.enum(["operation", "workflow"]);
|
|
198
|
+
const AgentToolCredentialSetReferenceSchema = z.object({
|
|
199
|
+
id: z.string(),
|
|
200
|
+
required: z.boolean()
|
|
201
|
+
});
|
|
202
|
+
z.object({
|
|
203
|
+
id: trimmedNonEmptyString("Agent ID"),
|
|
204
|
+
name: trimmedNonEmptyString("Agent name"),
|
|
205
|
+
description: optionalDescriptionString("Agent description"),
|
|
206
|
+
systemPrompt: z.string().min(1, { error: "System prompt is required" }),
|
|
207
|
+
model: trimmedNonEmptyString("Model"),
|
|
208
|
+
thinkingLevel: AgentThinkingLevelSchema.optional(),
|
|
209
|
+
input: anyZodSchemaSchema.optional(),
|
|
210
|
+
output: anyZodSchemaSchema.optional(),
|
|
211
|
+
tools: z.array(z.unknown()).optional(),
|
|
212
|
+
mcpServers: z.array(mcpServerInstanceSchema).optional(),
|
|
213
|
+
sandbox: sandboxInstanceSchema.optional(),
|
|
214
|
+
skills: z.array(SkillSourceSchema).optional(),
|
|
215
|
+
enableMemory: z.boolean().default(true),
|
|
216
|
+
enableDatabase: z.boolean().default(true),
|
|
217
|
+
messaging: z.array(messagingGatewayInstanceSchema).optional(),
|
|
218
|
+
maxSteps: z.number().int().nonnegative().optional(),
|
|
219
|
+
hooks: AgentHooksSchema.optional(),
|
|
220
|
+
run: z.function().optional(),
|
|
221
|
+
stream: z.function().optional()
|
|
222
|
+
});
|
|
223
|
+
const AgentManifestSchema = z.object({
|
|
224
|
+
manifestVersion: z.literal(1),
|
|
225
|
+
type: z.literal("agent"),
|
|
226
|
+
id: z.string().min(1),
|
|
227
|
+
authoredAgentId: z.string().min(1),
|
|
228
|
+
name: z.string().min(1),
|
|
229
|
+
runtimeKind: z.enum([AGENT_RUNTIME_KIND_DECLARATIVE, AGENT_RUNTIME_KIND_RUNNABLE]),
|
|
230
|
+
description: z.string().optional(),
|
|
231
|
+
systemPrompt: z.string(),
|
|
232
|
+
model: z.string(),
|
|
233
|
+
thinkingLevel: AgentThinkingLevelSchema,
|
|
234
|
+
input: jsonSchemaObject,
|
|
235
|
+
output: jsonSchemaObject,
|
|
236
|
+
maxSteps: z.number(),
|
|
237
|
+
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
238
|
+
tools: z.array(z.object({
|
|
239
|
+
id: z.string(),
|
|
240
|
+
displayName: z.string(),
|
|
241
|
+
description: z.string().optional(),
|
|
242
|
+
sourceKind: AgentToolSourceKindSchema,
|
|
243
|
+
authoredOperationId: z.string().optional(),
|
|
244
|
+
authoredWorkflowId: z.string().optional(),
|
|
245
|
+
integrationId: z.string().optional(),
|
|
246
|
+
largeResultMode: z.enum(["reject", "ref"]).optional(),
|
|
247
|
+
midSessionSnapshot: z.boolean().optional(),
|
|
248
|
+
credentialSets: z.array(AgentToolCredentialSetReferenceSchema).optional()
|
|
249
|
+
})),
|
|
250
|
+
skills: z.array(SkillSourceSchema).optional(),
|
|
251
|
+
enableMemory: z.boolean().default(true),
|
|
252
|
+
enableDatabase: z.boolean().default(true),
|
|
253
|
+
mcpServers: z.array(McpServerManifestSchema),
|
|
254
|
+
sandbox: SandboxManifestSchema.optional(),
|
|
255
|
+
messaging: z.array(MessagingGatewayManifestSchema).optional()
|
|
256
|
+
});
|
|
257
|
+
triggerBaseConfigSchema.extend({
|
|
258
|
+
input: anyZodSchemaSchema,
|
|
259
|
+
payload: z.custom((value) => {
|
|
260
|
+
return jsonValueSchema.safeParse(value).success;
|
|
261
|
+
}, "Expected a JSON-serializable payload"),
|
|
262
|
+
schedule: ScheduleSchema,
|
|
263
|
+
timezone: IANATimezoneSchema.optional()
|
|
264
|
+
});
|
|
265
|
+
const cronTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
266
|
+
input: jsonSchemaObject,
|
|
267
|
+
payloadMode: z.literal("static"),
|
|
268
|
+
schedule: z.string(),
|
|
269
|
+
timezone: z.string().optional()
|
|
270
|
+
});
|
|
271
|
+
const cronTriggerManifestSchema = z.object({
|
|
272
|
+
manifestVersion: z.literal(1),
|
|
273
|
+
type: z.literal("trigger"),
|
|
274
|
+
triggerType: z.literal("cron"),
|
|
275
|
+
name: trimmedNonEmptyString("Trigger name"),
|
|
276
|
+
description: descriptionString("Trigger description"),
|
|
277
|
+
enabled: z.boolean(),
|
|
278
|
+
modeDefault: z.enum(["managed", "subscribable"]),
|
|
279
|
+
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
280
|
+
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
281
|
+
runtime: cronTriggerRuntimeSchema,
|
|
282
|
+
/** Static payload for cron triggers — the workflow input when this trigger fires */
|
|
283
|
+
payload: jsonValueSchema.optional()
|
|
284
|
+
});
|
|
285
|
+
z.object({
|
|
286
|
+
lastPolledAt: z.string().optional(),
|
|
287
|
+
lastResponse: z.unknown().optional()
|
|
288
|
+
});
|
|
289
|
+
triggerBaseConfigSchema.extend({
|
|
290
|
+
poll: z.function(),
|
|
291
|
+
filter: z.function().optional(),
|
|
292
|
+
idempotencyKey: z.function().optional(),
|
|
293
|
+
response: anyZodSchemaSchema,
|
|
294
|
+
schedule: ScheduleSchema
|
|
295
|
+
});
|
|
296
|
+
const pollingTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
297
|
+
response: jsonSchemaObject,
|
|
298
|
+
schedule: z.string(),
|
|
299
|
+
state: z.object({
|
|
300
|
+
lastPolledAt: z.literal(true),
|
|
301
|
+
lastResponse: z.literal(true)
|
|
302
|
+
})
|
|
303
|
+
});
|
|
304
|
+
const pollingTriggerManifestSchema = z.object({
|
|
305
|
+
manifestVersion: z.literal(1),
|
|
306
|
+
type: z.literal("trigger"),
|
|
307
|
+
triggerType: z.literal("polling"),
|
|
308
|
+
name: trimmedNonEmptyString("Trigger name"),
|
|
309
|
+
description: descriptionString("Trigger description"),
|
|
310
|
+
enabled: z.boolean(),
|
|
311
|
+
modeDefault: z.enum(["managed", "subscribable"]),
|
|
312
|
+
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
313
|
+
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
314
|
+
runtime: pollingTriggerRuntimeSchema
|
|
315
|
+
});
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region ../../packages/core/src/trigger/webhook/schemas.ts
|
|
318
|
+
const WebhookMethodSchema = z.enum([
|
|
319
|
+
"PATCH",
|
|
320
|
+
"POST",
|
|
321
|
+
"PUT"
|
|
322
|
+
]);
|
|
323
|
+
z.object({
|
|
324
|
+
method: z.string(),
|
|
325
|
+
path: z.string(),
|
|
326
|
+
query: z.record(z.string(), z.union([
|
|
327
|
+
z.string(),
|
|
328
|
+
z.array(z.string()),
|
|
329
|
+
z.undefined()
|
|
330
|
+
])),
|
|
331
|
+
headers: z.record(z.string(), z.string().optional()),
|
|
332
|
+
rawBody: z.string()
|
|
333
|
+
});
|
|
334
|
+
const WebhookResponseConfigSchema = z.object({
|
|
335
|
+
ignoredBody: jsonValueSchema.optional(),
|
|
336
|
+
ignoredStatus: z.number().int().positive().optional(),
|
|
337
|
+
successBody: jsonValueSchema.optional(),
|
|
338
|
+
successStatus: z.number().int().positive().optional()
|
|
339
|
+
});
|
|
340
|
+
/**
|
|
341
|
+
* Custom webhook trigger paths describe the suffix that a request URL has
|
|
342
|
+
* after the organization id. The router serves these triggers at
|
|
343
|
+
* `/api/v1/webhooks/{orgId}{path}` (e.g. `path: '/orders'` → request
|
|
344
|
+
* `/api/v1/webhooks/{orgId}/orders`). Authors must therefore supply only the
|
|
345
|
+
* trailing path segment, not the `/webhooks/` prefix that the route already
|
|
346
|
+
* provides.
|
|
347
|
+
*/
|
|
348
|
+
const webhookPathSchema = z.string().trim().min(1, { error: "Webhook path cannot be empty" }).max(50, { error: "Webhook path cannot exceed 50 characters" }).refine((s) => !/\s/.test(s), { error: "Webhook path cannot contain spaces or whitespace" }).refine((s) => s.startsWith("/"), { error: "Webhook path must start with /" }).refine((s) => s.length > 1, { error: "Webhook path must include a path segment after the leading \"/\"" }).refine((s) => !/^\/webhooks(\/|$)/i.test(s), { error: "Webhook path must not start with \"/webhooks\". Provide just the suffix that follows the organization id in the URL — e.g. use \"/orders\" for a webhook served at \"/api/v1/webhooks/{orgId}/orders\"." });
|
|
349
|
+
const credentialSetInstanceSchema = createStructuralSchema([
|
|
350
|
+
"id",
|
|
351
|
+
"auth",
|
|
352
|
+
"needsResolve"
|
|
353
|
+
], "a CredentialSet instance");
|
|
354
|
+
const webhookCustomSourceConfigSchema = z.object({
|
|
355
|
+
type: z.literal("custom"),
|
|
356
|
+
method: WebhookMethodSchema,
|
|
357
|
+
path: webhookPathSchema,
|
|
358
|
+
verify: z.function().optional(),
|
|
359
|
+
response: WebhookResponseConfigSchema.optional(),
|
|
360
|
+
credentialSets: z.array(credentialSetInstanceSchema).optional()
|
|
361
|
+
});
|
|
362
|
+
const webhookAppSourceConfigSchema = z.object({
|
|
363
|
+
type: z.literal("app"),
|
|
364
|
+
appRef: trimmedNonEmptyString("appRef")
|
|
365
|
+
});
|
|
366
|
+
const webhookSourceConfigSchema = z.discriminatedUnion("type", [webhookCustomSourceConfigSchema, webhookAppSourceConfigSchema]);
|
|
367
|
+
const webhookCustomSourceManifestSchema = z.object({
|
|
368
|
+
type: z.literal("custom"),
|
|
369
|
+
method: WebhookMethodSchema,
|
|
370
|
+
path: z.string().min(1).max(1024),
|
|
371
|
+
response: WebhookResponseConfigSchema.optional()
|
|
372
|
+
});
|
|
373
|
+
const webhookAppSourceManifestSchema = z.object({
|
|
374
|
+
type: z.literal("app"),
|
|
375
|
+
appRef: trimmedNonEmptyString("appRef")
|
|
376
|
+
});
|
|
377
|
+
const WebhookSourceManifestSchema = z.discriminatedUnion("type", [webhookCustomSourceManifestSchema, webhookAppSourceManifestSchema]);
|
|
378
|
+
triggerBaseConfigSchema.omit({ credentialSets: true }).extend({
|
|
379
|
+
source: webhookSourceConfigSchema,
|
|
380
|
+
payload: anyZodSchemaSchema.optional(),
|
|
381
|
+
filter: z.function().optional(),
|
|
382
|
+
idempotencyKey: z.function().optional()
|
|
383
|
+
});
|
|
384
|
+
const webhookTriggerRuntimeSchema = TriggerRuntimeDescriptorSchema.extend({
|
|
385
|
+
source: WebhookSourceManifestSchema,
|
|
386
|
+
payload: jsonSchemaObject
|
|
387
|
+
});
|
|
388
|
+
const webhookTriggerManifestSchema = z.object({
|
|
389
|
+
manifestVersion: z.literal(1),
|
|
390
|
+
type: z.literal("trigger"),
|
|
391
|
+
triggerType: z.literal("webhook"),
|
|
392
|
+
name: trimmedNonEmptyString("Trigger name"),
|
|
393
|
+
description: descriptionString("Trigger description"),
|
|
394
|
+
enabled: z.boolean(),
|
|
395
|
+
modeDefault: z.enum(["managed", "subscribable"]),
|
|
396
|
+
executionIdentityPolicy: triggerBaseConfigSchema.shape.executionIdentityPolicy,
|
|
397
|
+
credentialSets: z.array(CredentialSetManifestSchema).optional(),
|
|
398
|
+
runtime: webhookTriggerRuntimeSchema
|
|
399
|
+
});
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region ../../packages/workflow-builder/dist/import-module-DDPnzlJ1.mjs
|
|
17
402
|
var DiscoveryError = class extends Error {
|
|
18
403
|
code;
|
|
19
404
|
filePath;
|
|
@@ -132,9 +517,9 @@ import {
|
|
|
132
517
|
cronTrigger,
|
|
133
518
|
webhookTrigger,
|
|
134
519
|
pollingTrigger,
|
|
135
|
-
} from '@
|
|
136
|
-
import { getOfficialIntegrationMetadata } from '@
|
|
137
|
-
import { analyzeSuspensions, analyzeWorkflowCredentials, isTabularSchema } from '@
|
|
520
|
+
} from '@keystrokehq/core';
|
|
521
|
+
import { getOfficialIntegrationMetadata } from '@keystrokehq/core/_runtime';
|
|
522
|
+
import { analyzeSuspensions, analyzeWorkflowCredentials, isTabularSchema } from '@keystrokehq/core/flow-graph-toolkit';
|
|
138
523
|
import { parseSync } from ${JSON.stringify(OXC_PARSER_IMPORT_URL)};
|
|
139
524
|
|
|
140
525
|
Object.assign(globalThis, {
|
|
@@ -210,7 +595,7 @@ function getAgentToolId(tool) {
|
|
|
210
595
|
|
|
211
596
|
/**
|
|
212
597
|
* Computes enrichment data for each agent tool (workflow + operation) by reaching
|
|
213
|
-
* into the live primitive instances.
|
|
598
|
+
* into the live primitive instances. core only emits primitive-level facts
|
|
214
599
|
* in toManifest(); cross-cutting enrichment (suspensions, credential conditionality,
|
|
215
600
|
* dispatch placement, tabular detection) is computed here.
|
|
216
601
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { t as createTypedCommand } from "./commander-
|
|
3
|
+
import { t as createTypedCommand } from "./commander-DZ3F3CVq.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/commands/init/init.command.ts
|
|
6
6
|
const InitOptionsSchema = z.object({
|
|
@@ -38,7 +38,7 @@ function createInitCommand() {
|
|
|
38
38
|
description: "Initialize a Keystroke project (creates keystroke.config.ts)",
|
|
39
39
|
schema: InitOptionsSchema,
|
|
40
40
|
optionsConfig: INIT_OPTIONS_CONFIG,
|
|
41
|
-
loadHandler: async () => (await import("./init.handler-
|
|
41
|
+
loadHandler: async () => (await import("./init.handler-DSW6XFZn.mjs")).handleInit
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|