@stigmer/mcp-server 3.11.1-dev.20260812192248 → 3.12.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/README.md +4 -22
- package/cli/mcp-server-stigmer.js +11 -11
- package/config.d.ts +1 -5
- package/config.d.ts.map +1 -1
- package/config.js +2 -2
- package/config.js.map +1 -1
- package/domains/resourceuri.d.ts.map +1 -1
- package/domains/resourceuri.js +0 -1
- package/domains/resourceuri.js.map +1 -1
- package/domains/search/tools.d.ts.map +1 -1
- package/domains/search/tools.js +4 -5
- package/domains/search/tools.js.map +1 -1
- package/gen/agent.d.ts +0 -56
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +1 -24
- package/gen/agent.js.map +1 -1
- package/gen/workflow.d.ts +2 -2
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/server.d.ts +6 -18
- package/server.d.ts.map +1 -1
- package/server.js +6 -36
- package/server.js.map +1 -1
- package/src/config.ts +3 -7
- package/src/domains/apply.integration.test.ts +3 -40
- package/src/domains/deletes.integration.test.ts +1 -25
- package/src/domains/reads.integration.test.ts +1 -18
- package/src/domains/resources.integration.test.ts +0 -18
- package/src/domains/resourceuri.test.ts +0 -2
- package/src/domains/resourceuri.ts +0 -1
- package/src/domains/search/search.integration.test.ts +3 -5
- package/src/domains/search/tools.ts +4 -5
- package/src/gen/agent.ts +1 -28
- package/src/http.integration.test.ts +2 -3
- package/src/index.ts +0 -2
- package/src/server.ts +6 -36
- package/domains/datastores/apply.d.ts +0 -4
- package/domains/datastores/apply.d.ts.map +0 -1
- package/domains/datastores/apply.js +0 -28
- package/domains/datastores/apply.js.map +0 -1
- package/domains/datastores/delete.d.ts +0 -3
- package/domains/datastores/delete.d.ts.map +0 -1
- package/domains/datastores/delete.js +0 -38
- package/domains/datastores/delete.js.map +0 -1
- package/domains/datastores/fetch.d.ts +0 -3
- package/domains/datastores/fetch.d.ts.map +0 -1
- package/domains/datastores/fetch.js +0 -23
- package/domains/datastores/fetch.js.map +0 -1
- package/domains/datastores/resources.d.ts +0 -5
- package/domains/datastores/resources.d.ts.map +0 -1
- package/domains/datastores/resources.js +0 -16
- package/domains/datastores/resources.js.map +0 -1
- package/domains/datastores/tools.d.ts +0 -5
- package/domains/datastores/tools.d.ts.map +0 -1
- package/domains/datastores/tools.js +0 -46
- package/domains/datastores/tools.js.map +0 -1
- package/domains/records/calls.d.ts +0 -48
- package/domains/records/calls.d.ts.map +0 -1
- package/domains/records/calls.js +0 -118
- package/domains/records/calls.js.map +0 -1
- package/domains/records/errors.d.ts +0 -24
- package/domains/records/errors.d.ts.map +0 -1
- package/domains/records/errors.js +0 -79
- package/domains/records/errors.js.map +0 -1
- package/domains/records/tools.d.ts +0 -7
- package/domains/records/tools.d.ts.map +0 -1
- package/domains/records/tools.js +0 -139
- package/domains/records/tools.js.map +0 -1
- package/gen/datastore.d.ts +0 -861
- package/gen/datastore.d.ts.map +0 -1
- package/gen/datastore.js +0 -267
- package/gen/datastore.js.map +0 -1
- package/src/domains/datastores/apply.ts +0 -33
- package/src/domains/datastores/delete.ts +0 -47
- package/src/domains/datastores/fetch.ts +0 -32
- package/src/domains/datastores/resources.ts +0 -21
- package/src/domains/datastores/tools.ts +0 -76
- package/src/domains/records/calls.ts +0 -209
- package/src/domains/records/errors.ts +0 -98
- package/src/domains/records/records.integration.test.ts +0 -313
- package/src/domains/records/tools.ts +0 -210
- package/src/gen/datastore.ts +0 -264
package/gen/datastore.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datastore.d.ts","sourceRoot":"","sources":["../../src/gen/datastore.ts"],"names":[],"mappings":"AAQA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,wDAAwD,CAAC;AAIzG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qGAAqG;AACrG,eAAO,MAAM,mBAAm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AS,CAoBtE"}
|
package/gen/datastore.js
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
// Code generated by stigmer-codegen --target=mcp-ts. DO NOT EDIT.
|
|
2
|
-
//
|
|
3
|
-
// Flattened apply-input zod schema + toProto bridge for the Datastore resource.
|
|
4
|
-
// Source proto package: ai.stigmer.agentic.datastore.v1
|
|
5
|
-
import { generateSlug, visibilityFromString, enumFromString } from "./apply-runtime.js";
|
|
6
|
-
import { create, fromJson } from "@bufbuild/protobuf";
|
|
7
|
-
import { ValueSchema } from "@bufbuild/protobuf/wkt";
|
|
8
|
-
import { DatastoreSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
9
|
-
import { DatastoreSpecSchema, DatastoreRoleSchema, ChannelSenderSubjectSchema, DatastoreSubjectSchema, DatastoreRoleBindingSchema, DatastoreAuthorizationSchema, FieldDeclarationSchema, FieldType, UniqueWhereSchema, UniqueConstraintSchema, CheckConstraintSchema, ExistsConstraintSchema, DatastoreGrantSchema, DatastoreVerb, DatastoreGrantScope, CollectionDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/spec_pb";
|
|
10
|
-
import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
|
|
11
|
-
import { ApiResourceRefSchema } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
/** DatastoreSpec declares typed record collections with constraints and role-aware access grants. */
|
|
14
|
-
export const DatastoreInputShape = {
|
|
15
|
-
name: z.string().describe("Human-readable name of the resource."),
|
|
16
|
-
slug: z.string().optional().describe("URL-friendly identifier (lowercase alphanumeric with hyphens). Auto-generated from name if omitted."),
|
|
17
|
-
org: z.string().describe("Organization that owns this resource (e.g. acme)."),
|
|
18
|
-
visibility: z.string().optional().describe("Resource visibility: PRIVATE or PUBLIC. Omit to leave unchanged on updates."),
|
|
19
|
-
labels: z.record(z.string()).optional().describe("Key-value labels for organization and filtering."),
|
|
20
|
-
tags: z.array(z.string()).optional().describe("Tags for categorization and discovery."),
|
|
21
|
-
description: z.string().optional().describe("Human-readable description of what this datastore holds."),
|
|
22
|
-
timezone: z.string().optional().describe("IANA timezone (e.g. 'Asia/Kolkata') for constraint evaluation. Bound as the constant 'tz' in check and exists constraint expressions. Optional; when unset, expressions that reference 'tz' are rejected at apply time."),
|
|
23
|
-
authorization: z.lazy(() => DatastoreAuthorizationInputSchema).optional().describe("Record-layer authorization: roles, subject bindings, and the default role for unbound callers."),
|
|
24
|
-
collections: z.array(z.lazy(() => CollectionDeclarationInputSchema)).optional().describe("Record collections declared by this datastore."),
|
|
25
|
-
};
|
|
26
|
-
export const DatastoreInputSchema = z.object(DatastoreInputShape);
|
|
27
|
-
const DatastoreRoleInputSchema = z.object({
|
|
28
|
-
name: z.string().describe("Role name, referenced by bindings, grants, and default_role."),
|
|
29
|
-
});
|
|
30
|
-
const ChannelSenderSubjectInputSchema = z.object({
|
|
31
|
-
sender_kind: z.string().describe("Sender identity namespace. Must be a namespace the platform's channel brokers can stamp — today 'whatsapp_phone'; unrecognized namespaces are refused at apply time (they could never match)."),
|
|
32
|
-
value: z.string().describe("Sender identity value within the namespace, in the exact wire shape the channel broker stamps. For 'whatsapp_phone' this is Meta's wa_id: DIGITS ONLY, no '+', no separators (e.g. '919800000001' — NOT the '+'-prefixed E.164 form). Apply-time validation refuses any other shape, because subject matching is exact string equality and a mis-shaped value would bind and silently never match."),
|
|
33
|
-
});
|
|
34
|
-
const ApiResourceRefInputSchema = z.object({
|
|
35
|
-
kind: z.string().describe("Type of the API resource being referenced This should be the resource kind as defined in ApiResourceKind enum. Examples: 'identity_account', 'team', 'organization', 'environment', 'cloud_resource', 'service', etc."),
|
|
36
|
-
id: z.string().describe("Unique identifier of the resource This is the resource's ID field (e.g., ia-01HQUSER123, tm-01HQTEAM456)"),
|
|
37
|
-
relation: z.string().optional().describe("Optional relation qualifier for the resource reference. Used when the reference needs additional context about the relationship. Primary use case: For team principals, this specifies the relation of the user to the team (e.g., 'member', 'admin'). Example: principal { kind: 'team', id: 'tm-123', relation: 'member' } means 'members of team tm-123' This field qualifies HOW the principal relates to this resource reference, NOT the permission being granted (that's IamPolicySpec.relation)."),
|
|
38
|
-
});
|
|
39
|
-
const DatastoreSubjectInputSchema = z.object({
|
|
40
|
-
channel_sender: z.lazy(() => ChannelSenderSubjectInputSchema).optional().describe("Channel sender identity, matched against the session metadata stamped by the channel broker."),
|
|
41
|
-
principal: z.lazy(() => ApiResourceRefInputSchema).optional().describe("Platform principal (an identity account today; teams later without schema change)."),
|
|
42
|
-
});
|
|
43
|
-
const DatastoreRoleBindingInputSchema = z.object({
|
|
44
|
-
subject: z.lazy(() => DatastoreSubjectInputSchema).describe("The caller identity this binding matches."),
|
|
45
|
-
role: z.string().describe("Name of a declared role."),
|
|
46
|
-
});
|
|
47
|
-
const DatastoreAuthorizationInputSchema = z.object({
|
|
48
|
-
roles: z.array(z.lazy(() => DatastoreRoleInputSchema)).optional().describe("Role names referenced by bindings and grants (e.g. 'admin', 'patient')."),
|
|
49
|
-
bindings: z.array(z.lazy(() => DatastoreRoleBindingInputSchema)).optional().describe("Subject-to-role bindings."),
|
|
50
|
-
default_role: z.string().optional().describe("Role an unbound caller resolves to. Applies to channel senders with no binding and platform principals with no binding. When empty, unbound callers are denied every verb."),
|
|
51
|
-
});
|
|
52
|
-
const FieldDeclarationInputSchema = z.object({
|
|
53
|
-
name: z.string().describe("Field name, unique within the collection. Format: lowercase snake_case. The record envelope's system field names (id, created_at, updated_at, created_by), 'org', and 'partition' are reserved."),
|
|
54
|
-
type: z.string().describe("Value type for this field. Allowed values: string, integer, number, bool, timestamp, date, time, json."),
|
|
55
|
-
required: z.boolean().optional().describe("Whether a value must be present on every record. Absent optional fields evaluate as null in constraint expressions."),
|
|
56
|
-
default: z.unknown().optional().describe("Default value applied when the field is absent on insert."),
|
|
57
|
-
enum_values: z.array(z.string()).optional().describe("Allowed values for string fields. Declaring enum_values on a non-string field is rejected."),
|
|
58
|
-
description: z.string().optional().describe("Human-readable description, surfaced to agents via describe_datastore."),
|
|
59
|
-
});
|
|
60
|
-
const UniqueWhereInputSchema = z.object({
|
|
61
|
-
field: z.string().describe("Declared field the condition tests."),
|
|
62
|
-
equals: z.unknown().describe("Value the field must equal for the constraint to apply."),
|
|
63
|
-
});
|
|
64
|
-
const UniqueConstraintInputSchema = z.object({
|
|
65
|
-
name: z.string().describe("Constraint name, unique within the collection."),
|
|
66
|
-
fields: z.array(z.string()).optional().describe("Declared fields whose combined values must be unique."),
|
|
67
|
-
where: z.lazy(() => UniqueWhereInputSchema).optional().describe("Limits the constraint to records matching this condition (e.g. only 'status == 'confirmed'' bookings must be unique per slot)."),
|
|
68
|
-
message: z.string().describe("Error message returned on violation, written to be relayed to an end user by an agent (e.g. 'that slot is already booked')."),
|
|
69
|
-
});
|
|
70
|
-
const CheckConstraintInputSchema = z.object({
|
|
71
|
-
name: z.string().describe("Constraint name, unique within the collection."),
|
|
72
|
-
expression: z.string().describe("CEL expression that must evaluate true for the record to be written."),
|
|
73
|
-
when: z.string().optional().describe("Optional CEL gate: the check applies only when this evaluates true."),
|
|
74
|
-
message: z.string().describe("Error message returned on violation, written to be relayed to an end user by an agent."),
|
|
75
|
-
});
|
|
76
|
-
const ExistsConstraintInputSchema = z.object({
|
|
77
|
-
name: z.string().describe("Constraint name, unique within the collection."),
|
|
78
|
-
collection: z.string().describe("Target collection in the same datastore."),
|
|
79
|
-
where: z.string().describe("CEL condition matching candidate ('this') against target records ('that')."),
|
|
80
|
-
when: z.string().optional().describe("Optional CEL gate: the constraint applies only when this evaluates true."),
|
|
81
|
-
message: z.string().describe("Error message returned on violation, written to be relayed to an end user by an agent."),
|
|
82
|
-
});
|
|
83
|
-
const DatastoreGrantInputSchema = z.object({
|
|
84
|
-
role: z.string().describe("Name of a declared role."),
|
|
85
|
-
verbs: z.array(z.string()).optional().describe("Verbs granted to the role on this collection. Allowed values: read, insert, update, delete."),
|
|
86
|
-
scope: z.string().optional().describe("Row scope of the grant. Defaults to all records. 'own' limits update and delete (and read) to records whose server-stamped created_by matches the caller. Allowed values: all, own."),
|
|
87
|
-
read_fields: z.array(z.string()).optional().describe("Field allowlist for the read verb: when set, reads by this role return only these fields, and filter conditions and order_by may reference only these fields. Empty means every field is readable. Entries name declared fields of the collection, or 'created_by' to expose the attribution subject. The system fields id, created_at, and updated_at are always readable."),
|
|
88
|
-
});
|
|
89
|
-
const CollectionDeclarationInputSchema = z.object({
|
|
90
|
-
name: z.string().describe("Collection name, unique within the datastore. Format: lowercase snake_case (e.g. 'bookings', 'schedule_exceptions')."),
|
|
91
|
-
description: z.string().optional().describe("Human-readable description of what records in this collection represent."),
|
|
92
|
-
fields: z.array(z.lazy(() => FieldDeclarationInputSchema)).optional().describe("Typed field declarations for records in this collection."),
|
|
93
|
-
uniques: z.array(z.lazy(() => UniqueConstraintInputSchema)).optional().describe("Uniqueness constraints, enforced by substrate indexes."),
|
|
94
|
-
checks: z.array(z.lazy(() => CheckConstraintInputSchema)).optional().describe("Single-record check constraints, evaluated on every insert and update."),
|
|
95
|
-
exists: z.array(z.lazy(() => ExistsConstraintInputSchema)).optional().describe("Cross-collection constraints requiring a matching record to exist."),
|
|
96
|
-
not_exists: z.array(z.lazy(() => ExistsConstraintInputSchema)).optional().describe("Cross-collection constraints requiring no matching record to exist."),
|
|
97
|
-
grants: z.array(z.lazy(() => DatastoreGrantInputSchema)).optional().describe("Per-role access grants for records in this collection. Deny by default: a role with no grant on a collection has no access to it."),
|
|
98
|
-
});
|
|
99
|
-
/** Build the fully-formed Datastore proto from the flat MCP apply input. */
|
|
100
|
-
export function datastoreInputToProto(input) {
|
|
101
|
-
const slug = input.slug && input.slug.length > 0 ? input.slug : generateSlug(input.name);
|
|
102
|
-
const spec = create(DatastoreSpecSchema);
|
|
103
|
-
if (input.description !== undefined)
|
|
104
|
-
spec.description = input.description;
|
|
105
|
-
if (input.timezone !== undefined)
|
|
106
|
-
spec.timezone = input.timezone;
|
|
107
|
-
if (input.authorization !== undefined)
|
|
108
|
-
spec.authorization = datastoreAuthorizationInputToProto(input.authorization);
|
|
109
|
-
if (input.collections !== undefined)
|
|
110
|
-
spec.collections = input.collections.map(collectionDeclarationInputToProto);
|
|
111
|
-
return Object.assign(create(DatastoreSchema), {
|
|
112
|
-
apiVersion: "agentic.stigmer.ai/v1",
|
|
113
|
-
kind: "Datastore",
|
|
114
|
-
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
115
|
-
name: input.name,
|
|
116
|
-
slug,
|
|
117
|
-
org: input.org,
|
|
118
|
-
...(input.visibility !== undefined && { visibility: visibilityFromString(input.visibility) }),
|
|
119
|
-
...(input.labels !== undefined && { labels: input.labels }),
|
|
120
|
-
...(input.tags !== undefined && { tags: input.tags }),
|
|
121
|
-
}),
|
|
122
|
-
spec,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
function datastoreRoleInputToProto(input) {
|
|
126
|
-
const result = create(DatastoreRoleSchema);
|
|
127
|
-
if (input.name !== undefined)
|
|
128
|
-
result.name = input.name;
|
|
129
|
-
return result;
|
|
130
|
-
}
|
|
131
|
-
function channelSenderSubjectInputToProto(input) {
|
|
132
|
-
const result = create(ChannelSenderSubjectSchema);
|
|
133
|
-
if (input.sender_kind !== undefined)
|
|
134
|
-
result.senderKind = input.sender_kind;
|
|
135
|
-
if (input.value !== undefined)
|
|
136
|
-
result.value = input.value;
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
function apiResourceRefInputToProto(input) {
|
|
140
|
-
const result = create(ApiResourceRefSchema);
|
|
141
|
-
if (input.kind !== undefined)
|
|
142
|
-
result.kind = input.kind;
|
|
143
|
-
if (input.id !== undefined)
|
|
144
|
-
result.id = input.id;
|
|
145
|
-
if (input.relation !== undefined)
|
|
146
|
-
result.relation = input.relation;
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
function datastoreSubjectInputToProto(input) {
|
|
150
|
-
const result = create(DatastoreSubjectSchema);
|
|
151
|
-
if (input.channel_sender !== undefined)
|
|
152
|
-
result.kind = { case: "channelSender", value: channelSenderSubjectInputToProto(input.channel_sender) };
|
|
153
|
-
if (input.principal !== undefined)
|
|
154
|
-
result.kind = { case: "principal", value: apiResourceRefInputToProto(input.principal) };
|
|
155
|
-
return result;
|
|
156
|
-
}
|
|
157
|
-
function datastoreRoleBindingInputToProto(input) {
|
|
158
|
-
const result = create(DatastoreRoleBindingSchema);
|
|
159
|
-
if (input.subject !== undefined)
|
|
160
|
-
result.subject = datastoreSubjectInputToProto(input.subject);
|
|
161
|
-
if (input.role !== undefined)
|
|
162
|
-
result.role = input.role;
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
165
|
-
function datastoreAuthorizationInputToProto(input) {
|
|
166
|
-
const result = create(DatastoreAuthorizationSchema);
|
|
167
|
-
if (input.roles !== undefined)
|
|
168
|
-
result.roles = input.roles.map(datastoreRoleInputToProto);
|
|
169
|
-
if (input.bindings !== undefined)
|
|
170
|
-
result.bindings = input.bindings.map(datastoreRoleBindingInputToProto);
|
|
171
|
-
if (input.default_role !== undefined)
|
|
172
|
-
result.defaultRole = input.default_role;
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
function fieldDeclarationInputToProto(input) {
|
|
176
|
-
const result = create(FieldDeclarationSchema);
|
|
177
|
-
if (input.name !== undefined)
|
|
178
|
-
result.name = input.name;
|
|
179
|
-
result.type = enumFromString(FieldType, input.type);
|
|
180
|
-
if (input.required !== undefined)
|
|
181
|
-
result.required = input.required;
|
|
182
|
-
if (input.default !== undefined)
|
|
183
|
-
result.default = fromJson(ValueSchema, input.default);
|
|
184
|
-
if (input.enum_values !== undefined)
|
|
185
|
-
result.enumValues = input.enum_values;
|
|
186
|
-
if (input.description !== undefined)
|
|
187
|
-
result.description = input.description;
|
|
188
|
-
return result;
|
|
189
|
-
}
|
|
190
|
-
function uniqueWhereInputToProto(input) {
|
|
191
|
-
const result = create(UniqueWhereSchema);
|
|
192
|
-
if (input.field !== undefined)
|
|
193
|
-
result.field = input.field;
|
|
194
|
-
if (input.equals !== undefined)
|
|
195
|
-
result.equals = fromJson(ValueSchema, input.equals);
|
|
196
|
-
return result;
|
|
197
|
-
}
|
|
198
|
-
function uniqueConstraintInputToProto(input) {
|
|
199
|
-
const result = create(UniqueConstraintSchema);
|
|
200
|
-
if (input.name !== undefined)
|
|
201
|
-
result.name = input.name;
|
|
202
|
-
if (input.fields !== undefined)
|
|
203
|
-
result.fields = input.fields;
|
|
204
|
-
if (input.where !== undefined)
|
|
205
|
-
result.where = uniqueWhereInputToProto(input.where);
|
|
206
|
-
if (input.message !== undefined)
|
|
207
|
-
result.message = input.message;
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
210
|
-
function checkConstraintInputToProto(input) {
|
|
211
|
-
const result = create(CheckConstraintSchema);
|
|
212
|
-
if (input.name !== undefined)
|
|
213
|
-
result.name = input.name;
|
|
214
|
-
if (input.expression !== undefined)
|
|
215
|
-
result.expression = input.expression;
|
|
216
|
-
if (input.when !== undefined)
|
|
217
|
-
result.when = input.when;
|
|
218
|
-
if (input.message !== undefined)
|
|
219
|
-
result.message = input.message;
|
|
220
|
-
return result;
|
|
221
|
-
}
|
|
222
|
-
function existsConstraintInputToProto(input) {
|
|
223
|
-
const result = create(ExistsConstraintSchema);
|
|
224
|
-
if (input.name !== undefined)
|
|
225
|
-
result.name = input.name;
|
|
226
|
-
if (input.collection !== undefined)
|
|
227
|
-
result.collection = input.collection;
|
|
228
|
-
if (input.where !== undefined)
|
|
229
|
-
result.where = input.where;
|
|
230
|
-
if (input.when !== undefined)
|
|
231
|
-
result.when = input.when;
|
|
232
|
-
if (input.message !== undefined)
|
|
233
|
-
result.message = input.message;
|
|
234
|
-
return result;
|
|
235
|
-
}
|
|
236
|
-
function datastoreGrantInputToProto(input) {
|
|
237
|
-
const result = create(DatastoreGrantSchema);
|
|
238
|
-
if (input.role !== undefined)
|
|
239
|
-
result.role = input.role;
|
|
240
|
-
if (input.verbs !== undefined)
|
|
241
|
-
result.verbs = input.verbs.map((v) => enumFromString(DatastoreVerb, v));
|
|
242
|
-
result.scope = enumFromString(DatastoreGrantScope, input.scope);
|
|
243
|
-
if (input.read_fields !== undefined)
|
|
244
|
-
result.readFields = input.read_fields;
|
|
245
|
-
return result;
|
|
246
|
-
}
|
|
247
|
-
function collectionDeclarationInputToProto(input) {
|
|
248
|
-
const result = create(CollectionDeclarationSchema);
|
|
249
|
-
if (input.name !== undefined)
|
|
250
|
-
result.name = input.name;
|
|
251
|
-
if (input.description !== undefined)
|
|
252
|
-
result.description = input.description;
|
|
253
|
-
if (input.fields !== undefined)
|
|
254
|
-
result.fields = input.fields.map(fieldDeclarationInputToProto);
|
|
255
|
-
if (input.uniques !== undefined)
|
|
256
|
-
result.uniques = input.uniques.map(uniqueConstraintInputToProto);
|
|
257
|
-
if (input.checks !== undefined)
|
|
258
|
-
result.checks = input.checks.map(checkConstraintInputToProto);
|
|
259
|
-
if (input.exists !== undefined)
|
|
260
|
-
result.exists = input.exists.map(existsConstraintInputToProto);
|
|
261
|
-
if (input.not_exists !== undefined)
|
|
262
|
-
result.notExists = input.not_exists.map(existsConstraintInputToProto);
|
|
263
|
-
if (input.grants !== undefined)
|
|
264
|
-
result.grants = input.grants.map(datastoreGrantInputToProto);
|
|
265
|
-
return result;
|
|
266
|
-
}
|
|
267
|
-
//# sourceMappingURL=datastore.js.map
|
package/gen/datastore.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datastore.js","sourceRoot":"","sources":["../../src/gen/datastore.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,gFAAgF;AAChF,wDAAwD;AAExD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EA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AAS;QAAE,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAClG,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC9F,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC/F,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1G,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAC7F,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Datastore apply path: create-or-update via DatastoreCommandController.apply.
|
|
2
|
-
// The flat MCP input is projected into a fully-formed Datastore proto by the
|
|
3
|
-
// generated datastoreInputToProto bridge (codegen, src/gen/datastore.ts).
|
|
4
|
-
//
|
|
5
|
-
// The manifest is authoritative for structure, never for data: schema changes
|
|
6
|
-
// sync on apply (the server enforces its additive-plus change matrix), and
|
|
7
|
-
// records enter exclusively through the record tools.
|
|
8
|
-
|
|
9
|
-
import { DatastoreSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
10
|
-
import { DatastoreCommandController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/command_pb";
|
|
11
|
-
|
|
12
|
-
import { datastoreInputToProto, type DatastoreInput } from "../../gen/datastore.js";
|
|
13
|
-
import { withClient } from "../client.js";
|
|
14
|
-
import { toProtoJson } from "../marshal.js";
|
|
15
|
-
import { rpcError } from "../rpcerr.js";
|
|
16
|
-
|
|
17
|
-
/** Create or update a datastore, returning the persisted resource as protojson. */
|
|
18
|
-
export async function applyDatastore(
|
|
19
|
-
serverAddress: string,
|
|
20
|
-
token: string,
|
|
21
|
-
input: DatastoreInput,
|
|
22
|
-
): Promise<string> {
|
|
23
|
-
const datastore = datastoreInputToProto(input);
|
|
24
|
-
const desc = `datastore "${datastore.metadata?.slug ?? ""}" in org "${datastore.metadata?.org ?? ""}"`;
|
|
25
|
-
return withClient(DatastoreCommandController, serverAddress, token, async (client, callOptions) => {
|
|
26
|
-
try {
|
|
27
|
-
const result = await client.apply(datastore, callOptions);
|
|
28
|
-
return toProtoJson(DatastoreSchema, result);
|
|
29
|
-
} catch (err) {
|
|
30
|
-
throw rpcError(err, desc);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Datastore delete path: resolve org/slug → id via the Query controller, then
|
|
2
|
-
// delete via the Command controller, both over a single shared transport. Like
|
|
3
|
-
// McpServer, the command controller takes ApiResourceDeleteInput{resource_id}.
|
|
4
|
-
//
|
|
5
|
-
// This is the only path that destroys collections — record tools can delete
|
|
6
|
-
// individual records but never structure.
|
|
7
|
-
|
|
8
|
-
import { createClient } from "@connectrpc/connect";
|
|
9
|
-
import { DatastoreSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
10
|
-
import { DatastoreCommandController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/command_pb";
|
|
11
|
-
import { DatastoreQueryController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/query_pb";
|
|
12
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
13
|
-
|
|
14
|
-
import { withTransport } from "../client.js";
|
|
15
|
-
import { toProtoJson } from "../marshal.js";
|
|
16
|
-
import { rpcError } from "../rpcerr.js";
|
|
17
|
-
|
|
18
|
-
/** Delete a datastore by org and slug, returning the deleted resource as protojson. */
|
|
19
|
-
export async function deleteDatastore(
|
|
20
|
-
serverAddress: string,
|
|
21
|
-
token: string,
|
|
22
|
-
org: string,
|
|
23
|
-
slug: string,
|
|
24
|
-
): Promise<string> {
|
|
25
|
-
const desc = `datastore "${slug}" in org "${org}"`;
|
|
26
|
-
return withTransport(serverAddress, token, async (transport, callOptions) => {
|
|
27
|
-
const query = createClient(DatastoreQueryController, transport);
|
|
28
|
-
let id: string;
|
|
29
|
-
try {
|
|
30
|
-
const datastore = await query.getByReference(
|
|
31
|
-
{ org, kind: ApiResourceKind.datastore, slug },
|
|
32
|
-
callOptions,
|
|
33
|
-
);
|
|
34
|
-
id = datastore.metadata?.id ?? "";
|
|
35
|
-
} catch (err) {
|
|
36
|
-
throw rpcError(err, desc);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const command = createClient(DatastoreCommandController, transport);
|
|
40
|
-
try {
|
|
41
|
-
const deleted = await command.delete({ resourceId: id }, callOptions);
|
|
42
|
-
return toProtoJson(DatastoreSchema, deleted);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
throw rpcError(err, desc);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Datastore-definition read path: the single RPC both the get_datastore tool
|
|
2
|
-
// and the datastore resource template delegate to. This is the *structure*
|
|
3
|
-
// surface (collections, constraints, grants); living records are served by the
|
|
4
|
-
// record tools (records/), whose agent-facing summary is describe_datastore.
|
|
5
|
-
|
|
6
|
-
import { DatastoreSchema } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
|
|
7
|
-
import { DatastoreQueryController } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/query_pb";
|
|
8
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
9
|
-
|
|
10
|
-
import { withClient } from "../client.js";
|
|
11
|
-
import { toProtoJson } from "../marshal.js";
|
|
12
|
-
import { rpcError } from "../rpcerr.js";
|
|
13
|
-
|
|
14
|
-
/** Retrieve a datastore by org and slug, returning its protojson representation. */
|
|
15
|
-
export async function fetchDatastore(
|
|
16
|
-
serverAddress: string,
|
|
17
|
-
token: string,
|
|
18
|
-
org: string,
|
|
19
|
-
slug: string,
|
|
20
|
-
): Promise<string> {
|
|
21
|
-
return withClient(DatastoreQueryController, serverAddress, token, async (client, callOptions) => {
|
|
22
|
-
try {
|
|
23
|
-
const datastore = await client.getByReference(
|
|
24
|
-
{ org, kind: ApiResourceKind.datastore, slug },
|
|
25
|
-
callOptions,
|
|
26
|
-
);
|
|
27
|
-
return toProtoJson(DatastoreSchema, datastore);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw rpcError(err, `datastore "${slug}" in org "${org}"`);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Datastore resource template (stigmer://datastores/{org}/{slug}).
|
|
2
|
-
|
|
3
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
|
|
5
|
-
import type { BackendTarget } from "../client.js";
|
|
6
|
-
import { registerResource } from "../resourcehandler.js";
|
|
7
|
-
import { fetchDatastore } from "./fetch.js";
|
|
8
|
-
|
|
9
|
-
/** Register the datastore resource template; returns the registered resource names. */
|
|
10
|
-
export function registerDatastoreResources(server: McpServer, target: BackendTarget): string[] {
|
|
11
|
-
registerResource(server, target, {
|
|
12
|
-
name: "stigmer_datastore",
|
|
13
|
-
title: "Stigmer Datastore",
|
|
14
|
-
description:
|
|
15
|
-
"Full definition of a Stigmer datastore (collections, constraints, grants), " +
|
|
16
|
-
"identified by organization and slug.",
|
|
17
|
-
template: "stigmer://datastores/{org}/{slug}",
|
|
18
|
-
fetch: fetchDatastore,
|
|
19
|
-
});
|
|
20
|
-
return ["stigmer_datastore"];
|
|
21
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// MCP tools for the Datastore *definition* domain — the structure surface
|
|
2
|
-
// (collections, fields, constraints, roles, grants). The record tools
|
|
3
|
-
// (records/tools.ts) operate on the living data inside these structures;
|
|
4
|
-
// before this domain existed, an assistant could insert records into a
|
|
5
|
-
// datastore it had no way to create.
|
|
6
|
-
|
|
7
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
|
|
10
|
-
import { DatastoreInputShape } from "../../gen/datastore.js";
|
|
11
|
-
import { resolveToken, type BackendTarget } from "../client.js";
|
|
12
|
-
import { textOrError } from "../toolresult.js";
|
|
13
|
-
import { applyDatastore } from "./apply.js";
|
|
14
|
-
import { deleteDatastore } from "./delete.js";
|
|
15
|
-
import { fetchDatastore } from "./fetch.js";
|
|
16
|
-
|
|
17
|
-
/** Register every Datastore-domain tool; returns the registered tool names. */
|
|
18
|
-
export function registerDatastoreTools(server: McpServer, target: BackendTarget): string[] {
|
|
19
|
-
server.registerTool(
|
|
20
|
-
"get_datastore",
|
|
21
|
-
{
|
|
22
|
-
description:
|
|
23
|
-
"Get the full definition of a Stigmer datastore by its org and slug: collections, field " +
|
|
24
|
-
"declarations, constraints, roles, and grants. For the record-facing view of the same " +
|
|
25
|
-
"structure (allowed verbs, readable fields), use describe_datastore; for the data " +
|
|
26
|
-
"itself, use the record tools.",
|
|
27
|
-
inputSchema: {
|
|
28
|
-
org: z.string().describe("Organization slug that owns the datastore (e.g. stigmer)."),
|
|
29
|
-
slug: z
|
|
30
|
-
.string()
|
|
31
|
-
.describe("Datastore slug — the unique identifier within the org (e.g. clinic-bookings)."),
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
(args, extra) =>
|
|
35
|
-
textOrError(() =>
|
|
36
|
-
fetchDatastore(target.serverAddress, resolveToken(extra, target.apiKey), args.org, args.slug),
|
|
37
|
-
),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
server.registerTool(
|
|
41
|
-
"apply_datastore",
|
|
42
|
-
{
|
|
43
|
-
description:
|
|
44
|
-
"Create or update a Stigmer datastore definition (idempotent). The manifest is " +
|
|
45
|
-
"authoritative for structure only — schema changes sync on apply (the server enforces " +
|
|
46
|
-
"its additive-plus change rules), and records are never touched; use the record tools " +
|
|
47
|
-
"to manage data.",
|
|
48
|
-
inputSchema: DatastoreInputShape,
|
|
49
|
-
},
|
|
50
|
-
(args, extra) =>
|
|
51
|
-
textOrError(() =>
|
|
52
|
-
applyDatastore(target.serverAddress, resolveToken(extra, target.apiKey), args),
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
server.registerTool(
|
|
57
|
-
"delete_datastore",
|
|
58
|
-
{
|
|
59
|
-
description:
|
|
60
|
-
"Delete a Stigmer datastore by its org and slug, destroying its collections and all " +
|
|
61
|
-
"records in them. This is irreversible. Returns the deleted datastore definition.",
|
|
62
|
-
inputSchema: {
|
|
63
|
-
org: z.string().describe("Organization slug that owns the datastore (e.g. stigmer)."),
|
|
64
|
-
slug: z
|
|
65
|
-
.string()
|
|
66
|
-
.describe("Datastore slug — the unique identifier within the org (e.g. clinic-bookings)."),
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
(args, extra) =>
|
|
70
|
-
textOrError(() =>
|
|
71
|
-
deleteDatastore(target.serverAddress, resolveToken(extra, target.apiKey), args.org, args.slug),
|
|
72
|
-
),
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return ["get_datastore", "apply_datastore", "delete_datastore"];
|
|
76
|
-
}
|