@lssm/example.agent-console 0.0.0-canary-20251225044228 → 0.0.0-canary-20251225052113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build$colon$bundle.log +11 -11
- package/.turbo/turbo-build.log +17 -17
- package/CHANGELOG.md +6 -6
- package/dist/agent/agent.operation.d.ts +115 -115
- package/dist/agent/agent.operation.d.ts.map +1 -1
- package/dist/agent/agent.operation.js +152 -4
- package/dist/agent/agent.operation.js.map +1 -1
- package/dist/agent/agent.schema.d.ts +95 -95
- package/dist/run/run.entity.d.ts +56 -56
- package/dist/run/run.enum.d.ts +5 -5
- package/dist/run/run.event.d.ts +70 -70
- package/dist/run/run.operation.d.ts +174 -174
- package/dist/run/run.operation.d.ts.map +1 -1
- package/dist/run/run.operation.js +157 -5
- package/dist/run/run.operation.js.map +1 -1
- package/dist/run/run.schema.d.ts +99 -99
- package/dist/tool/tool.entity.d.ts +24 -24
- package/dist/tool/tool.enum.d.ts +4 -4
- package/dist/tool/tool.event.d.ts +24 -24
- package/dist/tool/tool.handler.d.ts.map +1 -1
- package/dist/tool/tool.operation.d.ts +100 -100
- package/dist/tool/tool.operation.d.ts.map +1 -1
- package/dist/tool/tool.operation.js +116 -3
- package/dist/tool/tool.operation.js.map +1 -1
- package/dist/tool/tool.presentation.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/agent/agent.operation.ts +132 -0
- package/src/run/run.operation.ts +131 -0
- package/src/tool/tool.operation.ts +97 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.operation.d.ts","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":[],"mappings":";;;;;;;cAiBa,2CAAmB,kCAAA;EAAnB,OAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"run.operation.d.ts","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":[],"mappings":";;;;;;;cAiBa,2CAA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IA8Df,UAAA,EAAA,KA6EX;EAAA,CAAA;;;;;;;oBA7E6B;EAAA,CAAA;;;;;;;;;;;;;;wBAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAnLlB,qCAAa,kCAAA;;UAgExB,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAhEwB,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqEb,wCAAgB,kCAAA;;UA2C3B,mBAAA,CAAA;;;;;;;cA3C2B,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgDhB,uCAAe,kCAAA;;UAyD1B,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;cAzD0B,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8Df,0CAAkB,kCAAA;;UA6E7B,mBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;UA7E6B,mBAAA,CAAA"}
|
|
@@ -97,6 +97,31 @@ const ExecuteAgentCommand = defineCommand({
|
|
|
97
97
|
payload: RunSummaryModel
|
|
98
98
|
}],
|
|
99
99
|
audit: ["run.started"]
|
|
100
|
+
},
|
|
101
|
+
acceptance: {
|
|
102
|
+
scenarios: [{
|
|
103
|
+
key: "execute-agent-happy-path",
|
|
104
|
+
given: ["Agent exists", "Agent is active"],
|
|
105
|
+
when: ["User submits execution request"],
|
|
106
|
+
then: ["Run is created", "RunStarted event is emitted"]
|
|
107
|
+
}, {
|
|
108
|
+
key: "execute-agent-not-active",
|
|
109
|
+
given: ["Agent exists but is not active"],
|
|
110
|
+
when: ["User attempts to execute"],
|
|
111
|
+
then: ["AGENT_NOT_ACTIVE error is returned"]
|
|
112
|
+
}],
|
|
113
|
+
examples: [{
|
|
114
|
+
key: "basic-execute",
|
|
115
|
+
input: {
|
|
116
|
+
agentId: "agent-123",
|
|
117
|
+
input: { message: "Hello" }
|
|
118
|
+
},
|
|
119
|
+
output: {
|
|
120
|
+
runId: "run-456",
|
|
121
|
+
status: "pending",
|
|
122
|
+
estimatedWaitMs: 5e3
|
|
123
|
+
}
|
|
124
|
+
}]
|
|
100
125
|
}
|
|
101
126
|
});
|
|
102
127
|
/**
|
|
@@ -167,6 +192,30 @@ const CancelRunCommand = defineCommand({
|
|
|
167
192
|
payload: RunSummaryModel
|
|
168
193
|
}],
|
|
169
194
|
audit: ["run.cancelled"]
|
|
195
|
+
},
|
|
196
|
+
acceptance: {
|
|
197
|
+
scenarios: [{
|
|
198
|
+
key: "cancel-run-happy-path",
|
|
199
|
+
given: ["Run exists", "Run is in progress"],
|
|
200
|
+
when: ["User cancels run"],
|
|
201
|
+
then: ["Run is cancelled", "RunCancelled event is emitted"]
|
|
202
|
+
}, {
|
|
203
|
+
key: "cancel-run-already-completed",
|
|
204
|
+
given: ["Run exists but is already completed"],
|
|
205
|
+
when: ["User attempts to cancel"],
|
|
206
|
+
then: ["RUN_NOT_CANCELLABLE error is returned"]
|
|
207
|
+
}],
|
|
208
|
+
examples: [{
|
|
209
|
+
key: "cancel-basic",
|
|
210
|
+
input: {
|
|
211
|
+
runId: "run-456",
|
|
212
|
+
reason: "User requested"
|
|
213
|
+
},
|
|
214
|
+
output: {
|
|
215
|
+
success: true,
|
|
216
|
+
status: "cancelled"
|
|
217
|
+
}
|
|
218
|
+
}]
|
|
170
219
|
}
|
|
171
220
|
});
|
|
172
221
|
/**
|
|
@@ -209,7 +258,28 @@ const GetRunQuery = defineQuery({
|
|
|
209
258
|
when: "Run ID is invalid"
|
|
210
259
|
} }
|
|
211
260
|
},
|
|
212
|
-
policy: { auth: "user" }
|
|
261
|
+
policy: { auth: "user" },
|
|
262
|
+
acceptance: {
|
|
263
|
+
scenarios: [{
|
|
264
|
+
key: "get-run-happy-path",
|
|
265
|
+
given: ["Run exists"],
|
|
266
|
+
when: ["User requests run by ID"],
|
|
267
|
+
then: ["Run details are returned"]
|
|
268
|
+
}],
|
|
269
|
+
examples: [{
|
|
270
|
+
key: "get-with-steps",
|
|
271
|
+
input: {
|
|
272
|
+
runId: "run-456",
|
|
273
|
+
includeSteps: true,
|
|
274
|
+
includeLogs: false
|
|
275
|
+
},
|
|
276
|
+
output: {
|
|
277
|
+
id: "run-456",
|
|
278
|
+
status: "completed",
|
|
279
|
+
steps: []
|
|
280
|
+
}
|
|
281
|
+
}]
|
|
282
|
+
}
|
|
213
283
|
});
|
|
214
284
|
/**
|
|
215
285
|
* ListRunsQuery - Lists runs for an organization or agent.
|
|
@@ -288,7 +358,28 @@ const ListRunsQuery = defineQuery({
|
|
|
288
358
|
}
|
|
289
359
|
})
|
|
290
360
|
},
|
|
291
|
-
policy: { auth: "user" }
|
|
361
|
+
policy: { auth: "user" },
|
|
362
|
+
acceptance: {
|
|
363
|
+
scenarios: [{
|
|
364
|
+
key: "list-runs-happy-path",
|
|
365
|
+
given: ["Organization has runs"],
|
|
366
|
+
when: ["User lists runs"],
|
|
367
|
+
then: ["Paginated list of runs is returned"]
|
|
368
|
+
}],
|
|
369
|
+
examples: [{
|
|
370
|
+
key: "list-by-agent",
|
|
371
|
+
input: {
|
|
372
|
+
agentId: "agent-123",
|
|
373
|
+
limit: 20,
|
|
374
|
+
offset: 0
|
|
375
|
+
},
|
|
376
|
+
output: {
|
|
377
|
+
items: [],
|
|
378
|
+
total: 0,
|
|
379
|
+
hasMore: false
|
|
380
|
+
}
|
|
381
|
+
}]
|
|
382
|
+
}
|
|
292
383
|
});
|
|
293
384
|
/**
|
|
294
385
|
* GetRunStepsQuery - Retrieves steps for a run.
|
|
@@ -321,7 +412,20 @@ const GetRunStepsQuery = defineQuery({
|
|
|
321
412
|
} }
|
|
322
413
|
})
|
|
323
414
|
},
|
|
324
|
-
policy: { auth: "user" }
|
|
415
|
+
policy: { auth: "user" },
|
|
416
|
+
acceptance: {
|
|
417
|
+
scenarios: [{
|
|
418
|
+
key: "get-run-steps-happy-path",
|
|
419
|
+
given: ["Run exists with steps"],
|
|
420
|
+
when: ["User requests steps"],
|
|
421
|
+
then: ["Steps list is returned"]
|
|
422
|
+
}],
|
|
423
|
+
examples: [{
|
|
424
|
+
key: "get-steps-basic",
|
|
425
|
+
input: { runId: "run-456" },
|
|
426
|
+
output: { steps: [] }
|
|
427
|
+
}]
|
|
428
|
+
}
|
|
325
429
|
});
|
|
326
430
|
/**
|
|
327
431
|
* GetRunLogsQuery - Retrieves logs for a run.
|
|
@@ -384,7 +488,28 @@ const GetRunLogsQuery = defineQuery({
|
|
|
384
488
|
}
|
|
385
489
|
})
|
|
386
490
|
},
|
|
387
|
-
policy: { auth: "user" }
|
|
491
|
+
policy: { auth: "user" },
|
|
492
|
+
acceptance: {
|
|
493
|
+
scenarios: [{
|
|
494
|
+
key: "get-run-logs-happy-path",
|
|
495
|
+
given: ["Run exists with logs"],
|
|
496
|
+
when: ["User requests logs"],
|
|
497
|
+
then: ["Paginated logs list is returned"]
|
|
498
|
+
}],
|
|
499
|
+
examples: [{
|
|
500
|
+
key: "get-logs-filtered",
|
|
501
|
+
input: {
|
|
502
|
+
runId: "run-456",
|
|
503
|
+
level: "error",
|
|
504
|
+
limit: 50
|
|
505
|
+
},
|
|
506
|
+
output: {
|
|
507
|
+
items: [],
|
|
508
|
+
total: 0,
|
|
509
|
+
hasMore: false
|
|
510
|
+
}
|
|
511
|
+
}]
|
|
512
|
+
}
|
|
388
513
|
});
|
|
389
514
|
/**
|
|
390
515
|
* GetRunMetricsQuery - Retrieves aggregated metrics for runs.
|
|
@@ -466,7 +591,34 @@ const GetRunMetricsQuery = defineQuery({
|
|
|
466
591
|
}
|
|
467
592
|
})
|
|
468
593
|
},
|
|
469
|
-
policy: { auth: "user" }
|
|
594
|
+
policy: { auth: "user" },
|
|
595
|
+
acceptance: {
|
|
596
|
+
scenarios: [{
|
|
597
|
+
key: "get-run-metrics-happy-path",
|
|
598
|
+
given: ["Organization has run history"],
|
|
599
|
+
when: ["User requests metrics for date range"],
|
|
600
|
+
then: ["Aggregated metrics are returned"]
|
|
601
|
+
}],
|
|
602
|
+
examples: [{
|
|
603
|
+
key: "get-daily-metrics",
|
|
604
|
+
input: {
|
|
605
|
+
organizationId: "org-123",
|
|
606
|
+
startDate: "2025-01-01",
|
|
607
|
+
endDate: "2025-01-31",
|
|
608
|
+
granularity: "day"
|
|
609
|
+
},
|
|
610
|
+
output: {
|
|
611
|
+
totalRuns: 100,
|
|
612
|
+
completedRuns: 90,
|
|
613
|
+
failedRuns: 10,
|
|
614
|
+
totalTokens: 5e4,
|
|
615
|
+
totalCostUsd: 5,
|
|
616
|
+
averageDurationMs: 2500,
|
|
617
|
+
successRate: .9,
|
|
618
|
+
timeline: []
|
|
619
|
+
}
|
|
620
|
+
}]
|
|
621
|
+
}
|
|
470
622
|
});
|
|
471
623
|
|
|
472
624
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.operation.js","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@lssm/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';\nimport { GranularityEnum, LogLevelEnum, RunStatusEnum } from './run.enum';\nimport {\n RunInputModel,\n RunLogModel,\n RunModel,\n RunStepModel,\n RunSummaryModel,\n TimelineDataPointModel,\n} from './run.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * ExecuteAgentCommand - Starts a new agent run.\n */\nexport const ExecuteAgentCommand = defineCommand({\n meta: {\n key: 'agent.run.execute',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'execute'],\n description: 'Starts a new agent run with the given input.',\n goal: 'Execute an AI agent with user input.',\n context: 'Called from chat interface or API.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ExecuteAgentInput',\n fields: {\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: RunInputModel, isOptional: false },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n stream: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n maxIterations: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'ExecuteAgentOutput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n estimatedWaitMs: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n },\n }),\n errors: {\n AGENT_NOT_FOUND: {\n description: 'The specified agent does not exist',\n http: 404,\n gqlCode: 'AGENT_NOT_FOUND',\n when: 'Agent ID is invalid',\n },\n AGENT_NOT_ACTIVE: {\n description: 'The specified agent is not active',\n http: 400,\n gqlCode: 'AGENT_NOT_ACTIVE',\n when: 'Agent is in draft/paused/archived state',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.started',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n when: 'Run is queued',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.started'],\n },\n});\n\n/**\n * CancelRunCommand - Cancels an in-progress run.\n */\nexport const CancelRunCommand = defineCommand({\n meta: {\n key: 'agent.run.cancel',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancel'],\n description: 'Cancels an in-progress agent run.',\n goal: 'Stop a running agent execution.',\n context: 'Called when user wants to abort a long-running task.',\n },\n io: {\n input: defineSchemaModel({\n name: 'CancelRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'CancelRunOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n },\n }),\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n RUN_NOT_CANCELLABLE: {\n description: 'The run cannot be cancelled',\n http: 400,\n gqlCode: 'RUN_NOT_CANCELLABLE',\n when: 'Run is already completed/failed/cancelled',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.cancelled',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n when: 'Run is cancelled',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.cancelled'],\n },\n});\n\n/**\n * GetRunQuery - Retrieves a run by ID.\n */\nexport const GetRunQuery = defineQuery({\n meta: {\n key: 'agent.run.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'get'],\n description: 'Retrieves a run by its ID with optional details.',\n goal: 'View detailed run information.',\n context: 'Run details page or monitoring.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n includeSteps: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n includeLogs: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n }),\n output: RunModel,\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\n/**\n * ListRunsQuery - Lists runs for an organization or agent.\n */\nexport const ListRunsQuery = defineQuery({\n meta: {\n key: 'agent.run.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'list'],\n description: 'Lists runs with optional filtering.',\n goal: 'Browse and search run history.',\n context: 'Run history/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListRunsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: RunStatusEnum, isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListRunsOutput',\n fields: {\n items: { type: RunSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n});\n\n/**\n * GetRunStepsQuery - Retrieves steps for a run.\n */\nexport const GetRunStepsQuery = defineQuery({\n meta: {\n key: 'agent.run.getSteps',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'steps'],\n description: 'Retrieves all steps for a specific run.',\n goal: 'View step-by-step execution details.',\n context: 'Run details page - steps tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunStepsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunStepsOutput',\n fields: {\n steps: { type: RunStepModel, isArray: true, isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n});\n\n/**\n * GetRunLogsQuery - Retrieves logs for a run.\n */\nexport const GetRunLogsQuery = defineQuery({\n meta: {\n key: 'agent.run.getLogs',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'logs'],\n description: 'Retrieves all logs for a specific run.',\n goal: 'Debug and audit run execution.',\n context: 'Run details page - logs tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunLogsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n level: { type: LogLevelEnum, isOptional: true },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 100,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunLogsOutput',\n fields: {\n items: { type: RunLogModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n});\n\n/**\n * GetRunMetricsQuery - Retrieves aggregated metrics for runs.\n */\nexport const GetRunMetricsQuery = defineQuery({\n meta: {\n key: 'agent.run.getMetrics',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'metrics'],\n description: 'Retrieves aggregated metrics for runs within a time period.',\n goal: 'Monitor and analyze agent usage.',\n context: 'Analytics dashboard.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunMetricsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n granularity: {\n type: GranularityEnum,\n isOptional: true,\n defaultValue: 'day',\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunMetricsOutput',\n fields: {\n totalRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedRuns: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n failedRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n averageDurationMs: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n successRate: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n timeline: {\n type: TimelineDataPointModel,\n isArray: true,\n isOptional: false,\n },\n },\n }),\n },\n policy: { auth: 'user' },\n});\n"],"mappings":";;;;;;AAYA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,OAAO,UAAU;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ;IACN,SAAS;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACtE,OAAO;KAAE,MAAM;KAAe,YAAY;KAAO;IACjD,WAAW;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAM;IACvE,UAAU;KAAE,MAAM,eAAe,YAAY;KAAE,YAAY;KAAM;IACjE,QAAQ;KAAE,MAAM,eAAe,SAAS;KAAE,YAAY;KAAM;IAC5D,eAAe;KACb,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACD,WAAW;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAM;IACrE;GACF,CAAC;EACF,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;IACN,OAAO;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACpE,QAAQ;KAAE,MAAM;KA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c;KAAE,YAAY;KAAO;IACvE,cAAc;KACZ,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,mBAAmB;KACjB,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,aAAa;KACX,MAAM,eAAe,gBAAgB;KACrC,YAAY;KACb;IACD,UAAU;KACR,MAAM;KACN,SAAS;KACT,YAAY;KACb;IACF;GACF,CAAC;EACH;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"run.operation.js","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@lssm/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';\nimport { GranularityEnum, LogLevelEnum, RunStatusEnum } from './run.enum';\nimport {\n RunInputModel,\n RunLogModel,\n RunModel,\n RunStepModel,\n RunSummaryModel,\n TimelineDataPointModel,\n} from './run.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * ExecuteAgentCommand - Starts a new agent run.\n */\nexport const ExecuteAgentCommand = defineCommand({\n meta: {\n key: 'agent.run.execute',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'execute'],\n description: 'Starts a new agent run with the given input.',\n goal: 'Execute an AI agent with user input.',\n context: 'Called from chat interface or API.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ExecuteAgentInput',\n fields: {\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: RunInputModel, isOptional: false },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n stream: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n maxIterations: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n timeoutMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'ExecuteAgentOutput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n estimatedWaitMs: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n },\n }),\n errors: {\n AGENT_NOT_FOUND: {\n description: 'The specified agent does not exist',\n http: 404,\n gqlCode: 'AGENT_NOT_FOUND',\n when: 'Agent ID is invalid',\n },\n AGENT_NOT_ACTIVE: {\n description: 'The specified agent is not active',\n http: 400,\n gqlCode: 'AGENT_NOT_ACTIVE',\n when: 'Agent is in draft/paused/archived state',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.started',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n when: 'Run is queued',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.started'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'execute-agent-happy-path',\n given: ['Agent exists', 'Agent is active'],\n when: ['User submits execution request'],\n then: ['Run is created', 'RunStarted event is emitted'],\n },\n {\n key: 'execute-agent-not-active',\n given: ['Agent exists but is not active'],\n when: ['User attempts to execute'],\n then: ['AGENT_NOT_ACTIVE error is returned'],\n },\n ],\n examples: [\n {\n key: 'basic-execute',\n input: { agentId: 'agent-123', input: { message: 'Hello' } },\n output: { runId: 'run-456', status: 'pending', estimatedWaitMs: 5000 },\n },\n ],\n },\n});\n\n/**\n * CancelRunCommand - Cancels an in-progress run.\n */\nexport const CancelRunCommand = defineCommand({\n meta: {\n key: 'agent.run.cancel',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancel'],\n description: 'Cancels an in-progress agent run.',\n goal: 'Stop a running agent execution.',\n context: 'Called when user wants to abort a long-running task.',\n },\n io: {\n input: defineSchemaModel({\n name: 'CancelRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n }),\n output: defineSchemaModel({\n name: 'CancelRunOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n status: { type: RunStatusEnum, isOptional: false },\n },\n }),\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n RUN_NOT_CANCELLABLE: {\n description: 'The run cannot be cancelled',\n http: 400,\n gqlCode: 'RUN_NOT_CANCELLABLE',\n when: 'Run is already completed/failed/cancelled',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'run.cancelled',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n when: 'Run is cancelled',\n payload: RunSummaryModel,\n },\n ],\n audit: ['run.cancelled'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'cancel-run-happy-path',\n given: ['Run exists', 'Run is in progress'],\n when: ['User cancels run'],\n then: ['Run is cancelled', 'RunCancelled event is emitted'],\n },\n {\n key: 'cancel-run-already-completed',\n given: ['Run exists but is already completed'],\n when: ['User attempts to cancel'],\n then: ['RUN_NOT_CANCELLABLE error is returned'],\n },\n ],\n examples: [\n {\n key: 'cancel-basic',\n input: { runId: 'run-456', reason: 'User requested' },\n output: { success: true, status: 'cancelled' },\n },\n ],\n },\n});\n\n/**\n * GetRunQuery - Retrieves a run by ID.\n */\nexport const GetRunQuery = defineQuery({\n meta: {\n key: 'agent.run.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'get'],\n description: 'Retrieves a run by its ID with optional details.',\n goal: 'View detailed run information.',\n context: 'Run details page or monitoring.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n includeSteps: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n includeLogs: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n },\n }),\n output: RunModel,\n errors: {\n RUN_NOT_FOUND: {\n description: 'The specified run does not exist',\n http: 404,\n gqlCode: 'RUN_NOT_FOUND',\n when: 'Run ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-happy-path',\n given: ['Run exists'],\n when: ['User requests run by ID'],\n then: ['Run details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-with-steps',\n input: { runId: 'run-456', includeSteps: true, includeLogs: false },\n output: { id: 'run-456', status: 'completed', steps: [] },\n },\n ],\n },\n});\n\n/**\n * ListRunsQuery - Lists runs for an organization or agent.\n */\nexport const ListRunsQuery = defineQuery({\n meta: {\n key: 'agent.run.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'list'],\n description: 'Lists runs with optional filtering.',\n goal: 'Browse and search run history.',\n context: 'Run history/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListRunsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: RunStatusEnum, isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'ListRunsOutput',\n fields: {\n items: { type: RunSummaryModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-runs-happy-path',\n given: ['Organization has runs'],\n when: ['User lists runs'],\n then: ['Paginated list of runs is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-agent',\n input: { agentId: 'agent-123', limit: 20, offset: 0 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * GetRunStepsQuery - Retrieves steps for a run.\n */\nexport const GetRunStepsQuery = defineQuery({\n meta: {\n key: 'agent.run.getSteps',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'steps'],\n description: 'Retrieves all steps for a specific run.',\n goal: 'View step-by-step execution details.',\n context: 'Run details page - steps tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunStepsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunStepsOutput',\n fields: {\n steps: { type: RunStepModel, isArray: true, isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-steps-happy-path',\n given: ['Run exists with steps'],\n when: ['User requests steps'],\n then: ['Steps list is returned'],\n },\n ],\n examples: [\n {\n key: 'get-steps-basic',\n input: { runId: 'run-456' },\n output: { steps: [] },\n },\n ],\n },\n});\n\n/**\n * GetRunLogsQuery - Retrieves logs for a run.\n */\nexport const GetRunLogsQuery = defineQuery({\n meta: {\n key: 'agent.run.getLogs',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'logs'],\n description: 'Retrieves all logs for a specific run.',\n goal: 'Debug and audit run execution.',\n context: 'Run details page - logs tab.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunLogsInput',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n level: { type: LogLevelEnum, isOptional: true },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 100,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunLogsOutput',\n fields: {\n items: { type: RunLogModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasMore: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-logs-happy-path',\n given: ['Run exists with logs'],\n when: ['User requests logs'],\n then: ['Paginated logs list is returned'],\n },\n ],\n examples: [\n {\n key: 'get-logs-filtered',\n input: { runId: 'run-456', level: 'error', limit: 50 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * GetRunMetricsQuery - Retrieves aggregated metrics for runs.\n */\nexport const GetRunMetricsQuery = defineQuery({\n meta: {\n key: 'agent.run.getMetrics',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'metrics'],\n description: 'Retrieves aggregated metrics for runs within a time period.',\n goal: 'Monitor and analyze agent usage.',\n context: 'Analytics dashboard.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetRunMetricsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n startDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n endDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n granularity: {\n type: GranularityEnum,\n isOptional: true,\n defaultValue: 'day',\n },\n },\n }),\n output: defineSchemaModel({\n name: 'GetRunMetricsOutput',\n fields: {\n totalRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedRuns: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n failedRuns: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n averageDurationMs: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n successRate: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n timeline: {\n type: TimelineDataPointModel,\n isArray: true,\n isOptional: false,\n },\n },\n }),\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-run-metrics-happy-path',\n given: ['Organization has run history'],\n when: ['User requests metrics for date range'],\n then: ['Aggregated metrics are returned'],\n },\n ],\n examples: [\n {\n key: 'get-daily-metrics',\n input: { organizationId: 'org-123', startDate: '2025-01-01', endDate: '2025-01-31', granularity: 'day' },\n output: { totalRuns: 100, completedRuns: 90, failedRuns: 10, totalTokens: 50000, totalCostUsd: 5.0, averageDurationMs: 2500, successRate: 0.9, timeline: [] },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAYA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,OAAO,UAAU;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO,kBAAkB;GACvB,MAAM;GACN,QAAQ;IACN,SAAS;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACtE,OAAO;KAAE,MAAM;KAAe,YAAY;KAAO;IACjD,WAAW;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAM;IACvE,UAAU;KAAE,MAAM,eAAe,YAAY;KAAE,YAAY;KAAM;IACjE,QAAQ;KAAE,MAAM,eAAe,SAAS;KAAE,YAAY;KAAM;IAC5D,eAAe;KACb,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACD,WAAW;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAM;IACrE;GACF,CAAC;EACF,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;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