@m6d/cortex-cli 0.6.0 → 0.8.0
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { MESSAGE_ROLES, type TokenUsage } from "../wire/index";
|
|
3
3
|
import { agentRefSchema, agentSlugSchema, variableDeclarationSchema } from "./grammar";
|
|
4
|
-
import { TRIGGER_OUTCOMES, TRIGGER_SOURCES } from "./triggers";
|
|
4
|
+
import { approvalRequestedEventSchema, TRIGGER_OUTCOMES, TRIGGER_SOURCES } from "./triggers";
|
|
5
5
|
import { DATASET_ERROR_KINDS } from "./datasets";
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -141,6 +141,19 @@ export const syncEventSchema = z.discriminatedUnion("type", [
|
|
|
141
141
|
createdAt: z.iso.datetime(),
|
|
142
142
|
finishedAt: z.iso.datetime().nullable(),
|
|
143
143
|
}),
|
|
144
|
+
/**
|
|
145
|
+
* A run on a cc-backed agent parked on approval. cc delivers it to the
|
|
146
|
+
* published webhooks in the agent's audience; a code agent reacts in
|
|
147
|
+
* code and sends none.
|
|
148
|
+
*/
|
|
149
|
+
z.object({
|
|
150
|
+
type: z.literal("approval.requested"),
|
|
151
|
+
id: z.uuid(),
|
|
152
|
+
agentSlug: agentSlugSchema,
|
|
153
|
+
agentRef: agentRefSchema,
|
|
154
|
+
payload: approvalRequestedEventSchema,
|
|
155
|
+
createdAt: z.iso.datetime(),
|
|
156
|
+
}),
|
|
144
157
|
/** What the server offers console-created agents, sent whole at boot and replacing the previous declaration. */
|
|
145
158
|
z.object({
|
|
146
159
|
type: z.literal("server.declare"),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { datasetIdentifierSchema } from "./datasets";
|
|
3
3
|
import {
|
|
4
|
+
agentRefSchema,
|
|
4
5
|
agentSlugSchema,
|
|
5
6
|
localizedTextSchema,
|
|
6
7
|
mentionedToolSchema,
|
|
@@ -159,6 +160,31 @@ const triggerApprovalSchema = z.object({
|
|
|
159
160
|
input: z.unknown(),
|
|
160
161
|
});
|
|
161
162
|
|
|
163
|
+
/** The host-reaction events a run reports. One so far; the shape is generic. */
|
|
164
|
+
export const HOST_EVENTS = ["approval_requested"] as const;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A run parked on server tools that need the user's approval, as every host
|
|
168
|
+
* hears of it: the code hook's argument and a webhook's body are this one
|
|
169
|
+
* object. `agentId` is the slug; `agentRef` is cc's id when cc backs the
|
|
170
|
+
* agent. `firingId` and `triggerName` are set when a trigger started the run,
|
|
171
|
+
* which is what a host answering through the firing route needs.
|
|
172
|
+
*/
|
|
173
|
+
export const approvalRequestedEventSchema = z.object({
|
|
174
|
+
event: z.literal("approval_requested"),
|
|
175
|
+
agentId: z.string(),
|
|
176
|
+
agentRef: agentRefSchema.optional(),
|
|
177
|
+
threadId: z.string(),
|
|
178
|
+
runId: z.string(),
|
|
179
|
+
userId: z.string(),
|
|
180
|
+
firingId: z.uuid().optional(),
|
|
181
|
+
triggerName: z.string().optional(),
|
|
182
|
+
/** The hook always gets each call's `input`; a webhook body leaves it out when the whole would be too large for the wire. */
|
|
183
|
+
approvals: z.array(triggerApprovalSchema.extend({ input: z.unknown().optional() })),
|
|
184
|
+
occurredAt: z.iso.datetime(),
|
|
185
|
+
});
|
|
186
|
+
export type ApprovalRequestedEvent = z.infer<typeof approvalRequestedEventSchema>;
|
|
187
|
+
|
|
162
188
|
export const triggerFiringResponseSchema = z.discriminatedUnion("outcome", [
|
|
163
189
|
z.object({
|
|
164
190
|
firingId: z.uuid(),
|
package/src/scaffold/files.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type Database = "postgres" | "mssql";
|
|
|
27
27
|
// sync (scripts/sync-package-versions.ts) restamps it and files.test.ts holds
|
|
28
28
|
// them to that.
|
|
29
29
|
export const DEPENDENCIES = {
|
|
30
|
-
"@m6d/cortex-server": "~0.
|
|
30
|
+
"@m6d/cortex-server": "~0.8.0",
|
|
31
31
|
"@tanstack/ai": "^0.55.0",
|
|
32
32
|
"@tanstack/ai-openai": "^0.22.8",
|
|
33
33
|
hono: "^4.12.3",
|