@stigmer/mcp-server 3.3.0 → 3.4.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.
Files changed (154) hide show
  1. package/README.md +60 -13
  2. package/cli/mcp-server-stigmer.js +5 -1
  3. package/domains/agentexecutions/approve.d.ts +9 -0
  4. package/domains/agentexecutions/approve.d.ts.map +1 -0
  5. package/domains/agentexecutions/approve.js +46 -0
  6. package/domains/agentexecutions/approve.js.map +1 -0
  7. package/domains/agentexecutions/fetch.d.ts +28 -0
  8. package/domains/agentexecutions/fetch.d.ts.map +1 -0
  9. package/domains/agentexecutions/fetch.js +82 -0
  10. package/domains/agentexecutions/fetch.js.map +1 -0
  11. package/domains/agentexecutions/run.d.ts +27 -0
  12. package/domains/agentexecutions/run.d.ts.map +1 -0
  13. package/domains/agentexecutions/run.js +87 -0
  14. package/domains/agentexecutions/run.js.map +1 -0
  15. package/domains/agentexecutions/tools.d.ts +5 -0
  16. package/domains/agentexecutions/tools.d.ts.map +1 -0
  17. package/domains/agentexecutions/tools.js +97 -0
  18. package/domains/agentexecutions/tools.js.map +1 -0
  19. package/domains/client.d.ts +8 -0
  20. package/domains/client.d.ts.map +1 -1
  21. package/domains/client.js +9 -0
  22. package/domains/client.js.map +1 -1
  23. package/domains/datastores/apply.d.ts +4 -0
  24. package/domains/datastores/apply.d.ts.map +1 -0
  25. package/domains/datastores/apply.js +28 -0
  26. package/domains/datastores/apply.js.map +1 -0
  27. package/domains/datastores/delete.d.ts +3 -0
  28. package/domains/datastores/delete.d.ts.map +1 -0
  29. package/domains/datastores/delete.js +38 -0
  30. package/domains/datastores/delete.js.map +1 -0
  31. package/domains/datastores/fetch.d.ts +3 -0
  32. package/domains/datastores/fetch.d.ts.map +1 -0
  33. package/domains/datastores/fetch.js +23 -0
  34. package/domains/datastores/fetch.js.map +1 -0
  35. package/domains/datastores/resources.d.ts +5 -0
  36. package/domains/datastores/resources.d.ts.map +1 -0
  37. package/domains/datastores/resources.js +16 -0
  38. package/domains/datastores/resources.js.map +1 -0
  39. package/domains/datastores/tools.d.ts +5 -0
  40. package/domains/datastores/tools.d.ts.map +1 -0
  41. package/domains/datastores/tools.js +46 -0
  42. package/domains/datastores/tools.js.map +1 -0
  43. package/domains/environments/apply.d.ts +4 -0
  44. package/domains/environments/apply.d.ts.map +1 -0
  45. package/domains/environments/apply.js +30 -0
  46. package/domains/environments/apply.js.map +1 -0
  47. package/domains/environments/delete.d.ts +3 -0
  48. package/domains/environments/delete.d.ts.map +1 -0
  49. package/domains/environments/delete.js +36 -0
  50. package/domains/environments/delete.js.map +1 -0
  51. package/domains/environments/fetch.d.ts +6 -0
  52. package/domains/environments/fetch.d.ts.map +1 -0
  53. package/domains/environments/fetch.js +30 -0
  54. package/domains/environments/fetch.js.map +1 -0
  55. package/domains/environments/resources.d.ts +5 -0
  56. package/domains/environments/resources.d.ts.map +1 -0
  57. package/domains/environments/resources.js +16 -0
  58. package/domains/environments/resources.js.map +1 -0
  59. package/domains/environments/tools.d.ts +5 -0
  60. package/domains/environments/tools.d.ts.map +1 -0
  61. package/domains/environments/tools.js +51 -0
  62. package/domains/environments/tools.js.map +1 -0
  63. package/domains/executions/cancel.d.ts +9 -0
  64. package/domains/executions/cancel.d.ts.map +1 -0
  65. package/domains/executions/cancel.js +114 -0
  66. package/domains/executions/cancel.js.map +1 -0
  67. package/domains/executions/tools.d.ts +5 -0
  68. package/domains/executions/tools.d.ts.map +1 -0
  69. package/domains/executions/tools.js +28 -0
  70. package/domains/executions/tools.js.map +1 -0
  71. package/domains/records/tools.d.ts.map +1 -1
  72. package/domains/records/tools.js +7 -3
  73. package/domains/records/tools.js.map +1 -1
  74. package/domains/resourceuri.d.ts.map +1 -1
  75. package/domains/resourceuri.js +2 -0
  76. package/domains/resourceuri.js.map +1 -1
  77. package/domains/search/tools.d.ts.map +1 -1
  78. package/domains/search/tools.js +10 -7
  79. package/domains/search/tools.js.map +1 -1
  80. package/domains/skills/tools.d.ts.map +1 -1
  81. package/domains/skills/tools.js +25 -1
  82. package/domains/skills/tools.js.map +1 -1
  83. package/domains/skills/versions.d.ts +9 -0
  84. package/domains/skills/versions.d.ts.map +1 -0
  85. package/domains/skills/versions.js +31 -0
  86. package/domains/skills/versions.js.map +1 -0
  87. package/domains/workflowexecutions/approvals.d.ts +17 -0
  88. package/domains/workflowexecutions/approvals.d.ts.map +1 -0
  89. package/domains/workflowexecutions/approvals.js +61 -0
  90. package/domains/workflowexecutions/approvals.js.map +1 -0
  91. package/domains/workflowexecutions/run.d.ts +12 -0
  92. package/domains/workflowexecutions/run.d.ts.map +1 -0
  93. package/domains/workflowexecutions/run.js +69 -0
  94. package/domains/workflowexecutions/run.js.map +1 -0
  95. package/domains/workflowexecutions/tools.d.ts.map +1 -1
  96. package/domains/workflowexecutions/tools.js +89 -6
  97. package/domains/workflowexecutions/tools.js.map +1 -1
  98. package/domains/workflows/tools.d.ts.map +1 -1
  99. package/domains/workflows/tools.js +69 -5
  100. package/domains/workflows/tools.js.map +1 -1
  101. package/domains/workflows/versions.d.ts +29 -0
  102. package/domains/workflows/versions.d.ts.map +1 -0
  103. package/domains/workflows/versions.js +99 -0
  104. package/domains/workflows/versions.js.map +1 -0
  105. package/gen/datastore.d.ts +861 -0
  106. package/gen/datastore.d.ts.map +1 -0
  107. package/gen/datastore.js +267 -0
  108. package/gen/datastore.js.map +1 -0
  109. package/gen/environment.d.ts +77 -0
  110. package/gen/environment.d.ts.map +1 -0
  111. package/gen/environment.js +62 -0
  112. package/gen/environment.js.map +1 -0
  113. package/package.json +3 -3
  114. package/server.d.ts.map +1 -1
  115. package/server.js +12 -0
  116. package/server.js.map +1 -1
  117. package/src/domains/agentexecutions/approve.ts +67 -0
  118. package/src/domains/agentexecutions/fetch.ts +112 -0
  119. package/src/domains/agentexecutions/run.ts +112 -0
  120. package/src/domains/agentexecutions/tools.ts +139 -0
  121. package/src/domains/apply.integration.test.ts +82 -6
  122. package/src/domains/client.ts +9 -0
  123. package/src/domains/datastores/apply.ts +33 -0
  124. package/src/domains/datastores/delete.ts +47 -0
  125. package/src/domains/datastores/fetch.ts +32 -0
  126. package/src/domains/datastores/resources.ts +21 -0
  127. package/src/domains/datastores/tools.ts +76 -0
  128. package/src/domains/deletes.integration.test.ts +49 -2
  129. package/src/domains/environments/apply.ts +40 -0
  130. package/src/domains/environments/delete.ts +45 -0
  131. package/src/domains/environments/fetch.ts +39 -0
  132. package/src/domains/environments/resources.ts +21 -0
  133. package/src/domains/environments/tools.ts +81 -0
  134. package/src/domains/executions/cancel.ts +148 -0
  135. package/src/domains/executions/tools.ts +45 -0
  136. package/src/domains/executions.integration.test.ts +376 -0
  137. package/src/domains/reads.integration.test.ts +51 -5
  138. package/src/domains/records/tools.ts +7 -3
  139. package/src/domains/resources.integration.test.ts +38 -2
  140. package/src/domains/resourceuri.test.ts +11 -2
  141. package/src/domains/resourceuri.ts +2 -0
  142. package/src/domains/search/search.integration.test.ts +18 -2
  143. package/src/domains/search/tools.ts +12 -7
  144. package/src/domains/skills/tools.ts +34 -1
  145. package/src/domains/skills/versions.ts +47 -0
  146. package/src/domains/versions.integration.test.ts +212 -0
  147. package/src/domains/workflowexecutions/approvals.ts +102 -0
  148. package/src/domains/workflowexecutions/run.ts +87 -0
  149. package/src/domains/workflowexecutions/tools.ts +120 -6
  150. package/src/domains/workflows/tools.ts +90 -7
  151. package/src/domains/workflows/versions.ts +147 -0
  152. package/src/gen/datastore.ts +264 -0
  153. package/src/gen/environment.ts +66 -0
  154. package/src/server.ts +12 -0
@@ -0,0 +1,264 @@
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
+
6
+ import { generateSlug, visibilityFromString, enumFromString } from "./apply-runtime.js";
7
+ import { create, fromJson, type JsonValue } from "@bufbuild/protobuf";
8
+ import { ValueSchema } from "@bufbuild/protobuf/wkt";
9
+ import { DatastoreSchema, type Datastore } from "@stigmer/protos/ai/stigmer/agentic/datastore/v1/api_pb";
10
+ 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";
11
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
12
+ import { ApiResourceRefSchema } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
13
+ import { z } from "zod";
14
+
15
+ /** DatastoreSpec declares typed record collections with constraints and role-aware access grants. @internal The manifest is authoritative for structure, never for living data: schema changes sync on apply (additive-plus change matrix, gating), and records enter exclusively through the record RPCs — there is no seed path (DD-010 SD-5 removed seed_records; console, agent tools, and import scripts are the population surfaces). Structural limits here are v1 guardrails — raising a max_items later is a non-breaking change. Max datastores per org (25) cannot be expressed on this message; it is a domain validation constant in the create pipelines. */
16
+ export const DatastoreInputShape = {
17
+ name: z.string().describe("Human-readable name of the resource."),
18
+ slug: z.string().optional().describe("URL-friendly identifier (lowercase alphanumeric with hyphens). Auto-generated from name if omitted."),
19
+ org: z.string().describe("Organization that owns this resource (e.g. acme)."),
20
+ visibility: z.string().optional().describe("Resource visibility: PRIVATE or PUBLIC. Omit to leave unchanged on updates."),
21
+ labels: z.record(z.string()).optional().describe("Key-value labels for organization and filtering."),
22
+ tags: z.array(z.string()).optional().describe("Tags for categorization and discovery."),
23
+ description: z.string().optional().describe("Human-readable description of what this datastore holds."),
24
+ 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. @internal IANA-name validity is domain validation (the proto layer cannot carry a timezone database)."),
25
+ authorization: z.lazy(() => DatastoreAuthorizationInputSchema).optional().describe("Record-layer authorization: roles, subject bindings, and the default role for unbound callers."),
26
+ collections: z.array(z.lazy(() => CollectionDeclarationInputSchema)).optional().describe("Record collections declared by this datastore. @internal Collection-name uniqueness within the datastore is domain validation (protovalidate CEL has no portable uniqueness check over message lists)."),
27
+ } as const;
28
+
29
+ export const DatastoreInputSchema = z.object(DatastoreInputShape);
30
+ export type DatastoreInput = z.infer<typeof DatastoreInputSchema>;
31
+
32
+ const DatastoreRoleInputSchema = z.object({
33
+ name: z.string().describe("Role name, referenced by bindings, grants, and default_role."),
34
+ });
35
+ type DatastoreRoleInput = z.infer<typeof DatastoreRoleInputSchema>;
36
+
37
+ const ChannelSenderSubjectInputSchema = z.object({
38
+ 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)."),
39
+ 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. @internal Bearer-adjacent: never logged raw, never filterable, never echoed into validation error strings, and only ever compared against broker-stamped session metadata."),
40
+ });
41
+ type ChannelSenderSubjectInput = z.infer<typeof ChannelSenderSubjectInputSchema>;
42
+
43
+ const ApiResourceRefInputSchema = z.object({
44
+ 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."),
45
+ id: z.string().describe("Unique identifier of the resource This is the resource's ID field (e.g., ia-01HQUSER123, tm-01HQTEAM456)"),
46
+ 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). @internal In OpenFGA tuple notation: team:tm-123#member (as the subject of the tuple)"),
47
+ });
48
+ type ApiResourceRefInput = z.infer<typeof ApiResourceRefInputSchema>;
49
+
50
+ const DatastoreSubjectInputSchema = z.object({
51
+ channel_sender: z.lazy(() => ChannelSenderSubjectInputSchema).optional().describe("Channel sender identity, matched against the session metadata stamped by the channel broker."),
52
+ principal: z.lazy(() => ApiResourceRefInputSchema).optional().describe("Platform principal (an identity account today; teams later without schema change). @internal Matched by exact kind+id equality against the caller-derived subject; the relation qualifier is excluded from identity and rejected at apply. The id is the account id, never a slug or email — apply-time validation refuses unresolvable values with a membership-gated did-you-mean instead of letting them bind nothing silently (dont-dos/001)."),
53
+ });
54
+ type DatastoreSubjectInput = z.infer<typeof DatastoreSubjectInputSchema>;
55
+
56
+ const DatastoreRoleBindingInputSchema = z.object({
57
+ subject: z.lazy(() => DatastoreSubjectInputSchema).describe("The caller identity this binding matches."),
58
+ role: z.string().describe("Name of a declared role."),
59
+ });
60
+ type DatastoreRoleBindingInput = z.infer<typeof DatastoreRoleBindingInputSchema>;
61
+
62
+ const DatastoreAuthorizationInputSchema = z.object({
63
+ roles: z.array(z.lazy(() => DatastoreRoleInputSchema)).optional().describe("Role names referenced by bindings and grants (e.g. 'admin', 'patient')."),
64
+ bindings: z.array(z.lazy(() => DatastoreRoleBindingInputSchema)).optional().describe("Subject-to-role bindings. @internal Role-reference integrity (every binding names a declared role) is domain validation."),
65
+ 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."),
66
+ });
67
+ type DatastoreAuthorizationInput = z.infer<typeof DatastoreAuthorizationInputSchema>;
68
+
69
+ const FieldDeclarationInputSchema = z.object({
70
+ 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."),
71
+ type: z.string().describe("Value type for this field. Allowed values: string, integer, number, bool, timestamp, date, time, json."),
72
+ required: z.boolean().optional().describe("Whether a value must be present on every record. Absent optional fields evaluate as null in constraint expressions."),
73
+ default: z.unknown().optional().describe("Default value applied when the field is absent on insert. @internal Type compatibility between the default and the declared type is domain validation (google.protobuf.Value is untyped here)."),
74
+ enum_values: z.array(z.string()).optional().describe("Allowed values for string fields. Declaring enum_values on a non-string field is rejected."),
75
+ description: z.string().optional().describe("Human-readable description, surfaced to agents via describe_datastore."),
76
+ });
77
+ type FieldDeclarationInput = z.infer<typeof FieldDeclarationInputSchema>;
78
+
79
+ const UniqueWhereInputSchema = z.object({
80
+ field: z.string().describe("Declared field the condition tests."),
81
+ equals: z.unknown().describe("Value the field must equal for the constraint to apply."),
82
+ });
83
+ type UniqueWhereInput = z.infer<typeof UniqueWhereInputSchema>;
84
+
85
+ const UniqueConstraintInputSchema = z.object({
86
+ name: z.string().describe("Constraint name, unique within the collection."),
87
+ fields: z.array(z.string()).optional().describe("Declared fields whose combined values must be unique."),
88
+ 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). @internal Structured, never an expression — it must compile to the substrate's partial-index dialect in both editions."),
89
+ 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')."),
90
+ });
91
+ type UniqueConstraintInput = z.infer<typeof UniqueConstraintInputSchema>;
92
+
93
+ const CheckConstraintInputSchema = z.object({
94
+ name: z.string().describe("Constraint name, unique within the collection."),
95
+ expression: z.string().describe("CEL expression that must evaluate true for the record to be written."),
96
+ when: z.string().optional().describe("Optional CEL gate: the check applies only when this evaluates true."),
97
+ message: z.string().describe("Error message returned on violation, written to be relayed to an end user by an agent."),
98
+ });
99
+ type CheckConstraintInput = z.infer<typeof CheckConstraintInputSchema>;
100
+
101
+ const ExistsConstraintInputSchema = z.object({
102
+ name: z.string().describe("Constraint name, unique within the collection."),
103
+ collection: z.string().describe("Target collection in the same datastore."),
104
+ where: z.string().describe("CEL condition matching candidate ('this') against target records ('that')."),
105
+ when: z.string().optional().describe("Optional CEL gate: the constraint applies only when this evaluates true."),
106
+ message: z.string().describe("Error message returned on violation, written to be relayed to an end user by an agent."),
107
+ });
108
+ type ExistsConstraintInput = z.infer<typeof ExistsConstraintInputSchema>;
109
+
110
+ const DatastoreGrantInputSchema = z.object({
111
+ role: z.string().describe("Name of a declared role."),
112
+ verbs: z.array(z.string()).optional().describe("Verbs granted to the role on this collection. Allowed values: read, insert, update, delete."),
113
+ 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."),
114
+ 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. @internal The column-level GRANT SELECT of the record layer, closing the scope-all-reads-carry-PII residual (dont-dos/002): every record RPC response — find results AND write echoes — is projected to the caller's read-grant field set, and created_by is included only when listed (for channel senders it is the phone number, the most direct PII in the envelope). A caller with no read grant at all receives envelopes with id and timestamps only (write-only access). Empty = unrestricted is forced by proto3 repeated-field semantics (no presence) and mirrors 'scope' unset = all. Requires 'read' among the grant's verbs — read_fields on a write-only grant is declared intent with no effect and is refused at apply, same posture as the binding relation qualifier. Entry-to-declared-field resolution is domain validation (both editions, byte-identical messages)."),
115
+ });
116
+ type DatastoreGrantInput = z.infer<typeof DatastoreGrantInputSchema>;
117
+
118
+ const CollectionDeclarationInputSchema = z.object({
119
+ name: z.string().describe("Collection name, unique within the datastore. Format: lowercase snake_case (e.g. 'bookings', 'schedule_exceptions')."),
120
+ description: z.string().optional().describe("Human-readable description of what records in this collection represent."),
121
+ fields: z.array(z.lazy(() => FieldDeclarationInputSchema)).optional().describe("Typed field declarations for records in this collection."),
122
+ uniques: z.array(z.lazy(() => UniqueConstraintInputSchema)).optional().describe("Uniqueness constraints, enforced by substrate indexes."),
123
+ checks: z.array(z.lazy(() => CheckConstraintInputSchema)).optional().describe("Single-record check constraints, evaluated on every insert and update."),
124
+ exists: z.array(z.lazy(() => ExistsConstraintInputSchema)).optional().describe("Cross-collection constraints requiring a matching record to exist."),
125
+ not_exists: z.array(z.lazy(() => ExistsConstraintInputSchema)).optional().describe("Cross-collection constraints requiring no matching record to exist."),
126
+ 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."),
127
+ });
128
+ type CollectionDeclarationInput = z.infer<typeof CollectionDeclarationInputSchema>;
129
+
130
+
131
+ /** Build the fully-formed Datastore proto from the flat MCP apply input. */
132
+ export function datastoreInputToProto(input: DatastoreInput): Datastore {
133
+ const slug = input.slug && input.slug.length > 0 ? input.slug : generateSlug(input.name);
134
+ const spec = create(DatastoreSpecSchema);
135
+ if (input.description !== undefined) spec.description = input.description;
136
+ if (input.timezone !== undefined) spec.timezone = input.timezone;
137
+ if (input.authorization !== undefined) spec.authorization = datastoreAuthorizationInputToProto(input.authorization);
138
+ if (input.collections !== undefined) spec.collections = input.collections.map(collectionDeclarationInputToProto);
139
+ return Object.assign(create(DatastoreSchema), {
140
+ apiVersion: "agentic.stigmer.ai/v1",
141
+ kind: "Datastore",
142
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
143
+ name: input.name,
144
+ slug,
145
+ org: input.org,
146
+ ...(input.visibility !== undefined && { visibility: visibilityFromString(input.visibility) }),
147
+ ...(input.labels !== undefined && { labels: input.labels }),
148
+ ...(input.tags !== undefined && { tags: input.tags }),
149
+ }),
150
+ spec,
151
+ }) as Datastore;
152
+ }
153
+
154
+ function datastoreRoleInputToProto(input: DatastoreRoleInput) {
155
+ const result = create(DatastoreRoleSchema);
156
+ if (input.name !== undefined) result.name = input.name;
157
+ return result;
158
+ }
159
+
160
+ function channelSenderSubjectInputToProto(input: ChannelSenderSubjectInput) {
161
+ const result = create(ChannelSenderSubjectSchema);
162
+ if (input.sender_kind !== undefined) result.senderKind = input.sender_kind;
163
+ if (input.value !== undefined) result.value = input.value;
164
+ return result;
165
+ }
166
+
167
+ function apiResourceRefInputToProto(input: ApiResourceRefInput) {
168
+ const result = create(ApiResourceRefSchema);
169
+ if (input.kind !== undefined) result.kind = input.kind;
170
+ if (input.id !== undefined) result.id = input.id;
171
+ if (input.relation !== undefined) result.relation = input.relation;
172
+ return result;
173
+ }
174
+
175
+ function datastoreSubjectInputToProto(input: DatastoreSubjectInput) {
176
+ const result = create(DatastoreSubjectSchema);
177
+ if (input.channel_sender !== undefined) result.kind = { case: "channelSender", value: channelSenderSubjectInputToProto(input.channel_sender) };
178
+ if (input.principal !== undefined) result.kind = { case: "principal", value: apiResourceRefInputToProto(input.principal) };
179
+ return result;
180
+ }
181
+
182
+ function datastoreRoleBindingInputToProto(input: DatastoreRoleBindingInput) {
183
+ const result = create(DatastoreRoleBindingSchema);
184
+ if (input.subject !== undefined) result.subject = datastoreSubjectInputToProto(input.subject);
185
+ if (input.role !== undefined) result.role = input.role;
186
+ return result;
187
+ }
188
+
189
+ function datastoreAuthorizationInputToProto(input: DatastoreAuthorizationInput) {
190
+ const result = create(DatastoreAuthorizationSchema);
191
+ if (input.roles !== undefined) result.roles = input.roles.map(datastoreRoleInputToProto);
192
+ if (input.bindings !== undefined) result.bindings = input.bindings.map(datastoreRoleBindingInputToProto);
193
+ if (input.default_role !== undefined) result.defaultRole = input.default_role;
194
+ return result;
195
+ }
196
+
197
+ function fieldDeclarationInputToProto(input: FieldDeclarationInput) {
198
+ const result = create(FieldDeclarationSchema);
199
+ if (input.name !== undefined) result.name = input.name;
200
+ result.type = enumFromString(FieldType, input.type) as FieldType;
201
+ if (input.required !== undefined) result.required = input.required;
202
+ if (input.default !== undefined) result.default = fromJson(ValueSchema, input.default as JsonValue);
203
+ if (input.enum_values !== undefined) result.enumValues = input.enum_values;
204
+ if (input.description !== undefined) result.description = input.description;
205
+ return result;
206
+ }
207
+
208
+ function uniqueWhereInputToProto(input: UniqueWhereInput) {
209
+ const result = create(UniqueWhereSchema);
210
+ if (input.field !== undefined) result.field = input.field;
211
+ if (input.equals !== undefined) result.equals = fromJson(ValueSchema, input.equals as JsonValue);
212
+ return result;
213
+ }
214
+
215
+ function uniqueConstraintInputToProto(input: UniqueConstraintInput) {
216
+ const result = create(UniqueConstraintSchema);
217
+ if (input.name !== undefined) result.name = input.name;
218
+ if (input.fields !== undefined) result.fields = input.fields;
219
+ if (input.where !== undefined) result.where = uniqueWhereInputToProto(input.where);
220
+ if (input.message !== undefined) result.message = input.message;
221
+ return result;
222
+ }
223
+
224
+ function checkConstraintInputToProto(input: CheckConstraintInput) {
225
+ const result = create(CheckConstraintSchema);
226
+ if (input.name !== undefined) result.name = input.name;
227
+ if (input.expression !== undefined) result.expression = input.expression;
228
+ if (input.when !== undefined) result.when = input.when;
229
+ if (input.message !== undefined) result.message = input.message;
230
+ return result;
231
+ }
232
+
233
+ function existsConstraintInputToProto(input: ExistsConstraintInput) {
234
+ const result = create(ExistsConstraintSchema);
235
+ if (input.name !== undefined) result.name = input.name;
236
+ if (input.collection !== undefined) result.collection = input.collection;
237
+ if (input.where !== undefined) result.where = input.where;
238
+ if (input.when !== undefined) result.when = input.when;
239
+ if (input.message !== undefined) result.message = input.message;
240
+ return result;
241
+ }
242
+
243
+ function datastoreGrantInputToProto(input: DatastoreGrantInput) {
244
+ const result = create(DatastoreGrantSchema);
245
+ if (input.role !== undefined) result.role = input.role;
246
+ if (input.verbs !== undefined) result.verbs = input.verbs.map((v) => enumFromString(DatastoreVerb, v) as DatastoreVerb);
247
+ result.scope = enumFromString(DatastoreGrantScope, input.scope) as DatastoreGrantScope;
248
+ if (input.read_fields !== undefined) result.readFields = input.read_fields;
249
+ return result;
250
+ }
251
+
252
+ function collectionDeclarationInputToProto(input: CollectionDeclarationInput) {
253
+ const result = create(CollectionDeclarationSchema);
254
+ if (input.name !== undefined) result.name = input.name;
255
+ if (input.description !== undefined) result.description = input.description;
256
+ if (input.fields !== undefined) result.fields = input.fields.map(fieldDeclarationInputToProto);
257
+ if (input.uniques !== undefined) result.uniques = input.uniques.map(uniqueConstraintInputToProto);
258
+ if (input.checks !== undefined) result.checks = input.checks.map(checkConstraintInputToProto);
259
+ if (input.exists !== undefined) result.exists = input.exists.map(existsConstraintInputToProto);
260
+ if (input.not_exists !== undefined) result.notExists = input.not_exists.map(existsConstraintInputToProto);
261
+ if (input.grants !== undefined) result.grants = input.grants.map(datastoreGrantInputToProto);
262
+ return result;
263
+ }
264
+
@@ -0,0 +1,66 @@
1
+ // Code generated by stigmer-codegen --target=mcp-ts. DO NOT EDIT.
2
+ //
3
+ // Flattened apply-input zod schema + toProto bridge for the Environment resource.
4
+ // Source proto package: ai.stigmer.agentic.environment.v1
5
+
6
+ import { generateSlug, visibilityFromString } from "./apply-runtime.js";
7
+ import { create } from "@bufbuild/protobuf";
8
+ import { EnvironmentSchema, type Environment } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/api_pb";
9
+ import { EnvironmentSpecSchema, EnvironmentValueSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
10
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
11
+ import { z } from "zod";
12
+
13
+ /** EnvironmentSpec defines the configurable properties of an environment. @internal The overview.md file provides the SDK-facing description and example YAML. */
14
+ export const EnvironmentInputShape = {
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 for UI and listing display."),
22
+ data: z.record(z.lazy(() => EnvironmentValueInputSchema)).optional().describe("Key-value pairs containing configuration and secrets. Each value includes a flag indicating whether it is a secret."),
23
+ } as const;
24
+
25
+ export const EnvironmentInputSchema = z.object(EnvironmentInputShape);
26
+ export type EnvironmentInput = z.infer<typeof EnvironmentInputSchema>;
27
+
28
+ const EnvironmentValueInputSchema = z.object({
29
+ value: z.string().optional().describe("The configuration or secret string. @internal When is_secret is true the value is encrypted at rest and redacted in logs. When is_secret is false the value is stored as plaintext. Value can be empty when pre-declaring keys whose values are injected at runtime."),
30
+ is_secret: z.boolean().optional().describe("Whether this value should be treated as a secret. @internal When true: encrypted at rest, redacted in logs, requires can_read_secrets to reveal. When false: stored as plaintext, visible in audit logs."),
31
+ description: z.string().optional().describe("Human-readable description of what this value is used for."),
32
+ });
33
+ type EnvironmentValueInput = z.infer<typeof EnvironmentValueInputSchema>;
34
+
35
+
36
+ /** Build the fully-formed Environment proto from the flat MCP apply input. */
37
+ export function environmentInputToProto(input: EnvironmentInput): Environment {
38
+ const slug = input.slug && input.slug.length > 0 ? input.slug : generateSlug(input.name);
39
+ const spec = create(EnvironmentSpecSchema);
40
+ if (input.description !== undefined) spec.description = input.description;
41
+ if (input.data !== undefined) {
42
+ for (const [k, v] of Object.entries(input.data)) spec.data[k] = environmentValueInputToProto(v);
43
+ }
44
+ return Object.assign(create(EnvironmentSchema), {
45
+ apiVersion: "agentic.stigmer.ai/v1",
46
+ kind: "Environment",
47
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
48
+ name: input.name,
49
+ slug,
50
+ org: input.org,
51
+ ...(input.visibility !== undefined && { visibility: visibilityFromString(input.visibility) }),
52
+ ...(input.labels !== undefined && { labels: input.labels }),
53
+ ...(input.tags !== undefined && { tags: input.tags }),
54
+ }),
55
+ spec,
56
+ }) as Environment;
57
+ }
58
+
59
+ function environmentValueInputToProto(input: EnvironmentValueInput) {
60
+ const result = create(EnvironmentValueSchema);
61
+ if (input.value !== undefined) result.value = input.value;
62
+ if (input.is_secret !== undefined) result.isSecret = input.is_secret;
63
+ if (input.description !== undefined) result.description = input.description;
64
+ return result;
65
+ }
66
+
package/src/server.ts CHANGED
@@ -19,9 +19,15 @@ import type { AuthInfo } from "@modelcontextprotocol/sdk/server/auth/types.js";
19
19
  import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
20
20
 
21
21
  import type { Config } from "./config.js";
22
+ import { registerAgentExecutionTools } from "./domains/agentexecutions/tools.js";
22
23
  import { registerAgentResources } from "./domains/agents/resources.js";
23
24
  import { registerAgentTools } from "./domains/agents/tools.js";
24
25
  import type { BackendTarget } from "./domains/client.js";
26
+ import { registerDatastoreResources } from "./domains/datastores/resources.js";
27
+ import { registerDatastoreTools } from "./domains/datastores/tools.js";
28
+ import { registerEnvironmentResources } from "./domains/environments/resources.js";
29
+ import { registerEnvironmentTools } from "./domains/environments/tools.js";
30
+ import { registerExecutionControlTools } from "./domains/executions/tools.js";
25
31
  import { registerMcpServerResources } from "./domains/mcpservers/resources.js";
26
32
  import { registerMcpServerTools } from "./domains/mcpservers/tools.js";
27
33
  import { registerRecordTools } from "./domains/records/tools.js";
@@ -86,12 +92,16 @@ function registerTools(server: McpServer, target: BackendTarget): void {
86
92
  const tools = [
87
93
  ...registerSearchTools(server, target),
88
94
  ...registerAgentTools(server, target),
95
+ ...registerAgentExecutionTools(server, target),
89
96
  ...registerMcpServerTools(server, target),
90
97
  ...registerSkillTools(server, target),
91
98
  ...registerWorkflowTools(server, target),
92
99
  ...registerValidateWorkflowYamlTool(server, target),
93
100
  ...registerTaskKindTools(server, target),
94
101
  ...registerWorkflowExecutionTools(server, target),
102
+ ...registerExecutionControlTools(server, target),
103
+ ...registerEnvironmentTools(server, target),
104
+ ...registerDatastoreTools(server, target),
95
105
  // The record tools also serve external MCP clients — as direct
96
106
  // principals with the org argument and honest annotations (the
97
107
  // agent-facing variant lives on the records-only roster).
@@ -111,6 +121,8 @@ function registerResources(server: McpServer, target: BackendTarget): void {
111
121
  ...registerMcpServerResources(server, target),
112
122
  ...registerSkillResources(server, target),
113
123
  ...registerWorkflowResources(server, target),
124
+ ...registerEnvironmentResources(server, target),
125
+ ...registerDatastoreResources(server, target),
114
126
  ];
115
127
  log.info("resources registered", { count: resources.length, resources });
116
128
  }