@segmentstream/ontology 0.166.0 → 0.166.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.166.1
4
+
5
+ In an app preview that runs the agent, the agent's tools and recall now act for an eval session's
6
+ test member over `/mcp` as they do over the REST routes. MCP requests now see the preview's
7
+ deployment, so eval grants count there, and a preview's capability limits apply to them.
8
+
3
9
  ## 0.166.0
4
10
 
5
11
  `agent_chat.draft({ chat, message?, note? })` asks the agent to draft a reply in a person's private
@@ -4,6 +4,7 @@ import { HttpApiBuilder, HttpApiSecurity } from "effect/unstable/httpapi";
4
4
  import { ActionRejected } from "../../errors.js";
5
5
  import { currentToolName } from "../../earlier-entity-names.js";
6
6
  import { DeploymentAdmissionError } from "../../deployment.js";
7
+ import { RuntimeDeployment } from "../../runtime/deployment.js";
7
8
  import { effectivePermissions } from "../../permissions.js";
8
9
  import { declaredChatRetentionDaysOf, encodeManifest } from "../../manifest.js";
9
10
  import { describeError, SCOPE_MISMATCH } from "../metric-query-platform.js";
@@ -831,6 +832,12 @@ export function mcpLayer(options) {
831
832
  const router = yield* HttpRouter.HttpRouter;
832
833
  const backend = yield* OntologyBackend;
833
834
  const warehouseQueries = yield* Effect.serviceOption(WarehouseQueries);
835
+ // Requests see only what is provided to them, as the warehouse is: whom a preview's agent may
836
+ // act for, and what a preview may run, depend on its deployment.
837
+ const deployment = yield* Effect.serviceOption(RuntimeDeployment);
838
+ const deployed = (effect) => Option.isSome(deployment)
839
+ ? Effect.provideService(effect, RuntimeDeployment, deployment.value)
840
+ : effect;
834
841
  const tools = mcpTools(options.built, options.chatHistory !== undefined, {
835
842
  attachments: backend.attachments !== undefined,
836
843
  files: backend.blobs !== undefined,
@@ -861,14 +868,14 @@ export function mcpLayer(options) {
861
868
  };
862
869
  const post = handlePost(server, options.verifyToken, options.verifyRuntime, backend, options.workspaceId);
863
870
  yield* router.add("POST", MCP_PATH, (request) => {
864
- const response = post(request);
871
+ const response = deployed(post(request));
865
872
  const served = Option.isSome(warehouseQueries)
866
873
  ? response.pipe(Effect.provideService(WarehouseQueries, warehouseQueries.value))
867
874
  : response;
868
875
  return served.pipe(Effect.map((response) => HttpServerResponse.setHeaders(response, CORS)));
869
876
  });
870
877
  yield* router.add("OPTIONS", MCP_PATH, PREFLIGHT);
871
- yield* router.add("GET", MCP_PATH, (request) => handleGet(request, options, backend).pipe(Effect.map((response) => HttpServerResponse.setHeaders(response, CORS))));
878
+ yield* router.add("GET", MCP_PATH, (request) => deployed(handleGet(request, options, backend)).pipe(Effect.map((response) => HttpServerResponse.setHeaders(response, CORS))));
872
879
  yield* router.add("DELETE", MCP_PATH, METHOD_NOT_ALLOWED);
873
880
  }));
874
881
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.166.0",
3
+ "version": "0.166.1",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",