@keystrokehq/keystroke 0.0.137 → 0.0.139

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.
Files changed (49) hide show
  1. package/dist/action.cjs +1 -1
  2. package/dist/action.mjs +1 -1
  3. package/dist/agent.cjs +6 -6
  4. package/dist/agent.cjs.map +1 -1
  5. package/dist/agent.d.cts +1 -1
  6. package/dist/agent.d.mts +1 -1
  7. package/dist/agent.mjs +6 -6
  8. package/dist/agent.mjs.map +1 -1
  9. package/dist/credentials.cjs +1 -1
  10. package/dist/credentials.mjs +1 -1
  11. package/dist/{dist-BmlK40ac.mjs → dist-BNQqTOFy.mjs} +3 -3
  12. package/dist/{dist-BmlK40ac.mjs.map → dist-BNQqTOFy.mjs.map} +1 -1
  13. package/dist/{dist-26JT3ARI.mjs → dist-BdWFNOUY.mjs} +188 -7
  14. package/dist/dist-BdWFNOUY.mjs.map +1 -0
  15. package/dist/{dist-Bzx9Br-Y.cjs → dist-CTrlIh_f.cjs} +188 -7
  16. package/dist/dist-CTrlIh_f.cjs.map +1 -0
  17. package/dist/{dist-DaFIPOqy.cjs → dist-CnMZ1hvK.cjs} +17 -15
  18. package/dist/dist-CnMZ1hvK.cjs.map +1 -0
  19. package/dist/{dist-Cuo_rQCC.mjs → dist-CtNtlPF1.mjs} +17 -15
  20. package/dist/dist-CtNtlPF1.mjs.map +1 -0
  21. package/dist/{dist-DKbeiwQK.cjs → dist-Dr0pndoF.cjs} +3 -3
  22. package/dist/{dist-DKbeiwQK.cjs.map → dist-Dr0pndoF.cjs.map} +1 -1
  23. package/dist/{index-BrCBKmB8.d.cts → index-COm9NdJ2.d.cts} +4 -2
  24. package/dist/index-COm9NdJ2.d.cts.map +1 -0
  25. package/dist/index-CiuCYKLw.d.cts.map +1 -1
  26. package/dist/index-CiuCYKLw.d.mts.map +1 -1
  27. package/dist/{index-Bcr_vyxW.d.mts → index-D-CtqeAA.d.mts} +4 -2
  28. package/dist/index-D-CtqeAA.d.mts.map +1 -0
  29. package/dist/{mistral-Cvz-UV1E.cjs → mistral-C8BLCSQV.cjs} +2 -2
  30. package/dist/{mistral-Cvz-UV1E.cjs.map → mistral-C8BLCSQV.cjs.map} +1 -1
  31. package/dist/{mistral-CJDAC1s2.mjs → mistral-yyEKTPq_.mjs} +2 -2
  32. package/dist/{mistral-CJDAC1s2.mjs.map → mistral-yyEKTPq_.mjs.map} +1 -1
  33. package/dist/{sse-2is8NCgv.mjs → sse-CZB6IpEJ.mjs} +2 -2
  34. package/dist/{sse-2is8NCgv.mjs.map → sse-CZB6IpEJ.mjs.map} +1 -1
  35. package/dist/{sse-DaiJ8bd6.cjs → sse-Q-62VwSM.cjs} +2 -2
  36. package/dist/{sse-DaiJ8bd6.cjs.map → sse-Q-62VwSM.cjs.map} +1 -1
  37. package/dist/trigger.cjs +1 -1
  38. package/dist/trigger.d.cts +1 -1
  39. package/dist/trigger.d.mts +1 -1
  40. package/dist/trigger.mjs +1 -1
  41. package/dist/workflow.cjs +1 -1
  42. package/dist/workflow.mjs +1 -1
  43. package/package.json +2 -5
  44. package/dist/dist-26JT3ARI.mjs.map +0 -1
  45. package/dist/dist-Bzx9Br-Y.cjs.map +0 -1
  46. package/dist/dist-Cuo_rQCC.mjs.map +0 -1
  47. package/dist/dist-DaFIPOqy.cjs.map +0 -1
  48. package/dist/index-Bcr_vyxW.d.mts.map +0 -1
  49. package/dist/index-BrCBKmB8.d.cts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { Bn as __require, Ln as __commonJSMin, Vn as __toESM } from "./dist-Dv44b9V1.mjs";
2
- import { h as CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE, x as normalizeCredentialList } from "./dist-26JT3ARI.mjs";
2
+ import { h as CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE, x as normalizeCredentialList } from "./dist-BdWFNOUY.mjs";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import "node:fs";
5
5
  import { ZodFirstPartyTypeKind } from "zod/v3";
@@ -8,13 +8,9 @@ import * as z$1 from "zod/v4";
8
8
  import { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID } from "node:crypto";
9
9
  import process$1 from "node:process";
10
10
  import { PassThrough } from "node:stream";
11
- import "pg";
12
11
  import "node:path";
13
- import "better-sqlite3";
14
12
  import "node:url";
15
13
  import "node:os";
16
- import "@aws-sdk/client-s3";
17
- import "@aws-sdk/s3-request-presigner";
18
14
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
19
15
  function isZ4Schema(s) {
20
16
  return !!s._zod;
@@ -13255,7 +13251,7 @@ async function connectMcpServer(name, options) {
13255
13251
  }
13256
13252
  async function createTransport(url, transport, requestInit, fetchImpl) {
13257
13253
  if (transport === "sse") {
13258
- const { SSEClientTransport } = await import("./sse-2is8NCgv.mjs");
13254
+ const { SSEClientTransport } = await import("./sse-CZB6IpEJ.mjs");
13259
13255
  return new SSEClientTransport(url, {
13260
13256
  requestInit,
13261
13257
  fetch: fetchImpl
@@ -16449,6 +16445,7 @@ const agentSessions = pgTable("agent_sessions", {
16449
16445
  sourceKind: text$1("source_kind").$type().notNull().default("api"),
16450
16446
  sourceId: text$1("source_id"),
16451
16447
  parentSpanId: text$1("parent_span_id"),
16448
+ ranByUserId: text$1("ran_by_user_id"),
16452
16449
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
16453
16450
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
16454
16451
  deletedAt: timestamp("deleted_at", { withTimezone: true })
@@ -16460,6 +16457,7 @@ const agentSessionsSqlite = sqliteTable("agent_sessions", {
16460
16457
  sourceKind: text("source_kind").$type().notNull().default("api"),
16461
16458
  sourceId: text("source_id"),
16462
16459
  parentSpanId: text("parent_span_id"),
16460
+ ranByUserId: text("ran_by_user_id"),
16463
16461
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
16464
16462
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
16465
16463
  deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
@@ -16583,6 +16581,7 @@ const workflowRuns = pgTable("workflow_runs", {
16583
16581
  parentSpanId: text$1("parent_span_id"),
16584
16582
  sourceKind: text$1("source_kind").$type().notNull().default("api"),
16585
16583
  sourceId: text$1("source_id"),
16584
+ ranByUserId: text$1("ran_by_user_id"),
16586
16585
  status: text$1("status").$type().notNull(),
16587
16586
  trigger: text$1("trigger").$type().notNull(),
16588
16587
  triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull(),
@@ -16603,6 +16602,7 @@ const workflowRunsSqlite = sqliteTable("workflow_runs", {
16603
16602
  parentSpanId: text("parent_span_id"),
16604
16603
  sourceKind: text("source_kind").$type().notNull().default("api"),
16605
16604
  sourceId: text("source_id"),
16605
+ ranByUserId: text("ran_by_user_id"),
16606
16606
  status: text("status").$type().notNull(),
16607
16607
  trigger: text("trigger").$type().notNull(),
16608
16608
  triggeredAt: integer("triggered_at", { mode: "timestamp_ms" }).notNull(),
@@ -17077,6 +17077,7 @@ async function insertAgentSession(values) {
17077
17077
  ...values,
17078
17078
  sourceKind: values.sourceKind ?? "api",
17079
17079
  sourceId: values.sourceId ?? null,
17080
+ ranByUserId: values.ranByUserId ?? null,
17080
17081
  projectId: projectScopeId()
17081
17082
  });
17082
17083
  }
@@ -17095,6 +17096,13 @@ async function insertAgentEvent(values) {
17095
17096
  async function listMessagePayloads(sessionId, messageEventType) {
17096
17097
  return (await getDb$1().select({ payload: agentEvents.payload }).from(agentEvents).innerJoin(agentSessions, eq(agentSessions.id, agentEvents.sessionId)).where(scopedAnd$1(agentSessions, eq(agentEvents.sessionId, sessionId), eq(agentEvents.eventType, messageEventType), isNull(agentEvents.deletedAt))).orderBy(asc(agentEvents.seq))).map((row) => row.payload);
17097
17098
  }
17099
+ const MESSAGE_EVENT_TYPE = "message";
17100
+ async function selectTraceSpanById(id) {
17101
+ const db = getDb$1();
17102
+ const rows = await db.select({ span: traceSpans }).from(traceSpans).leftJoin(workflowRuns, eq(workflowRuns.id, traceSpans.traceId)).leftJoin(triggerRuns, eq(triggerRuns.id, traceSpans.traceId)).leftJoin(agentSessions, eq(agentSessions.id, traceSpans.traceId)).where(and(eq(traceSpans.id, id), traceRootProjectScopeFilter())).limit(1);
17103
+ if (rows[0]) return rows[0].span;
17104
+ return (await db.select({ span: traceSpans }).from(traceSpans).leftJoin(workflowRuns, eq(workflowRuns.id, traceSpans.refId)).leftJoin(triggerRuns, eq(triggerRuns.id, traceSpans.refId)).leftJoin(agentSessions, eq(agentSessions.id, traceSpans.refId)).where(and(eq(traceSpans.id, id), traceRootProjectScopeFilter())).limit(1))[0]?.span;
17105
+ }
17098
17106
  /** Org/user credentials live once in the shared org database; project scope stays per-project. */
17099
17107
  function credentialScopeAnd(scopeType, ...conditions) {
17100
17108
  if (scopeType === "project") return scopedAnd$1(credentialInstances, ...conditions);
@@ -17114,12 +17122,6 @@ async function selectCredentialInstancesForScope$1(slug, scopeType, scopeId) {
17114
17122
  const scopeCondition = scopeId === null ? and(eq(credentialInstances.scopeType, scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, scopeType), eq(credentialInstances.scopeId, scopeId));
17115
17123
  return db.select().from(credentialInstances).where(credentialScopeAnd(scopeType, eq(credentialInstances.slug, slug), scopeCondition));
17116
17124
  }
17117
- async function selectTraceSpanById(id) {
17118
- const db = getDb$1();
17119
- const rows = await db.select({ span: traceSpans }).from(traceSpans).leftJoin(workflowRuns, eq(workflowRuns.id, traceSpans.traceId)).leftJoin(triggerRuns, eq(triggerRuns.id, traceSpans.traceId)).leftJoin(agentSessions, eq(agentSessions.id, traceSpans.traceId)).where(and(eq(traceSpans.id, id), traceRootProjectScopeFilter())).limit(1);
17120
- if (rows[0]) return rows[0].span;
17121
- return (await db.select({ span: traceSpans }).from(traceSpans).leftJoin(workflowRuns, eq(workflowRuns.id, traceSpans.refId)).leftJoin(triggerRuns, eq(triggerRuns.id, traceSpans.refId)).leftJoin(agentSessions, eq(agentSessions.id, traceSpans.refId)).where(and(eq(traceSpans.id, id), traceRootProjectScopeFilter())).limit(1))[0]?.span;
17122
- }
17123
17125
  function runSource(kind, id) {
17124
17126
  return {
17125
17127
  kind,
@@ -17160,8 +17162,7 @@ async function resolveRunSourceFromTraceContext() {
17160
17162
  async function getAgentByRoute(route) {
17161
17163
  return selectActiveAgentByRoute(route);
17162
17164
  }
17163
- const MESSAGE_EVENT_TYPE = "message";
17164
- async function createSession(agentId, id, source = runSource("api")) {
17165
+ async function createSession(agentId, id, source = runSource("api"), options) {
17165
17166
  const now = /* @__PURE__ */ new Date();
17166
17167
  const sessionId = id ?? crypto.randomUUID();
17167
17168
  await insertAgentSession({
@@ -17169,6 +17170,7 @@ async function createSession(agentId, id, source = runSource("api")) {
17169
17170
  agentId,
17170
17171
  sourceKind: source.kind,
17171
17172
  sourceId: source.id,
17173
+ ranByUserId: options?.ranByUserId ?? null,
17172
17174
  createdAt: now,
17173
17175
  updatedAt: now,
17174
17176
  deletedAt: null
@@ -18192,4 +18194,4 @@ async function resolveActionCredentials(requirements, options) {
18192
18194
  //#endregion
18193
18195
  export { zodToJsonSchema as A, isMcp as C, extractWWWAuthenticateParams as D, auth as E, createFetchWithInit as O, defineMcp as S, UnauthorizedError as T, logSystem as _, resolveActionCredentials as a, connectMcpServer as b, appendEvent as c, getSession as d, listMessageEvents as f, getTraceContext as g, captureConsole as h, isCredentialError as i, JSONRPCMessageSchema as j, normalizeHeaders as k, createSession as l, touchSession as m, captureCredentialToolErrors as n, resolveMcpTools as o, resolveRunSourceFromTraceContext as p, createCredentialResolver as r, MESSAGE_EVENT_TYPE as s, buildCredentialRunContext as t, getAgentByRoute as u, withSpan as v, createParser as w, connectMcpStdio as x, connectMcpDefinition as y };
18194
18196
 
18195
- //# sourceMappingURL=dist-Cuo_rQCC.mjs.map
18197
+ //# sourceMappingURL=dist-CtNtlPF1.mjs.map