@securecoms/agent-runtime 0.9.8 → 0.9.9

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 (2) hide show
  1. package/dist/bin.js +9 -2
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -3699,6 +3699,10 @@ var NO_TURN_AUTHORIZATION = Object.freeze({
3699
3699
  sender_membership: "unknown",
3700
3700
  tool_grants: Object.freeze([])
3701
3701
  });
3702
+ var PER_TOOL_GRANTS_FEATURE = "per_tool_grants";
3703
+ function runtimeHelloFrame() {
3704
+ return { type: "hello", features: ["nack", PER_TOOL_GRANTS_FEATURE] };
3705
+ }
3702
3706
  function parseTurnAuthorization(value) {
3703
3707
  if (!value || typeof value !== "object" || Array.isArray(value)) return NO_TURN_AUTHORIZATION;
3704
3708
  const raw = value;
@@ -3726,7 +3730,8 @@ function parseTurnAuthorization(value) {
3726
3730
  version: 1,
3727
3731
  audience: raw.audience,
3728
3732
  sender_membership: raw.sender_membership,
3729
- tool_grants: Object.freeze(grants)
3733
+ tool_grants: Object.freeze(grants),
3734
+ ...raw.relay_speaker === "owner" ? { relay_speaker: "owner" } : {}
3730
3735
  });
3731
3736
  }
3732
3737
  var VOICE_GUIDANCE_MAX_CHARS = 1e3;
@@ -3969,7 +3974,7 @@ var SecureComsDataPlane = class {
3969
3974
  ws.addEventListener("open", () => {
3970
3975
  this.helloPending.add(ws);
3971
3976
  try {
3972
- ws.send(JSON.stringify({ type: "hello", features: ["nack"] }));
3977
+ ws.send(JSON.stringify(runtimeHelloFrame()));
3973
3978
  } catch {
3974
3979
  }
3975
3980
  settle = setTimeout(() => {
@@ -4279,7 +4284,9 @@ function hasReadGrant(auth, toolName) {
4279
4284
  function hasSideEffectGrant(auth, toolName) {
4280
4285
  return auth.sender_membership === "active" && auth.tool_grants.some((grant) => grant.tool === toolName && grant.mode === "side_effect");
4281
4286
  }
4287
+ var ROOM_SAFE_READ_TOOLS = /* @__PURE__ */ new Set(["current_time"]);
4282
4288
  function toolIsOffered(auth, toolName) {
4289
+ if (auth.audience !== "owner_dm" && !(auth.audience === "team_room" && ROOM_SAFE_READ_TOOLS.has(toolName)) && auth.relay_speaker !== "owner") return false;
4283
4290
  if (READ_ONLY_TOOLS.has(toolName)) return hasReadGrant(auth, toolName);
4284
4291
  if (toolName === "http_request") {
4285
4292
  return hasReadGrant(auth, toolName) || hasSideEffectGrant(auth, toolName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securecoms/agent-runtime",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "securecoms-agent": "dist/bin.js"