@siduri-x/core 1.0.3 → 1.0.4

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.
@@ -73,10 +73,17 @@ class ActionPolicyEngine {
73
73
  await this.recordAudit(action, undefined, decision, 'REJECTED');
74
74
  return { decision };
75
75
  }
76
- // Role check if tool restricts roles
76
+ // Role check if tool restricts roles (supports administrator/owner role parity)
77
77
  if (toolDef.allowedRoles && toolDef.allowedRoles.length > 0) {
78
78
  const actorRole = effectiveContext.actor.authorizationRole;
79
- if (!toolDef.allowedRoles.includes(actorRole)) {
79
+ const normalizedActorRoles = new Set([actorRole.toLowerCase()]);
80
+ if (actorRole === 'administrator' || actorRole === 'owner') {
81
+ normalizedActorRoles.add('administrator');
82
+ normalizedActorRoles.add('owner');
83
+ normalizedActorRoles.add('admin');
84
+ }
85
+ const isAuthorizedRole = toolDef.allowedRoles.some((r) => normalizedActorRoles.has(r.toLowerCase()));
86
+ if (!isAuthorizedRole) {
80
87
  const decision = {
81
88
  allowed: false,
82
89
  reason: `Actor role "${actorRole}" is not authorized to execute tool "${action.toolName}"`,
@@ -154,4 +154,41 @@ describe('ActionPolicyEngine Boundary', () => {
154
154
  expect(log?.parametersHash).toBeDefined();
155
155
  expect(log?.resultHash).toBeDefined();
156
156
  });
157
+ it('supports single-owner role parity between owner and administrator', async () => {
158
+ const ownerTool = {
159
+ name: 'builtin/owner_tool',
160
+ description: 'Owner only tool',
161
+ inputSchema: {},
162
+ riskLevel: 'LOW',
163
+ allowedRoles: ['owner'],
164
+ };
165
+ engine.registerToolDefinition(ownerTool);
166
+ // Context with authorizationRole: 'administrator'
167
+ const adminContext = {
168
+ ...sampleContext,
169
+ actor: {
170
+ ...sampleContext.actor,
171
+ authorizationRole: 'administrator',
172
+ },
173
+ };
174
+ const actionWithAdmin = {
175
+ actionId: 'act-owner-admin',
176
+ toolName: 'builtin/owner_tool',
177
+ parameters: {},
178
+ context: adminContext,
179
+ };
180
+ const res = await engine.evaluateAction(actionWithAdmin);
181
+ expect(res.decision.allowed).toBe(true);
182
+ expect(res.capability).toBeDefined();
183
+ // Context with authorizationRole: 'operator' (non-owner) is rejected
184
+ const operatorAction = {
185
+ actionId: 'act-owner-op',
186
+ toolName: 'builtin/owner_tool',
187
+ parameters: {},
188
+ context: sampleContext, // has authorizationRole: 'operator'
189
+ };
190
+ const resOp = await engine.evaluateAction(operatorAction);
191
+ expect(resOp.decision.allowed).toBe(false);
192
+ expect(resOp.decision.decisionCode).toBe('REJECTED_UNAUTHORIZED');
193
+ });
157
194
  });
@@ -31,7 +31,6 @@ export interface ChatResponsePlan {
31
31
  }
32
32
  export interface ChatResponseMetadata {
33
33
  language?: string;
34
- internal_monologue?: string;
35
34
  proposals?: Claim[];
36
35
  memory_proposals?: Array<{
37
36
  proposal_id: string;
@@ -20,10 +20,10 @@ async function dispatchCompanionChat(runtime, payload) {
20
20
  ? 'OWNER'
21
21
  : authRole === 'operator'
22
22
  ? 'OPERATOR'
23
- : 'VIEWER';
23
+ : (authRole === 'viewer' ? 'VIEWER' : 'OWNER');
24
24
  }
25
25
  else {
26
- roleOrContext = 'VIEWER';
26
+ roleOrContext = 'OWNER';
27
27
  }
28
28
  const runtimeResult = await runtime.handleUserMessage(userMessage, roleOrContext, history);
29
29
  // Normalize response plan
@@ -48,6 +48,8 @@ async function dispatchCompanionChat(runtime, payload) {
48
48
  const metadata = {
49
49
  ...(runtimeResult?.metadata || {}),
50
50
  };
51
+ delete metadata.internal_monologue;
52
+ delete metadata.internalMonologue;
51
53
  return {
52
54
  status: runtimeResult?.status || 'APPROVED',
53
55
  response_id: runtimeResult?.response_id,
package/dist/runtime.js CHANGED
@@ -390,7 +390,6 @@ class SiduriRuntime {
390
390
  },
391
391
  metadata: {
392
392
  language: plan.language,
393
- internal_monologue: plan.internalMonologue,
394
393
  proposals: createdMemoryProposals,
395
394
  memory_proposals: memoryProposalReceipts,
396
395
  action_results: actionResults,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siduri-x/core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Core runtime types, evidence protocol, action dispatcher, capability validation, and SiduriRuntime protocol",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {