sdd-agent-platform 0.2.0 → 0.3.0

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.
@@ -42,6 +42,17 @@ export declare const EVIDENCE_INGESTION_CONTRACT_VERSION = "phase-6.0-evidence-i
42
42
  export declare const AGENT_EXECUTION_RECORD_CONTRACT_VERSION = "phase-6.0-agent-execution-record-v1";
43
43
  export declare const TEAM_SESSION_RECORD_CONTRACT_VERSION = "phase-6.0-team-session-record-v1";
44
44
  export declare const RESIDENT_WORKER_RUNTIME_CONTRACT_VERSION = "phase-6.1-resident-worker-runtime-v1";
45
+ export declare const SDD_EVIDENCE_CONTRACT = "sdd-evidence-v1";
46
+ export declare const SDD_EVIDENCE_VERSION = "1.0.0";
47
+ export declare const ACCEPTANCE_POLICY_RULESET_VERSION = "acceptance-policy-v1";
48
+ export declare const INVOCATION_LEDGER_CONTRACT_VERSION = "phase-6.9-invocation-ledger-v1";
49
+ export declare const ROUTE_CACHE_CONTRACT_VERSION = "phase-6.9-route-cache-v1";
50
+ export declare const RUNTIME_PROFILE_CONTRACT_VERSION = "phase-6.9-runtime-profile-v1";
51
+ export declare const CONTEXT_BUDGET_CONTRACT_VERSION = "phase-6.10-context-budget-v1";
52
+ export declare const COMMAND_OUTPUT_SUMMARY_CONTRACT_VERSION = "sdd-command-output-summary-v1";
53
+ export declare const EVIDENCE_SUMMARY_CONTRACT_VERSION = "sdd-evidence-summary-v1";
54
+ export declare const CONTEXT_PACKAGE_CONTRACT_VERSION = "sdd-context-package-v1";
55
+ export declare const LOG_WORKER_SUMMARY_CONTRACT_VERSION = "sdd-log-worker-summary-v1";
45
56
  export type DoctorLevel = 'PASS' | 'WARN' | 'FAIL';
46
57
  export type RunStatus = 'created' | 'running' | 'completed' | 'blocked' | 'failed' | 'archived';
47
58
  export type LifecycleProfile = 'direct' | 'compact' | 'full' | 'research';
@@ -52,6 +63,12 @@ export type DelegationStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' |
52
63
  export type GoalVerifyStatus = 'PASS' | 'PASS_WITH_GAPS' | 'FAIL' | 'BLOCKED';
53
64
  export type HarnessVerifyStatus = 'PASS' | 'GAPS' | 'BLOCKED' | 'HUMAN_NEEDED';
54
65
  export type ArtifactResultIngestionStatus = 'accepted' | 'rejected';
66
+ export type EvidenceCoverageStatus = 'PASS' | 'FAIL' | 'BLOCKED' | 'REFERENCED_ONLY' | 'MISSING';
67
+ export type EvidenceQualityIssue = 'EMPTY_EVIDENCE' | 'TODO_PLACEHOLDER' | 'TEMPLATE_TEXT' | 'MENTION_ONLY' | 'UNSOURCED_PASS' | 'MISSING_COMMAND_OUTPUT' | 'MISSING_ARTIFACT_REFERENCE' | 'MISSING_MATERIAL_REFERENCE' | 'PROVENANCE_GAP' | 'POLICY_RULE_FAILED' | 'DERIVED_SOURCE_EVIDENCE' | 'PARTITION_SCOPE_VIOLATION';
68
+ export type ContextProfile = 'brief' | 'normal' | 'forensic';
69
+ export type ContextBuildMode = 'do' | 'verify' | 'sync-back' | 'doctor';
70
+ export type ContextSourceKind = 'artifact' | 'run_state' | 'ledger' | 'document' | 'command_output' | 'derived';
71
+ export type ContextSummaryStatus = 'PASS' | 'FAIL' | 'BLOCKED' | 'UNKNOWN';
55
72
  export type DetectionConfidence = 'high' | 'medium' | 'low';
56
73
  export interface DetectionEvidence {
57
74
  kind: string;
@@ -442,6 +459,8 @@ export interface RunState {
442
459
  syncBack: {
443
460
  mode: 'proposal';
444
461
  proposalPath: string | null;
462
+ proposalDigest?: string | null;
463
+ sourceVerifyStatus?: GoalVerifyStatus | SingleTaskLoopStatus | null;
445
464
  status: 'not_created' | 'proposed' | 'applied';
446
465
  };
447
466
  }
@@ -868,6 +887,7 @@ export type TeamModeDecisionStatus = 'disabled' | 'enabled' | 'blocked';
868
887
  export type TeamModeActivation = 'auto' | 'force' | 'off';
869
888
  export type TeamModeSelection = 'off' | 'inspect' | 'review-lite' | 'hyperplan' | 'security-research';
870
889
  export type TeamModeCostClass = 'none' | 'low' | 'medium' | 'high';
890
+ export type TeamModeCostRoute = 'not_applicable' | 'downgraded' | 'no_downgrade' | 'blocked';
871
891
  export type AgentExecutionRecordStatus = 'claimed' | 'completed' | 'failed' | 'blocked' | 'skipped';
872
892
  export type TeamSessionRecordStatus = 'created' | 'completed' | 'blocked' | 'disabled';
873
893
  export interface AgentProfileContract {
@@ -1003,6 +1023,9 @@ export interface TeamModePolicy {
1003
1023
  activation: TeamModeActivation;
1004
1024
  costClass: TeamModeCostClass;
1005
1025
  reason: string;
1026
+ costRoute: TeamModeCostRoute;
1027
+ downgradeReason: string | null;
1028
+ trustPolicyEnforced: boolean;
1006
1029
  chiefProfile: AgentProfileId;
1007
1030
  memberProfiles: AgentProfileId[];
1008
1031
  allowedWaves: DelegationWavePolicy[];
@@ -1038,6 +1061,7 @@ export interface AgentExecutionRecord {
1038
1061
  queueItemId: string | null;
1039
1062
  ingestionStatus: ArtifactResultIngestionStatus | null;
1040
1063
  resultStatus: SddResultStatus | null;
1064
+ routeId: string;
1041
1065
  routeDecision: Pick<AgentRouterDecision, 'version' | 'category' | 'recommendedProfile' | 'autonomyCeiling' | 'requiredCapabilities' | 'blockedReason'>;
1042
1066
  evidenceSummary: string;
1043
1067
  createdAt: string;
@@ -1096,6 +1120,22 @@ export interface AgentRouterDecision {
1096
1120
  routingRuleHits?: string[];
1097
1121
  quarantineWarnings?: string[];
1098
1122
  adapterMapping?: AgentRuntimeAdapterMapping | null;
1123
+ cache?: RouteCacheMetadata;
1124
+ profile?: RuntimeProfileSpan[];
1125
+ }
1126
+ export interface RouteCacheMetadata {
1127
+ contract: typeof ROUTE_CACHE_CONTRACT_VERSION;
1128
+ key: string;
1129
+ status: 'hit' | 'miss' | 'stored';
1130
+ source: 'content_addressed_derived_route';
1131
+ authoritative: false;
1132
+ }
1133
+ export interface RuntimeProfileSpan {
1134
+ contract: typeof RUNTIME_PROFILE_CONTRACT_VERSION;
1135
+ name: string;
1136
+ startedAt: string;
1137
+ endedAt: string;
1138
+ durationMs: number;
1099
1139
  }
1100
1140
  export interface AgentSkillTeamRuntimeInspection {
1101
1141
  version: typeof AGENT_SKILL_TEAM_RUNTIME_CONTRACT_VERSION;
@@ -1217,9 +1257,179 @@ export interface SddResultValidationReport {
1217
1257
  valid: boolean;
1218
1258
  result: SddResult | null;
1219
1259
  issues: ContractValidationIssue[];
1260
+ trust?: ArtifactTrustValidationReport;
1261
+ }
1262
+ export interface EvidenceItem {
1263
+ kind: string;
1264
+ ref: string;
1265
+ summary: string | null;
1266
+ }
1267
+ export interface EvidenceClaim {
1268
+ contract: typeof SDD_EVIDENCE_CONTRACT;
1269
+ version: typeof SDD_EVIDENCE_VERSION;
1270
+ task: string;
1271
+ acceptance: string;
1272
+ status: EvidenceCoverageStatus;
1273
+ claim: string;
1274
+ sourceArtifact: string;
1275
+ evidence: EvidenceItem[];
1276
+ provenance: string[];
1277
+ policy: string[];
1278
+ rawMetadata: Record<string, string | string[]>;
1279
+ }
1280
+ export interface EvidenceReasoning {
1281
+ summary: string;
1282
+ ruleIds: string[];
1283
+ issueCodes: EvidenceQualityIssue[];
1284
+ }
1285
+ export interface PolicyRuleSet {
1286
+ id: typeof ACCEPTANCE_POLICY_RULESET_VERSION;
1287
+ version: string;
1288
+ ruleIds: string[];
1289
+ }
1290
+ export interface PolicyDecision {
1291
+ status: EvidenceCoverageStatus;
1292
+ ruleSet: PolicyRuleSet;
1293
+ passedRules: string[];
1294
+ failedRules: string[];
1295
+ issueCodes: EvidenceQualityIssue[];
1296
+ }
1297
+ export interface EvidenceCoverage {
1298
+ acceptanceId: string;
1299
+ status: EvidenceCoverageStatus;
1300
+ claim?: EvidenceClaim;
1301
+ evidence: EvidenceItem[];
1302
+ reasoning?: EvidenceReasoning;
1303
+ policyDecision: PolicyDecision;
1304
+ }
1305
+ export interface ProvenanceEntity {
1306
+ id: string;
1307
+ kind: 'spec' | 'plan' | 'tasks' | 'artifact' | 'command_output' | 'run_state' | 'material' | string;
1308
+ hash?: string;
1309
+ path?: string;
1310
+ }
1311
+ export interface ProvenanceActivity {
1312
+ id: string;
1313
+ kind: 'inspect' | 'route' | 'do' | 'verify' | 'artifact_validate' | 'sync_back' | 'policy_evaluate' | 'cache' | string;
1314
+ startedAt?: string;
1315
+ endedAt?: string;
1316
+ }
1317
+ export interface ProvenanceAgent {
1318
+ id: string;
1319
+ kind: 'runtime' | 'implementer' | 'reviewer' | 'validator' | 'tool' | string;
1320
+ }
1321
+ export interface ProvenanceLink {
1322
+ relation: 'used' | 'wasGeneratedBy' | 'wasAssociatedWith' | 'wasDerivedFrom' | string;
1323
+ from: string;
1324
+ to: string;
1325
+ }
1326
+ export interface SddEvidenceAttestation {
1327
+ subject: string;
1328
+ materials: ProvenanceEntity[];
1329
+ invocation: ProvenanceActivity;
1330
+ builder: ProvenanceAgent;
1331
+ }
1332
+ export interface ArtifactTrustValidationReport {
1333
+ valid: boolean;
1334
+ claims: EvidenceClaim[];
1335
+ issues: ContractValidationIssue[];
1336
+ }
1337
+ export type InvocationLedgerKind = 'command' | 'tool_invocation' | 'agent' | 'skill' | 'material' | 'policy_evaluation' | 'cache' | 'artifact_hash';
1338
+ export interface InvocationLedgerEntry {
1339
+ contract: 'sdd-invocation-ledger-v1';
1340
+ version: typeof INVOCATION_LEDGER_CONTRACT_VERSION;
1341
+ entryId: string;
1342
+ runId: string;
1343
+ taskId: string | null;
1344
+ branch: string | null;
1345
+ kind: InvocationLedgerKind;
1346
+ ref: string;
1347
+ status: string;
1348
+ timestamp: string;
1349
+ artifactPath?: string | null;
1350
+ inputHash?: string | null;
1351
+ outputHash?: string | null;
1352
+ materialRefs: string[];
1353
+ metadata: Record<string, string | number | boolean | null>;
1354
+ }
1355
+ export interface ContextBudget {
1356
+ contract: typeof CONTEXT_BUDGET_CONTRACT_VERSION;
1357
+ profile: ContextProfile;
1358
+ maxBytes: number;
1359
+ preserve: string[];
1360
+ }
1361
+ export interface ContextSourceRef {
1362
+ path: string;
1363
+ hash: string;
1364
+ kind: ContextSourceKind;
1365
+ }
1366
+ export interface CommandOutputSummary {
1367
+ contract: typeof COMMAND_OUTPUT_SUMMARY_CONTRACT_VERSION;
1368
+ authoritative: false;
1369
+ usableForPass: false;
1370
+ source: ContextSourceRef;
1371
+ status: ContextSummaryStatus;
1372
+ highlights: string[];
1373
+ omittedLines: number;
1374
+ }
1375
+ export interface EvidenceSummaryProjection {
1376
+ contract: typeof EVIDENCE_SUMMARY_CONTRACT_VERSION;
1377
+ authoritative: false;
1378
+ usableForPass: false;
1379
+ runId: string;
1380
+ taskId: string | null;
1381
+ sources: ContextSourceRef[];
1382
+ passCount: number;
1383
+ blockedCount: number;
1384
+ failCount: number;
1385
+ issueCodes: EvidenceQualityIssue[];
1386
+ policyRefs: string[];
1387
+ highlights: string[];
1388
+ }
1389
+ export interface ContextBuildPackage {
1390
+ contract: typeof CONTEXT_PACKAGE_CONTRACT_VERSION;
1391
+ profile: ContextProfile;
1392
+ mode: ContextBuildMode;
1393
+ agent: string | null;
1394
+ authoritative: false;
1395
+ usableForPass: false;
1396
+ taskId: string;
1397
+ branch: string;
1398
+ mustRead: ContextSourceRef[];
1399
+ optionalRead: ContextSourceRef[];
1400
+ doNotReadUnlessNeeded: ContextSourceRef[];
1401
+ nextCommands: string[];
1402
+ warnings: string[];
1403
+ }
1404
+ export interface LogWorkerSummary {
1405
+ contract: typeof LOG_WORKER_SUMMARY_CONTRACT_VERSION;
1406
+ authoritative: false;
1407
+ usableForPass: false;
1408
+ runId: string;
1409
+ taskId: string | null;
1410
+ workerId: string;
1411
+ sources: ContextSourceRef[];
1412
+ highlights: string[];
1413
+ forbiddenAuthority: string[];
1414
+ }
1415
+ export interface EvidenceSummaryOptions {
1416
+ runId: string;
1417
+ taskId?: string;
1418
+ }
1419
+ export interface ContextBuildOptions {
1420
+ taskId: string;
1421
+ branch?: string;
1422
+ mode: ContextBuildMode;
1423
+ agent?: string;
1424
+ profile?: ContextProfile;
1425
+ }
1426
+ export interface LogWorkerSummaryValidation {
1427
+ valid: boolean;
1428
+ issues: ContractValidationIssue[];
1220
1429
  }
1221
1430
  export interface SddResultArtifactTemplateOptions {
1222
1431
  branch?: string;
1432
+ runId?: string;
1223
1433
  taskId: string;
1224
1434
  agent: string;
1225
1435
  artifactPath: string;
@@ -1282,8 +1492,10 @@ export interface GoalVerifyOptions {
1282
1492
  }
1283
1493
  export interface AcceptanceCoverageItem {
1284
1494
  acceptance: string;
1285
- status: GoalVerifyStatus | 'GAP';
1495
+ status: EvidenceCoverageStatus;
1286
1496
  evidence: string;
1497
+ policyDecision?: PolicyDecision;
1498
+ issueCodes?: EvidenceQualityIssue[];
1287
1499
  }
1288
1500
  export interface GoalVerifyResult {
1289
1501
  runId: string;
@@ -1407,6 +1619,7 @@ export interface TaskRunEvidenceContract {
1407
1619
  validation: RunState['validation'];
1408
1620
  gaps: SddTaskGap[];
1409
1621
  syncBackProposal: string | null;
1622
+ invocationLedger: InvocationLedgerEntry[];
1410
1623
  agentExecutions: AgentExecutionRecord[];
1411
1624
  teamSessions: TeamSessionRecord[];
1412
1625
  workerRuntimes: ResidentWorkerRuntimeRecord[];
@@ -1425,6 +1638,7 @@ export interface RunInspection {
1425
1638
  tasks: Record<string, unknown>;
1426
1639
  taskRunEvidence: TaskRunEvidenceContract;
1427
1640
  agentExecutions: AgentExecutionRecord[];
1641
+ invocationLedger: InvocationLedgerEntry[];
1428
1642
  teamSessions: TeamSessionRecord[];
1429
1643
  workerRuntimes: ResidentWorkerRuntimeRecord[];
1430
1644
  }
@@ -1486,6 +1700,8 @@ export interface SyncBackInspection {
1486
1700
  reasons: string[];
1487
1701
  proposalPath: string | null;
1488
1702
  proposal: string | null;
1703
+ proposalDigest: string | null;
1704
+ proposalDigestValid: boolean | null;
1489
1705
  runTaskStatus: string | null;
1490
1706
  markdownTask: SddTask | null;
1491
1707
  markdownStatus: SddTaskStatus | null;
@@ -1509,11 +1725,14 @@ export declare function getSddDir(projectRoot: string): string;
1509
1725
  export declare function getProjectConfigPath(projectRoot: string): string;
1510
1726
  export declare function getRunsDir(projectRoot: string): string;
1511
1727
  export declare function getLocalRunIndexPath(projectRoot: string): string;
1728
+ export declare function getRuntimeStorePath(projectRoot: string): string;
1512
1729
  export declare function getRunDir(projectRoot: string, runId: string): string;
1513
1730
  export declare function getArtifactsDir(projectRoot: string, runId: string): string;
1514
1731
  export declare function getAgentExecutionsDir(projectRoot: string, runId: string): string;
1515
1732
  export declare function getTeamSessionsDir(projectRoot: string, runId: string): string;
1516
1733
  export declare function getWorkerRuntimesDir(projectRoot: string, runId: string): string;
1734
+ export declare function getInvocationLedgerPath(projectRoot: string, runId: string): string;
1735
+ export declare function getRouteCacheDir(projectRoot: string): string;
1517
1736
  export declare function getWorkerRuntimeRecordPath(projectRoot: string, runId: string, runtimeId: string): string;
1518
1737
  export declare function getAgentExecutionRecordPath(projectRoot: string, runId: string, executionId: string): string;
1519
1738
  export declare function getTeamSessionRecordPath(projectRoot: string, runId: string, teamId: string): string;
@@ -1525,6 +1744,8 @@ export declare function writeArtifact(projectRoot: string, runId: string, artifa
1525
1744
  runRelativePath: string;
1526
1745
  }>;
1527
1746
  export declare function readArtifact(projectRoot: string, runId: string, artifactRootRelativePath: string): Promise<string>;
1747
+ export declare function appendInvocationLedgerEntry(projectRoot: string, input: Omit<InvocationLedgerEntry, 'contract' | 'version' | 'entryId' | 'timestamp'>): Promise<InvocationLedgerEntry>;
1748
+ export declare function listInvocationLedgerEntries(projectRoot: string, runId: string): Promise<InvocationLedgerEntry[]>;
1528
1749
  export declare function writeAgentExecutionRecord(projectRoot: string, record: AgentExecutionRecord): Promise<AgentExecutionRecord>;
1529
1750
  export declare function writeTeamSessionRecord(projectRoot: string, record: TeamSessionRecord): Promise<TeamSessionRecord>;
1530
1751
  export declare function writeResidentWorkerRuntimeRecord(projectRoot: string, record: ResidentWorkerRuntimeRecord): Promise<ResidentWorkerRuntimeRecord>;
@@ -1573,6 +1794,12 @@ export declare function readLocalRunIndex(projectRoot: string): Promise<LocalRun
1573
1794
  export declare function queryLocalRunIndex(projectRoot: string, query?: LocalRunIndexQuery): Promise<LocalRunIndex>;
1574
1795
  export declare function inspectLocalRunIndex(projectRoot: string): Promise<LocalRunIndexInspection>;
1575
1796
  export declare function inspectRun(projectRoot: string, runId: string): Promise<RunInspection>;
1797
+ export declare function parseContextProfile(value: string | null | undefined): ContextProfile;
1798
+ export declare function contextBudgetForProfile(profile: ContextProfile): ContextBudget;
1799
+ export declare function summarizeCommandOutput(rawOutput: string, source: ContextSourceRef, profile?: ContextProfile): CommandOutputSummary;
1800
+ export declare function buildEvidenceSummaryProjection(projectRoot: string, options: EvidenceSummaryOptions): Promise<EvidenceSummaryProjection>;
1801
+ export declare function buildContextBuildPackage(projectRoot: string, options: ContextBuildOptions): Promise<ContextBuildPackage>;
1802
+ export declare function validateLogWorkerSummary(summary: LogWorkerSummary): LogWorkerSummaryValidation;
1576
1803
  export declare function resolveSddContext(projectRoot: string, options?: {
1577
1804
  branch?: string | null;
1578
1805
  branchSource?: ContextBranchSource;
@@ -1600,6 +1827,7 @@ export declare function applySyncBack(projectRoot: string, options: {
1600
1827
  export declare function doctor(projectRoot: string, options?: {
1601
1828
  allRuns?: boolean;
1602
1829
  latestOnly?: boolean;
1830
+ branch?: string | null;
1603
1831
  }): Promise<DoctorReport>;
1604
1832
  export declare function parseSddBranch(projectRoot: string, branch?: string): Promise<SddTaskModel>;
1605
1833
  export declare function parseSddTasksMarkdown(raw: string, options?: {
@@ -1618,6 +1846,10 @@ export declare function validateSddResult(result: SddResult, options?: {
1618
1846
  expectedAgent?: string;
1619
1847
  runRelativeArtifactPath?: string;
1620
1848
  }): ContractValidationIssue[];
1849
+ export declare function parseSddEvidenceMarkdown(raw: string, options?: {
1850
+ expectedTask?: string;
1851
+ sourceArtifact?: string;
1852
+ }): ArtifactTrustValidationReport;
1621
1853
  export declare function createDelegationRecord(input: {
1622
1854
  delegationId: string;
1623
1855
  task: string;
@@ -1723,11 +1955,14 @@ export declare function inspectTeamModePolicy(projectRoot: string, options?: {
1723
1955
  enabled?: boolean;
1724
1956
  teamModeActivation?: TeamModeActivation;
1725
1957
  }): Promise<TeamModePolicy>;
1726
- export declare function routeSddTask(projectRoot: string, options: {
1958
+ export declare function routeSddTask(projectRoot: string, options?: {
1727
1959
  taskId: string;
1728
1960
  branch?: string;
1961
+ agent?: string;
1729
1962
  teamModeEnabled?: boolean;
1730
1963
  teamModeActivation?: TeamModeActivation;
1964
+ profile?: boolean;
1965
+ cache?: boolean;
1731
1966
  }): Promise<AgentRouterDecision>;
1732
1967
  export declare function inspectQueryStatusContract(projectRoot: string): Promise<QueryStatusContract>;
1733
1968
  export declare function inspectSkillAgentEvalContract(projectRoot: string): Promise<SkillAgentEvalContract>;