@inkeep/agents-run-api 0.1.3 → 0.1.6

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 (157) hide show
  1. package/LICENSE.md +7 -0
  2. package/SUPPLEMENTAL_TERMS.md +40 -0
  3. package/dist/chunk-P6IQZWFC.js +239 -0
  4. package/dist/conversations-EUPRCMQZ.js +1 -0
  5. package/dist/index.cjs +8992 -0
  6. package/dist/index.d.cts +15 -0
  7. package/dist/index.d.ts +13 -21
  8. package/dist/index.js +8644 -27
  9. package/package.json +8 -7
  10. package/dist/AgentExecutionServer.d.ts +0 -28
  11. package/dist/AgentExecutionServer.d.ts.map +0 -1
  12. package/dist/AgentExecutionServer.js +0 -41
  13. package/dist/__tests__/setup.d.ts +0 -4
  14. package/dist/__tests__/setup.d.ts.map +0 -1
  15. package/dist/__tests__/setup.js +0 -80
  16. package/dist/__tests__/utils/testProject.d.ts +0 -18
  17. package/dist/__tests__/utils/testProject.d.ts.map +0 -1
  18. package/dist/__tests__/utils/testProject.js +0 -26
  19. package/dist/__tests__/utils/testRequest.d.ts +0 -8
  20. package/dist/__tests__/utils/testRequest.d.ts.map +0 -1
  21. package/dist/__tests__/utils/testRequest.js +0 -32
  22. package/dist/__tests__/utils/testTenant.d.ts +0 -64
  23. package/dist/__tests__/utils/testTenant.d.ts.map +0 -1
  24. package/dist/__tests__/utils/testTenant.js +0 -71
  25. package/dist/a2a/client.d.ts +0 -182
  26. package/dist/a2a/client.d.ts.map +0 -1
  27. package/dist/a2a/client.js +0 -645
  28. package/dist/a2a/handlers.d.ts +0 -4
  29. package/dist/a2a/handlers.d.ts.map +0 -1
  30. package/dist/a2a/handlers.js +0 -656
  31. package/dist/a2a/transfer.d.ts +0 -18
  32. package/dist/a2a/transfer.d.ts.map +0 -1
  33. package/dist/a2a/transfer.js +0 -22
  34. package/dist/a2a/types.d.ts +0 -63
  35. package/dist/a2a/types.d.ts.map +0 -1
  36. package/dist/a2a/types.js +0 -1
  37. package/dist/agents/Agent.d.ts +0 -154
  38. package/dist/agents/Agent.d.ts.map +0 -1
  39. package/dist/agents/Agent.js +0 -1110
  40. package/dist/agents/ModelFactory.d.ts +0 -62
  41. package/dist/agents/ModelFactory.d.ts.map +0 -1
  42. package/dist/agents/ModelFactory.js +0 -208
  43. package/dist/agents/SystemPromptBuilder.d.ts +0 -14
  44. package/dist/agents/SystemPromptBuilder.d.ts.map +0 -1
  45. package/dist/agents/SystemPromptBuilder.js +0 -62
  46. package/dist/agents/ToolSessionManager.d.ts +0 -61
  47. package/dist/agents/ToolSessionManager.d.ts.map +0 -1
  48. package/dist/agents/ToolSessionManager.js +0 -143
  49. package/dist/agents/artifactTools.d.ts +0 -30
  50. package/dist/agents/artifactTools.d.ts.map +0 -1
  51. package/dist/agents/artifactTools.js +0 -463
  52. package/dist/agents/generateTaskHandler.d.ts +0 -41
  53. package/dist/agents/generateTaskHandler.d.ts.map +0 -1
  54. package/dist/agents/generateTaskHandler.js +0 -350
  55. package/dist/agents/relationTools.d.ts +0 -35
  56. package/dist/agents/relationTools.d.ts.map +0 -1
  57. package/dist/agents/relationTools.js +0 -246
  58. package/dist/agents/types.d.ts +0 -23
  59. package/dist/agents/types.d.ts.map +0 -1
  60. package/dist/agents/types.js +0 -1
  61. package/dist/agents/versions/V1Config.d.ts +0 -21
  62. package/dist/agents/versions/V1Config.d.ts.map +0 -1
  63. package/dist/agents/versions/V1Config.js +0 -285
  64. package/dist/app.d.ts +0 -12
  65. package/dist/app.d.ts.map +0 -1
  66. package/dist/app.js +0 -216
  67. package/dist/data/agentGraph.d.ts +0 -4
  68. package/dist/data/agentGraph.d.ts.map +0 -1
  69. package/dist/data/agentGraph.js +0 -73
  70. package/dist/data/agents.d.ts +0 -4
  71. package/dist/data/agents.d.ts.map +0 -1
  72. package/dist/data/agents.js +0 -78
  73. package/dist/data/conversations.d.ts +0 -59
  74. package/dist/data/conversations.d.ts.map +0 -1
  75. package/dist/data/conversations.js +0 -216
  76. package/dist/data/db/clean.d.ts +0 -6
  77. package/dist/data/db/clean.d.ts.map +0 -1
  78. package/dist/data/db/clean.js +0 -77
  79. package/dist/data/db/dbClient.d.ts +0 -3
  80. package/dist/data/db/dbClient.d.ts.map +0 -1
  81. package/dist/data/db/dbClient.js +0 -13
  82. package/dist/env.d.ts +0 -45
  83. package/dist/env.d.ts.map +0 -1
  84. package/dist/env.js +0 -64
  85. package/dist/handlers/executionHandler.d.ts +0 -36
  86. package/dist/handlers/executionHandler.d.ts.map +0 -1
  87. package/dist/handlers/executionHandler.js +0 -399
  88. package/dist/index.d.ts.map +0 -1
  89. package/dist/instrumentation.d.ts +0 -13
  90. package/dist/instrumentation.d.ts.map +0 -1
  91. package/dist/instrumentation.js +0 -66
  92. package/dist/logger.d.ts +0 -4
  93. package/dist/logger.d.ts.map +0 -1
  94. package/dist/logger.js +0 -32
  95. package/dist/middleware/api-key-auth.d.ts +0 -22
  96. package/dist/middleware/api-key-auth.d.ts.map +0 -1
  97. package/dist/middleware/api-key-auth.js +0 -139
  98. package/dist/middleware/index.d.ts +0 -2
  99. package/dist/middleware/index.d.ts.map +0 -1
  100. package/dist/middleware/index.js +0 -1
  101. package/dist/openapi.d.ts +0 -2
  102. package/dist/openapi.d.ts.map +0 -1
  103. package/dist/openapi.js +0 -36
  104. package/dist/routes/agents.d.ts +0 -10
  105. package/dist/routes/agents.d.ts.map +0 -1
  106. package/dist/routes/agents.js +0 -158
  107. package/dist/routes/chat.d.ts +0 -10
  108. package/dist/routes/chat.d.ts.map +0 -1
  109. package/dist/routes/chat.js +0 -307
  110. package/dist/routes/chatDataStream.d.ts +0 -10
  111. package/dist/routes/chatDataStream.d.ts.map +0 -1
  112. package/dist/routes/chatDataStream.js +0 -179
  113. package/dist/routes/mcp.d.ts +0 -10
  114. package/dist/routes/mcp.d.ts.map +0 -1
  115. package/dist/routes/mcp.js +0 -500
  116. package/dist/server.d.ts +0 -5
  117. package/dist/server.d.ts.map +0 -1
  118. package/dist/server.js +0 -61
  119. package/dist/tracer.d.ts +0 -24
  120. package/dist/tracer.d.ts.map +0 -1
  121. package/dist/tracer.js +0 -107
  122. package/dist/types/chat.d.ts +0 -25
  123. package/dist/types/chat.d.ts.map +0 -1
  124. package/dist/types/chat.js +0 -1
  125. package/dist/types/execution-context.d.ts +0 -14
  126. package/dist/types/execution-context.d.ts.map +0 -1
  127. package/dist/types/execution-context.js +0 -14
  128. package/dist/utils/agent-operations.d.ts +0 -92
  129. package/dist/utils/agent-operations.d.ts.map +0 -1
  130. package/dist/utils/agent-operations.js +0 -78
  131. package/dist/utils/artifact-component-schema.d.ts +0 -29
  132. package/dist/utils/artifact-component-schema.d.ts.map +0 -1
  133. package/dist/utils/artifact-component-schema.js +0 -119
  134. package/dist/utils/artifact-parser.d.ts +0 -71
  135. package/dist/utils/artifact-parser.d.ts.map +0 -1
  136. package/dist/utils/artifact-parser.js +0 -251
  137. package/dist/utils/cleanup.d.ts +0 -19
  138. package/dist/utils/cleanup.d.ts.map +0 -1
  139. package/dist/utils/cleanup.js +0 -66
  140. package/dist/utils/data-component-schema.d.ts +0 -6
  141. package/dist/utils/data-component-schema.d.ts.map +0 -1
  142. package/dist/utils/data-component-schema.js +0 -43
  143. package/dist/utils/graph-session.d.ts +0 -200
  144. package/dist/utils/graph-session.d.ts.map +0 -1
  145. package/dist/utils/graph-session.js +0 -1016
  146. package/dist/utils/incremental-stream-parser.d.ts +0 -57
  147. package/dist/utils/incremental-stream-parser.d.ts.map +0 -1
  148. package/dist/utils/incremental-stream-parser.js +0 -289
  149. package/dist/utils/response-formatter.d.ts +0 -27
  150. package/dist/utils/response-formatter.d.ts.map +0 -1
  151. package/dist/utils/response-formatter.js +0 -160
  152. package/dist/utils/stream-helpers.d.ts +0 -174
  153. package/dist/utils/stream-helpers.d.ts.map +0 -1
  154. package/dist/utils/stream-helpers.js +0 -466
  155. package/dist/utils/stream-registry.d.ts +0 -18
  156. package/dist/utils/stream-registry.d.ts.map +0 -1
  157. package/dist/utils/stream-registry.js +0 -33
package/dist/tracer.js DELETED
@@ -1,107 +0,0 @@
1
- import { SpanStatusCode, trace, } from '@opentelemetry/api';
2
- import { env } from './env';
3
- import { getLogger } from './logger';
4
- // Environments where trace force flush should be enabled
5
- const FORCE_FLUSH_ENVIRONMENTS = ['development'];
6
- const logger = getLogger('tracer');
7
- // Base prefix for all span names - export this to use in other files
8
- export const BASE = 'inkeep-chat';
9
- // Service name and version constants for consistent tracer identification
10
- export const SERVICE_NAME = 'inkeep-chat';
11
- export const SERVICE_VERSION = '1.0.0';
12
- // Helper function to create prefixed span names
13
- export const createSpanName = (suffix) => `${BASE}.${suffix}`;
14
- // No-op span implementation for when OpenTelemetry is not available
15
- const createNoOpSpan = () => ({
16
- setAttributes: () => ({}),
17
- recordException: () => ({}),
18
- setStatus: () => ({}),
19
- addEvent: () => ({}),
20
- end: () => { },
21
- isRecording: () => false,
22
- setAttribute: () => ({}),
23
- updateName: () => ({}),
24
- spanContext: () => ({
25
- traceId: '00000000000000000000000000000000',
26
- spanId: '0000000000000000',
27
- traceFlags: 0,
28
- }),
29
- addLink: () => ({}),
30
- addLinks: () => ({}),
31
- });
32
- // No-op tracer implementation for when OpenTelemetry is not available
33
- const noopTracer = {
34
- startActiveSpan(name, arg1, arg2, arg3) {
35
- const fn = typeof arg1 === 'function' ? arg1 : typeof arg2 === 'function' ? arg2 : arg3;
36
- if (!fn)
37
- throw new Error('No callback function provided');
38
- return fn(createNoOpSpan());
39
- },
40
- startSpan(name, options) {
41
- return createNoOpSpan();
42
- },
43
- };
44
- // Global tracer instance - singleton pattern
45
- let globalTracerInstance = null;
46
- /**
47
- * Helper function to handle span errors consistently
48
- * Records the exception, sets error status, and optionally logs
49
- */
50
- export function handleSpanError(span, error, logger, logMessage) {
51
- const errorMessage = error instanceof Error ? error.message : String(error);
52
- // Record the exception in the span
53
- span.recordException(error);
54
- // Set error status
55
- span.setStatus({
56
- code: SpanStatusCode.ERROR,
57
- message: errorMessage,
58
- });
59
- // Optionally log the error
60
- if (logger && logMessage) {
61
- logger.error({ error: errorMessage }, logMessage);
62
- }
63
- }
64
- /**
65
- * Get the global tracer instance
66
- * This creates a single tracer for the entire application
67
- */
68
- export function getGlobalTracer() {
69
- if (!globalTracerInstance) {
70
- try {
71
- globalTracerInstance = trace.getTracer(SERVICE_NAME, SERVICE_VERSION);
72
- }
73
- catch (error) {
74
- logger.debug('OpenTelemetry tracer not available, using no-op tracer');
75
- globalTracerInstance = noopTracer;
76
- }
77
- }
78
- return globalTracerInstance;
79
- }
80
- /**
81
- * Force flush the tracer provider to ensure critical spans are sent immediately
82
- * This is useful for critical operations where we want to ensure telemetry data
83
- * is sent before the operation completes or fails
84
- */
85
- export async function forceFlushTracer() {
86
- const isOtelTracesForceFlushEnabled = env.OTEL_TRACES_FORCE_FLUSH_ENABLED;
87
- const isForceFlushEnvironment = env.ENVIRONMENT && FORCE_FLUSH_ENVIRONMENTS.includes(env.ENVIRONMENT);
88
- const shouldForceFlush = isOtelTracesForceFlushEnabled === true ||
89
- (isOtelTracesForceFlushEnabled == null && isForceFlushEnvironment);
90
- if (!shouldForceFlush) {
91
- return;
92
- }
93
- try {
94
- // Import the span processor from instrumentation
95
- const { spanProcessor } = await import('./instrumentation.js');
96
- if (spanProcessor && typeof spanProcessor.forceFlush === 'function') {
97
- await spanProcessor.forceFlush();
98
- logger.debug('Span processor force flush completed');
99
- }
100
- else {
101
- logger.debug('Span processor does not support force flush or is not available');
102
- }
103
- }
104
- catch (error) {
105
- logger.warn({ error }, 'Failed to force flush tracer');
106
- }
107
- }
@@ -1,25 +0,0 @@
1
- export type ContentItem = {
2
- type: string;
3
- text?: string;
4
- };
5
- export type Message = {
6
- role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
7
- content: string | ContentItem[];
8
- name?: string;
9
- };
10
- export type ChatCompletionRequest = {
11
- model: string;
12
- messages: Message[];
13
- temperature?: number;
14
- top_p?: number;
15
- n?: number;
16
- stream?: boolean;
17
- max_tokens?: number;
18
- presence_penalty?: number;
19
- frequency_penalty?: number;
20
- logit_bias?: Record<string, number>;
21
- user?: string;
22
- tools?: Record<string, unknown>;
23
- runConfig?: Record<string, unknown>;
24
- };
25
- //# sourceMappingURL=chat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/types/chat.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;IAC5D,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import type { ExecutionContext } from '@inkeep/agents-core';
2
- /**
3
- * Create execution context from middleware values
4
- */
5
- export declare function createExecutionContext(params: {
6
- apiKey: string;
7
- tenantId: string;
8
- projectId: string;
9
- graphId: string;
10
- apiKeyId: string;
11
- agentId?: string;
12
- baseUrl?: string;
13
- }): ExecutionContext;
14
- //# sourceMappingURL=execution-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/types/execution-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,gBAAgB,CAUnB"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Create execution context from middleware values
3
- */
4
- export function createExecutionContext(params) {
5
- return {
6
- apiKey: params.apiKey,
7
- tenantId: params.tenantId,
8
- projectId: params.projectId,
9
- graphId: params.graphId,
10
- baseUrl: params.baseUrl || process.env.API_URL || 'http://localhost:3003',
11
- apiKeyId: params.apiKeyId,
12
- agentId: params.agentId,
13
- };
14
- }
@@ -1,92 +0,0 @@
1
- /**
2
- * Agent initialization operation event
3
- */
4
- export interface AgentInitializingEvent {
5
- type: 'agent_initializing';
6
- ctx: {
7
- sessionId: string;
8
- graphId: string;
9
- };
10
- }
11
- /**
12
- * Agent ready operation event
13
- */
14
- export interface AgentReadyEvent {
15
- type: 'agent_ready';
16
- ctx: {
17
- sessionId: string;
18
- graphId: string;
19
- };
20
- }
21
- /**
22
- * Completion operation event
23
- */
24
- export interface CompletionEvent {
25
- type: 'completion';
26
- ctx: {
27
- agent: string;
28
- iteration: number;
29
- };
30
- }
31
- /**
32
- * Error operation event
33
- */
34
- export interface ErrorEvent {
35
- type: 'error';
36
- ctx: {
37
- error: string;
38
- agent?: string;
39
- };
40
- }
41
- /**
42
- * Agent thinking operation event
43
- */
44
- export interface AgentThinkingEvent {
45
- type: 'agent_thinking';
46
- ctx: {
47
- agent: string;
48
- };
49
- }
50
- /**
51
- * Status update operation event with flexible structured/unstructured data
52
- */
53
- export interface StatusUpdateEvent {
54
- type: 'status_update';
55
- ctx: {
56
- summary?: string;
57
- [key: string]: any;
58
- };
59
- }
60
- /**
61
- * Discriminated union of all operation events
62
- */
63
- export type OperationEvent = AgentInitializingEvent | AgentReadyEvent | AgentThinkingEvent | CompletionEvent | ErrorEvent | StatusUpdateEvent;
64
- /**
65
- * Creates an agent initializing operation
66
- */
67
- export declare function agentInitializingOp(sessionId: string, graphId: string): AgentInitializingEvent;
68
- /**
69
- * Creates an agent ready operation
70
- */
71
- export declare function agentReadyOp(sessionId: string, graphId: string): AgentReadyEvent;
72
- /**
73
- * Creates an agent thinking operation
74
- */
75
- export declare function agentThinkingOp(agent: string): AgentThinkingEvent;
76
- /**
77
- * Creates a completion operation
78
- */
79
- export declare function completionOp(agentId: string, iterations: number): CompletionEvent;
80
- /**
81
- * Creates an error operation
82
- */
83
- export declare function errorOp(error: string, agentId?: string): ErrorEvent;
84
- /**
85
- * Generate a unique tool execution ID for lifecycle tracking
86
- */
87
- export declare function generateToolId(): string;
88
- /**
89
- * Creates a status update operation with flexible data
90
- */
91
- export declare function statusUpdateOp(ctx: Record<string, any>): StatusUpdateEvent;
92
- //# sourceMappingURL=agent-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-operations.d.ts","sourceRoot":"","sources":["../../src/utils/agent-operations.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,GAAG,EAAE;QACH,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE;QACH,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,EAAE;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,UAAU,GACV,iBAAiB,CAAC;AAMtB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAQ9F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,CAQhF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAOjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe,CAQjF;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAQnE;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,iBAAiB,CAK1E"}
@@ -1,78 +0,0 @@
1
- import { nanoid } from 'nanoid';
2
- // =============================================================================
3
- // OPERATION FUNCTIONS
4
- // =============================================================================
5
- /**
6
- * Creates an agent initializing operation
7
- */
8
- export function agentInitializingOp(sessionId, graphId) {
9
- return {
10
- type: 'agent_initializing',
11
- ctx: {
12
- sessionId,
13
- graphId,
14
- },
15
- };
16
- }
17
- /**
18
- * Creates an agent ready operation
19
- */
20
- export function agentReadyOp(sessionId, graphId) {
21
- return {
22
- type: 'agent_ready',
23
- ctx: {
24
- sessionId,
25
- graphId,
26
- },
27
- };
28
- }
29
- /**
30
- * Creates an agent thinking operation
31
- */
32
- export function agentThinkingOp(agent) {
33
- return {
34
- type: 'agent_thinking',
35
- ctx: {
36
- agent,
37
- },
38
- };
39
- }
40
- /**
41
- * Creates a completion operation
42
- */
43
- export function completionOp(agentId, iterations) {
44
- return {
45
- type: 'completion',
46
- ctx: {
47
- agent: agentId,
48
- iteration: iterations,
49
- },
50
- };
51
- }
52
- /**
53
- * Creates an error operation
54
- */
55
- export function errorOp(error, agentId) {
56
- return {
57
- type: 'error',
58
- ctx: {
59
- error,
60
- agent: agentId,
61
- },
62
- };
63
- }
64
- /**
65
- * Generate a unique tool execution ID for lifecycle tracking
66
- */
67
- export function generateToolId() {
68
- return `tool_${nanoid(8)}`;
69
- }
70
- /**
71
- * Creates a status update operation with flexible data
72
- */
73
- export function statusUpdateOp(ctx) {
74
- return {
75
- type: 'status_update',
76
- ctx,
77
- };
78
- }
@@ -1,29 +0,0 @@
1
- import type { ArtifactComponentApiSelect, DataComponentInsert } from '@inkeep/agents-core';
2
- import { z } from 'zod';
3
- /**
4
- * Converts artifact component configurations to Zod schema for structured generation
5
- */
6
- export declare function createArtifactComponentsSchema(artifactComponents?: ArtifactComponentApiSelect[]): z.ZodObject<{}, z.core.$strip> | z.ZodUnion<any>;
7
- /**
8
- * Create schema for artifact component summary props only (for quick display)
9
- */
10
- export declare function createArtifactComponentsSummarySchema(artifactComponents?: ArtifactComponentApiSelect[]): z.ZodUnion<any> | z.ZodObject<{}, z.core.$strip>;
11
- /**
12
- * Create schema for artifact component full props only (for detailed display)
13
- */
14
- export declare function createArtifactComponentsFullSchema(artifactComponents?: ArtifactComponentApiSelect[]): z.ZodUnion<any> | z.ZodObject<{}, z.core.$strip>;
15
- /**
16
- * Standard artifact reference component schema for tool responses
17
- */
18
- export declare class ArtifactReferenceSchema {
19
- private static readonly ARTIFACT_PROPS_SCHEMA;
20
- /**
21
- * Get the standard Zod schema for artifact reference components
22
- */
23
- static getSchema(): z.ZodType<any>;
24
- /**
25
- * Get complete DataComponent by adding missing fields to base definition
26
- */
27
- static getDataComponent(tenantId: string, projectId?: string): DataComponentInsert;
28
- }
29
- //# sourceMappingURL=artifact-component-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-component-schema.d.ts","sourceRoot":"","sources":["../../src/utils/artifact-component-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,kBAAkB,CAAC,EAAE,0BAA0B,EAAE,oDA2B/F;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,kBAAkB,CAAC,EAAE,0BAA0B,EAAE,oDAsBlD;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,kBAAkB,CAAC,EAAE,0BAA0B,EAAE,oDAsBlD;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAe3C;IAEF;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAQlC;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW,GAAG,mBAAmB;CAWvF"}
@@ -1,119 +0,0 @@
1
- import { z } from 'zod';
2
- import { getLogger } from '../logger';
3
- import { jsonSchemaToZod } from './data-component-schema';
4
- const logger = getLogger('ArtifactComponentSchema');
5
- /**
6
- * Converts artifact component configurations to Zod schema for structured generation
7
- */
8
- export function createArtifactComponentsSchema(artifactComponents) {
9
- // Convert artifact component configs to a union schema
10
- const componentSchemas = artifactComponents?.map((component) => {
11
- // Convert the JSON Schema props to Zod - handle both summaryProps and fullProps
12
- const summaryPropsSchema = jsonSchemaToZod(component.summaryProps);
13
- const fullPropsSchema = jsonSchemaToZod(component.fullProps);
14
- // Return schema with both summary and full props
15
- return z
16
- .object({
17
- id: z.string().describe(component.id),
18
- name: z.literal(component.name).describe(component.name),
19
- summaryProps: summaryPropsSchema,
20
- fullProps: fullPropsSchema,
21
- })
22
- .describe(`${component.name}: ${component.description}`);
23
- }) || [];
24
- // Return union of all component schemas - z.union requires at least 2 schemas
25
- if (componentSchemas.length === 0) {
26
- return z.object({}); // Empty object for no components
27
- }
28
- if (componentSchemas.length === 1) {
29
- return componentSchemas[0]; // Single schema doesn't need union
30
- }
31
- return z.union(componentSchemas); // Safe union with 2+ schemas
32
- }
33
- /**
34
- * Create schema for artifact component summary props only (for quick display)
35
- */
36
- export function createArtifactComponentsSummarySchema(artifactComponents) {
37
- const componentSchemas = artifactComponents?.map((component) => {
38
- const summaryPropsSchema = jsonSchemaToZod(component.summaryProps);
39
- return z
40
- .object({
41
- id: z.string().describe(component.id),
42
- name: z.literal(component.name).describe(component.name),
43
- summaryProps: summaryPropsSchema,
44
- })
45
- .describe(`${component.name} Summary: ${component.description}`);
46
- }) || [];
47
- if (componentSchemas.length === 0) {
48
- return z.object({});
49
- }
50
- if (componentSchemas.length === 1) {
51
- return componentSchemas[0];
52
- }
53
- return z.union(componentSchemas);
54
- }
55
- /**
56
- * Create schema for artifact component full props only (for detailed display)
57
- */
58
- export function createArtifactComponentsFullSchema(artifactComponents) {
59
- const componentSchemas = artifactComponents?.map((component) => {
60
- const fullPropsSchema = jsonSchemaToZod(component.fullProps);
61
- return z
62
- .object({
63
- id: z.string().describe(component.id),
64
- name: z.literal(component.name).describe(component.name),
65
- fullProps: fullPropsSchema,
66
- })
67
- .describe(`${component.name} Full: ${component.description}`);
68
- }) || [];
69
- if (componentSchemas.length === 0) {
70
- return z.object({});
71
- }
72
- if (componentSchemas.length === 1) {
73
- return componentSchemas[0];
74
- }
75
- return z.union(componentSchemas);
76
- }
77
- /**
78
- * Standard artifact reference component schema for tool responses
79
- */
80
- export class ArtifactReferenceSchema {
81
- // Standard artifact props schema - single source of truth
82
- static ARTIFACT_PROPS_SCHEMA = {
83
- type: 'object',
84
- properties: {
85
- artifact_id: {
86
- type: 'string',
87
- description: 'The EXACT artifact_id from save_tool_result tool output. NEVER invent or make up IDs.',
88
- },
89
- task_id: {
90
- type: 'string',
91
- description: 'The EXACT task_id from save_tool_result tool output. NEVER invent or make up IDs.',
92
- },
93
- },
94
- required: ['artifact_id', 'task_id'],
95
- };
96
- /**
97
- * Get the standard Zod schema for artifact reference components
98
- */
99
- static getSchema() {
100
- return z.object({
101
- id: z.string(),
102
- name: z.literal('Artifact'),
103
- props: jsonSchemaToZod(ArtifactReferenceSchema.ARTIFACT_PROPS_SCHEMA),
104
- });
105
- }
106
- /**
107
- * Get complete DataComponent by adding missing fields to base definition
108
- */
109
- static getDataComponent(tenantId, projectId = '') {
110
- return {
111
- id: 'The EXACT artifact_id from save_tool_result tool output. NEVER invent or make up IDs.',
112
- tenantId: tenantId,
113
- projectId: projectId,
114
- name: 'Artifact',
115
- description: 'Reference to saved content from tool results that grounds information in verifiable sources.',
116
- props: ArtifactReferenceSchema.ARTIFACT_PROPS_SCHEMA,
117
- };
118
- }
119
- }
@@ -1,71 +0,0 @@
1
- export interface StreamPart {
2
- kind: 'text' | 'data';
3
- text?: string;
4
- data?: any;
5
- }
6
- export interface ArtifactData {
7
- artifactId: string;
8
- taskId: string;
9
- name: string;
10
- description: string;
11
- artifactType?: string;
12
- artifactSummary: any;
13
- }
14
- /**
15
- * Unified artifact parser that handles all artifact-related parsing and formatting
16
- * Used by both ResponseFormatter and IncrementalStreamParser to eliminate redundancy
17
- */
18
- export declare class ArtifactParser {
19
- private tenantId;
20
- private static readonly ARTIFACT_REGEX;
21
- private static readonly ARTIFACT_CHECK_REGEX;
22
- private static readonly INCOMPLETE_ARTIFACT_REGEX;
23
- constructor(tenantId: string);
24
- /**
25
- * Check if text contains complete artifact markers
26
- */
27
- hasArtifactMarkers(text: string): boolean;
28
- /**
29
- * Check if text has incomplete artifact marker (for streaming)
30
- * More robust detection that handles streaming fragments
31
- */
32
- hasIncompleteArtifact(text: string): boolean;
33
- /**
34
- * Find safe text boundary before incomplete artifacts (for streaming)
35
- * Enhanced to handle streaming chunks that split in the middle of artifacts
36
- */
37
- findSafeTextBoundary(text: string): number;
38
- /**
39
- * Get all artifacts for a context (with caching opportunity)
40
- */
41
- getContextArtifacts(contextId: string): Promise<Map<string, any>>;
42
- /**
43
- * Convert raw artifact to standardized data format
44
- */
45
- private formatArtifactData;
46
- /**
47
- * Parse text with artifact markers into parts array
48
- * Can work with or without pre-fetched artifact map
49
- */
50
- parseText(text: string, artifactMap?: Map<string, any>): Promise<StreamPart[]>;
51
- /**
52
- * Process object/dataComponents for artifact components
53
- */
54
- parseObject(obj: any, artifactMap?: Map<string, any>): Promise<StreamPart[]>;
55
- /**
56
- * Check if object is an artifact component
57
- */
58
- private isArtifactComponent;
59
- /**
60
- * Get artifact data from map or fetch directly
61
- */
62
- private getArtifactData;
63
- /**
64
- * Parse partial JSON buffer (for streaming)
65
- */
66
- parsePartialJSON(buffer: string): {
67
- complete: any[];
68
- remaining: string;
69
- };
70
- }
71
- //# sourceMappingURL=artifact-parser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"artifact-parser.d.ts","sourceRoot":"","sources":["../../src/utils/artifact-parser.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,GAAG,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,cAAc;IAWb,OAAO,CAAC,QAAQ;IAT5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CACsB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CACmB;IAG/D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CACQ;gBAErC,QAAQ,EAAE,MAAM;IAEpC;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC;;;OAGG;IACH,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAS5C;;;OAGG;IACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAoC1C;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAqCvE;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;;OAGG;IACG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IA2CpF;;OAEG;IACG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAoClF;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;YACW,eAAe;IAwC7B;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;CA2BzE"}