osuite 2.9.0 → 2.9.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/osuite.js CHANGED
@@ -1,10 +1,505 @@
1
- export {
2
- default,
3
- DashClaw,
4
- OSuite,
5
- Osuite,
6
- ApprovalDeniedError,
7
- GuardBlockedError,
8
- PCAA_CHECKPOINTS,
9
- buildPcaaCheckpointStates,
10
- } from './dashclaw.js';
1
+ import { buildReviewSurface } from './reviewSurface.js';
2
+
3
+ class ApprovalDeniedError extends Error {
4
+ constructor(message, decision) {
5
+ super(message);
6
+ this.name = 'ApprovalDeniedError';
7
+ this.decision = decision;
8
+ }
9
+ }
10
+
11
+ class GuardBlockedError extends Error {
12
+ constructor(decision) {
13
+ super(decision?.reason || 'Action blocked by policy');
14
+ this.name = 'GuardBlockedError';
15
+ this.decision = decision;
16
+ }
17
+ }
18
+
19
+ class OSuite {
20
+ constructor({ baseUrl, apiKey, agentId, agentKeyId = null, provenanceVersion = 'osuite-prov-v1' } = {}) {
21
+ if (!baseUrl) throw new Error('baseUrl is required');
22
+ if (!apiKey) throw new Error('apiKey is required');
23
+ if (!agentId) throw new Error('agentId is required');
24
+
25
+ this.baseUrl = String(baseUrl).replace(/\/$/, '');
26
+ this.apiKey = apiKey;
27
+ this.agentId = agentId;
28
+ this.agentKeyId = agentKeyId;
29
+ this.provenanceVersion = provenanceVersion;
30
+ }
31
+
32
+ _withProvenance(payload = {}) {
33
+ const body = { ...payload };
34
+ const signature = body.agentSignature || body.agent_signature || body._signature || null;
35
+ delete body.agentSignature;
36
+ delete body.agent_signature;
37
+
38
+ if (signature) body._signature = signature;
39
+ if (body.agent_key_id === undefined && this.agentKeyId) body.agent_key_id = this.agentKeyId;
40
+ if (body.provenance_version === undefined && this.provenanceVersion) {
41
+ body.provenance_version = this.provenanceVersion;
42
+ }
43
+ return body;
44
+ }
45
+
46
+ async _request(path, method = 'GET', body = null, params = null) {
47
+ let url = `${this.baseUrl}${path}`;
48
+ if (params) {
49
+ const query = new URLSearchParams();
50
+ Object.entries(params).forEach(([key, value]) => {
51
+ if (value !== undefined && value !== null && value !== '') query.set(key, String(value));
52
+ });
53
+ const qs = query.toString();
54
+ if (qs) url += `?${qs}`;
55
+ }
56
+
57
+ const response = await fetch(url, {
58
+ method,
59
+ headers: {
60
+ 'content-type': 'application/json',
61
+ 'x-api-key': this.apiKey,
62
+ },
63
+ body: body ? JSON.stringify(body) : undefined,
64
+ });
65
+
66
+ const text = await response.text();
67
+ let data = {};
68
+ if (text) {
69
+ try {
70
+ data = JSON.parse(text);
71
+ } catch {
72
+ data = { raw: text };
73
+ }
74
+ }
75
+
76
+ if (!response.ok) {
77
+ if (response.status === 403 && data.decision?.decision === 'block') {
78
+ throw new GuardBlockedError(data.decision);
79
+ }
80
+ const error = new Error(data.reason || data.error || `Request failed with status ${response.status}`);
81
+ error.status = response.status;
82
+ error.details = data.details;
83
+ error.response = data;
84
+ throw error;
85
+ }
86
+
87
+ return data;
88
+ }
89
+
90
+ async guard(context = {}) {
91
+ return this._request('/api/guard', 'POST', this._withProvenance({
92
+ ...context,
93
+ agent_id: context.agent_id || this.agentId,
94
+ }));
95
+ }
96
+
97
+ async createAction(action = {}) {
98
+ return this._request('/api/actions', 'POST', this._withProvenance({
99
+ ...action,
100
+ agent_id: action.agent_id || this.agentId,
101
+ }));
102
+ }
103
+
104
+ async updateOutcome(actionId, outcome = {}) {
105
+ return this._request(`/api/actions/${encodeURIComponent(actionId)}`, 'PATCH', {
106
+ ...outcome,
107
+ timestamp_end: outcome.timestamp_end || new Date().toISOString(),
108
+ });
109
+ }
110
+
111
+ async getActions(filters = {}) {
112
+ return this._request('/api/actions', 'GET', null, filters);
113
+ }
114
+
115
+ async getAction(actionId) {
116
+ return this._request(`/api/actions/${encodeURIComponent(actionId)}`, 'GET');
117
+ }
118
+
119
+ async getPendingApprovals(limit = 20, offset = 0) {
120
+ return this.getActions({ status: 'pending_approval', limit, offset });
121
+ }
122
+
123
+ async approveAction(actionId, decision, reasoning = null) {
124
+ return this._request(`/api/approvals/${encodeURIComponent(actionId)}`, 'POST', {
125
+ decision,
126
+ ...(reasoning ? { reasoning } : {}),
127
+ });
128
+ }
129
+
130
+ async waitForApproval(actionId, { timeout = 300000, interval = 5000, print = true } = {}) {
131
+ const startedAt = Date.now();
132
+ let wasPending = false;
133
+ let printed = false;
134
+
135
+ while (Date.now() - startedAt < timeout) {
136
+ const payload = await this.getAction(actionId);
137
+ const action = payload.action || payload;
138
+
139
+ if (print && !printed) {
140
+ printed = true;
141
+ process.stdout.write(`\n${buildReviewSurface(action, { baseUrl: this.baseUrl })}\n\nWaiting for approval... Ctrl+C to abort.\n\n`);
142
+ }
143
+
144
+ if (action.status === 'pending_approval') wasPending = true;
145
+ if (action.approved_by || action.approved_at) return action;
146
+ if (action.status === 'failed' || action.status === 'cancelled') {
147
+ throw new ApprovalDeniedError(action.error_message || 'Operator denied the action.', action.status);
148
+ }
149
+ if (wasPending && action.status !== 'pending_approval') {
150
+ throw new Error(`Action ${actionId} left pending_approval without explicit approval metadata.`);
151
+ }
152
+ if (!wasPending && action.status === 'running') return action;
153
+
154
+ await new Promise((resolve) => setTimeout(resolve, interval));
155
+ }
156
+
157
+ throw new Error(`Timed out waiting for approval of action ${actionId}`);
158
+ }
159
+
160
+ async recordAssumption(assumption = {}) {
161
+ return this._request('/api/assumptions', 'POST', assumption);
162
+ }
163
+
164
+ async registerAssumption(assumption = {}) {
165
+ return this.recordAssumption({
166
+ agent_id: this.agentId,
167
+ ...assumption,
168
+ });
169
+ }
170
+
171
+ async getAssumption(assumptionId) {
172
+ return this._request(`/api/assumptions/${encodeURIComponent(assumptionId)}`);
173
+ }
174
+
175
+ async registerOpenLoop(actionId, loopType, description, metadata = null) {
176
+ const payload = typeof actionId === 'object'
177
+ ? { agent_id: this.agentId, ...actionId }
178
+ : { action_id: actionId, loop_type: loopType, description, metadata, agent_id: this.agentId };
179
+ return this._request('/api/actions/loops', 'POST', payload);
180
+ }
181
+
182
+ async getOpenLoops(filters = {}) {
183
+ return this._request('/api/actions/loops', 'GET', null, filters);
184
+ }
185
+
186
+ async resolveOpenLoop(loopId, status, resolution = null) {
187
+ return this._request(`/api/actions/loops/${encodeURIComponent(loopId)}`, 'PATCH', { status, resolution });
188
+ }
189
+
190
+ async getSignals() {
191
+ return this._request('/api/signals');
192
+ }
193
+
194
+ async reportTokenUsage(usage = {}) {
195
+ return this._request('/api/actions', 'POST', {
196
+ agent_id: this.agentId,
197
+ action_type: 'token_usage',
198
+ status: 'completed',
199
+ declared_goal: 'Report token usage',
200
+ ...usage,
201
+ });
202
+ }
203
+
204
+ async heartbeat(status = 'online', metadata = null) {
205
+ return this._request('/api/agents/heartbeat', 'POST', {
206
+ agent_id: this.agentId,
207
+ status,
208
+ metadata,
209
+ });
210
+ }
211
+
212
+ async reportConnections(connections = []) {
213
+ return this._request('/api/agents/connections', 'POST', {
214
+ agent_id: this.agentId,
215
+ connections,
216
+ });
217
+ }
218
+
219
+ async getActionTrace(actionId) {
220
+ return this._request(`/api/actions/${encodeURIComponent(actionId)}/trace`);
221
+ }
222
+
223
+ async getGovernanceProof({ actionId, format } = {}) {
224
+ return this._request('/api/governance/proof', 'GET', null, {
225
+ ...(actionId ? { action_id: actionId } : {}),
226
+ ...(format ? { format } : {}),
227
+ });
228
+ }
229
+
230
+ async getGovernanceProofBundle({ actionId } = {}) {
231
+ return this.getGovernanceProof({ actionId, format: 'bundle' });
232
+ }
233
+
234
+ async verifyGovernanceProof(actionId) {
235
+ return this._request('/api/governance/proof/verify', 'POST', { action_id: actionId });
236
+ }
237
+
238
+ async exportProof({ actionId, bundleId } = {}) {
239
+ return this._request('/api/proof/export', 'GET', null, {
240
+ ...(actionId ? { action_id: actionId } : {}),
241
+ ...(bundleId ? { bundle_id: bundleId } : {}),
242
+ });
243
+ }
244
+
245
+ async getComplianceEvidence(params = {}) {
246
+ return this._request('/api/compliance/evidence', 'GET', null, params);
247
+ }
248
+
249
+ async getPcaaHealth(params = {}) {
250
+ return this._request('/api/governance/proof', 'GET', null, {
251
+ view: 'pcaa_health',
252
+ ...params,
253
+ });
254
+ }
255
+
256
+ async getPcaaAction(actionId) {
257
+ return this._request(`/api/actions/${encodeURIComponent(actionId)}`, 'GET', null, {
258
+ view: 'pcaa',
259
+ });
260
+ }
261
+
262
+ async events({ signal } = {}) {
263
+ const response = await fetch(`${this.baseUrl}/api/stream`, {
264
+ headers: { 'x-api-key': this.apiKey },
265
+ signal,
266
+ });
267
+ if (!response.ok) throw new Error(`Event stream failed with status ${response.status}`);
268
+ return response;
269
+ }
270
+
271
+ async createScorer(name, scorer_type, config = null, description = null) {
272
+ return this._request('/api/evaluations/scorers', 'POST', { name, scorer_type, config, description });
273
+ }
274
+
275
+ async createScoringProfile(profile) {
276
+ return this._request('/api/scoring/profiles', 'POST', profile);
277
+ }
278
+
279
+ async listScoringProfiles(filters = {}) {
280
+ return this._request('/api/scoring/profiles', 'GET', null, filters);
281
+ }
282
+
283
+ async getScoringProfile(profileId) {
284
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}`);
285
+ }
286
+
287
+ async updateScoringProfile(profileId, updates) {
288
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}`, 'PATCH', updates);
289
+ }
290
+
291
+ async deleteScoringProfile(profileId) {
292
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}`, 'DELETE');
293
+ }
294
+
295
+ async addScoringDimension(profileId, dimension) {
296
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}/dimensions`, 'POST', dimension);
297
+ }
298
+
299
+ async updateScoringDimension(profileId, dimensionId, updates) {
300
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}/dimensions/${encodeURIComponent(dimensionId)}`, 'PATCH', updates);
301
+ }
302
+
303
+ async deleteScoringDimension(profileId, dimensionId) {
304
+ return this._request(`/api/scoring/profiles/${encodeURIComponent(profileId)}/dimensions/${encodeURIComponent(dimensionId)}`, 'DELETE');
305
+ }
306
+
307
+ async scoreWithProfile(profileId, action) {
308
+ return this._request('/api/scoring/score', 'POST', { profile_id: profileId, action });
309
+ }
310
+
311
+ async batchScoreWithProfile(profileId, actions) {
312
+ return this._request('/api/scoring/score', 'POST', { profile_id: profileId, actions });
313
+ }
314
+
315
+ async getProfileScores(filters = {}) {
316
+ return this._request('/api/scoring/score', 'GET', null, filters);
317
+ }
318
+
319
+ async getProfileScoreStats(profileId) {
320
+ return this._request('/api/scoring/score', 'GET', null, { profile_id: profileId, view: 'stats' });
321
+ }
322
+
323
+ async createRiskTemplate(template) {
324
+ return this._request('/api/scoring/risk-templates', 'POST', template);
325
+ }
326
+
327
+ async listRiskTemplates(filters = {}) {
328
+ return this._request('/api/scoring/risk-templates', 'GET', null, filters);
329
+ }
330
+
331
+ async updateRiskTemplate(templateId, updates) {
332
+ return this._request(`/api/scoring/risk-templates/${encodeURIComponent(templateId)}`, 'PATCH', updates);
333
+ }
334
+
335
+ async deleteRiskTemplate(templateId) {
336
+ return this._request(`/api/scoring/risk-templates/${encodeURIComponent(templateId)}`, 'DELETE');
337
+ }
338
+
339
+ async autoCalibrate(options = {}) {
340
+ return this._request('/api/scoring/calibrate', 'POST', options);
341
+ }
342
+
343
+ async sendMessage({ to, type, subject, body, threadId, urgent, actionId }) {
344
+ return this._request('/api/messages', 'POST', {
345
+ from_agent_id: this.agentId,
346
+ to_agent_id: to,
347
+ message_type: type,
348
+ subject,
349
+ body,
350
+ thread_id: threadId,
351
+ urgent,
352
+ action_id: actionId,
353
+ });
354
+ }
355
+
356
+ async getInbox({ type, unread, limit } = {}) {
357
+ return this._request('/api/messages', 'GET', null, {
358
+ agent_id: this.agentId,
359
+ direction: 'inbox',
360
+ ...(type ? { type } : {}),
361
+ ...(unread != null ? { unread } : {}),
362
+ ...(limit ? { limit } : {}),
363
+ });
364
+ }
365
+
366
+ async createHandoff(handoff) {
367
+ return this._request('/api/_archive/handoffs', 'POST', { agent_id: this.agentId, ...handoff });
368
+ }
369
+
370
+ async getHandoffs(filters = {}) {
371
+ return this._request('/api/_archive/handoffs', 'GET', null, {
372
+ agent_id: this.agentId,
373
+ ...filters,
374
+ });
375
+ }
376
+
377
+ async getLatestHandoff() {
378
+ return this._request('/api/_archive/handoffs', 'GET', null, { agent_id: this.agentId, latest: 'true' });
379
+ }
380
+
381
+ async scanPromptInjection(text, { source } = {}) {
382
+ return this._request('/api/security/prompt-injection', 'POST', { text, source, agent_id: this.agentId });
383
+ }
384
+
385
+ async scanContent(text, destination = null) {
386
+ return this._request('/api/security/scan', 'POST', {
387
+ text,
388
+ destination,
389
+ agent_id: this.agentId,
390
+ store: false,
391
+ });
392
+ }
393
+
394
+ async submitFeedback({ action_id, rating, comment, category, tags, metadata }) {
395
+ return this._request('/api/feedback', 'POST', {
396
+ action_id,
397
+ agent_id: this.agentId,
398
+ rating,
399
+ comment,
400
+ category,
401
+ tags,
402
+ metadata,
403
+ });
404
+ }
405
+
406
+ async createThread(thread) {
407
+ return this._request('/api/messages/threads', 'POST', {
408
+ created_by: this.agentId,
409
+ participants: [this.agentId],
410
+ ...thread,
411
+ });
412
+ }
413
+
414
+ async getThreads(filters = {}) {
415
+ return this._request('/api/messages/threads', 'GET', null, {
416
+ agent_id: this.agentId,
417
+ ...filters,
418
+ });
419
+ }
420
+
421
+ async addThreadEntry(threadId, content, entryType) {
422
+ return this._request(`/api/context/threads/${encodeURIComponent(threadId)}/entries`, 'POST', {
423
+ content,
424
+ entry_type: entryType,
425
+ });
426
+ }
427
+
428
+ async closeThread(threadId, summary) {
429
+ return this._request('/api/messages/threads', 'PATCH', {
430
+ thread_id: threadId,
431
+ status: 'resolved',
432
+ ...(summary ? { summary } : {}),
433
+ });
434
+ }
435
+
436
+ async saveSnippet(snippet = {}) {
437
+ return this._request('/api/_archive/snippets', 'POST', {
438
+ agent_id: this.agentId,
439
+ ...snippet,
440
+ });
441
+ }
442
+
443
+ async getSnippet(snippetId) {
444
+ return this._request(`/api/_archive/snippets/${encodeURIComponent(snippetId)}`);
445
+ }
446
+
447
+ async setPreference(preference = {}) {
448
+ return this._request('/api/_archive/preferences', 'POST', {
449
+ type: 'preference',
450
+ agent_id: this.agentId,
451
+ ...preference,
452
+ });
453
+ }
454
+
455
+ async getPreferenceSummary() {
456
+ return this._request('/api/_archive/preferences', 'GET', null, {
457
+ type: 'summary',
458
+ agent_id: this.agentId,
459
+ });
460
+ }
461
+
462
+ async getDailyDigest(date = null) {
463
+ return this._request('/api/_archive/digest', 'GET', null, {
464
+ agent_id: this.agentId,
465
+ ...(date ? { date } : {}),
466
+ });
467
+ }
468
+
469
+ async getSentMessages({ type, threadId, limit } = {}) {
470
+ return this._request('/api/messages', 'GET', null, {
471
+ agent_id: this.agentId,
472
+ direction: 'sent',
473
+ ...(type ? { type } : {}),
474
+ ...(threadId ? { thread_id: threadId } : {}),
475
+ ...(limit ? { limit } : {}),
476
+ });
477
+ }
478
+
479
+ async getWebhooks() {
480
+ return this._request('/api/webhooks');
481
+ }
482
+
483
+ async syncState(state) {
484
+ return this._request('/api/sync', 'POST', { agent_id: this.agentId, ...state });
485
+ }
486
+
487
+ actionContext(actionId) {
488
+ return {
489
+ sendMessage: (message) => this.sendMessage({ ...message, actionId }),
490
+ recordAssumption: (assumption) => this.recordAssumption({ ...assumption, action_id: actionId }),
491
+ updateOutcome: (outcome) => this.updateOutcome(actionId, outcome),
492
+ };
493
+ }
494
+
495
+ renderReview(action, options = {}) {
496
+ return buildReviewSurface(action, { baseUrl: this.baseUrl, ...options });
497
+ }
498
+ }
499
+
500
+ const DashClaw = OSuite;
501
+ const Osuite = OSuite;
502
+ const OpenClawAgent = OSuite;
503
+
504
+ export default OSuite;
505
+ export { ApprovalDeniedError, DashClaw, GuardBlockedError, OSuite, Osuite, OpenClawAgent, buildReviewSurface };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "osuite",
3
- "version": "2.9.0",
4
- "description": "OSuite governance runtime for AI agents. Intercept, govern, and verify agent actions.",
3
+ "version": "2.9.1",
4
+ "description": "OSuite governed action SDK for AI agents. Approve, replay, prove, and verify runtime decisions.",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "files": [
25
25
  "cli.js",
26
+ "reviewSurface.js",
26
27
  "osuite.js",
27
- "dashclaw.js",
28
28
  "index.cjs",
29
29
  "LICENSE",
30
30
  "README.md",
@@ -35,16 +35,10 @@
35
35
  "decision-infrastructure",
36
36
  "agent-governance",
37
37
  "guardrails",
38
- "dashclaw",
39
38
  "osuite"
40
39
  ],
41
40
  "author": "OSuite",
42
41
  "license": "MIT",
43
- "repository": {
44
- "type": "git",
45
- "url": "git+https://github.com/ucsandman/DashClaw.git",
46
- "directory": "sdk"
47
- },
48
42
  "engines": {
49
43
  "node": ">=18.0.0"
50
44
  },
@@ -0,0 +1,131 @@
1
+ const RESET = '\x1b[0m';
2
+ const BOLD = '\x1b[1m';
3
+ const DIM = '\x1b[2m';
4
+ const GREEN = '\x1b[32m';
5
+ const YELLOW = '\x1b[33m';
6
+ const RED = '\x1b[31m';
7
+ const CYAN = '\x1b[36m';
8
+
9
+ function colorize(value, color, enabled) {
10
+ return enabled ? `${color}${value}${RESET}` : value;
11
+ }
12
+
13
+ function asArray(value) {
14
+ return Array.isArray(value) ? value : [];
15
+ }
16
+
17
+ function getActionId(action = {}) {
18
+ return action.action_id || action.id || action.actionId || 'unknown-action';
19
+ }
20
+
21
+ function getScore(action = {}) {
22
+ const summary = action.decision_summary || action.scorecard || action.risk_presentation || {};
23
+ return summary.policyScore ?? summary.rawScore ?? action.risk_score ?? action.agent_risk_score ?? null;
24
+ }
25
+
26
+ function getGrade(score) {
27
+ if (score == null || Number.isNaN(Number(score))) return 'Unscored';
28
+ const numeric = Number(score);
29
+ if (numeric >= 85) return 'Critical';
30
+ if (numeric >= 70) return 'High';
31
+ if (numeric >= 45) return 'Moderate';
32
+ return 'Low';
33
+ }
34
+
35
+ function getGradeColor(grade) {
36
+ if (grade === 'Critical' || grade === 'High') return RED;
37
+ if (grade === 'Moderate') return YELLOW;
38
+ return GREEN;
39
+ }
40
+
41
+ function line(label, value) {
42
+ if (value == null || value === '') return null;
43
+ return `${label.padEnd(21)} ${value}`;
44
+ }
45
+
46
+ function normalizeDecisionSummary(action = {}) {
47
+ const summary = action.decision_summary || action.scorecard || action.risk_presentation || {};
48
+ const understood = summary.understoodAction || summary.understood_action || {};
49
+ const evidence = summary.evidenceConfidence || summary.evidence_confidence || {};
50
+ const control = summary.controlSummary || summary.control_summary || {};
51
+ const dimensions = summary.dimensions || summary.scoreDimensions || summary.score_dimensions || [];
52
+
53
+ return {
54
+ understood,
55
+ evidence,
56
+ control,
57
+ dimensions: asArray(dimensions),
58
+ missingEvidence: asArray(summary.missingEvidence || summary.missing_evidence),
59
+ };
60
+ }
61
+
62
+ export function buildReviewSurface(action = {}, options = {}) {
63
+ const color = options.color ?? !process.env.NO_COLOR;
64
+ const score = getScore(action);
65
+ const grade = action.decision_grade || action.grade || getGrade(score);
66
+ const gradeColor = getGradeColor(grade);
67
+ const summary = normalizeDecisionSummary(action);
68
+ const actionId = getActionId(action);
69
+ const title = `OSuite Decision Review`;
70
+ const scoreText = score == null ? 'not scored' : `${Math.round(Number(score))}/100`;
71
+ const understoodSummary = summary.understood.summary
72
+ || summary.understood.label
73
+ || action.declared_goal
74
+ || action.action_type
75
+ || 'No action summary was provided.';
76
+ const evidenceLabel = summary.evidence.label
77
+ || (summary.evidence.score != null ? `${summary.evidence.score}/100` : null)
78
+ || 'Evidence confidence not provided';
79
+ const controlLabel = summary.control.label
80
+ || summary.control.summary
81
+ || action.effective_decision
82
+ || action.status
83
+ || 'No control posture provided';
84
+
85
+ const rows = [
86
+ line('Action ID', actionId),
87
+ line('Agent', action.agent_name || action.agent_id),
88
+ line('Action type', action.action_type),
89
+ line('Decision', action.effective_decision || action.decision || action.status),
90
+ line('Score', `${scoreText} (${colorize(grade, gradeColor, color)})`),
91
+ line('OSuite understood', understoodSummary),
92
+ line('Evidence confidence', evidenceLabel),
93
+ line('Control posture', controlLabel),
94
+ ].filter(Boolean);
95
+
96
+ const dimensionLines = summary.dimensions.length
97
+ ? [
98
+ '',
99
+ colorize('Score dimensions', BOLD, color),
100
+ ...summary.dimensions.map((dimension) => {
101
+ const label = dimension.label || dimension.id || 'dimension';
102
+ const value = dimension.score ?? dimension.value ?? '-';
103
+ const reason = dimension.summary || dimension.reason || '';
104
+ return ` ${label.padEnd(18)} ${String(value).padStart(3)}${reason ? ` ${colorize(reason, DIM, color)}` : ''}`;
105
+ }),
106
+ ]
107
+ : [];
108
+
109
+ const missingEvidenceLines = summary.missingEvidence.length
110
+ ? [
111
+ '',
112
+ colorize('Missing evidence', BOLD, color),
113
+ ...summary.missingEvidence.map((item) => ` - ${item.label || item.id || item}`),
114
+ ]
115
+ : [];
116
+
117
+ const replayUrl = options.baseUrl ? `${String(options.baseUrl).replace(/\/$/, '')}/replay/${actionId}` : null;
118
+ const footer = replayUrl ? ['', `${colorize('Replay', BOLD, color)} ${replayUrl}`] : [];
119
+
120
+ return [
121
+ colorize(title, `${BOLD}${CYAN}`, color),
122
+ colorize('Route. Review. Prove.', DIM, color),
123
+ '',
124
+ ...rows,
125
+ ...dimensionLines,
126
+ ...missingEvidenceLines,
127
+ ...footer,
128
+ ].join('\n');
129
+ }
130
+
131
+ export default buildReviewSurface;
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Osuite
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.