@stigmer/mcp-server 3.2.2 → 3.3.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.
Files changed (43) hide show
  1. package/cli/mcp-server-stigmer.js +9 -9
  2. package/config.d.ts +12 -0
  3. package/config.d.ts.map +1 -1
  4. package/config.js +5 -0
  5. package/config.js.map +1 -1
  6. package/domains/records/calls.d.ts +48 -0
  7. package/domains/records/calls.d.ts.map +1 -0
  8. package/domains/records/calls.js +118 -0
  9. package/domains/records/calls.js.map +1 -0
  10. package/domains/records/errors.d.ts +24 -0
  11. package/domains/records/errors.d.ts.map +1 -0
  12. package/domains/records/errors.js +79 -0
  13. package/domains/records/errors.js.map +1 -0
  14. package/domains/records/tools.d.ts +7 -0
  15. package/domains/records/tools.d.ts.map +1 -0
  16. package/domains/records/tools.js +135 -0
  17. package/domains/records/tools.js.map +1 -0
  18. package/gen/agent.d.ts +56 -0
  19. package/gen/agent.d.ts.map +1 -1
  20. package/gen/agent.js +24 -1
  21. package/gen/agent.js.map +1 -1
  22. package/gen/workflow.d.ts +4 -4
  23. package/gen/workflow.js +1 -1
  24. package/gen/workflow.js.map +1 -1
  25. package/index.d.ts +2 -2
  26. package/index.d.ts.map +1 -1
  27. package/index.js +4 -4
  28. package/index.js.map +1 -1
  29. package/package.json +3 -3
  30. package/server.d.ts +31 -1
  31. package/server.d.ts.map +1 -1
  32. package/server.js +41 -3
  33. package/server.js.map +1 -1
  34. package/src/config.ts +19 -0
  35. package/src/domains/records/calls.ts +209 -0
  36. package/src/domains/records/errors.ts +98 -0
  37. package/src/domains/records/records.integration.test.ts +313 -0
  38. package/src/domains/records/tools.ts +206 -0
  39. package/src/gen/agent.ts +28 -1
  40. package/src/gen/workflow.ts +1 -1
  41. package/src/http.integration.test.ts +1 -0
  42. package/src/index.ts +12 -5
  43. package/src/server.ts +59 -5
package/config.d.ts CHANGED
@@ -1,6 +1,16 @@
1
1
  import { type LogFormat, type LogLevel } from "./logger.js";
2
2
  /** Communication mode between MCP clients and the server. */
3
3
  export type Transport = "stdio" | "http" | "both";
4
+ /**
5
+ * Which tool roster the server exposes.
6
+ *
7
+ * - "full": every domain (the default — external MCP clients).
8
+ * - "records": only the five record tools (DD-005) with the agent-facing
9
+ * argument surface. This is what the runner-synthesized datastore
10
+ * attachment spawns over stdio (T05 R1); over HTTP the same roster is
11
+ * served on the /records route regardless of this setting.
12
+ */
13
+ export type Roster = "full" | "records";
4
14
  /**
5
15
  * OAuth 2.0 Protected Resource Metadata (RFC 9728) discovery settings.
6
16
  *
@@ -25,6 +35,8 @@ export interface Config {
25
35
  */
26
36
  readonly apiKey: string;
27
37
  readonly transport: Transport;
38
+ /** Tool roster for stdio/both stdio-side; HTTP routes by path. */
39
+ readonly roster: Roster;
28
40
  readonly httpPort: string;
29
41
  /** Whether HTTP requests require an Authorization: Bearer header. */
30
42
  readonly httpAuthEnabled: boolean;
package/config.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,OAAO,EAAO,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjE,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;CACpC;AAED,gDAAgD;AAChD,MAAM,WAAW,MAAM;IACrB,mEAAmE;IACnE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAA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EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAOD,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAkB9E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAkDhD"}
package/config.js CHANGED
@@ -7,6 +7,7 @@
7
7
  // reproduces Go's hard-errors AND warnings, not just the defaults.
8
8
  import { log } from "./logger.js";
9
9
  const VALID_TRANSPORTS = ["stdio", "http", "both"];
10
+ const VALID_ROSTERS = ["full", "records"];
10
11
  const VALID_LOG_FORMATS = ["text", "json"];
11
12
  const VALID_LOG_LEVELS = ["debug", "info", "warn", "error"];
12
13
  /** Reads configuration from the process environment, applying defaults. */
@@ -15,6 +16,7 @@ export function loadConfigFromEnv(env = process.env) {
15
16
  stigmerServerAddress: envOr(env, "STIGMER_SERVER_ADDRESS", "localhost:7234"),
16
17
  apiKey: env.STIGMER_API_KEY ?? "",
17
18
  transport: envOr(env, "STIGMER_MCP_TRANSPORT", "stdio").toLowerCase(),
19
+ roster: envOr(env, "STIGMER_MCP_ROSTER", "full").toLowerCase(),
18
20
  httpPort: envOr(env, "STIGMER_MCP_HTTP_PORT", "8080"),
19
21
  // Go semantics: only the exact string "true" enables auth.
20
22
  httpAuthEnabled: envOr(env, "STIGMER_MCP_HTTP_AUTH_ENABLED", "true") === "true",
@@ -38,6 +40,9 @@ export function validateConfig(cfg) {
38
40
  if (!VALID_TRANSPORTS.includes(cfg.transport)) {
39
41
  throw new Error(`invalid STIGMER_MCP_TRANSPORT "${cfg.transport}": must be stdio, http, or both`);
40
42
  }
43
+ if (!VALID_ROSTERS.includes(cfg.roster)) {
44
+ throw new Error(`invalid STIGMER_MCP_ROSTER "${cfg.roster}": must be full or records`);
45
+ }
41
46
  if (cfg.stigmerServerAddress === "") {
42
47
  throw new Error("STIGMER_SERVER_ADDRESS must not be empty");
43
48
  }
package/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,mEAAmE;AAEnE,OAAO,EAAE,GAAG,EAAiC,MAAM,aAAa,CAAC;AAsCjE,MAAM,gBAAgB,GAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACtE,MAAM,iBAAiB,GAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,gBAAgB,GAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/E,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACpE,OAAO;QACL,oBAAoB,EAAE,KAAK,CAAC,GAAG,EAAE,wBAAwB,EAAE,gBAAgB,CAAC;QAC5E,MAAM,EAAE,GAAG,CAAC,eAAe,IAAI,EAAE;QACjC,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,uBAAuB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAe;QAClF,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE,uBAAuB,EAAE,MAAM,CAAC;QACrD,2DAA2D;QAC3D,eAAe,EAAE,KAAK,CAAC,GAAG,EAAE,+BAA+B,EAAE,MAAM,CAAC,KAAK,MAAM;QAC/E,KAAK,EAAE;YACL,OAAO,EAAE,GAAG,CAAC,yBAAyB,KAAK,MAAM;YACjD,QAAQ,E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,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,GAAuB;IACxC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IACzC,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,SAAiB;IACxC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,SAAS,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;AAClE,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A filter condition as the model supplies it. `op` uses the natural
3
+ * spelling "in" (the proto enum's `is_in` exists only because `in` is
4
+ * reserved in Java/Python — a substrate detail the model never sees).
5
+ */
6
+ export interface ConditionArg {
7
+ field: string;
8
+ op: string;
9
+ value?: string | number | boolean | null;
10
+ values?: (string | number | boolean)[];
11
+ }
12
+ export interface FindArgs {
13
+ datastore: string;
14
+ org?: string;
15
+ collection: string;
16
+ conditions?: ConditionArg[];
17
+ order_by?: {
18
+ field: string;
19
+ direction?: string;
20
+ };
21
+ limit?: number;
22
+ offset?: number;
23
+ }
24
+ export declare function findRecords(serverAddress: string, token: string, args: FindArgs): Promise<string>;
25
+ export declare function insertRecord(serverAddress: string, token: string, args: {
26
+ datastore: string;
27
+ org?: string;
28
+ collection: string;
29
+ record: Record<string, unknown>;
30
+ }): Promise<string>;
31
+ export declare function updateRecord(serverAddress: string, token: string, args: {
32
+ datastore: string;
33
+ org?: string;
34
+ collection: string;
35
+ id: string;
36
+ fields: Record<string, unknown>;
37
+ }): Promise<string>;
38
+ export declare function deleteRecord(serverAddress: string, token: string, args: {
39
+ datastore: string;
40
+ org?: string;
41
+ collection: string;
42
+ id: string;
43
+ }): Promise<string>;
44
+ export declare function describeDatastore(serverAddress: string, token: string, args: {
45
+ datastore: string;
46
+ org?: string;
47
+ }): Promise<string>;
48
+ //# sourceMappingURL=calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../src/domains/records/calls.ts"],"names":[],"mappings":"AAyCA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgBD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of DatastoreRecordQueryController / DatastoreRecordCommandController
3
+ // (DD-005: the tool layer adds no semantics; validation, grants,
4
+ // scopes, constraints, and messages all live in record-RPC domain
5
+ // logic on the control plane).
6
+ //
7
+ // One file for the five thin calls rather than the resource domains'
8
+ // file-per-verb split: resource verbs each carry orchestration
9
+ // (reference resolution, YAML parsing, two-step deletes); record calls
10
+ // are each "build request, call, marshal" and the shared argument
11
+ // mapping (filter/value building) is the only substance.
12
+ import { create, fromJson } from "@bufbuild/protobuf";
13
+ import { ValueSchema } from "@bufbuild/protobuf/wkt";
14
+ import { DatastoreRecordCommandController, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_command_pb";
15
+ import { DatastoreRecordQueryController, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_query_pb";
16
+ import { DatastoreDescriptionSchema, DeleteRecordRequestSchema, DescribeDatastoreRequestSchema, FindRecordsRequestSchema, InsertRecordRequestSchema, RecordConditionOp, RecordConditionSchema, RecordEnvelopeSchema, RecordFilterSchema, RecordListSchema, RecordOrderBySchema, RecordSortDirection, UpdateRecordRequestSchema, } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/record_io_pb";
17
+ import { withClient } from "../client.js";
18
+ import { toProtoJson } from "../marshal.js";
19
+ /** Model-facing operator spelling → proto enum. */
20
+ const CONDITION_OPS = {
21
+ eq: RecordConditionOp.eq,
22
+ neq: RecordConditionOp.neq,
23
+ gt: RecordConditionOp.gt,
24
+ gte: RecordConditionOp.gte,
25
+ lt: RecordConditionOp.lt,
26
+ lte: RecordConditionOp.lte,
27
+ in: RecordConditionOp.is_in,
28
+ not_in: RecordConditionOp.not_in,
29
+ is_null: RecordConditionOp.is_null,
30
+ not_null: RecordConditionOp.not_null,
31
+ };
32
+ export async function findRecords(serverAddress, token, args) {
33
+ const request = create(FindRecordsRequestSchema, {
34
+ datastore: args.datastore,
35
+ org: args.org ?? "",
36
+ collection: args.collection,
37
+ filter: buildFilter(args.conditions),
38
+ orderBy: buildOrderBy(args.order_by),
39
+ limit: args.limit ?? 0,
40
+ offset: args.offset ?? 0,
41
+ });
42
+ return withClient(DatastoreRecordQueryController, serverAddress, token, async (client, opts) => toProtoJson(RecordListSchema, await client.findRecords(request, opts)));
43
+ }
44
+ export async function insertRecord(serverAddress, token, args) {
45
+ const request = create(InsertRecordRequestSchema, {
46
+ datastore: args.datastore,
47
+ org: args.org ?? "",
48
+ collection: args.collection,
49
+ // google.protobuf.Struct fields are plain JSON objects in
50
+ // protobuf-es v2 — no conversion.
51
+ record: args.record,
52
+ });
53
+ return withClient(DatastoreRecordCommandController, serverAddress, token, async (client, opts) => toProtoJson(RecordEnvelopeSchema, await client.insertRecord(request, opts)));
54
+ }
55
+ export async function updateRecord(serverAddress, token, args) {
56
+ const request = create(UpdateRecordRequestSchema, {
57
+ datastore: args.datastore,
58
+ org: args.org ?? "",
59
+ collection: args.collection,
60
+ id: args.id,
61
+ fields: args.fields,
62
+ });
63
+ return withClient(DatastoreRecordCommandController, serverAddress, token, async (client, opts) => toProtoJson(RecordEnvelopeSchema, await client.updateRecord(request, opts)));
64
+ }
65
+ export async function deleteRecord(serverAddress, token, args) {
66
+ const request = create(DeleteRecordRequestSchema, {
67
+ datastore: args.datastore,
68
+ org: args.org ?? "",
69
+ collection: args.collection,
70
+ id: args.id,
71
+ });
72
+ return withClient(DatastoreRecordCommandController, serverAddress, token, async (client, opts) => toProtoJson(RecordEnvelopeSchema, await client.deleteRecord(request, opts)));
73
+ }
74
+ export async function describeDatastore(serverAddress, token, args) {
75
+ const request = create(DescribeDatastoreRequestSchema, {
76
+ datastore: args.datastore,
77
+ org: args.org ?? "",
78
+ });
79
+ return withClient(DatastoreRecordQueryController, serverAddress, token, async (client, opts) => toProtoJson(DatastoreDescriptionSchema, await client.describeDatastore(request, opts)));
80
+ }
81
+ /**
82
+ * Build the typed AND-only filter (DD-005 SD-2). An unknown operator is
83
+ * left unspecified for the server to reject with its own domain
84
+ * message — the bridge never fabricates validation of its own.
85
+ */
86
+ function buildFilter(conditions) {
87
+ if (conditions === undefined || conditions.length === 0) {
88
+ return undefined;
89
+ }
90
+ return create(RecordFilterSchema, {
91
+ conditions: conditions.map(buildCondition),
92
+ });
93
+ }
94
+ function buildCondition(arg) {
95
+ return create(RecordConditionSchema, {
96
+ field: arg.field,
97
+ op: CONDITION_OPS[arg.op] ?? RecordConditionOp.record_condition_op_unspecified,
98
+ value: arg.value !== undefined ? scalarValue(arg.value) : undefined,
99
+ values: (arg.values ?? []).map(scalarValue),
100
+ });
101
+ }
102
+ function buildOrderBy(orderBy) {
103
+ if (orderBy === undefined) {
104
+ return undefined;
105
+ }
106
+ return create(RecordOrderBySchema, {
107
+ field: orderBy.field,
108
+ direction: orderBy.direction === "desc"
109
+ ? RecordSortDirection.desc
110
+ : orderBy.direction === "asc"
111
+ ? RecordSortDirection.asc
112
+ : RecordSortDirection.record_sort_direction_unspecified,
113
+ });
114
+ }
115
+ function scalarValue(v) {
116
+ return fromJson(ValueSchema, v);
117
+ }
118
+ //# sourceMappingURL=calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.js","sourceRoot":"","sources":["../../../src/domains/records/calls.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,+BAA+B;AAC/B,EAAE;AACF,qEAAqE;AACrE,+DAA+D;AAC/D,uEAAuE;AACvE,kEAAkE;AAClE,yDAAyD;AAEzD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAmB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAc,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,gCAAgC,GACjC,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EACL,8BAA8B,GAC/B,MAAM,iEAAiE,CAAC;AACzE,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,EAC9B,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,qBAAqB,EACr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C;AACL,CAAC;AAED,SAAS,cAAc,CAAC,GAAiB;IACvC,OAAO,MAAM,CAAC,qBAAqB,EAAE;QACnC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAiB,CAAC,+BAA+B;QAC9E,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;QACnE,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC;KAC5C,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CACnB,OAA0D;IAE1D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC,mBAAmB,EAAE;QACjC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,KAAK,MAAM;YACrC,CAAC,CAAC,mBAAmB,CAAC,IAAI;YAC1B,CAAC,CAAC,OAAO,CAAC,SAAS,KAAK,KAAK;gBAC3B,CAAC,CAAC,mBAAmB,CAAC,GAAG;gBACzB,CAAC,CAAC,mBAAmB,CAAC,iCAAiC;KAC5D,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,CAAmC;IACtD,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ConnectError } from "@connectrpc/connect";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ /** The structured error payload record tools return for domain errors. */
4
+ export interface RecordToolError {
5
+ /** The server's relayable message, byte-for-byte. */
6
+ error: string;
7
+ /** gRPC status name in SCREAMING_SNAKE (e.g. ALREADY_EXISTS). */
8
+ code: string;
9
+ /** ErrorInfo reason (e.g. CONSTRAINT_VIOLATION), when present. */
10
+ reason?: string;
11
+ /** Violated constraint name from ErrorInfo metadata, when present. */
12
+ constraint?: string;
13
+ }
14
+ /**
15
+ * Run a record-tool body: a string payload becomes a text result; a
16
+ * domain error becomes an isError JSON result carrying the verbatim
17
+ * message + ErrorInfo companions; a transport error delegates to the
18
+ * shared classifier. The records analog of ../toolresult.ts
19
+ * textOrError, and the only try/catch in this domain.
20
+ */
21
+ export declare function recordResult(toolContext: string, produce: () => Promise<string>): Promise<CallToolResult>;
22
+ /** Project a domain ConnectError into the structured tool payload. */
23
+ export declare function domainError(ce: ConnectError): RecordToolError;
24
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/domains/records/errors.ts"],"names":[],"mappings":"AAeA,OAAO,EAAQ,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAkBzE,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,cAAc,CAAC,CAazB;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,EAAE,EAAE,YAAY,GAAG,eAAe,CAoB7D"}
@@ -0,0 +1,79 @@
1
+ // The records-domain error mapper (DD-005 SD-6) — a deliberate,
2
+ // documented divergence from the shared ../rpcerr.ts.
3
+ //
4
+ // Record-RPC domain errors carry agent-relayable messages that are
5
+ // cross-edition contract bytes (DD-002 SD-5): "that slot is already
6
+ // booked", "you are not allowed to insert records in bookings". The
7
+ // shared helper would rewrite them ("Check your API key permissions")
8
+ // and discards google.rpc.ErrorInfo. Here the domain codes pass the
9
+ // server's message through VERBATIM as isError JSON text
10
+ // `{error, code, reason, constraint}` — reason/constraint extracted
11
+ // from ErrorInfo — so the model can self-correct (retry another slot
12
+ // on CONSTRAINT_VIOLATION; stop and relay on PERMISSION_DENIED).
13
+ // Transport codes still delegate to the shared helper, whose advice is
14
+ // right for them.
15
+ import { Code, ConnectError } from "@connectrpc/connect";
16
+ import { ErrorInfoSchema } from "@stigmer/protos/google/rpc/error_details_pb";
17
+ import { rpcError } from "../rpcerr.js";
18
+ import { errorResult, textResult } from "../toolresult.js";
19
+ /**
20
+ * The gRPC codes whose messages are the record-RPC domain contract
21
+ * (DD-005 SD-6): declared constraint messages, fixed denial texts, and
22
+ * domain validation — all written to be relayed to end users verbatim.
23
+ */
24
+ const DOMAIN_CODES = new Set([
25
+ Code.PermissionDenied,
26
+ Code.AlreadyExists,
27
+ Code.FailedPrecondition,
28
+ Code.InvalidArgument,
29
+ Code.NotFound,
30
+ ]);
31
+ /**
32
+ * Run a record-tool body: a string payload becomes a text result; a
33
+ * domain error becomes an isError JSON result carrying the verbatim
34
+ * message + ErrorInfo companions; a transport error delegates to the
35
+ * shared classifier. The records analog of ../toolresult.ts
36
+ * textOrError, and the only try/catch in this domain.
37
+ */
38
+ export async function recordResult(toolContext, produce) {
39
+ try {
40
+ return textResult(await produce());
41
+ }
42
+ catch (err) {
43
+ const ce = ConnectError.from(err);
44
+ if (DOMAIN_CODES.has(ce.code)) {
45
+ return {
46
+ content: [{ type: "text", text: JSON.stringify(domainError(ce)) }],
47
+ isError: true,
48
+ };
49
+ }
50
+ return errorResult(rpcError(ce, toolContext));
51
+ }
52
+ }
53
+ /** Project a domain ConnectError into the structured tool payload. */
54
+ export function domainError(ce) {
55
+ const payload = {
56
+ error: ce.rawMessage,
57
+ code: grpcStatusName(ce.code),
58
+ };
59
+ // The record RPCs attach one google.rpc.ErrorInfo per domain error
60
+ // (domain datastore.stigmer.ai); absence means an older server — the
61
+ // message alone still carries the contract.
62
+ const details = ce.findDetails(ErrorInfoSchema);
63
+ if (details.length > 0) {
64
+ const info = details[0];
65
+ if (info.reason !== "") {
66
+ payload.reason = info.reason;
67
+ }
68
+ const constraint = info.metadata["constraint"];
69
+ if (constraint !== undefined && constraint !== "") {
70
+ payload.constraint = constraint;
71
+ }
72
+ }
73
+ return payload;
74
+ }
75
+ /** Connect's PascalCase code name → the gRPC SCREAMING_SNAKE status name. */
76
+ function grpcStatusName(code) {
77
+ return Code[code].replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
78
+ }
79
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domains/records/errors.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,sDAAsD;AACtD,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,sEAAsE;AACtE,oEAAoE;AACpE,yDAAyD;AACzD,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,uEAAuE;AACvE,kBAAkB;AAElB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,YAAY,GAAsB,IAAI,GAAG,CAAC;IAC9C,IAAI,CAAC,gBAAgB;IACrB,IAAI,CAAC,aAAa;IAClB,IAAI,CAAC,kBAAkB;IACvB,IAAI,CAAC,eAAe;IACpB,IAAI,CAAC,QAAQ;CACd,CAAC,CAAC;AAcH;;;;;;GAMG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,KAAK,EAAE,EAAE,CAAC;YAClD,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6EAA6E;AAC7E,SAAS,cAAc,CAAC,IAAU;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AACzE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type BackendTarget } from "../client.js";
3
+ /** Which roster the tools are being registered on (see file header). */
4
+ export type RecordToolAudience = "agent" | "direct";
5
+ /** Register the five record tools for one audience; returns the tool names. */
6
+ export declare function registerRecordTools(server: McpServer, target: BackendTarget, audience: RecordToolAudience): string[];
7
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/domains/records/tools.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAWhE,wEAAwE;AACxE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAyBpD,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,kBAAkB,GAC3B,MAAM,EAAE,CA0IV"}
@@ -0,0 +1,135 @@
1
+ // MCP tools for the Datastore record domain — the five agent-facing
2
+ // record tools of DD-005: 1:1 projections of the record RPCs, with the
3
+ // records-own error mapper (errors.ts) and honest MCP annotations (the
4
+ // bridge's first use of annotations; the platform's own connect-time
5
+ // classifier honors destructiveHint fail-closed for external clients,
6
+ // while the runner-synthesized attachment is approval-free by
7
+ // construction and never passes through that classifier).
8
+ //
9
+ // Two audiences, one definition (registered per roster):
10
+ // - "agent" (the records-only roster the runner-synthesized
11
+ // attachment connects to): NO `org` argument — a session-bound
12
+ // caller's org is server-derived from the session, and an explicit
13
+ // org is rejected (T05 R3), so offering the argument would only
14
+ // invite rejected calls.
15
+ // - "direct" (the main roster external MCP clients see): optional
16
+ // `org`, which cloud direct principals must name (their credential
17
+ // carries no ambient org — the DD-006 session-14 amendment). OSS
18
+ // resolves an empty org to the local system org.
19
+ // `partition` is deliberately NOT a tool argument for either audience
20
+ // (DD-010: never from tool arguments); partition-explicit work is the
21
+ // console/CLI/SDK surface.
22
+ import { z } from "zod";
23
+ import { resolveToken } from "../client.js";
24
+ import { deleteRecord, describeDatastore, findRecords, insertRecord, updateRecord, } from "./calls.js";
25
+ import { recordResult } from "./errors.js";
26
+ const ENCODINGS = "Field value encodings: date YYYY-MM-DD, time HH:MM[:SS], timestamp RFC 3339 UTC " +
27
+ "(e.g. 2026-07-21T04:30:00Z).";
28
+ const scalar = z.union([z.string(), z.number(), z.boolean()]);
29
+ const conditionShape = z.object({
30
+ field: z
31
+ .string()
32
+ .describe("Declared field name, or a filterable system field (id, created_at, updated_at)."),
33
+ op: z
34
+ .enum(["eq", "neq", "gt", "gte", "lt", "lte", "in", "not_in", "is_null", "not_null"])
35
+ .describe("Comparison operator. eq/neq/in/not_in for string and enum fields; " +
36
+ "gt/gte/lt/lte for numeric and temporal fields; is_null/not_null for optional fields."),
37
+ value: scalar
38
+ .nullable()
39
+ .optional()
40
+ .describe("Comparison value for scalar operators, in the field's canonical encoding."),
41
+ values: z.array(scalar).optional().describe("Comparison values for in / not_in."),
42
+ });
43
+ /** Register the five record tools for one audience; returns the tool names. */
44
+ export function registerRecordTools(server, target, audience) {
45
+ // The org argument exists only on the direct roster (file header).
46
+ const orgShape = {};
47
+ if (audience === "direct") {
48
+ orgShape.org = z
49
+ .string()
50
+ .optional()
51
+ .describe("Organization that owns the datastore. Required on Stigmer Cloud; " +
52
+ "omit against a local backend.");
53
+ }
54
+ server.registerTool("describe_datastore", {
55
+ description: "Describe a datastore: its collections, field declarations and encodings, constraint " +
56
+ "messages, data partitions, and the verbs you are allowed to use per collection " +
57
+ "(empty access means you are not allowed to touch that collection). Call this before " +
58
+ `the first record operation against an unfamiliar datastore. ${ENCODINGS}`,
59
+ inputSchema: {
60
+ datastore: z.string().describe("Datastore slug (e.g. clinic)."),
61
+ ...orgShape,
62
+ },
63
+ annotations: { readOnlyHint: true },
64
+ }, (args, extra) => recordResult(`datastore "${args.datastore}"`, () => describeDatastore(target.serverAddress, resolveToken(extra, target.apiKey), args)));
65
+ server.registerTool("find_records", {
66
+ description: "Find records in a datastore collection with a typed filter (conditions are AND-combined). " +
67
+ "Returns records plus total/limit/offset for paging. Results are ordered by created_at " +
68
+ `descending unless order_by is given. ${ENCODINGS}`,
69
+ inputSchema: {
70
+ datastore: z.string().describe("Datastore slug (e.g. clinic)."),
71
+ ...orgShape,
72
+ collection: z.string().describe("Collection to query (e.g. bookings)."),
73
+ conditions: z
74
+ .array(conditionShape)
75
+ .optional()
76
+ .describe("Filter conditions, AND-combined. Omit to list all readable records."),
77
+ order_by: z
78
+ .object({
79
+ field: z.string().describe("Field to sort by."),
80
+ direction: z.enum(["asc", "desc"]).optional().describe("Sort direction (default asc)."),
81
+ })
82
+ .optional()
83
+ .describe("Sort order. Omit for created_at descending with id tiebreak."),
84
+ limit: z.number().int().optional().describe("Page size (default 25, max 100)."),
85
+ offset: z.number().int().optional().describe("Records to skip for paging."),
86
+ },
87
+ annotations: { readOnlyHint: true },
88
+ }, (args, extra) => recordResult(`records in "${args.datastore}/${args.collection}"`, () => findRecords(target.serverAddress, resolveToken(extra, target.apiKey), {
89
+ ...args,
90
+ conditions: args.conditions,
91
+ })));
92
+ server.registerTool("insert_record", {
93
+ description: "Insert one record into a datastore collection. System fields (id, created_at, " +
94
+ "updated_at, created_by) are server-stamped — never include them. Declared constraints " +
95
+ "are enforced by the store; a violation returns the constraint's message verbatim " +
96
+ "(e.g. a taken slot returns ALREADY_EXISTS — pick another, do not retry the same one). " +
97
+ `When uncertain whether a record already exists, find first. ${ENCODINGS}`,
98
+ inputSchema: {
99
+ datastore: z.string().describe("Datastore slug (e.g. clinic)."),
100
+ ...orgShape,
101
+ collection: z.string().describe("Collection to insert into (e.g. bookings)."),
102
+ record: z
103
+ .record(z.unknown())
104
+ .describe("Declared fields for the new record, in canonical encodings."),
105
+ },
106
+ }, (args, extra) => recordResult(`record in "${args.datastore}/${args.collection}"`, () => insertRecord(target.serverAddress, resolveToken(extra, target.apiKey), args)));
107
+ server.registerTool("update_record", {
108
+ description: "Update one record by id with a partial merge: only the supplied fields change, and an " +
109
+ "explicit null clears a field. Constraints are re-evaluated on the merged result. " +
110
+ `Returns the full updated record. ${ENCODINGS}`,
111
+ inputSchema: {
112
+ datastore: z.string().describe("Datastore slug (e.g. clinic)."),
113
+ ...orgShape,
114
+ collection: z.string().describe("Collection holding the record."),
115
+ id: z.string().describe("Record id (from a previous find or insert)."),
116
+ fields: z
117
+ .record(z.unknown())
118
+ .describe("Fields to merge. Explicit null clears a field; omitted fields keep their values."),
119
+ },
120
+ annotations: { idempotentHint: true },
121
+ }, (args, extra) => recordResult(`record "${args.id}" in "${args.datastore}/${args.collection}"`, () => updateRecord(target.serverAddress, resolveToken(extra, target.apiKey), args)));
122
+ server.registerTool("delete_record", {
123
+ description: "Delete one record by id. Returns the deleted record. Record tools never delete " +
124
+ "collections or datastores.",
125
+ inputSchema: {
126
+ datastore: z.string().describe("Datastore slug (e.g. clinic)."),
127
+ ...orgShape,
128
+ collection: z.string().describe("Collection holding the record."),
129
+ id: z.string().describe("Record id (from a previous find or insert)."),
130
+ },
131
+ annotations: { destructiveHint: true, idempotentHint: true },
132
+ }, (args, extra) => recordResult(`record "${args.id}" in "${args.datastore}/${args.collection}"`, () => deleteRecord(target.serverAddress, resolveToken(extra, target.apiKey), args)));
133
+ return ["describe_datastore", "find_records", "insert_record", "update_record", "delete_record"];
134
+ }
135
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/domains/records/tools.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,uEAAuE;AACvE,uEAAuE;AACvE,qEAAqE;AACrE,sEAAsE;AACtE,8DAA8D;AAC9D,0DAA0D;AAC1D,EAAE;AACF,yDAAyD;AACzD,8DAA8D;AAC9D,mEAAmE;AACnE,uEAAuE;AACvE,oEAAoE;AACpE,6BAA6B;AAC7B,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,qDAAqD;AACrD,sEAAsE;AACtE,sEAAsE;AACtE,2BAA2B;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAsB,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,YAAY,GAEb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,MAAM,SAAS,GACb,kFAAkF;IAClF,8BAA8B,CAAC;AAEjC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAE9D,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,iFAAiF,CAAC;IAC9F,EAAE,EAAE,CAAC;SACF,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;SACpF,QAAQ,CACP,oEAAoE;QAClE,sFAAsF,CACzF;IACH,KAAK,EAA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AAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,GAAG,EAAE,GAAG,EAAE,CACjF,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAC7E,CACJ,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,WAAW,EACT,iFAAiF;YACjF,4BAA4B;QAC9B,WAAW,EAAE;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;YAC/D,GAAG,QAAQ;YACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YACjE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;SACvE;QACD,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;KAC7D,EACD,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,YAAY,CAAC,WAAW,IAAI,CAAC,EAAE,SAAS,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,GAAG,EAAE,GAAG,EAAE,CACjF,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAC7E,CACJ,CAAC;IAEF,OAAO,CAAC,oBAAoB,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;AACnG,CAAC"}
package/gen/agent.d.ts CHANGED
@@ -142,6 +142,28 @@ export declare const AgentInputShape: {
142
142
  optional?: boolean | undefined;
143
143
  is_secret?: boolean | undefined;
144
144
  }>>>>;
145
+ readonly datastore_usages: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
146
+ datastore_ref: z.ZodLazy<z.ZodObject<{
147
+ org: z.ZodOptional<z.ZodString>;
148
+ slug: z.ZodString;
149
+ }, "strip", z.ZodTypeAny, {
150
+ slug: string;
151
+ org?: string | undefined;
152
+ }, {
153
+ slug: string;
154
+ org?: string | undefined;
155
+ }>>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ datastore_ref: {
158
+ slug: string;
159
+ org?: string | undefined;
160
+ };
161
+ }, {
162
+ datastore_ref: {
163
+ slug: string;
164
+ org?: string | undefined;
165
+ };
166
+ }>>, "many">>;
145
167
  };
146
168
  export declare const AgentInputSchema: z.ZodObject<{
147
169
  readonly name: z.ZodString;
@@ -284,6 +306,28 @@ export declare const AgentInputSchema: z.ZodObject<{
284
306
  optional?: boolean | undefined;
285
307
  is_secret?: boolean | undefined;
286
308
  }>>>>;
309
+ readonly datastore_usages: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
310
+ datastore_ref: z.ZodLazy<z.ZodObject<{
311
+ org: z.ZodOptional<z.ZodString>;
312
+ slug: z.ZodString;
313
+ }, "strip", z.ZodTypeAny, {
314
+ slug: string;
315
+ org?: string | undefined;
316
+ }, {
317
+ slug: string;
318
+ org?: string | undefined;
319
+ }>>;
320
+ }, "strip", z.ZodTypeAny, {
321
+ datastore_ref: {
322
+ slug: string;
323
+ org?: string | undefined;
324
+ };
325
+ }, {
326
+ datastore_ref: {
327
+ slug: string;
328
+ org?: string | undefined;
329
+ };
330
+ }>>, "many">>;
287
331
  }, "strip", z.ZodTypeAny, {
288
332
  name: string;
289
333
  org: string;
@@ -331,6 +375,12 @@ export declare const AgentInputSchema: z.ZodObject<{
331
375
  }[] | undefined;
332
376
  model_override?: string | undefined;
333
377
  }[] | undefined;
378
+ datastore_usages?: {
379
+ datastore_ref: {
380
+ slug: string;
381
+ org?: string | undefined;
382
+ };
383
+ }[] | undefined;
334
384
  }, {
335
385
  name: string;
336
386
  org: string;
@@ -378,6 +428,12 @@ export declare const AgentInputSchema: z.ZodObject<{
378
428
  }[] | undefined;
379
429
  model_override?: string | undefined;
380
430
  }[] | undefined;
431
+ datastore_usages?: {
432
+ datastore_ref: {
433
+ slug: string;
434
+ org?: string | undefined;
435
+ };
436
+ }[] | undefined;
381
437
  }>;
382
438
  export type AgentInput = z.infer<typeof AgentInputSchema>;
383
439
  /** Build the fully-formed Agent proto from the flat MCP apply input. */
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/gen/agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAM7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6NAA6N;AAC7N,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAclB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AAC1D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAqD1D,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAyB1D"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/gen/agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,oDAAoD,CAAC;AAM7F,OAAO,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