@keystrokehq/keystroke 0.0.138 → 0.0.140

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 (47) 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-DkLDEVmh.mjs → dist-BNQqTOFy.mjs} +3 -3
  12. package/dist/{dist-DkLDEVmh.mjs.map → dist-BNQqTOFy.mjs.map} +1 -1
  13. package/dist/{dist-DRpkKWT3.mjs → dist-BdWFNOUY.mjs} +172 -2
  14. package/dist/dist-BdWFNOUY.mjs.map +1 -0
  15. package/dist/{dist-Do4-nLe3.cjs → dist-CTrlIh_f.cjs} +172 -2
  16. package/dist/dist-CTrlIh_f.cjs.map +1 -0
  17. package/dist/{dist-CsyntC4f.cjs → dist-CnMZ1hvK.cjs} +17 -11
  18. package/dist/{dist-CsyntC4f.cjs.map → dist-CnMZ1hvK.cjs.map} +1 -1
  19. package/dist/{dist-D2_PNNdg.mjs → dist-CtNtlPF1.mjs} +17 -11
  20. package/dist/{dist-D2_PNNdg.mjs.map → dist-CtNtlPF1.mjs.map} +1 -1
  21. package/dist/{dist-CsgSwVY2.cjs → dist-Dr0pndoF.cjs} +3 -3
  22. package/dist/{dist-CsgSwVY2.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-Doo1vAfq.cjs → mistral-C8BLCSQV.cjs} +2 -2
  30. package/dist/{mistral-Doo1vAfq.cjs.map → mistral-C8BLCSQV.cjs.map} +1 -1
  31. package/dist/{mistral-CU4sYriZ.mjs → mistral-yyEKTPq_.mjs} +2 -2
  32. package/dist/{mistral-CU4sYriZ.mjs.map → mistral-yyEKTPq_.mjs.map} +1 -1
  33. package/dist/{sse-DqD9H1Q3.mjs → sse-CZB6IpEJ.mjs} +2 -2
  34. package/dist/{sse-DqD9H1Q3.mjs.map → sse-CZB6IpEJ.mjs.map} +1 -1
  35. package/dist/{sse-vcZK__fp.cjs → sse-Q-62VwSM.cjs} +2 -2
  36. package/dist/{sse-vcZK__fp.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 +1 -1
  44. package/dist/dist-DRpkKWT3.mjs.map +0 -1
  45. package/dist/dist-Do4-nLe3.cjs.map +0 -1
  46. package/dist/index-Bcr_vyxW.d.mts.map +0 -1
  47. 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-DRpkKWT3.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";
@@ -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-DqD9H1Q3.mjs");
13254
+ const { SSEClientTransport } = await import("./sse-CZB6IpEJ.mjs");
13255
13255
  return new SSEClientTransport(url, {
13256
13256
  requestInit,
13257
13257
  fetch: fetchImpl
@@ -16445,6 +16445,7 @@ const agentSessions = pgTable("agent_sessions", {
16445
16445
  sourceKind: text$1("source_kind").$type().notNull().default("api"),
16446
16446
  sourceId: text$1("source_id"),
16447
16447
  parentSpanId: text$1("parent_span_id"),
16448
+ ranByUserId: text$1("ran_by_user_id"),
16448
16449
  createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
16449
16450
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
16450
16451
  deletedAt: timestamp("deleted_at", { withTimezone: true })
@@ -16456,6 +16457,7 @@ const agentSessionsSqlite = sqliteTable("agent_sessions", {
16456
16457
  sourceKind: text("source_kind").$type().notNull().default("api"),
16457
16458
  sourceId: text("source_id"),
16458
16459
  parentSpanId: text("parent_span_id"),
16460
+ ranByUserId: text("ran_by_user_id"),
16459
16461
  createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull(),
16460
16462
  updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
16461
16463
  deletedAt: integer("deleted_at", { mode: "timestamp_ms" })
@@ -16579,6 +16581,7 @@ const workflowRuns = pgTable("workflow_runs", {
16579
16581
  parentSpanId: text$1("parent_span_id"),
16580
16582
  sourceKind: text$1("source_kind").$type().notNull().default("api"),
16581
16583
  sourceId: text$1("source_id"),
16584
+ ranByUserId: text$1("ran_by_user_id"),
16582
16585
  status: text$1("status").$type().notNull(),
16583
16586
  trigger: text$1("trigger").$type().notNull(),
16584
16587
  triggeredAt: timestamp("triggered_at", { withTimezone: true }).notNull(),
@@ -16599,6 +16602,7 @@ const workflowRunsSqlite = sqliteTable("workflow_runs", {
16599
16602
  parentSpanId: text("parent_span_id"),
16600
16603
  sourceKind: text("source_kind").$type().notNull().default("api"),
16601
16604
  sourceId: text("source_id"),
16605
+ ranByUserId: text("ran_by_user_id"),
16602
16606
  status: text("status").$type().notNull(),
16603
16607
  trigger: text("trigger").$type().notNull(),
16604
16608
  triggeredAt: integer("triggered_at", { mode: "timestamp_ms" }).notNull(),
@@ -17073,6 +17077,7 @@ async function insertAgentSession(values) {
17073
17077
  ...values,
17074
17078
  sourceKind: values.sourceKind ?? "api",
17075
17079
  sourceId: values.sourceId ?? null,
17080
+ ranByUserId: values.ranByUserId ?? null,
17076
17081
  projectId: projectScopeId()
17077
17082
  });
17078
17083
  }
@@ -17091,6 +17096,13 @@ async function insertAgentEvent(values) {
17091
17096
  async function listMessagePayloads(sessionId, messageEventType) {
17092
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);
17093
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
+ }
17094
17106
  /** Org/user credentials live once in the shared org database; project scope stays per-project. */
17095
17107
  function credentialScopeAnd(scopeType, ...conditions) {
17096
17108
  if (scopeType === "project") return scopedAnd$1(credentialInstances, ...conditions);
@@ -17110,12 +17122,6 @@ async function selectCredentialInstancesForScope$1(slug, scopeType, scopeId) {
17110
17122
  const scopeCondition = scopeId === null ? and(eq(credentialInstances.scopeType, scopeType), isNull(credentialInstances.scopeId)) : and(eq(credentialInstances.scopeType, scopeType), eq(credentialInstances.scopeId, scopeId));
17111
17123
  return db.select().from(credentialInstances).where(credentialScopeAnd(scopeType, eq(credentialInstances.slug, slug), scopeCondition));
17112
17124
  }
17113
- async function selectTraceSpanById(id) {
17114
- const db = getDb$1();
17115
- 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);
17116
- if (rows[0]) return rows[0].span;
17117
- 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;
17118
- }
17119
17125
  function runSource(kind, id) {
17120
17126
  return {
17121
17127
  kind,
@@ -17156,8 +17162,7 @@ async function resolveRunSourceFromTraceContext() {
17156
17162
  async function getAgentByRoute(route) {
17157
17163
  return selectActiveAgentByRoute(route);
17158
17164
  }
17159
- const MESSAGE_EVENT_TYPE = "message";
17160
- async function createSession(agentId, id, source = runSource("api")) {
17165
+ async function createSession(agentId, id, source = runSource("api"), options) {
17161
17166
  const now = /* @__PURE__ */ new Date();
17162
17167
  const sessionId = id ?? crypto.randomUUID();
17163
17168
  await insertAgentSession({
@@ -17165,6 +17170,7 @@ async function createSession(agentId, id, source = runSource("api")) {
17165
17170
  agentId,
17166
17171
  sourceKind: source.kind,
17167
17172
  sourceId: source.id,
17173
+ ranByUserId: options?.ranByUserId ?? null,
17168
17174
  createdAt: now,
17169
17175
  updatedAt: now,
17170
17176
  deletedAt: null
@@ -18188,4 +18194,4 @@ async function resolveActionCredentials(requirements, options) {
18188
18194
  //#endregion
18189
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 };
18190
18196
 
18191
- //# sourceMappingURL=dist-D2_PNNdg.mjs.map
18197
+ //# sourceMappingURL=dist-CtNtlPF1.mjs.map