@contractspec/example.agent-console 1.44.1 → 1.45.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.
- package/.turbo/turbo-build$colon$bundle.log +26 -26
- package/.turbo/turbo-build.log +32 -32
- package/CHANGELOG.md +41 -0
- package/dist/agent/agent.event.js +4 -4
- package/dist/agent/agent.event.js.map +1 -1
- package/dist/agent/agent.operation.d.ts +1 -1
- package/dist/agent/agent.operation.js +7 -7
- package/dist/agent/agent.operation.js.map +1 -1
- package/dist/agent/agent.presentation.js +3 -3
- package/dist/agent/agent.presentation.js.map +1 -1
- package/dist/agent/agent.schema.d.ts +95 -95
- package/dist/agent.feature.js +60 -60
- package/dist/agent.feature.js.map +1 -1
- package/dist/example.d.ts +3 -36
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +16 -11
- package/dist/example.js.map +1 -1
- package/dist/run/run.entity.d.ts +56 -56
- package/dist/run/run.enum.d.ts +5 -5
- package/dist/run/run.event.js +7 -7
- package/dist/run/run.event.js.map +1 -1
- package/dist/run/run.operation.d.ts +2 -2
- package/dist/run/run.operation.js +9 -9
- package/dist/run/run.operation.js.map +1 -1
- package/dist/run/run.presentation.js +2 -2
- package/dist/run/run.presentation.js.map +1 -1
- package/dist/tool/tool.event.js +3 -3
- package/dist/tool/tool.event.js.map +1 -1
- package/dist/tool/tool.operation.d.ts +2 -2
- package/dist/tool/tool.operation.js +7 -7
- package/dist/tool/tool.operation.js.map +1 -1
- package/dist/tool/tool.presentation.js +2 -2
- package/dist/tool/tool.presentation.js.map +1 -1
- package/package.json +8 -8
- package/src/agent/agent.event.ts +4 -4
- package/src/agent/agent.operation.ts +8 -8
- package/src/agent/agent.presentation.ts +3 -3
- package/src/agent.feature.ts +60 -60
- package/src/example.ts +16 -9
- package/src/run/run.event.ts +7 -7
- package/src/run/run.operation.ts +9 -9
- package/src/run/run.presentation.ts +2 -2
- package/src/tool/tool.event.ts +3 -3
- package/src/tool/tool.operation.ts +7 -7
- package/src/tool/tool.presentation.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/dist/run/run.event.js
CHANGED
|
@@ -50,7 +50,7 @@ const RunStartedPayload = defineSchemaModel$1({
|
|
|
50
50
|
const RunStartedEvent = defineEvent({
|
|
51
51
|
meta: {
|
|
52
52
|
key: "agent.run.started",
|
|
53
|
-
version: 1,
|
|
53
|
+
version: "1.0.0",
|
|
54
54
|
description: "An agent run was started.",
|
|
55
55
|
stability: "stable",
|
|
56
56
|
owners: [...OWNERS],
|
|
@@ -125,7 +125,7 @@ const RunCompletedPayload = defineSchemaModel$1({
|
|
|
125
125
|
const RunCompletedEvent = defineEvent({
|
|
126
126
|
meta: {
|
|
127
127
|
key: "agent.run.completed",
|
|
128
|
-
version: 1,
|
|
128
|
+
version: "1.0.0",
|
|
129
129
|
description: "An agent run completed successfully.",
|
|
130
130
|
stability: "stable",
|
|
131
131
|
owners: [...OWNERS],
|
|
@@ -192,7 +192,7 @@ const RunFailedPayload = defineSchemaModel$1({
|
|
|
192
192
|
const RunFailedEvent = defineEvent({
|
|
193
193
|
meta: {
|
|
194
194
|
key: "agent.run.failed",
|
|
195
|
-
version: 1,
|
|
195
|
+
version: "1.0.0",
|
|
196
196
|
description: "An agent run encountered an error.",
|
|
197
197
|
stability: "stable",
|
|
198
198
|
owners: [...OWNERS],
|
|
@@ -251,7 +251,7 @@ const RunCancelledPayload = defineSchemaModel$1({
|
|
|
251
251
|
const RunCancelledEvent = defineEvent({
|
|
252
252
|
meta: {
|
|
253
253
|
key: "agent.run.cancelled",
|
|
254
|
-
version: 1,
|
|
254
|
+
version: "1.0.0",
|
|
255
255
|
description: "An agent run was cancelled by the user.",
|
|
256
256
|
stability: "stable",
|
|
257
257
|
owners: [...OWNERS],
|
|
@@ -298,7 +298,7 @@ const ToolInvokedPayload = defineSchemaModel$1({
|
|
|
298
298
|
const ToolInvokedEvent = defineEvent({
|
|
299
299
|
meta: {
|
|
300
300
|
key: "agent.run.toolInvoked",
|
|
301
|
-
version: 1,
|
|
301
|
+
version: "1.0.0",
|
|
302
302
|
description: "A tool was invoked during an agent run.",
|
|
303
303
|
stability: "stable",
|
|
304
304
|
owners: [...OWNERS],
|
|
@@ -361,7 +361,7 @@ const ToolCompletedPayload = defineSchemaModel$1({
|
|
|
361
361
|
const ToolCompletedEvent = defineEvent({
|
|
362
362
|
meta: {
|
|
363
363
|
key: "agent.run.toolCompleted",
|
|
364
|
-
version: 1,
|
|
364
|
+
version: "1.0.0",
|
|
365
365
|
description: "A tool invocation completed during an agent run.",
|
|
366
366
|
stability: "stable",
|
|
367
367
|
owners: [...OWNERS],
|
|
@@ -416,7 +416,7 @@ const MessageGeneratedPayload = defineSchemaModel$1({
|
|
|
416
416
|
const MessageGeneratedEvent = defineEvent({
|
|
417
417
|
meta: {
|
|
418
418
|
key: "agent.run.messageGenerated",
|
|
419
|
-
version: 1,
|
|
419
|
+
version: "1.0.0",
|
|
420
420
|
description: "An agent generated a message during a run.",
|
|
421
421
|
stability: "stable",
|
|
422
422
|
owners: [...OWNERS],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.event.js","names":["defineSchemaModel"],"sources":["../../src/run/run.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for run started event.\n */\nconst RunStartedPayload = defineSchemaModel({\n name: 'RunStartedPayload',\n description: 'Payload for run started event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunStartedEvent - An agent run was started.\n */\nexport const RunStartedEvent = defineEvent({\n meta: {\n key: 'agent.run.started',\n version: 1,\n description: 'An agent run was started.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n },\n payload: RunStartedPayload,\n});\n\n/**\n * Payload for run completed event.\n */\nconst RunCompletedPayload = defineSchemaModel({\n name: 'RunCompletedPayload',\n description: 'Payload for run completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n promptTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completionTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n estimatedCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCompletedEvent - An agent run completed successfully.\n */\nexport const RunCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.completed',\n version: 1,\n description: 'An agent run completed successfully.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'completed'],\n },\n payload: RunCompletedPayload,\n});\n\n/**\n * Payload for run failed event.\n */\nconst RunFailedPayload = defineSchemaModel({\n name: 'RunFailedPayload',\n description: 'Payload for run failed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunFailedEvent - An agent run failed.\n */\nexport const RunFailedEvent = defineEvent({\n meta: {\n key: 'agent.run.failed',\n version: 1,\n description: 'An agent run encountered an error.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'failed'],\n },\n payload: RunFailedPayload,\n});\n\n/**\n * Payload for run cancelled event.\n */\nconst RunCancelledPayload = defineSchemaModel({\n name: 'RunCancelledPayload',\n description: 'Payload for run cancelled event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCancelledEvent - An agent run was cancelled.\n */\nexport const RunCancelledEvent = defineEvent({\n meta: {\n key: 'agent.run.cancelled',\n version: 1,\n description: 'An agent run was cancelled by the user.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n },\n payload: RunCancelledPayload,\n});\n\n/**\n * Payload for tool invoked event.\n */\nconst ToolInvokedPayload = defineSchemaModel({\n name: 'ToolInvokedPayload',\n description: 'Payload for tool invoked event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n invokedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolInvokedEvent - A tool was invoked during a run.\n */\nexport const ToolInvokedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolInvoked',\n version: 1,\n description: 'A tool was invoked during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'invoked'],\n },\n payload: ToolInvokedPayload,\n});\n\n/**\n * Payload for tool completed event.\n */\nconst ToolCompletedPayload = defineSchemaModel({\n name: 'ToolCompletedPayload',\n description: 'Payload for tool completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCompletedEvent - A tool invocation completed.\n */\nexport const ToolCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolCompleted',\n version: 1,\n description: 'A tool invocation completed during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'completed'],\n },\n payload: ToolCompletedPayload,\n});\n\n/**\n * Message type enum.\n */\nconst MessageTypeEnum = defineEnum('MessageType', ['assistant', 'system']);\n\n/**\n * Payload for message generated event.\n */\nconst MessageGeneratedPayload = defineSchemaModel({\n name: 'MessageGeneratedPayload',\n description: 'Payload for message generated event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n messageType: { type: MessageTypeEnum, isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n tokensUsed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n generatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * MessageGeneratedEvent - Agent generated a message.\n */\nexport const MessageGeneratedEvent = defineEvent({\n meta: {\n key: 'agent.run.messageGenerated',\n version: 1,\n description: 'An agent generated a message during a run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'message', 'generated'],\n },\n payload: MessageGeneratedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAM,oBAAoBA,oBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,WAAW;GAAE,MAAM,eAAe,iBAAiB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;GAAC;GAAO;GAAW;GAAY;EACtC;CACD,SAAS;CACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"run.event.js","names":["defineSchemaModel"],"sources":["../../src/run/run.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for run started event.\n */\nconst RunStartedPayload = defineSchemaModel({\n name: 'RunStartedPayload',\n description: 'Payload for run started event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sessionId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunStartedEvent - An agent run was started.\n */\nexport const RunStartedEvent = defineEvent({\n meta: {\n key: 'agent.run.started',\n version: '1.0.0',\n description: 'An agent run was started.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'started'],\n },\n payload: RunStartedPayload,\n});\n\n/**\n * Payload for run completed event.\n */\nconst RunCompletedPayload = defineSchemaModel({\n name: 'RunCompletedPayload',\n description: 'Payload for run completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n promptTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completionTokens: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n estimatedCostUsd: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCompletedEvent - An agent run completed successfully.\n */\nexport const RunCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.completed',\n version: '1.0.0',\n description: 'An agent run completed successfully.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'completed'],\n },\n payload: RunCompletedPayload,\n});\n\n/**\n * Payload for run failed event.\n */\nconst RunFailedPayload = defineSchemaModel({\n name: 'RunFailedPayload',\n description: 'Payload for run failed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n agentName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n errorCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n failedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunFailedEvent - An agent run failed.\n */\nexport const RunFailedEvent = defineEvent({\n meta: {\n key: 'agent.run.failed',\n version: '1.0.0',\n description: 'An agent run encountered an error.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'failed'],\n },\n payload: RunFailedPayload,\n});\n\n/**\n * Payload for run cancelled event.\n */\nconst RunCancelledPayload = defineSchemaModel({\n name: 'RunCancelledPayload',\n description: 'Payload for run cancelled event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n agentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n cancelledBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n totalTokens: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalIterations: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n cancelledAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * RunCancelledEvent - An agent run was cancelled.\n */\nexport const RunCancelledEvent = defineEvent({\n meta: {\n key: 'agent.run.cancelled',\n version: '1.0.0',\n description: 'An agent run was cancelled by the user.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'cancelled'],\n },\n payload: RunCancelledPayload,\n});\n\n/**\n * Payload for tool invoked event.\n */\nconst ToolInvokedPayload = defineSchemaModel({\n name: 'ToolInvokedPayload',\n description: 'Payload for tool invoked event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n input: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n invokedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolInvokedEvent - A tool was invoked during a run.\n */\nexport const ToolInvokedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolInvoked',\n version: '1.0.0',\n description: 'A tool was invoked during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'invoked'],\n },\n payload: ToolInvokedPayload,\n});\n\n/**\n * Payload for tool completed event.\n */\nconst ToolCompletedPayload = defineSchemaModel({\n name: 'ToolCompletedPayload',\n description: 'Payload for tool completed event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n toolName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n errorMessage: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCompletedEvent - A tool invocation completed.\n */\nexport const ToolCompletedEvent = defineEvent({\n meta: {\n key: 'agent.run.toolCompleted',\n version: '1.0.0',\n description: 'A tool invocation completed during an agent run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'tool', 'completed'],\n },\n payload: ToolCompletedPayload,\n});\n\n/**\n * Message type enum.\n */\nconst MessageTypeEnum = defineEnum('MessageType', ['assistant', 'system']);\n\n/**\n * Payload for message generated event.\n */\nconst MessageGeneratedPayload = defineSchemaModel({\n name: 'MessageGeneratedPayload',\n description: 'Payload for message generated event',\n fields: {\n runId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n messageType: { type: MessageTypeEnum, isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n tokensUsed: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n generatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * MessageGeneratedEvent - Agent generated a message.\n */\nexport const MessageGeneratedEvent = defineEvent({\n meta: {\n key: 'agent.run.messageGenerated',\n version: '1.0.0',\n description: 'An agent generated a message during a run.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['run', 'message', 'generated'],\n },\n payload: MessageGeneratedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAM,oBAAoBA,oBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,OAAO;GAAE,MAAM,eAAe,YAAY;GAAE,YAAY;GAAO;EAC/D,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,kBAAkB,YAAY;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,OAAO,UAAU;EACzB;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAM,sBAAsBA,oBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,iBAAiB;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AAQ;GAAY;EACnC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAM,kBAAkB,WAAW,eAAe,CAAC,aAAa,SAAS,CAAC;;;;AAK1E,MAAM,0BAA0BA,oBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,aAAa;GAAE,MAAM;GAAiB,YAAY;GAAO;EACzD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACpE;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAO;GAAW;GAAY;EACtC;CACD,SAAS;CACV,CAAC"}
|
|
@@ -58,7 +58,7 @@ declare const ExecuteAgentCommand: _contractspec_lib_contracts17.OperationSpec<_
|
|
|
58
58
|
};
|
|
59
59
|
}>, {
|
|
60
60
|
key: string;
|
|
61
|
-
version:
|
|
61
|
+
version: string;
|
|
62
62
|
stability: string;
|
|
63
63
|
owners: "@agent-console-team"[];
|
|
64
64
|
tags: string[];
|
|
@@ -125,7 +125,7 @@ declare const CancelRunCommand: _contractspec_lib_contracts17.OperationSpec<_con
|
|
|
125
125
|
};
|
|
126
126
|
}>, {
|
|
127
127
|
key: string;
|
|
128
|
-
version:
|
|
128
|
+
version: string;
|
|
129
129
|
stability: string;
|
|
130
130
|
owners: "@agent-console-team"[];
|
|
131
131
|
tags: string[];
|
|
@@ -11,7 +11,7 @@ const OWNERS = ["@agent-console-team"];
|
|
|
11
11
|
const ExecuteAgentCommand = defineCommand({
|
|
12
12
|
meta: {
|
|
13
13
|
key: "agent.run.execute",
|
|
14
|
-
version: 1,
|
|
14
|
+
version: "1.0.0",
|
|
15
15
|
stability: "stable",
|
|
16
16
|
owners: [...OWNERS],
|
|
17
17
|
tags: ["run", "execute"],
|
|
@@ -89,7 +89,7 @@ const ExecuteAgentCommand = defineCommand({
|
|
|
89
89
|
sideEffects: {
|
|
90
90
|
emits: [{
|
|
91
91
|
key: "run.started",
|
|
92
|
-
version: 1,
|
|
92
|
+
version: "1.0.0",
|
|
93
93
|
stability: "stable",
|
|
94
94
|
owners: [...OWNERS],
|
|
95
95
|
tags: ["run", "started"],
|
|
@@ -130,7 +130,7 @@ const ExecuteAgentCommand = defineCommand({
|
|
|
130
130
|
const CancelRunCommand = defineCommand({
|
|
131
131
|
meta: {
|
|
132
132
|
key: "agent.run.cancel",
|
|
133
|
-
version: 1,
|
|
133
|
+
version: "1.0.0",
|
|
134
134
|
stability: "stable",
|
|
135
135
|
owners: [...OWNERS],
|
|
136
136
|
tags: ["run", "cancel"],
|
|
@@ -184,7 +184,7 @@ const CancelRunCommand = defineCommand({
|
|
|
184
184
|
sideEffects: {
|
|
185
185
|
emits: [{
|
|
186
186
|
key: "run.cancelled",
|
|
187
|
-
version: 1,
|
|
187
|
+
version: "1.0.0",
|
|
188
188
|
stability: "stable",
|
|
189
189
|
owners: [...OWNERS],
|
|
190
190
|
tags: ["run", "cancelled"],
|
|
@@ -224,7 +224,7 @@ const CancelRunCommand = defineCommand({
|
|
|
224
224
|
const GetRunQuery = defineQuery({
|
|
225
225
|
meta: {
|
|
226
226
|
key: "agent.run.get",
|
|
227
|
-
version: 1,
|
|
227
|
+
version: "1.0.0",
|
|
228
228
|
stability: "stable",
|
|
229
229
|
owners: [...OWNERS],
|
|
230
230
|
tags: ["run", "get"],
|
|
@@ -287,7 +287,7 @@ const GetRunQuery = defineQuery({
|
|
|
287
287
|
const ListRunsQuery = defineQuery({
|
|
288
288
|
meta: {
|
|
289
289
|
key: "agent.run.list",
|
|
290
|
-
version: 1,
|
|
290
|
+
version: "1.0.0",
|
|
291
291
|
stability: "stable",
|
|
292
292
|
owners: [...OWNERS],
|
|
293
293
|
tags: ["run", "list"],
|
|
@@ -387,7 +387,7 @@ const ListRunsQuery = defineQuery({
|
|
|
387
387
|
const GetRunStepsQuery = defineQuery({
|
|
388
388
|
meta: {
|
|
389
389
|
key: "agent.run.getSteps",
|
|
390
|
-
version: 1,
|
|
390
|
+
version: "1.0.0",
|
|
391
391
|
stability: "stable",
|
|
392
392
|
owners: [...OWNERS],
|
|
393
393
|
tags: ["run", "steps"],
|
|
@@ -433,7 +433,7 @@ const GetRunStepsQuery = defineQuery({
|
|
|
433
433
|
const GetRunLogsQuery = defineQuery({
|
|
434
434
|
meta: {
|
|
435
435
|
key: "agent.run.getLogs",
|
|
436
|
-
version: 1,
|
|
436
|
+
version: "1.0.0",
|
|
437
437
|
stability: "stable",
|
|
438
438
|
owners: [...OWNERS],
|
|
439
439
|
tags: ["run", "logs"],
|
|
@@ -517,7 +517,7 @@ const GetRunLogsQuery = defineQuery({
|
|
|
517
517
|
const GetRunMetricsQuery = defineQuery({
|
|
518
518
|
meta: {
|
|
519
519
|
key: "agent.run.getMetrics",
|
|
520
|
-
version: 1,
|
|
520
|
+
version: "1.0.0",
|
|
521
521
|
stability: "stable",
|
|
522
522
|
owners: [...OWNERS],
|
|
523
523
|
tags: ["run", "metrics"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.operation.js","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/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: {\n organizationId: 'org-123',\n startDate: '2025-01-01',\n endDate: '2025-01-31',\n granularity: 'day',\n },\n output: {\n totalRuns: 100,\n completedRuns: 90,\n failedRuns: 10,\n totalTokens: 50000,\n totalCostUsd: 5.0,\n averageDurationMs: 2500,\n successRate: 0.9,\n timeline: [],\n },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAeA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,sBAAs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eAAe;KACb,MAAM,eAAe,cAAc;KACnC,YAAY;KACb;IACD,YAAY;KAAE,MAAM,eAAe,cAAc;KAAE,YAAY;KAAO;IACtE,aAAa;KAAE,MAAM,eAAe,cAAc;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;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,+BAA+B;GACvC,MAAM,CAAC,uCAAuC;GAC9C,MAAM,CAAC,kCAAkC;GAC1C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,gBAAgB;IAChB,WAAW;IACX,SAAS;IACT,aAAa;IACd;GACD,QAAQ;IACN,WAAW;IACX,eAAe;IACf,YAAY;IACZ,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,aAAa;IACb,UAAU,EAAE;IACb;GACF,CACF;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"run.operation.js","names":[],"sources":["../../src/run/run.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/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.0.0',\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.0.0',\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.0.0',\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.0.0',\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.0.0',\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.0.0',\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.0.0',\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.0.0',\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.0.0',\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: {\n organizationId: 'org-123',\n startDate: '2025-01-01',\n endDate: '2025-01-31',\n granularity: 'day',\n },\n output: {\n totalRuns: 100,\n completedRuns: 90,\n failedRuns: 10,\n totalTokens: 50000,\n totalCostUsd: 5.0,\n averageDurationMs: 2500,\n successRate: 0.9,\n timeline: [],\n },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAeA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC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e,cAAc;KAAE,YAAY;KAAO;IACtE,aAAa;KAAE,MAAM,eAAe,cAAc;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;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,+BAA+B;GACvC,MAAM,CAAC,uCAAuC;GAC9C,MAAM,CAAC,kCAAkC;GAC1C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,gBAAgB;IAChB,WAAW;IACX,SAAS;IACT,aAAa;IACd;GACD,QAAQ;IACN,WAAW;IACX,eAAe;IACf,YAAY;IACZ,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,aAAa;IACb,UAAU,EAAE;IACb;GACF,CACF;EACF;CACF,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
|
8
8
|
const RunListPresentation = {
|
|
9
9
|
meta: {
|
|
10
10
|
key: "agent-console.run.list",
|
|
11
|
-
version: 1,
|
|
11
|
+
version: "1.0.0",
|
|
12
12
|
title: "Run List",
|
|
13
13
|
description: "List view of agent runs with status, tokens, and duration info",
|
|
14
14
|
goal: "Provide an overview of agent execution history and performance.",
|
|
@@ -41,7 +41,7 @@ const RunListPresentation = {
|
|
|
41
41
|
const RunDetailPresentation = {
|
|
42
42
|
meta: {
|
|
43
43
|
key: "agent-console.run.detail",
|
|
44
|
-
version: 1,
|
|
44
|
+
version: "1.0.0",
|
|
45
45
|
title: "Run Details",
|
|
46
46
|
description: "Detailed view of an agent run with steps, logs, and metrics",
|
|
47
47
|
goal: "Allow users to inspect and debug a specific agent run.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.presentation.js","names":["RunListPresentation: PresentationSpec","RunDetailPresentation: PresentationSpec"],"sources":["../../src/run/run.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { RunSummaryModel } from './run.schema';\n\n/**\n * Presentation for displaying a list of agent runs.\n */\nexport const RunListPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.run.list',\n version: 1,\n title: 'Run List',\n description:\n 'List view of agent runs with status, tokens, and duration info',\n goal: 'Provide an overview of agent execution history and performance.',\n context: 'Run history dashboard.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'list', 'dashboard'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunListView',\n props: RunSummaryModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n policy: { flags: ['agent-console.enabled'] },\n};\n\n/**\n * Presentation for run detail view.\n */\nexport const RunDetailPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.run.detail',\n version: 1,\n title: 'Run Details',\n description: 'Detailed view of an agent run with steps, logs, and metrics',\n goal: 'Allow users to inspect and debug a specific agent run.',\n context: 'Detailed view of an agent run.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'detail'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunDetailView',\n },\n targets: ['react', 'markdown'],\n policy: { flags: ['agent-console.enabled'] },\n};\n"],"mappings":";;;;;;;AAOA,MAAaA,sBAAwC;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM;GAAC;GAAO;GAAQ;GAAY;EAClC,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CAClD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C;;;;AAKD,MAAaC,wBAA0C;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM,CAAC,OAAO,SAAS;EACvB,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C"}
|
|
1
|
+
{"version":3,"file":"run.presentation.js","names":["RunListPresentation: PresentationSpec","RunDetailPresentation: PresentationSpec"],"sources":["../../src/run/run.presentation.ts"],"sourcesContent":["import type { PresentationSpec } from '@contractspec/lib.contracts';\nimport { StabilityEnum } from '@contractspec/lib.contracts';\nimport { RunSummaryModel } from './run.schema';\n\n/**\n * Presentation for displaying a list of agent runs.\n */\nexport const RunListPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.run.list',\n version: '1.0.0',\n title: 'Run List',\n description:\n 'List view of agent runs with status, tokens, and duration info',\n goal: 'Provide an overview of agent execution history and performance.',\n context: 'Run history dashboard.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'list', 'dashboard'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunListView',\n props: RunSummaryModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n policy: { flags: ['agent-console.enabled'] },\n};\n\n/**\n * Presentation for run detail view.\n */\nexport const RunDetailPresentation: PresentationSpec = {\n meta: {\n key: 'agent-console.run.detail',\n version: '1.0.0',\n title: 'Run Details',\n description: 'Detailed view of an agent run with steps, logs, and metrics',\n goal: 'Allow users to inspect and debug a specific agent run.',\n context: 'Detailed view of an agent run.',\n domain: 'agent-console',\n owners: ['@agent-console-team'],\n tags: ['run', 'detail'],\n stability: StabilityEnum.Experimental,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'RunDetailView',\n },\n targets: ['react', 'markdown'],\n policy: { flags: ['agent-console.enabled'] },\n};\n"],"mappings":";;;;;;;AAOA,MAAaA,sBAAwC;CACnD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM;GAAC;GAAO;GAAQ;GAAY;EAClC,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CAClD,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C;;;;AAKD,MAAaC,wBAA0C;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ;EACR,QAAQ,CAAC,sBAAsB;EAC/B,MAAM,CAAC,OAAO,SAAS;EACvB,WAAW,cAAc;EAC1B;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,EAAE;CAC7C"}
|
package/dist/tool/tool.event.js
CHANGED
|
@@ -50,7 +50,7 @@ const ToolCreatedPayload = defineSchemaModel$1({
|
|
|
50
50
|
const ToolCreatedEvent = defineEvent({
|
|
51
51
|
meta: {
|
|
52
52
|
key: "agent.tool.created",
|
|
53
|
-
version: 1,
|
|
53
|
+
version: "1.0.0",
|
|
54
54
|
description: "A new AI tool was created.",
|
|
55
55
|
stability: "stable",
|
|
56
56
|
owners: [...OWNERS],
|
|
@@ -98,7 +98,7 @@ const ToolUpdatedPayload = defineSchemaModel$1({
|
|
|
98
98
|
const ToolUpdatedEvent = defineEvent({
|
|
99
99
|
meta: {
|
|
100
100
|
key: "agent.tool.updated",
|
|
101
|
-
version: 1,
|
|
101
|
+
version: "1.0.0",
|
|
102
102
|
description: "An AI tool configuration was updated.",
|
|
103
103
|
stability: "stable",
|
|
104
104
|
owners: [...OWNERS],
|
|
@@ -145,7 +145,7 @@ const ToolStatusChangedPayload = defineSchemaModel$1({
|
|
|
145
145
|
const ToolStatusChangedEvent = defineEvent({
|
|
146
146
|
meta: {
|
|
147
147
|
key: "agent.tool.statusChanged",
|
|
148
|
-
version: 1,
|
|
148
|
+
version: "1.0.0",
|
|
149
149
|
description: "An AI tool status was changed (activated, deprecated, disabled).",
|
|
150
150
|
stability: "stable",
|
|
151
151
|
owners: [...OWNERS],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.event.js","names":["defineSchemaModel"],"sources":["../../src/tool/tool.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for tool created event.\n */\nconst ToolCreatedPayload = defineSchemaModel({\n name: 'ToolCreatedPayload',\n description: 'Payload for tool created event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n implementationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCreatedEvent - A new tool was created.\n */\nexport const ToolCreatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.created',\n version: 1,\n description: 'A new AI tool was created.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n },\n payload: ToolCreatedPayload,\n});\n\n/**\n * Payload for tool updated event.\n */\nconst ToolUpdatedPayload = defineSchemaModel({\n name: 'ToolUpdatedPayload',\n description: 'Payload for tool updated event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedFields: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: false,\n },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolUpdatedEvent - A tool was updated.\n */\nexport const ToolUpdatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.updated',\n version: 1,\n description: 'An AI tool configuration was updated.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n },\n payload: ToolUpdatedPayload,\n});\n\n/**\n * Payload for tool status changed event.\n */\nconst ToolStatusChangedPayload = defineSchemaModel({\n name: 'ToolStatusChangedPayload',\n description: 'Payload for tool status changed event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolStatusChangedEvent - A tool's status was changed.\n */\nexport const ToolStatusChangedEvent = defineEvent({\n meta: {\n key: 'agent.tool.statusChanged',\n version: 1,\n description:\n 'An AI tool status was changed (activated, deprecated, disabled).',\n stability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YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,UAAU;EAC1B;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAM,2BAA2BA,oBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACzB;CACD,SAAS;CACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"tool.event.js","names":["defineSchemaModel"],"sources":["../../src/tool/tool.event.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * Payload for tool created event.\n */\nconst ToolCreatedPayload = defineSchemaModel({\n name: 'ToolCreatedPayload',\n description: 'Payload for tool created event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n category: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n implementationType: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n createdById: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolCreatedEvent - A new tool was created.\n */\nexport const ToolCreatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.created',\n version: '1.0.0',\n description: 'A new AI tool was created.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n },\n payload: ToolCreatedPayload,\n});\n\n/**\n * Payload for tool updated event.\n */\nconst ToolUpdatedPayload = defineSchemaModel({\n name: 'ToolUpdatedPayload',\n description: 'Payload for tool updated event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedFields: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: false,\n },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolUpdatedEvent - A tool was updated.\n */\nexport const ToolUpdatedEvent = defineEvent({\n meta: {\n key: 'agent.tool.updated',\n version: '1.0.0',\n description: 'An AI tool configuration was updated.',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n },\n payload: ToolUpdatedPayload,\n});\n\n/**\n * Payload for tool status changed event.\n */\nconst ToolStatusChangedPayload = defineSchemaModel({\n name: 'ToolStatusChangedPayload',\n description: 'Payload for tool status changed event',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * ToolStatusChangedEvent - A tool's status was changed.\n */\nexport const ToolStatusChangedEvent = defineEvent({\n meta: {\n key: 'agent.tool.statusChanged',\n version: '1.0.0',\n description:\n 'An AI tool status was changed (activated, deprecated, disabled).',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'status'],\n },\n payload: ToolStatusChangedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAM,qBAAqBA,oBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,oBAAoB;GAClB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,UAAU;EAC1B;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAM,qBAAqBA,oBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,SAAS;GACT,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,UAAU;EAC1B;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAM,2BAA2BA,oBAAkB;CACjD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,YAAY;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACzB;CACD,SAAS;CACV,CAAC"}
|
|
@@ -74,7 +74,7 @@ declare const CreateToolCommand: _contractspec_lib_contracts27.OperationSpec<_co
|
|
|
74
74
|
};
|
|
75
75
|
}>, {
|
|
76
76
|
key: string;
|
|
77
|
-
version:
|
|
77
|
+
version: string;
|
|
78
78
|
stability: string;
|
|
79
79
|
owners: "@agent-console-team"[];
|
|
80
80
|
tags: string[];
|
|
@@ -178,7 +178,7 @@ declare const UpdateToolCommand: _contractspec_lib_contracts27.OperationSpec<_co
|
|
|
178
178
|
};
|
|
179
179
|
}>, {
|
|
180
180
|
key: string;
|
|
181
|
-
version:
|
|
181
|
+
version: string;
|
|
182
182
|
stability: string;
|
|
183
183
|
owners: "@agent-console-team"[];
|
|
184
184
|
tags: string[];
|
|
@@ -11,7 +11,7 @@ const OWNERS = ["@agent-console-team"];
|
|
|
11
11
|
const CreateToolCommand = defineCommand({
|
|
12
12
|
meta: {
|
|
13
13
|
key: "agent.tool.create",
|
|
14
|
-
version: 1,
|
|
14
|
+
version: "1.0.0",
|
|
15
15
|
stability: "stable",
|
|
16
16
|
owners: [...OWNERS],
|
|
17
17
|
tags: ["tool", "create"],
|
|
@@ -53,7 +53,7 @@ const CreateToolCommand = defineCommand({
|
|
|
53
53
|
sideEffects: {
|
|
54
54
|
emits: [{
|
|
55
55
|
key: "tool.created",
|
|
56
|
-
version: 1,
|
|
56
|
+
version: "1.0.0",
|
|
57
57
|
stability: "stable",
|
|
58
58
|
owners: [...OWNERS],
|
|
59
59
|
tags: ["tool", "created"],
|
|
@@ -97,7 +97,7 @@ const CreateToolCommand = defineCommand({
|
|
|
97
97
|
const UpdateToolCommand = defineCommand({
|
|
98
98
|
meta: {
|
|
99
99
|
key: "agent.tool.update",
|
|
100
|
-
version: 1,
|
|
100
|
+
version: "1.0.0",
|
|
101
101
|
stability: "stable",
|
|
102
102
|
owners: [...OWNERS],
|
|
103
103
|
tags: ["tool", "update"],
|
|
@@ -139,7 +139,7 @@ const UpdateToolCommand = defineCommand({
|
|
|
139
139
|
sideEffects: {
|
|
140
140
|
emits: [{
|
|
141
141
|
key: "tool.updated",
|
|
142
|
-
version: 1,
|
|
142
|
+
version: "1.0.0",
|
|
143
143
|
stability: "stable",
|
|
144
144
|
owners: [...OWNERS],
|
|
145
145
|
tags: ["tool", "updated"],
|
|
@@ -176,7 +176,7 @@ const UpdateToolCommand = defineCommand({
|
|
|
176
176
|
const GetToolQuery = defineQuery({
|
|
177
177
|
meta: {
|
|
178
178
|
key: "agent.tool.get",
|
|
179
|
-
version: 1,
|
|
179
|
+
version: "1.0.0",
|
|
180
180
|
stability: "stable",
|
|
181
181
|
owners: [...OWNERS],
|
|
182
182
|
tags: ["tool", "get"],
|
|
@@ -226,7 +226,7 @@ const GetToolQuery = defineQuery({
|
|
|
226
226
|
const ListToolsQuery = defineQuery({
|
|
227
227
|
meta: {
|
|
228
228
|
key: "agent.tool.list",
|
|
229
|
-
version: 1,
|
|
229
|
+
version: "1.0.0",
|
|
230
230
|
stability: "stable",
|
|
231
231
|
owners: [...OWNERS],
|
|
232
232
|
tags: ["tool", "list"],
|
|
@@ -314,7 +314,7 @@ const ListToolsQuery = defineQuery({
|
|
|
314
314
|
const TestToolCommand = defineCommand({
|
|
315
315
|
meta: {
|
|
316
316
|
key: "agent.tool.test",
|
|
317
|
-
version: 1,
|
|
317
|
+
version: "1.0.0",
|
|
318
318
|
stability: "stable",
|
|
319
319
|
owners: [...OWNERS],
|
|
320
320
|
tags: ["tool", "test"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.operation.js","names":[],"sources":["../../src/tool/tool.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ToolCategoryEnum, ToolStatusEnum } from './tool.enum';\nimport {\n CreateToolInputModel,\n ToolModel,\n ToolSummaryModel,\n UpdateToolInputModel,\n} from './tool.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * CreateToolCommand - Creates a new tool definition.\n */\nexport const CreateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.create',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'create'],\n description: 'Creates a new AI tool definition.',\n goal: 'Allow users to define new tools that agents can use.',\n context: 'Called from the tool builder UI when creating a new tool.',\n },\n io: {\n input: CreateToolInputModel,\n output: defineSchemaModel({\n name: 'CreateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n },\n }),\n errors: {\n SLUG_EXISTS: {\n description: 'A tool with this slug already exists in the organization',\n http: 409,\n gqlCode: 'SLUG_EXISTS',\n when: 'Slug is already taken',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.created',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n when: 'Tool is successfully created',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-tool-happy-path',\n given: ['User is authenticated', 'Organization exists'],\n when: ['User submits valid tool configuration'],\n then: ['New tool is created', 'ToolCreated event is emitted'],\n },\n {\n key: 'create-tool-slug-conflict',\n given: ['Tool with same slug exists'],\n when: ['User submits tool with duplicate slug'],\n then: ['SLUG_EXISTS error is returned'],\n },\n ],\n examples: [\n {\n key: 'create-api-tool',\n input: {\n name: 'Weather API',\n slug: 'weather-api',\n category: 'api',\n description: 'Fetches weather data',\n },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n slug: 'weather-api',\n status: 'draft',\n },\n },\n ],\n },\n});\n\n/**\n * UpdateToolCommand - Updates an existing tool.\n */\nexport const UpdateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.update',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'update'],\n description: 'Updates an existing AI tool definition.',\n goal: 'Allow users to modify tool settings and configuration.',\n context: 'Called from the tool settings UI.',\n },\n io: {\n input: UpdateToolInputModel,\n output: defineSchemaModel({\n name: 'UpdateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.updated',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n when: 'Tool is updated',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-tool-happy-path',\n given: ['Tool exists', 'User owns the tool'],\n when: ['User submits updated configuration'],\n then: ['Tool is updated', 'ToolUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'update-description',\n input: { toolId: 'tool-123', description: 'Updated weather API tool' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'draft',\n updatedAt: '2025-01-01T00:00:00Z',\n },\n },\n ],\n },\n});\n\n/**\n * GetToolQuery - Retrieves a tool by ID.\n */\nexport const GetToolQuery = defineQuery({\n meta: {\n key: 'agent.tool.get',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'get'],\n description: 'Retrieves a tool by its ID.',\n goal: 'View detailed tool configuration.',\n context: 'Called when viewing tool details or editing.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: ToolModel,\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-tool-happy-path',\n given: ['Tool exists'],\n when: ['User requests tool by ID'],\n then: ['Tool details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { toolId: 'tool-123' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'active',\n category: 'api',\n },\n },\n ],\n },\n});\n\n/**\n * ListToolsQuery - Lists tools for an organization.\n */\nexport const ListToolsQuery = defineQuery({\n meta: {\n key: 'agent.tool.list',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'list'],\n description: 'Lists tools for an organization with optional filtering.',\n goal: 'Browse and search available tools.',\n context: 'Tool list/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListToolsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n category: { type: ToolCategoryEnum, isOptional: true },\n status: { type: ToolStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), 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: 'ListToolsOutput',\n fields: {\n items: { type: ToolSummaryModel, 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-tools-happy-path',\n given: ['Organization has tools'],\n when: ['User lists tools'],\n then: ['Paginated list of tools is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-category',\n input: { organizationId: 'org-123', category: 'api', limit: 10 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * TestToolCommand - Tests a tool with sample input.\n */\nexport const TestToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.test',\n version: 1,\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'test'],\n description: 'Tests a tool with sample input to verify it works correctly.',\n goal: 'Validate tool configuration before deployment.',\n context: 'Tool builder UI - test panel.',\n },\n io: {\n input: defineSchemaModel({\n name: 'TestToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n testInput: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'TestToolOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n TOOL_EXECUTION_ERROR: {\n description: 'Tool execution failed',\n http: 500,\n gqlCode: 'TOOL_EXECUTION_ERROR',\n when: 'Tool returns an error',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: { audit: ['tool.tested'] },\n acceptance: {\n scenarios: [\n {\n key: 'test-tool-success',\n given: ['Tool exists', 'Tool is configured correctly'],\n when: ['User runs test with valid input'],\n then: ['Tool executes successfully', 'Output is returned'],\n },\n {\n key: 'test-tool-failure',\n given: ['Tool exists', 'Tool has configuration error'],\n when: ['User runs test'],\n then: ['TOOL_EXECUTION_ERROR is returned'],\n },\n ],\n examples: [\n {\n key: 'test-weather-api',\n input: { toolId: 'tool-123', testInput: { city: 'Paris' } },\n output: { success: true, output: { temperature: 22 }, durationMs: 150 },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAaA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,oBAAoB,cAAc;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CA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B;GACtD,MAAM,CAAC,kCAAkC;GACzC,MAAM,CAAC,8BAA8B,qBAAqB;GAC3D,EACD;GACE,KAAK;GACL,OAAO,CAAC,eAAe,+BAA+B;GACtD,MAAM,CAAC,iBAAiB;GACxB,MAAM,CAAC,mCAAmC;GAC3C,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,WAAW,EAAE,MAAM,SAAS;IAAE;GAC3D,QAAQ;IAAE,SAAS;IAAM,QAAQ,EAAE,aAAa,IAAI;IAAE,YAAY;IAAK;GACxE,CACF;EACF;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"tool.operation.js","names":[],"sources":["../../src/tool/tool.operation.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ToolCategoryEnum, ToolStatusEnum } from './tool.enum';\nimport {\n CreateToolInputModel,\n ToolModel,\n ToolSummaryModel,\n UpdateToolInputModel,\n} from './tool.schema';\n\nconst OWNERS = ['@agent-console-team'] as const;\n\n/**\n * CreateToolCommand - Creates a new tool definition.\n */\nexport const CreateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'create'],\n description: 'Creates a new AI tool definition.',\n goal: 'Allow users to define new tools that agents can use.',\n context: 'Called from the tool builder UI when creating a new tool.',\n },\n io: {\n input: CreateToolInputModel,\n output: defineSchemaModel({\n name: 'CreateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n },\n }),\n errors: {\n SLUG_EXISTS: {\n description: 'A tool with this slug already exists in the organization',\n http: 409,\n gqlCode: 'SLUG_EXISTS',\n when: 'Slug is already taken',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.created',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'created'],\n when: 'Tool is successfully created',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-tool-happy-path',\n given: ['User is authenticated', 'Organization exists'],\n when: ['User submits valid tool configuration'],\n then: ['New tool is created', 'ToolCreated event is emitted'],\n },\n {\n key: 'create-tool-slug-conflict',\n given: ['Tool with same slug exists'],\n when: ['User submits tool with duplicate slug'],\n then: ['SLUG_EXISTS error is returned'],\n },\n ],\n examples: [\n {\n key: 'create-api-tool',\n input: {\n name: 'Weather API',\n slug: 'weather-api',\n category: 'api',\n description: 'Fetches weather data',\n },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n slug: 'weather-api',\n status: 'draft',\n },\n },\n ],\n },\n});\n\n/**\n * UpdateToolCommand - Updates an existing tool.\n */\nexport const UpdateToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.update',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'update'],\n description: 'Updates an existing AI tool definition.',\n goal: 'Allow users to modify tool settings and configuration.',\n context: 'Called from the tool settings UI.',\n },\n io: {\n input: UpdateToolInputModel,\n output: defineSchemaModel({\n name: 'UpdateToolOutput',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n status: { type: ToolStatusEnum, isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'tool.updated',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'updated'],\n when: 'Tool is updated',\n payload: ToolSummaryModel,\n },\n ],\n audit: ['tool.updated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-tool-happy-path',\n given: ['Tool exists', 'User owns the tool'],\n when: ['User submits updated configuration'],\n then: ['Tool is updated', 'ToolUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'update-description',\n input: { toolId: 'tool-123', description: 'Updated weather API tool' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'draft',\n updatedAt: '2025-01-01T00:00:00Z',\n },\n },\n ],\n },\n});\n\n/**\n * GetToolQuery - Retrieves a tool by ID.\n */\nexport const GetToolQuery = defineQuery({\n meta: {\n key: 'agent.tool.get',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'get'],\n description: 'Retrieves a tool by its ID.',\n goal: 'View detailed tool configuration.',\n context: 'Called when viewing tool details or editing.',\n },\n io: {\n input: defineSchemaModel({\n name: 'GetToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n }),\n output: ToolModel,\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n },\n },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'get-tool-happy-path',\n given: ['Tool exists'],\n when: ['User requests tool by ID'],\n then: ['Tool details are returned'],\n },\n ],\n examples: [\n {\n key: 'get-basic',\n input: { toolId: 'tool-123' },\n output: {\n id: 'tool-123',\n name: 'Weather API',\n status: 'active',\n category: 'api',\n },\n },\n ],\n },\n});\n\n/**\n * ListToolsQuery - Lists tools for an organization.\n */\nexport const ListToolsQuery = defineQuery({\n meta: {\n key: 'agent.tool.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'list'],\n description: 'Lists tools for an organization with optional filtering.',\n goal: 'Browse and search available tools.',\n context: 'Tool list/dashboard view.',\n },\n io: {\n input: defineSchemaModel({\n name: 'ListToolsInput',\n fields: {\n organizationId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n category: { type: ToolCategoryEnum, isOptional: true },\n status: { type: ToolStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), 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: 'ListToolsOutput',\n fields: {\n items: { type: ToolSummaryModel, 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-tools-happy-path',\n given: ['Organization has tools'],\n when: ['User lists tools'],\n then: ['Paginated list of tools is returned'],\n },\n ],\n examples: [\n {\n key: 'list-by-category',\n input: { organizationId: 'org-123', category: 'api', limit: 10 },\n output: { items: [], total: 0, hasMore: false },\n },\n ],\n },\n});\n\n/**\n * TestToolCommand - Tests a tool with sample input.\n */\nexport const TestToolCommand = defineCommand({\n meta: {\n key: 'agent.tool.test',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['tool', 'test'],\n description: 'Tests a tool with sample input to verify it works correctly.',\n goal: 'Validate tool configuration before deployment.',\n context: 'Tool builder UI - test panel.',\n },\n io: {\n input: defineSchemaModel({\n name: 'TestToolInput',\n fields: {\n toolId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n testInput: { type: ScalarTypeEnum.JSONObject(), isOptional: false },\n },\n }),\n output: defineSchemaModel({\n name: 'TestToolOutput',\n fields: {\n success: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n output: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n error: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n durationMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n }),\n errors: {\n TOOL_NOT_FOUND: {\n description: 'The specified tool does not exist',\n http: 404,\n gqlCode: 'TOOL_NOT_FOUND',\n when: 'Tool ID is invalid',\n },\n TOOL_EXECUTION_ERROR: {\n description: 'Tool execution failed',\n http: 500,\n gqlCode: 'TOOL_EXECUTION_ERROR',\n when: 'Tool returns an error',\n },\n },\n },\n policy: { auth: 'user' },\n sideEffects: { audit: ['tool.tested'] },\n acceptance: {\n scenarios: [\n {\n key: 'test-tool-success',\n given: ['Tool exists', 'Tool is configured correctly'],\n when: ['User runs test with valid input'],\n then: ['Tool executes successfully', 'Output is returned'],\n },\n {\n key: 'test-tool-failure',\n given: ['Tool exists', 'Tool has configuration error'],\n when: ['User runs test'],\n then: ['TOOL_EXECUTION_ERROR is returned'],\n },\n ],\n examples: [\n {\n key: 'test-weather-api',\n input: { toolId: 'tool-123', testInput: { city: 'Paris' } },\n output: { success: true, output: { temperature: 22 }, durationMs: 150 },\n },\n ],\n },\n});\n"],"mappings":";;;;;;AAaA,MAAM,SAAS,CAAC,sBAAsB;;;;AAKtC,MAAa,oBAAoB,cAAc;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM,CAAC,QAAQ,SAAS;EACxB,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ,kBAAkB;GACxB,MAAM;GACN,QAAQ;IACN,IAAI;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACjE,MAAM;KAAE,MAAM,eAAe,gBAAgB;KAAE,YAAY;KAAO;IAClE,MAAM;KAAE,MAAM,eAAe,iBAAiB;KAAE,YAAY;KAAO;IACnE,QAAQ;KAAE,MAAM;KAAgB,YAAY;KAAO;IACpD;GACF,CAAC;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 -8,7 +8,7 @@ import { StabilityEnum } from "@contractspec/lib.contracts";
|
|
|
8
8
|
const ToolListPresentation = {
|
|
9
9
|
meta: {
|
|
10
10
|
key: "agent-console.tool.list",
|
|
11
|
-
version: 1,
|
|
11
|
+
version: "1.0.0",
|
|
12
12
|
title: "Tool List",
|
|
13
13
|
description: "List view of AI tools with category, status, and version info",
|
|
14
14
|
goal: "Provide an overview of all available tools for agents.",
|
|
@@ -41,7 +41,7 @@ const ToolListPresentation = {
|
|
|
41
41
|
const ToolDetailPresentation = {
|
|
42
42
|
meta: {
|
|
43
43
|
key: "agent-console.tool.detail",
|
|
44
|
-
version: 1,
|
|
44
|
+
version: "1.0.0",
|
|
45
45
|
title: "Tool Details",
|
|
46
46
|
description: "Detailed view of an AI tool with configuration and test panel",
|
|
47
47
|
goal: "Allow users to inspect and test a specific tool.",
|