osuite 2.9.5 → 2.9.7
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/README.md +34 -1
- package/cli.js +285 -1
- package/osuite.js +14 -0
- package/package.json +1 -1
- package/reviewSurface.js +20 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# OSuite SDK (v2.9.
|
|
1
|
+
# OSuite SDK (v2.9.7)
|
|
2
2
|
|
|
3
3
|
**Governed action SDK for AI agents.**
|
|
4
4
|
|
|
@@ -128,6 +128,39 @@ The v2 SDK exposes the core governance loop plus first-class PCAA, replay, proof
|
|
|
128
128
|
- `events()` -- Subscribe to live approval and governance events over SSE.
|
|
129
129
|
- `PCAA_CHECKPOINTS` / `buildPcaaCheckpointStates(...)` -- Reuse the portable checkpoint contract in your own tooling.
|
|
130
130
|
|
|
131
|
+
### External Verifier Network
|
|
132
|
+
- `getExternalVerifierConfig()` -- Read provider-neutral external verifier status, configured providers, usage, and copy-paste setup commands.
|
|
133
|
+
- `configureExternalVerifier(config)` -- Configure a verifier provider such as Baby Blue / invinoveritas from SDK code or an agent-run terminal task.
|
|
134
|
+
- `disableExternalVerifier(providerId)` -- Disable one verifier provider without deleting OSuite proof or billing history.
|
|
135
|
+
|
|
136
|
+
CLI setup:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
osuite external status
|
|
140
|
+
osuite external configure \
|
|
141
|
+
--provider babyblue_invinoveritas \
|
|
142
|
+
--mode shadow \
|
|
143
|
+
--account-model customer_managed \
|
|
144
|
+
--api-key "$BABYBLUE_IVV_BEARER" \
|
|
145
|
+
--account-id "$BABYBLUE_IVV_AGENT_ID"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
SDK setup:
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
await osuite.configureExternalVerifier({
|
|
152
|
+
enabled: true,
|
|
153
|
+
providers: [{
|
|
154
|
+
provider_id: 'babyblue_invinoveritas',
|
|
155
|
+
enabled: true,
|
|
156
|
+
mode: 'shadow',
|
|
157
|
+
account_model: 'customer_managed',
|
|
158
|
+
api_key: process.env.BABYBLUE_IVV_BEARER,
|
|
159
|
+
account_id: process.env.BABYBLUE_IVV_AGENT_ID,
|
|
160
|
+
}],
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
131
164
|
### External Governor Receipts
|
|
132
165
|
- `governance_stage_receipts` -- Preserve runtime-stage decisions such as `pre_input`, `pre_tool`, `post_tool`, and `pre_output`.
|
|
133
166
|
- `approval_receipts` -- Preserve human approval workflow receipts alongside legacy approval fields.
|
package/cli.js
CHANGED
|
@@ -25,6 +25,16 @@ const PROTECTED_REFS = new Set(['main', 'master', 'prod', 'production', 'stable'
|
|
|
25
25
|
const OBSERVE_OPS = new Set(['get', 'describe', 'logs', 'top', 'version', 'diff']);
|
|
26
26
|
const PLAN_OPS = new Set(['plan', 'show', 'validate', 'output', 'fmt', 'providers', 'graph']);
|
|
27
27
|
const MUTATION_OPS = new Set(['apply', 'destroy', 'delete', 'create', 'replace', 'taint', 'untaint', 'import', 'upgrade', 'rollback', 'install', 'uninstall']);
|
|
28
|
+
const GIT_OBSERVATION_RISKS = {
|
|
29
|
+
status: 10,
|
|
30
|
+
log: 10,
|
|
31
|
+
branch: 10,
|
|
32
|
+
show: 12,
|
|
33
|
+
remote: 14,
|
|
34
|
+
diff: 18,
|
|
35
|
+
};
|
|
36
|
+
const PUBLIC_FILE_HOST_HINTS = ['transfer.sh', 'file.io', 'tmpfiles.org', '0x0.st', 'ufile.io', 'gofile.io', 'wetransfer.com'];
|
|
37
|
+
const SECURITY_CONTROL_WEAKENING_RE = /(\bspctl\b[\s\S]*(--master-disable|--global-disable|--disable)|\bcsrutil\b[\s\S]*\bdisable\b|Set-MpPreference[\s\S]*Disable(?:RealtimeMonitoring|BehaviorMonitoring|IOAVProtection)[\s\S]*(true|\$true|1)|netsh\s+advfirewall\s+set\s+allprofiles\s+state\s+off|\bsystemctl\b[\s\S]*\b(stop|disable|mask)\b[\s\S]*(auditd|falcon|crowdstrike|osquery|defender|mdatp|sentinel|carbonblack|firewalld|ufw)|\bufw\b[\s\S]*\bdisable\b)/i;
|
|
28
38
|
const DEFAULT_BASE_URL = 'https://studio.osuite.ai';
|
|
29
39
|
const PROJECT_BOOTSTRAPS = {
|
|
30
40
|
codex: {
|
|
@@ -169,6 +179,31 @@ function defaultAgentIdForRuntime(runtime) {
|
|
|
169
179
|
return 'sdk-runtime';
|
|
170
180
|
}
|
|
171
181
|
|
|
182
|
+
function sanitizeConfiguredAgentId(runtime, agentId) {
|
|
183
|
+
const value = String(agentId || '').trim();
|
|
184
|
+
if (!value) return '';
|
|
185
|
+
const knownDefaults = {
|
|
186
|
+
codex: 'codex-runtime',
|
|
187
|
+
claude: 'claude-code-runtime',
|
|
188
|
+
mcp: 'mcp-runtime',
|
|
189
|
+
sdk: 'sdk-runtime',
|
|
190
|
+
};
|
|
191
|
+
const foreignDefault = Object.entries(knownDefaults).some(([otherRuntime, defaultId]) => (
|
|
192
|
+
otherRuntime !== runtime && value === defaultId
|
|
193
|
+
));
|
|
194
|
+
return foreignDefault ? '' : value;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function runtimeMatchesConfiguredAdapter(runtime, adapterId) {
|
|
198
|
+
const adapter = String(adapterId || '').trim().toLowerCase();
|
|
199
|
+
if (!adapter) return false;
|
|
200
|
+
if (runtime === 'codex') return adapter === 'codex_hooks';
|
|
201
|
+
if (runtime === 'claude') return adapter === 'claude_code_hooks' || adapter === 'claude_hooks';
|
|
202
|
+
if (runtime === 'mcp') return adapter.includes('mcp');
|
|
203
|
+
if (runtime === 'sdk') return ['sdk', 'framework_sdk', 'inline_sdk'].includes(adapter);
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
|
|
172
207
|
function envPathForRuntime(runtime) {
|
|
173
208
|
if (runtime === 'codex') return '.codex/.env';
|
|
174
209
|
if (runtime === 'claude') return '.claude/.env';
|
|
@@ -371,6 +406,8 @@ function printHelp() {
|
|
|
371
406
|
write(' osuite review <actionId> Render the decision review card');
|
|
372
407
|
write(' osuite approve <actionId> --reason "Looks safe"');
|
|
373
408
|
write(' osuite deny <actionId> --reason "Outside change window"');
|
|
409
|
+
write(' osuite external status Show external verifier network setup and usage');
|
|
410
|
+
write(' osuite external configure --provider babyblue_invinoveritas --mode shadow --api-key <key>');
|
|
374
411
|
write(' osuite connect [auto|codex|claude|sdk|mcp] Detect runtime and start browser handoff');
|
|
375
412
|
write(' osuite init [sdk|codex|claude|mcp] Print setup steps for a runtime lane');
|
|
376
413
|
write('');
|
|
@@ -395,6 +432,28 @@ function protectedGitTarget(tokens) {
|
|
|
395
432
|
return null;
|
|
396
433
|
}
|
|
397
434
|
|
|
435
|
+
function hostFromCommand(command) {
|
|
436
|
+
const match = String(command || '').match(/https?:\/\/([^/\s"'<>]+)/i);
|
|
437
|
+
return match ? match[1].toLowerCase() : null;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function hasPublicFileHost(command) {
|
|
441
|
+
const normalized = String(command || '').toLowerCase();
|
|
442
|
+
return PUBLIC_FILE_HOST_HINTS.some((hint) => normalized.includes(hint));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function semanticPattern(id, label, severity, detail) {
|
|
446
|
+
return { id, label, severity, detail };
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function scoreBreakdown(components, formula = 'local CAVA preview rubric') {
|
|
450
|
+
return {
|
|
451
|
+
model_version: 'osuite.decision_score.v2.1',
|
|
452
|
+
formula,
|
|
453
|
+
components,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
398
457
|
function classifyCommand(command) {
|
|
399
458
|
const tokens = tokenize(command);
|
|
400
459
|
const executable = tokens[0] || '';
|
|
@@ -404,6 +463,72 @@ function classifyCommand(command) {
|
|
|
404
463
|
return { category: 'unknown', operation: 'unknown', risk: 20, reversible: true, summary: 'No command provided.' };
|
|
405
464
|
}
|
|
406
465
|
|
|
466
|
+
if (SECURITY_CONTROL_WEAKENING_RE.test(command)) {
|
|
467
|
+
return {
|
|
468
|
+
category: 'policy_degradation',
|
|
469
|
+
operation: executable === 'sudo' ? (tokens[1] || 'security_control_change') : executable,
|
|
470
|
+
risk: 95,
|
|
471
|
+
reversible: false,
|
|
472
|
+
systems: ['security_posture'],
|
|
473
|
+
summary: 'Security-control weakening command. CAVA treats this as a posture degradation pattern, not a generic shell action.',
|
|
474
|
+
notes: ['block by default', 'requires security-owner review before retry'],
|
|
475
|
+
patterns: [
|
|
476
|
+
semanticPattern('security_control_weakening', 'Security-control weakening', 'critical', 'Disables or weakens endpoint, firewall, audit, EDR, or OS runtime protection.'),
|
|
477
|
+
],
|
|
478
|
+
breakdown: scoreBreakdown([
|
|
479
|
+
{ id: 'base_action', label: 'Base action', value: 65, detail: 'Security posture change baseline.', direction: 'base' },
|
|
480
|
+
{ id: 'cava_pattern_security_control_weakening', label: 'CAVA pattern', value: 30, detail: 'Security-control weakening raises the local preview to block-level risk.', direction: 'increase' },
|
|
481
|
+
]),
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
if (['curl', 'wget'].includes(executable) || (executable === 'sudo' && ['curl', 'wget'].includes(tokens[1]))) {
|
|
486
|
+
const host = hostFromCommand(command);
|
|
487
|
+
const publicHost = hasPublicFileHost(command);
|
|
488
|
+
const uploadLike = /\s(-F|--form|-T|--upload-file|--post-file)\b|upload|share/i.test(command);
|
|
489
|
+
const risk = publicHost && uploadLike ? 86 : 62;
|
|
490
|
+
const patterns = [
|
|
491
|
+
...(publicHost && uploadLike ? [
|
|
492
|
+
semanticPattern('hidden_externality', 'Hidden externality', 'high', 'The command creates an external side effect that is stronger than a normal local task.'),
|
|
493
|
+
semanticPattern('public_persistent_egress', 'Public persistent egress', 'critical', 'Data is being uploaded to a public or link-accessible file host.'),
|
|
494
|
+
] : []),
|
|
495
|
+
];
|
|
496
|
+
return {
|
|
497
|
+
category: 'network_egress',
|
|
498
|
+
operation: executable === 'sudo' ? tokens[1] : executable,
|
|
499
|
+
risk,
|
|
500
|
+
reversible: false,
|
|
501
|
+
systems: ['network', host || 'external_endpoint'],
|
|
502
|
+
summary: publicHost
|
|
503
|
+
? `Network egress to public file host ${host || 'unknown host'}.`
|
|
504
|
+
: `Network egress to ${host || 'external endpoint'}.`,
|
|
505
|
+
notes: publicHost ? ['public link or file host', 'approval or block depends on policy profile'] : ['external network boundary'],
|
|
506
|
+
patterns,
|
|
507
|
+
breakdown: scoreBreakdown([
|
|
508
|
+
{ id: 'base_action', label: 'Base action', value: 45, detail: 'Network egress baseline.', direction: 'base' },
|
|
509
|
+
...(publicHost ? [{ id: 'public_destination', label: 'Public destination', value: 23, detail: 'Public file/link destination detected.', direction: 'increase' }] : []),
|
|
510
|
+
...(uploadLike ? [{ id: 'external_write', label: 'External write', value: 18, detail: 'Upload or form-post semantics detected.', direction: 'increase' }] : []),
|
|
511
|
+
]),
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (executable === 'git' && Object.hasOwn(GIT_OBSERVATION_RISKS, operation)) {
|
|
516
|
+
const risk = GIT_OBSERVATION_RISKS[operation];
|
|
517
|
+
return {
|
|
518
|
+
category: 'observation',
|
|
519
|
+
operation,
|
|
520
|
+
risk,
|
|
521
|
+
reversible: true,
|
|
522
|
+
systems: ['git'],
|
|
523
|
+
summary: `Git ${operation} read-only workspace observation.`,
|
|
524
|
+
notes: ['read-only CAVA operation', 'usually does not require approval'],
|
|
525
|
+
breakdown: scoreBreakdown([
|
|
526
|
+
{ id: 'base_action', label: 'Base action', value: risk, detail: `git ${operation} read-only observation baseline.`, direction: 'base' },
|
|
527
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as read-only/reversible git observation.', direction: 'evidence' },
|
|
528
|
+
]),
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
|
|
407
532
|
if (executable === 'git' && operation === 'push') {
|
|
408
533
|
const protectedTarget = protectedGitTarget(tokens);
|
|
409
534
|
const target = protectedTarget || tokens.filter((token) => !token.startsWith('-')).at(-1) || 'remote';
|
|
@@ -417,6 +542,11 @@ function classifyCommand(command) {
|
|
|
417
542
|
? `Git push to protected target ${protectedTarget}.`
|
|
418
543
|
: `Git push to ${target}.`,
|
|
419
544
|
notes: protectedTarget ? ['protected target', 'approval recommended before side effects'] : ['feature branch target'],
|
|
545
|
+
breakdown: scoreBreakdown([
|
|
546
|
+
{ id: 'base_action', label: 'Base action', value: protectedTarget ? 80 : 62, detail: protectedTarget ? 'Protected git push baseline.' : 'Remote git push baseline.', direction: 'base' },
|
|
547
|
+
...(protectedTarget ? [{ id: 'protected_target', label: 'Protected target', value: 2, detail: `Target ${protectedTarget} raises review posture.`, direction: 'increase' }] : []),
|
|
548
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as state-changing deployment.', direction: 'evidence' },
|
|
549
|
+
]),
|
|
420
550
|
};
|
|
421
551
|
}
|
|
422
552
|
|
|
@@ -429,6 +559,10 @@ function classifyCommand(command) {
|
|
|
429
559
|
systems: ['local_workspace'],
|
|
430
560
|
summary: 'Local build or compilation step.',
|
|
431
561
|
notes: ['usually does not require approval unless chained with deployment'],
|
|
562
|
+
breakdown: scoreBreakdown([
|
|
563
|
+
{ id: 'base_action', label: 'Base action', value: 30, detail: 'Local build baseline.', direction: 'base' },
|
|
564
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as reversible local build.', direction: 'evidence' },
|
|
565
|
+
]),
|
|
432
566
|
};
|
|
433
567
|
}
|
|
434
568
|
|
|
@@ -443,6 +577,10 @@ function classifyCommand(command) {
|
|
|
443
577
|
systems: [executable],
|
|
444
578
|
summary: `${executable} observation command.`,
|
|
445
579
|
notes: ['read-oriented runtime action'],
|
|
580
|
+
breakdown: scoreBreakdown([
|
|
581
|
+
{ id: 'base_action', label: 'Base action', value: 28, detail: `${executable} read-oriented operation baseline.`, direction: 'base' },
|
|
582
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as observation.', direction: 'evidence' },
|
|
583
|
+
]),
|
|
446
584
|
};
|
|
447
585
|
}
|
|
448
586
|
if (PLAN_OPS.has(op)) {
|
|
@@ -454,6 +592,10 @@ function classifyCommand(command) {
|
|
|
454
592
|
systems: [executable],
|
|
455
593
|
summary: `${executable} planning command.`,
|
|
456
594
|
notes: ['plan evidence can improve approval confidence'],
|
|
595
|
+
breakdown: scoreBreakdown([
|
|
596
|
+
{ id: 'base_action', label: 'Base action', value: 38, detail: `${executable} planning baseline.`, direction: 'base' },
|
|
597
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as reversible plan/preflight evidence.', direction: 'evidence' },
|
|
598
|
+
]),
|
|
457
599
|
};
|
|
458
600
|
}
|
|
459
601
|
if (MUTATION_OPS.has(op)) {
|
|
@@ -465,6 +607,10 @@ function classifyCommand(command) {
|
|
|
465
607
|
systems: [executable],
|
|
466
608
|
summary: `${executable} infrastructure mutation.`,
|
|
467
609
|
notes: ['approval recommended', 'capture plan/output as evidence'],
|
|
610
|
+
breakdown: scoreBreakdown([
|
|
611
|
+
{ id: 'base_action', label: 'Base action', value: op === 'apply' || op === 'destroy' ? 90 : 78, detail: `${executable} mutation baseline.`, direction: 'base' },
|
|
612
|
+
{ id: 'cava_operation', label: 'CAVA operation', value: 0, detail: 'Parsed as state-changing infrastructure action.', direction: 'evidence' },
|
|
613
|
+
]),
|
|
468
614
|
};
|
|
469
615
|
}
|
|
470
616
|
}
|
|
@@ -478,6 +624,10 @@ function classifyCommand(command) {
|
|
|
478
624
|
systems: ['azure_key_vault'],
|
|
479
625
|
summary: 'Azure Key Vault secret access.',
|
|
480
626
|
notes: ['sensitive read', 'approval may be required by policy'],
|
|
627
|
+
breakdown: scoreBreakdown([
|
|
628
|
+
{ id: 'base_action', label: 'Base action', value: 74, detail: 'Secret access baseline.', direction: 'base' },
|
|
629
|
+
{ id: 'secret_data', label: 'Secret/data signal', value: 0, detail: 'Key Vault secret operation detected.', direction: 'evidence' },
|
|
630
|
+
]),
|
|
481
631
|
};
|
|
482
632
|
}
|
|
483
633
|
|
|
@@ -490,6 +640,10 @@ function classifyCommand(command) {
|
|
|
490
640
|
systems: ['workspace'],
|
|
491
641
|
summary: 'Potentially destructive operation.',
|
|
492
642
|
notes: ['approval strongly recommended'],
|
|
643
|
+
breakdown: scoreBreakdown([
|
|
644
|
+
{ id: 'base_action', label: 'Base action', value: 72, detail: 'Unknown destructive shell baseline.', direction: 'base' },
|
|
645
|
+
{ id: 'destructive_text', label: 'Destructive intent', value: 20, detail: 'Command text matched destructive patterns.', direction: 'increase' },
|
|
646
|
+
]),
|
|
493
647
|
};
|
|
494
648
|
}
|
|
495
649
|
|
|
@@ -501,6 +655,10 @@ function classifyCommand(command) {
|
|
|
501
655
|
systems: ['shell'],
|
|
502
656
|
summary: 'General shell command. OSuite will use runtime context and policy to decide.',
|
|
503
657
|
notes: ['provide declared_goal and evidence for better scoring'],
|
|
658
|
+
breakdown: scoreBreakdown([
|
|
659
|
+
{ id: 'base_action', label: 'Base action', value: 20, detail: 'Generic shell baseline.', direction: 'base' },
|
|
660
|
+
{ id: 'moderate_system', label: 'System boundary', value: 25, detail: 'Unknown shell command lacks CAVA-specific parser evidence.', direction: 'increase' },
|
|
661
|
+
]),
|
|
504
662
|
};
|
|
505
663
|
}
|
|
506
664
|
|
|
@@ -530,6 +688,23 @@ function printExplanation(command) {
|
|
|
530
688
|
write(c('Decision hints', ANSI.bold));
|
|
531
689
|
result.notes.forEach((note) => write(` - ${note}`));
|
|
532
690
|
}
|
|
691
|
+
if (result.breakdown?.components?.length) {
|
|
692
|
+
write('');
|
|
693
|
+
write(c('Score breakdown', ANSI.bold));
|
|
694
|
+
write(` Model ${result.breakdown.model_version}`);
|
|
695
|
+
result.breakdown.components.forEach((component) => {
|
|
696
|
+
const value = component.value ?? component.score ?? '-';
|
|
697
|
+
const sign = typeof value === 'number' && value > 0 && component.direction !== 'base' ? `+${value}` : String(value);
|
|
698
|
+
write(` ${(component.label || component.id).padEnd(18)} ${String(sign).padStart(4)} ${component.detail || ''}`);
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
if (result.patterns?.length) {
|
|
702
|
+
write('');
|
|
703
|
+
write(c('CAVA patterns', ANSI.bold));
|
|
704
|
+
result.patterns.forEach((pattern) => {
|
|
705
|
+
write(` - ${pattern.label} (${pattern.severity}): ${pattern.detail}`);
|
|
706
|
+
});
|
|
707
|
+
}
|
|
533
708
|
}
|
|
534
709
|
|
|
535
710
|
async function doctor() {
|
|
@@ -642,6 +817,109 @@ async function decide(actionId, decision, args) {
|
|
|
642
817
|
if (result?.action?.status) write(`New status ${result.action.status}`);
|
|
643
818
|
}
|
|
644
819
|
|
|
820
|
+
function printExternalVerifierProvider(provider = {}) {
|
|
821
|
+
const status = provider.enabled ? c('enabled', ANSI.green) : c('disabled', ANSI.yellow);
|
|
822
|
+
write(` ${provider.display_name || provider.provider_id}`);
|
|
823
|
+
write(` id ${provider.provider_id}`);
|
|
824
|
+
write(` status ${status}`);
|
|
825
|
+
write(` mode ${provider.mode || 'off'}`);
|
|
826
|
+
write(` account model ${provider.account_model || 'osuite_managed'}`);
|
|
827
|
+
if (provider.account_id) write(` account id ${provider.account_id}`);
|
|
828
|
+
if (provider.api_key_preview || provider.has_api_key) {
|
|
829
|
+
write(` verifier key ${provider.api_key_preview || 'present'}`);
|
|
830
|
+
}
|
|
831
|
+
if (provider.base_url) write(` endpoint ${provider.base_url}`);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
function printExternalVerifierStatus(payload = {}) {
|
|
835
|
+
const config = payload.config || {};
|
|
836
|
+
const usage = payload.usage || {};
|
|
837
|
+
write(c('External Verifier Network', `${ANSI.bold}${ANSI.cyan}`));
|
|
838
|
+
write(c('Provider-neutral checkpoint configuration for signed, challengeable proof references.', ANSI.dim));
|
|
839
|
+
write('');
|
|
840
|
+
write(`Workspace state ${config.enabled ? c('enabled', ANSI.green) : c('disabled', ANSI.yellow)}`);
|
|
841
|
+
if (usage.resource) {
|
|
842
|
+
write(`Usage ${usage.current ?? 0} / ${usage.limit ?? 0} ${usage.resource}`);
|
|
843
|
+
}
|
|
844
|
+
write('');
|
|
845
|
+
const providers = Array.isArray(config.providers) ? config.providers : [];
|
|
846
|
+
if (!providers.length) {
|
|
847
|
+
write('No provider has been configured yet.');
|
|
848
|
+
} else {
|
|
849
|
+
providers.forEach(printExternalVerifierProvider);
|
|
850
|
+
}
|
|
851
|
+
if (payload.commands?.cli) {
|
|
852
|
+
write('');
|
|
853
|
+
write(c('Copy-paste setup', ANSI.bold));
|
|
854
|
+
payload.commands.cli.split('\n').forEach((line) => write(` ${line}`));
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function buildExternalVerifierProviderPayload(args = {}) {
|
|
859
|
+
const providerId = String(args.provider || args._?.[1] || 'babyblue_invinoveritas').trim();
|
|
860
|
+
const mode = String(args.mode || 'shadow').trim();
|
|
861
|
+
const accountModel = String(args['account-model'] || args.accountModel || 'customer_managed').trim();
|
|
862
|
+
const provider = {
|
|
863
|
+
provider_id: providerId,
|
|
864
|
+
enabled: args.enabled === undefined ? true : args.enabled !== 'false',
|
|
865
|
+
mode,
|
|
866
|
+
account_model: accountModel,
|
|
867
|
+
};
|
|
868
|
+
if (args['api-key']) provider.api_key = String(args['api-key']);
|
|
869
|
+
if (args['account-id']) provider.account_id = String(args['account-id']);
|
|
870
|
+
if (args['base-url']) provider.base_url = String(args['base-url']);
|
|
871
|
+
if (args['expected-source-class']) provider.expected_source_class = String(args['expected-source-class']);
|
|
872
|
+
return provider;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
async function external(args = {}) {
|
|
876
|
+
const subcommand = args._[0] || 'status';
|
|
877
|
+
const client = requireClient();
|
|
878
|
+
|
|
879
|
+
if (subcommand === 'status' || subcommand === 'providers') {
|
|
880
|
+
const payload = await client.getExternalVerifierConfig();
|
|
881
|
+
if (args.json) return write(JSON.stringify(payload, null, 2));
|
|
882
|
+
printExternalVerifierStatus(payload);
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if (subcommand === 'configure') {
|
|
887
|
+
const provider = buildExternalVerifierProviderPayload(args);
|
|
888
|
+
const request = {
|
|
889
|
+
enabled: true,
|
|
890
|
+
providers: [provider],
|
|
891
|
+
};
|
|
892
|
+
if (args['dry-run']) {
|
|
893
|
+
write(c('External Verifier Network', `${ANSI.bold}${ANSI.cyan}`));
|
|
894
|
+
write('Dry run: would POST this configuration to Studio.');
|
|
895
|
+
write(JSON.stringify(request, null, 2));
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
const payload = await client.configureExternalVerifier(request);
|
|
899
|
+
write(c('External Verifier Network configured', ANSI.green));
|
|
900
|
+
write(`Provider ${provider.provider_id}`);
|
|
901
|
+
write(`Mode ${provider.mode}`);
|
|
902
|
+
write(`Account model ${provider.account_model}`);
|
|
903
|
+
write('');
|
|
904
|
+
printExternalVerifierStatus(payload);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
if (subcommand === 'disable') {
|
|
909
|
+
const providerId = String(args.provider || args._[1] || 'babyblue_invinoveritas');
|
|
910
|
+
const payload = await client.disableExternalVerifier(providerId);
|
|
911
|
+
write(c('External Verifier Network provider disabled', ANSI.yellow));
|
|
912
|
+
write(`Provider ${providerId}`);
|
|
913
|
+
write('');
|
|
914
|
+
printExternalVerifierStatus(payload);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
write(`Unknown external verifier command: ${subcommand}`);
|
|
919
|
+
write('Usage: osuite external [status|configure|disable]');
|
|
920
|
+
process.exit(1);
|
|
921
|
+
}
|
|
922
|
+
|
|
645
923
|
async function init(target = 'generic', args = {}) {
|
|
646
924
|
write(c('OSuite init', `${ANSI.bold}${ANSI.cyan}`));
|
|
647
925
|
if (PROJECT_BOOTSTRAPS[target]) {
|
|
@@ -672,7 +950,12 @@ async function connect(target = 'auto', args = {}) {
|
|
|
672
950
|
const config = readConfig();
|
|
673
951
|
const runtime = detectRuntimeTarget(target);
|
|
674
952
|
const baseUrl = normalizedBaseUrl(args['base-url'] || config.baseUrl || DEFAULT_BASE_URL);
|
|
675
|
-
const configuredAgentId =
|
|
953
|
+
const configuredAgentId = sanitizeConfiguredAgentId(
|
|
954
|
+
runtime,
|
|
955
|
+
runtimeMatchesConfiguredAdapter(runtime, config.runtimeAdapterId)
|
|
956
|
+
? envValue('OSUITE_AGENT_ID', 'DASHCLAW_AGENT_ID')
|
|
957
|
+
: '',
|
|
958
|
+
);
|
|
676
959
|
const agentId = String(args['agent-id'] || configuredAgentId || defaultAgentIdForRuntime(runtime));
|
|
677
960
|
const dryRunCode = String(args.code || generateConnectCode()).trim() || generateConnectCode();
|
|
678
961
|
let connectPayload = null;
|
|
@@ -770,6 +1053,7 @@ async function main() {
|
|
|
770
1053
|
if (command === 'review') return review(args._[0]);
|
|
771
1054
|
if (command === 'approve') return decide(args._[0], 'allow', args);
|
|
772
1055
|
if (command === 'deny') return decide(args._[0], 'deny', args);
|
|
1056
|
+
if (command === 'external') return external(args);
|
|
773
1057
|
if (command === 'connect') return connect(args._[0] || 'auto', args);
|
|
774
1058
|
if (command === 'init') return init(args._[0] || 'generic', args);
|
|
775
1059
|
|
package/osuite.js
CHANGED
|
@@ -242,6 +242,20 @@ class OSuite {
|
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
async getExternalVerifierConfig() {
|
|
246
|
+
return this._request('/api/external-verifiers/config');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async configureExternalVerifier(config = {}) {
|
|
250
|
+
return this._request('/api/external-verifiers/config', 'POST', config);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async disableExternalVerifier(providerId = 'babyblue_invinoveritas') {
|
|
254
|
+
return this._request('/api/external-verifiers/config', 'DELETE', null, {
|
|
255
|
+
provider: providerId,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
245
259
|
async getComplianceEvidence(params = {}) {
|
|
246
260
|
return this._request('/api/compliance/evidence', 'GET', null, params);
|
|
247
261
|
}
|
package/package.json
CHANGED
package/reviewSurface.js
CHANGED
|
@@ -49,11 +49,14 @@ function normalizeDecisionSummary(action = {}) {
|
|
|
49
49
|
const evidence = summary.evidenceConfidence || summary.evidence_confidence || {};
|
|
50
50
|
const control = summary.controlSummary || summary.control_summary || {};
|
|
51
51
|
const dimensions = summary.dimensions || summary.scoreDimensions || summary.score_dimensions || [];
|
|
52
|
+
const scoreBreakdown = summary.scoreBreakdown || summary.score_breakdown || {};
|
|
52
53
|
|
|
53
54
|
return {
|
|
54
55
|
understood,
|
|
55
56
|
evidence,
|
|
56
57
|
control,
|
|
58
|
+
scoreModel: summary.scoreModel || summary.score_model || scoreBreakdown.model_version,
|
|
59
|
+
scoreBreakdown,
|
|
57
60
|
dimensions: asArray(dimensions),
|
|
58
61
|
missingEvidence: asArray(summary.missingEvidence || summary.missing_evidence),
|
|
59
62
|
};
|
|
@@ -87,6 +90,7 @@ export function buildReviewSurface(action = {}, options = {}) {
|
|
|
87
90
|
line('Agent', action.agent_name || action.agent_id),
|
|
88
91
|
line('Action type', action.action_type),
|
|
89
92
|
line('Decision', action.effective_decision || action.decision || action.status),
|
|
93
|
+
line('Score model', summary.scoreModel),
|
|
90
94
|
line('Score', `${scoreText} (${colorize(grade, gradeColor, color)})`),
|
|
91
95
|
line('OSuite understood', understoodSummary),
|
|
92
96
|
line('Evidence confidence', evidenceLabel),
|
|
@@ -106,6 +110,21 @@ export function buildReviewSurface(action = {}, options = {}) {
|
|
|
106
110
|
]
|
|
107
111
|
: [];
|
|
108
112
|
|
|
113
|
+
const scoreComponents = asArray(summary.scoreBreakdown.components);
|
|
114
|
+
const breakdownLines = scoreComponents.length
|
|
115
|
+
? [
|
|
116
|
+
'',
|
|
117
|
+
colorize('Score breakdown', BOLD, color),
|
|
118
|
+
...scoreComponents.map((component) => {
|
|
119
|
+
const label = component.label || component.id || 'component';
|
|
120
|
+
const value = component.value ?? component.score ?? component.contribution ?? '-';
|
|
121
|
+
const sign = typeof value === 'number' && value > 0 && component.direction !== 'base' ? `+${value}` : String(value);
|
|
122
|
+
const reason = component.detail || component.reason || component.summary || '';
|
|
123
|
+
return ` ${label.padEnd(18)} ${String(sign).padStart(4)}${reason ? ` ${colorize(reason, DIM, color)}` : ''}`;
|
|
124
|
+
}),
|
|
125
|
+
]
|
|
126
|
+
: [];
|
|
127
|
+
|
|
109
128
|
const missingEvidenceLines = summary.missingEvidence.length
|
|
110
129
|
? [
|
|
111
130
|
'',
|
|
@@ -122,6 +141,7 @@ export function buildReviewSurface(action = {}, options = {}) {
|
|
|
122
141
|
colorize('Route. Review. Prove.', DIM, color),
|
|
123
142
|
'',
|
|
124
143
|
...rows,
|
|
144
|
+
...breakdownLines,
|
|
125
145
|
...dimensionLines,
|
|
126
146
|
...missingEvidenceLines,
|
|
127
147
|
...footer,
|