@zk-tech/ag-ui-core 0.0.1-alpha.6 → 0.0.1-alpha.8

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.
@@ -0,0 +1,10 @@
1
+ declare enum DesignProjectCtxNamespace {
2
+ Project = "project"
3
+ }
4
+ interface DesignProjectProjectCtx {
5
+ projectId: string;
6
+ /** 草稿版本号, 如果没有那么则传递 undefined */
7
+ workspaceHash: string | undefined;
8
+ }
9
+
10
+ export { DesignProjectCtxNamespace as D, type DesignProjectProjectCtx as a };
@@ -0,0 +1,10 @@
1
+ declare enum DesignProjectCtxNamespace {
2
+ Project = "project"
3
+ }
4
+ interface DesignProjectProjectCtx {
5
+ projectId: string;
6
+ /** 草稿版本号, 如果没有那么则传递 undefined */
7
+ workspaceHash: string | undefined;
8
+ }
9
+
10
+ export { DesignProjectCtxNamespace as D, type DesignProjectProjectCtx as a };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/protocol/context.ts","../src/utils/is-project-ctx.ts","../src/utils/create-project-context.ts","../src/utils/extract-workspace-hash-from-context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";;;AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA;;;ACIL,SAAS,0BAA0B,KAAA,EAAkD;AACxF,EAAA,OACE,OAAO,KAAA,KAAU,QAAA,IACjB,KAAA,KAAU,IAAA,IACV,WAAA,IAAe,KAAA,IACf,OAAQ,KAAA,CAAkC,SAAA,KAAc,QAAA,IACvD,KAAA,CAAkC,UAAU,MAAA,GAAS,CAAA;AAE1D;;;ACDK,SAAS,qBAAqB,GAAA,EAAuC;AAE1E,EAAA,OAAO;AAAA,IACL,WAAA,EAAA,SAAA;AAAA,IACA,KAAA,EAAO,IAAA,CAAK,SAAA,CAAU,GAAG;AAAA,GAC3B;AACF;;;ACJO,SAAS,gCACd,OAAA,EACoB;AACpB,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,KAAA,CAAM,OAAA,CAAQ,OAAO,CAAA,EAAG;AACvC,IAAA,OAAO,MAAA;AAAA,EACT;AAGA,EAAA,KAAA,MAAW,OAAO,OAAA,EAAS;AACzB,IAAA,IAAI,CAAC,GAAA,IAAO,OAAO,GAAA,KAAQ,QAAA,EAAU;AACnC,MAAA;AAAA,IACF;AAGA,IAAA,MAAM,YAAY,GAAA,CAAI,WAAA;AACtB,IAAA,IAAI,SAAA,KAAA,SAAA,kBAAmD,IAAI,KAAA,EAAO;AAChE,MAAA,IAAI;AAEF,QAAA,MAAM,MAAA,GAAS,OAAO,GAAA,CAAI,KAAA,KAAU,QAAA,GAAW,KAAK,KAAA,CAAM,GAAA,CAAI,KAAK,CAAA,GAAI,GAAA,CAAI,KAAA;AAG3E,QAAA,IAAI,yBAAA,CAA0B,MAAM,CAAA,EAAG;AACrC,UAAA,OAAO,MAAA,CAAO,aAAA;AAAA,QAChB;AAAA,MACF,CAAA,CAAA,MAAQ;AAEN,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.cjs","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}","/**\n * Type guard to check if an object matches DesignProjectProjectCtx\n */\nimport { type DesignProjectProjectCtx } from '../protocol';\n\nexport function isDesignProjectProjectCtx(value: unknown): value is DesignProjectProjectCtx {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'projectId' in value &&\n typeof (value as Record<string, unknown>).projectId === 'string' &&\n (value as DesignProjectProjectCtx).projectId.length > 0\n );\n }\n ","/**\n * Create project context for AG-UI RunAgentInput\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport type { Context } from '@ag-ui/core';\n\n/**\n * Create a project context item for AG-UI RunAgentInput\n *\n * @param projectId - The project ID\n * @returns Context item with namespace 'project' and projectId in value\n */\nexport function createProjectContext(ctx: DesignProjectProjectCtx): Context {\n // const projectCtx: DesignProjectProjectCtx = { projectId, workspaceHash };\n return {\n description: DesignProjectCtxNamespace.Project,\n value: JSON.stringify(ctx),\n };\n}\n","/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport { isDesignProjectProjectCtx } from './is-project-ctx';\n\n/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n *\n * @param context - Context array from RunAgentInput\n * @returns workspaceHash if found, undefined otherwise\n */\nexport function extractWorkspaceHashFromContext(\n context: Array<{ description?: string; value?: string }> | undefined\n): string | undefined {\n if (!context || !Array.isArray(context)) {\n return undefined;\n }\n\n // Look for context with namespace 'project'\n for (const ctx of context) {\n if (!ctx || typeof ctx !== 'object') {\n continue;\n }\n\n // Check if this is a project context (namespace = 'project')\n const namespace = ctx.description;\n if (namespace === DesignProjectCtxNamespace.Project && ctx.value) {\n try {\n // Parse value as JSON (AG-UI Context.value is a string)\n const parsed = typeof ctx.value === 'string' ? JSON.parse(ctx.value) : ctx.value;\n\n // Use type guard to validate and extract workspaceHash with proper typing\n if (isDesignProjectProjectCtx(parsed)) {\n return parsed.workspaceHash;\n }\n } catch {\n // Invalid JSON, skip this context\n continue;\n }\n }\n }\n\n return undefined;\n}"]}
1
+ {"version":3,"sources":["../src/protocol/context.ts","../src/utils/is-project-ctx.ts","../src/utils/create-project-context.ts","../src/utils/extract-workspace-hash-from-context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";;;AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0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'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}\n","/**\n * Type guard to check if an object matches DesignProjectProjectCtx\n */\nimport { type DesignProjectProjectCtx } from '../protocol';\n\nexport function isDesignProjectProjectCtx(value: unknown): value is DesignProjectProjectCtx {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'projectId' in value &&\n typeof (value as Record<string, unknown>).projectId === 'string' &&\n (value as DesignProjectProjectCtx).projectId.length > 0\n );\n }\n ","/**\n * Create project context for AG-UI RunAgentInput\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport type { Context } from '@ag-ui/core';\n\n/**\n * Create a project context item for AG-UI RunAgentInput\n *\n * @param projectId - The project ID\n * @returns Context item with namespace 'project' and projectId in value\n */\nexport function createProjectContext(ctx: DesignProjectProjectCtx): Context {\n // const projectCtx: DesignProjectProjectCtx = { projectId, workspaceHash };\n return {\n description: DesignProjectCtxNamespace.Project,\n value: JSON.stringify(ctx),\n };\n}\n","/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport { isDesignProjectProjectCtx } from './is-project-ctx';\n\n/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n *\n * @param context - Context array from RunAgentInput\n * @returns workspaceHash if found, undefined otherwise\n */\nexport function extractWorkspaceHashFromContext(\n context: Array<{ description?: string; value?: string }> | undefined\n): string | undefined {\n if (!context || !Array.isArray(context)) {\n return undefined;\n }\n\n // Look for context with namespace 'project'\n for (const ctx of context) {\n if (!ctx || typeof ctx !== 'object') {\n continue;\n }\n\n // Check if this is a project context (namespace = 'project')\n const namespace = ctx.description;\n if (namespace === DesignProjectCtxNamespace.Project && ctx.value) {\n try {\n // Parse value as JSON (AG-UI Context.value is a string)\n const parsed = typeof ctx.value === 'string' ? JSON.parse(ctx.value) : ctx.value;\n\n // Use type guard to validate and extract workspaceHash with proper typing\n if (isDesignProjectProjectCtx(parsed)) {\n return parsed.workspaceHash;\n }\n } catch {\n // Invalid JSON, skip this context\n continue;\n }\n }\n }\n\n return undefined;\n}"]}
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
- export { DesignProjectCtxNamespace, DesignProjectProjectCtx } from './protocol/index.cjs';
1
+ export { D as DesignProjectCtxNamespace, a as DesignProjectProjectCtx } from './context-ByCp1cHp.cjs';
2
+ export { ResumeOption, RunAgentInput } from './protocol/index.cjs';
2
3
  export { createProjectContext, extractWorkspaceHashFromContext, isDesignProjectProjectCtx } from './utils/index.cjs';
3
4
  import '@ag-ui/core';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { DesignProjectCtxNamespace, DesignProjectProjectCtx } from './protocol/index.js';
1
+ export { D as DesignProjectCtxNamespace, a as DesignProjectProjectCtx } from './context-ByCp1cHp.js';
2
+ export { ResumeOption, RunAgentInput } from './protocol/index.js';
2
3
  export { createProjectContext, extractWorkspaceHashFromContext, isDesignProjectProjectCtx } from './utils/index.js';
3
4
  import '@ag-ui/core';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/protocol/context.ts","../src/utils/is-project-ctx.ts","../src/utils/create-project-context.ts","../src/utils/extract-workspace-hash-from-context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA;;;ACIL,SAAS,0BAA0B,KAAA,EAAkD;AACxF,EAAA,OACE,OAAO,KAAA,KAAU,QAAA,IACjB,KAAA,KAAU,IAAA,IACV,WAAA,IAAe,KAAA,IACf,OAAQ,KAAA,CAAkC,SAAA,KAAc,QAAA,IACvD,KAAA,CAAkC,UAAU,MAAA,GAAS,CAAA;AAE1D;;;ACDK,SAAS,qBAAqB,GAAA,EAAuC;AAE1E,EAAA,OAAO;AAAA,IACL,WAAA,EAAA,SAAA;AAAA,IACA,KAAA,EAAO,IAAA,CAAK,SAAA,CAAU,GAAG;AAAA,GAC3B;AACF;;;ACJO,SAAS,gCACd,OAAA,EACoB;AACpB,EAAA,IAAI,CAAC,OAAA,IAAW,CAAC,KAAA,CAAM,OAAA,CAAQ,OAAO,CAAA,EAAG;AACvC,IAAA,OAAO,MAAA;AAAA,EACT;AAGA,EAAA,KAAA,MAAW,OAAO,OAAA,EAAS;AACzB,IAAA,IAAI,CAAC,GAAA,IAAO,OAAO,GAAA,KAAQ,QAAA,EAAU;AACnC,MAAA;AAAA,IACF;AAGA,IAAA,MAAM,YAAY,GAAA,CAAI,WAAA;AACtB,IAAA,IAAI,SAAA,KAAA,SAAA,kBAAmD,IAAI,KAAA,EAAO;AAChE,MAAA,IAAI;AAEF,QAAA,MAAM,MAAA,GAAS,OAAO,GAAA,CAAI,KAAA,KAAU,QAAA,GAAW,KAAK,KAAA,CAAM,GAAA,CAAI,KAAK,CAAA,GAAI,GAAA,CAAI,KAAA;AAG3E,QAAA,IAAI,yBAAA,CAA0B,MAAM,CAAA,EAAG;AACrC,UAAA,OAAO,MAAA,CAAO,aAAA;AAAA,QAChB;AAAA,MACF,CAAA,CAAA,MAAQ;AAEN,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}","/**\n * Type guard to check if an object matches DesignProjectProjectCtx\n */\nimport { type DesignProjectProjectCtx } from '../protocol';\n\nexport function isDesignProjectProjectCtx(value: unknown): value is DesignProjectProjectCtx {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'projectId' in value &&\n typeof (value as Record<string, unknown>).projectId === 'string' &&\n (value as DesignProjectProjectCtx).projectId.length > 0\n );\n }\n ","/**\n * Create project context for AG-UI RunAgentInput\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport type { Context } from '@ag-ui/core';\n\n/**\n * Create a project context item for AG-UI RunAgentInput\n *\n * @param projectId - The project ID\n * @returns Context item with namespace 'project' and projectId in value\n */\nexport function createProjectContext(ctx: DesignProjectProjectCtx): Context {\n // const projectCtx: DesignProjectProjectCtx = { projectId, workspaceHash };\n return {\n description: DesignProjectCtxNamespace.Project,\n value: JSON.stringify(ctx),\n };\n}\n","/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport { isDesignProjectProjectCtx } from './is-project-ctx';\n\n/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n *\n * @param context - Context array from RunAgentInput\n * @returns workspaceHash if found, undefined otherwise\n */\nexport function extractWorkspaceHashFromContext(\n context: Array<{ description?: string; value?: string }> | undefined\n): string | undefined {\n if (!context || !Array.isArray(context)) {\n return undefined;\n }\n\n // Look for context with namespace 'project'\n for (const ctx of context) {\n if (!ctx || typeof ctx !== 'object') {\n continue;\n }\n\n // Check if this is a project context (namespace = 'project')\n const namespace = ctx.description;\n if (namespace === DesignProjectCtxNamespace.Project && ctx.value) {\n try {\n // Parse value as JSON (AG-UI Context.value is a string)\n const parsed = typeof ctx.value === 'string' ? JSON.parse(ctx.value) : ctx.value;\n\n // Use type guard to validate and extract workspaceHash with proper typing\n if (isDesignProjectProjectCtx(parsed)) {\n return parsed.workspaceHash;\n }\n } catch {\n // Invalid JSON, skip this context\n continue;\n }\n }\n }\n\n return undefined;\n}"]}
1
+ {"version":3,"sources":["../src/protocol/context.ts","../src/utils/is-project-ctx.ts","../src/utils/create-project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ChB;AAAA,MACF,CAAA,CAAA,MAAQ;AAEN,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}\n","/**\n * Type guard to check if an object matches DesignProjectProjectCtx\n */\nimport { type DesignProjectProjectCtx } from '../protocol';\n\nexport function isDesignProjectProjectCtx(value: unknown): value is DesignProjectProjectCtx {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'projectId' in value &&\n typeof (value as Record<string, unknown>).projectId === 'string' &&\n (value as DesignProjectProjectCtx).projectId.length > 0\n );\n }\n ","/**\n * Create project context for AG-UI RunAgentInput\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport type { Context } from '@ag-ui/core';\n\n/**\n * Create a project context item for AG-UI RunAgentInput\n *\n * @param projectId - The project ID\n * @returns Context item with namespace 'project' and projectId in value\n */\nexport function createProjectContext(ctx: DesignProjectProjectCtx): Context {\n // const projectCtx: DesignProjectProjectCtx = { projectId, workspaceHash };\n return {\n description: DesignProjectCtxNamespace.Project,\n value: JSON.stringify(ctx),\n };\n}\n","/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n */\nimport { type DesignProjectProjectCtx, DesignProjectCtxNamespace } from '../protocol';\nimport { isDesignProjectProjectCtx } from './is-project-ctx';\n\n/**\n * Extract workspaceHash from context array\n * Looks for context with namespace 'project' and extracts workspaceHash from value\n *\n * @param context - Context array from RunAgentInput\n * @returns workspaceHash if found, undefined otherwise\n */\nexport function extractWorkspaceHashFromContext(\n context: Array<{ description?: string; value?: string }> | undefined\n): string | undefined {\n if (!context || !Array.isArray(context)) {\n return undefined;\n }\n\n // Look for context with namespace 'project'\n for (const ctx of context) {\n if (!ctx || typeof ctx !== 'object') {\n continue;\n }\n\n // Check if this is a project context (namespace = 'project')\n const namespace = ctx.description;\n if (namespace === DesignProjectCtxNamespace.Project && ctx.value) {\n try {\n // Parse value as JSON (AG-UI Context.value is a string)\n const parsed = typeof ctx.value === 'string' ? JSON.parse(ctx.value) : ctx.value;\n\n // Use type guard to validate and extract workspaceHash with proper typing\n if (isDesignProjectProjectCtx(parsed)) {\n return parsed.workspaceHash;\n }\n } catch {\n // Invalid JSON, skip this context\n continue;\n }\n }\n }\n\n return undefined;\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/protocol/context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";;;AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA","file":"index.cjs","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}"]}
1
+ {"version":3,"sources":["../../src/protocol/context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";;;AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA","file":"index.cjs","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}\n"]}
@@ -1,10 +1,36 @@
1
- declare enum DesignProjectCtxNamespace {
2
- Project = "project"
1
+ export { D as DesignProjectCtxNamespace, a as DesignProjectProjectCtx } from '../context-ByCp1cHp.cjs';
2
+ import { RunAgentInput as RunAgentInput$1 } from '@ag-ui/core';
3
+
4
+ /**
5
+ * RunAgentInput 类型重定义
6
+ * 直接使用 @ag-ui/core 的标准类型,保持协议一致性
7
+ */
8
+
9
+ /**
10
+ * Resume 选项类型(用于恢复中断的运行)
11
+ */
12
+ interface ResumeOption {
13
+ /**
14
+ * 中断 ID(可选,如果提供了则回显)
15
+ * 来自 RUN_FINISHED 事件中的 interrupt.id
16
+ */
17
+ interruptId?: string;
18
+ /**
19
+ * 用户响应数据(任意 JSON)
20
+ * 可以包含 approvals、edits、files-as-refs 等
21
+ */
22
+ payload?: any;
3
23
  }
4
- interface DesignProjectProjectCtx {
5
- projectId: string;
6
- /** 草稿版本号, 如果没有那么则传递 undefined */
7
- workspaceHash: string | undefined;
24
+ /**
25
+ * RunAgentInput 类型重定义
26
+ * 基于 @ag-ui/core 的标准类型,扩展 resume 字段以支持中断恢复
27
+ */
28
+ interface RunAgentInput extends RunAgentInput$1 {
29
+ /**
30
+ * Resume 选项(用于恢复中断的运行)
31
+ * 当需要恢复一个被中断的 run 时,提供此字段
32
+ */
33
+ resume?: ResumeOption;
8
34
  }
9
35
 
10
- export { DesignProjectCtxNamespace, type DesignProjectProjectCtx };
36
+ export type { ResumeOption, RunAgentInput };
@@ -1,10 +1,36 @@
1
- declare enum DesignProjectCtxNamespace {
2
- Project = "project"
1
+ export { D as DesignProjectCtxNamespace, a as DesignProjectProjectCtx } from '../context-ByCp1cHp.js';
2
+ import { RunAgentInput as RunAgentInput$1 } from '@ag-ui/core';
3
+
4
+ /**
5
+ * RunAgentInput 类型重定义
6
+ * 直接使用 @ag-ui/core 的标准类型,保持协议一致性
7
+ */
8
+
9
+ /**
10
+ * Resume 选项类型(用于恢复中断的运行)
11
+ */
12
+ interface ResumeOption {
13
+ /**
14
+ * 中断 ID(可选,如果提供了则回显)
15
+ * 来自 RUN_FINISHED 事件中的 interrupt.id
16
+ */
17
+ interruptId?: string;
18
+ /**
19
+ * 用户响应数据(任意 JSON)
20
+ * 可以包含 approvals、edits、files-as-refs 等
21
+ */
22
+ payload?: any;
3
23
  }
4
- interface DesignProjectProjectCtx {
5
- projectId: string;
6
- /** 草稿版本号, 如果没有那么则传递 undefined */
7
- workspaceHash: string | undefined;
24
+ /**
25
+ * RunAgentInput 类型重定义
26
+ * 基于 @ag-ui/core 的标准类型,扩展 resume 字段以支持中断恢复
27
+ */
28
+ interface RunAgentInput extends RunAgentInput$1 {
29
+ /**
30
+ * Resume 选项(用于恢复中断的运行)
31
+ * 当需要恢复一个被中断的 run 时,提供此字段
32
+ */
33
+ resume?: ResumeOption;
8
34
  }
9
35
 
10
- export { DesignProjectCtxNamespace, type DesignProjectProjectCtx };
36
+ export type { ResumeOption, RunAgentInput };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/protocol/context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA","file":"index.js","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}"]}
1
+ {"version":3,"sources":["../../src/protocol/context.ts"],"names":["DesignProjectCtxNamespace"],"mappings":";AACO,IAAK,yBAAA,qBAAAA,0BAAAA,KAAL;AAEH,EAAAA,2BAAA,SAAA,CAAA,GAAU,SAAA;AAFF,EAAA,OAAAA,0BAAAA;AAAA,CAAA,EAAA,yBAAA,IAAA,EAAA","file":"index.js","sourcesContent":["\nexport enum DesignProjectCtxNamespace {\n // 项目相关上下文\n Project = 'project',\n}\n\nexport interface DesignProjectProjectCtx {\n projectId: string;\n /** 草稿版本号, 如果没有那么则传递 undefined */\n workspaceHash: string | undefined;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { DesignProjectProjectCtx } from '../protocol/index.cjs';
1
+ import { a as DesignProjectProjectCtx } from '../context-ByCp1cHp.cjs';
2
2
  import { Context } from '@ag-ui/core';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { DesignProjectProjectCtx } from '../protocol/index.js';
1
+ import { a as DesignProjectProjectCtx } from '../context-ByCp1cHp.js';
2
2
  import { Context } from '@ag-ui/core';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zk-tech/ag-ui-core",
3
- "version": "0.0.1-alpha.6",
3
+ "version": "0.0.1-alpha.8",
4
4
  "description": "Extends from AG-UI core with more strict types",
5
5
  "license": "MIT",
6
6
  "author": "ZK Tech",