@keystrokehq/keystroke 0.0.54 → 0.0.56

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 (33) hide show
  1. package/dist/action.cjs +1 -1
  2. package/dist/action.mjs +1 -1
  3. package/dist/agent.cjs +3 -3
  4. package/dist/agent.mjs +3 -3
  5. package/dist/credentials.cjs +1 -1
  6. package/dist/credentials.mjs +1 -1
  7. package/dist/{dist-BEXGA30k.cjs → dist-BPbk55m-.cjs} +1 -2
  8. package/dist/dist-BPbk55m-.cjs.map +1 -0
  9. package/dist/{dist-DUjxQlqZ.cjs → dist-BcS5RYgX.cjs} +3 -3
  10. package/dist/{dist-DUjxQlqZ.cjs.map → dist-BcS5RYgX.cjs.map} +1 -1
  11. package/dist/{dist-CT9m3EP4.cjs → dist-BkXl9gQF.cjs} +3 -3
  12. package/dist/{dist-CT9m3EP4.cjs.map → dist-BkXl9gQF.cjs.map} +1 -1
  13. package/dist/{dist-CXHSlVhd.mjs → dist-Bt-d5yhn.mjs} +3 -3
  14. package/dist/{dist-CXHSlVhd.mjs.map → dist-Bt-d5yhn.mjs.map} +1 -1
  15. package/dist/{dist-CSBkgefj.mjs → dist-BxHP5hXz.mjs} +1 -2
  16. package/dist/dist-BxHP5hXz.mjs.map +1 -0
  17. package/dist/{dist-CJA_sYaQ.mjs → dist-SRdmqD5M.mjs} +3 -3
  18. package/dist/{dist-CJA_sYaQ.mjs.map → dist-SRdmqD5M.mjs.map} +1 -1
  19. package/dist/{mistral-B75PpahY.mjs → mistral-DAR1MPzS.mjs} +2 -2
  20. package/dist/{mistral-B75PpahY.mjs.map → mistral-DAR1MPzS.mjs.map} +1 -1
  21. package/dist/{mistral-Dw8mh09I.cjs → mistral-DZaYJXpM.cjs} +2 -2
  22. package/dist/{mistral-Dw8mh09I.cjs.map → mistral-DZaYJXpM.cjs.map} +1 -1
  23. package/dist/{sse-CHTxH40f.mjs → sse-BjtIZJyR.mjs} +2 -2
  24. package/dist/{sse-CHTxH40f.mjs.map → sse-BjtIZJyR.mjs.map} +1 -1
  25. package/dist/{sse-CbwhLQFm.cjs → sse-Cd5tB78r.cjs} +2 -2
  26. package/dist/{sse-CbwhLQFm.cjs.map → sse-Cd5tB78r.cjs.map} +1 -1
  27. package/dist/trigger.cjs +1 -1
  28. package/dist/trigger.mjs +1 -1
  29. package/dist/workflow.cjs +1 -1
  30. package/dist/workflow.mjs +1 -1
  31. package/package.json +6 -6
  32. package/dist/dist-BEXGA30k.cjs.map +0 -1
  33. package/dist/dist-CSBkgefj.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_dist = require("./dist-C7Fgk61q.cjs");
2
- const require_dist$1 = require("./dist-BEXGA30k.cjs");
3
- const require_dist$2 = require("./dist-DUjxQlqZ.cjs");
2
+ const require_dist$1 = require("./dist-BPbk55m-.cjs");
3
+ const require_dist$2 = require("./dist-BcS5RYgX.cjs");
4
4
  let zod = require("zod");
5
5
  let node_async_hooks = require("node:async_hooks");
6
6
  //#region ../workflow/dist/index.mjs
@@ -174,4 +174,4 @@ Object.defineProperty(exports, "isWorkflow", {
174
174
  }
175
175
  });
176
176
 
177
- //# sourceMappingURL=dist-CT9m3EP4.cjs.map
177
+ //# sourceMappingURL=dist-BkXl9gQF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dist-CT9m3EP4.cjs","names":["z","SandboxDefinitionSchema","normalizeCredentialList","withSpan","logSystem","captureConsole","getActionCredentialRequirements","executeAction","resolveActionCredentials","AsyncLocalStorage","registerWorkflowRunGetter","getTraceContext"],"sources":["../../workflow/dist/index.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { SandboxDefinitionSchema } from \"@keystrokehq/sandbox\";\nimport { captureConsole, getTraceContext, logSystem, withSpan } from \"@keystrokehq/tracing\";\nimport { executeAction, getActionCredentialRequirements, normalizeCredentialList, registerWorkflowRunGetter } from \"@keystrokehq/action\";\nimport { resolveActionCredentials } from \"@keystrokehq/credentials\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n//#region src/workflow-definition.ts\nconst zodSchema = z.custom((v) => v instanceof z.ZodType, \"must be a Zod schema\");\n/** Runtime validation for an unbranded workflow definition. */\nconst workflowCoreSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tname: z.string().optional(),\n\tdescription: z.string().optional(),\n\tsubscription: z.object({ mode: z.enum([\"system\", \"subscribable\"]).optional() }).optional(),\n\tsandbox: SandboxDefinitionSchema.optional(),\n\tinput: zodSchema,\n\toutput: zodSchema,\n\trun: z.function()\n});\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\n/**\n* Validates brand + shape via `workflowCoreSchema` so discovery and guards\n* reject malformed definitions.\n*/\nfunction isWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\treturn workflowCoreSchema.safeParse(value).success;\n}\n//#endregion\n//#region src/define-workflow.ts\nfunction defineWorkflow(def) {\n\tconst result = workflowCoreSchema.safeParse(def);\n\tif (!result.success) throw new Error(`Invalid workflow definition: ${formatIssues(result.error.issues)}`);\n\treturn {\n\t\t...result.data,\n\t\t[WORKFLOW]: true\n\t};\n}\nfunction formatIssues(issues) {\n\treturn issues.map((issue) => {\n\t\treturn `${issue.path.length > 0 ? `${issue.path.join(\".\")}: ` : \"\"}${issue.message}`;\n\t}).join(\"; \");\n}\n//#endregion\n//#region src/create-action-runner.ts\nfunction withCredentialChainOverride(requirements, chain) {\n\tif (!requirements || !chain) return requirements;\n\treturn normalizeCredentialList(requirements).map((requirement) => ({\n\t\t...requirement,\n\t\tchain\n\t}));\n}\nfunction createActionRunner(store, runId, options = {}) {\n\treturn async (action, input, runOptions) => {\n\t\tconst actionKey = runOptions?.id ?? action.key;\n\t\tconst cached = await store.get(runId, actionKey);\n\t\tif (cached !== void 0) {\n\t\t\tawait withSpan({\n\t\t\t\tkind: \"action\",\n\t\t\t\tname: actionKey,\n\t\t\t\trefId: `${runId}:${actionKey}`,\n\t\t\t\tmetadata: {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey,\n\t\t\t\t\treplayed: true\n\t\t\t\t}\n\t\t\t}, async () => {\n\t\t\t\tawait logSystem(\"info\", \"action replayed from checkpoint\", {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn action.output.parse(cached);\n\t\t}\n\t\treturn withSpan({\n\t\t\tkind: \"action\",\n\t\t\tname: actionKey,\n\t\t\trefId: `${runId}:${actionKey}`,\n\t\t\tmetadata: {\n\t\t\t\trunId,\n\t\t\t\tactionKey\n\t\t\t}\n\t\t}, async () => captureConsole(async () => {\n\t\t\tconst requirements = withCredentialChainOverride(getActionCredentialRequirements(action), runOptions?.credentialChain);\n\t\t\tconst contextOverride = runOptions?.credentialSelection ? { selection: runOptions.credentialSelection } : void 0;\n\t\t\tconst validatedOutput = await executeAction(action, input, requirements?.length ? await resolveActionCredentials(requirements, {\n\t\t\t\tresolveCredentials: options.resolveCredentials,\n\t\t\t\tcontext: options.credentialContext,\n\t\t\t\toauthAdapter: options.oauthAdapter,\n\t\t\t\tconsumer: {\n\t\t\t\t\tkind: \"action\",\n\t\t\t\t\tname: action.key\n\t\t\t\t},\n\t\t\t\tcontextOverride\n\t\t\t}) : {});\n\t\t\tawait store.set(runId, actionKey, validatedOutput);\n\t\t\treturn validatedOutput;\n\t\t}));\n\t};\n}\n//#endregion\n//#region src/memory-action-store.ts\nvar MemoryActionStore = class {\n\trecords = /* @__PURE__ */ new Map();\n\tkey(runId, actionKey) {\n\t\treturn `${runId}:${actionKey}`;\n\t}\n\tasync get(runId, actionKey) {\n\t\treturn this.records.get(this.key(runId, actionKey));\n\t}\n\tasync set(runId, actionKey, output) {\n\t\tthis.records.set(this.key(runId, actionKey), output);\n\t}\n};\n//#endregion\n//#region src/run-context.ts\nconst storage = new AsyncLocalStorage();\nregisterWorkflowRunGetter(() => {\n\tconst store = storage.getStore();\n\tif (!store) return;\n\treturn { actionRunner: store.actionRunner };\n});\nfunction runWithWorkflowContext(store, fn) {\n\treturn storage.run(store, fn);\n}\n//#endregion\n//#region src/execute-workflow.ts\nasync function runWorkflowBody(workflow, validatedInput, ctx, actionRunner) {\n\treturn runWithWorkflowContext({\n\t\tactionRunner,\n\t\trunId: ctx.runId\n\t}, () => captureConsole(async () => workflow.run(validatedInput, ctx)));\n}\nasync function executeWorkflow(workflow, input, options = {}) {\n\tconst runId = options.runId ?? crypto.randomUUID();\n\tconst actionRunner = createActionRunner(options.actionStore ?? options.actionStoreFactory?.() ?? new MemoryActionStore(), runId, {\n\t\tresolveCredentials: options.resolveCredentials,\n\t\tcredentialContext: options.credentialContext,\n\t\toauthAdapter: options.oauthAdapter\n\t});\n\tconst validatedInput = workflow.input.parse(input);\n\tconst ctx = {\n\t\trunId,\n\t\t...options.context\n\t};\n\tif (options.skipWorkflowSpan) return workflow.output.parse(await runWorkflowBody(workflow, validatedInput, ctx, actionRunner));\n\tconst parent = getTraceContext();\n\tconst output = await withSpan({\n\t\tkind: \"workflow_run\",\n\t\tname: workflow.key,\n\t\trefId: runId,\n\t\ttraceId: parent?.traceId ?? runId,\n\t\tmetadata: {\n\t\t\tworkflowKey: workflow.key,\n\t\t\ttrigger: options.context?.trigger ?? \"api\",\n\t\t\t...options.workflowSpanMetadata\n\t\t}\n\t}, () => runWorkflowBody(workflow, validatedInput, ctx, actionRunner));\n\treturn workflow.output.parse(output);\n}\n//#endregion\nexport { MemoryActionStore, defineWorkflow, executeWorkflow, isWorkflow };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;AAOA,MAAM,YAAYA,IAAAA,EAAE,QAAQ,MAAM,aAAaA,IAAAA,EAAE,SAAS,sBAAsB;;AAEhF,MAAM,qBAAqBA,IAAAA,EAAE,OAAO;CACnC,KAAKA,IAAAA,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC5B,MAAMA,IAAAA,EAAE,OAAO,EAAE,SAAS;CA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ialRequirements","executeAction","resolveActionCredentials","AsyncLocalStorage","registerWorkflowRunGetter","getTraceContext"],"sources":["../../workflow/dist/index.mjs"],"sourcesContent":["import { z } from \"zod\";\nimport { SandboxDefinitionSchema } from \"@keystrokehq/sandbox\";\nimport { captureConsole, getTraceContext, logSystem, withSpan } from \"@keystrokehq/tracing\";\nimport { executeAction, getActionCredentialRequirements, normalizeCredentialList, registerWorkflowRunGetter } from \"@keystrokehq/action\";\nimport { resolveActionCredentials } from \"@keystrokehq/credentials\";\nimport { AsyncLocalStorage } from \"node:async_hooks\";\n//#region src/workflow-definition.ts\nconst zodSchema = z.custom((v) => v instanceof z.ZodType, \"must be a Zod schema\");\n/** Runtime validation for an unbranded workflow definition. */\nconst workflowCoreSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tname: z.string().optional(),\n\tdescription: z.string().optional(),\n\tsubscription: z.object({ mode: z.enum([\"system\", \"subscribable\"]).optional() }).optional(),\n\tsandbox: SandboxDefinitionSchema.optional(),\n\tinput: zodSchema,\n\toutput: zodSchema,\n\trun: z.function()\n});\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\n/**\n* Validates brand + shape via `workflowCoreSchema` so discovery and guards\n* reject malformed definitions.\n*/\nfunction isWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\treturn workflowCoreSchema.safeParse(value).success;\n}\n//#endregion\n//#region src/define-workflow.ts\nfunction defineWorkflow(def) {\n\tconst result = workflowCoreSchema.safeParse(def);\n\tif (!result.success) throw new Error(`Invalid workflow definition: ${formatIssues(result.error.issues)}`);\n\treturn {\n\t\t...result.data,\n\t\t[WORKFLOW]: true\n\t};\n}\nfunction formatIssues(issues) {\n\treturn issues.map((issue) => {\n\t\treturn `${issue.path.length > 0 ? `${issue.path.join(\".\")}: ` : \"\"}${issue.message}`;\n\t}).join(\"; \");\n}\n//#endregion\n//#region src/create-action-runner.ts\nfunction withCredentialChainOverride(requirements, chain) {\n\tif (!requirements || !chain) return requirements;\n\treturn normalizeCredentialList(requirements).map((requirement) => ({\n\t\t...requirement,\n\t\tchain\n\t}));\n}\nfunction createActionRunner(store, runId, options = {}) {\n\treturn async (action, input, runOptions) => {\n\t\tconst actionKey = runOptions?.id ?? action.key;\n\t\tconst cached = await store.get(runId, actionKey);\n\t\tif (cached !== void 0) {\n\t\t\tawait withSpan({\n\t\t\t\tkind: \"action\",\n\t\t\t\tname: actionKey,\n\t\t\t\trefId: `${runId}:${actionKey}`,\n\t\t\t\tmetadata: {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey,\n\t\t\t\t\treplayed: true\n\t\t\t\t}\n\t\t\t}, async () => {\n\t\t\t\tawait logSystem(\"info\", \"action replayed from checkpoint\", {\n\t\t\t\t\trunId,\n\t\t\t\t\tactionKey\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn action.output.parse(cached);\n\t\t}\n\t\treturn withSpan({\n\t\t\tkind: \"action\",\n\t\t\tname: actionKey,\n\t\t\trefId: `${runId}:${actionKey}`,\n\t\t\tmetadata: {\n\t\t\t\trunId,\n\t\t\t\tactionKey\n\t\t\t}\n\t\t}, async () => captureConsole(async () => {\n\t\t\tconst requirements = withCredentialChainOverride(getActionCredentialRequirements(action), runOptions?.credentialChain);\n\t\t\tconst contextOverride = runOptions?.credentialSelection ? { selection: runOptions.credentialSelection } : void 0;\n\t\t\tconst validatedOutput = await executeAction(action, input, requirements?.length ? await resolveActionCredentials(requirements, {\n\t\t\t\tresolveCredentials: options.resolveCredentials,\n\t\t\t\tcontext: options.credentialContext,\n\t\t\t\toauthAdapter: options.oauthAdapter,\n\t\t\t\tconsumer: {\n\t\t\t\t\tkind: \"action\",\n\t\t\t\t\tname: action.key\n\t\t\t\t},\n\t\t\t\tcontextOverride\n\t\t\t}) : {});\n\t\t\tawait store.set(runId, actionKey, validatedOutput);\n\t\t\treturn validatedOutput;\n\t\t}));\n\t};\n}\n//#endregion\n//#region src/memory-action-store.ts\nvar MemoryActionStore = class {\n\trecords = /* @__PURE__ */ new Map();\n\tkey(runId, actionKey) {\n\t\treturn `${runId}:${actionKey}`;\n\t}\n\tasync get(runId, actionKey) {\n\t\treturn this.records.get(this.key(runId, actionKey));\n\t}\n\tasync set(runId, actionKey, output) {\n\t\tthis.records.set(this.key(runId, actionKey), output);\n\t}\n};\n//#endregion\n//#region src/run-context.ts\nconst storage = new AsyncLocalStorage();\nregisterWorkflowRunGetter(() => {\n\tconst store = storage.getStore();\n\tif (!store) return;\n\treturn { actionRunner: store.actionRunner };\n});\nfunction runWithWorkflowContext(store, fn) {\n\treturn storage.run(store, fn);\n}\n//#endregion\n//#region src/execute-workflow.ts\nasync function runWorkflowBody(workflow, validatedInput, ctx, actionRunner) {\n\treturn runWithWorkflowContext({\n\t\tactionRunner,\n\t\trunId: ctx.runId\n\t}, () => captureConsole(async () => workflow.run(validatedInput, ctx)));\n}\nasync function executeWorkflow(workflow, input, options = {}) {\n\tconst runId = options.runId ?? crypto.randomUUID();\n\tconst actionRunner = createActionRunner(options.actionStore ?? options.actionStoreFactory?.() ?? new MemoryActionStore(), runId, {\n\t\tresolveCredentials: options.resolveCredentials,\n\t\tcredentialContext: options.credentialContext,\n\t\toauthAdapter: options.oauthAdapter\n\t});\n\tconst validatedInput = workflow.input.parse(input);\n\tconst ctx = {\n\t\trunId,\n\t\t...options.context\n\t};\n\tif (options.skipWorkflowSpan) return workflow.output.parse(await runWorkflowBody(workflow, validatedInput, ctx, actionRunner));\n\tconst parent = getTraceContext();\n\tconst output = await withSpan({\n\t\tkind: \"workflow_run\",\n\t\tname: workflow.key,\n\t\trefId: runId,\n\t\ttraceId: parent?.traceId ?? runId,\n\t\tmetadata: {\n\t\t\tworkflowKey: workflow.key,\n\t\t\ttrigger: options.context?.trigger ?? \"api\",\n\t\t\t...options.workflowSpanMetadata\n\t\t}\n\t}, () => runWorkflowBody(workflow, validatedInput, ctx, actionRunner));\n\treturn workflow.output.parse(output);\n}\n//#endregion\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SAAS;EACf,OAAO;EACP,SAAS,QAAQ,WAAW;EAC5B,UAAU;GACT,aAAa,SAAS;GACtB,SAAS,QAAQ,SAAS,WAAW;GACrC,GAAG,QAAQ;EACZ;CACD,SAAS,gBAAgB,UAAU,gBAAgB,KAAK,YAAY,CAAC;CACrE,OAAO,SAAS,OAAO,MAAM,MAAM;AACpC"}
@@ -1,5 +1,5 @@
1
1
  import { Bn as __require, Ln as __commonJSMin, Vn as __toESM } from "./dist-PFUo6XmY.mjs";
2
- import { b as normalizeCredentialList, m as CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE } from "./dist-CSBkgefj.mjs";
2
+ import { b as normalizeCredentialList, m as CREDENTIAL_SCOPE_LEVEL_TO_SCOPE_TYPE } from "./dist-BxHP5hXz.mjs";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import "node:fs";
5
5
  import { ZodFirstPartyTypeKind } from "zod/v3";
@@ -13252,7 +13252,7 @@ async function connectMcpServer(name, options) {
13252
13252
  }
13253
13253
  async function createTransport(url, transport, requestInit, fetchImpl) {
13254
13254
  if (transport === "sse") {
13255
- const { SSEClientTransport } = await import("./sse-CHTxH40f.mjs");
13255
+ const { SSEClientTransport } = await import("./sse-BjtIZJyR.mjs");
13256
13256
  return new SSEClientTransport(url, {
13257
13257
  requestInit,
13258
13258
  fetch: fetchImpl
@@ -18006,4 +18006,4 @@ async function withSpan(input, fn) {
18006
18006
  //#endregion
18007
18007
  export { JSONRPCMessageSchema as A, createParser as C, createFetchWithInit as D, extractWWWAuthenticateParams as E, normalizeHeaders as O, isMcp as S, auth as T, touchSession as _, buildCredentialRunContext as a, connectMcpStdio as b, isCredentialError as c, MESSAGE_EVENT_TYPE as d, appendEvent as f, listMessageEvents as g, getSession as h, withSpan as i, zodToJsonSchema as k, resolveActionCredentials as l, getAgentByRoute as m, getTraceContext as n, captureCredentialToolErrors as o, createSession as p, logSystem as r, createCredentialResolver as s, captureConsole as t, resolveMcpTools as u, connectMcpDefinition as v, UnauthorizedError as w, defineMcp as x, connectMcpServer as y };
18008
18008
 
18009
- //# sourceMappingURL=dist-CXHSlVhd.mjs.map
18009
+ //# sourceMappingURL=dist-Bt-d5yhn.mjs.map