@sepveneto/dnde-agent 0.1.16 → 0.2.0-beta.10

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.
Files changed (54) hide show
  1. package/README.md +161 -0
  2. package/dist/{agent-JES391Lz.js → agent-I4tbZfvO.js} +1 -1
  3. package/dist/agentInstructions.d.ts +2 -0
  4. package/dist/agentInstructions.d.ts.map +1 -0
  5. package/dist/agents.d.ts +20 -0
  6. package/dist/agents.d.ts.map +1 -0
  7. package/dist/composables/useFile.d.ts +7 -9
  8. package/dist/composables/useFile.d.ts.map +1 -1
  9. package/dist/editorContext.d.ts +26 -0
  10. package/dist/editorContext.d.ts.map +1 -0
  11. package/dist/element.js +66242 -12
  12. package/dist/{index-gtAUVnBf.js → index-hugwYSU_.js} +23666 -20266
  13. package/dist/index.d.ts +13 -26
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +18 -39
  16. package/dist/runtime.d.ts +32 -0
  17. package/dist/runtime.d.ts.map +1 -0
  18. package/dist/services.d.ts +46 -0
  19. package/dist/services.d.ts.map +1 -0
  20. package/dist/tool.d.ts +32 -0
  21. package/dist/tool.d.ts.map +1 -0
  22. package/dist/toolExecution.d.ts +10 -0
  23. package/dist/toolExecution.d.ts.map +1 -0
  24. package/dist/types.d.ts +94 -0
  25. package/dist/types.d.ts.map +1 -0
  26. package/package.json +4 -5
  27. package/dist/agent/capability.d.ts +0 -32
  28. package/dist/agent/capability.d.ts.map +0 -1
  29. package/dist/agent/capabilityAgent.d.ts +0 -6
  30. package/dist/agent/capabilityAgent.d.ts.map +0 -1
  31. package/dist/agent/capabilityRegistry.d.ts +0 -15
  32. package/dist/agent/capabilityRegistry.d.ts.map +0 -1
  33. package/dist/agent/context.d.ts +0 -17
  34. package/dist/agent/context.d.ts.map +0 -1
  35. package/dist/agent/core/sdk.d.ts +0 -35
  36. package/dist/agent/core/sdk.d.ts.map +0 -1
  37. package/dist/agent/editAgent.d.ts +0 -6
  38. package/dist/agent/editAgent.d.ts.map +0 -1
  39. package/dist/agent/extract.d.ts +0 -9
  40. package/dist/agent/extract.d.ts.map +0 -1
  41. package/dist/agent/flowAgent.d.ts +0 -22
  42. package/dist/agent/flowAgent.d.ts.map +0 -1
  43. package/dist/agent/ir.d.ts +0 -92
  44. package/dist/agent/ir.d.ts.map +0 -1
  45. package/dist/agent/layout.d.ts +0 -14
  46. package/dist/agent/layout.d.ts.map +0 -1
  47. package/dist/agent/runtime.d.ts +0 -73
  48. package/dist/agent/runtime.d.ts.map +0 -1
  49. package/dist/agent/type.d.ts +0 -45
  50. package/dist/agent/type.d.ts.map +0 -1
  51. package/dist/agent/utils/helper.d.ts +0 -7
  52. package/dist/agent/utils/helper.d.ts.map +0 -1
  53. package/dist/agent/workflow.d.ts +0 -94
  54. package/dist/agent/workflow.d.ts.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,33 +1,20 @@
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
- * 基于库内同一份 `vue` 实例创建 `<dnd-agent>` 的自定义元素类。
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 { Capability, CapabilityContext, CapabilityDefinition, CapabilitySchema, ToolApprovalOptions, } from './agent/capability';
11
- export { createCapabilityTool, defineCapability, invokeCapability, } from './agent/capability';
12
- export { createCapabilityAgent } from './agent/capabilityAgent';
13
- export { clearCapabilities, getRegisteredCapabilities, getRegisteredCapabilityTools, listCapabilities, registerCapability, unregisterCapability, } from './agent/capabilityRegistry';
14
- export type { AppContext, ToolApprovalHandler, ToolApprovalRequest, } from './agent/context';
15
- export { configureModel, getModel, getModelConfig, getModelName, resolveServiceURL, runAgent, runAgentStreamed, setMockClient, } from './agent/core/sdk';
16
- export type { ModelConfig, RunAgentOptions } from './agent/core/sdk';
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 { PreparedEditorOperation, } from './editorContext';
11
+ export { completeEditorOperation, createEditorAgentContext, editorOperationSucceeded, prepareEditorOperation, } from './editorContext';
12
+ export type { AgentRuntime, AgentRuntimeConfig, AgentRuntimeOptions, AgentRuntimeTurn, } from './runtime';
13
+ export { createAgentRuntime } from './runtime';
14
+ export type { AgentUploadedFile } from './services';
15
+ export { resolveAgentServiceURL } from './services';
16
+ export type { AgentToolApprovalOptions, AgentToolContext, AgentToolDefinition, } from './tool';
17
+ export { defineAgentTool, defineCapability, } from './tool';
18
+ export type { AgentApiMode, AgentEditorApi, AgentEditorOperation, AgentFileKind, AgentHostApi, AgentModelConfig, ChatMessage, ChatMode, DataPart, EditorAgentContext, FilePart, MessagePart, MessageRole, ReasoningPart, TextPart, ToolPart, } from './types';
31
19
  export { Agent, MemorySession, run, Runner, tool, } from '@openai/agents';
32
- export type { FunctionTool, RunContext, RunResult, Session, Tool, } from '@openai/agents';
33
20
  //# sourceMappingURL=index.d.ts.map
@@ -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;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,qBAAqB,CAE1D;AAGD,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AAGnC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,cAAc,EACd,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,EAChB,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGnD,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],"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,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,iBAAiB,CAAA;AAExB,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAEnD,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,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,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,21 @@
1
- import { c as t, W as s, _ as i, g as r, a0 as n, Z as o, q as l, B as g, a1 as c, h as u, X as p, m as d, j as m, K as y, O as A, T as C, k as b, Y as R, Q as f, P as M, V as S, D as k, E as h, F as v, u as w, v as E, l as I, R as L, x, L as T, y as W, G as F, $ as J, H as N, I as O, J as j, N as q, t as z, z as B } from "./index-gtAUVnBf.js";
1
+ import { c as t, D as s, k as n, B as r, g as o, R as i, l as A, h as E, v as c, j as d, m as g, y as p, z as l, q as m, u, x as L, E as R, t as T } from "./index-hugwYSU_.js";
2
2
  export {
3
3
  t as Agent,
4
- s as AgentRuntime,
5
- i as MemorySession,
6
- r as MpdAgent,
7
- n as Runner,
8
- o as WorkflowRuntime,
9
- l as clearCapabilities,
10
- g as configureModel,
11
- c as createAgent,
12
- u as createAgentElement,
13
- p as createAgentRuntime,
14
- d as createCapabilityAgent,
15
- m as createCapabilityTool,
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
4
+ s as DEFAULT_AGENT_BFF_URL,
5
+ n as DEFAULT_AGENT_MODEL,
6
+ r as MemorySession,
7
+ o as MpdAgent,
8
+ i as Runner,
9
+ A as completeEditorOperation,
10
+ E as createAgentElement,
11
+ c as createAgentRuntime,
12
+ d as createAgents,
13
+ g as createEditorAgentContext,
14
+ p as defineAgentTool,
15
+ l as defineCapability,
16
+ m as editorOperationSucceeded,
17
+ u as prepareEditorOperation,
18
+ L as resolveAgentServiceURL,
19
+ R as run,
20
+ T as tool
42
21
  };
@@ -0,0 +1,32 @@
1
+ import type { AgentToolDefinition } from './tool';
2
+ import type { AgentHostApi, ChatMessage, ChatMode, FilePart } 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
+ attachments?: FilePart[];
20
+ signal: AbortSignal;
21
+ onUpdate: () => void;
22
+ }
23
+ export interface AgentRuntime {
24
+ readonly config: Readonly<AgentRuntimeConfig>;
25
+ runTurn: (turn: AgentRuntimeTurn) => Promise<void>;
26
+ }
27
+ /**
28
+ * llm-agent runtime. The Agents SDK owns the agent loop, tool calls and session
29
+ * history; this module only maps its stream events to the chat UI parts.
30
+ */
31
+ export declare function createAgentRuntime(options?: AgentRuntimeOptions): AgentRuntime;
32
+ //# 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,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAQ,EAGT,MAAM,SAAS,CAAA;AAwBhB,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,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAA;IACxB,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;AA+KD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,mBAAwB,GAChC,YAAY,CA0Od"}
@@ -0,0 +1,46 @@
1
+ import type { AgentFileKind, FilePart } from './types';
2
+ export declare const AGENT_DOCUMENT_MAX_SIZE: number;
3
+ export declare const AGENT_IMAGE_MAX_SIZE: number;
4
+ export declare const AGENT_ATTACHMENT_MAX_COUNT = 6;
5
+ export declare const AGENT_ATTACHMENT_MAX_TOTAL_SIZE: number;
6
+ /** @deprecated Use the format-specific upload limits. */
7
+ export declare const AGENT_UPLOAD_MAX_SIZE: number;
8
+ export interface AgentUploadedFile {
9
+ /** Server-side upload id. */
10
+ name: string;
11
+ /** Original file name. */
12
+ file: string;
13
+ kind: AgentFileKind;
14
+ mimeType: string;
15
+ /** BFF URL used for thumbnails and previews. */
16
+ url: string;
17
+ size?: number;
18
+ }
19
+ export declare function getAgentFileKind(file: Pick<File, 'name' | 'type'>): AgentFileKind | undefined;
20
+ export declare function isAgentImageFilePart(part: FilePart): boolean;
21
+ /**
22
+ * Model APIs normally live under `/v1`, while upload and document conversion
23
+ * endpoints live at the BFF root. Keep any deployment prefix in the base URL.
24
+ */
25
+ export declare function resolveAgentServiceURL(baseURL: string, path: string): string;
26
+ export declare function uploadAgentFile(baseURL: string, file: File): Promise<AgentUploadedFile>;
27
+ /** @deprecated Use uploadAgentFile. */
28
+ export declare const uploadAgentDocument: typeof uploadAgentFile;
29
+ export declare function readAgentDocumentMarkdown(baseURL: string, uploaded: AgentUploadedFile): Promise<string>;
30
+ export declare function readAgentImageData(baseURL: string, uploaded: Pick<AgentUploadedFile, 'name'>): Promise<string>;
31
+ export type AgentUserContent = {
32
+ type: 'input_image';
33
+ image: string;
34
+ detail: 'high';
35
+ } | {
36
+ type: 'input_text';
37
+ text: string;
38
+ };
39
+ /**
40
+ * Qwen's OpenAI-compatible API expects images and text in one user message.
41
+ * Put images first so visual context is available when the model reads the
42
+ * accompanying layout instructions.
43
+ */
44
+ export declare function buildAgentUserContent(prompt: string, imageDataUrls: readonly string[]): string | AgentUserContent[];
45
+ export declare function formatAgentDocumentContext(file: FilePart): string;
46
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEtD,eAAO,MAAM,uBAAuB,QAAmB,CAAA;AACvD,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AACpD,eAAO,MAAM,0BAA0B,IAAI,CAAA;AAC3C,eAAO,MAAM,+BAA+B,QAAmB,CAAA;AAC/D,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,QAA0B,CAAA;AAE5D,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,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ADDED
@@ -0,0 +1,32 @@
1
+ import type { z } from 'zod';
2
+ import type { AgentHostApi, EditorAgentContext } from './types';
3
+ export interface AgentToolContext {
4
+ api: AgentHostApi;
5
+ getContext: () => Record<string, unknown>;
6
+ /** Mutable context belonging to the current Agent Run. */
7
+ context: EditorAgentContext;
8
+ signal?: AbortSignal;
9
+ }
10
+ export interface AgentToolApprovalOptions {
11
+ message?: (input: any) => string;
12
+ }
13
+ export interface AgentToolDefinition<TInput = unknown, TOutput = unknown> {
14
+ /** Discriminator that keeps plain tool definitions distinct from SDK objects. */
15
+ kind?: 'agent-tool';
16
+ name: string;
17
+ description: string;
18
+ parameters?: z.ZodType;
19
+ /** Alias kept for existing capability definitions. */
20
+ inputSchema?: z.ZodType;
21
+ needsApproval?: boolean | ((input: TInput) => boolean | Promise<boolean>);
22
+ approval?: AgentToolApprovalOptions;
23
+ execute: (input: TInput, context: AgentToolContext) => TOutput | Promise<TOutput>;
24
+ }
25
+ /**
26
+ * Define a business tool consumed by the agent. Tools stay owned by the host:
27
+ * the element only adapts them to the Agents SDK at runtime.
28
+ */
29
+ export declare function defineAgentTool<TInput = unknown, TOutput = unknown>(definition: AgentToolDefinition<TInput, TOutput>): AgentToolDefinition<TInput, TOutput>;
30
+ /** Backwards-compatible name for hosts that already use the capability API. */
31
+ export declare const defineCapability: typeof defineAgentTool;
32
+ //# 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,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE/D,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,YAAY,CAAA;IACjB,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,0DAA0D;IAC1D,OAAO,EAAE,kBAAkB,CAAA;IAC3B,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"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Business tools can prepare data that a later edit tool consumes. The Agents
3
+ * SDK starts function tools from one model response concurrently by default,
4
+ * so a later tool may otherwise run before the context written by an earlier
5
+ * tool is available. Keep tool execution ordered within each Agent Run.
6
+ */
7
+ export declare const AGENT_TOOL_EXECUTION: Readonly<{
8
+ maxFunctionToolConcurrency: 1;
9
+ }>;
10
+ //# sourceMappingURL=toolExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolExecution.d.ts","sourceRoot":"","sources":["../src/toolExecution.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;EAE/B,CAAA"}
@@ -0,0 +1,94 @@
1
+ export type ChatMode = 'data' | 'text';
2
+ export type MessageRole = 'system' | 'user' | 'assistant';
3
+ export type AgentApiMode = 'responses' | 'chat_completions';
4
+ export type AgentFileKind = 'document' | 'image';
5
+ export interface AgentModelConfig {
6
+ /** OpenAI-compatible endpoint exposed by the host or its BFF. */
7
+ baseURL?: string;
8
+ model?: string;
9
+ apiMode?: AgentApiMode;
10
+ }
11
+ export interface AgentEditorOperation {
12
+ action: 'add' | 'edit' | 'delete' | 'move';
13
+ /** Existing node UUID used by edit, delete, and move operations. */
14
+ target?: string;
15
+ /** Widget type id used by `add`. */
16
+ widget?: string;
17
+ /**
18
+ * Editor data assembled by a business tool and injected by the host.
19
+ * This field is intentionally absent from the model-facing tool schema.
20
+ */
21
+ items?: unknown[];
22
+ changes?: Record<string, unknown>;
23
+ style?: Record<string, unknown>;
24
+ before?: string;
25
+ after?: string;
26
+ }
27
+ /**
28
+ * Mutable state scoped to one Agent Run.
29
+ *
30
+ * Business tools write complete editor data into `pendingItems`; the editor
31
+ * tool consumes it after a successful operation. A fresh object is created for
32
+ * every turn so concurrent runs and conversations never share business data.
33
+ */
34
+ export interface EditorAgentContext extends Record<string, unknown> {
35
+ pendingItems: unknown[];
36
+ }
37
+ /**
38
+ * APIs implemented by the host. The agent runtime only knows this contract, so
39
+ * the editor document and business data never become part of the agent package.
40
+ */
41
+ export interface AgentEditorApi {
42
+ getCurrentEditor: () => unknown | Promise<unknown>;
43
+ getWidgets: () => unknown | Promise<unknown>;
44
+ /** Context contains business data prepared by tools during the current Agent Run. */
45
+ operateEditor: (operation: AgentEditorOperation, context?: EditorAgentContext) => unknown | Promise<unknown>;
46
+ }
47
+ export interface AgentHostApi {
48
+ model?: AgentModelConfig;
49
+ editor?: Partial<AgentEditorApi>;
50
+ }
51
+ export interface TextPart {
52
+ type: 'text';
53
+ text: string;
54
+ }
55
+ export interface ReasoningPart {
56
+ type: 'reasoning';
57
+ text: string;
58
+ }
59
+ export interface ToolPart {
60
+ type: 'tool';
61
+ toolCallId: string;
62
+ toolName: string;
63
+ state: 'input-available' | 'output-available';
64
+ input?: unknown;
65
+ output?: unknown;
66
+ errorText?: string;
67
+ }
68
+ export interface DataPart {
69
+ type: 'data';
70
+ name: string;
71
+ data?: unknown;
72
+ }
73
+ export interface FilePart {
74
+ type: 'file';
75
+ /** Server-side upload id used to retrieve the file content. */
76
+ name: string;
77
+ /** Original file name shown to the user. */
78
+ file: string;
79
+ /** Missing on legacy stored document parts. */
80
+ kind?: AgentFileKind;
81
+ mimeType?: string;
82
+ size?: number;
83
+ /** Converted document content sent to the agent as context. */
84
+ text?: string;
85
+ /** BFF URL used to render an image preview without persisting Base64 data. */
86
+ url?: string;
87
+ }
88
+ export type MessagePart = TextPart | ReasoningPart | ToolPart | DataPart | FilePart;
89
+ export interface ChatMessage {
90
+ id: string;
91
+ role: MessageRole;
92
+ parts: MessagePart[];
93
+ }
94
+ //# 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;AAC3D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO,CAAA;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,Y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WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,iBAAiB,GAAG,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,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA+C;IAC/C,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEnF,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.16",
4
+ "version": "0.2.0-beta.10",
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
- "debug": "^4.4.3",
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",
@@ -49,6 +48,6 @@
49
48
  "build:types": "tsc -p tsconfig.build.json",
50
49
  "build:playground": "vite build --outDir dist-playground",
51
50
  "preview": "vite preview",
52
- "test": "echo \"Error: no test specified\" && exit 1"
51
+ "test": "node --test \"tests/**/*.test.ts\""
53
52
  }
54
53
  }
@@ -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,KAAK,CAAA;AACvB,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,OAAO,CAAA;AAExC,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAA;IAChC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;CAChC;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,aAAa,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IACzE,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;CAC/E;AAED,MAAM,WAAW,UAAU,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,CAC7D,SAAQ,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7C,IAAI,EAAE,YAAY,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAC9C,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,6 +0,0 @@
1
- import { Agent } from '@openai/agents';
2
- import type { Capability } from './capability';
3
- export declare function createCapabilityAgent(options: {
4
- capabilities: Capability<any, any>[];
5
- }): Agent<any, any>;
6
- //# sourceMappingURL=capabilityAgent.d.ts.map
@@ -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"}
@@ -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"}
@@ -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,KAAK,EACL,cAAc,EAEd,KAAK,EAGL,SAAS,EACT,cAAc,EAEd,OAAO,EACP,iBAAiB,EAElB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC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Agent(options: {
4
- capabilities: Capability<any, any>[];
5
- }): Agent<any, any>;
6
- //# sourceMappingURL=editAgent.d.ts.map
@@ -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"}
@@ -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"}