@keystrokehq/keystroke 0.0.174 → 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.
Files changed (75) hide show
  1. package/dist/action.cjs +1 -1
  2. package/dist/action.d.cts +2 -2
  3. package/dist/action.d.mts +2 -2
  4. package/dist/action.mjs +1 -1
  5. package/dist/agent.cjs +3 -3
  6. package/dist/agent.d.cts +2 -2
  7. package/dist/agent.d.mts +2 -2
  8. package/dist/agent.mjs +3 -3
  9. package/dist/app.cjs +11 -47
  10. package/dist/app.cjs.map +1 -1
  11. package/dist/app.d.cts +36 -42
  12. package/dist/app.d.cts.map +1 -1
  13. package/dist/app.d.mts +36 -42
  14. package/dist/app.d.mts.map +1 -1
  15. package/dist/app.mjs +11 -47
  16. package/dist/app.mjs.map +1 -1
  17. package/dist/config.d.cts +1 -1
  18. package/dist/config.d.mts +1 -1
  19. package/dist/credentials.cjs +1 -1
  20. package/dist/credentials.d.cts +1 -1
  21. package/dist/credentials.d.mts +1 -1
  22. package/dist/credentials.mjs +1 -1
  23. package/dist/{dist-DEwBt6Ee.cjs → dist-B3WT5qgl.cjs} +35 -2
  24. package/dist/dist-B3WT5qgl.cjs.map +1 -0
  25. package/dist/{dist-g-XZ7Tbo.mjs → dist-BwuyO3oY.mjs} +3 -3
  26. package/dist/{dist-g-XZ7Tbo.mjs.map → dist-BwuyO3oY.mjs.map} +1 -1
  27. package/dist/{dist-BLADLFrG.cjs → dist-CIhk3fW1.cjs} +18 -3
  28. package/dist/{dist-BLADLFrG.cjs.map → dist-CIhk3fW1.cjs.map} +1 -1
  29. package/dist/{dist-CFy63Npi.mjs → dist-DgjcBE-O.mjs} +35 -2
  30. package/dist/dist-DgjcBE-O.mjs.map +1 -0
  31. package/dist/{dist-BX0Upt63.mjs → dist-itGeZOJp.mjs} +18 -3
  32. package/dist/{dist-BX0Upt63.mjs.map → dist-itGeZOJp.mjs.map} +1 -1
  33. package/dist/{dist-Bwkl4vwe.cjs → dist-tKIYuAek.cjs} +3 -3
  34. package/dist/{dist-Bwkl4vwe.cjs.map → dist-tKIYuAek.cjs.map} +1 -1
  35. package/dist/{index-DT9Ml-7N.d.mts → index-CPCPd4hJ.d.cts} +2 -2
  36. package/dist/{index-CDWAJRJD.d.cts.map → index-CPCPd4hJ.d.cts.map} +1 -1
  37. package/dist/{index-CDWAJRJD.d.cts → index-Cn6nUPtC.d.mts} +2 -2
  38. package/dist/{index-DT9Ml-7N.d.mts.map → index-Cn6nUPtC.d.mts.map} +1 -1
  39. package/dist/{index-CUYwOWCh.d.cts → index-DQfGP5X4.d.cts} +4 -4
  40. package/dist/{index-DPyUP9U_.d.mts.map → index-DQfGP5X4.d.cts.map} +1 -1
  41. package/dist/{index-DjLUdkRo.d.cts → index-DpOXmY3P.d.cts} +2 -2
  42. package/dist/{index-B8ZRIgPK.d.mts.map → index-DpOXmY3P.d.cts.map} +1 -1
  43. package/dist/{index-B8ZRIgPK.d.mts → index-DsDxuNfg.d.mts} +2 -2
  44. package/dist/{index-DjLUdkRo.d.cts.map → index-DsDxuNfg.d.mts.map} +1 -1
  45. package/dist/{index-CITVigQS.d.mts → index-DykbAIg-.d.mts} +2 -2
  46. package/dist/{index-CITVigQS.d.mts.map → index-DykbAIg-.d.mts.map} +1 -1
  47. package/dist/{index-DPyUP9U_.d.mts → index-VCi-jUnh.d.mts} +4 -4
  48. package/dist/{index-CUYwOWCh.d.cts.map → index-VCi-jUnh.d.mts.map} +1 -1
  49. package/dist/{index-hf0OTB6M.d.mts → index-e9f4pcX4.d.cts} +2 -2
  50. package/dist/index-e9f4pcX4.d.cts.map +1 -0
  51. package/dist/{index-hf0OTB6M.d.cts → index-e9f4pcX4.d.mts} +2 -2
  52. package/dist/index-e9f4pcX4.d.mts.map +1 -0
  53. package/dist/{index-y_2btA4s.d.cts → index-nUAXCgEe.d.cts} +2 -2
  54. package/dist/{index-y_2btA4s.d.cts.map → index-nUAXCgEe.d.cts.map} +1 -1
  55. package/dist/{mistral-DbKZmAHf.mjs → mistral-MfzlP5Os.mjs} +2 -2
  56. package/dist/{mistral-DbKZmAHf.mjs.map → mistral-MfzlP5Os.mjs.map} +1 -1
  57. package/dist/{mistral-CC5EGzH4.cjs → mistral-gBakFlvh.cjs} +2 -2
  58. package/dist/{mistral-CC5EGzH4.cjs.map → mistral-gBakFlvh.cjs.map} +1 -1
  59. package/dist/{sse-DqYCbW54.mjs → sse-CFH10VfF.mjs} +2 -2
  60. package/dist/{sse-DqYCbW54.mjs.map → sse-CFH10VfF.mjs.map} +1 -1
  61. package/dist/{sse-dAxMgDEB.cjs → sse-CO21wkJ1.cjs} +2 -2
  62. package/dist/{sse-dAxMgDEB.cjs.map → sse-CO21wkJ1.cjs.map} +1 -1
  63. package/dist/trigger.cjs +1 -1
  64. package/dist/trigger.d.cts +3 -3
  65. package/dist/trigger.d.mts +3 -3
  66. package/dist/trigger.mjs +1 -1
  67. package/dist/workflow.cjs +1 -1
  68. package/dist/workflow.d.cts +2 -2
  69. package/dist/workflow.d.mts +2 -2
  70. package/dist/workflow.mjs +1 -1
  71. package/package.json +1 -1
  72. package/dist/dist-CFy63Npi.mjs.map +0 -1
  73. package/dist/dist-DEwBt6Ee.cjs.map +0 -1
  74. package/dist/index-hf0OTB6M.d.cts.map +0 -1
  75. package/dist/index-hf0OTB6M.d.mts.map +0 -1
package/dist/action.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-DEwBt6Ee.cjs");
2
+ const require_dist = require("./dist-B3WT5qgl.cjs");
3
3
  exports.CREDENTIAL_SCOPE_TYPES = require_dist.CREDENTIAL_SCOPE_TYPES;
4
4
  exports.actionCoreSchema = require_dist.actionCoreSchema;
5
5
  exports.createStepInvocation = require_dist.createStepInvocation;
package/dist/action.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-hf0OTB6M.cjs";
2
- import { C as runWithRunSignal, S as runOutsideActionExecution, _ as isAction, a as ResolveActionCredentialsFn, b as registerWorkflowRunGetter, c as WorkflowActionDefinition, d as createStepInvocation, f as defineAction, g as getWorkflowRunHandle, h as getRunSignal, i as AgentRunOptions, l as WorkflowRunHandle, m as getActionCredentialRequirements, n as ActionDefinition, o as ResolveActionToolOptions, p as executeAction, r as ActionDefinitionInput, s as StepInvocation, t as ActionCredentialConsumer, u as actionCoreSchema, v as isStepInvocation, w as runWithinActionExecution, x as resolveActionTool, y as isWithinActionExecution } from "./index-DjLUdkRo.cjs";
1
+ import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-e9f4pcX4.cjs";
2
+ import { C as runWithRunSignal, S as runOutsideActionExecution, _ as isAction, a as ResolveActionCredentialsFn, b as registerWorkflowRunGetter, c as WorkflowActionDefinition, d as createStepInvocation, f as defineAction, g as getWorkflowRunHandle, h as getRunSignal, i as AgentRunOptions, l as WorkflowRunHandle, m as getActionCredentialRequirements, n as ActionDefinition, o as ResolveActionToolOptions, p as executeAction, r as ActionDefinitionInput, s as StepInvocation, t as ActionCredentialConsumer, u as actionCoreSchema, v as isStepInvocation, w as runWithinActionExecution, x as resolveActionTool, y as isWithinActionExecution } from "./index-DpOXmY3P.cjs";
3
3
  export { type ActionCredentialConsumer, type ActionDefinition, type ActionDefinitionInput, type AgentRunOptions, CREDENTIAL_SCOPE_TYPES, type Credential, type CredentialAuthKind, type CredentialInput, type CredentialList, type CredentialRequirement, type CredentialScopeType, type DefineCredentialInput, type DefineOAuthCredentialInput, type DefineStaticCredentialInput, type NormalizeCredential, type ResolveActionCredentialsFn, type ResolveActionToolOptions, type ResolvedCredentials, type StepInvocation, type WorkflowActionDefinition, type WorkflowRunHandle, actionCoreSchema, createStepInvocation, credential, credentialInputSchema, defineAction, defineCredential, executeAction, getActionCredentialRequirements, getRunSignal, getWorkflowRunHandle, isAction, isCredentialInput, isStepInvocation, isWithinActionExecution, normalizeCredentialList, registerWorkflowRunGetter, resolveActionTool, runOutsideActionExecution, runWithRunSignal, runWithinActionExecution, toCredentialRequirement };
package/dist/action.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-hf0OTB6M.mjs";
2
- import { C as runWithRunSignal, S as runOutsideActionExecution, _ as isAction, a as ResolveActionCredentialsFn, b as registerWorkflowRunGetter, c as WorkflowActionDefinition, d as createStepInvocation, f as defineAction, g as getWorkflowRunHandle, h as getRunSignal, i as AgentRunOptions, l as WorkflowRunHandle, m as getActionCredentialRequirements, n as ActionDefinition, o as ResolveActionToolOptions, p as executeAction, r as ActionDefinitionInput, s as StepInvocation, t as ActionCredentialConsumer, u as actionCoreSchema, v as isStepInvocation, w as runWithinActionExecution, x as resolveActionTool, y as isWithinActionExecution } from "./index-B8ZRIgPK.mjs";
1
+ import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-e9f4pcX4.mjs";
2
+ import { C as runWithRunSignal, S as runOutsideActionExecution, _ as isAction, a as ResolveActionCredentialsFn, b as registerWorkflowRunGetter, c as WorkflowActionDefinition, d as createStepInvocation, f as defineAction, g as getWorkflowRunHandle, h as getRunSignal, i as AgentRunOptions, l as WorkflowRunHandle, m as getActionCredentialRequirements, n as ActionDefinition, o as ResolveActionToolOptions, p as executeAction, r as ActionDefinitionInput, s as StepInvocation, t as ActionCredentialConsumer, u as actionCoreSchema, v as isStepInvocation, w as runWithinActionExecution, x as resolveActionTool, y as isWithinActionExecution } from "./index-DsDxuNfg.mjs";
3
3
  export { type ActionCredentialConsumer, type ActionDefinition, type ActionDefinitionInput, type AgentRunOptions, CREDENTIAL_SCOPE_TYPES, type Credential, type CredentialAuthKind, type CredentialInput, type CredentialList, type CredentialRequirement, type CredentialScopeType, type DefineCredentialInput, type DefineOAuthCredentialInput, type DefineStaticCredentialInput, type NormalizeCredential, type ResolveActionCredentialsFn, type ResolveActionToolOptions, type ResolvedCredentials, type StepInvocation, type WorkflowActionDefinition, type WorkflowRunHandle, actionCoreSchema, createStepInvocation, credential, credentialInputSchema, defineAction, defineCredential, executeAction, getActionCredentialRequirements, getRunSignal, getWorkflowRunHandle, isAction, isCredentialInput, isStepInvocation, isWithinActionExecution, normalizeCredentialList, registerWorkflowRunGetter, resolveActionTool, runOutsideActionExecution, runWithRunSignal, runWithinActionExecution, toCredentialRequirement };
package/dist/action.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as toCredentialRequirement, S as normalizeCredentialList, _ as credential, a as getActionCredentialRequirements, b as isCredentialInput, c as isAction, d as registerWorkflowRunGetter, f as resolveActionTool, g as CREDENTIAL_SCOPE_TYPES, h as runWithinActionExecution, i as executeAction, l as isStepInvocation, m as runWithRunSignal, n as createStepInvocation, o as getRunSignal, p as runOutsideActionExecution, r as defineAction, s as getWorkflowRunHandle, t as actionCoreSchema, u as isWithinActionExecution, v as credentialInputSchema, y as defineCredential } from "./dist-CFy63Npi.mjs";
1
+ import { C as toCredentialRequirement, S as normalizeCredentialList, _ as credential, a as getActionCredentialRequirements, b as isCredentialInput, c as isAction, d as registerWorkflowRunGetter, f as resolveActionTool, g as CREDENTIAL_SCOPE_TYPES, h as runWithinActionExecution, i as executeAction, l as isStepInvocation, m as runWithRunSignal, n as createStepInvocation, o as getRunSignal, p as runOutsideActionExecution, r as defineAction, s as getWorkflowRunHandle, t as actionCoreSchema, u as isWithinActionExecution, v as credentialInputSchema, y as defineCredential } from "./dist-DgjcBE-O.mjs";
2
2
  export { CREDENTIAL_SCOPE_TYPES, actionCoreSchema, createStepInvocation, credential, credentialInputSchema, defineAction, defineCredential, executeAction, getActionCredentialRequirements, getRunSignal, getWorkflowRunHandle, isAction, isCredentialInput, isStepInvocation, isWithinActionExecution, normalizeCredentialList, registerWorkflowRunGetter, resolveActionTool, runOutsideActionExecution, runWithRunSignal, runWithinActionExecution, toCredentialRequirement };
package/dist/agent.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-DHdmVzO2.cjs");
3
- const require_dist$1 = require("./dist-DEwBt6Ee.cjs");
3
+ const require_dist$1 = require("./dist-B3WT5qgl.cjs");
4
4
  const require_dist$2 = require("./dist-CLr3qkxM.cjs");
5
5
  require("./env-api-keys-BFptfIIs.cjs");
6
6
  const require_event_stream = require("./event-stream-CS-ls7wC.cjs");
7
7
  require("./json-parse-TT8Vr6d3.cjs");
8
- const require_dist$3 = require("./dist-BLADLFrG.cjs");
8
+ const require_dist$3 = require("./dist-CIhk3fW1.cjs");
9
9
  let zod = require("zod");
10
10
  let node_async_hooks = require("node:async_hooks");
11
11
  let node_fs = require("node:fs");
@@ -902,7 +902,7 @@ function loadGoogleVertexProviderModule() {
902
902
  return googleVertexProviderModulePromise;
903
903
  }
904
904
  function loadMistralProviderModule() {
905
- mistralProviderModulePromise ||= Promise.resolve().then(() => require("./mistral-CC5EGzH4.cjs")).then((module) => {
905
+ mistralProviderModulePromise ||= Promise.resolve().then(() => require("./mistral-gBakFlvh.cjs")).then((module) => {
906
906
  const provider = module;
907
907
  return {
908
908
  stream: provider.streamMistral,
package/dist/agent.d.cts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { l as ThinkingLevel, u as getModel } from "./index-BByNfhJU.cjs";
2
- import { A as loadAssetManifest, B as runLlm, C as createAgent, D as errorMessage, E as defineTool, F as resolveAgentAssets, G as AgentModelIdSchema, H as AgentCreateInput, I as resolveAgentId, J as parseAgentCreateInput, K as DEFAULT_THINKING_LEVEL, L as resolveAgentTools, M as normalizeAgentDefinition, N as prepareAgentSession, O as forceToolChoice, P as prompt, R as resolveAgentWorkspaceRoot, S as buildAgentRuntime, T as defineSubagentTool, U as AgentCreateInputSchema, V as snapshot, W as AgentModelId, X as resolveThinkingLevel, Y as resolveAgentModel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentToolInherit, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as messages, k as getSubagentToolMetadata, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as ThinkingLevelSchema, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SubagentTool, w as defineAgent, x as SubagentToolMetadata, y as SubagentToolDetails, z as runAgentPrompt } from "./index-CUYwOWCh.cjs";
3
- import { a as McpDefinition, c as McpServerOptions, d as McpTransport, f as connectMcpDefinition, g as isMcp, h as defineMcp, i as McpConnection, l as McpStdioOptions, m as connectMcpStdio, n as McpAuthOptions, o as McpDefinitionInput, p as connectMcpServer, r as McpCallToolOptions, s as McpHttpTransport, t as ToolCredentialResolver, u as McpStdioTransport } from "./index-y_2btA4s.cjs";
2
+ import { A as loadAssetManifest, B as runLlm, C as createAgent, D as errorMessage, E as defineTool, F as resolveAgentAssets, G as AgentModelIdSchema, H as AgentCreateInput, I as resolveAgentId, J as parseAgentCreateInput, K as DEFAULT_THINKING_LEVEL, L as resolveAgentTools, M as normalizeAgentDefinition, N as prepareAgentSession, O as forceToolChoice, P as prompt, R as resolveAgentWorkspaceRoot, S as buildAgentRuntime, T as defineSubagentTool, U as AgentCreateInputSchema, V as snapshot, W as AgentModelId, X as resolveThinkingLevel, Y as resolveAgentModel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentToolInherit, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as messages, k as getSubagentToolMetadata, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as ThinkingLevelSchema, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SubagentTool, w as defineAgent, x as SubagentToolMetadata, y as SubagentToolDetails, z as runAgentPrompt } from "./index-DQfGP5X4.cjs";
3
+ import { a as McpDefinition, c as McpServerOptions, d as McpTransport, f as connectMcpDefinition, g as isMcp, h as defineMcp, i as McpConnection, l as McpStdioOptions, m as connectMcpStdio, n as McpAuthOptions, o as McpDefinitionInput, p as connectMcpServer, r as McpCallToolOptions, s as McpHttpTransport, t as ToolCredentialResolver, u as McpStdioTransport } from "./index-nUAXCgEe.cjs";
4
4
  export { type Agent, type AgentAssetInput, type AgentConfig, type AgentCreateInput, AgentCreateInputSchema, type AgentDefinition, type AgentDefinitionInput, type AgentModelId, AgentModelIdSchema, type AgentRuntime, type AgentSnapshot, type BuildAgentRuntimeContext, DEFAULT_THINKING_LEVEL, type DefineSubagentToolInput, type ForcedToolChoice, type McpAuthOptions, type McpCallToolOptions, type McpConnection, type McpDefinition, type McpDefinitionInput, type McpHttpTransport, type McpServerOptions, type McpStdioOptions, type McpStdioTransport, type McpTransport, type PromptInput, type PromptResponse, type ResolvedAgentAssets, type RunAgentPromptOptions, SUBAGENT_TOOL, type SandboxedAgentRuntime, SessionAgentMismatchError, type SubagentTool, type SubagentToolDetails, type SubagentToolInherit, type SubagentToolMetadata, type ThinkingLevel, ThinkingLevelSchema, type ToolCredentialResolver, buildAgentRuntime, connectMcpDefinition, connectMcpServer, connectMcpStdio, createAgent, defineAgent, defineMcp, defineSubagentTool, defineTool, errorMessage, forceToolChoice, getModel, getSubagentToolMetadata, isMcp, loadAssetManifest, messages, normalizeAgentDefinition, parseAgentCreateInput, prepareAgentSession, prompt, resolveAgentAssets, resolveAgentId, resolveAgentModel, resolveAgentTools, resolveAgentWorkspaceRoot, resolveThinkingLevel, runAgentPrompt, runLlm, snapshot };
package/dist/agent.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { l as ThinkingLevel, u as getModel } from "./index-D37gqyek.mjs";
2
- import { A as loadAssetManifest, B as runLlm, C as createAgent, D as errorMessage, E as defineTool, F as resolveAgentAssets, G as AgentModelIdSchema, H as AgentCreateInput, I as resolveAgentId, J as parseAgentCreateInput, K as DEFAULT_THINKING_LEVEL, L as resolveAgentTools, M as normalizeAgentDefinition, N as prepareAgentSession, O as forceToolChoice, P as prompt, R as resolveAgentWorkspaceRoot, S as buildAgentRuntime, T as defineSubagentTool, U as AgentCreateInputSchema, V as snapshot, W as AgentModelId, X as resolveThinkingLevel, Y as resolveAgentModel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentToolInherit, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as messages, k as getSubagentToolMetadata, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as ThinkingLevelSchema, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SubagentTool, w as defineAgent, x as SubagentToolMetadata, y as SubagentToolDetails, z as runAgentPrompt } from "./index-DPyUP9U_.mjs";
3
- import { a as McpDefinition, c as McpServerOptions, d as McpTransport, f as connectMcpDefinition, g as isMcp, h as defineMcp, i as McpConnection, l as McpStdioOptions, m as connectMcpStdio, n as McpAuthOptions, o as McpDefinitionInput, p as connectMcpServer, r as McpCallToolOptions, s as McpHttpTransport, t as ToolCredentialResolver, u as McpStdioTransport } from "./index-CITVigQS.mjs";
2
+ import { A as loadAssetManifest, B as runLlm, C as createAgent, D as errorMessage, E as defineTool, F as resolveAgentAssets, G as AgentModelIdSchema, H as AgentCreateInput, I as resolveAgentId, J as parseAgentCreateInput, K as DEFAULT_THINKING_LEVEL, L as resolveAgentTools, M as normalizeAgentDefinition, N as prepareAgentSession, O as forceToolChoice, P as prompt, R as resolveAgentWorkspaceRoot, S as buildAgentRuntime, T as defineSubagentTool, U as AgentCreateInputSchema, V as snapshot, W as AgentModelId, X as resolveThinkingLevel, Y as resolveAgentModel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentToolInherit, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as messages, k as getSubagentToolMetadata, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as ThinkingLevelSchema, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SubagentTool, w as defineAgent, x as SubagentToolMetadata, y as SubagentToolDetails, z as runAgentPrompt } from "./index-VCi-jUnh.mjs";
3
+ import { a as McpDefinition, c as McpServerOptions, d as McpTransport, f as connectMcpDefinition, g as isMcp, h as defineMcp, i as McpConnection, l as McpStdioOptions, m as connectMcpStdio, n as McpAuthOptions, o as McpDefinitionInput, p as connectMcpServer, r as McpCallToolOptions, s as McpHttpTransport, t as ToolCredentialResolver, u as McpStdioTransport } from "./index-DykbAIg-.mjs";
4
4
  export { type Agent, type AgentAssetInput, type AgentConfig, type AgentCreateInput, AgentCreateInputSchema, type AgentDefinition, type AgentDefinitionInput, type AgentModelId, AgentModelIdSchema, type AgentRuntime, type AgentSnapshot, type BuildAgentRuntimeContext, DEFAULT_THINKING_LEVEL, type DefineSubagentToolInput, type ForcedToolChoice, type McpAuthOptions, type McpCallToolOptions, type McpConnection, type McpDefinition, type McpDefinitionInput, type McpHttpTransport, type McpServerOptions, type McpStdioOptions, type McpStdioTransport, type McpTransport, type PromptInput, type PromptResponse, type ResolvedAgentAssets, type RunAgentPromptOptions, SUBAGENT_TOOL, type SandboxedAgentRuntime, SessionAgentMismatchError, type SubagentTool, type SubagentToolDetails, type SubagentToolInherit, type SubagentToolMetadata, type ThinkingLevel, ThinkingLevelSchema, type ToolCredentialResolver, buildAgentRuntime, connectMcpDefinition, connectMcpServer, connectMcpStdio, createAgent, defineAgent, defineMcp, defineSubagentTool, defineTool, errorMessage, forceToolChoice, getModel, getSubagentToolMetadata, isMcp, loadAssetManifest, messages, normalizeAgentDefinition, parseAgentCreateInput, prepareAgentSession, prompt, resolveAgentAssets, resolveAgentId, resolveAgentModel, resolveAgentTools, resolveAgentWorkspaceRoot, resolveThinkingLevel, runAgentPrompt, runLlm, snapshot };
package/dist/agent.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { $ as Options, $t as IsMap, An as IsSymbol$1, At as Unreachable, Bn as __require, Bt as IsRef$1, Cn as IsMinLength$2, Ct as IsInteger$2, Dn as IsObject$1, Dt as IsCodec, En as IsNumber$1, Et as IsBigInt$2, Fn as Symbols, Ft as IsUnion, G as ensureWorkspaceDir, Gt as IsArray$2, Ht as IsFunction$2, In as guard_exports, It as Union, Jt as IsOptional, K as materializeSandbox, Kt as Base, Ln as __commonJSMin, Lt as IsObject$2, Mn as IsUnsafePropertyKey, Mt as IsEnum$1, Nn as IsValueLike, Nt as IsCyclic, On as IsObjectNotArray$1, Ot as Hash, Pn as Keys$1, Pt as Unknown, Q as Instantiate, Qt as Get$3, Rt as _Object_, Sn as IsMaxLength$2, St as IsIterator$2, Tn as IsNull$1, Tt as IsBoolean$2, Ut as IsConstructor$2, Vt as Ref$1, W as defineSandbox, Wt as IsAsyncIterator$2, X as resolveSandboxRoot, Xt as IsPromise, Yt as Optional, Z as Evaluate$1, Zt as IsSchema$1, _n as IsGreaterThan$1, _t as IsLiteralBigInt, a as createSandbox, an as EveryAll, at as RecordPattern, bn as IsLessEqualThan$1, bt as IsLiteralString, c as defineTool$1, cn as IsAsyncIterator$1, ct as EnumToUnion, d as resolveRunProvider, dn as IsClassInstance, dt as String$1, en as IsSet, et as Compare, fn as IsConstructor$1, ft as IsSymbol$2, gn as IsGreaterEqualThan$1, gt as IsLiteral, hn as IsFunction$1, ht as IsNull$2, i as createJustBashProvider, in as Every$1, it as IsRecord, jn as IsUndefined$1, jt as IsIntersect, kn as IsString$1, kt as hash_exports, ln as IsBigInt$1, lt as TemplateLiteralDecode, mn as IsEqual$1, mt as Number$1, nn as Entries$2, nt as IsVoid, o as defaultWorkspacesRoot, on as HasPropertyKey$1, ot as RecordValue, pn as IsDeepEqual$1, pt as IsNumber$2, q as packAssetDirs, qt as IsBase, r as createInvokeToolBridge, rn as EntriesRegExp, rt as IsUndefined$2, s as defineSkill, sn as IsArray$1, st as IsTuple, tn as IsTypeArray, tt as IsTemplateLiteral, u as materializeSkills, un as IsBoolean$1, ut as IsString$2, vn as IsInteger$1, vt as IsLiteralBoolean, wn as IsMultipleOf$1, wt as Boolean$1, xn as IsLessThan$1, xt as Literal, yn as IsIterator$1, yt as IsLiteralNumber, zn as __exportAll, zt as IsNever } from "./dist-IaCcrwur.mjs";
2
- import { c as isAction, f as resolveActionTool, o as getRunSignal, s as getWorkflowRunHandle, u as isWithinActionExecution, w as toolParameters } from "./dist-CFy63Npi.mjs";
2
+ import { c as isAction, f as resolveActionTool, o as getRunSignal, s as getWorkflowRunHandle, u as isWithinActionExecution, w as toolParameters } from "./dist-DgjcBE-O.mjs";
3
3
  import "./env-api-keys-mSUt6vw1.mjs";
4
4
  import { i as getModel, t as AssistantMessageEventStream } from "./event-stream-C7YBbzsc.mjs";
5
5
  import "./json-parse-DzekVFUW.mjs";
6
- import { C as connectMcpStdio, S as connectMcpServer, T as isMcp, _ as captureConsole, a as resolveActionCredentials, b as withSpan, c as addAgentSessionDuration, d as getAgentByRoute, f as getSession, g as touchSession, h as resolveRunSourceFromTraceContext, i as isCredentialError, l as appendEvent, m as recordLlmUsageFromAssistantMessage, n as captureCredentialToolErrors, o as resolveMcpTools, p as listMessageEvents, r as createCredentialResolver, s as MESSAGE_EVENT_TYPE$1, t as buildCredentialRunContext, u as createSession, v as getTraceContext, w as defineMcp, x as connectMcpDefinition } from "./dist-BX0Upt63.mjs";
6
+ import { C as connectMcpStdio, S as connectMcpServer, T as isMcp, _ as captureConsole, a as resolveActionCredentials, b as withSpan, c as addAgentSessionDuration, d as getAgentByRoute, f as getSession, g as touchSession, h as resolveRunSourceFromTraceContext, i as isCredentialError, l as appendEvent, m as recordLlmUsageFromAssistantMessage, n as captureCredentialToolErrors, o as resolveMcpTools, p as listMessageEvents, r as createCredentialResolver, s as MESSAGE_EVENT_TYPE$1, t as buildCredentialRunContext, u as createSession, v as getTraceContext, w as defineMcp, x as connectMcpDefinition } from "./dist-itGeZOJp.mjs";
7
7
  import { createRequire } from "node:module";
8
8
  import { z } from "zod";
9
9
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -900,7 +900,7 @@ function loadGoogleVertexProviderModule() {
900
900
  return googleVertexProviderModulePromise;
901
901
  }
902
902
  function loadMistralProviderModule() {
903
- mistralProviderModulePromise ||= import("./mistral-DbKZmAHf.mjs").then((module) => {
903
+ mistralProviderModulePromise ||= import("./mistral-MfzlP5Os.mjs").then((module) => {
904
904
  const provider = module;
905
905
  return {
906
906
  stream: provider.streamMistral,
package/dist/app.cjs CHANGED
@@ -1,21 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-DEwBt6Ee.cjs");
3
- const require_client = require("./client.cjs");
2
+ const require_dist = require("./dist-B3WT5qgl.cjs");
4
3
  require("zod");
5
4
  //#region ../app/dist/index.mjs
6
- /**
7
- * Author a connectable app: one templated credential, tools as data, execution via `execute`.
8
- * Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.
9
- */
10
- function defineApp$1(input) {
5
+ function appCredentialFor(slug, input) {
6
+ if (input.auth === "api_key") return require_dist.credential.static(slug, input.credential);
7
+ if (input.auth === "oauth") return input.tokenField !== void 0 ? require_dist.credential.oauth(slug, { tokenField: input.tokenField }) : require_dist.credential.oauth(slug);
8
+ return require_dist.credential.keystroke(slug);
9
+ }
10
+ function defineApp(input) {
11
11
  const slug = input.slug.trim();
12
12
  if (!slug) throw new Error("defineApp requires a non-empty slug");
13
13
  const auth = input.auth ?? "keystroke";
14
- const version = input.version.trim();
15
- if (!version) throw new Error("defineApp requires a non-empty version");
16
- const appCredential = require_dist.credential.keystroke(slug);
17
- const execute = input.execute;
18
- function tool(toolSlug, def) {
14
+ const appCredential = appCredentialFor(slug, input);
15
+ function action(def) {
19
16
  return require_dist.defineAction({
20
17
  slug: def.slug,
21
18
  ...def.name !== void 0 ? { name: def.name } : {},
@@ -23,50 +20,17 @@ function defineApp$1(input) {
23
20
  input: def.input,
24
21
  output: def.output,
25
22
  credentials: [appCredential],
26
- async run(runInput, credentials) {
27
- const resolved = credentials[slug];
28
- const result = await execute({
29
- app: slug,
30
- tool: toolSlug,
31
- arguments: runInput,
32
- version,
33
- ...resolved?.instanceId ? { instanceId: resolved.instanceId } : {}
34
- });
35
- return def.output.parse(result);
36
- }
23
+ run: def.run
37
24
  });
38
25
  }
39
26
  return {
40
27
  slug,
41
28
  auth,
42
- version,
43
29
  credential: appCredential,
44
- tool
30
+ action
45
31
  };
46
32
  }
47
33
  //#endregion
48
- //#region src/app.ts
49
- /** Keystroke MCP app — wires `defineApp` to the platform gateway client. */
50
- function defineApp(input) {
51
- let client = input.client;
52
- const getClient = () => client ??= require_client.createKeystrokeClient();
53
- return defineApp$1({
54
- slug: input.slug,
55
- ...input.auth !== void 0 ? { auth: input.auth } : {},
56
- version: input.version,
57
- async execute({ app, tool, arguments: args, instanceId, version }) {
58
- const { result } = await getClient().tools.execute({
59
- app,
60
- tool,
61
- arguments: args,
62
- version,
63
- ...instanceId ? { instanceId } : {}
64
- });
65
- return result;
66
- }
67
- });
68
- }
69
- //#endregion
70
34
  exports.defineApp = defineApp;
71
35
 
72
36
  //# sourceMappingURL=app.cjs.map
package/dist/app.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.cjs","names":["defineApp","credential","defineAction","createKeystrokeClient","defineAppCore"],"sources":["../../app/dist/index.mjs","../src/app.ts"],"sourcesContent":["import { credential, defineAction } from \"@keystrokehq/action\";\nimport \"zod\";\n//#region src/define-app.ts\n/**\n* Author a connectable app: one templated credential, tools as data, execution via `execute`.\n* Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.\n*/\nfunction defineApp(input) {\n\tconst slug = input.slug.trim();\n\tif (!slug) throw new Error(\"defineApp requires a non-empty slug\");\n\tconst auth = input.auth ?? \"keystroke\";\n\tconst version = input.version.trim();\n\tif (!version) throw new Error(\"defineApp requires a non-empty version\");\n\tconst appCredential = credential.keystroke(slug);\n\tconst execute = input.execute;\n\tfunction tool(toolSlug, def) {\n\t\treturn defineAction({\n\t\t\tslug: def.slug,\n\t\t\t...def.name !== void 0 ? { name: def.name } : {},\n\t\t\t...def.description !== void 0 ? { description: def.description } : {},\n\t\t\tinput: def.input,\n\t\t\toutput: def.output,\n\t\t\tcredentials: [appCredential],\n\t\t\tasync run(runInput, credentials) {\n\t\t\t\tconst resolved = credentials[slug];\n\t\t\t\tconst result = await execute({\n\t\t\t\t\tapp: slug,\n\t\t\t\t\ttool: toolSlug,\n\t\t\t\t\targuments: runInput,\n\t\t\t\t\tversion,\n\t\t\t\t\t...resolved?.instanceId ? { instanceId: resolved.instanceId } : {}\n\t\t\t\t});\n\t\t\t\treturn def.output.parse(result);\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\tslug,\n\t\tauth,\n\t\tversion,\n\t\tcredential: appCredential,\n\t\ttool\n\t};\n}\n//#endregion\nexport { defineApp };\n\n//# sourceMappingURL=index.mjs.map","import {\n defineApp as defineAppCore,\n type App,\n type AppAuthKind,\n type AppToolDefinition,\n type DefineAppInput as CoreDefineAppInput,\n} from \"@keystrokehq/app\";\n\nimport { createKeystrokeClient, type KeystrokeClient } from \"./client\";\n\nexport type { App, AppAuthKind, AppToolDefinition };\n\nexport type DefineAppInput = Omit<CoreDefineAppInput, \"execute\"> & {\n /** Test seam — defaults to a client resolved from `KEYSTROKE_API_KEY` / `PUBLIC_PLATFORM_URL`. */\n client?: KeystrokeClient;\n};\n\n/** Keystroke MCP app — wires `defineApp` to the platform gateway client. */\nexport function defineApp(input: DefineAppInput): App {\n let client = input.client;\n const getClient = (): KeystrokeClient => (client ??= createKeystrokeClient());\n\n return defineAppCore({\n slug: input.slug,\n ...(input.auth !== undefined ? { auth: input.auth } : {}),\n version: input.version,\n async execute({ app, tool, arguments: args, instanceId, version }) {\n const { result } = await getClient().tools.execute({\n app,\n tool,\n arguments: args,\n version,\n ...(instanceId ? { instanceId } : {}),\n });\n return result;\n },\n });\n}\n"],"mappings":";;;;;;;;;AAOA,SAASA,YAAU,OAAO;CACzB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,qCAAqC;CAChE,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,UAAU,MAAM,QAAQ,KAAK;CACnC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,wCAAwC;CACtE,MAAM,gBAAgBC,aAAAA,WAAW,UAAU,IAAI;CAC/C,MAAM,UAAU,MAAM;CACtB,SAAS,KAAK,UAAU,KAAK;EAC5B,OAAOC,aAAAA,aAAa;GACnB,MAAM,IAAI;GACV,GAAG,IAAI,SAAS,KAAK,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GAC/C,GAAG,IAAI,gBAAgB,KAAK,IAAI,EAAE,aAAa,IAAI,YAAY,IAAI,CAAC;GACpE,OAAO,IAAI;GACX,QAAQ,IAAI;GACZ,aAAa,CAAC,aAAa;GAC3B,MAAM,IAAI,UAAU,aAAa;IAChC,MAAM,WAAW,YAAY;IAC7B,MAAM,SAAS,MAAM,QAAQ;KAC5B,KAAK;KACL,MAAM;KACN,WAAW;KACX;KACA,GAAG,UAAU,aAAa,EAAE,YAAY,SAAS,WAAW,IAAI,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,OAAO,MAAM,MAAM;GAC/B;EACD,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA;EACA,YAAY;EACZ;CACD;AACD;;;;ACzBA,SAAgB,UAAU,OAA4B;CACpD,IAAI,SAAS,MAAM;CACnB,MAAM,kBAAoC,WAAWC,eAAAA,sBAAsB;CAE3E,OAAOC,YAAc;EACnB,MAAM,MAAM;EACZ,GAAI,MAAM,SAAS,KAAA,IAAY,EAAE,MAAM,MAAM,KAAK,IAAI,CAAC;EACvD,SAAS,MAAM;EACf,MAAM,QAAQ,EAAE,KAAK,MAAM,WAAW,MAAM,YAAY,WAAW;GACjE,MAAM,EAAE,WAAW,MAAM,UAAU,EAAE,MAAM,QAAQ;IACjD;IACA;IACA,WAAW;IACX;IACA,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;GACrC,CAAC;GACD,OAAO;EACT;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"app.cjs","names":["credential","defineAction"],"sources":["../../app/dist/index.mjs"],"sourcesContent":["import { credential, defineAction } from \"@keystrokehq/action\";\nimport \"zod\";\n//#region src/define-app.ts\nfunction appCredentialFor(slug, input) {\n\tif (input.auth === \"api_key\") return credential.static(slug, input.credential);\n\tif (input.auth === \"oauth\") return input.tokenField !== void 0 ? credential.oauth(slug, { tokenField: input.tokenField }) : credential.oauth(slug);\n\treturn credential.keystroke(slug);\n}\nfunction defineApp(input) {\n\tconst slug = input.slug.trim();\n\tif (!slug) throw new Error(\"defineApp requires a non-empty slug\");\n\tconst auth = input.auth ?? \"keystroke\";\n\tconst appCredential = appCredentialFor(slug, input);\n\tfunction action(def) {\n\t\treturn defineAction({\n\t\t\tslug: def.slug,\n\t\t\t...def.name !== void 0 ? { name: def.name } : {},\n\t\t\t...def.description !== void 0 ? { description: def.description } : {},\n\t\t\tinput: def.input,\n\t\t\toutput: def.output,\n\t\t\tcredentials: [appCredential],\n\t\t\trun: def.run\n\t\t});\n\t}\n\treturn {\n\t\tslug,\n\t\tauth,\n\t\tcredential: appCredential,\n\t\taction\n\t};\n}\n//#endregion\nexport { defineApp };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;AAGA,SAAS,iBAAiB,MAAM,OAAO;CACtC,IAAI,MAAM,SAAS,WAAW,OAAOA,aAAAA,WAAW,OAAO,MAAM,MAAM,UAAU;CAC7E,IAAI,MAAM,SAAS,SAAS,OAAO,MAAM,eAAe,KAAK,IAAIA,aAAAA,WAAW,MAAM,MAAM,EAAE,YAAY,MAAM,WAAW,CAAC,IAAIA,aAAAA,WAAW,MAAM,IAAI;CACjJ,OAAOA,aAAAA,WAAW,UAAU,IAAI;AACjC;AACA,SAAS,UAAU,OAAO;CACzB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,qCAAqC;CAChE,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,gBAAgB,iBAAiB,MAAM,KAAK;CAClD,SAAS,OAAO,KAAK;EACpB,OAAOC,aAAAA,aAAa;GACnB,MAAM,IAAI;GACV,GAAG,IAAI,SAAS,KAAK,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GAC/C,GAAG,IAAI,gBAAgB,KAAK,IAAI,EAAE,aAAa,IAAI,YAAY,IAAI,CAAC;GACpE,OAAO,IAAI;GACX,QAAQ,IAAI;GACZ,aAAa,CAAC,aAAa;GAC3B,KAAK,IAAI;EACV,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA,YAAY;EACZ;CACD;AACD"}
package/dist/app.d.cts CHANGED
@@ -1,58 +1,52 @@
1
- import { b as credential } from "./index-hf0OTB6M.cjs";
2
- import { c as WorkflowActionDefinition } from "./index-DjLUdkRo.cjs";
3
- import { KeystrokeClient } from "./client.cjs";
1
+ import { n as Credential, v as ResolvedCredentials } from "./index-e9f4pcX4.cjs";
2
+ import { c as WorkflowActionDefinition, r as ActionDefinitionInput } from "./index-DpOXmY3P.cjs";
4
3
  import { z } from "zod";
5
4
 
6
5
  //#region ../app/dist/index.d.mts
7
6
  //#region src/define-app.d.ts
8
7
  /** Auth strategy an app templates onto its credential instances. */
9
- type AppAuthKind = "keystroke";
10
- type AppToolExecuteInput = {
11
- app: string;
12
- tool: string;
13
- arguments: Record<string, unknown>;
14
- instanceId?: string;
15
- version: string;
16
- };
17
- type AppExecutor = (input: AppToolExecuteInput) => Promise<unknown>;
18
- type DefineAppInput$1 = {
8
+ type AppAuthKind = "keystroke" | "api_key" | "oauth";
9
+ /** Keystroke MCP app — actions resolve the keystroke credential keyed by slug. */
10
+ type DefineKeystrokeAppInput = {
19
11
  /** App + credential key (e.g. `github`). Matches `credential_instances.slug`. */slug: string;
20
- auth?: AppAuthKind; /** Pinned app toolkit version (e.g. `20260501_01`). */
21
- version: string; /** Runs a provider tool for the resolved credential instance. */
22
- execute: AppExecutor;
12
+ auth?: "keystroke";
13
+ };
14
+ /** Direct-HTTP app — each `action()` owns its `run` and reads the static credential. */
15
+ type DefineApiKeyAppInput = {
16
+ slug: string;
17
+ auth: "api_key"; /** Vault credential fields (e.g. `{ apiKey: z.string() }`). */
18
+ credential: Record<string, z.ZodTypeAny>;
23
19
  };
24
- type AppToolDefinition<TInput extends z.ZodType, TOutput extends z.ZodType> = {
25
- /** Action slug for discovery + workflow step ids (e.g. `github-create-an-issue`). */slug: string;
26
- name?: string;
27
- description?: string;
28
- input: TInput;
29
- output: TOutput;
20
+ /** OAuth-managed app each `action()` reads the resolved token. */
21
+ type DefineOAuthAppInput = {
22
+ slug: string;
23
+ auth: "oauth"; /** Token field exposed to actions (defaults to `accessToken`). */
24
+ tokenField?: string;
30
25
  };
31
- type KeystrokeCredentialRef = ReturnType<typeof credential.keystroke<string>>;
32
- type App = {
26
+ type DefineAppInput = DefineKeystrokeAppInput | DefineApiKeyAppInput | DefineOAuthAppInput;
27
+ /** Authoring shape for `app.action()` — `defineAction` with the app credential pre-bound. */
28
+ type AppActionDefinition<TInput extends z.ZodType, TOutput extends z.ZodType, TCred extends Credential> = Omit<ActionDefinitionInput<TInput, TOutput, ResolvedCredentials<readonly [TCred]>>, "credentials">;
29
+ type App<TCred extends Credential = Credential> = {
33
30
  readonly slug: string;
34
- readonly auth: AppAuthKind;
35
- readonly version: string; /** Credential ref every tool on this app declares — templated from the app, not authored per use. */
36
- readonly credential: KeystrokeCredentialRef;
31
+ readonly auth: AppAuthKind; /** Credential ref every action on this app declares — templated from the app, not authored per use. */
32
+ readonly credential: TCred;
37
33
  /**
38
- * Define an action bound to a provider tool (e.g. `GITHUB_CREATE_AN_ISSUE`). The result is an
39
- * ordinary action — same credential resolution and `.scope()` binding as any other.
34
+ * Define an action with its own `run`, reading the app credential. The result is an ordinary
35
+ * action — same credential resolution and `.scope()` binding as any other.
40
36
  */
41
- tool<TInput extends z.ZodType, TOutput extends z.ZodType>(toolSlug: string, def: AppToolDefinition<TInput, TOutput>): WorkflowActionDefinition<z.infer<TInput>, z.infer<TOutput>, Record<string, {
42
- instanceId?: string;
43
- }>, readonly [KeystrokeCredentialRef]>;
37
+ action<TInput extends z.ZodType, TOutput extends z.ZodType>(def: AppActionDefinition<TInput, TOutput, TCred>): WorkflowActionDefinition<z.infer<TInput>, z.infer<TOutput>, ResolvedCredentials<readonly [TCred]>, readonly [TCred]>;
44
38
  };
45
39
  /**
46
- * Author a connectable app: one templated credential, tools as data, execution via `execute`.
47
- * Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.
40
+ * Author a connectable app: one templated credential plus actions that declare it. The auth kind
41
+ * selects the credential shape (`keystroke` | `api_key` | `oauth`).
48
42
  */
43
+ declare function defineApp<S extends string, R extends Record<string, z.ZodTypeAny>>(input: {
44
+ slug: S;
45
+ auth: "api_key";
46
+ credential: R;
47
+ }): App<Credential<S, z.ZodObject<R>>>;
48
+ declare function defineApp(input: DefineOAuthAppInput): App;
49
+ declare function defineApp(input: DefineKeystrokeAppInput): App; //#endregion
49
50
  //#endregion
50
- //#region src/app.d.ts
51
- type DefineAppInput = Omit<DefineAppInput$1, "execute"> & {
52
- /** Test seam — defaults to a client resolved from `KEYSTROKE_API_KEY` / `PUBLIC_PLATFORM_URL`. */client?: KeystrokeClient;
53
- };
54
- /** Keystroke MCP app — wires `defineApp` to the platform gateway client. */
55
- declare function defineApp(input: DefineAppInput): App;
56
- //#endregion
57
- export { type App, type AppAuthKind, type AppToolDefinition, DefineAppInput, defineApp };
51
+ export { type App, type AppActionDefinition, type AppAuthKind, type DefineApiKeyAppInput, type DefineAppInput, type DefineKeystrokeAppInput, type DefineOAuthAppInput, defineApp };
58
52
  //# sourceMappingURL=app.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.cts","names":["WorkflowActionDefinition","credential","z","AppAuthKind","AppToolExecuteInput","Record","app","tool","arguments","instanceId","version","AppExecutor","Promise","input","DefineAppInput","slug","auth","execute","AppToolDefinition","TInput","TOutput","ZodType","name","description","output","KeystrokeCredentialRef","keystroke","ReturnType","App","infer","toolSlug","def","defineApp"],"sources":["../../app/dist/index.d.mts","../src/app.ts"],"mappings":";;;;;;;;KAKKG,WAAAA;AAAAA,KACAC,mBAAAA;EACHE,GAAAA;EACAC,IAAAA;EACAC,SAAAA,EAAWH,MAAM;EACjBI,UAAAA;EACAC,OAAAA;AAAAA;AAAAA,KAEGC,WAAAA,IAAeE,KAAAA,EAAOT,mBAAAA,KAAwBQ,OAAO;AAAA,KACrDE,gBAAAA;EAPHR,iFAQiFS,IAAAA;EACjFC,IAAAA,GAAOb,WAAAA,EARPI;EASAG,OAAAA,UARAF;EASAS,OAAAA,EAASN,WAAW;AAAA;AAAA,KAEjBO,iBAAAA,gBAAiChB,CAAAA,CAAEmB,OAAAA,kBAAyBnB,CAAAA,CAAEmB,OAAAA;EAT1D,qFAU8EN,IAAAA;EACrFO,IAAAA;EACAC,WAAAA;EACAV,KAAAA,EAAOM,MAAAA;EACPK,MAAAA,EAAQJ,OAAAA;AAAAA;AAAAA,KAELK,sBAAAA,GAAyBE,UAAU,QAAQ1B,UAAAA,CAAWyB,SAAAA;AAAAA,KACtDE,GAAAA;EAAAA,SACMb,IAAAA;EAAAA,SACAC,IAAAA,EAAMb,WAAAA;EAAAA,SACNO,OAAAA,UAlB+C;EAAA,SAmB/CT,UAAAA,EAAYwB,sBAAAA;EAlBJ;;;;EAuBjBlB,IAAAA,gBAAoBL,CAAAA,CAAEmB,OAAAA,kBAAyBnB,CAAAA,CAAEmB,OAAAA,EAASS,QAAAA,UAAkBC,GAAAA,EAAKb,iBAAAA,CAAkBC,MAAAA,EAAQC,OAAAA,IAAWpB,wBAAAA,CAAyBE,CAAAA,CAAE2B,KAAAA,CAAMV,MAAAA,GAASjB,CAAAA,CAAE2B,KAAAA,CAAMT,OAAAA,GAAUf,MAAAA;IAChLI,UAAAA;EAAAA,cACYgB,sBAAAA;AAAAA;;;AArBM;AAAA;;;KCNV,cAAA,GAAiB,IAAA,CAAK,gBAAA;oGAEhC,MAAA,GAAS,eAAA;AAAA;;iBAIK,SAAA,CAAU,KAAA,EAAO,cAAA,GAAiB,GAAG"}
1
+ {"version":3,"file":"app.d.cts","names":["ActionDefinitionInput","Credential","ResolvedCredentials","WorkflowActionDefinition","z","AppAuthKind","DefineKeystrokeAppInput","slug","auth","DefineApiKeyAppInput","ZodTypeAny","Record","credential","DefineOAuthAppInput","tokenField","DefineAppInput","AppActionDefinition","TInput","TOutput","TCred","ZodType","Omit","App","infer","action","def","defineApp","S","R","ZodObject","input"],"sources":["../../app/dist/index.d.mts"],"mappings":";;;;;;;KAKKK,WAAAA;;KAEAC,uBAAAA;EAFW,iFAGmEC,IAAAA;EACjFC,IAAI;AAAA;;KAGDC,oBAAAA;EACHF,IAAAA;EACAC,IAAAA,aALI;EAMJI,UAAAA,EAAYD,MAAM,SAASP,CAAAA,CAAEM,UAAAA;AAAAA;;KAG1BG,mBAAAA;EACHN,IAAAA;EACAC,IAAAA,WANAA;EAOAM,UAAAA;AAAAA;AAAAA,KAEGC,cAAAA,GAAiBT,uBAAAA,GAA0BG,oBAAAA,GAAuBI,mBAAAA;;KAElEG,mBAAAA,gBAAmCZ,CAAAA,CAAEgB,OAAAA,kBAAyBhB,CAAAA,CAAEgB,OAAAA,gBAAuBnB,UAAAA,IAAcoB,IAAAA,CAAKrB,qBAAAA,CAAsBiB,MAAAA,EAAQC,OAAAA,EAAShB,mBAAAA,WAA8BiB,KAAAA;AAAAA,KAC/KG,GAAAA,eAAkBrB,UAAAA,GAAaA,UAAAA;EAAAA,SACzBM,IAAAA;EAAAA,SACAC,IAAAA,EAAMH,WAAAA,EAVO;EAAA,SAWbO,UAAAA,EAAYO,KAAAA;EAXC;;;;EAgBtBK,MAAAA,gBAAsBpB,CAAAA,CAAEgB,OAAAA,kBAAyBhB,CAAAA,CAAEgB,OAAAA,EAASK,GAAAA,EAAKT,mBAAAA,CAAoBC,MAAAA,EAAQC,OAAAA,EAASC,KAAAA,IAAShB,wBAAAA,CAAyBC,CAAAA,CAAEmB,KAAAA,CAAMN,MAAAA,GAASb,CAAAA,CAAEmB,KAAAA,CAAML,OAAAA,GAAUhB,mBAAAA,WAA8BiB,KAAAA,cAAmBA,KAAAA;AAAAA;AAblN;;;;AAAA,iBAmBKO,SAAAA,6BAAsCf,MAAAA,SAAeP,CAAAA,CAAEM,UAAAA,EAAAA,CAAaoB,KAAAA;EACnFvB,IAAAA,EAAMoB,CAAAA;EACNnB,IAAAA;EACAI,UAAAA,EAAYgB,CAAAA;AAAAA,IACVN,GAAAA,CAAIrB,UAAAA,CAAW0B,CAAAA,EAAGvB,CAAAA,CAAEyB,SAAAA,CAAUD,CAAAA;AAAAA,iBACjBF,SAAAA,CAAUI,KAAAA,EAAOjB,mBAAAA,GAAsBS,GAAG;AAAA,iBAC1CI,SAAAA,CAAUI,KAAAA,EAAOxB,uBAAAA,GAA0BgB,GAAG"}
package/dist/app.d.mts CHANGED
@@ -1,58 +1,52 @@
1
- import { b as credential } from "./index-hf0OTB6M.mjs";
2
- import { c as WorkflowActionDefinition } from "./index-B8ZRIgPK.mjs";
3
- import { KeystrokeClient } from "./client.mjs";
1
+ import { n as Credential, v as ResolvedCredentials } from "./index-e9f4pcX4.mjs";
2
+ import { c as WorkflowActionDefinition, r as ActionDefinitionInput } from "./index-DsDxuNfg.mjs";
4
3
  import { z } from "zod";
5
4
 
6
5
  //#region ../app/dist/index.d.mts
7
6
  //#region src/define-app.d.ts
8
7
  /** Auth strategy an app templates onto its credential instances. */
9
- type AppAuthKind = "keystroke";
10
- type AppToolExecuteInput = {
11
- app: string;
12
- tool: string;
13
- arguments: Record<string, unknown>;
14
- instanceId?: string;
15
- version: string;
16
- };
17
- type AppExecutor = (input: AppToolExecuteInput) => Promise<unknown>;
18
- type DefineAppInput$1 = {
8
+ type AppAuthKind = "keystroke" | "api_key" | "oauth";
9
+ /** Keystroke MCP app — actions resolve the keystroke credential keyed by slug. */
10
+ type DefineKeystrokeAppInput = {
19
11
  /** App + credential key (e.g. `github`). Matches `credential_instances.slug`. */slug: string;
20
- auth?: AppAuthKind; /** Pinned app toolkit version (e.g. `20260501_01`). */
21
- version: string; /** Runs a provider tool for the resolved credential instance. */
22
- execute: AppExecutor;
12
+ auth?: "keystroke";
13
+ };
14
+ /** Direct-HTTP app — each `action()` owns its `run` and reads the static credential. */
15
+ type DefineApiKeyAppInput = {
16
+ slug: string;
17
+ auth: "api_key"; /** Vault credential fields (e.g. `{ apiKey: z.string() }`). */
18
+ credential: Record<string, z.ZodTypeAny>;
23
19
  };
24
- type AppToolDefinition<TInput extends z.ZodType, TOutput extends z.ZodType> = {
25
- /** Action slug for discovery + workflow step ids (e.g. `github-create-an-issue`). */slug: string;
26
- name?: string;
27
- description?: string;
28
- input: TInput;
29
- output: TOutput;
20
+ /** OAuth-managed app each `action()` reads the resolved token. */
21
+ type DefineOAuthAppInput = {
22
+ slug: string;
23
+ auth: "oauth"; /** Token field exposed to actions (defaults to `accessToken`). */
24
+ tokenField?: string;
30
25
  };
31
- type KeystrokeCredentialRef = ReturnType<typeof credential.keystroke<string>>;
32
- type App = {
26
+ type DefineAppInput = DefineKeystrokeAppInput | DefineApiKeyAppInput | DefineOAuthAppInput;
27
+ /** Authoring shape for `app.action()` — `defineAction` with the app credential pre-bound. */
28
+ type AppActionDefinition<TInput extends z.ZodType, TOutput extends z.ZodType, TCred extends Credential> = Omit<ActionDefinitionInput<TInput, TOutput, ResolvedCredentials<readonly [TCred]>>, "credentials">;
29
+ type App<TCred extends Credential = Credential> = {
33
30
  readonly slug: string;
34
- readonly auth: AppAuthKind;
35
- readonly version: string; /** Credential ref every tool on this app declares — templated from the app, not authored per use. */
36
- readonly credential: KeystrokeCredentialRef;
31
+ readonly auth: AppAuthKind; /** Credential ref every action on this app declares — templated from the app, not authored per use. */
32
+ readonly credential: TCred;
37
33
  /**
38
- * Define an action bound to a provider tool (e.g. `GITHUB_CREATE_AN_ISSUE`). The result is an
39
- * ordinary action — same credential resolution and `.scope()` binding as any other.
34
+ * Define an action with its own `run`, reading the app credential. The result is an ordinary
35
+ * action — same credential resolution and `.scope()` binding as any other.
40
36
  */
41
- tool<TInput extends z.ZodType, TOutput extends z.ZodType>(toolSlug: string, def: AppToolDefinition<TInput, TOutput>): WorkflowActionDefinition<z.infer<TInput>, z.infer<TOutput>, Record<string, {
42
- instanceId?: string;
43
- }>, readonly [KeystrokeCredentialRef]>;
37
+ action<TInput extends z.ZodType, TOutput extends z.ZodType>(def: AppActionDefinition<TInput, TOutput, TCred>): WorkflowActionDefinition<z.infer<TInput>, z.infer<TOutput>, ResolvedCredentials<readonly [TCred]>, readonly [TCred]>;
44
38
  };
45
39
  /**
46
- * Author a connectable app: one templated credential, tools as data, execution via `execute`.
47
- * Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.
40
+ * Author a connectable app: one templated credential plus actions that declare it. The auth kind
41
+ * selects the credential shape (`keystroke` | `api_key` | `oauth`).
48
42
  */
43
+ declare function defineApp<S extends string, R extends Record<string, z.ZodTypeAny>>(input: {
44
+ slug: S;
45
+ auth: "api_key";
46
+ credential: R;
47
+ }): App<Credential<S, z.ZodObject<R>>>;
48
+ declare function defineApp(input: DefineOAuthAppInput): App;
49
+ declare function defineApp(input: DefineKeystrokeAppInput): App; //#endregion
49
50
  //#endregion
50
- //#region src/app.d.ts
51
- type DefineAppInput = Omit<DefineAppInput$1, "execute"> & {
52
- /** Test seam — defaults to a client resolved from `KEYSTROKE_API_KEY` / `PUBLIC_PLATFORM_URL`. */client?: KeystrokeClient;
53
- };
54
- /** Keystroke MCP app — wires `defineApp` to the platform gateway client. */
55
- declare function defineApp(input: DefineAppInput): App;
56
- //#endregion
57
- export { type App, type AppAuthKind, type AppToolDefinition, DefineAppInput, defineApp };
51
+ export { type App, type AppActionDefinition, type AppAuthKind, type DefineApiKeyAppInput, type DefineAppInput, type DefineKeystrokeAppInput, type DefineOAuthAppInput, defineApp };
58
52
  //# sourceMappingURL=app.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.mts","names":["WorkflowActionDefinition","credential","z","AppAuthKind","AppToolExecuteInput","Record","app","tool","arguments","instanceId","version","AppExecutor","Promise","input","DefineAppInput","slug","auth","execute","AppToolDefinition","TInput","TOutput","ZodType","name","description","output","KeystrokeCredentialRef","keystroke","ReturnType","App","infer","toolSlug","def","defineApp"],"sources":["../../app/dist/index.d.mts","../src/app.ts"],"mappings":";;;;;;;;KAKKG,WAAAA;AAAAA,KACAC,mBAAAA;EACHE,GAAAA;EACAC,IAAAA;EACAC,SAAAA,EAAWH,MAAM;EACjBI,UAAAA;EACAC,OAAAA;AAAAA;AAAAA,KAEGC,WAAAA,IAAeE,KAAAA,EAAOT,mBAAAA,KAAwBQ,OAAO;AAAA,KACrDE,gBAAAA;EAPHR,iFAQiFS,IAAAA;EACjFC,IAAAA,GAAOb,WAAAA,EARPI;EASAG,OAAAA,UARAF;EASAS,OAAAA,EAASN,WAAW;AAAA;AAAA,KAEjBO,iBAAAA,gBAAiChB,CAAAA,CAAEmB,OAAAA,kBAAyBnB,CAAAA,CAAEmB,OAAAA;EAT1D,qFAU8EN,IAAAA;EACrFO,IAAAA;EACAC,WAAAA;EACAV,KAAAA,EAAOM,MAAAA;EACPK,MAAAA,EAAQJ,OAAAA;AAAAA;AAAAA,KAELK,sBAAAA,GAAyBE,UAAU,QAAQ1B,UAAAA,CAAWyB,SAAAA;AAAAA,KACtDE,GAAAA;EAAAA,SACMb,IAAAA;EAAAA,SACAC,IAAAA,EAAMb,WAAAA;EAAAA,SACNO,OAAAA,UAlB+C;EAAA,SAmB/CT,UAAAA,EAAYwB,sBAAAA;EAlBJ;;;;EAuBjBlB,IAAAA,gBAAoBL,CAAAA,CAAEmB,OAAAA,kBAAyBnB,CAAAA,CAAEmB,OAAAA,EAASS,QAAAA,UAAkBC,GAAAA,EAAKb,iBAAAA,CAAkBC,MAAAA,EAAQC,OAAAA,IAAWpB,wBAAAA,CAAyBE,CAAAA,CAAE2B,KAAAA,CAAMV,MAAAA,GAASjB,CAAAA,CAAE2B,KAAAA,CAAMT,OAAAA,GAAUf,MAAAA;IAChLI,UAAAA;EAAAA,cACYgB,sBAAAA;AAAAA;;;AArBM;AAAA;;;KCNV,cAAA,GAAiB,IAAA,CAAK,gBAAA;oGAEhC,MAAA,GAAS,eAAA;AAAA;;iBAIK,SAAA,CAAU,KAAA,EAAO,cAAA,GAAiB,GAAG"}
1
+ {"version":3,"file":"app.d.mts","names":["ActionDefinitionInput","Credential","ResolvedCredentials","WorkflowActionDefinition","z","AppAuthKind","DefineKeystrokeAppInput","slug","auth","DefineApiKeyAppInput","ZodTypeAny","Record","credential","DefineOAuthAppInput","tokenField","DefineAppInput","AppActionDefinition","TInput","TOutput","TCred","ZodType","Omit","App","infer","action","def","defineApp","S","R","ZodObject","input"],"sources":["../../app/dist/index.d.mts"],"mappings":";;;;;;;KAKKK,WAAAA;;KAEAC,uBAAAA;EAFW,iFAGmEC,IAAAA;EACjFC,IAAI;AAAA;;KAGDC,oBAAAA;EACHF,IAAAA;EACAC,IAAAA,aALI;EAMJI,UAAAA,EAAYD,MAAM,SAASP,CAAAA,CAAEM,UAAAA;AAAAA;;KAG1BG,mBAAAA;EACHN,IAAAA;EACAC,IAAAA,WANAA;EAOAM,UAAAA;AAAAA;AAAAA,KAEGC,cAAAA,GAAiBT,uBAAAA,GAA0BG,oBAAAA,GAAuBI,mBAAAA;;KAElEG,mBAAAA,gBAAmCZ,CAAAA,CAAEgB,OAAAA,kBAAyBhB,CAAAA,CAAEgB,OAAAA,gBAAuBnB,UAAAA,IAAcoB,IAAAA,CAAKrB,qBAAAA,CAAsBiB,MAAAA,EAAQC,OAAAA,EAAShB,mBAAAA,WAA8BiB,KAAAA;AAAAA,KAC/KG,GAAAA,eAAkBrB,UAAAA,GAAaA,UAAAA;EAAAA,SACzBM,IAAAA;EAAAA,SACAC,IAAAA,EAAMH,WAAAA,EAVO;EAAA,SAWbO,UAAAA,EAAYO,KAAAA;EAXC;;;;EAgBtBK,MAAAA,gBAAsBpB,CAAAA,CAAEgB,OAAAA,kBAAyBhB,CAAAA,CAAEgB,OAAAA,EAASK,GAAAA,EAAKT,mBAAAA,CAAoBC,MAAAA,EAAQC,OAAAA,EAASC,KAAAA,IAAShB,wBAAAA,CAAyBC,CAAAA,CAAEmB,KAAAA,CAAMN,MAAAA,GAASb,CAAAA,CAAEmB,KAAAA,CAAML,OAAAA,GAAUhB,mBAAAA,WAA8BiB,KAAAA,cAAmBA,KAAAA;AAAAA;AAblN;;;;AAAA,iBAmBKO,SAAAA,6BAAsCf,MAAAA,SAAeP,CAAAA,CAAEM,UAAAA,EAAAA,CAAaoB,KAAAA;EACnFvB,IAAAA,EAAMoB,CAAAA;EACNnB,IAAAA;EACAI,UAAAA,EAAYgB,CAAAA;AAAAA,IACVN,GAAAA,CAAIrB,UAAAA,CAAW0B,CAAAA,EAAGvB,CAAAA,CAAEyB,SAAAA,CAAUD,CAAAA;AAAAA,iBACjBF,SAAAA,CAAUI,KAAAA,EAAOjB,mBAAAA,GAAsBS,GAAG;AAAA,iBAC1CI,SAAAA,CAAUI,KAAAA,EAAOxB,uBAAAA,GAA0BgB,GAAG"}
package/dist/app.mjs CHANGED
@@ -1,20 +1,17 @@
1
- import { _ as credential, r as defineAction } from "./dist-CFy63Npi.mjs";
2
- import { createKeystrokeClient } from "./client.mjs";
1
+ import { _ as credential, r as defineAction } from "./dist-DgjcBE-O.mjs";
3
2
  import "zod";
4
3
  //#region ../app/dist/index.mjs
5
- /**
6
- * Author a connectable app: one templated credential, tools as data, execution via `execute`.
7
- * Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.
8
- */
9
- function defineApp$1(input) {
4
+ function appCredentialFor(slug, input) {
5
+ if (input.auth === "api_key") return credential.static(slug, input.credential);
6
+ if (input.auth === "oauth") return input.tokenField !== void 0 ? credential.oauth(slug, { tokenField: input.tokenField }) : credential.oauth(slug);
7
+ return credential.keystroke(slug);
8
+ }
9
+ function defineApp(input) {
10
10
  const slug = input.slug.trim();
11
11
  if (!slug) throw new Error("defineApp requires a non-empty slug");
12
12
  const auth = input.auth ?? "keystroke";
13
- const version = input.version.trim();
14
- if (!version) throw new Error("defineApp requires a non-empty version");
15
- const appCredential = credential.keystroke(slug);
16
- const execute = input.execute;
17
- function tool(toolSlug, def) {
13
+ const appCredential = appCredentialFor(slug, input);
14
+ function action(def) {
18
15
  return defineAction({
19
16
  slug: def.slug,
20
17
  ...def.name !== void 0 ? { name: def.name } : {},
@@ -22,50 +19,17 @@ function defineApp$1(input) {
22
19
  input: def.input,
23
20
  output: def.output,
24
21
  credentials: [appCredential],
25
- async run(runInput, credentials) {
26
- const resolved = credentials[slug];
27
- const result = await execute({
28
- app: slug,
29
- tool: toolSlug,
30
- arguments: runInput,
31
- version,
32
- ...resolved?.instanceId ? { instanceId: resolved.instanceId } : {}
33
- });
34
- return def.output.parse(result);
35
- }
22
+ run: def.run
36
23
  });
37
24
  }
38
25
  return {
39
26
  slug,
40
27
  auth,
41
- version,
42
28
  credential: appCredential,
43
- tool
29
+ action
44
30
  };
45
31
  }
46
32
  //#endregion
47
- //#region src/app.ts
48
- /** Keystroke MCP app — wires `defineApp` to the platform gateway client. */
49
- function defineApp(input) {
50
- let client = input.client;
51
- const getClient = () => client ??= createKeystrokeClient();
52
- return defineApp$1({
53
- slug: input.slug,
54
- ...input.auth !== void 0 ? { auth: input.auth } : {},
55
- version: input.version,
56
- async execute({ app, tool, arguments: args, instanceId, version }) {
57
- const { result } = await getClient().tools.execute({
58
- app,
59
- tool,
60
- arguments: args,
61
- version,
62
- ...instanceId ? { instanceId } : {}
63
- });
64
- return result;
65
- }
66
- });
67
- }
68
- //#endregion
69
33
  export { defineApp };
70
34
 
71
35
  //# sourceMappingURL=app.mjs.map
package/dist/app.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.mjs","names":["defineApp","defineAppCore"],"sources":["../../app/dist/index.mjs","../src/app.ts"],"sourcesContent":["import { credential, defineAction } from \"@keystrokehq/action\";\nimport \"zod\";\n//#region src/define-app.ts\n/**\n* Author a connectable app: one templated credential, tools as data, execution via `execute`.\n* Auth-specific wiring (e.g. Keystroke MCP gateway) lives in the caller or a facade package.\n*/\nfunction defineApp(input) {\n\tconst slug = input.slug.trim();\n\tif (!slug) throw new Error(\"defineApp requires a non-empty slug\");\n\tconst auth = input.auth ?? \"keystroke\";\n\tconst version = input.version.trim();\n\tif (!version) throw new Error(\"defineApp requires a non-empty version\");\n\tconst appCredential = credential.keystroke(slug);\n\tconst execute = input.execute;\n\tfunction tool(toolSlug, def) {\n\t\treturn defineAction({\n\t\t\tslug: def.slug,\n\t\t\t...def.name !== void 0 ? { name: def.name } : {},\n\t\t\t...def.description !== void 0 ? { description: def.description } : {},\n\t\t\tinput: def.input,\n\t\t\toutput: def.output,\n\t\t\tcredentials: [appCredential],\n\t\t\tasync run(runInput, credentials) {\n\t\t\t\tconst resolved = credentials[slug];\n\t\t\t\tconst result = await execute({\n\t\t\t\t\tapp: slug,\n\t\t\t\t\ttool: toolSlug,\n\t\t\t\t\targuments: runInput,\n\t\t\t\t\tversion,\n\t\t\t\t\t...resolved?.instanceId ? { instanceId: resolved.instanceId } : {}\n\t\t\t\t});\n\t\t\t\treturn def.output.parse(result);\n\t\t\t}\n\t\t});\n\t}\n\treturn {\n\t\tslug,\n\t\tauth,\n\t\tversion,\n\t\tcredential: appCredential,\n\t\ttool\n\t};\n}\n//#endregion\nexport { defineApp };\n\n//# sourceMappingURL=index.mjs.map","import {\n defineApp as defineAppCore,\n type App,\n type AppAuthKind,\n type AppToolDefinition,\n type DefineAppInput as CoreDefineAppInput,\n} from \"@keystrokehq/app\";\n\nimport { createKeystrokeClient, type KeystrokeClient } from \"./client\";\n\nexport type { App, AppAuthKind, AppToolDefinition };\n\nexport type DefineAppInput = Omit<CoreDefineAppInput, \"execute\"> & {\n /** Test seam — defaults to a client resolved from `KEYSTROKE_API_KEY` / `PUBLIC_PLATFORM_URL`. */\n client?: KeystrokeClient;\n};\n\n/** Keystroke MCP app — wires `defineApp` to the platform gateway client. */\nexport function defineApp(input: DefineAppInput): App {\n let client = input.client;\n const getClient = (): KeystrokeClient => (client ??= createKeystrokeClient());\n\n return defineAppCore({\n slug: input.slug,\n ...(input.auth !== undefined ? { auth: input.auth } : {}),\n version: input.version,\n async execute({ app, tool, arguments: args, instanceId, version }) {\n const { result } = await getClient().tools.execute({\n app,\n tool,\n arguments: args,\n version,\n ...(instanceId ? { instanceId } : {}),\n });\n return result;\n },\n });\n}\n"],"mappings":";;;;;;;;AAOA,SAASA,YAAU,OAAO;CACzB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,qCAAqC;CAChE,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,UAAU,MAAM,QAAQ,KAAK;CACnC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,wCAAwC;CACtE,MAAM,gBAAgB,WAAW,UAAU,IAAI;CAC/C,MAAM,UAAU,MAAM;CACtB,SAAS,KAAK,UAAU,KAAK;EAC5B,OAAO,aAAa;GACnB,MAAM,IAAI;GACV,GAAG,IAAI,SAAS,KAAK,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GAC/C,GAAG,IAAI,gBAAgB,KAAK,IAAI,EAAE,aAAa,IAAI,YAAY,IAAI,CAAC;GACpE,OAAO,IAAI;GACX,QAAQ,IAAI;GACZ,aAAa,CAAC,aAAa;GAC3B,MAAM,IAAI,UAAU,aAAa;IAChC,MAAM,WAAW,YAAY;IAC7B,MAAM,SAAS,MAAM,QAAQ;KAC5B,KAAK;KACL,MAAM;KACN,WAAW;KACX;KACA,GAAG,UAAU,aAAa,EAAE,YAAY,SAAS,WAAW,IAAI,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,OAAO,MAAM,MAAM;GAC/B;EACD,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA;EACA,YAAY;EACZ;CACD;AACD;;;;ACzBA,SAAgB,UAAU,OAA4B;CACpD,IAAI,SAAS,MAAM;CACnB,MAAM,kBAAoC,WAAW,sBAAsB;CAE3E,OAAOC,YAAc;EACnB,MAAM,MAAM;EACZ,GAAI,MAAM,SAAS,KAAA,IAAY,EAAE,MAAM,MAAM,KAAK,IAAI,CAAC;EACvD,SAAS,MAAM;EACf,MAAM,QAAQ,EAAE,KAAK,MAAM,WAAW,MAAM,YAAY,WAAW;GACjE,MAAM,EAAE,WAAW,MAAM,UAAU,EAAE,MAAM,QAAQ;IACjD;IACA;IACA,WAAW;IACX;IACA,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC;GACrC,CAAC;GACD,OAAO;EACT;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"app.mjs","names":[],"sources":["../../app/dist/index.mjs"],"sourcesContent":["import { credential, defineAction } from \"@keystrokehq/action\";\nimport \"zod\";\n//#region src/define-app.ts\nfunction appCredentialFor(slug, input) {\n\tif (input.auth === \"api_key\") return credential.static(slug, input.credential);\n\tif (input.auth === \"oauth\") return input.tokenField !== void 0 ? credential.oauth(slug, { tokenField: input.tokenField }) : credential.oauth(slug);\n\treturn credential.keystroke(slug);\n}\nfunction defineApp(input) {\n\tconst slug = input.slug.trim();\n\tif (!slug) throw new Error(\"defineApp requires a non-empty slug\");\n\tconst auth = input.auth ?? \"keystroke\";\n\tconst appCredential = appCredentialFor(slug, input);\n\tfunction action(def) {\n\t\treturn defineAction({\n\t\t\tslug: def.slug,\n\t\t\t...def.name !== void 0 ? { name: def.name } : {},\n\t\t\t...def.description !== void 0 ? { description: def.description } : {},\n\t\t\tinput: def.input,\n\t\t\toutput: def.output,\n\t\t\tcredentials: [appCredential],\n\t\t\trun: def.run\n\t\t});\n\t}\n\treturn {\n\t\tslug,\n\t\tauth,\n\t\tcredential: appCredential,\n\t\taction\n\t};\n}\n//#endregion\nexport { defineApp };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAGA,SAAS,iBAAiB,MAAM,OAAO;CACtC,IAAI,MAAM,SAAS,WAAW,OAAO,WAAW,OAAO,MAAM,MAAM,UAAU;CAC7E,IAAI,MAAM,SAAS,SAAS,OAAO,MAAM,eAAe,KAAK,IAAI,WAAW,MAAM,MAAM,EAAE,YAAY,MAAM,WAAW,CAAC,IAAI,WAAW,MAAM,IAAI;CACjJ,OAAO,WAAW,UAAU,IAAI;AACjC;AACA,SAAS,UAAU,OAAO;CACzB,MAAM,OAAO,MAAM,KAAK,KAAK;CAC7B,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,qCAAqC;CAChE,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,gBAAgB,iBAAiB,MAAM,KAAK;CAClD,SAAS,OAAO,KAAK;EACpB,OAAO,aAAa;GACnB,MAAM,IAAI;GACV,GAAG,IAAI,SAAS,KAAK,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;GAC/C,GAAG,IAAI,gBAAgB,KAAK,IAAI,EAAE,aAAa,IAAI,YAAY,IAAI,CAAC;GACpE,OAAO,IAAI;GACX,QAAQ,IAAI;GACZ,aAAa,CAAC,aAAa;GAC3B,KAAK,IAAI;EACV,CAAC;CACF;CACA,OAAO;EACN;EACA;EACA,YAAY;EACZ;CACD;AACD"}
package/dist/config.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { h as OAuthTokenRefreshRegistry } from "./index-hf0OTB6M.cjs";
1
+ import { h as OAuthTokenRefreshRegistry } from "./index-e9f4pcX4.cjs";
2
2
  import { Context, Hono } from "hono";
3
3
 
4
4
  //#region ../oauth/dist/index.d.mts
package/dist/config.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { h as OAuthTokenRefreshRegistry } from "./index-hf0OTB6M.mjs";
1
+ import { h as OAuthTokenRefreshRegistry } from "./index-e9f4pcX4.mjs";
2
2
  import { Context, Hono } from "hono";
3
3
 
4
4
  //#region ../oauth/dist/index.d.mts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_dist = require("./dist-DEwBt6Ee.cjs");
2
+ const require_dist = require("./dist-B3WT5qgl.cjs");
3
3
  exports.CREDENTIAL_SCOPE_TYPES = require_dist.CREDENTIAL_SCOPE_TYPES;
4
4
  exports.credential = require_dist.credential;
5
5
  exports.credentialInputSchema = require_dist.credentialInputSchema;
@@ -1,2 +1,2 @@
1
- import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-hf0OTB6M.cjs";
1
+ import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-e9f4pcX4.cjs";
2
2
  export { CREDENTIAL_SCOPE_TYPES, type Credential, type CredentialAuthKind, type CredentialInput, type CredentialList, type CredentialRequirement, type CredentialScopeType, type DefineCredentialInput, type DefineOAuthCredentialInput, type DefineStaticCredentialInput, type NormalizeCredential, type ResolvedCredentials, credential, credentialInputSchema, defineCredential, isCredentialInput, normalizeCredentialList, toCredentialRequirement };
@@ -1,2 +1,2 @@
1
- import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-hf0OTB6M.mjs";
1
+ import { C as isCredentialInput, S as defineCredential, T as toCredentialRequirement, a as CredentialInput, b as credential, d as DefineOAuthCredentialInput, f as DefineStaticCredentialInput, l as CredentialScopeType, n as Credential, o as CredentialList, p as NormalizeCredential, r as CredentialAuthKind, s as CredentialRequirement, t as CREDENTIAL_SCOPE_TYPES, u as DefineCredentialInput, v as ResolvedCredentials, w as normalizeCredentialList, x as credentialInputSchema } from "./index-e9f4pcX4.mjs";
2
2
  export { CREDENTIAL_SCOPE_TYPES, type Credential, type CredentialAuthKind, type CredentialInput, type CredentialList, type CredentialRequirement, type CredentialScopeType, type DefineCredentialInput, type DefineOAuthCredentialInput, type DefineStaticCredentialInput, type NormalizeCredential, type ResolvedCredentials, credential, credentialInputSchema, defineCredential, isCredentialInput, normalizeCredentialList, toCredentialRequirement };