@nylorun/core 0.19.0-beta → 0.21.0-beta
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/CHANGELOG.md +191 -0
- package/README.md +2 -2
- package/dist/compatibility.d.ts +148 -32
- package/dist/compatibility.js +154 -33
- package/dist/contracts.d.ts +2714 -495
- package/dist/contracts.js +1395 -493
- package/dist/define.d.ts +15 -12
- package/dist/define.js +11 -7
- package/dist/definition/approval.d.ts +16 -0
- package/dist/definition/approval.js +33 -0
- package/dist/definition/assemble.d.ts +6 -10
- package/dist/definition/assemble.js +48 -105
- package/dist/definition/bind-agent.d.ts +3 -4
- package/dist/definition/bind-agent.js +12 -30
- package/dist/definition/binding.d.ts +2 -2
- package/dist/definition/bound.d.ts +10 -10
- package/dist/definition/builder.d.ts +16 -20
- package/dist/definition/builder.js +29 -81
- package/dist/definition/code-tools.d.ts +4 -4
- package/dist/definition/code-tools.js +7 -22
- package/dist/definition/declaration.d.ts +4 -7
- package/dist/definition/declaration.js +29 -99
- package/dist/definition/{tools-capability.d.ts → deferred-tools.d.ts} +3 -13
- package/dist/definition/{tools-capability.js → deferred-tools.js} +2 -18
- package/dist/definition/delegate.d.ts +2 -4
- package/dist/definition/delegate.js +8 -10
- package/dist/definition/flow/compile.js +0 -2
- package/dist/definition/from.d.ts +7 -4
- package/dist/definition/from.js +72 -117
- package/dist/definition/helpers.d.ts +0 -7
- package/dist/definition/helpers.js +0 -5
- package/dist/definition/http-tool.d.ts +7 -4
- package/dist/definition/http-tool.js +6 -10
- package/dist/definition/implementations.d.ts +6 -8
- package/dist/definition/manifest.d.ts +11 -5
- package/dist/definition/manifest.js +27 -26
- package/dist/definition/mcp.d.ts +1 -52
- package/dist/definition/mcp.js +11 -60
- package/dist/definition/media-reference.d.ts +23 -0
- package/dist/definition/media-reference.js +26 -0
- package/dist/definition/removed.d.ts +3 -10
- package/dist/definition/removed.js +10 -17
- package/dist/definition/runtime-manifest.d.ts +30 -0
- package/dist/definition/runtime-manifest.js +132 -0
- package/dist/definition/sandbox-tools.d.ts +1 -1
- package/dist/definition/sandbox-tools.js +1 -1
- package/dist/definition/skill-tools.d.ts +13 -7
- package/dist/definition/skill-tools.js +23 -10
- package/dist/definition/trace.d.ts +18 -0
- package/dist/definition/trace.js +42 -0
- package/dist/definition/variant.d.ts +5 -4
- package/dist/definition/variant.js +23 -55
- package/dist/definition/workflow/runnable.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/harness-api/entries.d.ts +242 -0
- package/dist/harness-api/entries.js +118 -0
- package/dist/harness-api/gates.d.ts +167 -0
- package/dist/harness-api/gates.js +117 -0
- package/dist/harness-api/harness-api.schema.json +4975 -0
- package/dist/harness-api/index.d.ts +19 -3
- package/dist/harness-api/index.js +16 -3
- package/dist/harness-api/json-schema.d.ts +12 -0
- package/dist/harness-api/json-schema.js +61 -0
- package/dist/harness-api/mcp.d.ts +57 -0
- package/dist/harness-api/mcp.js +39 -0
- package/dist/harness-api/messages.d.ts +11 -5
- package/dist/harness-api/messages.js +5 -3
- package/dist/harness-api/schema.d.ts +346 -36
- package/dist/harness-api/schema.js +143 -22
- package/dist/harness-api/transport.d.ts +55 -0
- package/dist/harness-api/transport.js +61 -0
- package/dist/index.d.ts +1 -1
- package/dist/manifest-schemas.d.ts +6 -0
- package/dist/manifest-schemas.js +34 -0
- package/dist/schemas/agent-manifest.schema.json +897 -0
- package/dist/schemas/environment-manifest.schema.json +329 -0
- package/dist/types/agent.d.ts +1 -1
- package/dist/types/manifest.d.ts +48 -28
- package/dist/types/model.d.ts +2 -2
- package/dist/types/observe.d.ts +8 -20
- package/dist/types/part.d.ts +25 -0
- package/dist/types/tool.d.ts +1 -1
- package/dist/types/transcript.d.ts +5 -0
- package/dist/utils/definition-files.d.ts +11 -6
- package/dist/utils/definition-files.js +19 -9
- package/dist/utils/harness-id.d.ts +9 -0
- package/dist/utils/harness-id.js +11 -0
- package/dist/utils/runtime-tools.d.ts +19 -0
- package/dist/utils/runtime-tools.js +30 -0
- package/dist/utils/sandbox.d.ts +1 -1
- package/dist/utils/sandbox.js +1 -1
- package/package.json +11 -4
- package/dist/definition/capability.d.ts +0 -43
- package/dist/definition/capability.js +0 -82
- package/dist/definition/sandbox-capability.d.ts +0 -44
- package/dist/definition/sandbox-capability.js +0 -139
- package/dist/types/middleware.d.ts +0 -94
- /package/dist/types/{middleware.js → part.js} +0 -0
package/dist/define.d.ts
CHANGED
|
@@ -5,18 +5,20 @@ export type { HarnessErrorCode, HarnessErrorDetails, HarnessErrorOptions, } from
|
|
|
5
5
|
export type { AgentTool, BuiltAgent } from "./types/agent.js";
|
|
6
6
|
export { DELEGATE_INPUT_SCHEMA, delegateManifest, delegateOf, delegatesOf, flowDelegatesOf, flowDelegateManifest, isFlowDelegate, } from "./definition/delegate.js";
|
|
7
7
|
export type { Delegate } from "./definition/delegate.js";
|
|
8
|
-
export {
|
|
8
|
+
export { tool } from "./definition/helpers.js";
|
|
9
9
|
export { APPROVAL_MODES, HTTP_TOOL_DEFAULT_TIMEOUT_MS, HTTP_TOOL_MAX_TIMEOUT_MS, HTTP_TOOL_METHODS, http, httpToolOf, isHttpTarget, withHttpTarget, type HttpTarget, type HttpTool, type HttpToolOptions, } from "./definition/http-tool.js";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
10
|
+
export { READ_ARTIFACT_MAX_BYTES, READ_ARTIFACT_TOOL, SAVE_ARTIFACT_TOOL, runtimeManifestFor, runtimeToolOf, type RuntimeManifestOptions, } from "./definition/runtime-manifest.js";
|
|
11
|
+
export { RUNTIME_PART_ID } from "./definition/manifest.js";
|
|
12
|
+
export { RUNTIME_TOOL_NAMES, isRuntimeToolName } from "./utils/runtime-tools.js";
|
|
13
|
+
export { MCP_TOOL_DEFAULTS, mcpToolSettings, McpError, normalizeMcpServers, stdioMcpRefusal, } from "./definition/mcp.js";
|
|
14
|
+
export { SERVER_INSTRUCTIONS_MAX_CHARS, TOOL_CALL_TOOL, TOOL_SEARCH_DEFAULT_LIMIT, TOOL_SEARCH_MAX_LIMIT, TOOL_SEARCH_TOOL, deferredToolsInstructions, deferredToolsTools, type DeferredServerNote, } from "./definition/deferred-tools.js";
|
|
13
15
|
export { codeToolRefusal, codeToolsOf } from "./definition/code-tools.js";
|
|
16
|
+
export { pluginOf, skillOfToolCall, type ToolCallTrace } from "./definition/trace.js";
|
|
17
|
+
export { approvalRefusal, approvalsOf } from "./definition/approval.js";
|
|
14
18
|
export type { CodeTool } from "./definition/code-tools.js";
|
|
15
|
-
export { CapabilityBuilder, isCapabilityBuilder } from "./definition/capability.js";
|
|
16
|
-
export type { CapabilityIdentity, CapabilityOptions } from "./definition/capability.js";
|
|
17
19
|
export { flow, FlowBuilder, isFlowBuilder, ROOT_POSITION, childPosition, embeddedAgent, flowHttpTarget, forEachFlowNode, indexSuffix, isLeafNode, isWorkflowManifest, leafPart, leafPath, stageKey, stripIndices, } from "./definition/flow/index.js";
|
|
18
20
|
export type { FlowAgentBuilder, Flow, Named, FlowOut, LoopOptions, StageOptions, FlowNodeVisit, FlowVisitNode, FlowHttpTarget, FlowImplementations, } from "./definition/flow/index.js";
|
|
19
|
-
export type {
|
|
21
|
+
export type { McpServerSpec, ResolvedMcpToolSettings, } from "./definition/mcp.js";
|
|
20
22
|
export { ToolError, isToolError } from "./definition/tool-error.js";
|
|
21
23
|
export { defineSchema } from "./definition/schema.js";
|
|
22
24
|
export { hashManifest } from "./utils/hash.js";
|
|
@@ -24,11 +26,11 @@ export { MODEL_FAILURE_CODES, isModelFailureOutcome } from "./definition/model-f
|
|
|
24
26
|
export { createSandboxTools, SANDBOX_INSTRUCTIONS, } from "./definition/sandbox-tools.js";
|
|
25
27
|
export { SANDBOX_NETWORK_PRESETS, SANDBOX_TOOL_NAMES, SANDBOX_WORKSPACE, isSandboxHostPattern, isSandboxToolName, parseSandboxDuration, parseSandboxSize, } from "./utils/sandbox.js";
|
|
26
28
|
export type { SandboxToolName } from "./utils/sandbox.js";
|
|
27
|
-
export { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILL_TOOL_NAMES, isSkillTool, } from "./definition/skill-tools.js";
|
|
28
|
-
export { DEFINITION_FILE_MAX_BYTES, SKILL_ENTRY, SKILL_FILES_MAX, SKILL_FILE_PATH_MAX, SKILLS_MOUNT, definitionFilesOf, isDefinitionFileHash, skillFilePathIssue, skillFilesIssue, skillInstructions, } from "./utils/definition-files.js";
|
|
29
|
+
export { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILL_TOOL_NAMES, isSkillTool, SKILLS_USAGE, formatSkillCatalog, } from "./definition/skill-tools.js";
|
|
30
|
+
export { DEFINITION_FILE_MAX_BYTES, SKILL_ENTRY, SKILL_FILES_MAX, SKILL_FILE_PATH_MAX, SKILLS_MOUNT, definitionFilesOf, skillFolderOf, isDefinitionFileHash, skillFilePathIssue, skillFilesIssue, skillInstructions, } from "./utils/definition-files.js";
|
|
29
31
|
export type { Implementations } from "./definition/implementations.js";
|
|
30
|
-
export type { AgentManifest, ApprovalMode,
|
|
31
|
-
export type {
|
|
32
|
+
export type { AgentManifest, ApprovalMode, HttpToolMethod, HttpToolTarget, McpServerManifest, McpToolSettings, PluginLabel, RuntimeManifest, SandboxManifest, SandboxNetworkPreset, SkillManifest, ToolManifest, ManifestSchemaVersion, } from "./types/manifest.js";
|
|
33
|
+
export type { PartDeclaration, SkillFileSource, } from "./types/part.js";
|
|
32
34
|
export type { ModelCandidate, ModelControls, ModelDirective, ModelEvidence, ModelFinishReason, ModelFailureCode, ModelFailureOutcome, ModelProducer, ModelAdapter, ModelAdapterContext, ModelPreparedCall, ContextContributor, ContextMutationOptions, ContextSnapshot, ModelCall, ModelCallTool, ModelOutputBlock, PromptContentPart, PromptItem, ModelConfigurationContributor, ModelConfigurationInstruction, ModelConfigurationMutationOptions, ModelConfigurationSnapshot, ModelConfigurationTool, ModelRequest, ModelToolCall, ModelUsage, } from "./types/model.js";
|
|
33
35
|
export type { BuildDiagnostic, ContextItem, DeferredOutcome, JsonObject, JsonPrimitive, JsonValue, Tripwire, } from "./types/shared.js";
|
|
34
36
|
export type { ObserveEvent, ObserveModelConfigurationSnapshot, ObserveModelRequested, ObserveSealedCall, ObserveToolSnapshot, Observer, } from "./types/observe.js";
|
|
@@ -41,11 +43,12 @@ export { VerdictSchema, isVerdict, WorkflowBuildError, isBuiltWorkflow, } from "
|
|
|
41
43
|
export type { BuiltWorkflow } from "./definition/workflow/index.js";
|
|
42
44
|
export { isVariantOf } from "./definition/variant.js";
|
|
43
45
|
export type { Verdict, WorkflowBinding, WorkflowHttpVerify, WorkflowLoopVerify, WorkflowManifest, WorkflowNode, } from "./types/workflow.js";
|
|
44
|
-
export type {
|
|
46
|
+
export type { DefinitionPart, BoundToolDefinition, } from "./definition/bound.js";
|
|
45
47
|
export { bindTool } from "./definition/bind-tool.js";
|
|
46
48
|
export { bindOutputContract } from "./definition/output-contract.js";
|
|
47
49
|
export type { TurnOutputContract } from "./definition/output-contract.js";
|
|
48
50
|
export { agentFrom } from "./definition/from.js";
|
|
51
|
+
export { mediaReferenceLine, mediaReferenceOf, type MediaReference, } from "./definition/media-reference.js";
|
|
49
52
|
export type { SessionToolRef } from "./definition/from.js";
|
|
50
53
|
export { schemaFromJSON } from "./definition/schema-json.js";
|
|
51
54
|
export { normalizeSchema } from "./definition/schema.js";
|
package/dist/define.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export { Agent, AgentBuilder, AgentBuildError, AgentLifecycleError, } from "./definition/builder.js";
|
|
2
2
|
export { HarnessError, isHarnessError } from "./errors.js";
|
|
3
3
|
export { DELEGATE_INPUT_SCHEMA, delegateManifest, delegateOf, delegatesOf, flowDelegatesOf, flowDelegateManifest, isFlowDelegate, } from "./definition/delegate.js";
|
|
4
|
-
export {
|
|
4
|
+
export { tool } from "./definition/helpers.js";
|
|
5
5
|
export { APPROVAL_MODES, HTTP_TOOL_DEFAULT_TIMEOUT_MS, HTTP_TOOL_MAX_TIMEOUT_MS, HTTP_TOOL_METHODS, http, httpToolOf, isHttpTarget, withHttpTarget, } from "./definition/http-tool.js";
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
6
|
+
export { READ_ARTIFACT_MAX_BYTES, READ_ARTIFACT_TOOL, SAVE_ARTIFACT_TOOL, runtimeManifestFor, runtimeToolOf, } from "./definition/runtime-manifest.js";
|
|
7
|
+
export { RUNTIME_PART_ID } from "./definition/manifest.js";
|
|
8
|
+
export { RUNTIME_TOOL_NAMES, isRuntimeToolName } from "./utils/runtime-tools.js";
|
|
9
|
+
export { MCP_TOOL_DEFAULTS, mcpToolSettings, McpError, normalizeMcpServers, stdioMcpRefusal, } from "./definition/mcp.js";
|
|
10
|
+
export { SERVER_INSTRUCTIONS_MAX_CHARS, TOOL_CALL_TOOL, TOOL_SEARCH_DEFAULT_LIMIT, TOOL_SEARCH_MAX_LIMIT, TOOL_SEARCH_TOOL, deferredToolsInstructions, deferredToolsTools, } from "./definition/deferred-tools.js";
|
|
9
11
|
export { codeToolRefusal, codeToolsOf } from "./definition/code-tools.js";
|
|
10
|
-
export {
|
|
12
|
+
export { pluginOf, skillOfToolCall } from "./definition/trace.js";
|
|
13
|
+
export { approvalRefusal, approvalsOf } from "./definition/approval.js";
|
|
11
14
|
export { flow, FlowBuilder, isFlowBuilder, ROOT_POSITION, childPosition, embeddedAgent, flowHttpTarget, forEachFlowNode, indexSuffix, isLeafNode, isWorkflowManifest, leafPart, leafPath, stageKey, stripIndices, } from "./definition/flow/index.js";
|
|
12
15
|
export { ToolError, isToolError } from "./definition/tool-error.js";
|
|
13
16
|
export { defineSchema } from "./definition/schema.js";
|
|
@@ -15,8 +18,8 @@ export { hashManifest } from "./utils/hash.js";
|
|
|
15
18
|
export { MODEL_FAILURE_CODES, isModelFailureOutcome } from "./definition/model-failure.js";
|
|
16
19
|
export { createSandboxTools, SANDBOX_INSTRUCTIONS, } from "./definition/sandbox-tools.js";
|
|
17
20
|
export { SANDBOX_NETWORK_PRESETS, SANDBOX_TOOL_NAMES, SANDBOX_WORKSPACE, isSandboxHostPattern, isSandboxToolName, parseSandboxDuration, parseSandboxSize, } from "./utils/sandbox.js";
|
|
18
|
-
export { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILL_TOOL_NAMES, isSkillTool, } from "./definition/skill-tools.js";
|
|
19
|
-
export { DEFINITION_FILE_MAX_BYTES, SKILL_ENTRY, SKILL_FILES_MAX, SKILL_FILE_PATH_MAX, SKILLS_MOUNT, definitionFilesOf, isDefinitionFileHash, skillFilePathIssue, skillFilesIssue, skillInstructions, } from "./utils/definition-files.js";
|
|
21
|
+
export { LOAD_SKILL_TOOL, READ_SKILL_RESOURCE_TOOL, SKILL_TOOL_NAMES, isSkillTool, SKILLS_USAGE, formatSkillCatalog, } from "./definition/skill-tools.js";
|
|
22
|
+
export { DEFINITION_FILE_MAX_BYTES, SKILL_ENTRY, SKILL_FILES_MAX, SKILL_FILE_PATH_MAX, SKILLS_MOUNT, definitionFilesOf, skillFolderOf, isDefinitionFileHash, skillFilePathIssue, skillFilesIssue, skillInstructions, } from "./utils/definition-files.js";
|
|
20
23
|
export { normalizeToolDefinition, normalizedSchemasFor, } from "./definition/schema.js";
|
|
21
24
|
export { implementationsFor, bindingFromAgent } from "./definition/binding.js";
|
|
22
25
|
export { VerdictSchema, isVerdict, WorkflowBuildError, isBuiltWorkflow, } from "./definition/workflow/index.js";
|
|
@@ -24,6 +27,7 @@ export { isVariantOf } from "./definition/variant.js";
|
|
|
24
27
|
export { bindTool } from "./definition/bind-tool.js";
|
|
25
28
|
export { bindOutputContract } from "./definition/output-contract.js";
|
|
26
29
|
export { agentFrom } from "./definition/from.js";
|
|
30
|
+
export { mediaReferenceLine, mediaReferenceOf, } from "./definition/media-reference.js";
|
|
27
31
|
export { schemaFromJSON } from "./definition/schema-json.js";
|
|
28
32
|
export { normalizeSchema } from "./definition/schema.js";
|
|
29
33
|
export * from "./utils/immutable.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `approval` in a manifest (R5 step 2). Tool approvals are the Tenant's tool policy now, decided
|
|
3
|
+
* at the Runtime's Tool Gate for every harness: `PUT /v1/tenant/tool-policy`, a rule with
|
|
4
|
+
* `effect: "ask"`. So `PUT /v1/agents/:id` and a turn's manifest refuse a definition that sets
|
|
5
|
+
* `approval` on an HTTP tool, an MCP server or an MCP tool's settings, and the SDK refuses it
|
|
6
|
+
* before sending. A manifest saved before keeps it: the gateway reads it from the session's
|
|
7
|
+
* pinned manifest as an ask, so no session loses the approval it was opened with.
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentManifest } from "../types/manifest.js";
|
|
10
|
+
import type { WorkflowManifest } from "../types/workflow.js";
|
|
11
|
+
/** Why the SDK refuses an `approval` option. */
|
|
12
|
+
export declare const APPROVAL_REMOVED = "approval was removed: tool approvals are the Tenant's tool policy now, decided at the Tool Gate for every harness (PUT /v1/tenant/tool-policy, a rule with effect \"ask\"; see MIGRATION.md)";
|
|
13
|
+
/** Where a definition sets `approval`, as a person reads it. */
|
|
14
|
+
export declare function approvalsOf(manifest: AgentManifest | WorkflowManifest, into?: string[]): string[];
|
|
15
|
+
/** Why a definition that sets `approval` is refused, naming the first; undefined when none does. */
|
|
16
|
+
export declare function approvalRefusal(manifest: AgentManifest | WorkflowManifest): string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Why the SDK refuses an `approval` option. */
|
|
2
|
+
export const APPROVAL_REMOVED = 'approval was removed: tool approvals are the Tenant\'s tool policy now, decided at the Tool Gate for every harness (PUT /v1/tenant/tool-policy, a rule with effect "ask"; see MIGRATION.md)';
|
|
3
|
+
/** Where a definition sets `approval`, as a person reads it. */
|
|
4
|
+
export function approvalsOf(manifest, into = []) {
|
|
5
|
+
if ("kind" in manifest && manifest.kind === "workflow") {
|
|
6
|
+
for (const agent of Object.values(manifest.agents))
|
|
7
|
+
approvalsOf(agent, into);
|
|
8
|
+
return into;
|
|
9
|
+
}
|
|
10
|
+
const agent = manifest;
|
|
11
|
+
for (const tool of agent.tools ?? []) {
|
|
12
|
+
if (tool.agent !== undefined)
|
|
13
|
+
approvalsOf(tool.agent, into);
|
|
14
|
+
else if (tool.approval !== undefined)
|
|
15
|
+
into.push(`tool '${tool.name}' of agent '${agent.id}'`);
|
|
16
|
+
}
|
|
17
|
+
for (const [key, server] of Object.entries(agent.mcpServers ?? {})) {
|
|
18
|
+
if (server.approval !== undefined)
|
|
19
|
+
into.push(`MCP server '${server.name ?? key}' of agent '${agent.id}'`);
|
|
20
|
+
for (const [name, settings] of Object.entries(server.tools ?? {}))
|
|
21
|
+
if (settings.approval !== undefined)
|
|
22
|
+
into.push(`tool '${name}' of MCP server '${server.name ?? key}' of agent '${agent.id}'`);
|
|
23
|
+
}
|
|
24
|
+
return into;
|
|
25
|
+
}
|
|
26
|
+
/** Why a definition that sets `approval` is refused, naming the first; undefined when none does. */
|
|
27
|
+
export function approvalRefusal(manifest) {
|
|
28
|
+
const [first, ...rest] = approvalsOf(manifest);
|
|
29
|
+
if (!first)
|
|
30
|
+
return undefined;
|
|
31
|
+
const more = rest.length === 0 ? "" : ` (and ${rest.length} more)`;
|
|
32
|
+
return `approval was removed from the manifest: remove it from ${first}${more}. Tool approvals are the Tenant's tool policy now, decided at the Tool Gate for every harness: PUT /v1/tenant/tool-policy with a rule whose effect is "ask" (see MIGRATION.md).`;
|
|
33
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DefinitionPart } from "./bound.js";
|
|
2
2
|
import type { BuiltAgent } from "../types/agent.js";
|
|
3
|
-
import type { AgentManifest,
|
|
3
|
+
import type { AgentManifest, AgentRequirements, RuntimeManifest } from "../types/manifest.js";
|
|
4
4
|
import type { BuildDiagnostic, JsonObject } from "../types/shared.js";
|
|
5
5
|
import type { ToolSchemaSource } from "../types/tool.js";
|
|
6
|
-
import type { StepMiddleware } from "../types/middleware.js";
|
|
7
6
|
type BuildResult<Agent> = {
|
|
8
7
|
readonly ok: true;
|
|
9
8
|
readonly agent: Agent;
|
|
@@ -12,17 +11,14 @@ type BuildResult<Agent> = {
|
|
|
12
11
|
readonly ok: false;
|
|
13
12
|
readonly diagnostics: readonly BuildDiagnostic[];
|
|
14
13
|
};
|
|
15
|
-
export
|
|
16
|
-
readonly middleware?: StepMiddleware<any>;
|
|
17
|
-
}
|
|
18
|
-
export declare function assembleAgent(middleware: readonly BoundMiddleware[], identity: Readonly<{
|
|
14
|
+
export declare function assembleAgent(parts: readonly DefinitionPart[], identity: Readonly<{
|
|
19
15
|
id: string;
|
|
20
16
|
name?: string;
|
|
21
17
|
description?: string;
|
|
22
18
|
metadata?: JsonObject;
|
|
23
19
|
outputSchema?: ToolSchemaSource;
|
|
20
|
+
requires?: AgentRequirements;
|
|
21
|
+
/** A pinned manifest's `runtime` block, kept as it was (`agentFrom`). */
|
|
24
22
|
runtime?: RuntimeManifest;
|
|
25
|
-
|
|
26
|
-
manifestSchemaVersion?: ManifestSchemaVersion;
|
|
27
|
-
}>, dynamics?: ReadonlyMap<string, CapabilityDynamics>): BuildResult<BuiltAgent>;
|
|
23
|
+
}>): BuildResult<BuiltAgent>;
|
|
28
24
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { bindAgent } from "./bind-agent.js";
|
|
2
|
-
import { createManifest } from "./manifest.js";
|
|
3
|
-
import { createSkillTools } from "./skill-tools.js";
|
|
2
|
+
import { createManifest, RUNTIME_PART_ID } from "./manifest.js";
|
|
4
3
|
import { DELEGATE_NAME_PATTERN, delegateOf, delegatesOf } from "./delegate.js";
|
|
5
|
-
import {
|
|
4
|
+
import { isRuntimeToolName } from "../utils/runtime-tools.js";
|
|
6
5
|
const diagnostic = (code, message, extra = {}) => Object.freeze({ code, message, ...extra });
|
|
7
|
-
export function assembleAgent(
|
|
6
|
+
export function assembleAgent(parts, identity) {
|
|
8
7
|
const diagnostics = [];
|
|
9
8
|
if (typeof identity.id !== "string" || identity.id.length === 0) {
|
|
10
9
|
diagnostics.push(diagnostic("agent.invalid-id", "Agent id must be a non-empty string"));
|
|
@@ -13,85 +12,67 @@ export function assembleAgent(middleware, identity, dynamics = new Map()) {
|
|
|
13
12
|
(typeof identity.name !== "string" || identity.name.length === 0)) {
|
|
14
13
|
diagnostics.push(diagnostic("agent.invalid-name", "Agent name must be a non-empty string"));
|
|
15
14
|
}
|
|
16
|
-
const
|
|
15
|
+
const partIds = new Set();
|
|
17
16
|
const frozen = [];
|
|
18
|
-
for (const item of
|
|
17
|
+
for (const item of parts) {
|
|
19
18
|
if (!item.id)
|
|
20
|
-
diagnostics.push(diagnostic("
|
|
21
|
-
else if (
|
|
22
|
-
diagnostics.push(diagnostic("
|
|
23
|
-
else if (typeof item.handle !== "function")
|
|
24
|
-
diagnostics.push(diagnostic("middleware.invalid", `Middleware '${item.id}' must provide a function`));
|
|
25
|
-
else if (item.name !== undefined && item.name.length === 0)
|
|
26
|
-
diagnostics.push(diagnostic("middleware.invalid", `Capability '${item.id}' name must be a non-empty string`));
|
|
19
|
+
diagnostics.push(diagnostic("part.invalid-id", "A part's id must not be empty"));
|
|
20
|
+
else if (partIds.has(item.id))
|
|
21
|
+
diagnostics.push(diagnostic("part.duplicate-id", `'${item.id}' is added twice`));
|
|
27
22
|
else {
|
|
28
|
-
|
|
29
|
-
frozen.push(Object.freeze({
|
|
30
|
-
id: item.id,
|
|
31
|
-
...(item.name === undefined ? {} : { name: item.name }),
|
|
32
|
-
...(item.description === undefined
|
|
33
|
-
? {}
|
|
34
|
-
: { description: item.description }),
|
|
35
|
-
handle: item.handle,
|
|
36
|
-
hasMiddleware: item.hasMiddleware,
|
|
37
|
-
...(item.tools === undefined ? {} : { tools: item.tools }),
|
|
38
|
-
...(item.contributions === undefined
|
|
39
|
-
? {}
|
|
40
|
-
: { contributions: item.contributions }),
|
|
41
|
-
...(item.manifestType === undefined
|
|
42
|
-
? {}
|
|
43
|
-
: { manifestType: item.manifestType }),
|
|
44
|
-
...(item.metadata === undefined ? {} : { metadata: item.metadata }),
|
|
45
|
-
...(item.mcpServers === undefined
|
|
46
|
-
? {}
|
|
47
|
-
: { mcpServers: item.mcpServers }),
|
|
48
|
-
...(item.sandbox === undefined ? {} : { sandbox: item.sandbox }),
|
|
49
|
-
...(item.skills === undefined ? {} : { skills: item.skills }),
|
|
50
|
-
...(item.skillFiles === undefined
|
|
51
|
-
? {}
|
|
52
|
-
: { skillFiles: item.skillFiles }),
|
|
53
|
-
...(item.sessionTools === undefined
|
|
54
|
-
? {}
|
|
55
|
-
: { sessionTools: item.sessionTools }),
|
|
56
|
-
}));
|
|
23
|
+
partIds.add(item.id);
|
|
24
|
+
frozen.push(Object.freeze({ ...item }));
|
|
57
25
|
}
|
|
58
26
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// with both owners. Duplicates within one capability keep their registration-time error.
|
|
63
|
-
const toolOwners = new Map();
|
|
64
|
-
for (const item of skilled.items)
|
|
27
|
+
// The wire schema rejects a tool name used twice; report it at build time.
|
|
28
|
+
const toolNames = new Set();
|
|
29
|
+
for (const item of frozen)
|
|
65
30
|
for (const entry of item.tools ?? []) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
31
|
+
if (toolNames.has(entry.name))
|
|
32
|
+
diagnostics.push(diagnostic("tool.duplicate-name", `Tool '${entry.name}' is declared twice`, {
|
|
33
|
+
toolName: entry.name,
|
|
34
|
+
}));
|
|
35
|
+
toolNames.add(entry.name);
|
|
36
|
+
if (item.id !== RUNTIME_PART_ID && isRuntimeToolName(entry.name))
|
|
37
|
+
diagnostics.push(diagnostic("tool.reserved-name", `Tool '${entry.name}' takes the name of a tool the Runtime serves; rename it`, { toolName: entry.name }));
|
|
38
|
+
if (item.id !== RUNTIME_PART_ID && entry.name.includes("__"))
|
|
39
|
+
diagnostics.push(diagnostic("tool.invalid-name", `Tool '${entry.name}' must not contain '__', which names an MCP server's tools`, { toolName: entry.name }));
|
|
71
40
|
}
|
|
72
|
-
diagnostics.push(...
|
|
73
|
-
diagnostics.push(...
|
|
41
|
+
diagnostics.push(...nameDiagnostics(frozen, "skills", "skill.duplicate-name", "skill"));
|
|
42
|
+
diagnostics.push(...nameDiagnostics(frozen, "mcpServers", "mcp.duplicate-server", "MCP server"));
|
|
43
|
+
diagnostics.push(...delegationDiagnostics(frozen));
|
|
44
|
+
diagnostics.push(...sandboxDiagnostics(frozen));
|
|
74
45
|
if (diagnostics.length)
|
|
75
46
|
return Object.freeze({
|
|
76
47
|
ok: false,
|
|
77
48
|
diagnostics: Object.freeze(diagnostics),
|
|
78
49
|
});
|
|
79
|
-
const
|
|
50
|
+
const frozenParts = Object.freeze(frozen);
|
|
80
51
|
const manifest = createManifest({
|
|
81
52
|
id: identity.id,
|
|
82
53
|
name: identity.name,
|
|
83
54
|
description: identity.description,
|
|
84
55
|
metadata: identity.metadata,
|
|
85
56
|
outputSchema: identity.outputSchema,
|
|
57
|
+
requires: identity.requires,
|
|
86
58
|
runtime: identity.runtime,
|
|
87
|
-
|
|
88
|
-
...(identity.manifestSchemaVersion === undefined
|
|
89
|
-
? {}
|
|
90
|
-
: { manifestSchemaVersion: identity.manifestSchemaVersion }),
|
|
59
|
+
parts: frozenParts,
|
|
91
60
|
});
|
|
92
|
-
const agent = bindAgent(
|
|
61
|
+
const agent = bindAgent(frozenParts, manifest, identity);
|
|
93
62
|
return Object.freeze({ ok: true, agent, manifest });
|
|
94
63
|
}
|
|
64
|
+
/** A skill or MCP server name declared by two parts (two plugins, or a plugin and the agent). */
|
|
65
|
+
function nameDiagnostics(parts, field, code, what) {
|
|
66
|
+
const found = [];
|
|
67
|
+
const seen = new Set();
|
|
68
|
+
for (const part of parts)
|
|
69
|
+
for (const [key, value] of Object.entries(part[field] ?? {})) {
|
|
70
|
+
if (key !== value.name || seen.has(value.name))
|
|
71
|
+
found.push(diagnostic(code, `Duplicate ${what} '${value.name}'`));
|
|
72
|
+
seen.add(value.name);
|
|
73
|
+
}
|
|
74
|
+
return found;
|
|
75
|
+
}
|
|
95
76
|
/** v1 delegation is one level deep and non-interactive; anything else fails the build by name. */
|
|
96
77
|
function delegationDiagnostics(items) {
|
|
97
78
|
const found = [];
|
|
@@ -105,7 +86,7 @@ function delegationDiagnostics(items) {
|
|
|
105
86
|
if (!DELEGATE_NAME_PATTERN.test(child.id))
|
|
106
87
|
found.push(diagnostic("delegation.invalid-name", `Agent '${child.id}' is used as a tool, so its id must be 1-64 letters, digits, '_' or '-'`, extra));
|
|
107
88
|
if (!child.description?.trim())
|
|
108
|
-
found.push(diagnostic("delegation.description-required", `Agent '${child.id}' is used as a tool
|
|
89
|
+
found.push(diagnostic("delegation.description-required", `Agent '${child.id}' is used as a tool and needs a description: the parent's model reads it to decide when to delegate`, extra));
|
|
109
90
|
// A flow agent runs in its own linked session; its agents may delegate in turn.
|
|
110
91
|
if (child.kind === "workflow")
|
|
111
92
|
continue;
|
|
@@ -119,50 +100,12 @@ function delegationDiagnostics(items) {
|
|
|
119
100
|
return found;
|
|
120
101
|
}
|
|
121
102
|
/**
|
|
122
|
-
* Definitions declare no sandbox: a session gets one when it is opened (Sandboxes v3)
|
|
123
|
-
*
|
|
124
|
-
*
|
|
103
|
+
* Definitions declare no sandbox: a session gets one when it is opened (Sandboxes v3), and the
|
|
104
|
+
* Runtime pins it in the manifest's `runtime` block. A part that still carries `sandbox` fails the
|
|
105
|
+
* build instead of being silently dropped.
|
|
125
106
|
*/
|
|
126
107
|
function sandboxDiagnostics(items) {
|
|
127
108
|
return items
|
|
128
|
-
.filter((item) => item.sandbox !== undefined
|
|
129
|
-
.map((
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Gives the first capability with skills `load_skill` (and `read_skill_resource`) for every skill
|
|
133
|
-
* of the agent. A tool of that name it already has is kept: an agent rebuilt from its manifest
|
|
134
|
-
* brings the hosted ones the Runtime serves.
|
|
135
|
-
*/
|
|
136
|
-
function attachSkillTools(items) {
|
|
137
|
-
const skills = new Map();
|
|
138
|
-
const diagnostics = [];
|
|
139
|
-
let ownerId;
|
|
140
|
-
for (const item of items)
|
|
141
|
-
for (const [key, skill] of Object.entries(item.skills ?? {})) {
|
|
142
|
-
if (key !== skill.name || skills.has(skill.name)) {
|
|
143
|
-
diagnostics.push(diagnostic("skill.duplicate-name", `Duplicate skill '${skill.name}' on capability '${item.id}'`));
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
skills.set(skill.name, skill);
|
|
147
|
-
ownerId ??= item.id;
|
|
148
|
-
}
|
|
149
|
-
if (diagnostics.length > 0 || ownerId === undefined)
|
|
150
|
-
return { items: [...items], diagnostics };
|
|
151
|
-
const skillTools = createSkillTools(skills);
|
|
152
|
-
const next = items.map((item) => {
|
|
153
|
-
if (item.id !== ownerId)
|
|
154
|
-
return item;
|
|
155
|
-
const declared = new Set((item.tools ?? []).map((entry) => entry.name));
|
|
156
|
-
const added = skillTools.filter((entry) => !declared.has(entry.name));
|
|
157
|
-
if (added.length === 0)
|
|
158
|
-
return item;
|
|
159
|
-
const tools = [...(item.tools ?? []), ...added];
|
|
160
|
-
const advertised = [...tools, ...(item.sessionTools ?? [])];
|
|
161
|
-
const handle = async (request, next) => item.handle(request, async () => {
|
|
162
|
-
request.configuration.tools.set(item.id, advertised);
|
|
163
|
-
return next();
|
|
164
|
-
});
|
|
165
|
-
return { ...item, tools, handle };
|
|
166
|
-
});
|
|
167
|
-
return { items: next, diagnostics };
|
|
109
|
+
.filter((item) => item.sandbox !== undefined)
|
|
110
|
+
.map(() => diagnostic("sandbox.in-definition", "Agents no longer declare a sandbox: open the session with it instead, createSession({ sandbox: { image, network: { allow }, resources } }), or set the Tenant's default sandbox."));
|
|
168
111
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { AgentManifest } from "../types/manifest.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefinitionPart } from "./bound.js";
|
|
3
3
|
import type { BuiltAgent } from "../types/agent.js";
|
|
4
4
|
import type { ToolSchemaSource } from "../types/tool.js";
|
|
5
|
-
|
|
6
|
-
export declare function bindAgent(middleware: readonly BoundMiddleware[], manifest: AgentManifest, options?: {
|
|
5
|
+
export declare function bindAgent(parts: readonly DefinitionPart[], manifest: AgentManifest, options?: {
|
|
7
6
|
outputSchema?: ToolSchemaSource;
|
|
8
|
-
}
|
|
7
|
+
}): BuiltAgent;
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { bindTool } from "./bind-tool.js";
|
|
2
2
|
import { HarnessError } from "../errors.js";
|
|
3
3
|
import { bindOutputContract } from "./output-contract.js";
|
|
4
|
-
export function bindAgent(
|
|
4
|
+
export function bindAgent(parts, manifest, options = {}) {
|
|
5
5
|
const seen = new Set();
|
|
6
|
-
const
|
|
6
|
+
const names = new Set();
|
|
7
7
|
const tools = [];
|
|
8
|
-
for (const
|
|
9
|
-
for (const tool of [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
]) {
|
|
13
|
-
const key = JSON.stringify([declaration.id, tool.name]);
|
|
14
|
-
if (seen.has(tool) || keys.has(key))
|
|
15
|
-
throw new HarnessError("tool.invalid", `Duplicate registered tool '${tool.name}' in '${declaration.id}'`);
|
|
8
|
+
for (const part of parts)
|
|
9
|
+
for (const tool of [...(part.tools ?? []), ...(part.sessionTools ?? [])]) {
|
|
10
|
+
if (seen.has(tool) || names.has(tool.name))
|
|
11
|
+
throw new HarnessError("tool.invalid", `Duplicate registered tool '${tool.name}'`);
|
|
16
12
|
seen.add(tool);
|
|
17
|
-
|
|
18
|
-
tools.push(bindTool(tool, {
|
|
13
|
+
names.add(tool.name);
|
|
14
|
+
tools.push(bindTool(tool, { partId: part.id, slot: part.id }));
|
|
19
15
|
}
|
|
20
|
-
const implementations =
|
|
16
|
+
const implementations = Object.freeze(tools.length === 0
|
|
17
|
+
? {}
|
|
18
|
+
: { tools: Object.freeze(Object.fromEntries(tools.map((tool) => [tool.name, tool]))) });
|
|
21
19
|
const binding = Object.freeze({
|
|
22
|
-
|
|
20
|
+
parts,
|
|
23
21
|
tools: Object.freeze(tools),
|
|
24
22
|
...(options.outputSchema === undefined
|
|
25
23
|
? {}
|
|
@@ -42,19 +40,3 @@ export function bindAgent(middleware, manifest, options = {}, dynamics = new Map
|
|
|
42
40
|
});
|
|
43
41
|
return agent;
|
|
44
42
|
}
|
|
45
|
-
function buildImplementations(middleware, dynamics, snapshots) {
|
|
46
|
-
const table = {};
|
|
47
|
-
for (const item of middleware) {
|
|
48
|
-
const tools = {};
|
|
49
|
-
for (const tool of snapshots.filter((tool) => tool.owner.middlewareId === item.id))
|
|
50
|
-
tools[tool.name] = tool;
|
|
51
|
-
const dyn = dynamics.get(item.id);
|
|
52
|
-
table[item.id] = Object.freeze({
|
|
53
|
-
...(Object.keys(tools).length
|
|
54
|
-
? { tools: Object.freeze({ ...tools }) }
|
|
55
|
-
: {}),
|
|
56
|
-
...(dyn?.middleware ? { middleware: dyn.middleware } : {}),
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
return Object.freeze(table);
|
|
60
|
-
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AgentManifest } from "../types/manifest.js";
|
|
2
2
|
import type { BuiltAgent } from "../types/agent.js";
|
|
3
3
|
import type { ToolSchemaSource } from "../types/tool.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { DefinitionPart, BoundToolDefinition } from "./bound.js";
|
|
5
5
|
import type { Implementations } from "./implementations.js";
|
|
6
6
|
/** Local code binding. Only manifest is serializable; functions stay in the application. */
|
|
7
7
|
export interface AgentBinding {
|
|
8
8
|
readonly manifest: AgentManifest;
|
|
9
9
|
readonly tools: readonly BoundToolDefinition[];
|
|
10
|
-
readonly
|
|
10
|
+
readonly parts: readonly DefinitionPart[];
|
|
11
11
|
readonly implementations: Implementations;
|
|
12
12
|
readonly outputSchema?: ToolSchemaSource;
|
|
13
13
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { JsonObject } from "../types/shared.js";
|
|
2
1
|
import type { McpServerManifest, SandboxManifest, SkillManifest } from "../types/manifest.js";
|
|
3
2
|
import type { Delegate } from "./delegate.js";
|
|
4
|
-
import type {
|
|
3
|
+
import type { SkillFileSource } from "../types/part.js";
|
|
5
4
|
import type { ToolApproval, ToolDefinition, ToolEffects, ToolExecutionContext, ToolInputSchema, ToolOutputSchema, ToolOwner, ToolRunResult, ToolSchema } from "../types/tool.js";
|
|
6
5
|
export interface BoundToolDefinition<Info = unknown> extends Omit<ToolDefinition<ToolInputSchema, Info, ToolOutputSchema | undefined>, "inputSchema" | "outputSchema" | "execute" | "run" | "input" | "output"> {
|
|
7
6
|
readonly inputSchema: ToolSchema<unknown>;
|
|
@@ -14,18 +13,19 @@ export interface BoundToolDefinition<Info = unknown> extends Omit<ToolDefinition
|
|
|
14
13
|
/** Set when this tool is an agent used as a tool; the engine runs it. */
|
|
15
14
|
readonly delegate?: Delegate;
|
|
16
15
|
}
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* One part of an agent definition: what one builder call, skills folder or plugin added, or (in
|
|
18
|
+
* an agent rebuilt from a pinned manifest) the `runtime` block. The engine offers each part's
|
|
19
|
+
* tools and instructions to the model in part order; the manifest holds the parts merged.
|
|
20
|
+
*/
|
|
21
|
+
export interface DefinitionPart {
|
|
18
22
|
readonly id: string;
|
|
19
|
-
readonly name?: string;
|
|
20
|
-
readonly description?: string;
|
|
21
|
-
readonly handle: StepMiddleware;
|
|
22
|
-
readonly hasMiddleware: boolean;
|
|
23
23
|
readonly tools?: readonly ToolDefinition<any, any, any>[];
|
|
24
24
|
/** Execution-only tools. Advertised for this run and omitted from the manifest. */
|
|
25
25
|
readonly sessionTools?: readonly ToolDefinition<any, any, any>[];
|
|
26
|
-
readonly
|
|
27
|
-
|
|
28
|
-
readonly
|
|
26
|
+
readonly instructions?: readonly string[];
|
|
27
|
+
/** Text the model reads while the session tools are advertised. Not in the manifest. */
|
|
28
|
+
readonly sessionInstructions?: readonly string[];
|
|
29
29
|
readonly skills?: Readonly<Record<string, SkillManifest>>;
|
|
30
30
|
/** Each skill file's bytes, by `sha256:<hex>`. Not a manifest field. */
|
|
31
31
|
readonly skillFiles?: Readonly<Record<string, SkillFileSource>>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { DefinitionPart } from "./bound.js";
|
|
2
|
+
import type { PartDeclaration } from "../types/part.js";
|
|
3
3
|
import type { BuildDiagnostic, JsonObject } from "../types/shared.js";
|
|
4
4
|
import { HarnessError } from "../errors.js";
|
|
5
5
|
import type { ToolDefinition, ToolSchemaSource, SchemaOutput } from "../types/tool.js";
|
|
6
6
|
import type { AgentTool, BuiltAgent } from "../types/agent.js";
|
|
7
|
-
import type { AgentManifest, McpServerManifest } from "../types/manifest.js";
|
|
7
|
+
import type { AgentManifest, AgentRequirements, McpServerManifest } from "../types/manifest.js";
|
|
8
8
|
import type { WorkflowBinding, WorkflowManifest } from "../types/workflow.js";
|
|
9
9
|
import type { Implementations } from "./implementations.js";
|
|
10
|
-
import { type CapabilityDynamics } from "./assemble.js";
|
|
11
10
|
import { type McpServerSpec } from "./mcp.js";
|
|
12
11
|
import { type FlowImplementations } from "./flow/from.js";
|
|
13
12
|
import type { BuiltWorkflow } from "./workflow/types.js";
|
|
@@ -33,12 +32,13 @@ interface BuilderSnapshot {
|
|
|
33
32
|
readonly metadata?: JsonObject;
|
|
34
33
|
readonly outputSchema?: ToolSchemaSource;
|
|
35
34
|
readonly inputSchema?: ToolSchemaSource;
|
|
36
|
-
|
|
37
|
-
readonly
|
|
35
|
+
/** What the agent needs of its session's Environment (D65). */
|
|
36
|
+
readonly requires?: AgentRequirements;
|
|
37
|
+
readonly entries: readonly DefinitionPart[];
|
|
38
38
|
/** Builder-level problems, reported with the assembly diagnostics. */
|
|
39
39
|
readonly diagnostics?: readonly BuildDiagnostic[];
|
|
40
40
|
readonly body: Body;
|
|
41
|
-
/** Raw items of the `"agent"`
|
|
41
|
+
/** Raw items of the `"agent"` part, so later calls can add to it. */
|
|
42
42
|
readonly agentPart?: {
|
|
43
43
|
readonly instructions?: readonly string[];
|
|
44
44
|
readonly tools?: readonly (ToolDefinition<any, any, any> | AgentTool)[];
|
|
@@ -59,7 +59,7 @@ export declare function Agent<Info = unknown, Schema extends ToolSchemaSource |
|
|
|
59
59
|
export declare namespace Agent {
|
|
60
60
|
/** Rebuild a flow agent from its workflow manifest v3 and the tools its tool nodes name. */
|
|
61
61
|
function from(json: WorkflowManifest, implementations?: FlowImplementations): BuiltWorkflow;
|
|
62
|
-
/** Rebuild an agent from its manifest and the code its
|
|
62
|
+
/** Rebuild an agent from its manifest and the code of its tools, by name. */
|
|
63
63
|
function from<Info = unknown>(json: AgentManifest | import("../types/shared.js").JsonObject, implementations: Implementations<Info>): BuiltAgent<Info>;
|
|
64
64
|
}
|
|
65
65
|
declare const SNAPSHOT: unique symbol;
|
|
@@ -96,18 +96,16 @@ export declare class AgentBuilder<Info = unknown, Schema extends ToolSchemaSourc
|
|
|
96
96
|
subagents(...agents: readonly AgentTool[]): this;
|
|
97
97
|
/** Declare MCP servers. A server's `name` defaults to its key; calls merge. */
|
|
98
98
|
mcp(servers: Readonly<Record<string, McpServerSpec>>): this;
|
|
99
|
-
/**
|
|
100
|
-
|
|
101
|
-
toDeclaration(): CapabilityInput<Info>;
|
|
102
|
-
}): this;
|
|
99
|
+
/** @internal Add a part (the SDK's `.skills()` and `.plugin()` use it). */
|
|
100
|
+
protected withPart(declaration: PartDeclaration<Info>, method: string): this;
|
|
103
101
|
/** The structured output. Set once. */
|
|
104
102
|
output<S extends ToolSchemaSource>(schema: S): AgentBuilder<Info, S, Id>;
|
|
105
|
-
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
/**
|
|
104
|
+
* What the agent needs of the Environment its session opens on (protocol 14, D65): a sandbox
|
|
105
|
+
* (`any` or `pod`) and secret names its skills' scripts read. A session whose Environment lacks
|
|
106
|
+
* them is refused when it opens. The agent still names no Environment. Set once.
|
|
107
|
+
*/
|
|
108
|
+
requires(requirements: AgentRequirements): AgentBuilder<Info, Schema, Id>;
|
|
111
109
|
/** The flow agent's input. Set once. */
|
|
112
110
|
input<S extends ToolSchemaSource>(schema: S): FlowAgentBuilder<Info, SchemaOutput<S>, SchemaOutput<S>, SchemaOut<Schema>, Id>;
|
|
113
111
|
/** Add stages in order: the first gets the flow's input, each later one the previous output. */
|
|
@@ -131,8 +129,6 @@ export declare class AgentBuilder<Info = unknown, Schema extends ToolSchemaSourc
|
|
|
131
129
|
private bodyFor;
|
|
132
130
|
private addStages;
|
|
133
131
|
private withAgentItems;
|
|
134
|
-
private addDeclaration;
|
|
135
|
-
private appendCompiled;
|
|
136
132
|
}
|
|
137
133
|
export type { Implementations };
|
|
138
134
|
export type { WorkflowBinding, WorkflowManifest };
|