@anvia/core 1.0.0-rc.2 → 1.0.0-rc.4
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/README.md +77 -10
- package/dist/agent/index.d.ts +20 -13
- package/dist/agent/index.js +36 -15
- package/dist/{agent-yBG8e9Jj.d.ts → agent-CXScUOpX.d.ts} +12 -15
- package/dist/chunk-3RM57ZT2.js +31 -0
- package/dist/chunk-3RM57ZT2.js.map +1 -0
- package/dist/{chunk-DBSCKTUL.js → chunk-5GXSQYQT.js} +1744 -838
- package/dist/chunk-5GXSQYQT.js.map +1 -0
- package/dist/{chunk-KIDGIJM7.js → chunk-AZB6N7P4.js} +94 -86
- package/dist/chunk-AZB6N7P4.js.map +1 -0
- package/dist/{chunk-KR3RCCHJ.js → chunk-D2ECOWN5.js} +26 -11
- package/dist/chunk-D2ECOWN5.js.map +1 -0
- package/dist/{chunk-EINTGEGY.js → chunk-FXAIYTRE.js} +101 -26
- package/dist/chunk-FXAIYTRE.js.map +1 -0
- package/dist/{chunk-FMHLROPQ.js → chunk-GQL5KRAH.js} +13 -33
- package/dist/chunk-GQL5KRAH.js.map +1 -0
- package/dist/{chunk-D37WMSP6.js → chunk-J2W63PJI.js} +50 -10
- package/dist/chunk-J2W63PJI.js.map +1 -0
- package/dist/{chunk-OJH6HWHX.js → chunk-KFR4CDGK.js} +8 -2
- package/dist/chunk-KFR4CDGK.js.map +1 -0
- package/dist/{chunk-TIZYTPJO.js → chunk-PK5LKOFL.js} +33 -2
- package/dist/chunk-PK5LKOFL.js.map +1 -0
- package/dist/{chunk-XKYYBABH.js → chunk-RFHQY2IO.js} +2 -2
- package/dist/chunk-TRQ3XRFD.js +54 -0
- package/dist/chunk-TRQ3XRFD.js.map +1 -0
- package/dist/{chunk-CWM7B2OO.js → chunk-VKYZZXP5.js} +10 -2
- package/dist/chunk-VKYZZXP5.js.map +1 -0
- package/dist/{chunk-77AIYARB.js → chunk-XYTPYUGB.js} +29 -19
- package/dist/chunk-XYTPYUGB.js.map +1 -0
- package/dist/{chunk-4WI3VGZK.js → chunk-ZCPOIDAQ.js} +3 -3
- package/dist/{client-B8DT1vUG.d.ts → client-DvUatElp.d.ts} +4 -3
- package/dist/completion/index.d.ts +3 -3
- package/dist/completion/index.js +2 -2
- package/dist/documents/index.d.ts +34 -0
- package/dist/documents/index.js +315 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/{dynamic-tools-KwEGRbHp.d.ts → dynamic-tools-AEBOTgu1.d.ts} +3 -3
- package/dist/embeddings/index.js +2 -1
- package/dist/evals/index.d.ts +19 -11
- package/dist/evals/index.js +88 -55
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +1 -1
- package/dist/extractor/index.js +3 -3
- package/dist/guardrails/index.d.ts +6 -129
- package/dist/guardrails/index.js +1 -1
- package/dist/image-generation/index.d.ts +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/index.js +49 -28
- package/dist/interactions-csssHYcN.d.ts +174 -0
- package/dist/internal/agent.d.ts +18 -22
- package/dist/internal/agent.js +45 -14
- package/dist/internal/agent.js.map +1 -1
- package/dist/mcp/index.d.ts +4 -4
- package/dist/mcp/index.js +6 -5
- package/dist/memory/index.d.ts +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-schema-Cn7ezRfJ.d.ts → message-schema-B2M7AYzR.d.ts} +1 -1
- package/dist/observability/index.d.ts +8 -7
- package/dist/observability/index.js +3 -3
- package/dist/pipeline/index.d.ts +18 -18
- package/dist/pipeline/index.js +20 -29
- package/dist/pipeline/index.js.map +1 -1
- package/dist/skills/index.d.ts +4 -4
- package/dist/skills/index.js +6 -5
- package/dist/speech-generation/index.d.ts +1 -1
- package/dist/text-C_6eKrbC.d.ts +32 -0
- package/dist/{think-tool-6H2QNQzQ.d.ts → think-tool-D8frXxwV.d.ts} +16 -2
- package/dist/tool/index.d.ts +6 -6
- package/dist/tool/index.js +9 -4
- package/dist/{tool--Mz4v1eL.d.ts → tool-r62gf3QY.d.ts} +3 -2
- package/dist/transcription/index.d.ts +1 -1
- package/dist/{types-Dld1TpWj.d.ts → types-C3gv9EX6.d.ts} +1 -1
- package/dist/{types-3x3mOLHU.d.ts → types-CElwurHZ.d.ts} +56 -35
- package/dist/types-CIPaIbZo.d.ts +105 -0
- package/dist/{types-CQ_ioXWK.d.ts → types-D9rKQ_as.d.ts} +24 -2
- package/dist/{types-BVzM4RsC.d.ts → types-DbolvLtZ.d.ts} +1 -1
- package/dist/{types-DiJqJejp.d.ts → types-RT3cuyRk.d.ts} +1 -1
- package/dist/vector-store/index.d.ts +7 -6
- package/dist/vector-store/index.js +6 -3
- package/package.json +6 -6
- package/dist/chunk-77AIYARB.js.map +0 -1
- package/dist/chunk-CWM7B2OO.js.map +0 -1
- package/dist/chunk-D37WMSP6.js.map +0 -1
- package/dist/chunk-DBSCKTUL.js.map +0 -1
- package/dist/chunk-EINTGEGY.js.map +0 -1
- package/dist/chunk-FMHLROPQ.js.map +0 -1
- package/dist/chunk-KIDGIJM7.js.map +0 -1
- package/dist/chunk-KR3RCCHJ.js.map +0 -1
- package/dist/chunk-OJH6HWHX.js.map +0 -1
- package/dist/chunk-TIZYTPJO.js.map +0 -1
- package/dist/loaders/index.d.ts +0 -87
- package/dist/loaders/index.js +0 -299
- package/dist/loaders/index.js.map +0 -1
- package/dist/middleware-C7PdmKF7.d.ts +0 -56
- /package/dist/{chunk-XKYYBABH.js.map → chunk-RFHQY2IO.js.map} +0 -0
- /package/dist/{chunk-4WI3VGZK.js.map → chunk-ZCPOIDAQ.js.map} +0 -0
package/dist/internal/agent.js
CHANGED
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
createHook,
|
|
4
|
-
createResolvedAgent,
|
|
5
|
-
getAgentApprovalRequestDetails,
|
|
6
4
|
getAgentToolState,
|
|
7
|
-
|
|
5
|
+
markResolvedAgentOptions,
|
|
8
6
|
withInternalAgentRunOptions
|
|
9
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-5GXSQYQT.js";
|
|
8
|
+
import "../chunk-FXAIYTRE.js";
|
|
9
|
+
import "../chunk-KFR4CDGK.js";
|
|
10
|
+
import "../chunk-VKYZZXP5.js";
|
|
10
11
|
import "../chunk-YK4WAAS4.js";
|
|
11
|
-
import "../chunk-EINTGEGY.js";
|
|
12
12
|
import "../chunk-CQNNSZPG.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-J2W63PJI.js";
|
|
14
|
+
import "../chunk-XYTPYUGB.js";
|
|
15
|
+
import "../chunk-TRQ3XRFD.js";
|
|
16
|
+
import "../chunk-GQL5KRAH.js";
|
|
17
|
+
import "../chunk-3RM57ZT2.js";
|
|
18
18
|
import "../chunk-MGNTXGTX.js";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-KIDGIJM7.js";
|
|
19
|
+
import "../chunk-D2ECOWN5.js";
|
|
20
|
+
import "../chunk-PK5LKOFL.js";
|
|
22
21
|
import "../chunk-FN7HLLAZ.js";
|
|
22
|
+
import "../chunk-AZB6N7P4.js";
|
|
23
|
+
|
|
24
|
+
// src/agent/resolved-agent.ts
|
|
25
|
+
function createResolvedAgent(options) {
|
|
26
|
+
return new Agent(markResolvedAgentOptions(options));
|
|
27
|
+
}
|
|
28
|
+
function getResolvedAgentOptions(agent) {
|
|
29
|
+
const toolState = getAgentToolState(agent);
|
|
30
|
+
return {
|
|
31
|
+
id: agent.id,
|
|
32
|
+
name: agent.name,
|
|
33
|
+
description: agent.description,
|
|
34
|
+
model: agent.model,
|
|
35
|
+
instructions: agent.instructions,
|
|
36
|
+
context: [...agent.context],
|
|
37
|
+
temperature: agent.temperature,
|
|
38
|
+
maxTokens: agent.maxTokens,
|
|
39
|
+
providerOptions: agent.providerOptions,
|
|
40
|
+
retries: agent.retries,
|
|
41
|
+
tools: [...toolState.configuredTools],
|
|
42
|
+
mcpServers: [...agent.mcpServers],
|
|
43
|
+
providerTools: [...toolState.providerTools],
|
|
44
|
+
toolIndexes: [...toolState.toolIndexes],
|
|
45
|
+
toolChoice: agent.toolChoice,
|
|
46
|
+
defaultMaxTurns: agent.defaultMaxTurns,
|
|
47
|
+
lifecycle: agent.lifecycle,
|
|
48
|
+
outputSchema: agent.outputSchema,
|
|
49
|
+
observability: agent.observability,
|
|
50
|
+
guardrails: [...agent.guardrails],
|
|
51
|
+
middlewares: [...agent.middlewares],
|
|
52
|
+
memory: agent.memory
|
|
53
|
+
};
|
|
54
|
+
}
|
|
23
55
|
export {
|
|
24
56
|
Agent,
|
|
25
57
|
createHook,
|
|
26
58
|
createResolvedAgent,
|
|
27
|
-
getAgentApprovalRequestDetails,
|
|
28
59
|
getAgentToolState,
|
|
29
60
|
getResolvedAgentOptions,
|
|
30
61
|
withInternalAgentRunOptions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/agent/resolved-agent.ts"],"sourcesContent":["import type { CompletionModel } from \"../completion\";\nimport { Agent } from \"./agent\";\nimport { markResolvedAgentOptions } from \"./resolve-options\";\nimport { getAgentToolState } from \"./tool-state\";\nimport type { ResolvedAgentOptions } from \"./types\";\n\nexport function createResolvedAgent<\n Output = string,\n M extends CompletionModel = CompletionModel,\n ContextDocument = unknown,\n>(options: ResolvedAgentOptions<Output, M, ContextDocument>): Agent<Output, M, ContextDocument> {\n return new Agent(markResolvedAgentOptions(options));\n}\n\nexport function getResolvedAgentOptions<Output, M extends CompletionModel, ContextDocument>(\n agent: Agent<Output, M, ContextDocument>,\n): ResolvedAgentOptions<Output, M, ContextDocument> {\n const toolState = getAgentToolState(agent);\n return {\n id: agent.id,\n name: agent.name,\n description: agent.description,\n model: agent.model,\n instructions: agent.instructions,\n context: [...agent.context],\n temperature: agent.temperature,\n maxTokens: agent.maxTokens,\n providerOptions: agent.providerOptions,\n retries: agent.retries,\n tools: [...toolState.configuredTools],\n mcpServers: [...agent.mcpServers],\n providerTools: [...toolState.providerTools],\n toolIndexes: [...toolState.toolIndexes],\n toolChoice: agent.toolChoice,\n defaultMaxTurns: agent.defaultMaxTurns,\n lifecycle: agent.lifecycle,\n outputSchema: agent.outputSchema,\n observability: agent.observability,\n guardrails: [...agent.guardrails],\n middlewares: [...agent.middlewares],\n memory: agent.memory,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMO,SAAS,oBAId,SAA8F;AAC9F,SAAO,IAAI,MAAM,yBAAyB,OAAO,CAAC;AACpD;AAEO,SAAS,wBACd,OACkD;AAClD,QAAM,YAAY,kBAAkB,KAAK;AACzC,SAAO;AAAA,IACL,IAAI,MAAM;AAAA,IACV,MAAM,MAAM;AAAA,IACZ,aAAa,MAAM;AAAA,IACnB,OAAO,MAAM;AAAA,IACb,cAAc,MAAM;AAAA,IACpB,SAAS,CAAC,GAAG,MAAM,OAAO;AAAA,IAC1B,aAAa,MAAM;AAAA,IACnB,WAAW,MAAM;AAAA,IACjB,iBAAiB,MAAM;AAAA,IACvB,SAAS,MAAM;AAAA,IACf,OAAO,CAAC,GAAG,UAAU,eAAe;AAAA,IACpC,YAAY,CAAC,GAAG,MAAM,UAAU;AAAA,IAChC,eAAe,CAAC,GAAG,UAAU,aAAa;AAAA,IAC1C,aAAa,CAAC,GAAG,UAAU,WAAW;AAAA,IACtC,YAAY,MAAM;AAAA,IAClB,iBAAiB,MAAM;AAAA,IACvB,WAAW,MAAM;AAAA,IACjB,cAAc,MAAM;AAAA,IACpB,eAAe,MAAM;AAAA,IACrB,YAAY,CAAC,GAAG,MAAM,UAAU;AAAA,IAChC,aAAa,CAAC,GAAG,MAAM,WAAW;AAAA,IAClC,QAAQ,MAAM;AAAA,EAChB;AACF;","names":[]}
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { M as McpClient, a as McpServer, b as McpClientGroupConnectOptions, c as McpTool } from '../client-
|
|
2
|
-
export { d as McpClientOptions, e as McpClientTransport, f as McpConnectOptions, g as McpCustomTransport, h as McpServerInfo, i as McpStdioTransport, j as McpStreamableHttpTransport, k as McpTransport } from '../client-
|
|
1
|
+
import { M as McpClient, a as McpServer, b as McpClientGroupConnectOptions, c as McpTool } from '../client-DvUatElp.js';
|
|
2
|
+
export { d as McpClientOptions, e as McpClientTransport, f as McpConnectOptions, g as McpCustomTransport, h as McpServerInfo, i as McpStdioTransport, j as McpStreamableHttpTransport, k as McpTransport } from '../client-DvUatElp.js';
|
|
3
3
|
import 'node:child_process';
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
6
6
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/shared/transport.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-D9rKQ_as.js';
|
|
9
9
|
import '../model-call-options-CZkSw_xN.js';
|
|
10
|
-
import '../tool
|
|
10
|
+
import '../tool-r62gf3QY.js';
|
|
11
11
|
|
|
12
12
|
declare class McpClientGroup {
|
|
13
13
|
#private;
|
package/dist/mcp/index.js
CHANGED
|
@@ -2,12 +2,13 @@ import {
|
|
|
2
2
|
McpClient,
|
|
3
3
|
McpClientGroup,
|
|
4
4
|
isMcpTool
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-FXAIYTRE.js";
|
|
6
6
|
import "../chunk-CQNNSZPG.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-J2W63PJI.js";
|
|
8
|
+
import "../chunk-XYTPYUGB.js";
|
|
9
|
+
import "../chunk-GQL5KRAH.js";
|
|
10
|
+
import "../chunk-3RM57ZT2.js";
|
|
11
|
+
import "../chunk-PK5LKOFL.js";
|
|
11
12
|
import "../chunk-FN7HLLAZ.js";
|
|
12
13
|
export {
|
|
13
14
|
McpClient,
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { M as Message, U as Usage } from '../types-
|
|
2
|
-
import { a as CreateSummaryMemoryCompactorOptions, m as MemoryCompactor, f as MemoryCompactionMessage, C as CreateMemoryScopeKeyOptions } from '../types-
|
|
3
|
-
export { M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionSnapshot, l as MemoryCompactionSnapshotOptions, n as MemoryCompactorInput, o as MemoryCompactorResult, p as MemoryConversation, q as MemoryConversationGetOptions, r as MemoryConversationListOptions, s as MemoryConversationMessage, t as MemoryConversationSummary, u as MemoryErrorOptions, v as MemoryInspector, w as MemoryLoadOptions, x as MemoryOptions, y as MemorySavePolicy, z as MemoryScope, A as MemoryScopeKeyOptions, B as MemoryScopeKeyResolver, D as MemoryStore } from '../types-
|
|
1
|
+
import { M as Message, U as Usage } from '../types-D9rKQ_as.js';
|
|
2
|
+
import { a as CreateSummaryMemoryCompactorOptions, m as MemoryCompactor, f as MemoryCompactionMessage, C as CreateMemoryScopeKeyOptions } from '../types-DbolvLtZ.js';
|
|
3
|
+
export { M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionSnapshot, l as MemoryCompactionSnapshotOptions, n as MemoryCompactorInput, o as MemoryCompactorResult, p as MemoryConversation, q as MemoryConversationGetOptions, r as MemoryConversationListOptions, s as MemoryConversationMessage, t as MemoryConversationSummary, u as MemoryErrorOptions, v as MemoryInspector, w as MemoryLoadOptions, x as MemoryOptions, y as MemorySavePolicy, z as MemoryScope, A as MemoryScopeKeyOptions, B as MemoryScopeKeyResolver, D as MemoryStore } from '../types-DbolvLtZ.js';
|
|
4
4
|
import '../model-call-options-CZkSw_xN.js';
|
|
5
5
|
import '../retry-CjvSlKGW.js';
|
|
6
6
|
|
package/dist/memory/index.js
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
MemoryCompactionError,
|
|
7
7
|
createSummaryMemoryCompactor,
|
|
8
8
|
isMemoryCompactionMessage
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-KFR4CDGK.js";
|
|
10
|
+
import "../chunk-D2ECOWN5.js";
|
|
11
|
+
import "../chunk-PK5LKOFL.js";
|
|
12
12
|
import "../chunk-FN7HLLAZ.js";
|
|
13
13
|
export {
|
|
14
14
|
MemoryCompactionConflictError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
2
2
|
import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
3
|
-
import { C as CompletionModel, M as Message, D as Document, j as CompletionTool, u as ToolChoice, J as JsonObject, W as StreamingCompletionModel, g as CompletionResult, i as CompletionStreamEvent, o as JsonValue } from './types-
|
|
3
|
+
import { C as CompletionModel, M as Message, D as Document, j as CompletionTool, u as ToolChoice, J as JsonObject, W as StreamingCompletionModel, g as CompletionResult, i as CompletionStreamEvent, o as JsonValue } from './types-D9rKQ_as.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
type CompletionInput = {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../
|
|
3
|
-
import '../types-
|
|
1
|
+
export { x as AgentGenerationEndArgs, y as AgentGenerationErrorArgs, z as AgentGenerationModelInfo, B as AgentGenerationObserver, C as AgentGenerationStartArgs, D as AgentGenerationUpdateArgs, E as AgentObservabilityOptions, F as AgentObserver, G as AgentObserverErrorPolicy, H as AgentObserverMap, I as AgentObserverTraceInfo, J as AgentRunEndArgs, K as AgentRunErrorArgs, L as AgentRunEventArgs, M as AgentRunObserver, N as AgentRunPromptRef, O as AgentRunStartArgs, P as AgentToolEndArgs, Q as AgentToolErrorArgs, R as AgentToolObserver, S as AgentToolStartArgs, T as AgentToolStreamEventArgs, U as AgentToolSuspendedArgs, V as AgentTraceInfo, W as AgentTraceOptions } from '../types-CElwurHZ.js';
|
|
2
|
+
import '../interactions-csssHYcN.js';
|
|
3
|
+
import '../types-D9rKQ_as.js';
|
|
4
4
|
import '../model-call-options-CZkSw_xN.js';
|
|
5
|
-
import '../guardrails/index.js';
|
|
6
5
|
import '../type-utils-CtHVDRn_.js';
|
|
7
|
-
import '
|
|
8
|
-
import '../
|
|
9
|
-
import '../
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../retry-CjvSlKGW.js';
|
|
8
|
+
import '../types-CIPaIbZo.js';
|
|
9
|
+
import '../types-DbolvLtZ.js';
|
|
10
|
+
import '../tool-r62gf3QY.js';
|
|
10
11
|
|
|
11
12
|
type AgentObserverFailure = {
|
|
12
13
|
readonly observer: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentObserverDispatchError
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-VKYZZXP5.js";
|
|
4
4
|
import "../chunk-MGNTXGTX.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-D2ECOWN5.js";
|
|
6
|
+
import "../chunk-PK5LKOFL.js";
|
|
7
7
|
import "../chunk-FN7HLLAZ.js";
|
|
8
8
|
export {
|
|
9
9
|
AgentObserverDispatchError
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as Agent } from '../agent-
|
|
3
|
-
import { J as JsonObject, C as CompletionModel } from '../types-
|
|
1
|
+
import { t as AgentSuspendedResult, f as AgentInput, m as AgentRunSettings } from '../types-CElwurHZ.js';
|
|
2
|
+
import { A as Agent } from '../agent-CXScUOpX.js';
|
|
3
|
+
import { J as JsonObject, C as CompletionModel } from '../types-D9rKQ_as.js';
|
|
4
4
|
import { ExtractOptions } from '../extractor/index.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import '../
|
|
7
|
-
import '../guardrails/index.js';
|
|
6
|
+
import '../interactions-csssHYcN.js';
|
|
8
7
|
import '../type-utils-CtHVDRn_.js';
|
|
9
|
-
import '../
|
|
10
|
-
import '../types-
|
|
11
|
-
import '../
|
|
12
|
-
import '../
|
|
8
|
+
import '../retry-CjvSlKGW.js';
|
|
9
|
+
import '../types-CIPaIbZo.js';
|
|
10
|
+
import '../types-DbolvLtZ.js';
|
|
11
|
+
import '../tool-r62gf3QY.js';
|
|
13
12
|
import '../zod-schema-C7F4clpm.js';
|
|
14
|
-
import '../client-
|
|
13
|
+
import '../client-DvUatElp.js';
|
|
15
14
|
import 'node:child_process';
|
|
16
15
|
import 'node:stream';
|
|
17
16
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
18
17
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
19
18
|
import '@modelcontextprotocol/sdk/shared/transport.js';
|
|
20
|
-
import '../types-
|
|
21
|
-
import '../dynamic-tools-
|
|
19
|
+
import '../types-RT3cuyRk.js';
|
|
20
|
+
import '../dynamic-tools-AEBOTgu1.js';
|
|
22
21
|
import '../types-Cr4uiYo5.js';
|
|
23
|
-
import '../
|
|
22
|
+
import '../model-call-options-CZkSw_xN.js';
|
|
23
|
+
import '../types-C3gv9EX6.js';
|
|
24
24
|
|
|
25
|
-
declare class
|
|
26
|
-
readonly result:
|
|
27
|
-
constructor(result:
|
|
25
|
+
declare class PipelineAgentSuspensionError extends Error {
|
|
26
|
+
readonly result: AgentSuspendedResult;
|
|
27
|
+
constructor(result: AgentSuspendedResult);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
type PipelineMetadata = {
|
|
@@ -145,7 +145,7 @@ type PipelineParallelOptions<Input, Branches extends Record<string, Pipeline<Inp
|
|
|
145
145
|
type PipelineAgentOptions<Input, AgentOutput, Model extends CompletionModel> = PipelineStageMetadata & {
|
|
146
146
|
agent: Agent<AgentOutput, Model>;
|
|
147
147
|
request(context: PipelineStageContext<Input>): PipelineAgentRequest<AgentOutput, Model> | Promise<PipelineAgentRequest<AgentOutput, Model>>;
|
|
148
|
-
|
|
148
|
+
suspension: "reject";
|
|
149
149
|
};
|
|
150
150
|
type PipelineExtractOptions<Input, Extracted, Model extends CompletionModel> = PipelineStageMetadata & Omit<ExtractOptions<Extracted, Model>, "text" | "abortSignal"> & {
|
|
151
151
|
text(context: PipelineStageContext<Input>): string | Promise<string>;
|
|
@@ -171,4 +171,4 @@ declare class Pipeline<Input, Output = Input> {
|
|
|
171
171
|
private execute;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
export { type ParallelOutput, Pipeline,
|
|
174
|
+
export { type ParallelOutput, Pipeline, type PipelineAgentOptions, PipelineAgentSuspensionError, type PipelineBatchItem, type PipelineBatchOptions, type PipelineComposeOptions, type PipelineExtractOptions, type PipelineGraph, type PipelineGraphEdge, type PipelineGraphNode, type PipelineMetadata, type PipelineNodePath, type PipelineOptions, type PipelineParallelOptions, type PipelineRunEvent, type PipelineRunObserver, type PipelineRunOptions, type PipelineRunResult, type PipelineStageContext, type PipelineStageKind, type PipelineStageMetadata, type PipelineStepOptions };
|
package/dist/pipeline/index.js
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AgentRunBlockedError
|
|
3
|
-
|
|
4
|
-
} from "../chunk-DBSCKTUL.js";
|
|
5
|
-
import "../chunk-YK4WAAS4.js";
|
|
6
|
-
import "../chunk-EINTGEGY.js";
|
|
7
|
-
import "../chunk-CQNNSZPG.js";
|
|
8
|
-
import "../chunk-D37WMSP6.js";
|
|
9
|
-
import "../chunk-77AIYARB.js";
|
|
10
|
-
import "../chunk-OJH6HWHX.js";
|
|
11
|
-
import "../chunk-CWM7B2OO.js";
|
|
2
|
+
AgentRunBlockedError
|
|
3
|
+
} from "../chunk-TRQ3XRFD.js";
|
|
12
4
|
import {
|
|
13
5
|
mapWithConcurrency
|
|
14
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3RM57ZT2.js";
|
|
15
7
|
import {
|
|
16
8
|
extract
|
|
17
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-ZCPOIDAQ.js";
|
|
18
10
|
import "../chunk-MGNTXGTX.js";
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-KIDGIJM7.js";
|
|
11
|
+
import "../chunk-D2ECOWN5.js";
|
|
12
|
+
import "../chunk-PK5LKOFL.js";
|
|
22
13
|
import {
|
|
23
14
|
abortError,
|
|
24
15
|
throwIfAborted
|
|
25
16
|
} from "../chunk-FN7HLLAZ.js";
|
|
26
17
|
|
|
27
18
|
// src/pipeline/errors.ts
|
|
28
|
-
var
|
|
19
|
+
var PipelineAgentSuspensionError = class extends Error {
|
|
29
20
|
constructor(result) {
|
|
30
|
-
super("Pipeline agent stage
|
|
21
|
+
super("Pipeline agent stage suspended for human interaction.");
|
|
31
22
|
this.result = result;
|
|
32
|
-
this.name = "
|
|
23
|
+
this.name = "PipelineAgentSuspensionError";
|
|
33
24
|
}
|
|
34
25
|
result;
|
|
35
26
|
};
|
|
@@ -133,12 +124,13 @@ function appendChildGraph(state, parentPath, child) {
|
|
|
133
124
|
continue;
|
|
134
125
|
}
|
|
135
126
|
const target = [...parentPath, ...edge.target];
|
|
136
|
-
|
|
127
|
+
let childEdge = {
|
|
137
128
|
id: `edge_${nextEdgeIndex}`,
|
|
138
129
|
source,
|
|
139
|
-
target
|
|
140
|
-
|
|
141
|
-
}
|
|
130
|
+
target
|
|
131
|
+
};
|
|
132
|
+
if (edge.label !== void 0) childEdge = { ...childEdge, label: edge.label };
|
|
133
|
+
childEdges.push(childEdge);
|
|
142
134
|
nextEdgeIndex += 1;
|
|
143
135
|
}
|
|
144
136
|
return {
|
|
@@ -422,6 +414,9 @@ var Pipeline = class {
|
|
|
422
414
|
}, nextState);
|
|
423
415
|
}
|
|
424
416
|
agent(options) {
|
|
417
|
+
if (options.suspension !== "reject") {
|
|
418
|
+
throw new TypeError('Pipeline Agent stages require suspension: "reject".');
|
|
419
|
+
}
|
|
425
420
|
const next = appendStageNode(this.state, "agent", options, {
|
|
426
421
|
defaultLabel: options.agent.name ?? options.agent.id,
|
|
427
422
|
agentId: options.agent.id,
|
|
@@ -436,12 +431,8 @@ var Pipeline = class {
|
|
|
436
431
|
...request,
|
|
437
432
|
abortSignal: context.abortSignal
|
|
438
433
|
});
|
|
439
|
-
if (response.status === "
|
|
440
|
-
|
|
441
|
-
response,
|
|
442
|
-
`Pipeline agent stage "${next.node.id}" rejects tool approval suspension.`
|
|
443
|
-
);
|
|
444
|
-
throw new PipelineAgentApprovalError(response);
|
|
434
|
+
if (response.status === "suspended") {
|
|
435
|
+
throw new PipelineAgentSuspensionError(response);
|
|
445
436
|
}
|
|
446
437
|
if (response.status === "blocked") {
|
|
447
438
|
throw new AgentRunBlockedError(response);
|
|
@@ -574,6 +565,6 @@ function normalizeParallelBranches(branches) {
|
|
|
574
565
|
}
|
|
575
566
|
export {
|
|
576
567
|
Pipeline,
|
|
577
|
-
|
|
568
|
+
PipelineAgentSuspensionError
|
|
578
569
|
};
|
|
579
570
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/errors.ts","../../src/pipeline/pipeline.ts","../../src/pipeline/graph.ts","../../src/pipeline/runtime.ts"],"sourcesContent":["import type { AgentApprovalRequiredResult } from \"../agent/run-types\";\n\nexport class PipelineAgentApprovalError extends Error {\n constructor(readonly result: AgentApprovalRequiredResult) {\n super(\"Pipeline agent stage required tool approval and was rejected.\");\n this.name = \"PipelineAgentApprovalError\";\n }\n}\n","import { z } from \"zod\";\nimport { type Agent, cancelAgentApproval } from \"../agent/agent\";\nimport { AgentRunBlockedError } from \"../agent/errors\";\nimport type { AgentInput, AgentRunOptions, AgentRunSettings } from \"../agent/run-types\";\nimport type { CompletionModel, JsonObject } from \"../completion\";\nimport { type ExtractOptions, extract as extractData } from \"../extractor\";\nimport { throwIfAborted } from \"../internal/abort\";\nimport { mapWithConcurrency } from \"../internal/concurrency\";\nimport { PipelineAgentApprovalError } from \"./errors\";\nimport {\n appendComposedGraph,\n appendParallelBranch,\n appendStageNode,\n cloneGraph,\n initialPipelineState,\n withOutputNode,\n withTerminalPaths,\n} from \"./graph\";\nimport {\n childContext,\n combineAbortSignals,\n pipelineAbortError,\n runNode,\n stageContext,\n} from \"./runtime\";\nimport type {\n ParallelOutput,\n PipelineBatchItem,\n PipelineBatchOptions,\n PipelineExecutor,\n PipelineGraph,\n PipelineGraphNode,\n PipelineNodePath,\n PipelineOptions,\n PipelineRunContext,\n PipelineRunOptions,\n PipelineRunResult,\n PipelineStageContext,\n PipelineStageMetadata,\n PipelineState,\n} from \"./types\";\n\nconst internalPipelineOptions = Symbol(\"internal-pipeline-options\");\n\ntype RawResponseOf<Model> =\n Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;\n\ntype PipelineAgentRequest<Output, Model extends CompletionModel> = AgentInput &\n Omit<AgentRunSettings<Output, RawResponseOf<Model>>, \"abortSignal\">;\n\nexport type PipelineStepOptions<Input, Output> = PipelineStageMetadata & {\n run(context: PipelineStageContext<Input>): Output | Promise<Output>;\n};\n\nexport type PipelineComposeOptions<Input, Output> = PipelineStageMetadata & {\n pipeline: Pipeline<Input, Output>;\n};\n\nexport type PipelineParallelOptions<\n Input,\n Branches extends Record<string, Pipeline<Input, unknown>>,\n> = PipelineStageMetadata & {\n branches: Branches;\n};\n\nexport type PipelineAgentOptions<\n Input,\n AgentOutput,\n Model extends CompletionModel,\n> = PipelineStageMetadata & {\n agent: Agent<AgentOutput, Model>;\n request(\n context: PipelineStageContext<Input>,\n ): PipelineAgentRequest<AgentOutput, Model> | Promise<PipelineAgentRequest<AgentOutput, Model>>;\n approval: \"reject\";\n};\n\nexport type PipelineExtractOptions<\n Input,\n Extracted,\n Model extends CompletionModel,\n> = PipelineStageMetadata &\n Omit<ExtractOptions<Extracted, Model>, \"text\" | \"abortSignal\"> & {\n text(context: PipelineStageContext<Input>): string | Promise<string>;\n };\n\ntype InternalPipelineOptions<Input, Output> = {\n [internalPipelineOptions]: {\n executor: PipelineExecutor<Input, Output>;\n state: PipelineState;\n };\n};\n\n/** Immutable, typed Pipeline with explicit stage and execution boundaries. */\nexport class Pipeline<Input, Output = Input> {\n readonly id: string;\n readonly name: string | undefined;\n readonly description: string | undefined;\n readonly metadata: JsonObject | undefined;\n\n private readonly executor: PipelineExecutor<Input, Output>;\n private readonly state: PipelineState;\n\n constructor(options: PipelineOptions<Input, Output>);\n constructor(options: PipelineOptions<Input, Output> | InternalPipelineOptions<Input, Output>) {\n if (isInternalPipelineOptions(options)) {\n this.executor = options[internalPipelineOptions].executor;\n this.state = options[internalPipelineOptions].state;\n } else {\n const id = normalizePipelineId(options.id);\n if (!isZodSchema(options.inputSchema)) {\n throw new TypeError(\"Pipeline inputSchema must be a Zod schema.\");\n }\n const inputSchema = options.inputSchema;\n this.executor = (async (input, context) => {\n throwIfAborted(context.abortSignal);\n return inputSchema.parseAsync(input) as Promise<Output>;\n }) as PipelineExecutor<Input, Output>;\n this.state = initialPipelineState({\n id,\n name: options.name,\n description: options.description,\n metadata: options.metadata,\n });\n }\n\n const graph = this.state.graph;\n this.id = graph.id;\n this.name = graph.name;\n this.description = graph.description;\n this.metadata = graph.metadata;\n }\n\n step<Next>(options: PipelineStepOptions<Awaited<Output>, Next>): Pipeline<Input, Awaited<Next>> {\n const next = appendStageNode(this.state, \"step\", options);\n const executor = (async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return (await runNode(context, next.node, path, () =>\n options.run(stageContext(value, context)),\n )) as Awaited<Next>;\n }) as PipelineExecutor<Input, Awaited<Next>>;\n return this.derive(executor, next.state);\n }\n\n compose<Next>(\n options: PipelineComposeOptions<Awaited<Output>, Next>,\n ): Pipeline<Input, Awaited<Next>> {\n const boundary = appendStageNode(this.state, \"pipeline\", options, {\n defaultLabel: options.pipeline.name ?? options.pipeline.id,\n pipelineId: options.pipeline.id,\n });\n const state = appendComposedGraph(boundary.state, boundary.node, options.pipeline.graph());\n const executor = (async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, boundary.node.id];\n return (await runNode(context, boundary.node, path, () =>\n options.pipeline.execute(value, context, path),\n )) as Awaited<Next>;\n }) as PipelineExecutor<Input, Awaited<Next>>;\n return this.derive(executor, state);\n }\n\n parallel<Branches extends Record<string, Pipeline<Awaited<Output>, unknown>>>(\n options: PipelineParallelOptions<Awaited<Output>, Branches>,\n ): Pipeline<Input, ParallelOutput<Branches>> {\n const branchEntries = normalizeParallelBranches(options.branches);\n if (branchEntries.length === 0) {\n throw new TypeError(\"Pipeline parallel branches must not be empty.\");\n }\n const parallel = appendStageNode(this.state, \"parallel\", options, {\n defaultLabel: `${branchEntries.length} parallel branches`,\n });\n let nextState = parallel.state;\n const branchNodes = new Map<string, PipelineGraphNode>();\n const terminalPaths: PipelineNodePath[] = [];\n for (const [key, branch] of branchEntries) {\n const appended = appendParallelBranch(nextState, parallel.node, key, branch.graph());\n nextState = appended.state;\n branchNodes.set(key, appended.node);\n terminalPaths.push(...appended.terminalPaths);\n }\n nextState = withTerminalPaths(nextState, terminalPaths);\n\n return this.derive<ParallelOutput<Branches>>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const parallelPath = [...pathPrefix, parallel.node.id];\n return runNode(context, parallel.node, parallelPath, async () => {\n const controller = new AbortController();\n const combined = combineAbortSignals(context.abortSignal, controller.signal);\n const branchContext = childContext(context, combined.signal);\n let firstError: unknown;\n const promises = branchEntries.map(async ([key, branch]) => {\n const node = branchNodes.get(key) as PipelineGraphNode;\n const path = [...parallelPath, node.id];\n try {\n const output = await runNode(branchContext, node, path, () =>\n branch.execute(value, branchContext, path),\n );\n return [key, output] as const;\n } catch (error) {\n if (firstError === undefined) firstError = error;\n if (!controller.signal.aborted) controller.abort(error);\n throw error;\n }\n });\n\n const settled = await Promise.allSettled(promises);\n combined.dispose();\n if (context.abortSignal?.aborted === true) {\n throw pipelineAbortError(context.abortSignal);\n }\n if (firstError !== undefined) throw firstError;\n return Object.fromEntries(\n settled.map(\n (result) => (result as PromiseFulfilledResult<readonly [string, unknown]>).value,\n ),\n ) as ParallelOutput<Branches>;\n });\n }, nextState);\n }\n\n agent<AgentOutput, Model extends CompletionModel>(\n options: PipelineAgentOptions<Awaited<Output>, AgentOutput, Model>,\n ): Pipeline<Input, AgentOutput> {\n const next = appendStageNode(this.state, \"agent\", options, {\n defaultLabel: options.agent.name ?? options.agent.id,\n agentId: options.agent.id,\n agentName: options.agent.name,\n });\n return this.derive<AgentOutput>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return runNode(context, next.node, path, async () => {\n const request = await options.request(stageContext(value, context));\n const response = await options.agent.generate({\n ...request,\n abortSignal: context.abortSignal,\n } as AgentRunOptions<AgentOutput, RawResponseOf<Model>>);\n if (response.status === \"approval_required\") {\n await cancelAgentApproval(\n response,\n `Pipeline agent stage \"${next.node.id}\" rejects tool approval suspension.`,\n );\n throw new PipelineAgentApprovalError(response);\n }\n if (response.status === \"blocked\") {\n throw new AgentRunBlockedError(response);\n }\n return response.output;\n });\n }, next.state);\n }\n\n extract<Extracted, Model extends CompletionModel>(\n options: PipelineExtractOptions<Awaited<Output>, Extracted, Model>,\n ): Pipeline<Input, Extracted> {\n const next = appendStageNode(this.state, \"extractor\", options);\n return this.derive<Extracted>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return runNode(context, next.node, path, async () => {\n const text = await options.text(stageContext(value, context));\n const result = await extractData({\n model: options.model,\n text,\n outputSchema: options.outputSchema,\n instructions: options.instructions,\n retries: options.retries,\n temperature: options.temperature,\n maxTokens: options.maxTokens,\n providerOptions: options.providerOptions,\n abortSignal: context.abortSignal,\n });\n return result.output;\n });\n }, next.state);\n }\n\n async run(options: PipelineRunOptions<Input>): Promise<PipelineRunResult<Output>> {\n const runId = normalizeRunId(options.runId ?? globalThis.crypto.randomUUID());\n const context: PipelineRunContext = {\n runId,\n pipelineId: this.id,\n runMetadata: options.metadata,\n abortSignal: options.abortSignal,\n observer: options.observer,\n failOnObserverError: options.failOnObserverError === true,\n };\n throwIfAborted(context.abortSignal);\n const output = await this.execute(options.input, context, []);\n throwIfAborted(context.abortSignal);\n return { runId, output };\n }\n\n async runBatch(options: PipelineBatchOptions<Input>): Promise<Array<PipelineBatchItem<Output>>> {\n throwIfAborted(options.abortSignal);\n return mapWithConcurrency([...options.inputs], options.concurrency, async (input) => {\n const runId = globalThis.crypto.randomUUID();\n try {\n const result = await this.run({\n input,\n runId,\n metadata: options.metadata,\n abortSignal: options.abortSignal,\n observer: options.observer,\n failOnObserverError: options.failOnObserverError,\n });\n return { status: \"completed\", ...result } as const;\n } catch (error) {\n if (options.abortSignal?.aborted === true) {\n throw pipelineAbortError(options.abortSignal);\n }\n return { status: \"failed\", runId, error } as const;\n }\n });\n }\n\n graph(): PipelineGraph {\n return cloneGraph(withOutputNode(this.state));\n }\n\n private derive<DerivedOutput>(\n executor: PipelineExecutor<Input, DerivedOutput>,\n state: PipelineState,\n ): Pipeline<Input, DerivedOutput> {\n return createDerivedPipeline(executor, state);\n }\n\n private async execute(\n input: Input,\n context: PipelineRunContext,\n pathPrefix: PipelineNodePath,\n ): Promise<Awaited<Output>> {\n throwIfAborted(context.abortSignal);\n return (await this.executor(input, context, pathPrefix)) as Awaited<Output>;\n }\n}\n\nfunction createDerivedPipeline<Input, Output>(\n executor: PipelineExecutor<Input, Output>,\n state: PipelineState,\n): Pipeline<Input, Output> {\n const options: InternalPipelineOptions<Input, Output> = {\n [internalPipelineOptions]: { executor, state },\n };\n return new Pipeline<Input, Output>(options as unknown as PipelineOptions<Input, Output>);\n}\n\nfunction isInternalPipelineOptions<Input, Output>(\n options: PipelineOptions<Input, Output> | InternalPipelineOptions<Input, Output>,\n): options is InternalPipelineOptions<Input, Output> {\n return internalPipelineOptions in options;\n}\n\nfunction isZodSchema(value: unknown): value is z.ZodType {\n return value instanceof z.ZodType;\n}\n\nfunction normalizePipelineId(id: string): string {\n if (typeof id !== \"string\") {\n throw new TypeError(\"Pipeline id must be a string.\");\n }\n const normalized = id.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Pipeline id must be a non-empty string.\");\n }\n return normalized;\n}\n\nfunction normalizeRunId(runId: string): string {\n if (typeof runId !== \"string\") {\n throw new TypeError(\"Pipeline runId must be a string.\");\n }\n const normalized = runId.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Pipeline runId must be a non-empty string.\");\n }\n return normalized;\n}\n\nfunction normalizeParallelBranches<Branch>(\n branches: Readonly<Record<string, Branch>>,\n): Array<readonly [string, Branch]> {\n const entries: Array<readonly [string, Branch]> = [];\n const ids = new Set<string>();\n for (const key of Object.keys(branches)) {\n const pipeline = branches[key] as Branch;\n const id = key.trim();\n if (id.length === 0) {\n throw new TypeError(\"Pipeline parallel branch id must be a non-empty string.\");\n }\n if (ids.has(id)) {\n throw new TypeError(`Pipeline parallel branch id \"${id}\" is already registered.`);\n }\n ids.add(id);\n if (id !== key) {\n throw new TypeError(\"Pipeline parallel branch ids must not contain surrounding whitespace.\");\n }\n entries.push([id, pipeline]);\n }\n return entries;\n}\n","import type { JsonObject } from \"../completion\";\nimport type {\n PipelineGraph,\n PipelineGraphNode,\n PipelineNodePath,\n PipelineStageKind,\n PipelineStageMetadata,\n PipelineState,\n} from \"./types\";\n\nconst INPUT_ID = \"$input\";\nconst OUTPUT_ID = \"$output\";\nconst RESERVED_STAGE_IDS = new Set([INPUT_ID, OUTPUT_ID]);\n\nexport function initialPipelineState(options: {\n id: string;\n name?: string | undefined;\n description?: string | undefined;\n metadata?: JsonObject | undefined;\n}): PipelineState {\n const input = graphNode(INPUT_ID, [INPUT_ID], \"input\", \"Input\");\n const graph: PipelineGraph = {\n id: options.id,\n nodes: [input],\n edges: [],\n };\n if (options.name !== undefined) graph.name = options.name;\n if (options.description !== undefined) graph.description = options.description;\n if (options.metadata !== undefined) graph.metadata = options.metadata;\n return {\n graph,\n terminalPaths: [input.path],\n stageIds: new Set(),\n nextEdgeIndex: 1,\n };\n}\n\nexport function appendStageNode(\n state: PipelineState,\n kind: PipelineStageKind,\n stage: PipelineStageMetadata,\n options: {\n defaultLabel?: string | undefined;\n agentId?: string | undefined;\n agentName?: string | undefined;\n pipelineId?: string | undefined;\n } = {},\n): { state: PipelineState; node: PipelineGraphNode } {\n const id = validateStageId(stage.id);\n if (state.stageIds.has(id)) {\n throw new TypeError(`Pipeline stage id \"${id}\" is already registered.`);\n }\n const node = graphNode(id, [id], kind, stage.name ?? options.defaultLabel ?? id, {\n description: stage.description,\n metadata: stage.metadata,\n agentId: options.agentId,\n agentName: options.agentName,\n pipelineId: options.pipelineId,\n });\n return {\n node,\n state: appendNode(state, node, state.terminalPaths, [node.path], id),\n };\n}\n\nexport function appendComposedGraph(\n state: PipelineState,\n boundary: PipelineGraphNode,\n child: PipelineGraph,\n): PipelineState {\n return appendChildGraph(state, boundary.path, child);\n}\n\nexport function appendParallelBranch(\n state: PipelineState,\n parallel: PipelineGraphNode,\n branchKey: string,\n child: PipelineGraph,\n): { state: PipelineState; node: PipelineGraphNode; terminalPaths: PipelineNodePath[] } {\n const id = validateStageId(branchKey);\n const path = [...parallel.path, id];\n const node = graphNode(id, path, \"branch\", id, { branchKey: id, pipelineId: child.id });\n const withBranch = appendNode(state, node, [parallel.path], state.terminalPaths);\n const withChild = appendChildGraph(withBranch, node.path, child);\n return { state: withChild, node, terminalPaths: withChild.terminalPaths };\n}\n\nexport function withTerminalPaths(\n state: PipelineState,\n terminalPaths: PipelineNodePath[],\n): PipelineState {\n return { ...state, terminalPaths };\n}\n\nexport function withOutputNode(state: PipelineState): PipelineGraph {\n const graph = cloneGraph(state.graph);\n const outputPath = [OUTPUT_ID];\n if (graph.nodes.some((node) => pathEquals(node.path, outputPath))) {\n return graph;\n }\n graph.nodes.push(graphNode(OUTPUT_ID, outputPath, \"output\", \"Output\"));\n graph.edges.push(\n ...state.terminalPaths.map((source, index) => ({\n id: `edge_${state.nextEdgeIndex + index}`,\n source: [...source],\n target: outputPath,\n })),\n );\n return graph;\n}\n\nexport function cloneGraph(graph: PipelineGraph): PipelineGraph {\n return {\n ...graph,\n nodes: graph.nodes.map((node) => ({ ...node, path: [...node.path] })),\n edges: graph.edges.map((edge) => ({\n ...edge,\n source: [...edge.source],\n target: [...edge.target],\n })),\n };\n}\n\nexport function scopedNode(node: PipelineGraphNode, path: PipelineNodePath): PipelineGraphNode {\n return { ...node, path: [...path] };\n}\n\nfunction appendChildGraph(\n state: PipelineState,\n parentPath: PipelineNodePath,\n child: PipelineGraph,\n): PipelineState {\n const childNodes = child.nodes\n .filter((node) => !isBoundaryPath(node.path))\n .map((node) => scopedNode(node, [...parentPath, ...node.path]));\n const childEdges: PipelineState[\"graph\"][\"edges\"] = [];\n const terminalPaths: PipelineNodePath[] = [];\n let nextEdgeIndex = state.nextEdgeIndex;\n\n for (const edge of child.edges) {\n const sourceIsInput = isInputPath(edge.source);\n const targetIsOutput = isOutputPath(edge.target);\n const source = sourceIsInput ? [...parentPath] : [...parentPath, ...edge.source];\n if (targetIsOutput) {\n terminalPaths.push(source);\n continue;\n }\n const target = [...parentPath, ...edge.target];\n childEdges.push({\n id: `edge_${nextEdgeIndex}`,\n source,\n target,\n ...(edge.label === undefined ? {} : { label: edge.label }),\n });\n nextEdgeIndex += 1;\n }\n\n return {\n ...state,\n graph: {\n ...state.graph,\n nodes: [...state.graph.nodes, ...childNodes],\n edges: [...state.graph.edges, ...childEdges],\n },\n terminalPaths: terminalPaths.length === 0 ? [[...parentPath]] : terminalPaths,\n nextEdgeIndex,\n };\n}\n\nfunction appendNode(\n state: PipelineState,\n node: PipelineGraphNode,\n sourcePaths: PipelineNodePath[],\n terminalPaths: PipelineNodePath[],\n stageId?: string,\n): PipelineState {\n const edges = sourcePaths.map((source, index) => ({\n id: `edge_${state.nextEdgeIndex + index}`,\n source: [...source],\n target: [...node.path],\n }));\n const stageIds = new Set(state.stageIds);\n if (stageId !== undefined) stageIds.add(stageId);\n return {\n graph: {\n ...state.graph,\n nodes: [...state.graph.nodes, node],\n edges: [...state.graph.edges, ...edges],\n },\n terminalPaths,\n stageIds,\n nextEdgeIndex: state.nextEdgeIndex + edges.length,\n };\n}\n\nfunction graphNode(\n id: string,\n path: PipelineNodePath,\n kind: PipelineStageKind,\n label: string,\n options: {\n description?: string | undefined;\n metadata?: JsonObject | undefined;\n agentId?: string | undefined;\n agentName?: string | undefined;\n pipelineId?: string | undefined;\n branchKey?: string | undefined;\n } = {},\n): PipelineGraphNode {\n const node: PipelineGraphNode = { id, path: [...path], kind, label };\n if (options.description !== undefined) node.description = options.description;\n if (options.metadata !== undefined) node.metadata = options.metadata;\n if (options.agentId !== undefined) node.agentId = options.agentId;\n if (options.agentName !== undefined) node.agentName = options.agentName;\n if (options.pipelineId !== undefined) node.pipelineId = options.pipelineId;\n if (options.branchKey !== undefined) node.branchKey = options.branchKey;\n return node;\n}\n\nfunction validateStageId(value: string): string {\n if (typeof value !== \"string\") {\n throw new TypeError(\"Pipeline stage id must be a string.\");\n }\n const id = value.trim();\n if (id.length === 0) {\n throw new TypeError(\"Pipeline stage id must be a non-empty string.\");\n }\n if (RESERVED_STAGE_IDS.has(id)) {\n throw new TypeError(`Pipeline stage id \"${id}\" is reserved.`);\n }\n return id;\n}\n\nfunction isBoundaryPath(path: PipelineNodePath): boolean {\n return isInputPath(path) || isOutputPath(path);\n}\n\nfunction isInputPath(path: PipelineNodePath): boolean {\n return path.length === 1 && path[0] === INPUT_ID;\n}\n\nfunction isOutputPath(path: PipelineNodePath): boolean {\n return path.length === 1 && path[0] === OUTPUT_ID;\n}\n\nfunction pathEquals(left: PipelineNodePath, right: PipelineNodePath): boolean {\n return left.length === right.length && left.every((segment, index) => segment === right[index]);\n}\n","import { abortError, throwIfAborted } from \"../internal/abort\";\nimport { scopedNode } from \"./graph\";\nimport type {\n PipelineGraphNode,\n PipelineNodePath,\n PipelineRunContext,\n PipelineRunEvent,\n PipelineStageContext,\n} from \"./types\";\n\nexport async function runNode<Output>(\n context: PipelineRunContext,\n node: PipelineGraphNode,\n path: PipelineNodePath,\n fn: () => Output | Promise<Output>,\n): Promise<Awaited<Output>> {\n throwIfAborted(context.abortSignal);\n const eventNode = scopedNode(node, path);\n const startedAt = Date.now();\n await emitEvent(context, {\n type: \"stage_started\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n });\n\n try {\n const output = (await fn()) as Awaited<Output>;\n throwIfAborted(context.abortSignal);\n await emitEvent(context, {\n type: \"stage_completed\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n durationMs: Date.now() - startedAt,\n });\n return output;\n } catch (error) {\n const failureEvent: PipelineRunEvent = {\n type: \"stage_failed\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n durationMs: Date.now() - startedAt,\n error,\n };\n try {\n await emitEvent(context, failureEvent);\n } catch (observerError) {\n throw new AggregateError(\n [error, observerError],\n `Pipeline stage \"${node.id}\" and its observer both failed.`,\n );\n }\n throw error;\n }\n}\n\nexport function stageContext<Input>(\n input: Input,\n context: PipelineRunContext,\n): PipelineStageContext<Input> {\n return {\n input,\n runId: context.runId,\n pipelineId: context.pipelineId,\n runMetadata: context.runMetadata,\n abortSignal: context.abortSignal,\n };\n}\n\nexport function childContext(\n context: PipelineRunContext,\n abortSignal: AbortSignal | undefined,\n): PipelineRunContext {\n return { ...context, abortSignal };\n}\n\nexport function combineAbortSignals(\n parent: AbortSignal | undefined,\n local: AbortSignal,\n): { signal: AbortSignal; dispose(): void } {\n const controller = new AbortController();\n const abortFromParent = () => controller.abort(parent?.reason);\n const abortFromLocal = () => controller.abort(local.reason);\n\n if (parent?.aborted === true) {\n controller.abort(parent.reason);\n } else if (local.aborted) {\n controller.abort(local.reason);\n } else {\n parent?.addEventListener(\"abort\", abortFromParent, { once: true });\n local.addEventListener(\"abort\", abortFromLocal, { once: true });\n }\n\n return {\n signal: controller.signal,\n dispose() {\n parent?.removeEventListener(\"abort\", abortFromParent);\n local.removeEventListener(\"abort\", abortFromLocal);\n },\n };\n}\n\nexport function pipelineAbortError(signal: AbortSignal | undefined): Error {\n return abortError(signal?.reason);\n}\n\nasync function emitEvent(context: PipelineRunContext, event: PipelineRunEvent): Promise<void> {\n if (context.observer === undefined) return;\n try {\n await context.observer.onEvent(event);\n } catch (error) {\n if (context.failOnObserverError) throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,6BAAN,cAAyC,MAAM;AAAA,EACpD,YAAqB,QAAqC;AACxD,UAAM,+DAA+D;AADlD;AAEnB,SAAK,OAAO;AAAA,EACd;AAAA,EAHqB;AAIvB;;;ACPA,SAAS,SAAS;;;ACUlB,IAAM,WAAW;AACjB,IAAM,YAAY;AAClB,IAAM,qBAAqB,oBAAI,IAAI,CAAC,UAAU,SAAS,CAAC;AAEjD,SAAS,qBAAqB,SAKnB;AAChB,QAAM,QAAQ,UAAU,UAAU,CAAC,QAAQ,GAAG,SAAS,OAAO;AAC9D,QAAM,QAAuB;AAAA,IAC3B,IAAI,QAAQ;AAAA,IACZ,OAAO,CAAC,KAAK;AAAA,IACb,OAAO,CA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E;AAAA,IAC7F;AACA,YAAQ,KAAK,CAAC,IAAI,QAAQ,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/errors.ts","../../src/pipeline/pipeline.ts","../../src/pipeline/graph.ts","../../src/pipeline/runtime.ts"],"sourcesContent":["import type { AgentSuspendedResult } from \"../agent/run-types\";\n\nexport class PipelineAgentSuspensionError extends Error {\n constructor(readonly result: AgentSuspendedResult) {\n super(\"Pipeline agent stage suspended for human interaction.\");\n this.name = \"PipelineAgentSuspensionError\";\n }\n}\n","import { z } from \"zod\";\nimport type { Agent } from \"../agent/agent\";\nimport { AgentRunBlockedError } from \"../agent/errors\";\nimport type { AgentInput, AgentRunOptions, AgentRunSettings } from \"../agent/run-types\";\nimport type { CompletionModel, JsonObject } from \"../completion\";\nimport { type ExtractOptions, extract as extractData } from \"../extractor\";\nimport { throwIfAborted } from \"../internal/abort\";\nimport { mapWithConcurrency } from \"../internal/concurrency\";\nimport { PipelineAgentSuspensionError } from \"./errors\";\nimport {\n appendComposedGraph,\n appendParallelBranch,\n appendStageNode,\n cloneGraph,\n initialPipelineState,\n withOutputNode,\n withTerminalPaths,\n} from \"./graph\";\nimport {\n childContext,\n combineAbortSignals,\n pipelineAbortError,\n runNode,\n stageContext,\n} from \"./runtime\";\nimport type {\n ParallelOutput,\n PipelineBatchItem,\n PipelineBatchOptions,\n PipelineExecutor,\n PipelineGraph,\n PipelineGraphNode,\n PipelineNodePath,\n PipelineOptions,\n PipelineRunContext,\n PipelineRunOptions,\n PipelineRunResult,\n PipelineStageContext,\n PipelineStageMetadata,\n PipelineState,\n} from \"./types\";\n\nconst internalPipelineOptions = Symbol(\"internal-pipeline-options\");\n\ntype RawResponseOf<Model> =\n Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;\n\ntype PipelineAgentRequest<Output, Model extends CompletionModel> = AgentInput &\n Omit<AgentRunSettings<Output, RawResponseOf<Model>>, \"abortSignal\">;\n\nexport type PipelineStepOptions<Input, Output> = PipelineStageMetadata & {\n run(context: PipelineStageContext<Input>): Output | Promise<Output>;\n};\n\nexport type PipelineComposeOptions<Input, Output> = PipelineStageMetadata & {\n pipeline: Pipeline<Input, Output>;\n};\n\nexport type PipelineParallelOptions<\n Input,\n Branches extends Record<string, Pipeline<Input, unknown>>,\n> = PipelineStageMetadata & {\n branches: Branches;\n};\n\nexport type PipelineAgentOptions<\n Input,\n AgentOutput,\n Model extends CompletionModel,\n> = PipelineStageMetadata & {\n agent: Agent<AgentOutput, Model>;\n request(\n context: PipelineStageContext<Input>,\n ): PipelineAgentRequest<AgentOutput, Model> | Promise<PipelineAgentRequest<AgentOutput, Model>>;\n suspension: \"reject\";\n};\n\nexport type PipelineExtractOptions<\n Input,\n Extracted,\n Model extends CompletionModel,\n> = PipelineStageMetadata &\n Omit<ExtractOptions<Extracted, Model>, \"text\" | \"abortSignal\"> & {\n text(context: PipelineStageContext<Input>): string | Promise<string>;\n };\n\ntype InternalPipelineOptions<Input, Output> = {\n [internalPipelineOptions]: {\n executor: PipelineExecutor<Input, Output>;\n state: PipelineState;\n };\n};\n\n/** Immutable, typed Pipeline with explicit stage and execution boundaries. */\nexport class Pipeline<Input, Output = Input> {\n readonly id: string;\n readonly name: string | undefined;\n readonly description: string | undefined;\n readonly metadata: JsonObject | undefined;\n\n private readonly executor: PipelineExecutor<Input, Output>;\n private readonly state: PipelineState;\n\n constructor(options: PipelineOptions<Input, Output>);\n constructor(options: PipelineOptions<Input, Output> | InternalPipelineOptions<Input, Output>) {\n if (isInternalPipelineOptions(options)) {\n this.executor = options[internalPipelineOptions].executor;\n this.state = options[internalPipelineOptions].state;\n } else {\n const id = normalizePipelineId(options.id);\n if (!isZodSchema(options.inputSchema)) {\n throw new TypeError(\"Pipeline inputSchema must be a Zod schema.\");\n }\n const inputSchema = options.inputSchema;\n this.executor = (async (input, context) => {\n throwIfAborted(context.abortSignal);\n return inputSchema.parseAsync(input) as Promise<Output>;\n }) as PipelineExecutor<Input, Output>;\n this.state = initialPipelineState({\n id,\n name: options.name,\n description: options.description,\n metadata: options.metadata,\n });\n }\n\n const graph = this.state.graph;\n this.id = graph.id;\n this.name = graph.name;\n this.description = graph.description;\n this.metadata = graph.metadata;\n }\n\n step<Next>(options: PipelineStepOptions<Awaited<Output>, Next>): Pipeline<Input, Awaited<Next>> {\n const next = appendStageNode(this.state, \"step\", options);\n const executor = (async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return (await runNode(context, next.node, path, () =>\n options.run(stageContext(value, context)),\n )) as Awaited<Next>;\n }) as PipelineExecutor<Input, Awaited<Next>>;\n return this.derive(executor, next.state);\n }\n\n compose<Next>(\n options: PipelineComposeOptions<Awaited<Output>, Next>,\n ): Pipeline<Input, Awaited<Next>> {\n const boundary = appendStageNode(this.state, \"pipeline\", options, {\n defaultLabel: options.pipeline.name ?? options.pipeline.id,\n pipelineId: options.pipeline.id,\n });\n const state = appendComposedGraph(boundary.state, boundary.node, options.pipeline.graph());\n const executor = (async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, boundary.node.id];\n return (await runNode(context, boundary.node, path, () =>\n options.pipeline.execute(value, context, path),\n )) as Awaited<Next>;\n }) as PipelineExecutor<Input, Awaited<Next>>;\n return this.derive(executor, state);\n }\n\n parallel<Branches extends Record<string, Pipeline<Awaited<Output>, unknown>>>(\n options: PipelineParallelOptions<Awaited<Output>, Branches>,\n ): Pipeline<Input, ParallelOutput<Branches>> {\n const branchEntries = normalizeParallelBranches(options.branches);\n if (branchEntries.length === 0) {\n throw new TypeError(\"Pipeline parallel branches must not be empty.\");\n }\n const parallel = appendStageNode(this.state, \"parallel\", options, {\n defaultLabel: `${branchEntries.length} parallel branches`,\n });\n let nextState = parallel.state;\n const branchNodes = new Map<string, PipelineGraphNode>();\n const terminalPaths: PipelineNodePath[] = [];\n for (const [key, branch] of branchEntries) {\n const appended = appendParallelBranch(nextState, parallel.node, key, branch.graph());\n nextState = appended.state;\n branchNodes.set(key, appended.node);\n terminalPaths.push(...appended.terminalPaths);\n }\n nextState = withTerminalPaths(nextState, terminalPaths);\n\n return this.derive<ParallelOutput<Branches>>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const parallelPath = [...pathPrefix, parallel.node.id];\n return runNode(context, parallel.node, parallelPath, async () => {\n const controller = new AbortController();\n const combined = combineAbortSignals(context.abortSignal, controller.signal);\n const branchContext = childContext(context, combined.signal);\n let firstError: unknown;\n const promises = branchEntries.map(async ([key, branch]) => {\n const node = branchNodes.get(key) as PipelineGraphNode;\n const path = [...parallelPath, node.id];\n try {\n const output = await runNode(branchContext, node, path, () =>\n branch.execute(value, branchContext, path),\n );\n return [key, output] as const;\n } catch (error) {\n if (firstError === undefined) firstError = error;\n if (!controller.signal.aborted) controller.abort(error);\n throw error;\n }\n });\n\n const settled = await Promise.allSettled(promises);\n combined.dispose();\n if (context.abortSignal?.aborted === true) {\n throw pipelineAbortError(context.abortSignal);\n }\n if (firstError !== undefined) throw firstError;\n return Object.fromEntries(\n settled.map(\n (result) => (result as PromiseFulfilledResult<readonly [string, unknown]>).value,\n ),\n ) as ParallelOutput<Branches>;\n });\n }, nextState);\n }\n\n agent<AgentOutput, Model extends CompletionModel>(\n options: PipelineAgentOptions<Awaited<Output>, AgentOutput, Model>,\n ): Pipeline<Input, AgentOutput> {\n if (options.suspension !== \"reject\") {\n throw new TypeError('Pipeline Agent stages require suspension: \"reject\".');\n }\n const next = appendStageNode(this.state, \"agent\", options, {\n defaultLabel: options.agent.name ?? options.agent.id,\n agentId: options.agent.id,\n agentName: options.agent.name,\n });\n return this.derive<AgentOutput>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return runNode(context, next.node, path, async () => {\n const request = await options.request(stageContext(value, context));\n const response = await options.agent.generate({\n ...request,\n abortSignal: context.abortSignal,\n } as AgentRunOptions<AgentOutput, RawResponseOf<Model>>);\n if (response.status === \"suspended\") {\n throw new PipelineAgentSuspensionError(response);\n }\n if (response.status === \"blocked\") {\n throw new AgentRunBlockedError(response);\n }\n return response.output;\n });\n }, next.state);\n }\n\n extract<Extracted, Model extends CompletionModel>(\n options: PipelineExtractOptions<Awaited<Output>, Extracted, Model>,\n ): Pipeline<Input, Extracted> {\n const next = appendStageNode(this.state, \"extractor\", options);\n return this.derive<Extracted>(async (input, context, pathPrefix) => {\n const value = await this.execute(input, context, pathPrefix);\n const path = [...pathPrefix, next.node.id];\n return runNode(context, next.node, path, async () => {\n const text = await options.text(stageContext(value, context));\n const result = await extractData({\n model: options.model,\n text,\n outputSchema: options.outputSchema,\n instructions: options.instructions,\n retries: options.retries,\n temperature: options.temperature,\n maxTokens: options.maxTokens,\n providerOptions: options.providerOptions,\n abortSignal: context.abortSignal,\n });\n return result.output;\n });\n }, next.state);\n }\n\n async run(options: PipelineRunOptions<Input>): Promise<PipelineRunResult<Output>> {\n const runId = normalizeRunId(options.runId ?? globalThis.crypto.randomUUID());\n const context: PipelineRunContext = {\n runId,\n pipelineId: this.id,\n runMetadata: options.metadata,\n abortSignal: options.abortSignal,\n observer: options.observer,\n failOnObserverError: options.failOnObserverError === true,\n };\n throwIfAborted(context.abortSignal);\n const output = await this.execute(options.input, context, []);\n throwIfAborted(context.abortSignal);\n return { runId, output };\n }\n\n async runBatch(options: PipelineBatchOptions<Input>): Promise<Array<PipelineBatchItem<Output>>> {\n throwIfAborted(options.abortSignal);\n return mapWithConcurrency([...options.inputs], options.concurrency, async (input) => {\n const runId = globalThis.crypto.randomUUID();\n try {\n const result = await this.run({\n input,\n runId,\n metadata: options.metadata,\n abortSignal: options.abortSignal,\n observer: options.observer,\n failOnObserverError: options.failOnObserverError,\n });\n return { status: \"completed\", ...result } as const;\n } catch (error) {\n if (options.abortSignal?.aborted === true) {\n throw pipelineAbortError(options.abortSignal);\n }\n return { status: \"failed\", runId, error } as const;\n }\n });\n }\n\n graph(): PipelineGraph {\n return cloneGraph(withOutputNode(this.state));\n }\n\n private derive<DerivedOutput>(\n executor: PipelineExecutor<Input, DerivedOutput>,\n state: PipelineState,\n ): Pipeline<Input, DerivedOutput> {\n return createDerivedPipeline(executor, state);\n }\n\n private async execute(\n input: Input,\n context: PipelineRunContext,\n pathPrefix: PipelineNodePath,\n ): Promise<Awaited<Output>> {\n throwIfAborted(context.abortSignal);\n return (await this.executor(input, context, pathPrefix)) as Awaited<Output>;\n }\n}\n\nfunction createDerivedPipeline<Input, Output>(\n executor: PipelineExecutor<Input, Output>,\n state: PipelineState,\n): Pipeline<Input, Output> {\n const options: InternalPipelineOptions<Input, Output> = {\n [internalPipelineOptions]: { executor, state },\n };\n return new Pipeline<Input, Output>(options as unknown as PipelineOptions<Input, Output>);\n}\n\nfunction isInternalPipelineOptions<Input, Output>(\n options: PipelineOptions<Input, Output> | InternalPipelineOptions<Input, Output>,\n): options is InternalPipelineOptions<Input, Output> {\n return internalPipelineOptions in options;\n}\n\nfunction isZodSchema(value: unknown): value is z.ZodType {\n return value instanceof z.ZodType;\n}\n\nfunction normalizePipelineId(id: string): string {\n if (typeof id !== \"string\") {\n throw new TypeError(\"Pipeline id must be a string.\");\n }\n const normalized = id.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Pipeline id must be a non-empty string.\");\n }\n return normalized;\n}\n\nfunction normalizeRunId(runId: string): string {\n if (typeof runId !== \"string\") {\n throw new TypeError(\"Pipeline runId must be a string.\");\n }\n const normalized = runId.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Pipeline runId must be a non-empty string.\");\n }\n return normalized;\n}\n\nfunction normalizeParallelBranches<Branch>(\n branches: Readonly<Record<string, Branch>>,\n): Array<readonly [string, Branch]> {\n const entries: Array<readonly [string, Branch]> = [];\n const ids = new Set<string>();\n for (const key of Object.keys(branches)) {\n const pipeline = branches[key] as Branch;\n const id = key.trim();\n if (id.length === 0) {\n throw new TypeError(\"Pipeline parallel branch id must be a non-empty string.\");\n }\n if (ids.has(id)) {\n throw new TypeError(`Pipeline parallel branch id \"${id}\" is already registered.`);\n }\n ids.add(id);\n if (id !== key) {\n throw new TypeError(\"Pipeline parallel branch ids must not contain surrounding whitespace.\");\n }\n entries.push([id, pipeline]);\n }\n return entries;\n}\n","import type { JsonObject } from \"../completion\";\nimport type {\n PipelineGraph,\n PipelineGraphEdge,\n PipelineGraphNode,\n PipelineNodePath,\n PipelineStageKind,\n PipelineStageMetadata,\n PipelineState,\n} from \"./types\";\n\nconst INPUT_ID = \"$input\";\nconst OUTPUT_ID = \"$output\";\nconst RESERVED_STAGE_IDS = new Set([INPUT_ID, OUTPUT_ID]);\n\nexport function initialPipelineState(options: {\n id: string;\n name?: string | undefined;\n description?: string | undefined;\n metadata?: JsonObject | undefined;\n}): PipelineState {\n const input = graphNode(INPUT_ID, [INPUT_ID], \"input\", \"Input\");\n const graph: PipelineGraph = {\n id: options.id,\n nodes: [input],\n edges: [],\n };\n if (options.name !== undefined) graph.name = options.name;\n if (options.description !== undefined) graph.description = options.description;\n if (options.metadata !== undefined) graph.metadata = options.metadata;\n return {\n graph,\n terminalPaths: [input.path],\n stageIds: new Set(),\n nextEdgeIndex: 1,\n };\n}\n\nexport function appendStageNode(\n state: PipelineState,\n kind: PipelineStageKind,\n stage: PipelineStageMetadata,\n options: {\n defaultLabel?: string | undefined;\n agentId?: string | undefined;\n agentName?: string | undefined;\n pipelineId?: string | undefined;\n } = {},\n): { state: PipelineState; node: PipelineGraphNode } {\n const id = validateStageId(stage.id);\n if (state.stageIds.has(id)) {\n throw new TypeError(`Pipeline stage id \"${id}\" is already registered.`);\n }\n const node = graphNode(id, [id], kind, stage.name ?? options.defaultLabel ?? id, {\n description: stage.description,\n metadata: stage.metadata,\n agentId: options.agentId,\n agentName: options.agentName,\n pipelineId: options.pipelineId,\n });\n return {\n node,\n state: appendNode(state, node, state.terminalPaths, [node.path], id),\n };\n}\n\nexport function appendComposedGraph(\n state: PipelineState,\n boundary: PipelineGraphNode,\n child: PipelineGraph,\n): PipelineState {\n return appendChildGraph(state, boundary.path, child);\n}\n\nexport function appendParallelBranch(\n state: PipelineState,\n parallel: PipelineGraphNode,\n branchKey: string,\n child: PipelineGraph,\n): { state: PipelineState; node: PipelineGraphNode; terminalPaths: PipelineNodePath[] } {\n const id = validateStageId(branchKey);\n const path = [...parallel.path, id];\n const node = graphNode(id, path, \"branch\", id, { branchKey: id, pipelineId: child.id });\n const withBranch = appendNode(state, node, [parallel.path], state.terminalPaths);\n const withChild = appendChildGraph(withBranch, node.path, child);\n return { state: withChild, node, terminalPaths: withChild.terminalPaths };\n}\n\nexport function withTerminalPaths(\n state: PipelineState,\n terminalPaths: PipelineNodePath[],\n): PipelineState {\n return { ...state, terminalPaths };\n}\n\nexport function withOutputNode(state: PipelineState): PipelineGraph {\n const graph = cloneGraph(state.graph);\n const outputPath = [OUTPUT_ID];\n if (graph.nodes.some((node) => pathEquals(node.path, outputPath))) {\n return graph;\n }\n graph.nodes.push(graphNode(OUTPUT_ID, outputPath, \"output\", \"Output\"));\n graph.edges.push(\n ...state.terminalPaths.map((source, index) => ({\n id: `edge_${state.nextEdgeIndex + index}`,\n source: [...source],\n target: outputPath,\n })),\n );\n return graph;\n}\n\nexport function cloneGraph(graph: PipelineGraph): PipelineGraph {\n return {\n ...graph,\n nodes: graph.nodes.map((node) => ({ ...node, path: [...node.path] })),\n edges: graph.edges.map((edge) => ({\n ...edge,\n source: [...edge.source],\n target: [...edge.target],\n })),\n };\n}\n\nexport function scopedNode(node: PipelineGraphNode, path: PipelineNodePath): PipelineGraphNode {\n return { ...node, path: [...path] };\n}\n\nfunction appendChildGraph(\n state: PipelineState,\n parentPath: PipelineNodePath,\n child: PipelineGraph,\n): PipelineState {\n const childNodes = child.nodes\n .filter((node) => !isBoundaryPath(node.path))\n .map((node) => scopedNode(node, [...parentPath, ...node.path]));\n const childEdges: PipelineState[\"graph\"][\"edges\"] = [];\n const terminalPaths: PipelineNodePath[] = [];\n let nextEdgeIndex = state.nextEdgeIndex;\n\n for (const edge of child.edges) {\n const sourceIsInput = isInputPath(edge.source);\n const targetIsOutput = isOutputPath(edge.target);\n const source = sourceIsInput ? [...parentPath] : [...parentPath, ...edge.source];\n if (targetIsOutput) {\n terminalPaths.push(source);\n continue;\n }\n const target = [...parentPath, ...edge.target];\n let childEdge: PipelineGraphEdge = {\n id: `edge_${nextEdgeIndex}`,\n source,\n target,\n };\n if (edge.label !== undefined) childEdge = { ...childEdge, label: edge.label };\n childEdges.push(childEdge);\n nextEdgeIndex += 1;\n }\n\n return {\n ...state,\n graph: {\n ...state.graph,\n nodes: [...state.graph.nodes, ...childNodes],\n edges: [...state.graph.edges, ...childEdges],\n },\n terminalPaths: terminalPaths.length === 0 ? [[...parentPath]] : terminalPaths,\n nextEdgeIndex,\n };\n}\n\nfunction appendNode(\n state: PipelineState,\n node: PipelineGraphNode,\n sourcePaths: PipelineNodePath[],\n terminalPaths: PipelineNodePath[],\n stageId?: string,\n): PipelineState {\n const edges = sourcePaths.map((source, index) => ({\n id: `edge_${state.nextEdgeIndex + index}`,\n source: [...source],\n target: [...node.path],\n }));\n const stageIds = new Set(state.stageIds);\n if (stageId !== undefined) stageIds.add(stageId);\n return {\n graph: {\n ...state.graph,\n nodes: [...state.graph.nodes, node],\n edges: [...state.graph.edges, ...edges],\n },\n terminalPaths,\n stageIds,\n nextEdgeIndex: state.nextEdgeIndex + edges.length,\n };\n}\n\nfunction graphNode(\n id: string,\n path: PipelineNodePath,\n kind: PipelineStageKind,\n label: string,\n options: {\n description?: string | undefined;\n metadata?: JsonObject | undefined;\n agentId?: string | undefined;\n agentName?: string | undefined;\n pipelineId?: string | undefined;\n branchKey?: string | undefined;\n } = {},\n): PipelineGraphNode {\n const node: PipelineGraphNode = { id, path: [...path], kind, label };\n if (options.description !== undefined) node.description = options.description;\n if (options.metadata !== undefined) node.metadata = options.metadata;\n if (options.agentId !== undefined) node.agentId = options.agentId;\n if (options.agentName !== undefined) node.agentName = options.agentName;\n if (options.pipelineId !== undefined) node.pipelineId = options.pipelineId;\n if (options.branchKey !== undefined) node.branchKey = options.branchKey;\n return node;\n}\n\nfunction validateStageId(value: string): string {\n if (typeof value !== \"string\") {\n throw new TypeError(\"Pipeline stage id must be a string.\");\n }\n const id = value.trim();\n if (id.length === 0) {\n throw new TypeError(\"Pipeline stage id must be a non-empty string.\");\n }\n if (RESERVED_STAGE_IDS.has(id)) {\n throw new TypeError(`Pipeline stage id \"${id}\" is reserved.`);\n }\n return id;\n}\n\nfunction isBoundaryPath(path: PipelineNodePath): boolean {\n return isInputPath(path) || isOutputPath(path);\n}\n\nfunction isInputPath(path: PipelineNodePath): boolean {\n return path.length === 1 && path[0] === INPUT_ID;\n}\n\nfunction isOutputPath(path: PipelineNodePath): boolean {\n return path.length === 1 && path[0] === OUTPUT_ID;\n}\n\nfunction pathEquals(left: PipelineNodePath, right: PipelineNodePath): boolean {\n return left.length === right.length && left.every((segment, index) => segment === right[index]);\n}\n","import { abortError, throwIfAborted } from \"../internal/abort\";\nimport { scopedNode } from \"./graph\";\nimport type {\n PipelineGraphNode,\n PipelineNodePath,\n PipelineRunContext,\n PipelineRunEvent,\n PipelineStageContext,\n} from \"./types\";\n\nexport async function runNode<Output>(\n context: PipelineRunContext,\n node: PipelineGraphNode,\n path: PipelineNodePath,\n fn: () => Output | Promise<Output>,\n): Promise<Awaited<Output>> {\n throwIfAborted(context.abortSignal);\n const eventNode = scopedNode(node, path);\n const startedAt = Date.now();\n await emitEvent(context, {\n type: \"stage_started\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n });\n\n try {\n const output = (await fn()) as Awaited<Output>;\n throwIfAborted(context.abortSignal);\n await emitEvent(context, {\n type: \"stage_completed\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n durationMs: Date.now() - startedAt,\n });\n return output;\n } catch (error) {\n const failureEvent: PipelineRunEvent = {\n type: \"stage_failed\",\n runId: context.runId,\n pipelineId: context.pipelineId,\n path: [...path],\n node: eventNode,\n durationMs: Date.now() - startedAt,\n error,\n };\n try {\n await emitEvent(context, failureEvent);\n } catch (observerError) {\n throw new AggregateError(\n [error, observerError],\n `Pipeline stage \"${node.id}\" and its observer both failed.`,\n );\n }\n throw error;\n }\n}\n\nexport function stageContext<Input>(\n input: Input,\n context: PipelineRunContext,\n): PipelineStageContext<Input> {\n return {\n input,\n runId: context.runId,\n pipelineId: context.pipelineId,\n runMetadata: context.runMetadata,\n abortSignal: context.abortSignal,\n };\n}\n\nexport function childContext(\n context: PipelineRunContext,\n abortSignal: AbortSignal | undefined,\n): PipelineRunContext {\n return { ...context, abortSignal };\n}\n\nexport function combineAbortSignals(\n parent: AbortSignal | undefined,\n local: AbortSignal,\n): { signal: AbortSignal; dispose(): void } {\n const controller = new AbortController();\n const abortFromParent = () => controller.abort(parent?.reason);\n const abortFromLocal = () => controller.abort(local.reason);\n\n if (parent?.aborted === true) {\n controller.abort(parent.reason);\n } else if (local.aborted) {\n controller.abort(local.reason);\n } else {\n parent?.addEventListener(\"abort\", abortFromParent, { once: true });\n local.addEventListener(\"abort\", abortFromLocal, { once: true });\n }\n\n return {\n signal: controller.signal,\n dispose() {\n parent?.removeEventListener(\"abort\", abortFromParent);\n local.removeEventListener(\"abort\", abortFromLocal);\n },\n };\n}\n\nexport function pipelineAbortError(signal: AbortSignal | undefined): Error {\n return abortError(signal?.reason);\n}\n\nasync function emitEvent(context: PipelineRunContext, event: PipelineRunEvent): Promise<void> {\n if (context.observer === undefined) return;\n try {\n await context.observer.onEvent(event);\n } catch (error) {\n if (context.failOnObserverError) throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEO,IAAM,+BAAN,cAA2C,MAAM;AAAA,EACtD,YAAqB,QAA8B;AACjD,UAAM,uDAAuD;AAD1C;AAEnB,SAAK,OAAO;AAAA,EACd;AAAA,EAHqB;AAIvB;;;ACPA,SAAS,SAAS;;;ACWlB,IAAM,WAAW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S,GAAG;AAC7B,UAAM,KAAK,IAAI,KAAK;AACpB,QAAI,GAAG,WAAW,GAAG;AACnB,YAAM,IAAI,UAAU,yDAAyD;AAAA,IAC/E;AACA,QAAI,IAAI,IAAI,EAAE,GAAG;AACf,YAAM,IAAI,UAAU,gCAAgC,EAAE,0BAA0B;AAAA,IAClF;AACA,QAAI,IAAI,EAAE;AACV,QAAI,OAAO,KAAK;AACd,YAAM,IAAI,UAAU,uEAAuE;AAAA,IAC7F;AACA,YAAQ,KAAK,CAAC,IAAI,QAAQ,CAAC;AAAA,EAC7B;AACA,SAAO;AACT;","names":[]}
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as SkillLoader, a as SkillSet } from '../types-
|
|
2
|
-
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-
|
|
3
|
-
import '../tool
|
|
4
|
-
import '../types-
|
|
1
|
+
import { b as SkillLoader, a as SkillSet } from '../types-RT3cuyRk.js';
|
|
2
|
+
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-RT3cuyRk.js';
|
|
3
|
+
import '../tool-r62gf3QY.js';
|
|
4
|
+
import '../types-D9rKQ_as.js';
|
|
5
5
|
import '../model-call-options-CZkSw_xN.js';
|
|
6
6
|
|
|
7
7
|
declare function loadSkills(loaders: SkillLoader | SkillLoader[]): Promise<SkillSet>;
|
package/dist/skills/index.js
CHANGED
|
@@ -2,13 +2,14 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RFHQY2IO.js";
|
|
6
6
|
import "../chunk-YK4WAAS4.js";
|
|
7
7
|
import "../chunk-CQNNSZPG.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-J2W63PJI.js";
|
|
9
|
+
import "../chunk-XYTPYUGB.js";
|
|
10
|
+
import "../chunk-GQL5KRAH.js";
|
|
11
|
+
import "../chunk-3RM57ZT2.js";
|
|
12
|
+
import "../chunk-PK5LKOFL.js";
|
|
12
13
|
import "../chunk-FN7HLLAZ.js";
|
|
13
14
|
export {
|
|
14
15
|
SkillValidationError,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
|
|
2
2
|
import { b as RetrySetting } from '../retry-CjvSlKGW.js';
|
|
3
3
|
export { R as RetryContext, a as RetryOptions } from '../retry-CjvSlKGW.js';
|
|
4
|
-
import { J as JsonObject } from '../types-
|
|
4
|
+
import { J as JsonObject } from '../types-D9rKQ_as.js';
|
|
5
5
|
|
|
6
6
|
type SpeechGenerationRequest = {
|
|
7
7
|
text: string;
|