@keystrokehq/keystroke 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action.cjs +3 -1
- package/dist/action.d.cts +3 -3
- package/dist/action.d.mts +3 -3
- package/dist/action.mjs +2 -2
- package/dist/agent.cjs +21 -10
- package/dist/agent.cjs.map +1 -1
- package/dist/agent.d.cts +2 -2
- package/dist/agent.d.mts +2 -2
- package/dist/agent.mjs +21 -10
- package/dist/agent.mjs.map +1 -1
- package/dist/app.cjs +1 -1
- package/dist/app.d.cts +2 -2
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +1 -1
- package/dist/client.cjs +13 -7
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts.map +1 -1
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +13 -7
- package/dist/client.mjs.map +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/credentials.cjs +1 -1
- package/dist/credentials.d.cts +1 -1
- package/dist/credentials.d.mts +1 -1
- package/dist/credentials.mjs +1 -1
- package/dist/{dist-DQL6zTI5.cjs → dist-C0fPHFaM.cjs} +20 -11
- package/dist/dist-C0fPHFaM.cjs.map +1 -0
- package/dist/{dist-DqFdFpiB.mjs → dist-CppO7361.mjs} +92 -9
- package/dist/dist-CppO7361.mjs.map +1 -0
- package/dist/{dist-C5otI4u3.cjs → dist-DivFQzKG.cjs} +236 -41
- package/dist/dist-DivFQzKG.cjs.map +1 -0
- package/dist/{dist-DOMwPx7V.cjs → dist-HI6bM6LK.cjs} +103 -8
- package/dist/dist-HI6bM6LK.cjs.map +1 -0
- package/dist/{dist-IUl7Bexl.mjs → dist-UzTnzZem.mjs} +231 -42
- package/dist/dist-UzTnzZem.mjs.map +1 -0
- package/dist/{dist-BpkCqbil.mjs → dist-nvW8vbKn.mjs} +20 -11
- package/dist/dist-nvW8vbKn.mjs.map +1 -0
- package/dist/{index-BMqj40Li.d.cts → index-3P7ec4Vo.d.cts} +4 -2
- package/dist/index-3P7ec4Vo.d.cts.map +1 -0
- package/dist/{index-nUAXCgEe.d.cts → index-BTz2OMAM.d.cts} +13 -3
- package/dist/index-BTz2OMAM.d.cts.map +1 -0
- package/dist/{index-8_UEbXaF.d.mts → index-Cq2F2XdS.d.mts} +13 -3
- package/dist/index-Cq2F2XdS.d.mts.map +1 -0
- package/dist/{index-Dgy9MjuX.d.cts → index-D4dAsbJr.d.cts} +20 -3
- package/dist/index-D4dAsbJr.d.cts.map +1 -0
- package/dist/{index-CWZAGTad.d.mts → index-D7UUmswR.d.mts} +4 -2
- package/dist/index-D7UUmswR.d.mts.map +1 -0
- package/dist/{index-BeBgntxT.d.mts → index-DdAOmbQc.d.mts} +9 -16
- package/dist/index-DdAOmbQc.d.mts.map +1 -0
- package/dist/{index-BY9SPR2h.d.cts → index-Ohwnfidc.d.cts} +9 -16
- package/dist/index-Ohwnfidc.d.cts.map +1 -0
- package/dist/{index-Bl4VEelg.d.mts → index-Sx9T2i0u.d.mts} +20 -3
- package/dist/index-Sx9T2i0u.d.mts.map +1 -0
- package/dist/{index-e9f4pcX4.d.cts → index-WT4ULMiw.d.cts} +14 -3
- package/dist/index-WT4ULMiw.d.cts.map +1 -0
- package/dist/{index-e9f4pcX4.d.mts → index-WT4ULMiw.d.mts} +14 -3
- package/dist/index-WT4ULMiw.d.mts.map +1 -0
- package/dist/{mistral-wOLLEgb9.cjs → mistral-CSlOhLAJ.cjs} +2 -2
- package/dist/{mistral-wOLLEgb9.cjs.map → mistral-CSlOhLAJ.cjs.map} +1 -1
- package/dist/{mistral-CMDejXQt.mjs → mistral-StBMjPiK.mjs} +2 -2
- package/dist/{mistral-CMDejXQt.mjs.map → mistral-StBMjPiK.mjs.map} +1 -1
- package/dist/{sse-DI7TsPKG.mjs → sse-CDOw-yuH.mjs} +2 -2
- package/dist/{sse-DI7TsPKG.mjs.map → sse-CDOw-yuH.mjs.map} +1 -1
- package/dist/{sse-Dzs73rQw.cjs → sse-CZOklzgA.cjs} +2 -2
- package/dist/{sse-Dzs73rQw.cjs.map → sse-CZOklzgA.cjs.map} +1 -1
- package/dist/trigger.cjs +1 -1
- package/dist/trigger.d.cts +3 -3
- package/dist/trigger.d.mts +3 -3
- package/dist/trigger.mjs +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.mts +2 -2
- package/dist/workflow.mjs +1 -1
- package/package.json +1 -1
- package/dist/dist-BpkCqbil.mjs.map +0 -1
- package/dist/dist-C5otI4u3.cjs.map +0 -1
- package/dist/dist-DOMwPx7V.cjs.map +0 -1
- package/dist/dist-DQL6zTI5.cjs.map +0 -1
- package/dist/dist-DqFdFpiB.mjs.map +0 -1
- package/dist/dist-IUl7Bexl.mjs.map +0 -1
- package/dist/index-8_UEbXaF.d.mts.map +0 -1
- package/dist/index-BMqj40Li.d.cts.map +0 -1
- package/dist/index-BY9SPR2h.d.cts.map +0 -1
- package/dist/index-BeBgntxT.d.mts.map +0 -1
- package/dist/index-Bl4VEelg.d.mts.map +0 -1
- package/dist/index-CWZAGTad.d.mts.map +0 -1
- package/dist/index-Dgy9MjuX.d.cts.map +0 -1
- package/dist/index-e9f4pcX4.d.cts.map +0 -1
- package/dist/index-e9f4pcX4.d.mts.map +0 -1
- package/dist/index-nUAXCgEe.d.cts.map +0 -1
package/dist/agent.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as ThinkingLevel, u as getModel } from "./index-BByNfhJU.cjs";
|
|
2
|
-
import { A as forceToolChoice, B as runAgentPrompt, C as SubagentToolMetadata, D as defineSubagentTool, E as defineAgent, F as prompt, G as AgentModelId, H as snapshot, I as resolveAgentAssets, J as ThinkingLevelSchema, K as AgentModelIdSchema, L as resolveAgentId, M as messages, N as normalizeAgentDefinition, O as defineTool, P as prepareAgentSession, R as resolveAgentTools, S as SubagentToolInherit, T as createAgent, U as AgentCreateInput, V as runLlm, W as AgentCreateInputSchema, X as resolveAgentModel, Y as parseAgentCreateInput, Z as resolveThinkingLevel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentTool, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as getSubagentToolMetadata, k as errorMessage, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as DEFAULT_THINKING_LEVEL, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SessionLifecycle, w as buildAgentRuntime, x as SubagentToolDetails, y as SessionLifecycleContext, z as resolveAgentWorkspaceRoot } from "./index-
|
|
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-
|
|
2
|
+
import { A as forceToolChoice, B as runAgentPrompt, C as SubagentToolMetadata, D as defineSubagentTool, E as defineAgent, F as prompt, G as AgentModelId, H as snapshot, I as resolveAgentAssets, J as ThinkingLevelSchema, K as AgentModelIdSchema, L as resolveAgentId, M as messages, N as normalizeAgentDefinition, O as defineTool, P as prepareAgentSession, R as resolveAgentTools, S as SubagentToolInherit, T as createAgent, U as AgentCreateInput, V as runLlm, W as AgentCreateInputSchema, X as resolveAgentModel, Y as parseAgentCreateInput, Z as resolveThinkingLevel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentTool, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as getSubagentToolMetadata, k as errorMessage, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as DEFAULT_THINKING_LEVEL, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SessionLifecycle, w as buildAgentRuntime, x as SubagentToolDetails, y as SessionLifecycleContext, z as resolveAgentWorkspaceRoot } from "./index-Ohwnfidc.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-BTz2OMAM.cjs";
|
|
4
4
|
import { z as loadAssetManifest } from "./index-DstR-eGs.cjs";
|
|
5
5
|
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 SessionLifecycle, type SessionLifecycleContext, 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,5 +1,5 @@
|
|
|
1
1
|
import { l as ThinkingLevel, u as getModel } from "./index-ClGiGBy7.mjs";
|
|
2
|
-
import { A as forceToolChoice, B as runAgentPrompt, C as SubagentToolMetadata, D as defineSubagentTool, E as defineAgent, F as prompt, G as AgentModelId, H as snapshot, I as resolveAgentAssets, J as ThinkingLevelSchema, K as AgentModelIdSchema, L as resolveAgentId, M as messages, N as normalizeAgentDefinition, O as defineTool, P as prepareAgentSession, R as resolveAgentTools, S as SubagentToolInherit, T as createAgent, U as AgentCreateInput, V as runLlm, W as AgentCreateInputSchema, X as resolveAgentModel, Y as parseAgentCreateInput, Z as resolveThinkingLevel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentTool, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as getSubagentToolMetadata, k as errorMessage, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as DEFAULT_THINKING_LEVEL, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SessionLifecycle, w as buildAgentRuntime, x as SubagentToolDetails, y as SessionLifecycleContext, z as resolveAgentWorkspaceRoot } from "./index-
|
|
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-
|
|
2
|
+
import { A as forceToolChoice, B as runAgentPrompt, C as SubagentToolMetadata, D as defineSubagentTool, E as defineAgent, F as prompt, G as AgentModelId, H as snapshot, I as resolveAgentAssets, J as ThinkingLevelSchema, K as AgentModelIdSchema, L as resolveAgentId, M as messages, N as normalizeAgentDefinition, O as defineTool, P as prepareAgentSession, R as resolveAgentTools, S as SubagentToolInherit, T as createAgent, U as AgentCreateInput, V as runLlm, W as AgentCreateInputSchema, X as resolveAgentModel, Y as parseAgentCreateInput, Z as resolveThinkingLevel, _ as SessionAgentMismatchError, a as AgentDefinitionInput, b as SubagentTool, c as BuildAgentRuntimeContext, d as PromptInput, f as PromptResponse, g as SandboxedAgentRuntime, h as SUBAGENT_TOOL, i as AgentDefinition, j as getSubagentToolMetadata, k as errorMessage, l as DefineSubagentToolInput, m as RunAgentPromptOptions, n as AgentAssetInput, o as AgentRuntime, p as ResolvedAgentAssets, q as DEFAULT_THINKING_LEVEL, r as AgentConfig, s as AgentSnapshot, t as Agent, u as ForcedToolChoice, v as SessionLifecycle, w as buildAgentRuntime, x as SubagentToolDetails, y as SessionLifecycleContext, z as resolveAgentWorkspaceRoot } from "./index-DdAOmbQc.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-Cq2F2XdS.mjs";
|
|
4
4
|
import { z as loadAssetManifest } from "./index-B3iWqXUd.mjs";
|
|
5
5
|
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 SessionLifecycle, type SessionLifecycleContext, 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,6 +1,6 @@
|
|
|
1
1
|
import { i as __require, r as __exportAll, t as __commonJSMin } from "./chunk-D0VCBZRD.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
2
|
+
import { O as toolParameters, c as getRunSignal, f as isWithinActionExecution, h as resolveActionTool, l as getWorkflowRunHandle, u as isAction } from "./dist-CppO7361.mjs";
|
|
3
|
+
import { A as recordLlmUsageFromAssistantMessage, C as appendEvent, D as getProjectScopeId, E as getAgentByRoute, F as captureConsole, I as getTraceContext, M as setSessionLiveMessage, N as setSessionTitle, O as getSession, P as touchSession, R as withSpan, S as addAgentSessionDuration, T as createSession, a as resolveActionCredentials, c as connectMcpDefinition, d as defineMcp, f as isMcp, i as isCredentialError, j as resolveRunSourceFromTraceContext, k as listMessageEvents, l as connectMcpServer, n as captureCredentialToolErrors, o as resolveMcpTools, r as createCredentialResolver, s as withCredentialAssignments, t as buildCredentialRunContext, u as connectMcpStdio, w as clearLiveMessage, x as MESSAGE_EVENT_TYPE } from "./dist-UzTnzZem.mjs";
|
|
4
4
|
import { $t as _Object_, An as IsFunction$1, At as IsNull$2, Bn as IsNull$1, Bt as IsBoolean$2, Cn as IsAsyncIterator$1, Ct as EnumToUnion, Dn as IsConstructor$1, Dt as IsSymbol$2, En as IsClassInstance, Et as String$1, Fn as IsLessEqualThan$1, Ft as IsLiteralString, Gn as IsSymbol$1, Gt as Unreachable, Hn as IsObject$1, Ht as IsCodec, In as IsLessThan$1, It as Literal, J as getBoundAppRoot, Jn as IsValueLike, Jt as IsCyclic, Kn as IsUndefined$1, Kt as IsIntersect, Ln as IsMaxLength$2, Lt as IsIterator$2, Mn as IsGreaterThan$1, Mt as IsLiteralBigInt, Nn as IsInteger$1, Nt as IsLiteralBoolean, On as IsDeepEqual$1, Ot as IsNumber$2, Pn as IsIterator$1, Pt as IsLiteralNumber, Qt as IsObject$2, Rn as IsMinLength$2, Rt as IsInteger$2, Sn as IsArray$1, St as IsTuple, Tn as IsBoolean$1, Tt as IsString$2, Un as IsObjectNotArray$1, Ut as Hash, Vn as IsNumber$1, Vt as IsBigInt$2, Wn as IsString$1, Wt as hash_exports, X as materializeSandbox, Xn as Symbols, Xt as IsUnion, Y as loadAssetManifest, Yn as Keys$1, Yt as Unknown, Zn as guard_exports, Zt as Union, _n as Entries$2, _t as IsVoid, a as defaultWorkspacesRoot, an as IsAsyncIterator$2, bn as EveryAll, bt as RecordPattern, cn as IsBase, ct as ensureWorkspaceDir, dn as IsPromise, dt as resolveSessionRoot, en as IsNever, fn as IsSchema$1, ft as Evaluate$1, gn as IsTypeArray, gt as IsTemplateLiteral, hn as IsSet, ht as Compare, i as createSandbox, in as IsConstructor$2, jn as IsGreaterEqualThan$1, jt as IsLiteral, kn as IsEqual$1, kt as Number$1, l as materializeSkills, ln as IsOptional, lt as resolveAgentRoot, mn as IsMap, mt as Options, n as createInvokeToolBridge, nn as Ref$1, o as defineSkill, on as IsArray$2, p as sandboxSystemPromptInjection, pn as Get$3, pt as Instantiate, qn as IsUnsafePropertyKey, qt as IsEnum$1, rn as IsFunction$2, sn as Base, tn as IsRef$1, tt as resolveSandboxDefinition, un as Optional, vn as EntriesRegExp, vt as IsUndefined$2, wn as IsBigInt$1, wt as TemplateLiteralDecode, xn as HasPropertyKey$1, xt as RecordValue, yn as Every$1, yt as IsRecord, zn as IsMultipleOf$1, zt as Boolean$1 } from "./dist-CRsUBf24.mjs";
|
|
5
5
|
import "./env-api-keys-24ayFQZr.mjs";
|
|
6
6
|
import { i as getModel, t as AssistantMessageEventStream } from "./event-stream-C7YBbzsc.mjs";
|
|
@@ -901,7 +901,7 @@ function loadGoogleVertexProviderModule() {
|
|
|
901
901
|
return googleVertexProviderModulePromise;
|
|
902
902
|
}
|
|
903
903
|
function loadMistralProviderModule() {
|
|
904
|
-
mistralProviderModulePromise ||= import("./mistral-
|
|
904
|
+
mistralProviderModulePromise ||= import("./mistral-StBMjPiK.mjs").then((module) => {
|
|
905
905
|
const provider = module;
|
|
906
906
|
return {
|
|
907
907
|
stream: provider.streamMistral,
|
|
@@ -14235,7 +14235,7 @@ async function resolveAgentWorkspaceRoot(agentId, sessionId, options) {
|
|
|
14235
14235
|
sessionRoot
|
|
14236
14236
|
};
|
|
14237
14237
|
}
|
|
14238
|
-
async function resolveAgentTools(tools, resolver) {
|
|
14238
|
+
async function resolveAgentTools(tools, resolver, options) {
|
|
14239
14239
|
const prepared = [];
|
|
14240
14240
|
const mcpConnections = [];
|
|
14241
14241
|
for (const item of tools) {
|
|
@@ -14254,8 +14254,10 @@ async function resolveAgentTools(tools, resolver) {
|
|
|
14254
14254
|
}),
|
|
14255
14255
|
consumer: {
|
|
14256
14256
|
kind: "tool",
|
|
14257
|
-
name: item.slug
|
|
14258
|
-
|
|
14257
|
+
name: item.slug,
|
|
14258
|
+
id: item.slug
|
|
14259
|
+
},
|
|
14260
|
+
mcpCredentialContext: options?.mcpCredentialContext
|
|
14259
14261
|
}));
|
|
14260
14262
|
continue;
|
|
14261
14263
|
}
|
|
@@ -14273,7 +14275,7 @@ async function resolveMemoryFactory(memoryOption, defMemory, injectedFactory) {
|
|
|
14273
14275
|
return createDefaultMemory(typeof option === "object" ? option : {});
|
|
14274
14276
|
}
|
|
14275
14277
|
/** Sandbox tools + host tools → pi agent from a {@link AgentDefinition}. */
|
|
14276
|
-
async function buildAgentRuntime(def, ctx, runPrompt = {}) {
|
|
14278
|
+
async function buildAgentRuntime(def, ctx, runPrompt = {}, agentSlug) {
|
|
14277
14279
|
const { agentRoot, sessionRoot } = await resolveAgentWorkspaceRoot(ctx.agentId, ctx.sessionId, {
|
|
14278
14280
|
workspacesRoot: runPrompt.workspacesRoot,
|
|
14279
14281
|
agentRoot: runPrompt.agentRoot,
|
|
@@ -14291,12 +14293,21 @@ async function buildAgentRuntime(def, ctx, runPrompt = {}) {
|
|
|
14291
14293
|
agentId: ctx.agentId,
|
|
14292
14294
|
sessionId: ctx.sessionId
|
|
14293
14295
|
}) : void 0;
|
|
14296
|
+
const credentialContext = buildCredentialRunContext({ request: runPrompt.credentials });
|
|
14297
|
+
const assignmentTargetKey = agentSlug ?? runPrompt.tracing?.agentKey;
|
|
14294
14298
|
const resolver = createCredentialResolver({
|
|
14295
|
-
context:
|
|
14299
|
+
context: assignmentTargetKey ? await withCredentialAssignments(credentialContext, {
|
|
14300
|
+
targetType: "agent",
|
|
14301
|
+
targetKey: assignmentTargetKey
|
|
14302
|
+
}) : credentialContext,
|
|
14296
14303
|
oauthAdapter: runPrompt.oauthAdapter
|
|
14297
14304
|
});
|
|
14298
14305
|
const memoryTools = memory ? [memory.tool] : [];
|
|
14299
|
-
const
|
|
14306
|
+
const mcpCredentialContext = assignmentTargetKey ? { assignmentTarget: {
|
|
14307
|
+
type: "agent",
|
|
14308
|
+
key: assignmentTargetKey
|
|
14309
|
+
} } : void 0;
|
|
14310
|
+
const resolved = await resolveAgentTools(def.tools ?? [], resolver, { mcpCredentialContext });
|
|
14300
14311
|
const captured = captureCredentialToolErrors([
|
|
14301
14312
|
...memoryTools,
|
|
14302
14313
|
...resolved.tools,
|
|
@@ -14409,7 +14420,7 @@ function defineAgent(input) {
|
|
|
14409
14420
|
slug,
|
|
14410
14421
|
...input.name !== void 0 ? { name: input.name } : {},
|
|
14411
14422
|
...input.description !== void 0 ? { description: input.description } : {},
|
|
14412
|
-
buildRuntime: (ctx, runPrompt) => buildAgentRuntime(def, ctx, runPrompt),
|
|
14423
|
+
buildRuntime: (ctx, runPrompt) => buildAgentRuntime(def, ctx, runPrompt, slug),
|
|
14413
14424
|
prompt: (promptInput, runPrompt) => {
|
|
14414
14425
|
const handle = getWorkflowRunHandle();
|
|
14415
14426
|
if (handle?.agentRunner && !isWithinActionExecution() && !isWithinAgentPromptExecution()) {
|