@treeseed/sdk 0.13.0-rc.120 → 0.13.0-rc.122

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 (97) hide show
  1. package/dist/.treeseed-build-complete.json +1 -1
  2. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +1594 -922
  3. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +22 -1
  4. package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +40 -40
  5. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +1 -59
  6. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +1 -1
  7. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +1 -1
  8. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +18 -20
  9. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +1 -1
  10. package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +0 -67
  11. package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
  12. package/dist/agent-capacity/contracts/configuration/configuration.js +0 -2
  13. package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +8 -8
  14. package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +0 -23
  15. package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
  16. package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
  17. package/dist/agent-capacity/contracts/support/execution-graph.d.ts +176 -176
  18. package/dist/agent-capacity/contracts/support/execution-graph.js +1 -1
  19. package/dist/agent-capacity/contracts/support/financial-records.d.ts +1 -6
  20. package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
  21. package/dist/agent-capacity/grant.d.ts +34 -0
  22. package/dist/agent-capacity/grant.js +4 -0
  23. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1042 -1042
  24. package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +11 -11
  25. package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
  26. package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
  27. package/dist/agent-capacity/validation/assignment-records.js +4 -35
  28. package/dist/agent-capacity/validation/configuration.d.ts +1 -1
  29. package/dist/agent-capacity/validation/configuration.js +2 -6
  30. package/dist/agent-capacity/validation/grant.d.ts +11 -0
  31. package/dist/agent-capacity/validation/grant.js +31 -0
  32. package/dist/capacity/agents/agent-capacity.d.ts +2 -4
  33. package/dist/capacity/agents/agent-capacity.js +1 -3
  34. package/dist/capacity-provider/capability-ontology.d.ts +138 -138
  35. package/dist/capacity-provider/client.d.ts +1 -2
  36. package/dist/capacity-provider/client.js +0 -6
  37. package/dist/capacity-provider/contracts/environment-profiles.d.ts +8 -8
  38. package/dist/capacity-provider/core-capability-catalog.d.ts +4 -4
  39. package/dist/capacity-provider/environment-catalog.d.ts +166 -166
  40. package/dist/capacity-provider/install-configuration.d.ts +2 -2
  41. package/dist/capacity-provider/sandbox-contracts.d.ts +52 -52
  42. package/dist/capacity-provider/source-workspace.d.ts +102 -4
  43. package/dist/capacity-provider/source-workspace.js +5 -1
  44. package/dist/content/validation/agent-operational-content-schemas.d.ts +108 -108
  45. package/dist/content/validation/auxiliary-content-schemas.d.ts +108 -108
  46. package/dist/content/validation/content-model-schemas.d.ts +9473 -6284
  47. package/dist/content/validation/content-model-schemas.js +116 -48
  48. package/dist/content/validation/portable-content-data.d.ts +351 -181
  49. package/dist/content/validation/portable-content-data.js +6 -1
  50. package/dist/deployment/ai/storage.d.ts +14 -14
  51. package/dist/deployment/ai-hosting.d.ts +10 -10
  52. package/dist/deployment/ai-instance.d.ts +14 -14
  53. package/dist/deployment/ai-mode.d.ts +82 -82
  54. package/dist/deployment/hosted-topology-template.d.ts +24 -24
  55. package/dist/deployment/hosted-topology.d.ts +219 -219
  56. package/dist/deployment/postgres/contracts.d.ts +52 -52
  57. package/dist/deployment/postgres/transfer.d.ts +4 -4
  58. package/dist/deployment/schemas.d.ts +780 -780
  59. package/dist/development/schemas.d.ts +440 -440
  60. package/dist/development/schemas.js +1 -1
  61. package/dist/knowledge/contracts.d.ts +9 -2
  62. package/dist/knowledge/contracts.js +2 -2
  63. package/dist/model-registry/discussion-models.js +0 -1
  64. package/dist/operator-contracts/canonical-command-tree.js +9 -2
  65. package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +2 -2
  66. package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +17 -17
  67. package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +4 -4
  68. package/dist/operator-contracts/catalog/communication-operations.d.ts +100 -100
  69. package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +40 -40
  70. package/dist/operator-contracts/catalog/inbox-operations.d.ts +54 -54
  71. package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +5 -5
  72. package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
  73. package/dist/operator-contracts/catalog/services/secret-operations.d.ts +8 -8
  74. package/dist/operator-contracts/communication/contracts.d.ts +273 -273
  75. package/dist/operator-contracts/control-plane-operations.d.ts +236 -242
  76. package/dist/operator-contracts/control-plane-operations.js +0 -2
  77. package/dist/operator-contracts/inbox/contracts.d.ts +204 -204
  78. package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
  79. package/dist/platform/agent-schema-verification.d.ts +3 -0
  80. package/dist/platform/agent-schema-verification.js +94 -0
  81. package/dist/platform/verification.js +6 -0
  82. package/dist/sdk-types/support/planning-policy.d.ts +1 -1
  83. package/dist/secrets-capability/shared-access.d.ts +2 -2
  84. package/dist/secrets-capability/shared-resources.d.ts +46 -46
  85. package/dist/secrets-capability/vault-contracts.d.ts +2 -2
  86. package/dist/security/encrypted-envelope.d.ts +8 -8
  87. package/package.json +3 -2
  88. package/dist/agent-capacity/allocation.d.ts +0 -183
  89. package/dist/agent-capacity/allocation.js +0 -5
  90. package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
  91. package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
  92. package/dist/agent-capacity/artifacts.d.ts +0 -123
  93. package/dist/agent-capacity/artifacts.js +0 -39
  94. package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -227
  95. package/dist/agent-capacity/contracts/support/decision-work.js +0 -0
  96. package/dist/agent-capacity/validation/allocation.d.ts +0 -12
  97. package/dist/agent-capacity/validation/allocation.js +0 -115
@@ -1,183 +0,0 @@
1
- export type CapacityAllocationSetStatus = 'draft' | 'validated' | 'active' | 'superseded' | 'archived';
2
- export type CapacityAllocationScope = 'project' | 'agent-class' | 'mode';
3
- export type CapacityAllocationOverflow = 'deny' | 'approval-required' | 'borrow';
4
- export type CapacityGrantStatus = 'planned' | 'active' | 'paused' | 'revoked' | 'expired';
5
- export interface CapacityAllocationSlicePolicy {
6
- targetPercent: number;
7
- minPercent: number;
8
- maxPercent: number;
9
- hardCapPercent: number;
10
- }
11
- export interface CapacityAllocationSlice {
12
- id: string;
13
- scope: CapacityAllocationScope;
14
- targetId: string;
15
- parentSliceId?: string | null;
16
- policy: CapacityAllocationSlicePolicy;
17
- metadata?: Record<string, unknown>;
18
- }
19
- export interface CapacityReservePolicy {
20
- percent: number;
21
- overflow: CapacityAllocationOverflow;
22
- }
23
- export interface CapacityBorrowingRule {
24
- id: string;
25
- fromSliceId: string;
26
- toSliceId: string;
27
- maxPercent: number;
28
- requiresApproval: boolean;
29
- allocationPriorityBand: 'minimum' | 'target' | 'normal' | 'overflow';
30
- allocationPriorityScore: number;
31
- }
32
- export interface CapacityAllocationSetV2 {
33
- schemaVersion: 2;
34
- id: string;
35
- teamId: string;
36
- version: number;
37
- status: CapacityAllocationSetStatus;
38
- effectiveFrom: string;
39
- effectiveUntil?: string | null;
40
- reservePolicy: CapacityReservePolicy;
41
- slices: CapacityAllocationSlice[];
42
- borrowingRules: CapacityBorrowingRule[];
43
- createdById?: string | null;
44
- activatedAt?: string | null;
45
- supersededById?: string | null;
46
- metadata?: Record<string, unknown>;
47
- createdAt?: string;
48
- updatedAt?: string;
49
- }
50
- export interface CapacityGrantV2 {
51
- schemaVersion: 2;
52
- id: string;
53
- membershipId: string;
54
- teamId: string;
55
- providerId: string;
56
- projectId: string;
57
- environment: string;
58
- status: CapacityGrantStatus;
59
- executionProviderIds: string[];
60
- laneIds: string[];
61
- capabilities: string[];
62
- allowedModes: Array<'planning' | 'acting'>;
63
- dailyAgentSecondsLimit?: number | null;
64
- monthlyAgentSecondsLimit?: number | null;
65
- maxConcurrentAssignments?: number | null;
66
- budgetLimits?: {
67
- tokens?: number | null;
68
- cost?: {
69
- amount: number;
70
- currency: string;
71
- } | null;
72
- native?: Array<{
73
- unit: string;
74
- amount: number;
75
- }>;
76
- } | null;
77
- unmetered?: boolean;
78
- expiresAt?: string | null;
79
- metadata?: Record<string, unknown>;
80
- }
81
- export type CapacityAdmissionReasonCode = 'allowed' | 'membership_not_approved' | 'membership_id_mismatch' | 'membership_suspended' | 'membership_revoked' | 'membership_team_mismatch' | 'membership_provider_mismatch' | 'availability_session_not_open' | 'outside_availability_window' | 'missing_active_grant' | 'grant_membership_mismatch' | 'grant_team_mismatch' | 'grant_provider_mismatch' | 'grant_expired' | 'grant_project_mismatch' | 'grant_environment_mismatch' | 'grant_mode_denied' | 'grant_capability_missing' | 'grant_execution_provider_denied' | 'grant_lane_denied' | 'grant_time_exhausted' | 'grant_concurrency_exhausted' | 'workday_not_active' | 'workday_budget_exhausted' | 'allocation_set_not_active' | 'allocation_set_not_effective' | 'allocation_team_mismatch' | 'allocation_slice_missing' | 'allocation_hard_cap_exhausted' | 'allocation_borrowing_approval_required' | 'allocation_borrowing_denied' | 'provider_capacity_exhausted' | 'provider_capability_missing' | 'provider_local_limit_exhausted' | 'acting_decision_not_approved' | 'acting_readiness_not_ready' | 'acting_capacity_plan_not_accepted' | 'requested_seconds_invalid' | 'requested_budget_invalid' | 'grant_token_exhausted' | 'grant_cost_exhausted' | 'grant_native_exhausted' | 'provider_budget_exhausted';
82
- export interface CapacityAdmissionInput {
83
- now: string;
84
- request: {
85
- teamId: string;
86
- providerId: string;
87
- membershipId: string;
88
- projectId: string;
89
- environment: string;
90
- agentClassId: string;
91
- mode: 'planning' | 'acting';
92
- executionProviderId?: string | null;
93
- laneId?: string | null;
94
- requiredCapabilities: string[];
95
- requestedSeconds: number;
96
- budget?: import('./contracts/support/time-capacity.js').CapacityBudgetV2 | null;
97
- };
98
- membership: {
99
- id: string;
100
- teamId: string;
101
- providerId: string;
102
- status: 'approved' | 'suspended' | 'revoked';
103
- };
104
- availability: {
105
- status: 'open' | 'draining' | 'closed' | 'expired';
106
- availableFrom: string;
107
- availableUntil?: string | null;
108
- };
109
- grant?: CapacityGrantV2 | null;
110
- workday: {
111
- id: string;
112
- status: 'draft' | 'active' | 'paused' | 'completed' | 'cancelled';
113
- totalSeconds: number;
114
- committedSeconds: number;
115
- };
116
- allocationSet?: CapacityAllocationSetV2 | null;
117
- allocationSliceIds: string[];
118
- committedSecondsBySlice: Record<string, number>;
119
- committedBorrowedSecondsByRule?: Record<string, number>;
120
- reserveCommittedSeconds?: number;
121
- approvedBorrowingRuleIds?: string[];
122
- providerCapacity: {
123
- availableAgentSeconds: number;
124
- availableConcurrentAssignments: number;
125
- capabilities?: string[];
126
- availableTokens?: number | null;
127
- availableCost?: number | null;
128
- availableNative?: Record<string, number>;
129
- };
130
- providerLocalLimits: {
131
- availableAgentSeconds: number;
132
- availableConcurrentAssignments: number;
133
- availableTokens?: number | null;
134
- availableCost?: number | null;
135
- availableNative?: Record<string, number>;
136
- };
137
- grantCommitted: {
138
- dailyAgentSeconds: number;
139
- monthlyAgentSeconds: number;
140
- activeAssignments: number;
141
- tokens?: number;
142
- cost?: number;
143
- native?: Record<string, number>;
144
- };
145
- acting?: {
146
- decisionApproved: boolean;
147
- readinessReady: boolean;
148
- capacityPlanAccepted: boolean;
149
- };
150
- }
151
- export interface CapacityAdmissionDecision {
152
- allowed: boolean;
153
- reasonCode: CapacityAdmissionReasonCode;
154
- reasonCodes: CapacityAdmissionReasonCode[];
155
- maxReservableSeconds: number;
156
- requiresApproval: boolean;
157
- allocationPriorityBand: 'minimum' | 'target' | 'normal' | 'overflow';
158
- allocationPriorityScore: number;
159
- grantId?: string | null;
160
- allocationSetId?: string | null;
161
- allocationVersion?: number | null;
162
- counterClaims: CapacityAdmissionCounterClaim[];
163
- policySnapshot: Record<string, unknown>;
164
- explanation: Array<{
165
- gate: string;
166
- allowed: boolean;
167
- remaining?: number;
168
- detail?: string;
169
- }>;
170
- }
171
- export interface CapacityAdmissionCounterClaim {
172
- id: string;
173
- scope: 'grant-daily' | 'grant-monthly' | 'grant-concurrency' | 'grant-token' | 'grant-cost' | 'grant-native' | 'provider-time' | 'provider-concurrency' | 'provider-token' | 'provider-cost' | 'provider-native' | 'provider-local-time' | 'provider-local-concurrency' | 'provider-local-token' | 'provider-local-cost' | 'provider-local-native' | 'workday' | 'allocation-slice' | 'allocation-overflow' | 'allocation-reserve' | 'allocation-borrow';
174
- scopeId: string;
175
- periodKey: string;
176
- hardLimit: number;
177
- amount: number;
178
- release: 'settlement-difference' | 'assignment-terminal';
179
- dimension?: 'time' | 'concurrency' | 'tokens' | 'cost' | 'native';
180
- unit?: string | null;
181
- }
182
- export { validateCapacityAllocationSetV2, validateCapacityGrantV2 } from './validation/allocation.js';
183
- export type { CapacityAllocationDiagnostic, CapacityAllocationValidation } from './validation/allocation.js';
@@ -1,5 +0,0 @@
1
- import { validateCapacityAllocationSetV2, validateCapacityGrantV2 } from "./validation/allocation.js";
2
- export {
3
- validateCapacityAllocationSetV2,
4
- validateCapacityGrantV2
5
- };
@@ -1,49 +0,0 @@
1
- export declare const ARTIFACT_MUTATION_RECEIPT_SCHEMA: "treeseed.artifact-mutation-receipt/v1";
2
- export type ArtifactMutationKind = 'treedx-content' | 'source-checkpoint';
3
- export type ArtifactMutationPhase = 'provisional' | 'integrated';
4
- import type { AgentWorkExecutionMode, UpstreamMutationPolicy } from './contracts/support/authority/execution-mode.js';
5
- export interface ArtifactMutationEvidence {
6
- ref: string;
7
- digest?: string | null;
8
- artifactRefs: string[];
9
- }
10
- /** Portable proof that an assignment changed one governed artifact boundary. */
11
- export interface ArtifactMutationReceipt {
12
- schemaVersion: typeof ARTIFACT_MUTATION_RECEIPT_SCHEMA;
13
- id: string;
14
- kind: ArtifactMutationKind;
15
- phase: ArtifactMutationPhase;
16
- executionMode: AgentWorkExecutionMode;
17
- upstreamMutationPolicy: UpstreamMutationPolicy;
18
- assignmentId: string;
19
- modeRunId: string;
20
- teamId: string;
21
- projectId: string;
22
- baseRef: string;
23
- effectiveRef: string;
24
- changedPaths: string[];
25
- before: ArtifactMutationEvidence;
26
- after: ArtifactMutationEvidence;
27
- review?: {
28
- reviewerId: string;
29
- disposition: 'approved' | 'rejected';
30
- evidenceReason: string;
31
- workdayId: string;
32
- };
33
- integration?: {
34
- actorId: string;
35
- targetRef: string;
36
- observedRef: string;
37
- observedPaths?: string[];
38
- };
39
- createdAt: string;
40
- }
41
- export declare function validateArtifactMutationReceipt(value: unknown): {
42
- ok: false;
43
- reason: string;
44
- value?: undefined;
45
- } | {
46
- ok: true;
47
- value: ArtifactMutationReceipt;
48
- reason?: undefined;
49
- };
@@ -1,36 +0,0 @@
1
- const ARTIFACT_MUTATION_RECEIPT_SCHEMA = "treeseed.artifact-mutation-receipt/v1";
2
- function exactRef(value) {
3
- return typeof value === "string" && value.trim().length > 0 && !/^(?:HEAD|main|master|staging|latest)$/iu.test(value.trim());
4
- }
5
- function digest(value) {
6
- return value == null || typeof value === "string" && /^(?:sha256:)?[a-f0-9]{64}$/u.test(value);
7
- }
8
- function validateArtifactMutationReceipt(value) {
9
- const receipt = value && typeof value === "object" && !Array.isArray(value) ? value : {};
10
- const problems = [];
11
- if (receipt.schemaVersion !== ARTIFACT_MUTATION_RECEIPT_SCHEMA) problems.push("schemaVersion");
12
- for (const key of ["id", "assignmentId", "modeRunId", "teamId", "projectId"]) if (!exactRef(receipt[key])) problems.push(key);
13
- if (!["treedx-content", "source-checkpoint"].includes(String(receipt.kind))) problems.push("kind");
14
- if (!["provisional", "integrated"].includes(String(receipt.phase))) problems.push("phase");
15
- if (!["simulation", "production"].includes(String(receipt.executionMode))) problems.push("executionMode");
16
- if (!["denied", "checkpoint-only", "exact-approved-ref"].includes(String(receipt.upstreamMutationPolicy))) problems.push("upstreamMutationPolicy");
17
- if (receipt.executionMode === "simulation" && receipt.upstreamMutationPolicy !== "denied") problems.push("upstreamMutationPolicy");
18
- if (receipt.phase === "provisional" && receipt.upstreamMutationPolicy === "exact-approved-ref") problems.push("upstreamMutationPolicy");
19
- if (receipt.phase === "integrated" && receipt.executionMode === "production" && receipt.upstreamMutationPolicy !== "exact-approved-ref") problems.push("upstreamMutationPolicy");
20
- if (!exactRef(receipt.baseRef)) problems.push("baseRef");
21
- if (!exactRef(receipt.effectiveRef)) problems.push("effectiveRef");
22
- if (receipt.baseRef === receipt.effectiveRef) problems.push("effectiveRef");
23
- if (!Array.isArray(receipt.changedPaths) || !receipt.changedPaths.length || receipt.changedPaths.some((path) => typeof path !== "string" || !path.trim())) problems.push("changedPaths");
24
- for (const key of ["before", "after"]) {
25
- const evidence = receipt[key];
26
- if (!evidence || !exactRef(evidence.ref) || !Array.isArray(evidence.artifactRefs) || !digest(evidence.digest)) problems.push(key);
27
- }
28
- if (receipt.before?.ref !== receipt.baseRef) problems.push("before.ref");
29
- if (receipt.after?.ref !== receipt.effectiveRef) problems.push("after.ref");
30
- if (!receipt.createdAt || Number.isNaN(Date.parse(receipt.createdAt))) problems.push("createdAt");
31
- return problems.length ? { ok: false, reason: `Artifact mutation receipt has invalid fields: ${[...new Set(problems)].join(", ")}.` } : { ok: true, value: receipt };
32
- }
33
- export {
34
- ARTIFACT_MUTATION_RECEIPT_SCHEMA,
35
- validateArtifactMutationReceipt
36
- };
@@ -1,123 +0,0 @@
1
- import type { ExecutionUsageActual } from '../types/agents.js';
2
- import type { ResearchCitation } from './contracts/support/research-citation.js';
3
- import { type ArtifactMutationReceipt } from './artifact-mutation-receipt.js';
4
- export interface AgentToolEventReference {
5
- id: string;
6
- toolId: string;
7
- status: 'completed' | 'failed';
8
- operation?: string | null;
9
- startedAt?: string | null;
10
- completedAt?: string | null;
11
- durationMs?: number | null;
12
- derivedEventTypes: string[];
13
- capturedInputRef?: string | null;
14
- capturedOutputRef?: string | null;
15
- }
16
- export interface AgentContentReference {
17
- model: string;
18
- contentPath: string;
19
- receiptId: string;
20
- toolEventId: string;
21
- subjectId?: string | null;
22
- subjectField?: string | null;
23
- artifactKind?: string | null;
24
- producedByAgent?: string | null;
25
- commitSha?: string | null;
26
- ref?: string | null;
27
- groupIds?: string[];
28
- }
29
- export interface AgentSourceWorktreeReference {
30
- root?: string | null;
31
- branch?: string | null;
32
- baseRef?: string | null;
33
- changedPaths: string[];
34
- }
35
- export interface AgentCommitReference {
36
- sha: string;
37
- ref?: string | null;
38
- message?: string | null;
39
- }
40
- export interface AgentVerificationResult {
41
- status: 'passed' | 'failed' | 'not-run' | 'unknown' | string;
42
- summary?: string | null;
43
- commands?: string[];
44
- evidenceRefs?: string[];
45
- }
46
- export interface AgentSignal {
47
- code: string;
48
- severity: 'info' | 'warning' | 'error';
49
- message?: string | null;
50
- metadata?: Record<string, unknown>;
51
- }
52
- export interface AgentControlPlaneReference {
53
- kind: string;
54
- id: string;
55
- status?: string | null;
56
- metadata?: Record<string, unknown>;
57
- }
58
- export interface AgentDiagnosticReference {
59
- code: string;
60
- message?: string | null;
61
- retryable?: boolean | null;
62
- evidenceRef?: string | null;
63
- }
64
- export interface ArtifactRef {
65
- contract: 'treeseed.artifact-ref/v1';
66
- kind: 'treedx-content' | 'repository-file' | 'r2-object' | 'verification-evidence' | 'provider-input' | 'provider-output' | 'citation' | 'source-commit';
67
- repositoryId?: string;
68
- workspaceId?: string;
69
- path?: string;
70
- commitSha?: string | null;
71
- objectKey?: string;
72
- sha256: string | null;
73
- byteLength?: number;
74
- mediaType?: string;
75
- visibility: 'private' | 'assignment' | 'project' | 'team' | 'public';
76
- assignmentId?: string;
77
- toolCallId?: string;
78
- eventId?: string;
79
- provenance?: Record<string, string>;
80
- }
81
- /** Portable, secret-free terminal evidence emitted by AgentKernel. */
82
- export interface AgentArtifactManifest {
83
- schemaVersion: 1;
84
- assignmentId: string;
85
- modeRunId: string;
86
- teamId: string;
87
- projectId: string;
88
- workDayId?: string | null;
89
- providerId: string;
90
- runnerId?: string | null;
91
- executionProviderId?: string | null;
92
- mode: 'planning' | 'acting';
93
- agentClassId: string;
94
- agentId: string;
95
- handlerId: string;
96
- activityType: string;
97
- status: 'completed' | 'returned' | 'failed';
98
- summary: string;
99
- toolEvents: AgentToolEventReference[];
100
- contentReferences: AgentContentReference[];
101
- mutationReceipts?: ArtifactMutationReceipt[];
102
- artifactReferences?: ArtifactRef[];
103
- sourceWorktree?: AgentSourceWorktreeReference;
104
- commit?: AgentCommitReference;
105
- verification: AgentVerificationResult[];
106
- citations: ResearchCitation[];
107
- signals: AgentSignal[];
108
- controlPlaneReferences?: AgentControlPlaneReference[];
109
- usage: ExecutionUsageActual[];
110
- diagnostics: AgentDiagnosticReference[];
111
- createdAt: string;
112
- }
113
- export declare function validateAgentArtifactManifest(manifest: AgentArtifactManifest, expected?: {
114
- publishedSignals?: unknown;
115
- artifactContracts?: unknown;
116
- signalContracts?: unknown;
117
- }): {
118
- ok: false;
119
- reason: string;
120
- } | {
121
- ok: true;
122
- reason?: undefined;
123
- };
@@ -1,39 +0,0 @@
1
- import { validateResearchCitations } from "./validation/research/citation.js";
2
- import { validateArtifactMutationReceipt } from "./artifact-mutation-receipt.js";
3
- function validateAgentArtifactManifest(manifest, expected = {}) {
4
- const invalidReceipt = (manifest.mutationReceipts ?? []).find((receipt) => {
5
- const validation = validateArtifactMutationReceipt(receipt);
6
- return !validation.ok || receipt.assignmentId !== manifest.assignmentId || receipt.modeRunId !== manifest.modeRunId || receipt.teamId !== manifest.teamId || receipt.projectId !== manifest.projectId;
7
- });
8
- if (invalidReceipt) return { ok: false, reason: "Artifact mutation receipt is invalid or outside the manifest authority scope." };
9
- if ((manifest.artifactReferences ?? []).some((reference) => reference.contract !== "treeseed.artifact-ref/v1" || typeof reference.sha256 === "string" && !/^[0-9a-f]{64}$/u.test(reference.sha256) || "signedUrl" in reference || "credentials" in reference)) {
10
- return { ok: false, reason: "Artifact references must be stable, digest-addressed, and secret-free." };
11
- }
12
- const citationValidation = validateResearchCitations(manifest.citations, "artifactManifest.citations");
13
- if (!citationValidation.ok) {
14
- return { ok: false, reason: citationValidation.diagnostics.map((diagnostic) => `${diagnostic.code} at ${diagnostic.path}`).join(", ") };
15
- }
16
- if (manifest.status !== "completed") return { ok: true };
17
- const ids = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && Boolean(entry.trim())).map((entry) => entry.replace(/_/gu, "-")) : [];
18
- const producedSignals = new Set(manifest.signals.map((signal) => signal.code.replace(/_/gu, "-")));
19
- const requestedSignals = [...ids(expected.publishedSignals), ...ids(expected.signalContracts)];
20
- const missingSignals = requestedSignals.filter((id) => !producedSignals.has(id));
21
- if (missingSignals.length) return {
22
- ok: false,
23
- reason: `Completed agent execution omitted validated publications: ${missingSignals.map((id) => `signal:${id}`).join(", ")}.`
24
- };
25
- const producedArtifacts = new Set(manifest.contentReferences.map((reference) => reference.artifactKind?.replace(/_/gu, "-")).filter(Boolean));
26
- const missingArtifacts = ids(expected.artifactContracts).filter((id) => !producedArtifacts.has(id));
27
- if (missingArtifacts.length) return {
28
- ok: false,
29
- reason: `Completed agent execution omitted validated publications: ${missingArtifacts.map((id) => `artifact:${id}`).join(", ")}.`
30
- };
31
- if (manifest.contentReferences.some((reference) => reference.model === "note" && (!reference.subjectId || !reference.subjectField))) {
32
- return { ok: false, reason: "Completed note receipt is missing its validated subject link." };
33
- }
34
- if (manifest.contentReferences.length || manifest.sourceWorktree || manifest.verification.length || manifest.controlPlaneReferences?.length) return { ok: true };
35
- return { ok: false, reason: "Completed agent execution did not produce a TreeDX content receipt, durable control-plane output, source worktree change, or verification result." };
36
- }
37
- export {
38
- validateAgentArtifactManifest
39
- };
@@ -1,227 +0,0 @@
1
- import type { ContentReference } from '../../../content/contracts.js';
2
- import type { AgentArtifactManifest } from '../../artifacts.js';
3
- import type { GroupMembershipSnapshot } from '../../../governance/groups/contracts.js';
4
- export type AgentPlanningActivityType = 'planning' | 'estimating' | 'reviewing' | 'reporting';
5
- export type ContentRef = ContentReference;
6
- export type AgentEstimateConfidence = 'low' | 'medium' | 'high';
7
- export type AgentEstimateRiskLevel = 'low' | 'medium' | 'high';
8
- export type DecisionDependencyType = 'artifact' | 'capability' | 'decision' | 'external-resource' | 'human-input';
9
- export type StructuredAgentEstimateStatus = 'submitted' | 'accepted' | 'rejected' | 'superseded';
10
- export interface ExactGovernanceRevision {
11
- id: string;
12
- version: number;
13
- digest: string;
14
- }
15
- export interface ProviderNativeEstimateRange {
16
- unit: string;
17
- minimum: number;
18
- expected: number;
19
- maximum: number;
20
- providerCapabilities?: string[];
21
- }
22
- export interface AgentOutputRequirement {
23
- id?: string;
24
- outputType: string;
25
- description?: string;
26
- contentModel?: string;
27
- required?: boolean;
28
- metadata?: Record<string, unknown>;
29
- }
30
- export interface DecisionDependencySpec {
31
- id: string;
32
- type: DecisionDependencyType;
33
- requiredBefore: 'start' | 'complete' | 'review' | 'release';
34
- optional?: boolean;
35
- deliverableType?: string;
36
- capability?: string;
37
- contentRefs?: string[];
38
- humanInputPolicy?: {
39
- requiredFrom: 'team-human' | 'any-human' | 'any-human-or-agent';
40
- teamId?: string | null;
41
- };
42
- summary?: string;
43
- }
44
- export interface StructuredAgentEstimate {
45
- schemaVersion?: 1 | 2 | 3;
46
- id: string;
47
- teamId: string;
48
- projectId: string;
49
- decisionId?: string | null;
50
- proposalId?: string | null;
51
- workUnitId?: string | null;
52
- agentClass: string;
53
- agentId?: string | null;
54
- minSeconds: number;
55
- expectedSeconds: number;
56
- maxSeconds: number;
57
- confidence: AgentEstimateConfidence;
58
- riskLevel: AgentEstimateRiskLevel;
59
- assumptions: string[];
60
- blockers: string[];
61
- dependencies: DecisionDependencySpec[];
62
- expectedOutputs: AgentOutputRequirement[];
63
- acceptanceCriteria: string[];
64
- completionEvidence: string[];
65
- workBreakdown?: {
66
- preparationSeconds: number;
67
- implementationSeconds: number;
68
- verificationSeconds: number;
69
- independentReviewSeconds: number;
70
- revisionSeconds: number;
71
- revisionVerificationSeconds: number;
72
- finalReviewSeconds: number;
73
- reportingSeconds: number;
74
- reserveSeconds: number;
75
- expectedRevisionCycles: number;
76
- };
77
- groupSnapshot?: GroupMembershipSnapshot;
78
- proposalRevision?: ExactGovernanceRevision;
79
- decisionRevision?: ExactGovernanceRevision;
80
- providerNativeRanges?: ProviderNativeEstimateRange[];
81
- requiredProviderCapabilities?: string[];
82
- acceptableProviderClasses?: string[];
83
- agentDefinitionRevision?: {
84
- id: string;
85
- revision: number;
86
- digest: string;
87
- };
88
- createdAt?: string | null;
89
- metadata?: Record<string, unknown>;
90
- }
91
- export interface StructuredAgentEstimateRecord extends StructuredAgentEstimate {
92
- status: StructuredAgentEstimateStatus;
93
- acceptedAt: string | null;
94
- rejectedAt: string | null;
95
- }
96
- export interface DeliverableContract {
97
- id: string;
98
- teamId: string;
99
- projectId: string;
100
- decisionId: string;
101
- deliverableType: string;
102
- producerAgentClasses: string[];
103
- reviewerAgentClasses?: string[];
104
- requiredSections?: string[];
105
- acceptanceCriteria: string[];
106
- status: 'required' | 'draft' | 'submitted' | 'approved' | 'rejected' | 'stale';
107
- metadata?: Record<string, unknown>;
108
- }
109
- export interface DeliverableContractRecord extends DeliverableContract {
110
- createdAt: string;
111
- updatedAt: string;
112
- }
113
- export interface DeliverableSourceAuthority {
114
- assignmentId: string;
115
- modeRunId: string;
116
- baseRef: string;
117
- effectiveRef: string;
118
- checkpointCommit?: string | null;
119
- }
120
- export interface DeliverableManifest {
121
- id: string;
122
- deliverableContractId: string;
123
- projectId: string;
124
- decisionId: string;
125
- producedRefs: ContentRef[];
126
- coverage?: Record<string, ContentRef[]>;
127
- summary: string;
128
- readyForReview: boolean;
129
- submittedByAgentId?: string | null;
130
- submittedAt?: string | null;
131
- sourceAuthority?: DeliverableSourceAuthority;
132
- metadata?: Record<string, unknown>;
133
- }
134
- export interface DeliverableManifestRecord extends DeliverableManifest {
135
- createdAt: string;
136
- }
137
- /** Authenticated, secret-free evidence projected from a completed graph ancestor. */
138
- export interface GovernedPredecessorEvidence {
139
- graphNodeId: string;
140
- stage: string | null;
141
- deliverableContractId: string;
142
- deliverableType: string;
143
- contractStatus: 'approved' | 'rejected';
144
- deliverableManifest: DeliverableManifestRecord;
145
- artifactManifest: AgentArtifactManifest;
146
- }
147
- /** API-owned review policy projected from the accepted workflow and current graph state. */
148
- export interface GovernedReviewPolicy {
149
- requireRevisionCycle: boolean;
150
- completedRevisionCycles: number;
151
- requiredDisposition: 'rejected' | null;
152
- }
153
- export interface DecisionAssignmentGraphNode {
154
- id: string;
155
- decisionId: string;
156
- projectId: string;
157
- targetAgentClass: string;
158
- activityType: AgentPlanningActivityType | 'acting';
159
- handler?: string | null;
160
- estimateId?: string | null;
161
- groupSnapshot?: GroupMembershipSnapshot;
162
- requiredCapabilities: string[];
163
- requiredDeliverableContractIds: string[];
164
- inputRefs: ContentRef[];
165
- outputRequirements: AgentOutputRequirement[];
166
- capacity: {
167
- expectedSeconds: number;
168
- maxSeconds: number;
169
- };
170
- status: 'pending' | 'ready' | 'leased' | 'running' | 'blocked' | 'completed' | 'failed' | 'cancelled';
171
- metadata?: Record<string, unknown>;
172
- }
173
- export interface DecisionAssignmentGraphEdge {
174
- fromNodeId: string;
175
- toNodeId: string;
176
- edgeType: 'blocks-start' | 'blocks-completion' | 'blocks-release';
177
- reason?: string;
178
- }
179
- export interface DecisionAssignmentGraph {
180
- id: string;
181
- teamId: string;
182
- projectId: string;
183
- decisionId: string;
184
- version: number;
185
- status: 'draft' | 'compiled' | 'ready' | 'executing' | 'completed' | 'blocked';
186
- estimateIds: string[];
187
- deliverableContracts: DeliverableContract[];
188
- nodes: DecisionAssignmentGraphNode[];
189
- edges: DecisionAssignmentGraphEdge[];
190
- compiledAt?: string | null;
191
- compiledBy: 'api-control-plane';
192
- executionMode?: import('./authority/execution-mode.js').AgentWorkExecutionMode;
193
- metadata?: Record<string, unknown>;
194
- }
195
- export interface DecisionAssignmentGraphRecord extends DecisionAssignmentGraph {
196
- active: boolean;
197
- createdAt: string;
198
- updatedAt: string;
199
- }
200
- export interface AgentCapacityContractDiagnostic {
201
- severity: 'info' | 'warning' | 'error';
202
- code: string;
203
- message: string;
204
- path?: string;
205
- }
206
- export interface AgentCapacityContractValidationResult {
207
- ok: boolean;
208
- diagnostics: AgentCapacityContractDiagnostic[];
209
- }
210
- export interface DecisionAssignmentGraphCompileResult {
211
- graph: DecisionAssignmentGraph;
212
- diagnostics: AgentCapacityContractDiagnostic[];
213
- }
214
- export interface GovernedRevisionCycleResult {
215
- graph: DecisionAssignmentGraph;
216
- newContracts: DeliverableContract[];
217
- revisionCycle: number;
218
- }
219
- export interface GovernedRevisionCycleInput {
220
- rejectedReviewNodeId: string;
221
- rejectedCheckpointRef: string;
222
- findingsRef: string;
223
- reason: string;
224
- actorAgentClass: string;
225
- reviewerAgentClass: string;
226
- availableSeconds: number;
227
- }
@@ -1,12 +0,0 @@
1
- import type { CapacityAllocationSetV2, CapacityGrantV2 } from '../allocation.js';
2
- export interface CapacityAllocationDiagnostic {
3
- code: string;
4
- path: string;
5
- message: string;
6
- }
7
- export interface CapacityAllocationValidation {
8
- ok: boolean;
9
- diagnostics: CapacityAllocationDiagnostic[];
10
- }
11
- export declare function validateCapacityGrantV2(grant: CapacityGrantV2): CapacityAllocationValidation;
12
- export declare function validateCapacityAllocationSetV2(set: CapacityAllocationSetV2): CapacityAllocationValidation;