@gt-fe/eap-runtime 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/handlers/stream.handler.js +1 -1
- package/dist/api/routes/agent.routes.d.ts +2 -2
- package/dist/common/types.d.ts +5 -5
- package/dist/common/types.js +2 -2
- package/dist/contracts/permission-checker.d.ts +1 -1
- package/dist/governance/governance-client.d.ts +1 -1
- package/dist/governance/index.d.ts +1 -1
- package/dist/governance/permission-guard.d.ts +1 -1
- package/dist/graph/adapters/langgraph.adapter.js +1 -1
- package/dist/graph/contracts/executable-graph.d.ts +6 -6
- package/dist/graph/contracts/executable-graph.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/providers/local-llm-provider.d.ts +1 -1
- package/dist/providers/local-llm-provider.js +1 -1
- package/dist/providers/routing-llm-provider.js +1 -1
- package/dist/registry/agent-models.d.ts +1 -1
- package/dist/registry/agent-models.js +1 -1
- package/dist/registry/agent-registry-client.d.ts +1 -1
- package/dist/registry/deployment-snapshot.js +1 -1
- package/dist/registry/graph-loader.d.ts +1 -1
- package/dist/registry/preload-errors.d.ts +1 -1
- package/dist/registry/preload-errors.js +1 -1
- package/dist/registry/skill-io-guard.js +1 -1
- package/dist/registry/skill-tree.js +1 -1
- package/dist/runtime/agent-runtime.js +1 -1
- package/dist/runtime/types.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/sse/events/skill-events.d.ts +1 -1
- package/dist/sse/events/skill-events.js +1 -1
- package/dist/tool/create-tool-executor.d.ts +1 -1
- package/dist/tool/dev-http-executor.d.ts +1 -1
- package/dist/tool/dev-http-executor.js +2 -2
- package/dist/tool/dev-mcp-executor.js +1 -1
- package/dist/tool/harness-primitives.js +1 -1
- package/dist/tool/http-tool-executor.js +1 -1
- package/dist/tool/local-mcp-client.d.ts +1 -1
- package/dist/tool/local-tool-executor.d.ts +1 -1
- package/dist/tool/local-tool-executor.js +1 -1
- package/dist/tool/mcp-tool-executor.js +1 -1
- package/dist/tool/system-prompt-builder.js +1 -1
- package/dist/tool/timeout.d.ts +2 -2
- package/dist/tool/timeout.js +2 -2
- package/dist/tool/tool-execution-router.d.ts +1 -1
- package/dist/tool/tool-execution-router.js +1 -1
- package/dist/tool/tool-orchestrator.d.ts +1 -1
- package/dist/tool/tool-orchestrator.js +1 -1
- package/dist/utils/format-error.d.ts +2 -2
- package/dist/utils/format-error.js +2 -2
- package/dist/utils/http-error.d.ts +2 -2
- package/dist/utils/http-error.js +2 -2
- package/package.json +2 -2
|
@@ -25,7 +25,7 @@ import { TokenBudgetExhaustedError } from '../../token/token-budget-guard.js';
|
|
|
25
25
|
import { SSEEmitter } from '../../sse/sse-emitter.js';
|
|
26
26
|
import { resolveExecutionContext } from '../../governance/governance-client.js';
|
|
27
27
|
import { resolveSkillInputFromInvokeInput } from '../../registry/skill-io-guard.js';
|
|
28
|
-
import { ErrorCodes } from '@eap
|
|
28
|
+
import { ErrorCodes } from '@gt-fe/eap-contracts';
|
|
29
29
|
import { classifyRuntimeError } from '../../utils/http-error.js';
|
|
30
30
|
import { toLoadedToolMap } from '../../tool/loaded-tool-definition.js';
|
|
31
31
|
import { toLoadedSkillMap } from '../../tool/system-prompt-builder.js';
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* 生产环境由 Hosting 提供对外 HTTP;本模块供 `EAP_DEV_HTTP=1` 本地调试。
|
|
5
5
|
*/
|
|
6
6
|
import type { ServerResponse } from 'node:http';
|
|
7
|
-
import type { InvokeRequest as ContractInvokeRequest, InvokeResponse as ContractInvokeResponse } from '@eap
|
|
7
|
+
import type { InvokeRequest as ContractInvokeRequest, InvokeResponse as ContractInvokeResponse } from '@gt-fe/eap-contracts';
|
|
8
8
|
import type { ITaskManager } from '../../task/task.service.js';
|
|
9
9
|
import type { SessionService } from '../../session/session.service.js';
|
|
10
10
|
import type { IStateGraphEngine } from '../../graph/contracts/executable-graph.js';
|
|
11
11
|
import type { SSEEmitter } from '../../sse/sse-emitter.js';
|
|
12
|
-
export type { InvokeConfig, InvokeResponseData } from '@eap
|
|
12
|
+
export type { InvokeConfig, InvokeResponseData } from '@gt-fe/eap-contracts';
|
|
13
13
|
/**
|
|
14
14
|
* dev HTTP 层 Invoke 请求(扩展 userId,Hosting 从 auth 注入)
|
|
15
15
|
*/
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* eap-runtime 内部共享类型定义
|
|
3
3
|
*
|
|
4
|
-
* 本文件定义 Runtime 模块内部使用的类型,与 @eap
|
|
5
|
-
* - @eap
|
|
4
|
+
* 本文件定义 Runtime 模块内部使用的类型,与 @gt-fe/eap-contracts 中的公共协议类型互补但不重复。
|
|
5
|
+
* - @gt-fe/eap-contracts 定义跨模块的公共协议(如 Task 实体、Session 实体、Agent Manifest)
|
|
6
6
|
* - 本文件定义 Runtime 执行引擎内部流转的配置、上下文、枚举等
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
@@ -32,7 +32,7 @@ export declare const DEFAULT_RUNTIME_CONFIG: RuntimeConfig;
|
|
|
32
32
|
/**
|
|
33
33
|
* 执行上下文 — 贯穿 Graph 执行生命周期(Runtime 内部)
|
|
34
34
|
*
|
|
35
|
-
* 平台级 ExecutionContext(@eap
|
|
35
|
+
* 平台级 ExecutionContext(@gt-fe/eap-contracts)由 Hosting/eap dev 注入;
|
|
36
36
|
* 本类型在 Task 创建后组装,供引擎子服务使用。
|
|
37
37
|
*/
|
|
38
38
|
export interface RuntimeRunContext {
|
|
@@ -62,7 +62,7 @@ export type TaskStatus = 'pending' | 'running' | 'waiting_hitl' | 'success' | 'f
|
|
|
62
62
|
/**
|
|
63
63
|
* Runtime 执行上下文绑定状态(非平台 Session 生命周期)
|
|
64
64
|
*
|
|
65
|
-
* 平台 Session 三态(active/paused/closed)由 Hosting 管理,见 @eap
|
|
65
|
+
* 平台 Session 三态(active/paused/closed)由 Hosting 管理,见 @gt-fe/eap-contracts。
|
|
66
66
|
* Runtime 仅在引擎内标记执行上下文是否仍可绑定:`active` | `archived`。
|
|
67
67
|
*/
|
|
68
68
|
export type ExecutionSessionBindingStatus = 'active' | 'archived';
|
|
@@ -77,7 +77,7 @@ export type MessageRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
|
77
77
|
/**
|
|
78
78
|
* 单次 LLM/Tool 调用的 Token 消耗记录
|
|
79
79
|
*
|
|
80
|
-
* 与 @eap
|
|
80
|
+
* 与 @gt-fe/eap-contracts.TokenUsage 的区别:
|
|
81
81
|
* - contracts 版本是 Task 级聚合结果(含 byNode/byModel)
|
|
82
82
|
* - 本类型是单次调用粒度的原始记录,用于 Runtime 内部累计和 stats.node_token 事件
|
|
83
83
|
*/
|
package/dist/common/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* eap-runtime 内部共享类型定义
|
|
3
3
|
*
|
|
4
|
-
* 本文件定义 Runtime 模块内部使用的类型,与 @eap
|
|
5
|
-
* - @eap
|
|
4
|
+
* 本文件定义 Runtime 模块内部使用的类型,与 @gt-fe/eap-contracts 中的公共协议类型互补但不重复。
|
|
5
|
+
* - @gt-fe/eap-contracts 定义跨模块的公共协议(如 Task 实体、Session 实体、Agent Manifest)
|
|
6
6
|
* - 本文件定义 Runtime 执行引擎内部流转的配置、上下文、枚举等
|
|
7
7
|
*/
|
|
8
8
|
/** RuntimeConfig 默认值 */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 权限校验器接口(对齐 06-governance R16.8)
|
|
3
3
|
*/
|
|
4
|
-
import type { ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult } from '@eap
|
|
4
|
+
import type { ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult } from '@gt-fe/eap-contracts';
|
|
5
5
|
/**
|
|
6
6
|
* IPermissionChecker — Runtime 执行期权限校验
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 治理服务 HTTP 客户端(06-governance validateToken / checkPermission)
|
|
3
3
|
*/
|
|
4
|
-
import type { ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult } from '@eap
|
|
4
|
+
import type { ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult } from '@gt-fe/eap-contracts';
|
|
5
5
|
export interface HttpGovernanceClientOptions {
|
|
6
6
|
baseUrl: string;
|
|
7
7
|
timeout?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 权限校验 — 对齐 06-governance R16.8
|
|
3
3
|
*/
|
|
4
|
-
export type { CallerType, ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult, PermissionAction, PermissionDenyReason, PermissionResourceType, } from '@eap
|
|
4
|
+
export type { CallerType, ExecutionContext, GovernancePermissionCheckParams, GovernancePermissionCheckResult, PermissionAction, PermissionDenyReason, PermissionResourceType, } from '@gt-fe/eap-contracts';
|
|
5
5
|
export type { IGovernanceClient } from './governance-client.js';
|
|
6
6
|
export { HttpGovernanceClient, AllowAllGovernanceClient, resolveExecutionContext, } from './governance-client.js';
|
|
7
7
|
export { assertToolPermission, assertSkillPermission, permissionMessage, PermissionDeniedError, GovernanceUnavailableError, } from './permission-guard.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 执行期 Tool 权限守卫
|
|
3
3
|
*/
|
|
4
|
-
import type { ExecutionContext, PermissionDenyReason } from '@eap
|
|
4
|
+
import type { ExecutionContext, PermissionDenyReason } from '@gt-fe/eap-contracts';
|
|
5
5
|
import type { IGovernanceClient } from './governance-client.js';
|
|
6
6
|
export declare class GovernanceUnavailableError extends Error {
|
|
7
7
|
readonly reason: PermissionDenyReason;
|
|
@@ -25,7 +25,7 @@ import { bindSelectedSkill } from '../nodes/skill-bind-node.js';
|
|
|
25
25
|
import { resolveGraphPrompt } from '../resolve-graph-prompt.js';
|
|
26
26
|
import { SkillAuditRecorder } from '../skill-audit-recorder.js';
|
|
27
27
|
import { preloadSkillNotFound } from '../../registry/preload-errors.js';
|
|
28
|
-
import { AppError, ErrorCodes } from '@eap
|
|
28
|
+
import { AppError, ErrorCodes } from '@gt-fe/eap-contracts';
|
|
29
29
|
import { isHitlDecision, lastAssistantHasUnansweredToolCalls } from '../hitl/hitl-handler.js';
|
|
30
30
|
import { classifySkillRead } from './skill-read.js';
|
|
31
31
|
import { withGraphSpan } from '../trace-span.js';
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Executable Graph 类型定义
|
|
3
3
|
*
|
|
4
4
|
* 定义 Graph 引擎核心的可执行图、DSL、节点、边等类型。
|
|
5
|
-
* 与 @eap
|
|
5
|
+
* 与 @gt-fe/eap-contracts 的 GraphDSL 基础类型互补,在 Runtime 层提供更丰富的类型支持。
|
|
6
6
|
*
|
|
7
7
|
* @see design.md §1.4 StateGraph Contract
|
|
8
8
|
* @see requirements.md Requirement 1 AC1-AC2
|
|
9
9
|
*/
|
|
10
|
-
import type { GraphDSL as BaseGraphDSL, GraphNode as BaseGraphNode, GraphEdge as BaseGraphEdge, GraphNodeType, GraphConfig } from '@eap
|
|
10
|
+
import type { GraphDSL as BaseGraphDSL, GraphNode as BaseGraphNode, GraphEdge as BaseGraphEdge, GraphNodeType, GraphConfig } from '@gt-fe/eap-contracts';
|
|
11
11
|
export type { GraphNodeType, GraphConfig };
|
|
12
12
|
/**
|
|
13
13
|
* RuntimeGraphConfig — Runtime 层扩展的 Graph 配置
|
|
14
14
|
*
|
|
15
|
-
* 在 @eap
|
|
15
|
+
* 在 @gt-fe/eap-contracts GraphConfig 基础上增加 Runtime 执行所需的 maxRetries。
|
|
16
16
|
*/
|
|
17
17
|
export interface RuntimeGraphConfig extends GraphConfig {
|
|
18
18
|
/** Graph 级默认重试次数(节点级 retry 可覆盖) */
|
|
@@ -21,7 +21,7 @@ export interface RuntimeGraphConfig extends GraphConfig {
|
|
|
21
21
|
/**
|
|
22
22
|
* GraphNode — Runtime 层扩展的节点定义
|
|
23
23
|
*
|
|
24
|
-
* 继承 @eap
|
|
24
|
+
* 继承 @gt-fe/eap-contracts 基础 GraphNode,增加 Runtime 执行所需的字段:
|
|
25
25
|
* - 重试配置(节点级 maxRetries + 退避策略)
|
|
26
26
|
* - HITL 标记(interrupt_before / interrupt_after)
|
|
27
27
|
* - 描述信息(调试/Trace 用)
|
|
@@ -79,7 +79,7 @@ export interface ConditionalBranch {
|
|
|
79
79
|
/**
|
|
80
80
|
* GraphDSL — Runtime 层扩展的声明式工作流定义
|
|
81
81
|
*
|
|
82
|
-
* 扩展 @eap
|
|
82
|
+
* 扩展 @gt-fe/eap-contracts 的 BaseGraphDSL,增加条件路由、入口/终止节点等。
|
|
83
83
|
*/
|
|
84
84
|
export interface GraphDSL extends Omit<BaseGraphDSL, 'config' | 'nodes' | 'edges'> {
|
|
85
85
|
/** 覆盖节点类型为 Runtime 扩展版本 */
|
|
@@ -163,7 +163,7 @@ export interface ExecutableGraph {
|
|
|
163
163
|
/** 底层引擎内部实例引用(opaque,由 adapter 管理) */
|
|
164
164
|
_engineInstance?: unknown;
|
|
165
165
|
}
|
|
166
|
-
import type { ExecutionContext as PlatformExecutionContext } from '@eap
|
|
166
|
+
import type { ExecutionContext as PlatformExecutionContext } from '@gt-fe/eap-contracts';
|
|
167
167
|
/**
|
|
168
168
|
* GraphState — 传入 stream/invoke 的上下文数据
|
|
169
169
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Executable Graph 类型定义
|
|
3
3
|
*
|
|
4
4
|
* 定义 Graph 引擎核心的可执行图、DSL、节点、边等类型。
|
|
5
|
-
* 与 @eap
|
|
5
|
+
* 与 @gt-fe/eap-contracts 的 GraphDSL 基础类型互补,在 Runtime 层提供更丰富的类型支持。
|
|
6
6
|
*
|
|
7
7
|
* @see design.md §1.4 StateGraph Contract
|
|
8
8
|
* @see requirements.md Requirement 1 AC1-AC2
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export * from './common/index.js';
|
|
|
16
16
|
export * from './registry/index.js';
|
|
17
17
|
export * from './providers/index.js';
|
|
18
18
|
export type { ITraceCollector, TraceEvent, TraceSession, ExecutionFlowEvent, ExecutionNodeEvent, TraceLinkEvent, TraceLinkNodeEvent, } from './contracts/trace-collector.js';
|
|
19
|
-
export type { ExecutionContext, CallerType, GovernancePermissionCheckParams, GovernancePermissionCheckResult, PermissionDenyReason, } from '@eap
|
|
19
|
+
export type { ExecutionContext, CallerType, GovernancePermissionCheckParams, GovernancePermissionCheckResult, PermissionDenyReason, } from '@gt-fe/eap-contracts';
|
|
20
20
|
export { HttpGovernanceClient, AllowAllGovernanceClient, resolveExecutionContext, assertToolPermission, assertSkillPermission, permissionMessage, PermissionDeniedError, GovernanceUnavailableError, } from './governance/index.js';
|
|
21
21
|
export type { IGovernanceClient } from './governance/index.js';
|
|
22
22
|
export { FileLlmTurnLog, InMemoryLlmTurnLog, createFileLlmTurnLogFromEnv, maskApiKey, resolveLlmTurnDir, } from './debug/llm-turn-log.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ILLMProvider } from '../graph/nodes/llm-node.js';
|
|
6
6
|
import type { ILlmTurnLog } from '../debug/llm-turn-log.js';
|
|
7
|
-
import { type ModelCallDefaults } from '@eap
|
|
7
|
+
import { type ModelCallDefaults } from '@gt-fe/eap-contracts';
|
|
8
8
|
export interface LocalLlmConnection {
|
|
9
9
|
baseUrl: string;
|
|
10
10
|
apiKey: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 本地多模型 LLM:按节点 model 选网关。仅 dev。
|
|
3
3
|
* 连接表里只带 apiKeyEnv,密钥从 process.env 读取,不进 JSON。
|
|
4
4
|
*/
|
|
5
|
-
import { mergeModelCallParams } from '@eap
|
|
5
|
+
import { mergeModelCallParams } from '@gt-fe/eap-contracts';
|
|
6
6
|
import { HttpLLMProvider } from './http-llm-provider.js';
|
|
7
7
|
export const LLM_CONNECTIONS_ENV = 'EAP_LLM_CONNECTIONS';
|
|
8
8
|
export function parseLocalLlmConnectionRefs(env = process.env) {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - 支持任意 OpenAI 兼容 API(OpenAI / DeepSeek / 本地 Ollama 等)
|
|
12
12
|
* - 连接配置由 Foundation 统一管理,Runtime 无感知
|
|
13
13
|
*/
|
|
14
|
-
import { mergeModelCallParams } from '@eap
|
|
14
|
+
import { mergeModelCallParams } from '@gt-fe/eap-contracts';
|
|
15
15
|
import { EchoLLMProvider } from './echo-llm-provider.js';
|
|
16
16
|
import { HttpLLMProvider } from './http-llm-provider.js';
|
|
17
17
|
export class RoutingLLMProvider {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { resolveDeclaredModels, resolveAgentDefaultModel, resolveAgentModelAllowlist, } from '@eap
|
|
1
|
+
export { resolveDeclaredModels, resolveAgentDefaultModel, resolveAgentModelAllowlist, } from '@gt-fe/eap-contracts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { resolveDeclaredModels, resolveAgentDefaultModel, resolveAgentModelAllowlist, } from '@eap
|
|
1
|
+
export { resolveDeclaredModels, resolveAgentDefaultModel, resolveAgentModelAllowlist, } from '@gt-fe/eap-contracts';
|
|
@@ -13,7 +13,7 @@ import { readdir, readFile, access } from 'node:fs/promises';
|
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
import { constants as fsConstants } from 'node:fs';
|
|
16
|
-
import { parseSkillMd } from '@eap
|
|
16
|
+
import { parseSkillMd } from '@gt-fe/eap-contracts';
|
|
17
17
|
import { findSkillEntryFile } from './skill-tree.js';
|
|
18
18
|
import { preloadMissing, preloadPackageCorrupt, } from './preload-errors.js';
|
|
19
19
|
import { isRequireChecksum, resolvePreloadBehaviorFlags, } from './preload-flags.js';
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { GraphDSL } from '../graph/contracts/executable-graph.js';
|
|
8
8
|
import type { AgentRegistryClient } from './agent-registry-client.js';
|
|
9
9
|
import type { DeploymentContext } from '../tool/tool-execution-router.js';
|
|
10
|
-
import type { ILocalToolInstallStore } from '@eap
|
|
10
|
+
import type { ILocalToolInstallStore } from '@gt-fe/eap-contracts';
|
|
11
11
|
import { type LoadedToolDefinition } from '../tool/loaded-tool-definition.js';
|
|
12
12
|
import type { LoadedSkillInfo } from '../tool/system-prompt-builder.js';
|
|
13
13
|
import { type IDeploymentSnapshot } from './deployment-snapshot.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 预装加载错误 — 对齐 runtime.preload.* / 联调契约
|
|
3
3
|
*/
|
|
4
|
-
import { AppError, type ErrorCode } from '@eap
|
|
4
|
+
import { AppError, type ErrorCode } from '@gt-fe/eap-contracts';
|
|
5
5
|
export declare function preloadError(code: ErrorCode, message: string, details?: unknown): AppError;
|
|
6
6
|
export declare function preloadMissing(message: string, details?: unknown): AppError;
|
|
7
7
|
export declare function preloadManifestNotFound(message: string, details?: unknown): AppError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 预装加载错误 — 对齐 runtime.preload.* / 联调契约
|
|
3
3
|
*/
|
|
4
|
-
import { AppError, ErrorCodes } from '@eap
|
|
4
|
+
import { AppError, ErrorCodes } from '@gt-fe/eap-contracts';
|
|
5
5
|
export function preloadError(code, message, details) {
|
|
6
6
|
return new AppError(code, message, {
|
|
7
7
|
exposeMessage: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Skill inputDef / outputDef 轻量校验(默认开启;EAP_PRELOAD_VALIDATE_SKILL_IO=0 关闭)
|
|
3
3
|
*/
|
|
4
|
-
import { AppError, ErrorCodes } from '@eap
|
|
4
|
+
import { AppError, ErrorCodes } from '@gt-fe/eap-contracts';
|
|
5
5
|
import { isValidateSkillIo } from './preload-flags.js';
|
|
6
6
|
function asRecord(value) {
|
|
7
7
|
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
@@ -10,7 +10,7 @@ import { readdir, stat, access, readFile } from 'node:fs/promises';
|
|
|
10
10
|
import { watch } from 'node:fs';
|
|
11
11
|
import { constants as fsConstants } from 'node:fs';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { SKILL_ENTRY_CANDIDATES } from '@eap
|
|
13
|
+
import { SKILL_ENTRY_CANDIDATES } from '@gt-fe/eap-contracts';
|
|
14
14
|
const SKILL_CODE = /^[a-z0-9][a-z0-9-]*$/;
|
|
15
15
|
async function exists(p) {
|
|
16
16
|
try {
|
|
@@ -12,7 +12,7 @@ import { toLoadedSkillMap } from '../tool/system-prompt-builder.js';
|
|
|
12
12
|
import { assembleLoadedTools } from '../tool/harness-primitives.js';
|
|
13
13
|
import { createFileLlmTurnLogFromEnv, } from '../debug/llm-turn-log.js';
|
|
14
14
|
import { buildHitlWaitingTaskOutput, buildTurnGraphMessages, buildTurnTranscriptFromStreamEvents, extractHitlThreadId, extractStreamReasoning, extractStreamTextDelta, messageRecordsToGraphMessages, persistHitlWaitingPlaceholder, persistTurnTranscript, persistUserTurnMessage, } from '../session/persist-turn-messages.js';
|
|
15
|
-
import { AppError, ErrorCodes } from '@eap
|
|
15
|
+
import { AppError, ErrorCodes } from '@gt-fe/eap-contracts';
|
|
16
16
|
import { resolveExecutionContext } from '../governance/governance-client.js';
|
|
17
17
|
import { resolveAgentCode } from '../common/agent-code.js';
|
|
18
18
|
import { resolveTraceId } from '../common/trace-id.js';
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @see 04-runtime-core/design.md §1.5
|
|
8
8
|
*/
|
|
9
|
-
import type { ExecutionContext, InvokeConfig, ResumeHitlResult } from '@eap
|
|
9
|
+
import type { ExecutionContext, InvokeConfig, ResumeHitlResult } from '@gt-fe/eap-contracts';
|
|
10
10
|
import type { InvokeResponseData } from '../api/routes/agent.routes.js';
|
|
11
11
|
import type { GraphMessage } from '../graph/contracts/executable-graph.js';
|
|
12
12
|
import type { SSEEvent } from '../sse/contracts/sse-emitter.contract.js';
|
|
@@ -31,7 +31,7 @@ export interface ExecuteParams {
|
|
|
31
31
|
}
|
|
32
32
|
/** 同步执行结果 */
|
|
33
33
|
export type ExecuteResult = InvokeResponseData;
|
|
34
|
-
/** HITL 恢复结果(与 @eap
|
|
34
|
+
/** HITL 恢复结果(与 @gt-fe/eap-contracts ResumeHitlResult 对齐) */
|
|
35
35
|
export type { ResumeHitlResult };
|
|
36
36
|
/** HITL 用户响应 */
|
|
37
37
|
export interface HitlResponse {
|
package/dist/server.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* TODO: Phase 2 将本文件迁移至 dev-tools/cli(作为 `eap dev` 命令实现),
|
|
8
8
|
* runtime 包不再包含 HTTP 服务代码,仅作为纯库导出。
|
|
9
9
|
*/
|
|
10
|
-
import { ErrorCodes } from '@eap
|
|
10
|
+
import { ErrorCodes } from '@gt-fe/eap-contracts';
|
|
11
11
|
import { createServer } from 'node:http';
|
|
12
12
|
import { URL } from 'node:url';
|
|
13
13
|
import { resolveExecutionContext } from './governance/index.js';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `EAP_TOOL_GATEWAY_TRANSPORT=http` 时用 HttpToolExecutor(仅调试)。
|
|
6
6
|
* desktop 经 ToolExecutionRouter 分流 Local / Gateway。
|
|
7
7
|
*/
|
|
8
|
-
import type { ILocalToolInstallStore, LocalToolInstallRecord } from '@eap
|
|
8
|
+
import type { ILocalToolInstallStore, LocalToolInstallRecord } from '@gt-fe/eap-contracts';
|
|
9
9
|
import { type DeploymentContext } from './tool-execution-router.js';
|
|
10
10
|
import type { IToolExecutor } from './tool-executor.interface.js';
|
|
11
11
|
export declare class EmptyInstallStore implements ILocalToolInstallStore {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev 下按 type:http 清单直连出站(gateway.baseUrl + pathTemplate)。
|
|
3
|
-
* URL 拼接与 host 白名单与 Tool Gateway 共用 @eap
|
|
3
|
+
* URL 拼接与 host 白名单与 Tool Gateway 共用 @gt-fe/eap-contracts http-outbound。
|
|
4
4
|
*/
|
|
5
5
|
import type { IToolExecutor, ToolCallRequest, ToolCallResult } from './tool-executor.interface.js';
|
|
6
6
|
export interface DevHttpExecution {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dev 下按 type:http 清单直连出站(gateway.baseUrl + pathTemplate)。
|
|
3
|
-
* URL 拼接与 host 白名单与 Tool Gateway 共用 @eap
|
|
3
|
+
* URL 拼接与 host 白名单与 Tool Gateway 共用 @gt-fe/eap-contracts http-outbound。
|
|
4
4
|
*/
|
|
5
|
-
import { assertHttpHostAllowlisted, buildHttpToolUrl as buildSharedHttpToolUrl, ErrorCodes } from '@eap
|
|
5
|
+
import { assertHttpHostAllowlisted, buildHttpToolUrl as buildSharedHttpToolUrl, ErrorCodes } from '@gt-fe/eap-contracts';
|
|
6
6
|
import { abortOrTimeoutMessage, DEFAULT_HTTP_TOOL_TIMEOUT_SEC, isAbortError, resolveToolTimeoutSec, toToolTimeoutMs, } from './timeout.js';
|
|
7
7
|
export function resolveHttpExecutionFromRequest(request) {
|
|
8
8
|
const raw = request.execution;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @see docs/workflows/local-agent-dev-loop.md
|
|
18
18
|
* @see runtime/src/tool/local-mcp-client.ts
|
|
19
19
|
*/
|
|
20
|
-
import { ErrorCodes } from '@eap
|
|
20
|
+
import { ErrorCodes } from '@gt-fe/eap-contracts';
|
|
21
21
|
import { isAbortError } from './timeout.js';
|
|
22
22
|
import { LocalMcpClient } from './local-mcp-client.js';
|
|
23
23
|
export class DevMcpExecutor {
|
|
@@ -11,7 +11,7 @@ import { spawn } from 'node:child_process';
|
|
|
11
11
|
import { constants as fsConstants, realpathSync } from 'node:fs';
|
|
12
12
|
import { mkdir, open, readFile } from 'node:fs/promises';
|
|
13
13
|
import path from 'node:path';
|
|
14
|
-
import { BUILTIN_TOOL_SOURCE, DEFAULT_BUILTIN_TIMEOUT_MS, MAX_BUILTIN_TIMEOUT_MS, clampBuiltinTimeout, isBuiltinToolExecution, resolveBuiltinToolsConfig, } from '@eap
|
|
14
|
+
import { BUILTIN_TOOL_SOURCE, DEFAULT_BUILTIN_TIMEOUT_MS, MAX_BUILTIN_TIMEOUT_MS, clampBuiltinTimeout, isBuiltinToolExecution, resolveBuiltinToolsConfig, } from '@gt-fe/eap-contracts';
|
|
15
15
|
import { ensureInterpreterShims, formatSpawnError, killProcessTree, resolveShellSpawn, sandboxEnv, spawnOptionsFor, substituteSkillDir, } from './harness-command.js';
|
|
16
16
|
import { expandSkillScriptRefs, isSkillEntryFile } from './skill-script-refs.js';
|
|
17
17
|
function builtinConfig() {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @see docs/contracts/tool-execution.md §2
|
|
5
5
|
* @see docs/contracts/cross-service-api.md §4.6
|
|
6
6
|
*/
|
|
7
|
-
import { ErrorCodes } from '@eap
|
|
7
|
+
import { ErrorCodes } from '@gt-fe/eap-contracts';
|
|
8
8
|
import { abortOrTimeoutMessage, isAbortError } from './timeout.js';
|
|
9
9
|
function mapGatewayHttpError(status, body, statusText) {
|
|
10
10
|
const code = body?.error?.code;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* mcp-data-service 等上游要求 HTTP 头 `userId`(或 query),再注入 `params._meta.userId`。
|
|
5
5
|
* 身份优先来自 Runtime ExecutionContext(Token.sub);manifest headers.userId 作兜底。
|
|
6
6
|
*/
|
|
7
|
-
import type { McpRuntimeExecution } from '@eap
|
|
7
|
+
import type { McpRuntimeExecution } from '@gt-fe/eap-contracts';
|
|
8
8
|
import { type FileArtifact } from './file-artifact.js';
|
|
9
9
|
export interface LocalMcpInvokeContext {
|
|
10
10
|
/** Platform Token.sub / ExecutionContext.userId */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 优先 ILocalToolInstallStore;若无安装记录但 request.execution 带
|
|
5
5
|
* 或 request.execution 带可解析的 code bundlePath+handler,则直接本机执行。
|
|
6
6
|
*/
|
|
7
|
-
import type { ILocalToolInstallStore } from '@eap
|
|
7
|
+
import type { ILocalToolInstallStore } from '@gt-fe/eap-contracts';
|
|
8
8
|
import type { IToolExecutor, ToolCallRequest, ToolCallResult } from './tool-executor.interface.js';
|
|
9
9
|
import { type ILocalMcpClient } from './local-mcp-client.js';
|
|
10
10
|
export interface LocalToolExecutorOptions {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { spawn } from 'node:child_process';
|
|
8
8
|
import { existsSync } from 'node:fs';
|
|
9
9
|
import path from 'node:path';
|
|
10
|
-
import { ErrorCodes, resolveReadyInstallByToolName, resolveMcpExecutionFromInstall, resolveCodeHandlerFromInstall, } from '@eap
|
|
10
|
+
import { ErrorCodes, resolveReadyInstallByToolName, resolveMcpExecutionFromInstall, resolveCodeHandlerFromInstall, } from '@gt-fe/eap-contracts';
|
|
11
11
|
import { isAbortError, toToolTimeoutMs, toolTimeoutErrorMessage } from './timeout.js';
|
|
12
12
|
import { fileArtifactFromToolOutput, fileBasesFromEnv } from './file-artifact.js';
|
|
13
13
|
import { LocalMcpClient } from './local-mcp-client.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see docs/contracts/tool-execution.md §2.0
|
|
5
5
|
*/
|
|
6
|
-
import { ErrorCodes } from '@eap
|
|
6
|
+
import { ErrorCodes } from '@gt-fe/eap-contracts';
|
|
7
7
|
import { abortOrTimeoutMessage, isAbortError } from './timeout.js';
|
|
8
8
|
function resolveAgentCode(request) {
|
|
9
9
|
return request.authContext.agentCode;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @see docs/status/module-status-and-backlog.md RT-5
|
|
19
19
|
*/
|
|
20
|
-
import { isBuiltinToolExecution } from '@eap
|
|
20
|
+
import { isBuiltinToolExecution } from '@gt-fe/eap-contracts';
|
|
21
21
|
import { commandDialectLines } from './harness-command.js';
|
|
22
22
|
// ─────────────────────────────────────────────
|
|
23
23
|
// 平台规则常量(一年改不了两次,不值得搞配置表)
|
package/dist/tool/timeout.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool / toolset `timeout`:秒。
|
|
3
|
-
* 与 `@eap
|
|
4
|
-
* 尚未含这些导出。发版 contracts 后改为从 `@eap
|
|
3
|
+
* 与 `@gt-fe/eap-contracts` `src/tool/timeout.ts` 同语义;Runtime 钉的是 contracts 0.0.9,
|
|
4
|
+
* 尚未含这些导出。发版 contracts 后改为从 `@gt-fe/eap-contracts` 引用。
|
|
5
5
|
*/
|
|
6
6
|
export declare const DEFAULT_TOOL_TIMEOUT_SEC = 30;
|
|
7
7
|
export declare const DEFAULT_HTTP_TOOL_TIMEOUT_SEC = 10;
|
package/dist/tool/timeout.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tool / toolset `timeout`:秒。
|
|
3
|
-
* 与 `@eap
|
|
4
|
-
* 尚未含这些导出。发版 contracts 后改为从 `@eap
|
|
3
|
+
* 与 `@gt-fe/eap-contracts` `src/tool/timeout.ts` 同语义;Runtime 钉的是 contracts 0.0.9,
|
|
4
|
+
* 尚未含这些导出。发版 contracts 后改为从 `@gt-fe/eap-contracts` 引用。
|
|
5
5
|
*/
|
|
6
6
|
export const DEFAULT_TOOL_TIMEOUT_SEC = 30;
|
|
7
7
|
export const DEFAULT_HTTP_TOOL_TIMEOUT_SEC = 10;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @see design.md §1.8.7
|
|
6
6
|
*/
|
|
7
7
|
import type { IToolExecutor, ToolCallRequest } from './tool-executor.interface.js';
|
|
8
|
-
import type { ILocalToolInstallStore } from '@eap
|
|
8
|
+
import type { ILocalToolInstallStore } from '@gt-fe/eap-contracts';
|
|
9
9
|
export type DeploymentContext = 'server' | 'desktop' | 'dev';
|
|
10
10
|
export interface ToolExecutionRouterOptions {
|
|
11
11
|
httpExecutor: IToolExecutor;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @see docs/contracts/tool-execution.md §6
|
|
5
5
|
* @see design.md §1.8.7
|
|
6
6
|
*/
|
|
7
|
-
import { resolveReadyInstallByToolName } from '@eap
|
|
7
|
+
import { resolveReadyInstallByToolName } from '@gt-fe/eap-contracts';
|
|
8
8
|
import { isLocalPreferredExecution } from './local-tool-executor.js';
|
|
9
9
|
export class ToolExecutionRouter {
|
|
10
10
|
options;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @see design.md §1.1 Tool调用编排
|
|
5
5
|
* @see requirements.md Requirement 8 AC1, AC3
|
|
6
6
|
*/
|
|
7
|
-
import { type ExecutionContext } from '@eap
|
|
7
|
+
import { type ExecutionContext } from '@gt-fe/eap-contracts';
|
|
8
8
|
import type { IGovernanceClient } from '../governance/governance-client.js';
|
|
9
9
|
export type { AuthContext, ToolCallRequest, ToolCallResult, LLMToolCall, LLMToolCallResponse, IToolExecutor, } from './tool-executor.interface.js';
|
|
10
10
|
import type { AuthContext, ToolCallRequest, ToolCallResult, LLMToolCallResponse, IToolExecutor } from './tool-executor.interface.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @see design.md §1.1 Tool调用编排
|
|
5
5
|
* @see requirements.md Requirement 8 AC1, AC3
|
|
6
6
|
*/
|
|
7
|
-
import { isBuiltinToolExecution } from '@eap
|
|
7
|
+
import { isBuiltinToolExecution } from '@gt-fe/eap-contracts';
|
|
8
8
|
import { assertToolPermission, GovernanceUnavailableError, PermissionDeniedError, } from '../governance/permission-guard.js';
|
|
9
9
|
/**
|
|
10
10
|
* ToolOrchestrator — Tool 调用编排主服务
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime HTTP 错误出口 — 对齐 @eap
|
|
2
|
+
* Runtime HTTP 错误出口 — 对齐 @gt-fe/eap-contracts ErrorCodes / AppError
|
|
3
3
|
*/
|
|
4
|
-
import { type ErrorCode, type AppError } from '@eap
|
|
4
|
+
import { type ErrorCode, type AppError } from '@gt-fe/eap-contracts';
|
|
5
5
|
import type { ServerResponse } from 'node:http';
|
|
6
6
|
/** 公共 classify;连接失败不再误标为 GOVERNANCE_UNAVAILABLE */
|
|
7
7
|
export declare function classifyRuntimeError(error: unknown): AppError;
|
package/dist/utils/http-error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Runtime HTTP 错误出口 — 对齐 @eap
|
|
2
|
+
* Runtime HTTP 错误出口 — 对齐 @gt-fe/eap-contracts ErrorCodes / AppError
|
|
3
3
|
*/
|
|
4
|
-
import { classifyError, formatUnknownError, ErrorCodes, } from '@eap
|
|
4
|
+
import { classifyError, formatUnknownError, ErrorCodes, } from '@gt-fe/eap-contracts';
|
|
5
5
|
/** 公共 classify;连接失败不再误标为 GOVERNANCE_UNAVAILABLE */
|
|
6
6
|
export function classifyRuntimeError(error) {
|
|
7
7
|
return classifyError(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gt-fe/eap-runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Enterprise Agent Platform — Runtime核心:Graph执行引擎、Task生命周期、Session管理、Checkpoint持久化",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"ioredis": "^5.4.0",
|
|
41
41
|
"pg": "^8.13.0",
|
|
42
42
|
"yaml": "^2.6.1",
|
|
43
|
-
"@gt-fe/eap-contracts": "0.0.
|
|
43
|
+
"@gt-fe/eap-contracts": "0.0.10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.0.0",
|