@sepveneto/dnde-agent 0.1.16 → 0.2.0-beta.1
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 -0
- package/dist/{agent-JES391Lz.js → agent-BP3wmmgT.js} +1 -1
- package/dist/agents.d.ts +19 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/{index-gtAUVnBf.js → index-B_cPI3XS.js} +22677 -20328
- package/dist/index.d.ts +9 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -40
- package/dist/runtime.d.ts +31 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/tool.d.ts +30 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +3 -4
- package/dist/agent/capability.d.ts +0 -32
- package/dist/agent/capability.d.ts.map +0 -1
- package/dist/agent/capabilityAgent.d.ts +0 -6
- package/dist/agent/capabilityAgent.d.ts.map +0 -1
- package/dist/agent/capabilityRegistry.d.ts +0 -15
- package/dist/agent/capabilityRegistry.d.ts.map +0 -1
- package/dist/agent/context.d.ts +0 -17
- package/dist/agent/context.d.ts.map +0 -1
- package/dist/agent/core/sdk.d.ts +0 -35
- package/dist/agent/core/sdk.d.ts.map +0 -1
- package/dist/agent/editAgent.d.ts +0 -6
- package/dist/agent/editAgent.d.ts.map +0 -1
- package/dist/agent/extract.d.ts +0 -9
- package/dist/agent/extract.d.ts.map +0 -1
- package/dist/agent/flowAgent.d.ts +0 -22
- package/dist/agent/flowAgent.d.ts.map +0 -1
- package/dist/agent/ir.d.ts +0 -92
- package/dist/agent/ir.d.ts.map +0 -1
- package/dist/agent/layout.d.ts +0 -14
- package/dist/agent/layout.d.ts.map +0 -1
- package/dist/agent/runtime.d.ts +0 -73
- package/dist/agent/runtime.d.ts.map +0 -1
- package/dist/agent/type.d.ts +0 -45
- package/dist/agent/type.d.ts.map +0 -1
- package/dist/agent/utils/helper.d.ts +0 -7
- package/dist/agent/utils/helper.d.ts.map +0 -1
- package/dist/agent/workflow.d.ts +0 -94
- package/dist/agent/workflow.d.ts.map +0 -1
- package/dist/composables/index.d.ts +0 -2
- package/dist/composables/index.d.ts.map +0 -1
- package/dist/composables/useFile.d.ts +0 -14
- package/dist/composables/useFile.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import type { VueElementConstructor } from 'vue';
|
|
2
2
|
export declare const MpdAgent: import("vue").DefineComponent<Record<string, unknown>, Record<string, unknown>, any>;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `vue` 随库本体一起打进 dist,这里集中导出创建逻辑,`/element` 入口只需 `import` 本函数,
|
|
7
|
-
* 就不会各自打包一份 `vue`,从而保证组件定义与 `defineCustomElement` 用的是同一个实例。
|
|
4
|
+
* Build the `<dnd-agent>` custom element from the same Vue runtime that is
|
|
5
|
+
* bundled into this package.
|
|
8
6
|
*/
|
|
9
7
|
export declare function createAgentElement(): VueElementConstructor;
|
|
10
|
-
export type {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export {
|
|
16
|
-
export type {
|
|
17
|
-
export { createEditAgent } from './agent/editAgent';
|
|
18
|
-
export type { StructuredExtractOptions } from './agent/extract';
|
|
19
|
-
export { parseJson, structuredExtract } from './agent/extract';
|
|
20
|
-
export type { FlowClassification, FlowType } from './agent/flowAgent';
|
|
21
|
-
export { createFlowAgent, flowOutputSchema } from './agent/flowAgent';
|
|
22
|
-
export type { AddComponentIR, DeleteComponentIR, EditIR, LayoutIR, LayoutWidgetItem, MoveComponentIR, NormalizedElement, NormalizedElementItem, NormalizedElements, UpdateComponentIR, } from './agent/ir';
|
|
23
|
-
export { editIrSchema, layoutIrSchema } from './agent/ir';
|
|
24
|
-
export type { LayoutWidgetDescriptor } from './agent/layout';
|
|
25
|
-
export { createLayoutAgent, generateLayoutIR } from './agent/layout';
|
|
26
|
-
export type { AgentRuntimeEvent, AgentRuntimeHooks, AgentRuntimeOptions, AgentRuntimeResult, } from './agent/runtime';
|
|
27
|
-
export { AgentRuntime, createAgentRuntime } from './agent/runtime';
|
|
28
|
-
export * from './agent/utils/helper';
|
|
29
|
-
export type { StepResult, Workflow, WorkflowContext, WorkflowDefinition, WorkflowEvent, WorkflowRunOptions, WorkflowRunResult, WorkflowStatus, WorkflowStep, } from './agent/workflow';
|
|
30
|
-
export { defineWorkflow, WorkflowRuntime } from './agent/workflow';
|
|
8
|
+
export type { CreateAgentsOptions } from './agents';
|
|
9
|
+
export { createAgents, DEFAULT_AGENT_BFF_URL, DEFAULT_AGENT_MODEL, } from './agents';
|
|
10
|
+
export type { AgentRuntime, AgentRuntimeConfig, AgentRuntimeOptions, AgentRuntimeTurn, } from './runtime';
|
|
11
|
+
export { createAgentRuntime } from './runtime';
|
|
12
|
+
export type { AgentToolApprovalOptions, AgentToolContext, AgentToolDefinition, } from './tool';
|
|
13
|
+
export { defineAgentTool, defineCapability, } from './tool';
|
|
14
|
+
export type { AgentApiMode, AgentEditorApi, AgentEditorOperation, AgentHostApi, AgentModelConfig, ChatMessage, ChatMode, DataPart, MessagePart, MessageRole, ReasoningPart, TextPart, ToolPart, } from './types';
|
|
31
15
|
export { Agent, MemorySession, run, Runner, tool, } from '@openai/agents';
|
|
32
|
-
export type { FunctionTool, RunContext, RunResult, Session, Tool, } from '@openai/agents';
|
|
33
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,KAAK,CAAA;AAIhD,eAAO,MAAM,QAAQ,sFAAU,CAAA;AAE/B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,KAAK,CAAA;AAIhD,eAAO,MAAM,QAAQ,sFAAU,CAAA;AAE/B;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,qBAAqB,CAE1D;AAED,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,YAAY,EACV,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,QAAQ,CAAA;AAEf,OAAO,EACL,eAAe,EACf,gBAAgB,GACjB,MAAM,QAAQ,CAAA;AACf,YAAY,EACV,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,KAAK,EACL,aAAa,EACb,GAAG,EACH,MAAM,EACN,IAAI,GACL,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,16 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as s, D as t, k as n, u as A, g as o, R as r, h as g, l as i, j as E, m as l, q as m, v as T, t as _ } from "./index-B_cPI3XS.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
y as createEditAgent,
|
|
17
|
-
A as createFlowAgent,
|
|
18
|
-
C as createLayoutAgent,
|
|
19
|
-
b as defineCapability,
|
|
20
|
-
R as defineWorkflow,
|
|
21
|
-
f as editIrSchema,
|
|
22
|
-
M as flowOutputSchema,
|
|
23
|
-
S as generateLayoutIR,
|
|
24
|
-
k as getModel,
|
|
25
|
-
h as getModelConfig,
|
|
26
|
-
v as getModelName,
|
|
27
|
-
w as getRegisteredCapabilities,
|
|
28
|
-
E as getRegisteredCapabilityTools,
|
|
29
|
-
I as invokeCapability,
|
|
30
|
-
L as layoutIrSchema,
|
|
31
|
-
x as listCapabilities,
|
|
32
|
-
T as parseJson,
|
|
33
|
-
W as registerCapability,
|
|
34
|
-
F as resolveServiceURL,
|
|
35
|
-
J as run,
|
|
36
|
-
N as runAgent,
|
|
37
|
-
O as runAgentStreamed,
|
|
38
|
-
j as setMockClient,
|
|
39
|
-
q as structuredExtract,
|
|
40
|
-
z as tool,
|
|
41
|
-
B as unregisterCapability
|
|
3
|
+
s as Agent,
|
|
4
|
+
t as DEFAULT_AGENT_BFF_URL,
|
|
5
|
+
n as DEFAULT_AGENT_MODEL,
|
|
6
|
+
A as MemorySession,
|
|
7
|
+
o as MpdAgent,
|
|
8
|
+
r as Runner,
|
|
9
|
+
g as createAgentElement,
|
|
10
|
+
i as createAgentRuntime,
|
|
11
|
+
E as createAgents,
|
|
12
|
+
l as defineAgentTool,
|
|
13
|
+
m as defineCapability,
|
|
14
|
+
T as run,
|
|
15
|
+
_ as tool
|
|
42
16
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AgentToolDefinition } from './tool';
|
|
2
|
+
import type { AgentHostApi, ChatMessage, ChatMode } from './types';
|
|
3
|
+
export interface AgentRuntimeConfig {
|
|
4
|
+
baseURL: string;
|
|
5
|
+
model: string;
|
|
6
|
+
apiMode: 'responses' | 'chat_completions';
|
|
7
|
+
}
|
|
8
|
+
export interface AgentRuntimeOptions extends Partial<AgentRuntimeConfig> {
|
|
9
|
+
api?: AgentHostApi;
|
|
10
|
+
tools?: AgentToolDefinition[];
|
|
11
|
+
getContext?: () => Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AgentRuntimeTurn {
|
|
14
|
+
runtimeSessionId: string;
|
|
15
|
+
prompt: string;
|
|
16
|
+
mode: ChatMode;
|
|
17
|
+
message: ChatMessage;
|
|
18
|
+
history: ChatMessage[];
|
|
19
|
+
signal: AbortSignal;
|
|
20
|
+
onUpdate: () => void;
|
|
21
|
+
}
|
|
22
|
+
export interface AgentRuntime {
|
|
23
|
+
readonly config: Readonly<AgentRuntimeConfig>;
|
|
24
|
+
runTurn: (turn: AgentRuntimeTurn) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* llm-agent runtime. The Agents SDK owns the agent loop, tool calls and session
|
|
28
|
+
* history; this module only maps its stream events to the chat UI parts.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createAgentRuntime(options?: AgentRuntimeOptions): AgentRuntime;
|
|
31
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAyB,MAAM,SAAS,CAAA;AAgBzF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,WAAW,GAAG,kBAAkB,CAAA;CAC1C;AAED,MAAM,WAAW,mBAAoB,SAAQ,OAAO,CAAC,kBAAkB,CAAC;IACtE,GAAG,CAAC,EAAE,YAAY,CAAA;IAClB,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,MAAM,EAAE,WAAW,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAA;IAC7C,OAAO,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD;AA0LD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,mBAAwB,GAChC,YAAY,CA6Jd"}
|
package/dist/tool.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { AgentHostApi } from './types';
|
|
3
|
+
export interface AgentToolContext {
|
|
4
|
+
api: AgentHostApi;
|
|
5
|
+
getContext: () => Record<string, unknown>;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentToolApprovalOptions {
|
|
9
|
+
message?: (input: any) => string;
|
|
10
|
+
}
|
|
11
|
+
export interface AgentToolDefinition<TInput = unknown, TOutput = unknown> {
|
|
12
|
+
/** Discriminator that keeps plain tool definitions distinct from SDK objects. */
|
|
13
|
+
kind?: 'agent-tool';
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
parameters?: z.ZodType;
|
|
17
|
+
/** Alias kept for existing capability definitions. */
|
|
18
|
+
inputSchema?: z.ZodType;
|
|
19
|
+
needsApproval?: boolean | ((input: TInput) => boolean | Promise<boolean>);
|
|
20
|
+
approval?: AgentToolApprovalOptions;
|
|
21
|
+
execute: (input: TInput, context: AgentToolContext) => TOutput | Promise<TOutput>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Define a business tool consumed by the agent. Tools stay owned by the host:
|
|
25
|
+
* the element only adapts them to the Agents SDK at runtime.
|
|
26
|
+
*/
|
|
27
|
+
export declare function defineAgentTool<TInput = unknown, TOutput = unknown>(definition: AgentToolDefinition<TInput, TOutput>): AgentToolDefinition<TInput, TOutput>;
|
|
28
|
+
/** Backwards-compatible name for hosts that already use the capability API. */
|
|
29
|
+
export declare const defineCapability: typeof defineAgentTool;
|
|
30
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,YAAY,CAAA;IACjB,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAA;CACjC;AAED,MAAM,WAAW,mBAAmB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACtE,iFAAiF;IACjF,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;IACtB,sDAAsD;IACtD,WAAW,CAAC,EAAE,CAAC,CAAC,OAAO,CAAA;IACvB,aAAa,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IACzE,QAAQ,CAAC,EAAE,wBAAwB,CAAA;IACnC,OAAO,EAAE,CACP,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,gBAAgB,KACtB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACjE,UAAU,EAAE,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/C,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAEtC;AAED,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,wBAAkB,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type ChatMode = 'data' | 'text';
|
|
2
|
+
export type MessageRole = 'system' | 'user' | 'assistant';
|
|
3
|
+
export type AgentApiMode = 'responses' | 'chat_completions';
|
|
4
|
+
export interface AgentModelConfig {
|
|
5
|
+
/** OpenAI-compatible endpoint exposed by the host or its BFF. */
|
|
6
|
+
baseURL?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
apiMode?: AgentApiMode;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentEditorOperation {
|
|
11
|
+
action: 'add' | 'edit' | 'delete' | 'move';
|
|
12
|
+
/** Existing node UUID. For `add`, this is the optional parent UUID. */
|
|
13
|
+
target?: string;
|
|
14
|
+
/** Widget type id used by `add`. */
|
|
15
|
+
widget?: string;
|
|
16
|
+
items?: unknown[];
|
|
17
|
+
changes?: Record<string, unknown>;
|
|
18
|
+
style?: Record<string, unknown>;
|
|
19
|
+
before?: string;
|
|
20
|
+
after?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* APIs implemented by the host. The agent runtime only knows this contract, so
|
|
24
|
+
* the editor document and business data never become part of the agent package.
|
|
25
|
+
*/
|
|
26
|
+
export interface AgentEditorApi {
|
|
27
|
+
getCurrentEditor: () => unknown | Promise<unknown>;
|
|
28
|
+
getWidgets: () => unknown | Promise<unknown>;
|
|
29
|
+
operateEditor: (operation: AgentEditorOperation) => unknown | Promise<unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentHostApi {
|
|
32
|
+
model?: AgentModelConfig;
|
|
33
|
+
editor?: Partial<AgentEditorApi>;
|
|
34
|
+
}
|
|
35
|
+
export interface TextPart {
|
|
36
|
+
type: 'text';
|
|
37
|
+
text: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ReasoningPart {
|
|
40
|
+
type: 'reasoning';
|
|
41
|
+
text: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ToolPart {
|
|
44
|
+
type: 'tool';
|
|
45
|
+
toolCallId: string;
|
|
46
|
+
toolName: string;
|
|
47
|
+
state: 'input-available' | 'output-available';
|
|
48
|
+
input?: unknown;
|
|
49
|
+
output?: unknown;
|
|
50
|
+
errorText?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface DataPart {
|
|
53
|
+
type: 'data';
|
|
54
|
+
name: string;
|
|
55
|
+
data?: unknown;
|
|
56
|
+
}
|
|
57
|
+
export type MessagePart = TextPart | ReasoningPart | ToolPart | DataPart;
|
|
58
|
+
export interface ChatMessage {
|
|
59
|
+
id: string;
|
|
60
|
+
role: MessageRole;
|
|
61
|
+
parts: MessagePart[];
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AACtC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,K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AG,kBAAkB,CAAA;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAExE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sepveneto/dnde-agent",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.0-beta.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "ISC",
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@openai/agents": "^0.19.0",
|
|
34
|
-
"@sepveneto/dnde-core": " *",
|
|
35
|
-
"@types/debug": "^4.1.13",
|
|
36
34
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
37
|
-
"
|
|
35
|
+
"dompurify": "^3.4.17",
|
|
36
|
+
"marked": "^18.1.2",
|
|
38
37
|
"openai": "^7.25.0",
|
|
39
38
|
"typescript": "^6.0.3",
|
|
40
39
|
"vite": "^6.3.5",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { FunctionTool } from '@openai/agents';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import type { ToolApprovalHandler } from './context';
|
|
4
|
-
export type CapabilitySchema = z.ZodType;
|
|
5
|
-
export interface CapabilityContext {
|
|
6
|
-
onApproval?: ToolApprovalHandler;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
state?: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
-
export interface ToolApprovalOptions {
|
|
11
|
-
message?: (input: any) => string;
|
|
12
|
-
onApprove?: (input: any) => void;
|
|
13
|
-
onReject?: (input: any) => void;
|
|
14
|
-
}
|
|
15
|
-
export interface CapabilityDefinition<TInput = unknown, TOutput = unknown> {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
inputSchema?: CapabilitySchema;
|
|
19
|
-
outputSchema?: CapabilitySchema;
|
|
20
|
-
needsApproval?: boolean | ((input: TInput) => boolean | Promise<boolean>);
|
|
21
|
-
approval?: ToolApprovalOptions;
|
|
22
|
-
execute(input: TInput, context: CapabilityContext): Promise<TOutput> | TOutput;
|
|
23
|
-
}
|
|
24
|
-
export interface Capability<TInput = unknown, TOutput = unknown> extends CapabilityDefinition<TInput, TOutput> {
|
|
25
|
-
kind: 'capability';
|
|
26
|
-
}
|
|
27
|
-
export declare function defineCapability<TInput, TOutput>(definition: CapabilityDefinition<TInput, TOutput>): Capability<TInput, TOutput>;
|
|
28
|
-
/** Capability -> OpenAI Agents SDK FunctionTool(V2 的 Capability Adapter)。 */
|
|
29
|
-
export declare function createCapabilityTool(capability: Capability<any, any>): FunctionTool<any, any, any>;
|
|
30
|
-
/** 工作流 Step 里直接调用能力时使用,统一处理审批。 */
|
|
31
|
-
export declare function invokeCapability<TInput = unknown, TOutput = unknown>(capability: Capability<TInput, TOutput>, input: TInput, context?: CapabilityContext): Promise<TOutput>;
|
|
32
|
-
//# sourceMappingURL=capability.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/agent/capability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM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AC9C,UAAU,EAAE,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,GAChD,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAE7B;AASD,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAgClG;AAID,kCAAkC;AAClC,wBAAsB,gBAAgB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACxE,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAMlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilityAgent.d.ts","sourceRoot":"","sources":["../../src/agent/capabilityAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAc9C,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAAE,YAAY,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAQxG"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { FunctionTool } from '@openai/agents';
|
|
2
|
-
import type { Capability } from './capability';
|
|
3
|
-
/** 注册业务能力,并返回对应的 Agent Tool(同名覆盖)。 */
|
|
4
|
-
export declare function registerCapability(capability: Capability): FunctionTool;
|
|
5
|
-
/** 取消注册;返回是否真的移除了一个能力。 */
|
|
6
|
-
export declare function unregisterCapability(name: string): boolean;
|
|
7
|
-
/** 当前注册的能力名列表。 */
|
|
8
|
-
export declare function listCapabilities(): string[];
|
|
9
|
-
/** 取出已注册能力;传 `names` 时按给定顺序返回其中存在的能力。 */
|
|
10
|
-
export declare function getRegisteredCapabilities(names?: string[]): Capability[];
|
|
11
|
-
/** 把已注册能力统一包装成 Agent Tool。 */
|
|
12
|
-
export declare function getRegisteredCapabilityTools(names?: string[]): FunctionTool[];
|
|
13
|
-
/** 清空注册表(测试或热更新时用)。 */
|
|
14
|
-
export declare function clearCapabilities(): void;
|
|
15
|
-
//# sourceMappingURL=capabilityRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilityRegistry.d.ts","sourceRoot":"","sources":["../../src/agent/capabilityRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAW9C,sCAAsC;AACtC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,0BAA0B;AAC1B,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,kBAAkB;AAClB,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED,yCAAyC;AACzC,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,CASxE;AAED,8BAA8B;AAC9B,wBAAgB,4BAA4B,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAE7E;AAED,uBAAuB;AACvB,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
package/dist/agent/context.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface ToolApprovalRequest {
|
|
2
|
-
callId: string;
|
|
3
|
-
name: string;
|
|
4
|
-
args: unknown;
|
|
5
|
-
message: string;
|
|
6
|
-
}
|
|
7
|
-
export type ToolApprovalHandler = (request: ToolApprovalRequest) => boolean | Promise<boolean>;
|
|
8
|
-
/** 平台注入给 Agent / Tool 的运行时上下文。 */
|
|
9
|
-
export interface AppContext {
|
|
10
|
-
/** 运行时共享状态(组件列表、编辑器状态等)。 */
|
|
11
|
-
state: Record<string, unknown>;
|
|
12
|
-
/** 业务侧自己的数据。 */
|
|
13
|
-
business?: unknown;
|
|
14
|
-
onApproval?: ToolApprovalHandler;
|
|
15
|
-
signal?: AbortSignal;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/agent/context.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,OAAO,EAAE,mBAAmB,KACzB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE/B,kCAAkC;AAClC,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB"}
|
package/dist/agent/core/sdk.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Agent, AgentInputItem, Model, RunResult, RunStreamEvent, Session, StreamedRunResult } from '@openai/agents';
|
|
2
|
-
import OpenAI from 'openai';
|
|
3
|
-
export interface ModelConfig {
|
|
4
|
-
baseURL?: string;
|
|
5
|
-
apiKey?: string;
|
|
6
|
-
model?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function configureModel(next: ModelConfig): void;
|
|
9
|
-
export declare function getModelConfig(): Required<ModelConfig>;
|
|
10
|
-
/**
|
|
11
|
-
* 模型 API 与文件服务共用同一个部署地址。`baseURL` 通常以 `/v1` 结尾,
|
|
12
|
-
* 文件接口位于其兄弟路径,因此解析时去掉末尾的版本段并保留自定义部署前缀。
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveServiceURL(path: string): string;
|
|
15
|
-
export declare function getModelName(): string;
|
|
16
|
-
/** 测试用:注入 mock 的 OpenAI client。 */
|
|
17
|
-
export declare function setMockClient(mock: OpenAI): void;
|
|
18
|
-
/**
|
|
19
|
-
* 返回一个 Agents SDK 的 Model 适配器。
|
|
20
|
-
*
|
|
21
|
-
* 模型接口调用保持原来的方式:直接走 `openai` 的 `chat.completions`(服务器代理 baseURL);
|
|
22
|
-
* Agent Loop / Tool Calling / Session / Context 等其它能力全部由 OpenAI Agents SDK 提供。
|
|
23
|
-
*/
|
|
24
|
-
export declare function getModel(): Model;
|
|
25
|
-
export interface RunAgentOptions<TContext = unknown> {
|
|
26
|
-
context?: TContext;
|
|
27
|
-
session?: Session;
|
|
28
|
-
maxTurns?: number | null;
|
|
29
|
-
}
|
|
30
|
-
/** 非流式执行(SDK 内部负责 Agent Loop / Tool Calling / Session)。 */
|
|
31
|
-
export declare function runAgent<TContext, TAgent extends Agent<any, any>>(agent: TAgent, input: string, options?: RunAgentOptions<TContext>): Promise<RunResult<TContext, TAgent>>;
|
|
32
|
-
/** 流式执行,并逐个抛出 SDK 的流式事件。 */
|
|
33
|
-
export declare function runAgentStreamed<TContext, TAgent extends Agent<any, any>>(agent: TAgent, input: string | AgentInputItem[], options?: RunAgentOptions<TContext>): Promise<StreamedRunResult<TContext, TAgent>>;
|
|
34
|
-
export type { RunStreamEvent };
|
|
35
|
-
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/agent/core/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,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,EAAE,MAAM,GAAG,cAAc,EAAE,EAChC,OAAO,GAAE,eAAe,CAAC,QAAQ,CAAM,GACtC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAO9C;AAED,YAAY,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editAgent.d.ts","sourceRoot":"","sources":["../../src/agent/editAgent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AA2BtC,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,YAAY,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAQlG"}
|
package/dist/agent/extract.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export interface StructuredExtractOptions {
|
|
3
|
-
instructions: string;
|
|
4
|
-
schema: z.ZodType;
|
|
5
|
-
input: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function structuredExtract(options: StructuredExtractOptions): Promise<unknown>;
|
|
8
|
-
export declare function parseJson(text: string): unknown;
|
|
9
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/agent/extract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAS3F;AAsDD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAoB/C"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Agent } from '@openai/agents';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import type { Capability } from './capability';
|
|
4
|
-
import type { Workflow } from './workflow';
|
|
5
|
-
export type FlowType = 'initialize' | 'edit' | 'capability';
|
|
6
|
-
export interface FlowClassification {
|
|
7
|
-
flow: FlowType;
|
|
8
|
-
input?: string;
|
|
9
|
-
note?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const flowOutputSchema: z.ZodObject<{
|
|
12
|
-
flow: z.ZodEnum<{
|
|
13
|
-
capability: "capability";
|
|
14
|
-
edit: "edit";
|
|
15
|
-
initialize: "initialize";
|
|
16
|
-
}>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export declare function createFlowAgent(options: {
|
|
19
|
-
workflows: Workflow[];
|
|
20
|
-
capabilities: Capability<any, any>[];
|
|
21
|
-
}): Agent<any, any>;
|
|
22
|
-
//# sourceMappingURL=flowAgent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flowAgent.d.ts","sourceRoot":"","sources":["../../src/agent/flowAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,GAAG,YAAY,CAAA;AAE3D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,gBAAgB;;;;;;iBAE3B,CAAA;AAgBF,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,SAAS,EAAE,QAAQ,EAAE,CAAA;IACrB,YAAY,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;CACrC,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAsBlB"}
|
package/dist/agent/ir.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { Node, Widget } from '@sepveneto/dnde-core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export interface AddComponentIR {
|
|
4
|
-
type: 'add-component';
|
|
5
|
-
widget: string;
|
|
6
|
-
items: Array<Record<string, any>>;
|
|
7
|
-
}
|
|
8
|
-
export interface DeleteComponentIR {
|
|
9
|
-
type: 'delete-component';
|
|
10
|
-
target: string;
|
|
11
|
-
}
|
|
12
|
-
export interface UpdateComponentIR {
|
|
13
|
-
type: 'update-component';
|
|
14
|
-
target: string;
|
|
15
|
-
changes: Record<string, any>;
|
|
16
|
-
}
|
|
17
|
-
export interface MoveComponentIR {
|
|
18
|
-
type: 'move-component';
|
|
19
|
-
target: string;
|
|
20
|
-
before?: string;
|
|
21
|
-
after?: string;
|
|
22
|
-
}
|
|
23
|
-
export type EditIR = AddComponentIR | DeleteComponentIR | UpdateComponentIR | MoveComponentIR;
|
|
24
|
-
export interface LayoutWidgetItem {
|
|
25
|
-
widget: string;
|
|
26
|
-
items: Array<{
|
|
27
|
-
category: string;
|
|
28
|
-
id: any;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
|
-
export type LayoutIR = LayoutWidgetItem[];
|
|
32
|
-
/** 标准化后的布局元素:业务数据统一成 { kind, items: [{ name, id }] }。 */
|
|
33
|
-
export interface NormalizedElementItem {
|
|
34
|
-
name: string;
|
|
35
|
-
id: number;
|
|
36
|
-
}
|
|
37
|
-
export interface NormalizedElement {
|
|
38
|
-
kind: string;
|
|
39
|
-
items: NormalizedElementItem[];
|
|
40
|
-
}
|
|
41
|
-
export type NormalizedElements = NormalizedElement[];
|
|
42
|
-
export declare const layoutIrSchema: z.ZodObject<{
|
|
43
|
-
layout: z.ZodArray<z.ZodObject<{
|
|
44
|
-
widget: z.ZodString;
|
|
45
|
-
items: z.ZodArray<z.ZodObject<{
|
|
46
|
-
category: z.ZodString;
|
|
47
|
-
id: z.ZodAny;
|
|
48
|
-
}, z.core.$strip>>;
|
|
49
|
-
}, z.core.$strip>>;
|
|
50
|
-
}, z.core.$strip>;
|
|
51
|
-
export declare const editIrSchema: z.ZodObject<{
|
|
52
|
-
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
-
type: z.ZodLiteral<"add-component">;
|
|
54
|
-
widget: z.ZodString;
|
|
55
|
-
items: z.ZodArray<z.ZodAny>;
|
|
56
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
-
type: z.ZodLiteral<"delete-component">;
|
|
58
|
-
target: z.ZodString;
|
|
59
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
-
type: z.ZodLiteral<"update-component">;
|
|
61
|
-
target: z.ZodString;
|
|
62
|
-
changes: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
63
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
-
type: z.ZodLiteral<"move-component">;
|
|
65
|
-
target: z.ZodString;
|
|
66
|
-
before: z.ZodOptional<z.ZodString>;
|
|
67
|
-
after: z.ZodOptional<z.ZodString>;
|
|
68
|
-
}, z.core.$strip>], "type">>;
|
|
69
|
-
}, z.core.$strip>;
|
|
70
|
-
export interface LayoutContextNode {
|
|
71
|
-
uuid: string;
|
|
72
|
-
name: string;
|
|
73
|
-
type: string;
|
|
74
|
-
desc?: string;
|
|
75
|
-
parent?: string;
|
|
76
|
-
children?: string[];
|
|
77
|
-
summary?: string;
|
|
78
|
-
keyData?: Record<string, string | number | boolean | null>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* 把页面组件树投影成扁平的状态 IR。
|
|
82
|
-
*
|
|
83
|
-
* 输出按先序遍历排列,节点之间通过 uuid 建立 parent / children 引用,
|
|
84
|
-
* 避免把整棵树重复嵌套进模型上下文。`widgets` 用于在节点缺少
|
|
85
|
-
* Widget 实例时,按组件类型回退解析展示名称。
|
|
86
|
-
*/
|
|
87
|
-
export declare function genStateIr(node: Node): LayoutContextNode[];
|
|
88
|
-
export declare function genWidgetIr(widgets: Widget[]): {
|
|
89
|
-
type: string;
|
|
90
|
-
attribues: import("@sepveneto/dnde-core").SchemaItem[];
|
|
91
|
-
}[];
|
|
92
|
-
//# sourceMappingURL=ir.d.ts.map
|
package/dist/agent/ir.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../src/agent/ir.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,eAAe,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,C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
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { LayoutIR, NormalizedElements } from './ir';
|
|
2
|
-
import { Agent } from '@openai/agents';
|
|
3
|
-
export interface LayoutWidgetDescriptor {
|
|
4
|
-
typeId: string;
|
|
5
|
-
description: string;
|
|
6
|
-
layout?: Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
export declare function createLayoutAgent(): Agent<any, any>;
|
|
9
|
-
export interface GenerateLayoutIROptions {
|
|
10
|
-
elements: NormalizedElements;
|
|
11
|
-
widgets: LayoutWidgetDescriptor[];
|
|
12
|
-
}
|
|
13
|
-
export declare function generateLayoutIR(options: GenerateLayoutIROptions): Promise<LayoutIR>;
|
|
14
|
-
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/agent/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAItC,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC7B;AAmBD,wBAAgB,iBAAiB,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAOnD;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,OAAO,EAAE,sBAAsB,EAAE,CAAA;CAClC;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAO1F"}
|