@gt-fe/eap-sdk 0.1.13 → 0.2.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.
Files changed (100) hide show
  1. package/README.md +452 -376
  2. package/dist/lockfile/resolve-dependencies.d.ts +1 -0
  3. package/dist/lockfile/resolve-dependencies.d.ts.map +1 -1
  4. package/dist/lockfile/resolve-dependencies.js +3 -0
  5. package/dist/lockfile/resolve-dependencies.js.map +1 -1
  6. package/dist/materialization/copy-resource-directory.d.ts +1 -0
  7. package/dist/materialization/copy-resource-directory.d.ts.map +1 -1
  8. package/dist/materialization/copy-resource-directory.js +38 -1
  9. package/dist/materialization/copy-resource-directory.js.map +1 -1
  10. package/dist/materialization/index.d.ts +1 -1
  11. package/dist/materialization/index.d.ts.map +1 -1
  12. package/dist/materialization/index.js +1 -1
  13. package/dist/materialization/index.js.map +1 -1
  14. package/dist/materialization/load-agent-runtime.d.ts +19 -0
  15. package/dist/materialization/load-agent-runtime.d.ts.map +1 -0
  16. package/dist/materialization/load-agent-runtime.js +128 -0
  17. package/dist/materialization/load-agent-runtime.js.map +1 -0
  18. package/dist/materialization/prepare-agent-runtime.d.ts +6 -0
  19. package/dist/materialization/prepare-agent-runtime.d.ts.map +1 -1
  20. package/dist/materialization/prepare-agent-runtime.js +108 -46
  21. package/dist/materialization/prepare-agent-runtime.js.map +1 -1
  22. package/dist/materialization/types.d.ts +0 -2
  23. package/dist/materialization/types.d.ts.map +1 -1
  24. package/dist/packaging/package-agent-project.d.ts.map +1 -1
  25. package/dist/packaging/package-agent-project.js +2 -4
  26. package/dist/packaging/package-agent-project.js.map +1 -1
  27. package/dist/packaging/read-package.d.ts.map +1 -1
  28. package/dist/packaging/read-package.js +20 -1
  29. package/dist/packaging/read-package.js.map +1 -1
  30. package/dist/platform/client.d.ts.map +1 -1
  31. package/dist/platform/client.js +13 -2
  32. package/dist/platform/client.js.map +1 -1
  33. package/dist/platform/types.d.ts +2 -0
  34. package/dist/platform/types.d.ts.map +1 -1
  35. package/dist/project/agent-project.d.ts.map +1 -1
  36. package/dist/project/agent-project.js +10 -0
  37. package/dist/project/agent-project.js.map +1 -1
  38. package/dist/resources/configured-local-resources.d.ts +15 -0
  39. package/dist/resources/configured-local-resources.d.ts.map +1 -0
  40. package/dist/resources/configured-local-resources.js +75 -0
  41. package/dist/resources/configured-local-resources.js.map +1 -0
  42. package/dist/resources/install-agent-dependencies.d.ts.map +1 -1
  43. package/dist/resources/install-agent-dependencies.js +7 -2
  44. package/dist/resources/install-agent-dependencies.js.map +1 -1
  45. package/dist/schema/agent/manifest.d.ts +832 -197
  46. package/dist/schema/agent/manifest.d.ts.map +1 -1
  47. package/dist/schema/graph.d.ts +1295 -403
  48. package/dist/schema/graph.d.ts.map +1 -1
  49. package/dist/schema/graph.js +29 -16
  50. package/dist/schema/graph.js.map +1 -1
  51. package/dist/schema/lockfile.d.ts +30 -30
  52. package/dist/schema/project-config.d.ts +6 -0
  53. package/dist/schema/project-config.d.ts.map +1 -1
  54. package/dist/schema/project-config.js +4 -0
  55. package/dist/schema/project-config.js.map +1 -1
  56. package/dist/service/create-agent.d.ts +8 -0
  57. package/dist/service/create-agent.d.ts.map +1 -0
  58. package/dist/service/create-agent.js +338 -0
  59. package/dist/service/create-agent.js.map +1 -0
  60. package/dist/service/events.d.ts +14 -45
  61. package/dist/service/events.d.ts.map +1 -1
  62. package/dist/service/events.js +46 -1
  63. package/dist/service/events.js.map +1 -1
  64. package/dist/service/index.d.ts +5 -2
  65. package/dist/service/index.d.ts.map +1 -1
  66. package/dist/service/index.js +4 -1
  67. package/dist/service/index.js.map +1 -1
  68. package/dist/service/messages.d.ts +13 -0
  69. package/dist/service/messages.d.ts.map +1 -0
  70. package/dist/service/messages.js +24 -0
  71. package/dist/service/messages.js.map +1 -0
  72. package/dist/service/resources.d.ts +86 -0
  73. package/dist/service/resources.d.ts.map +1 -0
  74. package/dist/service/resources.js +26 -0
  75. package/dist/service/resources.js.map +1 -0
  76. package/dist/service/runtime-adapter.d.ts.map +1 -1
  77. package/dist/service/runtime-adapter.js +26 -2
  78. package/dist/service/runtime-adapter.js.map +1 -1
  79. package/dist/service/sessions.d.ts +33 -0
  80. package/dist/service/sessions.d.ts.map +1 -0
  81. package/dist/service/sessions.js +67 -0
  82. package/dist/service/sessions.js.map +1 -0
  83. package/dist/service/types.d.ts +121 -32
  84. package/dist/service/types.d.ts.map +1 -1
  85. package/dist/validation/validate-agent-project.d.ts.map +1 -1
  86. package/dist/validation/validate-agent-project.js +31 -17
  87. package/dist/validation/validate-agent-project.js.map +1 -1
  88. package/package.json +4 -4
  89. package/dist/materialization/sync-author-resources.d.ts +0 -21
  90. package/dist/materialization/sync-author-resources.d.ts.map +0 -1
  91. package/dist/materialization/sync-author-resources.js +0 -98
  92. package/dist/materialization/sync-author-resources.js.map +0 -1
  93. package/dist/service/create-agent-service.d.ts +0 -12
  94. package/dist/service/create-agent-service.d.ts.map +0 -1
  95. package/dist/service/create-agent-service.js +0 -283
  96. package/dist/service/create-agent-service.js.map +0 -1
  97. package/dist/service/http-server.d.ts +0 -4
  98. package/dist/service/http-server.d.ts.map +0 -1
  99. package/dist/service/http-server.js +0 -89
  100. package/dist/service/http-server.js.map +0 -1
@@ -0,0 +1,338 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { loadAgentRuntime } from '../materialization/index.js';
4
+ import { sha256, writeFileAtomically } from '../resources/resource-files.js';
5
+ import { toSha256Hex } from '../digest.js';
6
+ import { AgentManifestSchema } from '../schema/index.js';
7
+ import { validateGraph } from '../validation/index.js';
8
+ import { createRuntimeForPrepared } from './runtime-adapter.js';
9
+ import { createEventManager } from './events.js';
10
+ import { createMessageManager } from './messages.js';
11
+ import { createSessionManager } from './sessions.js';
12
+ import { createUnavailableResourceManager } from './resources.js';
13
+ /**
14
+ * Creates an Agent API from an already materialized Runtime directory.
15
+ * Runtime preparation is explicit and is shared by development and build.
16
+ */
17
+ export async function createAgent(options = {}) {
18
+ const prepared = loadAgentRuntime({
19
+ runtimeRoot: options.runtimeRoot,
20
+ agentCode: options.agentCode,
21
+ version: options.version,
22
+ });
23
+ const runtimeRoot = prepared.runtimeRoot;
24
+ const target = {
25
+ root: runtimeRoot,
26
+ agentCode: prepared.agentCode,
27
+ version: prepared.version,
28
+ manifestPath: prepared.manifestPath,
29
+ graphPath: prepared.graphPath,
30
+ };
31
+ const embeddedConfig = options.embeddedConfig;
32
+ validateEmbeddedConfig(options.deploymentContext ?? 'server', embeddedConfig, options.runtimeFactory);
33
+ const environment = resolveAgentRuntimeEnvironment(runtimeRoot, options.deploymentContext ?? 'server', options.sessionPersistence ?? false, options.sessionDirectory, {
34
+ ...(embeddedConfig?.platform?.portalEndpoint ? { EAP_PLATFORM_ENDPOINT: embeddedConfig.platform.portalEndpoint } : {}),
35
+ ...(embeddedConfig?.platform?.foundationEndpoint ? { FOUNDATION_SERVICE_URL: embeddedConfig.platform.foundationEndpoint } : {}),
36
+ ...options.environment,
37
+ ...embeddedConfig?.runtime?.environment,
38
+ });
39
+ const runtimeFactory = options.runtimeFactory ?? createRuntimeForPrepared;
40
+ const credentials = embeddedConfig?.credentials;
41
+ const runtime = await createRuntime(target, prepared, runtimeFactory, environment, credentials?.provider, credentials?.developmentToken);
42
+ return new RuntimeAgent(target, prepared, runtime, runtimeFactory, environment, embeddedConfig);
43
+ }
44
+ class RuntimeAgent {
45
+ target;
46
+ prepared;
47
+ runtimeFactory;
48
+ environment;
49
+ graph;
50
+ config;
51
+ resources;
52
+ sessions;
53
+ messages;
54
+ events;
55
+ credentials;
56
+ currentRuntime;
57
+ disposed = false;
58
+ reloadQueue = Promise.resolve({ status: 'effective', revision: 'initial' });
59
+ configRevision = 'initial';
60
+ pendingConfig = {};
61
+ graphPending = false;
62
+ eventManager = createEventManager();
63
+ developmentToken;
64
+ constructor(target, prepared, runtime, runtimeFactory, environment, embeddedConfig) {
65
+ this.target = target;
66
+ this.prepared = prepared;
67
+ this.runtimeFactory = runtimeFactory;
68
+ this.environment = environment;
69
+ this.currentRuntime = runtime;
70
+ this.graph = new MaterializedGraphApi(this, target.graphPath, target.manifestPath);
71
+ this.config = new RuntimeConfigApi(this);
72
+ this.resources = embeddedConfig?.resources?.manager ?? createUnavailableResourceManager();
73
+ this.sessions = createSessionManager(() => this.currentRuntime, target.agentCode);
74
+ this.messages = createMessageManager(() => this.currentRuntime);
75
+ this.events = this.eventManager;
76
+ this.credentials = embeddedConfig?.credentials.provider;
77
+ this.developmentToken = embeddedConfig?.credentials.developmentToken;
78
+ }
79
+ get runtime() {
80
+ return this.currentRuntime;
81
+ }
82
+ async invoke(input, options = {}) {
83
+ const runtime = this.currentRuntime;
84
+ const { onEvent, onEventError, ...request } = options;
85
+ const authenticatedRequest = await this.withRequestCredential(request);
86
+ const result = await runtime.agentRuntime.execute({
87
+ ...authenticatedRequest,
88
+ input,
89
+ agentCode: this.target.agentCode,
90
+ });
91
+ return result;
92
+ }
93
+ stream(input, options = {}) {
94
+ const runtime = this.currentRuntime;
95
+ const { onEvent, onEventError, ...request } = options;
96
+ return this.withEvents(runtime, input, request, onEvent, onEventError);
97
+ }
98
+ async *withEvents(runtime, input, request, onEvent, onEventError) {
99
+ const authenticatedRequest = await this.withRequestCredential(request);
100
+ const events = runtime.agentRuntime.stream({ ...authenticatedRequest, input, agentCode: this.target.agentCode });
101
+ for await (const event of events) {
102
+ this.eventManager.emit(event);
103
+ if (onEvent)
104
+ await invokeEventCallback(onEvent, onEventError, event);
105
+ yield event;
106
+ }
107
+ }
108
+ async withRequestCredential(request) {
109
+ if (!this.credentials || !request.executionContext)
110
+ return request;
111
+ const credential = await this.credentials.getToken({
112
+ audience: 'runtime',
113
+ agentCode: this.target.agentCode,
114
+ requestId: request.executionContext.correlationId,
115
+ });
116
+ if (!credential.value.trim())
117
+ throw new Error('AgentCredentialProvider returned an empty runtime token');
118
+ return {
119
+ ...request,
120
+ executionContext: { ...request.executionContext, delegationToken: credential.value },
121
+ };
122
+ }
123
+ getConversation(sessionId) {
124
+ return this.currentRuntime.agentRuntime.getConversation(sessionId);
125
+ }
126
+ listConversations(options) {
127
+ return this.currentRuntime.agentRuntime.listConversations(options);
128
+ }
129
+ listLlmTurns(sessionId) {
130
+ return this.currentRuntime.agentRuntime.listLlmTurns(sessionId);
131
+ }
132
+ getLlmTurn(sessionId, turnId) {
133
+ return this.currentRuntime.agentRuntime.getLlmTurn(sessionId, turnId);
134
+ }
135
+ reload() {
136
+ const nextReload = this.reloadQueue.then(async () => {
137
+ if (this.disposed)
138
+ throw new Error('Agent is already disposed');
139
+ const nextPrepared = loadAgentRuntime({
140
+ runtimeRoot: this.prepared.runtimeRoot,
141
+ agentCode: this.target.agentCode,
142
+ version: this.target.version,
143
+ });
144
+ let nextRuntime;
145
+ try {
146
+ nextRuntime = await createRuntime(this.target, nextPrepared, this.runtimeFactory, this.environment, this.credentials, this.developmentToken);
147
+ }
148
+ catch (error) {
149
+ return {
150
+ status: 'failed',
151
+ revision: this.configRevision,
152
+ error: { code: 'runtime_unavailable', message: error instanceof Error ? error.message : String(error) },
153
+ };
154
+ }
155
+ const previousRuntime = this.currentRuntime;
156
+ this.currentRuntime = nextRuntime;
157
+ previousRuntime.dispose?.();
158
+ this.graphPending = false;
159
+ return { status: 'effective', revision: this.configRevision };
160
+ });
161
+ this.reloadQueue = nextReload.catch((error) => ({
162
+ status: 'failed',
163
+ revision: this.configRevision,
164
+ error: { code: 'runtime_unavailable', message: error instanceof Error ? error.message : String(error) },
165
+ }));
166
+ return nextReload;
167
+ }
168
+ dispose() {
169
+ if (this.disposed)
170
+ return;
171
+ this.disposed = true;
172
+ this.currentRuntime.dispose?.();
173
+ }
174
+ async replaceGraph(graph) {
175
+ const graphPath = this.target.graphPath;
176
+ const snapshotPath = resolve(this.prepared.agentDir, 'snapshot.json');
177
+ const oldGraph = readFileSync(graphPath);
178
+ const oldSnapshot = readFileSync(snapshotPath);
179
+ const serialized = `${JSON.stringify(graph, null, 2)}\n`;
180
+ const nextSnapshot = updateGraphSnapshot(oldSnapshot, Buffer.from(serialized, 'utf8'));
181
+ writeFileAtomically(graphPath, serialized);
182
+ try {
183
+ writeFileAtomically(snapshotPath, nextSnapshot);
184
+ this.configRevision = nextRevision(this.configRevision);
185
+ this.graphPending = true;
186
+ }
187
+ catch (error) {
188
+ writeFileAtomically(graphPath, oldGraph);
189
+ writeFileAtomically(snapshotPath, oldSnapshot);
190
+ throw error;
191
+ }
192
+ }
193
+ getConfig() {
194
+ return {
195
+ revision: this.configRevision,
196
+ pending: this.graphPending || Object.keys(this.pendingConfig).length > 0,
197
+ environment: { ...this.environment, ...(this.pendingConfig.environment ?? {}) },
198
+ };
199
+ }
200
+ async writeConfig(patch) {
201
+ this.pendingConfig = {
202
+ ...this.pendingConfig,
203
+ ...patch,
204
+ ...(patch.environment ? { environment: { ...(this.pendingConfig.environment ?? {}), ...patch.environment } } : {}),
205
+ };
206
+ this.configRevision = nextRevision(this.configRevision);
207
+ return { revision: this.configRevision, status: 'pending', requiresReload: true };
208
+ }
209
+ async applyConfig() {
210
+ Object.assign(this.environment, this.pendingConfig.environment ?? {});
211
+ const result = await this.reload();
212
+ if (result.status === 'effective') {
213
+ this.pendingConfig = {};
214
+ this.graphPending = false;
215
+ }
216
+ return result;
217
+ }
218
+ }
219
+ class MaterializedGraphApi {
220
+ agent;
221
+ graphPath;
222
+ manifestPath;
223
+ constructor(agent, graphPath, manifestPath) {
224
+ this.agent = agent;
225
+ this.graphPath = graphPath;
226
+ this.manifestPath = manifestPath;
227
+ }
228
+ read() {
229
+ return parseRuntimeGraph(readJson(this.graphPath, 'Runtime Graph'), this.graphPath, this.manifestPath);
230
+ }
231
+ async replace(graph) {
232
+ const parsed = parseRuntimeGraph(graph, this.graphPath, this.manifestPath);
233
+ await this.agent.replaceGraph(parsed);
234
+ return { revision: this.agent.getConfig().revision, status: 'pending', requiresReload: true };
235
+ }
236
+ async update(updater) {
237
+ const current = this.read();
238
+ const updated = await updater(current);
239
+ const next = updated ?? current;
240
+ return this.replace(next);
241
+ }
242
+ }
243
+ class RuntimeConfigApi {
244
+ agent;
245
+ constructor(agent) {
246
+ this.agent = agent;
247
+ }
248
+ read() { return this.agent.getConfig(); }
249
+ write(patch) { return this.agent.writeConfig(patch); }
250
+ apply() { return this.agent.applyConfig(); }
251
+ }
252
+ async function invokeEventCallback(callback, mode, event) {
253
+ try {
254
+ await callback(event);
255
+ }
256
+ catch (error) {
257
+ if (mode === 'throw')
258
+ throw error;
259
+ // Event callbacks are observers; by default they cannot change Runtime results.
260
+ }
261
+ }
262
+ function validateEmbeddedConfig(deploymentContext, config, runtimeFactory) {
263
+ if (deploymentContext !== 'server')
264
+ return;
265
+ if (runtimeFactory)
266
+ return;
267
+ if (!config) {
268
+ throw new Error('Server Agent requires embeddedConfig.credentials.provider or an authenticated runtime adapter');
269
+ }
270
+ if (config.credentials.provider)
271
+ return;
272
+ if (config.credentials.developmentToken) {
273
+ throw new Error('developmentToken cannot be used with server deployment; configure credentials.provider');
274
+ }
275
+ throw new Error('Server Agent requires embeddedConfig.credentials.provider or an authenticated runtime adapter');
276
+ }
277
+ function nextRevision(current) {
278
+ if (current === 'initial')
279
+ return '1';
280
+ const numeric = Number(current);
281
+ return Number.isInteger(numeric) ? String(numeric + 1) : `${current}.next`;
282
+ }
283
+ async function createRuntime(target, prepared, runtimeFactory, environment, provider, developmentToken) {
284
+ const runtimeEnvironment = { ...environment };
285
+ if (provider) {
286
+ const credential = await provider.getToken({ audience: 'runtime', agentCode: target.agentCode });
287
+ if (!credential.value.trim())
288
+ throw new Error('AgentCredentialProvider returned an empty runtime token');
289
+ runtimeEnvironment.EAP_DELEGATION_TOKEN = credential.value;
290
+ }
291
+ else if (developmentToken?.trim()) {
292
+ runtimeEnvironment.EAP_DELEGATION_TOKEN = developmentToken;
293
+ }
294
+ return runtimeFactory(prepared, runtimeEnvironment);
295
+ }
296
+ function parseRuntimeGraph(value, graphPath, manifestPath) {
297
+ const manifest = AgentManifestSchema.parse(readJson(manifestPath, 'Runtime Agent manifest'));
298
+ const validation = validateGraph(value, graphPath, manifest);
299
+ const errors = validation.issues.filter((issue) => issue.severity === 'error');
300
+ if (errors.length > 0 || !validation.graph) {
301
+ throw new Error(`Runtime Graph is invalid: ${errors.map((issue) => issue.message).join('; ')}`);
302
+ }
303
+ return validation.graph;
304
+ }
305
+ function updateGraphSnapshot(snapshotData, graphData) {
306
+ const snapshot = JSON.parse(snapshotData.toString('utf8'));
307
+ const graphArtifact = snapshot.artifacts.find((artifact) => artifact.path === 'graph.json');
308
+ if (!graphArtifact)
309
+ throw new Error('Runtime snapshot is missing graph.json');
310
+ graphArtifact.sha256 = toSha256Hex(sha256(graphData));
311
+ return `${JSON.stringify(snapshot, null, 2)}\n`;
312
+ }
313
+ export function resolveAgentRuntimeEnvironment(runtimeRoot, deploymentContext, sessionPersistence, sessionDirectory, environment) {
314
+ const runtimeDirectory = resolve(runtimeRoot);
315
+ const resolvedEnvironment = {
316
+ ...environment,
317
+ EAP_PREINSTALL_ROOT: runtimeDirectory,
318
+ EAP_DEPLOYMENT_CONTEXT: deploymentContext,
319
+ EAP_RUNTIME_STORAGE_PROFILE: sessionPersistence ? 'dev' : 'test',
320
+ EAP_LLM_TURN_DIR: resolve(runtimeDirectory, '..', 'llm-turns'),
321
+ };
322
+ if (sessionPersistence) {
323
+ const directory = resolve(sessionDirectory ?? resolve(runtimeDirectory, '..', 'sessions'));
324
+ resolvedEnvironment.EAP_SESSION_DIR = directory;
325
+ resolvedEnvironment.EAP_MESSAGE_DIR = resolve(directory, 'messages');
326
+ }
327
+ return resolvedEnvironment;
328
+ }
329
+ function readJson(path, label) {
330
+ try {
331
+ return JSON.parse(readFileSync(path, 'utf8'));
332
+ }
333
+ catch (error) {
334
+ const reason = error instanceof Error ? error.message : String(error);
335
+ throw new Error(`${label} is not valid JSON: ${path} (${reason})`);
336
+ }
337
+ }
338
+ //# sourceMappingURL=create-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create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AC/D,CAAC;IACF,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QAC3F,mBAAmB,CAAC,eAAe,GAAG,SAAS,CAAC;QAChD,mBAAmB,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa;IAC3C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,uBAAuB,IAAI,KAAK,MAAM,GAAG,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
@@ -1,49 +1,18 @@
1
- import type { SSEEvent, ToolCalledPayload, ToolErrorPayload, ToolProgressPayload, ToolResultPayload } from '@gt-fe/eap-runtime';
2
- /**
3
- * Payload shared by the Runtime SSE events exposed through AgentService.
4
- * Runtime keeps the top-level event payload open-ended, so the SDK records
5
- * the stable fields consumed by CLI and embedding clients here.
6
- */
7
- export interface AgentServiceEventPayload extends Record<string, unknown> {
8
- correlationId?: string;
1
+ import type { SSEEvent } from '@gt-fe/eap-runtime';
2
+ export type { SSEEvent } from '@gt-fe/eap-runtime';
3
+ export type { SSEEventType, SSEEventPayloadMap, SseEventLevel, } from '@gt-fe/eap-runtime';
4
+ export { CORE_SSE_EVENTS, OPTIONAL_SSE_EVENTS, isCoreEvent, isOptionalEvent, getEventLevel, } from '@gt-fe/eap-runtime';
5
+ export type Unsubscribe = () => void;
6
+ export type EventFilter = string | readonly string[] | {
7
+ types?: readonly string[];
9
8
  taskId?: string;
10
- timestamp?: string;
11
- chunk?: string;
12
- delta?: string;
13
- toolCallId?: string;
14
- toolName?: string;
15
- arguments?: Record<string, unknown>;
16
- content?: unknown;
17
- thought?: string;
18
- message?: string;
19
- success?: boolean;
20
- status?: string;
21
- progress?: number;
22
- error?: string;
23
- executionTime?: number;
24
- willRetry?: boolean;
25
- duration?: number;
26
- durationMs?: number;
27
- nodeId?: string;
28
- /** Runtime currently emits this graph node field in event payloads. */
29
- node?: string;
30
- graphId?: string;
31
- iterationCount?: number;
32
- choice?: string;
33
- state?: unknown;
34
- data?: unknown;
35
- model?: string;
36
- inputTokens?: number;
37
- outputTokens?: number;
38
- total?: unknown;
39
- tokenUsage?: unknown;
40
- question?: string;
41
- options?: string[];
9
+ correlationId?: string;
10
+ } | ((event: SSEEvent) => boolean);
11
+ export interface AgentEventManager {
12
+ subscribe(filter: EventFilter | undefined, handler: (event: SSEEvent) => void): Unsubscribe;
42
13
  }
43
- export type AgentToolEventPayload = ToolCalledPayload | ToolResultPayload | ToolProgressPayload | ToolErrorPayload;
44
- export type AgentServiceStreamEvent<TType extends string = string, TData = AgentServiceEventPayload> = Omit<SSEEvent, 'type' | 'data'> & {
45
- type: TType;
46
- data: TData;
14
+ export declare function createEventManager(): AgentEventManager & {
15
+ emit(event: SSEEvent): void;
16
+ clear(): void;
47
17
  };
48
- export type AgentToolStreamEvent = AgentServiceStreamEvent<'tool.called', ToolCalledPayload> | AgentServiceStreamEvent<'tool.result', ToolResultPayload> | AgentServiceStreamEvent<'tool.progress', ToolProgressPayload> | AgentServiceStreamEvent<'tool.error', ToolErrorPayload>;
49
18
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/service/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ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AC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACC,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,WAAW,CAAC;CAC7F;AAOD,wBAAgB,kBAAkB,IAAI,iBAAiB,GAAG;IAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,KAAK,IAAI,IAAI,CAAA;CAAE,CAsBvG"}
@@ -1,2 +1,47 @@
1
- export {};
1
+ export { CORE_SSE_EVENTS, OPTIONAL_SSE_EVENTS, isCoreEvent, isOptionalEvent, getEventLevel, } from '@gt-fe/eap-runtime';
2
+ export function createEventManager() {
3
+ const subscriptions = new Set();
4
+ return {
5
+ subscribe(filter, handler) {
6
+ const subscription = { filter, handler };
7
+ subscriptions.add(subscription);
8
+ return () => subscriptions.delete(subscription);
9
+ },
10
+ emit(event) {
11
+ for (const { filter, handler } of [...subscriptions]) {
12
+ if (!matchesFilter(event, filter))
13
+ continue;
14
+ try {
15
+ handler(event);
16
+ }
17
+ catch {
18
+ // Event listeners are observers and must not interrupt Runtime execution.
19
+ }
20
+ }
21
+ },
22
+ clear() {
23
+ subscriptions.clear();
24
+ },
25
+ };
26
+ }
27
+ function matchesFilter(event, filter) {
28
+ if (!filter)
29
+ return true;
30
+ if (typeof filter === 'function')
31
+ return filter(event);
32
+ if (typeof filter === 'string')
33
+ return event.type === filter;
34
+ if (Array.isArray(filter))
35
+ return filter.includes(event.type);
36
+ if (typeof filter !== 'object')
37
+ return false;
38
+ const criteria = filter;
39
+ if (criteria.types && !criteria.types.includes(event.type))
40
+ return false;
41
+ if (criteria.taskId && criteria.taskId !== event.taskId)
42
+ return false;
43
+ if (criteria.correlationId && criteria.correlationId !== event.correlationId)
44
+ return false;
45
+ return true;
46
+ }
2
47
  //# sourceMappingURL=events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/service/events.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/service/events.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,oBAAoB,CAAC;AAuB5B,MAAM,UAAU,kBAAkB;IAChC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAgB,CAAC;IAC9C,OAAO;QACL,SAAS,CAAC,MAAM,EAAE,OAAO;YACvB,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YACzC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAChC,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,KAAK;YACR,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC;gBACrD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC;oBAAE,SAAS;gBAC5C,IAAI,CAAC;oBACH,OAAO,CAAC,KAAK,CAAC,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,0EAA0E;gBAC5E,CAAC;YACH,CAAC;QACH,CAAC;QACD,KAAK;YACH,aAAa,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,KAAe,EAAE,MAA+B;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,OAAO,MAAM,KAAK,UAAU;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAA2F,CAAC;IAC7G,IAAI,QAAQ,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACzE,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACtE,IAAI,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa;QAAE,OAAO,KAAK,CAAC;IAC3F,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,5 +1,8 @@
1
1
  export * from './types.js';
2
2
  export * from './events.js';
3
- export * from './create-agent-service.js';
4
- export type { ConversationDetail, GraphMessage, LlmTurnIndexEntry, LlmTurnRecord, MessageService, MessageRecord, RuntimeEvent, SessionRecord, SessionService, } from '@gt-fe/eap-runtime';
3
+ export * from './resources.js';
4
+ export * from './sessions.js';
5
+ export * from './messages.js';
6
+ export * from './create-agent.js';
7
+ export type { ConversationDetail, GraphMessage, LlmTurnIndexEntry, LlmTurnRecord, MessageService, MessageRecord, SSEEvent, SessionRecord, SessionService, } from '@gt-fe/eap-runtime';
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,GACf,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,GACf,MAAM,oBAAoB,CAAC"}
@@ -1,4 +1,7 @@
1
1
  export * from './types.js';
2
2
  export * from './events.js';
3
- export * from './create-agent-service.js';
3
+ export * from './resources.js';
4
+ export * from './sessions.js';
5
+ export * from './messages.js';
6
+ export * from './create-agent.js';
4
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { DevRuntime, MessageRecord } from '@gt-fe/eap-runtime';
2
+ import type { Page } from './sessions.js';
3
+ export interface MessageListQuery {
4
+ limit?: number;
5
+ offset?: number;
6
+ }
7
+ export type MessageView = MessageRecord;
8
+ export interface AgentMessageManager {
9
+ list(sessionId: string, query?: MessageListQuery): Promise<Page<MessageView>>;
10
+ listByTask(taskId: string, query?: MessageListQuery): Promise<Page<MessageView>>;
11
+ }
12
+ export declare function createMessageManager(getRuntime: () => DevRuntime): AgentMessageManager;
13
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/service/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9E,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;CAClF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,UAAU,GAAG,mBAAmB,CAatF"}
@@ -0,0 +1,24 @@
1
+ export function createMessageManager(getRuntime) {
2
+ return {
3
+ async list(sessionId, query = {}) {
4
+ const { limit, offset } = normalizePagination(query);
5
+ const items = await getRuntime().messageService.getMessages(sessionId, { limit, offset });
6
+ return { items, limit, offset };
7
+ },
8
+ async listByTask(taskId, query = {}) {
9
+ const { limit, offset } = normalizePagination(query);
10
+ const all = await getRuntime().messageService.getMessagesByTask(taskId);
11
+ return { items: all.slice(offset, offset + limit), limit, offset, total: all.length };
12
+ },
13
+ };
14
+ }
15
+ function normalizePagination(query) {
16
+ const limit = query.limit ?? 100;
17
+ const offset = query.offset ?? 0;
18
+ if (!Number.isInteger(limit) || limit < 1 || limit > 500)
19
+ throw new RangeError('Message limit must be an integer between 1 and 500');
20
+ if (!Number.isInteger(offset) || offset < 0)
21
+ throw new RangeError('Message offset must be a non-negative integer');
22
+ return { limit, offset };
23
+ }
24
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/service/messages.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,oBAAoB,CAAC,UAA4B;IAC/D,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,EAAE;YAC9B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACrD,MAAM,KAAK,GAAG,MAAM,UAAU,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YAC1F,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAClC,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,GAAG,EAAE;YACjC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;YACrD,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACxE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QACxF,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAuB;IAClD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,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