@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bn as __require, Ln as __commonJSMin, Vn as __toESM } from "./dist-IaCcrwur.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { S as normalizeCredentialList, x as mcpEntityId } from "./dist-DgjcBE-O.mjs";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import "node:fs";
|
|
5
5
|
import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
@@ -13251,7 +13251,7 @@ async function connectMcpServer(name, options) {
|
|
|
13251
13251
|
}
|
|
13252
13252
|
async function createTransport(url, transport, requestInit, fetchImpl) {
|
|
13253
13253
|
if (transport === "sse") {
|
|
13254
|
-
const { SSEClientTransport } = await import("./sse-
|
|
13254
|
+
const { SSEClientTransport } = await import("./sse-CFH10VfF.mjs");
|
|
13255
13255
|
return new SSEClientTransport(url, {
|
|
13256
13256
|
requestInit,
|
|
13257
13257
|
fetch: fetchImpl
|
|
@@ -17156,12 +17156,6 @@ function credentialScopeAnd(scopeType, ...conditions) {
|
|
|
17156
17156
|
async function selectCredentialInstanceById$1(id) {
|
|
17157
17157
|
return (await getDb$1().select().from(credentialInstances).where(eq(credentialInstances.id, id)).limit(1))[0];
|
|
17158
17158
|
}
|
|
17159
|
-
async function listCredentialInstancesByScope$1(options) {
|
|
17160
|
-
const db = getDb$1();
|
|
17161
|
-
const conditions = [options.scopeId === null ? and(eq(credentialInstances.scopeType, options.scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, options.scopeType), eq(credentialInstances.scopeId, options.scopeId))];
|
|
17162
|
-
if (options.slug) conditions.push(eq(credentialInstances.slug, options.slug));
|
|
17163
|
-
return db.select().from(credentialInstances).where(credentialScopeAnd(options.scopeType, ...conditions));
|
|
17164
|
-
}
|
|
17165
17159
|
async function selectCredentialInstancesForScope$1(slug, scopeType, scopeId) {
|
|
17166
17160
|
const db = getDb$1();
|
|
17167
17161
|
const scopeCondition = scopeId === null ? and(eq(credentialInstances.scopeType, scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, scopeType), eq(credentialInstances.scopeId, scopeId));
|
|
@@ -17563,6 +17557,20 @@ const organizations = pgTable("organizations", {
|
|
|
17563
17557
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
17564
17558
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
17565
17559
|
}, (table) => [uniqueIndex$1("organizations_slug_unique").on(table.slug)]);
|
|
17560
|
+
const apps = pgTable("apps", {
|
|
17561
|
+
id: text$1("id").primaryKey(),
|
|
17562
|
+
organizationId: text$1("organization_id").references(() => organizations.id, { onDelete: "cascade" }),
|
|
17563
|
+
slug: text$1("slug").notNull(),
|
|
17564
|
+
name: text$1("name").notNull(),
|
|
17565
|
+
description: text$1("description").notNull(),
|
|
17566
|
+
category: text$1("category").notNull(),
|
|
17567
|
+
logo: text$1("logo"),
|
|
17568
|
+
authKind: text$1("auth_kind").$type().notNull(),
|
|
17569
|
+
oauthScopes: jsonb("oauth_scopes").$type().notNull(),
|
|
17570
|
+
source: text$1("source").$type().notNull(),
|
|
17571
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
17572
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
17573
|
+
}, (table) => [uniqueIndex$1("apps_slug_idx").on(table.slug), index$1("apps_organization_id_idx").on(table.organizationId)]);
|
|
17566
17574
|
const oauthApps = pgTable("oauth_apps", {
|
|
17567
17575
|
id: text$1("id").primaryKey(),
|
|
17568
17576
|
organizationId: text$1("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
@@ -17685,6 +17693,7 @@ buildPgSchema({
|
|
|
17685
17693
|
authDeviceCodes: { pg: authDeviceCodes },
|
|
17686
17694
|
authJwks: { pg: authJwks },
|
|
17687
17695
|
authApiKeys: { pg: authApiKeys },
|
|
17696
|
+
apps: { pg: apps },
|
|
17688
17697
|
oauthApps: { pg: oauthApps },
|
|
17689
17698
|
oauthConnections: { pg: oauthConnections },
|
|
17690
17699
|
secretValues: { pg: secretValues }
|
|
@@ -17841,9 +17850,6 @@ async function selectCredentialInstanceById(id) {
|
|
|
17841
17850
|
async function selectCredentialInstancesForScope(key, scopeType, scopeId) {
|
|
17842
17851
|
return (await selectCredentialInstancesForScope$1(key, scopeType, scopeId)).map(normalizeLocalRow);
|
|
17843
17852
|
}
|
|
17844
|
-
async function listCredentialInstancesByScope(options) {
|
|
17845
|
-
return (await listCredentialInstancesByScope$1(options)).map(normalizeLocalRow);
|
|
17846
|
-
}
|
|
17847
17853
|
//#endregion
|
|
17848
17854
|
//#region ../credentials/dist/index.mjs
|
|
17849
17855
|
var MissingCredentialsError = class extends Error {
|
|
@@ -18019,20 +18025,6 @@ function createCredentialBackend(options = {}) {
|
|
|
18019
18025
|
}
|
|
18020
18026
|
return createLocalCredentialBackend(options);
|
|
18021
18027
|
}
|
|
18022
|
-
const CHAIN_TO_SCOPE = {
|
|
18023
|
-
organization: {
|
|
18024
|
-
scopeType: CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE.organization,
|
|
18025
|
-
contextKey: "orgId"
|
|
18026
|
-
},
|
|
18027
|
-
project: {
|
|
18028
|
-
scopeType: CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE.project,
|
|
18029
|
-
contextKey: "projectId"
|
|
18030
|
-
},
|
|
18031
|
-
user: {
|
|
18032
|
-
scopeType: CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE.user,
|
|
18033
|
-
contextKey: "userId"
|
|
18034
|
-
}
|
|
18035
|
-
};
|
|
18036
18028
|
function toSelectionOption(row) {
|
|
18037
18029
|
return {
|
|
18038
18030
|
id: row.id,
|
|
@@ -18105,21 +18097,12 @@ function withTenantScope(context) {
|
|
|
18105
18097
|
orgId: getServerTenantScopeId()
|
|
18106
18098
|
};
|
|
18107
18099
|
}
|
|
18108
|
-
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
key,
|
|
18113
|
-
|
|
18114
|
-
scopeId: scoped.orgId
|
|
18115
|
-
}));
|
|
18116
|
-
const userId = resolveUserId(key, scoped);
|
|
18117
|
-
if (userId) rows.push(...await listCredentialInstancesByScope({
|
|
18118
|
-
key,
|
|
18119
|
-
scopeType: "user",
|
|
18120
|
-
scopeId: userId
|
|
18121
|
-
}));
|
|
18122
|
-
return rows.map(toSelectionOption);
|
|
18100
|
+
function scopeIdForScope(scope, key, context) {
|
|
18101
|
+
switch (scope) {
|
|
18102
|
+
case "organization": return context.orgId;
|
|
18103
|
+
case "project": return context.projectId;
|
|
18104
|
+
case "user": return resolveUserId(key, context);
|
|
18105
|
+
}
|
|
18123
18106
|
}
|
|
18124
18107
|
async function resolveAtScope(key, scopeType, scopeId, consumer) {
|
|
18125
18108
|
const rows = await selectCredentialInstancesForScope(key, scopeType, scopeId);
|
|
@@ -18131,35 +18114,45 @@ async function resolveAtScope(key, scopeType, scopeId, consumer) {
|
|
|
18131
18114
|
throw error;
|
|
18132
18115
|
}
|
|
18133
18116
|
}
|
|
18117
|
+
/**
|
|
18118
|
+
* Resolution order:
|
|
18119
|
+
* 1. A platform-provided binding (explicit instance id in `context.selection`) wins.
|
|
18120
|
+
* 2. A scope pinned on the requirement (`.scope("user")`) resolves only at that scope.
|
|
18121
|
+
* 3. Otherwise the project default, then the org default. No configurable chain.
|
|
18122
|
+
* If nothing matches, throw — there is no binding.
|
|
18123
|
+
*/
|
|
18134
18124
|
async function resolvePolicy(requirement, context, consumer, backend) {
|
|
18135
|
-
const
|
|
18136
|
-
const selectionId = context.selection?.[requirement.key];
|
|
18125
|
+
const attempted = [];
|
|
18137
18126
|
const materialBackend = backend ?? createCredentialBackend();
|
|
18138
18127
|
const scoped = withTenantScope(context);
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
if (
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
}
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18128
|
+
const selectionId = context.selection?.[requirement.key];
|
|
18129
|
+
if (selectionId) return resolveInstanceValue(await resolveSelectedInstance(requirement.key, selectionId, scoped, consumer), requirement, materialBackend);
|
|
18130
|
+
if (requirement.scope) {
|
|
18131
|
+
const scopeId = scopeIdForScope(requirement.scope, requirement.key, scoped);
|
|
18132
|
+
if (scopeId) {
|
|
18133
|
+
attempted.push(requirement.scope);
|
|
18134
|
+
const row = await resolveAtScope(requirement.key, requirement.scope, scopeId, consumer);
|
|
18135
|
+
if (row) return resolveInstanceValue(row, requirement, materialBackend);
|
|
18136
|
+
}
|
|
18137
|
+
throw new MissingCredentialsError({
|
|
18138
|
+
key: requirement.key,
|
|
18139
|
+
chainAttempted: attempted.length > 0 ? attempted : [requirement.scope],
|
|
18140
|
+
consumer
|
|
18141
|
+
});
|
|
18142
|
+
}
|
|
18143
|
+
if (scoped.projectId) {
|
|
18144
|
+
attempted.push("project");
|
|
18145
|
+
const row = await resolveAtScope(requirement.key, "project", scoped.projectId, consumer);
|
|
18146
|
+
if (row) return resolveInstanceValue(row, requirement, materialBackend);
|
|
18147
|
+
}
|
|
18148
|
+
if (scoped.orgId) {
|
|
18149
|
+
attempted.push("organization");
|
|
18150
|
+
const row = await resolveAtScope(requirement.key, "organization", scoped.orgId, consumer);
|
|
18158
18151
|
if (row) return resolveInstanceValue(row, requirement, materialBackend);
|
|
18159
18152
|
}
|
|
18160
18153
|
throw new MissingCredentialsError({
|
|
18161
18154
|
key: requirement.key,
|
|
18162
|
-
chainAttempted,
|
|
18155
|
+
chainAttempted: attempted,
|
|
18163
18156
|
consumer
|
|
18164
18157
|
});
|
|
18165
18158
|
}
|
|
@@ -18285,4 +18278,4 @@ async function resolveActionCredentials(requirements, options) {
|
|
|
18285
18278
|
//#endregion
|
|
18286
18279
|
export { createFetchWithInit as A, connectMcpStdio as C, UnauthorizedError as D, createParser as E, zodToJsonSchema as M, JSONRPCMessageSchema as N, auth as O, connectMcpServer as S, isMcp as T, captureConsole as _, resolveActionCredentials as a, withSpan as b, addAgentSessionDuration as c, getAgentByRoute as d, getSession as f, touchSession as g, resolveRunSourceFromTraceContext as h, isCredentialError as i, normalizeHeaders as j, extractWWWAuthenticateParams as k, appendEvent as l, recordLlmUsageFromAssistantMessage as m, captureCredentialToolErrors as n, resolveMcpTools as o, listMessageEvents as p, createCredentialResolver as r, MESSAGE_EVENT_TYPE as s, buildCredentialRunContext as t, createSession as u, getTraceContext as v, defineMcp as w, connectMcpDefinition as x, logSystem as y };
|
|
18287
18280
|
|
|
18288
|
-
//# sourceMappingURL=dist-
|
|
18281
|
+
//# sourceMappingURL=dist-itGeZOJp.mjs.map
|