@keystrokehq/keystroke 0.0.173 → 0.0.175
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/dist/action.cjs +2 -3
- package/dist/action.d.cts +3 -3
- package/dist/action.d.mts +3 -3
- package/dist/action.mjs +2 -2
- package/dist/agent.cjs +3 -3
- package/dist/agent.d.cts +2 -2
- package/dist/agent.d.mts +2 -2
- package/dist/agent.mjs +3 -3
- package/dist/app.cjs +36 -0
- package/dist/app.cjs.map +1 -0
- package/dist/app.d.cts +52 -0
- package/dist/app.d.cts.map +1 -0
- package/dist/app.d.mts +52 -0
- package/dist/app.d.mts.map +1 -0
- package/dist/app.mjs +35 -0
- package/dist/app.mjs.map +1 -0
- package/dist/client.cjs +3 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -0
- package/dist/client.d.cts.map +1 -1
- package/dist/client.d.mts +6 -0
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +3 -1
- package/dist/client.mjs.map +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/credentials.cjs +2 -3
- package/dist/credentials.d.cts +2 -2
- package/dist/credentials.d.mts +2 -2
- package/dist/credentials.mjs +2 -2
- package/dist/{dist--zLOSTcG.cjs → dist-B3WT5qgl.cjs} +65 -64
- package/dist/dist-B3WT5qgl.cjs.map +1 -0
- package/dist/{dist-DT5CSOQc.mjs → dist-BwuyO3oY.mjs} +8 -10
- package/dist/dist-BwuyO3oY.mjs.map +1 -0
- package/dist/{dist-Dz0i7l87.cjs → dist-CIhk3fW1.cjs} +56 -63
- package/dist/dist-CIhk3fW1.cjs.map +1 -0
- package/dist/{dist-BF5yN9sB.mjs → dist-DgjcBE-O.mjs} +64 -51
- package/dist/dist-DgjcBE-O.mjs.map +1 -0
- package/dist/{dist-bGasqeNy.mjs → dist-itGeZOJp.mjs} +56 -63
- package/dist/dist-itGeZOJp.mjs.map +1 -0
- package/dist/{dist--dtTaEXy.cjs → dist-tKIYuAek.cjs} +8 -10
- package/dist/dist-tKIYuAek.cjs.map +1 -0
- package/dist/{index-s53YoTdO.d.cts → index-CPCPd4hJ.d.cts} +2 -2
- package/dist/{index-BDPrsenN.d.mts.map → index-CPCPd4hJ.d.cts.map} +1 -1
- package/dist/{index-BDPrsenN.d.mts → index-Cn6nUPtC.d.mts} +2 -2
- package/dist/{index-s53YoTdO.d.cts.map → index-Cn6nUPtC.d.mts.map} +1 -1
- package/dist/{index-uWH8vj_f.d.cts → index-DQfGP5X4.d.cts} +4 -4
- package/dist/{index-uWH8vj_f.d.cts.map → index-DQfGP5X4.d.cts.map} +1 -1
- package/dist/{index-B9hlxKDT.d.cts → index-DpOXmY3P.d.cts} +12 -9
- package/dist/index-DpOXmY3P.d.cts.map +1 -0
- package/dist/{index-1uEWGKCk.d.mts → index-DsDxuNfg.d.mts} +12 -9
- package/dist/index-DsDxuNfg.d.mts.map +1 -0
- package/dist/{index-BPC4loSM.d.mts → index-DykbAIg-.d.mts} +2 -2
- package/dist/index-DykbAIg-.d.mts.map +1 -0
- package/dist/{index-DvJmjY4X.d.mts → index-VCi-jUnh.d.mts} +4 -4
- package/dist/{index-DvJmjY4X.d.mts.map → index-VCi-jUnh.d.mts.map} +1 -1
- package/dist/{index-DAzE8I-g.d.cts → index-e9f4pcX4.d.cts} +15 -17
- package/dist/index-e9f4pcX4.d.cts.map +1 -0
- package/dist/{index-DAzE8I-g.d.mts → index-e9f4pcX4.d.mts} +15 -17
- package/dist/index-e9f4pcX4.d.mts.map +1 -0
- package/dist/{index-Ugto82oH.d.cts → index-nUAXCgEe.d.cts} +2 -2
- package/dist/index-nUAXCgEe.d.cts.map +1 -0
- package/dist/{mistral-D56Ydau-.mjs → mistral-MfzlP5Os.mjs} +2 -2
- package/dist/{mistral-D56Ydau-.mjs.map → mistral-MfzlP5Os.mjs.map} +1 -1
- package/dist/{mistral-GXPqP1mo.cjs → mistral-gBakFlvh.cjs} +2 -2
- package/dist/{mistral-GXPqP1mo.cjs.map → mistral-gBakFlvh.cjs.map} +1 -1
- package/dist/{sse-U_LwOMpt.mjs → sse-CFH10VfF.mjs} +2 -2
- package/dist/{sse-U_LwOMpt.mjs.map → sse-CFH10VfF.mjs.map} +1 -1
- package/dist/{sse-D1mtozXN.cjs → sse-CO21wkJ1.cjs} +2 -2
- package/dist/{sse-D1mtozXN.cjs.map → sse-CO21wkJ1.cjs.map} +1 -1
- package/dist/trigger.cjs +1 -1
- package/dist/trigger.d.cts +3 -3
- package/dist/trigger.d.mts +3 -3
- package/dist/trigger.mjs +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.mts +2 -2
- package/dist/workflow.mjs +1 -1
- package/package.json +7 -1
- package/dist/dist--dtTaEXy.cjs.map +0 -1
- package/dist/dist--zLOSTcG.cjs.map +0 -1
- package/dist/dist-BF5yN9sB.mjs.map +0 -1
- package/dist/dist-DT5CSOQc.mjs.map +0 -1
- package/dist/dist-Dz0i7l87.cjs.map +0 -1
- package/dist/dist-bGasqeNy.mjs.map +0 -1
- package/dist/index-1uEWGKCk.d.mts.map +0 -1
- package/dist/index-B9hlxKDT.d.cts.map +0 -1
- package/dist/index-BPC4loSM.d.mts.map +0 -1
- package/dist/index-DAzE8I-g.d.cts.map +0 -1
- package/dist/index-DAzE8I-g.d.mts.map +0 -1
- package/dist/index-Ugto82oH.d.cts.map +0 -1
|
@@ -843,7 +843,39 @@ const OAuthScopeOptionSchema = zod.z.object({
|
|
|
843
843
|
required: zod.z.boolean().optional()
|
|
844
844
|
});
|
|
845
845
|
/** How an app authenticates when connecting credentials. */
|
|
846
|
-
const AppAuthKindSchema = zod.z.enum([
|
|
846
|
+
const AppAuthKindSchema = zod.z.enum([
|
|
847
|
+
"oauth",
|
|
848
|
+
"api_key",
|
|
849
|
+
"keystroke"
|
|
850
|
+
]);
|
|
851
|
+
/**
|
|
852
|
+
* Where app metadata and execution are sourced (e.g. native, composio, pipedream, custom).
|
|
853
|
+
* Opaque string — cloud/hosted entrypoints choose values; keystroke stays provider-agnostic.
|
|
854
|
+
*/
|
|
855
|
+
const AppSourceSchema = zod.z.string().trim().min(1);
|
|
856
|
+
zod.z.object({
|
|
857
|
+
slug: zod.z.string().trim().min(1),
|
|
858
|
+
name: zod.z.string().min(1),
|
|
859
|
+
description: zod.z.string().min(1),
|
|
860
|
+
category: zod.z.string().min(1),
|
|
861
|
+
logo: zod.z.string().url().optional(),
|
|
862
|
+
authKind: AppAuthKindSchema,
|
|
863
|
+
oauthScopes: zod.z.array(OAuthScopeOptionSchema)
|
|
864
|
+
}).extend({ source: AppSourceSchema });
|
|
865
|
+
zod.z.object({
|
|
866
|
+
id: zod.z.string().min(1),
|
|
867
|
+
organizationId: zod.z.string().min(1).nullable(),
|
|
868
|
+
slug: zod.z.string().min(1),
|
|
869
|
+
name: zod.z.string().min(1),
|
|
870
|
+
description: zod.z.string().min(1),
|
|
871
|
+
category: zod.z.string().min(1),
|
|
872
|
+
logo: zod.z.string().url().nullable(),
|
|
873
|
+
authKind: AppAuthKindSchema,
|
|
874
|
+
oauthScopes: zod.z.array(OAuthScopeOptionSchema),
|
|
875
|
+
source: AppSourceSchema,
|
|
876
|
+
createdAt: zod.z.string().min(1),
|
|
877
|
+
updatedAt: zod.z.string().min(1)
|
|
878
|
+
});
|
|
847
879
|
/**
|
|
848
880
|
* A connectable integration shown in the "Connect an app" picker. An "app" is
|
|
849
881
|
* an integration / credential set — connected state is whether a credential exists.
|
|
@@ -854,6 +886,7 @@ const AppCatalogEntrySchema = zod.z.object({
|
|
|
854
886
|
description: zod.z.string().min(1),
|
|
855
887
|
category: zod.z.string().min(1),
|
|
856
888
|
integrationDescription: zod.z.string().min(1),
|
|
889
|
+
logo: zod.z.string().url().nullable().optional(),
|
|
857
890
|
authKind: AppAuthKindSchema,
|
|
858
891
|
oauthScopes: zod.z.array(OAuthScopeOptionSchema),
|
|
859
892
|
/** When present, the app supports agent gateway bindings (external channels). */
|
|
@@ -866,32 +899,18 @@ const CredentialAuthKindSchema = zod.z.enum([
|
|
|
866
899
|
"oauth_managed",
|
|
867
900
|
"keystroke"
|
|
868
901
|
]);
|
|
869
|
-
/** Where a credential instance is stored (`credential_instances.scope_type`). */
|
|
870
|
-
const CredentialScopeTypeSchema = zod.z.enum([
|
|
871
|
-
"organization",
|
|
872
|
-
"project",
|
|
873
|
-
"user"
|
|
874
|
-
]);
|
|
875
902
|
/**
|
|
876
|
-
*
|
|
877
|
-
*
|
|
903
|
+
* Where a credential instance is stored (`credential_instances.scope_type`), and the only thing an
|
|
904
|
+
* action/tool can pin via `.scope(...)`. There is no resolution chain: when no scope is pinned, the
|
|
905
|
+
* resolver tries the project default, then the org default, then throws.
|
|
878
906
|
*/
|
|
879
|
-
const
|
|
880
|
-
"selection",
|
|
907
|
+
const CredentialScopeTypeSchema = zod.z.enum([
|
|
881
908
|
"organization",
|
|
882
909
|
"project",
|
|
883
910
|
"user"
|
|
884
911
|
]);
|
|
885
912
|
CredentialAuthKindSchema.options;
|
|
886
|
-
CredentialScopeTypeSchema.options;
|
|
887
|
-
const CREDENTIAL_SCOPE_LEVELS = CredentialScopeLevelSchema.options;
|
|
888
|
-
/** Default chain when `credential.static(...).scope()` is called with no args. */
|
|
889
|
-
const DEFAULT_CREDENTIAL_RESOLUTION_CHAIN = ["organization", "project"];
|
|
890
|
-
const CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE = {
|
|
891
|
-
organization: "organization",
|
|
892
|
-
project: "project",
|
|
893
|
-
user: "user"
|
|
894
|
-
};
|
|
913
|
+
const CREDENTIAL_SCOPE_TYPES = CredentialScopeTypeSchema.options;
|
|
895
914
|
/** Scope of a platform app credential (maps to `credential_instances.scope_type`). */
|
|
896
915
|
const AppCredentialScopeSchema = zod.z.enum([
|
|
897
916
|
"user",
|
|
@@ -1015,7 +1034,14 @@ const KeystrokeCredentialSchema = zod.z.object({
|
|
|
1015
1034
|
zod.z.object({
|
|
1016
1035
|
app: zod.z.string().trim().min(1),
|
|
1017
1036
|
tool: zod.z.string().trim().min(1),
|
|
1018
|
-
arguments: zod.z.record(zod.z.string(), zod.z.unknown()).default({})
|
|
1037
|
+
arguments: zod.z.record(zod.z.string(), zod.z.unknown()).default({}),
|
|
1038
|
+
/**
|
|
1039
|
+
* Resolved credential instance to execute against. When set, the platform executes that exact
|
|
1040
|
+
* connection (scoped to the caller's org); when omitted it resolves the app's instance by scope.
|
|
1041
|
+
*/
|
|
1042
|
+
instanceId: zod.z.string().trim().min(1).optional(),
|
|
1043
|
+
/** Pinned provider toolkit version, sourced from the app definition; forwarded to the provider. */
|
|
1044
|
+
version: zod.z.string().trim().min(1)
|
|
1019
1045
|
});
|
|
1020
1046
|
const TeamRequestTypeSchema = zod.z.enum([
|
|
1021
1047
|
"org-deletion",
|
|
@@ -1040,12 +1066,12 @@ function createRef(kind, key, schema, options) {
|
|
|
1040
1066
|
key,
|
|
1041
1067
|
schema,
|
|
1042
1068
|
...tokenField !== void 0 ? { tokenField } : {},
|
|
1043
|
-
scope(
|
|
1069
|
+
scope(scope) {
|
|
1044
1070
|
return {
|
|
1045
1071
|
key,
|
|
1046
1072
|
kind,
|
|
1047
1073
|
schema,
|
|
1048
|
-
|
|
1074
|
+
scope,
|
|
1049
1075
|
...tokenField !== void 0 ? { tokenField } : {}
|
|
1050
1076
|
};
|
|
1051
1077
|
}
|
|
@@ -1076,7 +1102,7 @@ function normalizeCredentialList(list) {
|
|
|
1076
1102
|
return list.map((item) => toCredentialRequirement(item));
|
|
1077
1103
|
}
|
|
1078
1104
|
function isCredentialRequirement(item) {
|
|
1079
|
-
return "
|
|
1105
|
+
return typeof item.scope !== "function";
|
|
1080
1106
|
}
|
|
1081
1107
|
function toCredentialRequirement(item) {
|
|
1082
1108
|
if (isCredentialRequirement(item)) return item;
|
|
@@ -1084,7 +1110,6 @@ function toCredentialRequirement(item) {
|
|
|
1084
1110
|
key: item.key,
|
|
1085
1111
|
kind: item.kind,
|
|
1086
1112
|
schema: item.schema,
|
|
1087
|
-
chain: DEFAULT_CREDENTIAL_RESOLUTION_CHAIN,
|
|
1088
1113
|
...item.tokenField !== void 0 ? { tokenField: item.tokenField } : {}
|
|
1089
1114
|
};
|
|
1090
1115
|
}
|
|
@@ -2250,19 +2275,13 @@ function registerWorkflowRunGetter(fn) {
|
|
|
2250
2275
|
function getWorkflowRunHandle() {
|
|
2251
2276
|
return registry().getter?.();
|
|
2252
2277
|
}
|
|
2253
|
-
function buildSelectionForAction(action, instanceId) {
|
|
2254
|
-
if (!action.credentials?.length) return {};
|
|
2255
|
-
const requirements = normalizeCredentialList(action.credentials);
|
|
2256
|
-
return Object.fromEntries(requirements.map((requirement) => [requirement.key, instanceId]));
|
|
2257
|
-
}
|
|
2258
2278
|
function executeStep(state) {
|
|
2259
2279
|
if (state.input === void 0) throw new Error(`Step "${state.action.slug}" has no input. Call .run(input) before awaiting or chaining .scope().`);
|
|
2260
2280
|
const handle = getWorkflowRunHandle();
|
|
2261
2281
|
if (!handle) throw new Error(`Step "${state.action.slug}" must run inside a workflow or be called as .run(input, credentials) in tests.`);
|
|
2262
2282
|
return handle.actionRunner(state.action, state.input, {
|
|
2263
2283
|
id: state.id,
|
|
2264
|
-
|
|
2265
|
-
credentialSelection: state.selection
|
|
2284
|
+
credentialScope: state.scope
|
|
2266
2285
|
});
|
|
2267
2286
|
}
|
|
2268
2287
|
function isStepInvocation(value) {
|
|
@@ -2270,20 +2289,10 @@ function isStepInvocation(value) {
|
|
|
2270
2289
|
}
|
|
2271
2290
|
function createStepInvocation(state) {
|
|
2272
2291
|
return {
|
|
2273
|
-
scope(
|
|
2274
|
-
return createStepInvocation({
|
|
2275
|
-
...state,
|
|
2276
|
-
chain: chain.length > 0 ? chain : state.chain
|
|
2277
|
-
});
|
|
2278
|
-
},
|
|
2279
|
-
select(instanceIdOrMap) {
|
|
2280
|
-
const nextSelection = typeof instanceIdOrMap === "string" ? buildSelectionForAction(state.action, instanceIdOrMap) : instanceIdOrMap;
|
|
2292
|
+
scope(scope) {
|
|
2281
2293
|
return createStepInvocation({
|
|
2282
2294
|
...state,
|
|
2283
|
-
|
|
2284
|
-
...state.selection,
|
|
2285
|
-
...nextSelection
|
|
2286
|
-
}
|
|
2295
|
+
scope
|
|
2287
2296
|
});
|
|
2288
2297
|
},
|
|
2289
2298
|
run(input) {
|
|
@@ -2315,11 +2324,15 @@ function attachStepApi(action) {
|
|
|
2315
2324
|
input
|
|
2316
2325
|
});
|
|
2317
2326
|
},
|
|
2318
|
-
scope(
|
|
2319
|
-
return
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2327
|
+
scope(scope) {
|
|
2328
|
+
if (!action.credentials) return attachStepApi(action);
|
|
2329
|
+
const credentials = normalizeCredentialList(action.credentials).map((requirement) => ({
|
|
2330
|
+
...requirement,
|
|
2331
|
+
scope
|
|
2332
|
+
}));
|
|
2333
|
+
return attachStepApi({
|
|
2334
|
+
...action,
|
|
2335
|
+
credentials
|
|
2323
2336
|
});
|
|
2324
2337
|
}
|
|
2325
2338
|
};
|
|
@@ -2374,22 +2387,10 @@ function resolveActionTool(action, options) {
|
|
|
2374
2387
|
};
|
|
2375
2388
|
}
|
|
2376
2389
|
//#endregion
|
|
2377
|
-
Object.defineProperty(exports, "
|
|
2378
|
-
enumerable: true,
|
|
2379
|
-
get: function() {
|
|
2380
|
-
return CREDENTIAL_SCOPE_LEVELS;
|
|
2381
|
-
}
|
|
2382
|
-
});
|
|
2383
|
-
Object.defineProperty(exports, "CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE", {
|
|
2384
|
-
enumerable: true,
|
|
2385
|
-
get: function() {
|
|
2386
|
-
return CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE;
|
|
2387
|
-
}
|
|
2388
|
-
});
|
|
2389
|
-
Object.defineProperty(exports, "DEFAULT_CREDENTIAL_RESOLUTION_CHAIN", {
|
|
2390
|
+
Object.defineProperty(exports, "CREDENTIAL_SCOPE_TYPES", {
|
|
2390
2391
|
enumerable: true,
|
|
2391
2392
|
get: function() {
|
|
2392
|
-
return
|
|
2393
|
+
return CREDENTIAL_SCOPE_TYPES;
|
|
2393
2394
|
}
|
|
2394
2395
|
});
|
|
2395
2396
|
Object.defineProperty(exports, "actionCoreSchema", {
|
|
@@ -2531,4 +2532,4 @@ Object.defineProperty(exports, "toolParameters", {
|
|
|
2531
2532
|
}
|
|
2532
2533
|
});
|
|
2533
2534
|
|
|
2534
|
-
//# sourceMappingURL=dist
|
|
2535
|
+
//# sourceMappingURL=dist-B3WT5qgl.cjs.map
|