@stigmer/cli 3.2.3 → 3.4.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/commands/delete.js +5 -2
- package/commands/delete.js.map +1 -1
- package/commands/mcp-server.d.ts.map +1 -1
- package/commands/mcp-server.js +1 -0
- package/commands/mcp-server.js.map +1 -1
- package/package.json +5 -5
- package/registry/metadata.d.ts.map +1 -1
- package/registry/metadata.js +2 -0
- package/registry/metadata.js.map +1 -1
- package/registry/verb-support.d.ts.map +1 -1
- package/registry/verb-support.js +4 -0
- package/registry/verb-support.js.map +1 -1
- package/resources/apply/apply.d.ts.map +1 -1
- package/resources/apply/apply.js +13 -10
- package/resources/apply/apply.js.map +1 -1
- package/resources/apply/handlers.d.ts.map +1 -1
- package/resources/apply/handlers.js +11 -0
- package/resources/apply/handlers.js.map +1 -1
- package/resources/delete.d.ts +5 -1
- package/resources/delete.d.ts.map +1 -1
- package/resources/delete.js +40 -8
- package/resources/delete.js.map +1 -1
- package/resources/get-bindings.d.ts.map +1 -1
- package/resources/get-bindings.js +8 -0
- package/resources/get-bindings.js.map +1 -1
- package/resources/list.d.ts.map +1 -1
- package/resources/list.js +1 -0
- package/resources/list.js.map +1 -1
- package/resources/validate.d.ts.map +1 -1
- package/resources/validate.js +2 -0
- package/resources/validate.js.map +1 -1
- package/src/commands/delete.ts +5 -2
- package/src/commands/mcp-server.ts +1 -0
- package/src/registry/metadata.ts +2 -0
- package/src/registry/verb-support.ts +4 -0
- package/src/resources/apply/apply.integration.test.ts +69 -0
- package/src/resources/apply/apply.ts +13 -10
- package/src/resources/apply/handlers.ts +11 -0
- package/src/resources/delete.ts +48 -9
- package/src/resources/get-bindings.ts +8 -0
- package/src/resources/list.ts +1 -0
- package/src/resources/mutate-verbs.integration.test.ts +178 -1
- package/src/resources/read-verbs.integration.test.ts +111 -1
- package/src/resources/validate.ts +2 -0
|
@@ -11,8 +11,14 @@ import { Code, ConnectError, type ConnectRouter } from "@connectrpc/connect";
|
|
|
11
11
|
import { connectNodeAdapter } from "@connectrpc/connect-node";
|
|
12
12
|
import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
13
13
|
import { AgentQueryController } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/query_pb";
|
|
14
|
+
import { AgentChannelSchema } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/api_pb";
|
|
15
|
+
import { AgentChannelQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentchannel/v1/query_pb";
|
|
14
16
|
import { AgentInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/api_pb";
|
|
15
17
|
import { AgentInstanceQueryController } from "@stigmer/protos/ai/stigmer/agentic/agentinstance/v1/query_pb";
|
|
18
|
+
import { ChannelAppSchema } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/api_pb";
|
|
19
|
+
import { ChannelAppQueryController } from "@stigmer/protos/ai/stigmer/agentic/channelapp/v1/query_pb";
|
|
20
|
+
import { EnvironmentSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/api_pb";
|
|
21
|
+
import { EnvironmentQueryController } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/query_pb";
|
|
16
22
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
17
23
|
import { ApiKeySchema } from "@stigmer/protos/ai/stigmer/iam/apikey/v1/api_pb";
|
|
18
24
|
import { ApiKeyQueryController } from "@stigmer/protos/ai/stigmer/iam/apikey/v1/query_pb";
|
|
@@ -67,6 +73,26 @@ const knownSearchResult = create(SearchResultSchema, {
|
|
|
67
73
|
description: "reviews code",
|
|
68
74
|
});
|
|
69
75
|
|
|
76
|
+
// The three T07 cutover kinds — wired into get-bindings alongside this test.
|
|
77
|
+
const knownEnvironment = create(EnvironmentSchema, {
|
|
78
|
+
apiVersion: "agentic.stigmer.ai/v1",
|
|
79
|
+
kind: "Environment",
|
|
80
|
+
metadata: { name: "clinic-patient-db", slug: "clinic-patient-db", org: "acme", id: "env_1" },
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const knownChannel = create(AgentChannelSchema, {
|
|
84
|
+
apiVersion: "agentic.stigmer.ai/v1",
|
|
85
|
+
kind: "AgentChannel",
|
|
86
|
+
metadata: { name: "clinic-patient-whatsapp", slug: "clinic-patient-whatsapp", org: "acme", id: "ach_1" },
|
|
87
|
+
spec: { enabled: true },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const knownChannelApp = create(ChannelAppSchema, {
|
|
91
|
+
apiVersion: "agentic.stigmer.ai/v1",
|
|
92
|
+
kind: "ChannelApp",
|
|
93
|
+
metadata: { name: "clinic-meta-app", slug: "clinic-meta-app", org: "acme", id: "chapp_1" },
|
|
94
|
+
});
|
|
95
|
+
|
|
70
96
|
let backend: Http2Server;
|
|
71
97
|
let client: Stigmer;
|
|
72
98
|
const openSessions = new Set<ServerHttp2Session>();
|
|
@@ -106,6 +132,36 @@ beforeAll(async () => {
|
|
|
106
132
|
router.service(ApiKeyQueryController, {
|
|
107
133
|
findAll: () => ({ entries: [knownApiKey] }),
|
|
108
134
|
});
|
|
135
|
+
router.service(EnvironmentQueryController, {
|
|
136
|
+
get: (req) => {
|
|
137
|
+
if (req.value !== "env_1") throw new ConnectError("environment not found", Code.NotFound);
|
|
138
|
+
return knownEnvironment;
|
|
139
|
+
},
|
|
140
|
+
getByReference: (req) => {
|
|
141
|
+
if (req.slug !== "clinic-patient-db") throw new ConnectError("environment not found", Code.NotFound);
|
|
142
|
+
return knownEnvironment;
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
router.service(AgentChannelQueryController, {
|
|
146
|
+
get: (req) => {
|
|
147
|
+
if (req.value !== "ach_1") throw new ConnectError("agent channel not found", Code.NotFound);
|
|
148
|
+
return knownChannel;
|
|
149
|
+
},
|
|
150
|
+
getByReference: (req) => {
|
|
151
|
+
if (req.slug !== "clinic-patient-whatsapp") throw new ConnectError("agent channel not found", Code.NotFound);
|
|
152
|
+
return knownChannel;
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
router.service(ChannelAppQueryController, {
|
|
156
|
+
get: (req) => {
|
|
157
|
+
if (req.value !== "chapp_1") throw new ConnectError("channel app not found", Code.NotFound);
|
|
158
|
+
return knownChannelApp;
|
|
159
|
+
},
|
|
160
|
+
getByReference: (req) => {
|
|
161
|
+
if (req.slug !== "clinic-meta-app") throw new ConnectError("channel app not found", Code.NotFound);
|
|
162
|
+
return knownChannelApp;
|
|
163
|
+
},
|
|
164
|
+
});
|
|
109
165
|
};
|
|
110
166
|
backend = createHttp2Server(connectNodeAdapter({ routes }));
|
|
111
167
|
backend.on("session", (session) => {
|
|
@@ -169,6 +225,58 @@ describe("get integration", () => {
|
|
|
169
225
|
});
|
|
170
226
|
});
|
|
171
227
|
|
|
228
|
+
it("fetches an environment by org/slug and renders backend protojson", async () => {
|
|
229
|
+
const { schema, message } = await fetchResource(client, ApiResourceKind.environment, {
|
|
230
|
+
kind: "ref",
|
|
231
|
+
org: "acme",
|
|
232
|
+
slug: "clinic-patient-db",
|
|
233
|
+
});
|
|
234
|
+
const rendered = JSON.parse(renderResource(schema, message, "json"));
|
|
235
|
+
expect(rendered).toEqual(toJson(EnvironmentSchema, knownEnvironment, { useProtoFieldName: true }));
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it("fetches an environment by ID", async () => {
|
|
239
|
+
const { message } = await fetchResource(client, ApiResourceKind.environment, { kind: "id", id: "env_1" });
|
|
240
|
+
expect(JSON.parse(renderResource(EnvironmentSchema, message, "json"))).toMatchObject({
|
|
241
|
+
metadata: { id: "env_1" },
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("fetches an agent channel by org/slug and renders backend protojson", async () => {
|
|
246
|
+
const { schema, message } = await fetchResource(client, ApiResourceKind.agent_channel, {
|
|
247
|
+
kind: "ref",
|
|
248
|
+
org: "acme",
|
|
249
|
+
slug: "clinic-patient-whatsapp",
|
|
250
|
+
});
|
|
251
|
+
const rendered = JSON.parse(renderResource(schema, message, "json"));
|
|
252
|
+
expect(rendered).toEqual(toJson(AgentChannelSchema, knownChannel, { useProtoFieldName: true }));
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("fetches an agent channel by ID", async () => {
|
|
256
|
+
const { message } = await fetchResource(client, ApiResourceKind.agent_channel, { kind: "id", id: "ach_1" });
|
|
257
|
+
expect(JSON.parse(renderResource(AgentChannelSchema, message, "json"))).toMatchObject({
|
|
258
|
+
metadata: { id: "ach_1" },
|
|
259
|
+
spec: { enabled: true },
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("fetches a channel app by org/slug and renders backend protojson", async () => {
|
|
264
|
+
const { schema, message } = await fetchResource(client, ApiResourceKind.channel_app, {
|
|
265
|
+
kind: "ref",
|
|
266
|
+
org: "acme",
|
|
267
|
+
slug: "clinic-meta-app",
|
|
268
|
+
});
|
|
269
|
+
const rendered = JSON.parse(renderResource(schema, message, "json"));
|
|
270
|
+
expect(rendered).toEqual(toJson(ChannelAppSchema, knownChannelApp, { useProtoFieldName: true }));
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("fetches a channel app by ID", async () => {
|
|
274
|
+
const { message } = await fetchResource(client, ApiResourceKind.channel_app, { kind: "id", id: "chapp_1" });
|
|
275
|
+
expect(JSON.parse(renderResource(ChannelAppSchema, message, "json"))).toMatchObject({
|
|
276
|
+
metadata: { id: "chapp_1" },
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
172
280
|
it("maps a NotFound backend error to ExitCode.NotFound", async () => {
|
|
173
281
|
const err = await fetchResource(client, ApiResourceKind.agent, { kind: "id", id: "missing" }).catch((e) => e);
|
|
174
282
|
const classified = classify(err);
|
|
@@ -176,7 +284,9 @@ describe("get integration", () => {
|
|
|
176
284
|
});
|
|
177
285
|
|
|
178
286
|
it("rejects an unsupported kind with a usage error", async () => {
|
|
179
|
-
|
|
287
|
+
// session declares Get in the registry but has no get binding — the
|
|
288
|
+
// canonical still-unwired kind (environment gained a binding).
|
|
289
|
+
const err = await fetchResource(client, ApiResourceKind.session, { kind: "id", id: "x" }).catch((e) => e);
|
|
180
290
|
expect(classify(err)?.exitCode).toBe(ExitCode.Usage);
|
|
181
291
|
});
|
|
182
292
|
});
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { type DescMessage, fromJson, type JsonValue } from "@bufbuild/protobuf";
|
|
9
9
|
import { AgentSchema } from "@stigmer/protos/ai/stigmer/agentic/agent/v1/api_pb";
|
|
10
|
+
import { DatastoreSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
10
11
|
import { McpServerSchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
11
12
|
import { WorkflowSchema } from "@stigmer/protos/ai/stigmer/agentic/workflow/v1/api_pb";
|
|
12
13
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
@@ -17,6 +18,7 @@ const VALIDATE_SCHEMAS: ReadonlyMap<ApiResourceKind, DescMessage> = new Map<ApiR
|
|
|
17
18
|
[ApiResourceKind.workflow, WorkflowSchema],
|
|
18
19
|
[ApiResourceKind.mcp_server, McpServerSchema],
|
|
19
20
|
[ApiResourceKind.project, ProjectSchema],
|
|
21
|
+
[ApiResourceKind.datastore, DatastoreSchema],
|
|
20
22
|
]);
|
|
21
23
|
|
|
22
24
|
export function schemaForValidate(kind: ApiResourceKind): DescMessage | undefined {
|