@treeseed/sdk 0.13.0-rc.121 → 0.13.0-rc.123
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/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +2365 -1275
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +94 -28
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +38 -38
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.d.ts +2 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-path.js +13 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +2 -59
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +126 -1
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +35 -1
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +2 -4
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +22 -16
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +3 -42
- package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +8 -8
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +244 -85
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +216 -70
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +1 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +0 -2
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +55 -55
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -23
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +2 -154
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +0 -13
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +496 -292
- package/dist/agent-capacity/contracts/support/execution-graph.js +21 -19
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +3 -6
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +1 -87
- package/dist/agent-capacity/grant.d.ts +34 -0
- package/dist/agent-capacity/grant.js +4 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +1178 -1152
- package/dist/agent-capacity/validation/agent-definition-schema.js +21 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +10 -10
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +0 -1
- package/dist/agent-capacity/validation/assignment-records.d.ts +1 -6
- package/dist/agent-capacity/validation/assignment-records.js +49 -35
- package/dist/agent-capacity/validation/configuration.d.ts +1 -1
- package/dist/agent-capacity/validation/configuration.js +2 -6
- package/dist/agent-capacity/validation/grant.d.ts +11 -0
- package/dist/agent-capacity/validation/grant.js +31 -0
- package/dist/capacity/agents/agent-capacity.d.ts +3 -4
- package/dist/capacity/agents/agent-capacity.js +2 -3
- package/dist/capacity-provider/capability-ontology.d.ts +150 -150
- package/dist/capacity-provider/client.d.ts +15 -9
- package/dist/capacity-provider/client.js +1 -10
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +44 -44
- package/dist/capacity-provider/contracts/governance.d.ts +2 -17
- package/dist/capacity-provider/contracts/index.d.ts +2 -0
- package/dist/capacity-provider/contracts/index.js +2 -0
- package/dist/capacity-provider/core-capability-catalog.d.ts +7 -7
- package/dist/capacity-provider/environment-catalog.d.ts +188 -188
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +2 -2
- package/dist/capacity-provider/sandbox-contracts.d.ts +92 -92
- package/dist/capacity-provider/source-workspace.d.ts +166 -68
- package/dist/capacity-provider/source-workspace.js +5 -1
- package/dist/capacity-provider/validation.d.ts +10 -2
- package/dist/capacity-provider/validation.js +52 -22
- package/dist/content/validation/agent-operational-content-schemas.d.ts +144 -142
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +158 -158
- package/dist/content/validation/content-model-schemas.d.ts +9105 -5295
- package/dist/content/validation/content-model-schemas.js +192 -115
- package/dist/content/validation/portable-content-data.d.ts +411 -238
- package/dist/content/validation/portable-content-data.js +6 -1
- package/dist/content/validation/schema-constraints.d.ts +78 -0
- package/dist/content/validation/schema-constraints.js +149 -0
- package/dist/deployment/ai/storage.d.ts +24 -24
- package/dist/deployment/ai-hosting.d.ts +18 -18
- package/dist/deployment/ai-instance.d.ts +16 -16
- package/dist/deployment/ai-mode.d.ts +92 -92
- package/dist/deployment/hosted-topology-template.d.ts +44 -44
- package/dist/deployment/hosted-topology.d.ts +335 -335
- package/dist/deployment/postgres/contracts.d.ts +52 -52
- package/dist/deployment/postgres/transfer.d.ts +6 -6
- package/dist/deployment/schemas.d.ts +1114 -1114
- package/dist/development/schemas.d.ts +633 -633
- package/dist/graph/context-query-contracts.js +1 -1
- package/dist/guarantees/index.d.ts +26 -2
- package/dist/identity/contracts.js +6 -1
- package/dist/knowledge/contracts.d.ts +9 -2
- package/dist/knowledge/contracts.js +2 -2
- package/dist/model-registry/discussion-models.js +0 -1
- package/dist/operator-contracts/canonical-command-tree.js +25 -9
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +29 -29
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +30 -30
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +15 -13
- package/dist/operator-contracts/catalog/communication-operations.d.ts +176 -158
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +67 -67
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +65 -65
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +6 -6
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +10 -10
- package/dist/operator-contracts/catalog/provider-environment-operations.d.ts +3 -3
- package/dist/operator-contracts/catalog/services/secret-operations.d.ts +16 -8
- package/dist/operator-contracts/catalog/services/secret-operations.js +2 -1
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +11 -11
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +3 -0
- package/dist/operator-contracts/communication/contracts.d.ts +537 -395
- package/dist/operator-contracts/communication/contracts.js +6 -1
- package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
- package/dist/operator-contracts/control-plane-operation.js +6 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +631 -610
- package/dist/operator-contracts/control-plane-operations.js +26 -12
- package/dist/operator-contracts/inbox/contracts.d.ts +229 -229
- package/dist/operator-contracts/knowledge/contracts.d.ts +16 -16
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -0
- package/dist/operator-contracts/workday-lifecycle.js +109 -45
- package/dist/platform/agent-schema-verification.d.ts +3 -0
- package/dist/platform/agent-schema-verification.js +377 -0
- package/dist/platform/contracts.d.ts +72 -72
- package/dist/platform/schemas.d.ts +144 -36
- package/dist/platform/schemas.js +26 -0
- package/dist/platform/verification.js +10 -0
- package/dist/sdk-types/support/planning-policy.d.ts +1 -1
- package/dist/sdk-types/support/sdk-search-request.d.ts +2 -2
- package/dist/secrets-capability/secret-contracts.d.ts +2 -2
- package/dist/secrets-capability/shared-access.d.ts +3 -3
- package/dist/secrets-capability/shared-resources.d.ts +50 -50
- package/dist/secrets-capability/vault-contracts.d.ts +2 -2
- package/dist/security/encrypted-envelope.d.ts +14 -14
- package/dist/treedx/client.d.ts +4 -4
- package/dist/treedx/index.d.ts +1 -1
- package/dist/treedx/index.js +1 -0
- package/dist/treedx/types.d.ts +286 -0
- package/dist/treedx/types.js +44 -0
- package/guarantees/agent/golden/component-boundaries.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product-custody.guarantee.yaml +12 -0
- package/guarantees/agent/golden/product.guarantee.yaml +12 -0
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +837 -0
- package/guarantees/agent/golden/scenes/product-custody.scene.yaml +53 -0
- package/guarantees/agent/golden/scenes/product.scene.yaml +8 -0
- package/guarantees/verifiers/golden.verifiers.yaml +1429 -0
- package/package.json +9 -3
- package/tests/acceptance/golden-product.test.ts +205 -0
- package/tests/acceptance/golden-product.ts +404 -0
- package/tests/acceptance/product/base-red.ts +73 -0
- package/tests/acceptance/product/documentation-examples.ts +68 -0
- package/tests/acceptance/product/intent-runtime.ts +145 -0
- package/tests/acceptance/product/release-output.ts +160 -0
- package/tests/acceptance/product/research-artifact.ts +87 -0
- package/tests/acceptance/product/research-revision.ts +82 -0
- package/tests/acceptance/product/research-source.ts +91 -0
- package/tests/acceptance/product/test-chain.ts +192 -0
- package/treeseed.package.yaml +147 -0
- package/dist/.treeseed-build-complete.json +0 -1
- package/dist/agent-capacity/allocation.d.ts +0 -183
- package/dist/agent-capacity/allocation.js +0 -5
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +0 -49
- package/dist/agent-capacity/artifact-mutation-receipt.js +0 -36
- package/dist/agent-capacity/artifacts.d.ts +0 -123
- package/dist/agent-capacity/artifacts.js +0 -39
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +0 -227
- package/dist/agent-capacity/contracts/support/decision-work.js +0 -0
- package/dist/agent-capacity/validation/allocation.d.ts +0 -12
- package/dist/agent-capacity/validation/allocation.js +0 -115
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {verifySdkDocumentationExamples} from './documentation-examples.ts';
|
|
2
|
+
export {verifySdkDocumentationExamples} from './documentation-examples.ts';
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { existsSync, lstatSync, realpathSync } from 'node:fs';
|
|
7
|
+
import { isAbsolute, join } from 'node:path';
|
|
8
|
+
import { assignmentReferenceSchema, type AssignmentAttempt, type AssignmentReference, type AssignmentResult } from '@treeseed/sdk/agent-capacity';
|
|
9
|
+
import { sourceWorkspaceKeySchema, sourceWorkspaceAuthorizationSchema } from '@treeseed/sdk/capacity-provider/sandbox';
|
|
10
|
+
|
|
11
|
+
export type PublishedSourceAttempt = Pick<AssignmentAttempt, 'id' | 'teamId' | 'projectId' | 'attempt' | 'workspace'>
|
|
12
|
+
& { provider: Pick<AssignmentAttempt['provider'], 'providerId'> };
|
|
13
|
+
|
|
14
|
+
const failure = 'ACCEPTANCE_SDK_NATIVE_TEST_CHAIN';
|
|
15
|
+
/** Join original reviewed predecessors; workspace compilation remains API-owned. */
|
|
16
|
+
export function verifySdkReviewedSourceInput(next: Pick<AssignmentAttempt, 'workspace' | 'predecessorResultIds' | 'createdAt'>,
|
|
17
|
+
predecessor: Pick<AssignmentResult, 'id'>, review: Pick<AssignmentResult, 'id' | 'completedAt'>, reference: AssignmentReference): void {
|
|
18
|
+
assert.ok(reference.kind === 'git', failure);
|
|
19
|
+
assert.ok(next.predecessorResultIds.includes(predecessor.id) && next.predecessorResultIds.includes(review.id), failure);
|
|
20
|
+
assert.ok(next.workspace.mode === 'git' && next.workspace.repository === reference.repository, failure);
|
|
21
|
+
assert.ok(Date.parse(review.completedAt) <= Date.parse(next.createdAt), failure);
|
|
22
|
+
}
|
|
23
|
+
const object = (value: unknown): Record<string, unknown> => {
|
|
24
|
+
assert.ok(value && typeof value === 'object' && !Array.isArray(value), failure);
|
|
25
|
+
return value as Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** The existing fixed public owning inventory supplies the locator, never an operator path. */
|
|
29
|
+
export function sdkPublishedRepository(workspace: unknown, sandboxId: string, attempt: PublishedSourceAttempt, reference: AssignmentReference) {
|
|
30
|
+
const observation = object(workspace), scope = object(observation.scope), journals = object(observation.journals);
|
|
31
|
+
assert.equal(observation.complete, true, failure); assert.deepEqual(observation.errors, [], failure);
|
|
32
|
+
assert.equal(scope.storageRoot, '/var/lib/treeseed/agent/workspaces', failure);
|
|
33
|
+
assert.match(sandboxId, /^sandbox-[A-Za-z0-9-]{1,128}$/u, failure);
|
|
34
|
+
assert.deepEqual(object(observation.confirmation).journals, journals, failure);
|
|
35
|
+
const entry = (kind: string) => {
|
|
36
|
+
const inventory = object(journals[kind]); assert.equal(inventory.rootPresent, true, failure);
|
|
37
|
+
assert.ok(Array.isArray(inventory.entries), failure);
|
|
38
|
+
const matches = inventory.entries.map(object).filter(item => item.name === `${sandboxId}.json`);
|
|
39
|
+
assert.equal(matches.length, 1, failure); const value = matches[0]!;
|
|
40
|
+
assert.equal(value.type, 'file', failure); assert.match(String(value.digest), /^[a-f0-9]{64}$/u, failure);
|
|
41
|
+
return object(value.metadata);
|
|
42
|
+
};
|
|
43
|
+
const job = entry('jobs'), result = entry('results');
|
|
44
|
+
assert.equal(job.schemaVersion, 'treeseed.assignment-source-job/v1', failure);
|
|
45
|
+
assert.deepEqual(job.owner, { assignmentId: attempt.id, providerId: attempt.provider.providerId,
|
|
46
|
+
teamId: attempt.teamId, projectId: attempt.projectId, attempt: attempt.attempt }, failure);
|
|
47
|
+
assert.equal(result.schemaVersion, 'treeseed.source-result/v1', failure);
|
|
48
|
+
assert.equal(result.sandboxId, sandboxId, failure); assert.equal(result.leaseId, job.leaseId, failure);
|
|
49
|
+
assert.ok(typeof result.leaseId === 'string' && result.leaseId.length > 0, failure);
|
|
50
|
+
assert.equal(result.status, 'completed', failure); assert.equal(result.teardownVerified, true, failure);
|
|
51
|
+
const source = sourceWorkspaceKeySchema.parse(result.source);
|
|
52
|
+
assert.equal(source.teamId, attempt.teamId, failure); assert.equal(source.projectId, attempt.projectId, failure);
|
|
53
|
+
assert.equal(attempt.workspace.mode, 'git', failure);
|
|
54
|
+
assert.ok(attempt.workspace.mode === 'git'); assert.equal(source.commit, attempt.workspace.baseCommit, failure);
|
|
55
|
+
assert.equal(reference.kind, 'git', failure); assert.deepEqual(assignmentReferenceSchema.parse(result.sourceReference), reference, failure);
|
|
56
|
+
assert.ok(reference.kind === 'git'); assert.equal(reference.repository, attempt.workspace.repository, failure);
|
|
57
|
+
assert.equal(reference.branch, attempt.workspace.branch, failure);
|
|
58
|
+
const parsedAuthority = sourceWorkspaceAuthorizationSchema.safeParse(job.authority); assert.ok(parsedAuthority.success, failure);
|
|
59
|
+
const authority = parsedAuthority.data; assert.deepEqual(authority, job.authority, failure);
|
|
60
|
+
assert.equal(authority.assignmentId, attempt.id, failure); assert.equal(authority.providerId, attempt.provider.providerId, failure);
|
|
61
|
+
assert.equal(authority.attempt, attempt.attempt, failure); assert.deepEqual(authority.source, source, failure);
|
|
62
|
+
assert.equal(authority.mode, 'work', failure); assert.equal(authority.publication, 'simulation-branch', failure);
|
|
63
|
+
assert.ok(['upstream-public', 'simulation-local'].includes(authority.acquisition), failure);
|
|
64
|
+
assert.equal(Object.hasOwn(authority, 'credentialBindingId'), false, failure);
|
|
65
|
+
assert.equal(authority.publicationRef, reference.branch, failure);
|
|
66
|
+
|
|
67
|
+
const candidate = entry('candidates'), verification = object(candidate.verification);
|
|
68
|
+
assert.equal(candidate.state, 'published', failure);
|
|
69
|
+
assert.equal(candidate.assignmentId, attempt.id, failure); assert.equal(candidate.attempt, attempt.attempt, failure);
|
|
70
|
+
assert.equal(candidate.providerId, attempt.provider.providerId, failure); assert.equal(candidate.leaseId, job.leaseId, failure);
|
|
71
|
+
const candidateSource = sourceWorkspaceKeySchema.safeParse(candidate.source); assert.ok(candidateSource.success, failure);
|
|
72
|
+
assert.deepEqual(candidateSource.data, candidate.source, failure); assert.deepEqual(candidateSource.data, source, failure);
|
|
73
|
+
assert.equal(candidate.commit, reference.commit, failure); assert.equal(verification.baseCommit, attempt.workspace.baseCommit, failure);
|
|
74
|
+
assert.equal(verification.commit, reference.commit, failure);
|
|
75
|
+
assert.deepEqual(Object.keys(verification).sort(), ['ancestry', 'baseCommit', 'bytes', 'clean', 'commit', 'isolatedVerifier', 'objectClosure'], failure);
|
|
76
|
+
assert.ok(Number.isSafeInteger(verification.bytes) && Number(verification.bytes) > 0, failure);
|
|
77
|
+
for (const flag of ['clean', 'objectClosure', 'ancestry', 'isolatedVerifier']) assert.equal(verification[flag], true, failure);
|
|
78
|
+
assert.ok(typeof candidate.verifierId === 'string' && /^sandbox-warm-[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/u.test(candidate.verifierId), failure);
|
|
79
|
+
assert.equal(candidate.verifierStopped, true, failure);
|
|
80
|
+
assert.ok(typeof candidate.digest === 'string' && /^sha256:[a-f0-9]{64}$/u.test(candidate.digest), failure);
|
|
81
|
+
const repository = result.simulationRepository;
|
|
82
|
+
assert.ok(typeof repository === 'string' && /^\/var\/lib\/treeseed\/agent\/workspaces\/simulations\/[a-f0-9]{64}\.git$/u.test(repository), failure);
|
|
83
|
+
return repository;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function nativePublishedGit(repository: string) {
|
|
87
|
+
assert.ok(isAbsolute(repository), failure);
|
|
88
|
+
assert.equal(realpathSync(repository), repository, failure); assert.ok(lstatSync(repository).isDirectory(), failure);
|
|
89
|
+
assert.equal(existsSync(join(repository, 'objects/info/alternates')), false, failure);
|
|
90
|
+
assert.equal(existsSync(join(repository, 'shallow')), false, failure);
|
|
91
|
+
const git = (args: string[]) => execFileSync('/usr/bin/git', ['--no-replace-objects', `--git-dir=${repository}`,
|
|
92
|
+
'-c', 'core.hooksPath=/dev/null', ...args], { timeout: 5000, maxBuffer: 32 * 1024 * 1024,
|
|
93
|
+
env: { PATH: '/usr/bin:/bin', LANG: 'C', GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: '/dev/null' } });
|
|
94
|
+
assert.equal(git(['rev-parse', '--is-bare-repository']).toString().trim(), 'true', failure);
|
|
95
|
+
return git;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Resolve the original published assignment branch independently from its journal and result. */
|
|
99
|
+
export function verifySdkPublishedBranch(repository: string, reference: AssignmentReference) {
|
|
100
|
+
assert.equal(reference.kind, 'git', failure); assert.ok(reference.kind === 'git');
|
|
101
|
+
assert.ok(typeof reference.branch === 'string' && reference.branch.length > 0, failure);
|
|
102
|
+
assert.match(reference.commit, /^[a-f0-9]{40}$/u, failure);
|
|
103
|
+
const git = nativePublishedGit(repository), ref = `refs/heads/${reference.branch}`;
|
|
104
|
+
git(['check-ref-format', ref]);
|
|
105
|
+
assert.equal(git(['show-ref', '--verify', '--hash', ref]).toString().trim(), reference.commit, failure);
|
|
106
|
+
assert.equal(git(['rev-parse', '--verify', `${reference.commit}^{commit}`]).toString().trim(), reference.commit, failure);
|
|
107
|
+
assert.equal(git(['show-ref', '--verify', '--hash', ref]).toString().trim(), reference.commit, failure);
|
|
108
|
+
return reference.commit;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Inspect visible committed documentation, rather than metadata or comments alone. */
|
|
112
|
+
export function sdkDocumentationBody(bytes: Buffer): string {
|
|
113
|
+
const text = bytes.toString('utf8'); assert.deepEqual(Buffer.from(text), bytes, `${failure}: Documentation must be UTF-8`);
|
|
114
|
+
assert.ok(!text.includes('\0'), `${failure}: Binary documentation denied`);
|
|
115
|
+
return text.replace(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/u, '').replace(/<!--[\s\S]*?-->/gu, '').trim();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Independent native Git objects prove ancestry and exact approved test bytes. No product code is changed. */
|
|
119
|
+
export function verifySdkCommittedTests(repository: string, base: string, tester: string, engineer: string,
|
|
120
|
+
integration?: { writer: string; release: string; writerBase: string }) {
|
|
121
|
+
for (const commit of [base, tester, engineer]) assert.match(commit, /^[a-f0-9]{40}$/u, failure);
|
|
122
|
+
if (integration) {
|
|
123
|
+
for (const commit of [integration.writer, integration.release, integration.writerBase]) assert.ok(typeof commit === 'string' && /^[a-f0-9]{40}$/u.test(commit), failure);
|
|
124
|
+
assert.equal(integration.writerBase, engineer, `${failure}: Writer must start from the independently approved implementation`);
|
|
125
|
+
}
|
|
126
|
+
assert.equal(new Set([base, tester, engineer]).size, 3, failure);
|
|
127
|
+
const git = nativePublishedGit(repository);
|
|
128
|
+
for (const commit of [base, tester, engineer]) assert.equal(git(['rev-parse', '--verify', `${commit}^{commit}`]).toString().trim(), commit, failure);
|
|
129
|
+
git(['merge-base', '--is-ancestor', base, tester]); git(['merge-base', '--is-ancestor', tester, engineer]);
|
|
130
|
+
if (integration) {
|
|
131
|
+
for (const commit of [integration.writer, integration.release])
|
|
132
|
+
assert.equal(git(['rev-parse', '--verify', `${commit}^{commit}`]).toString().trim(), commit, failure);
|
|
133
|
+
git(['merge-base', '--is-ancestor', engineer, integration.writer]);
|
|
134
|
+
const changed = git(['diff', '--name-only', '--no-renames', '-z', engineer, integration.writer]).toString('utf8').split('\0').filter(Boolean);
|
|
135
|
+
assert.ok(changed.every(path => /^(?:[^/]+\.mdx?$|docs\/|examples\/)/u.test(path)),
|
|
136
|
+
`${failure}: Writer must preserve the independently approved implementation and test runner`);
|
|
137
|
+
const docs = changed.filter(path => /^(?:[^/]+\.mdx?|docs\/.+\.mdx?)$/u.test(path));
|
|
138
|
+
let documented = 0;
|
|
139
|
+
for (const path of docs) {
|
|
140
|
+
const entry = git(['ls-tree', '-z', integration.writer, '--', path]).toString('utf8');
|
|
141
|
+
if (!entry) continue; // Removed obsolete pages cannot count as the delivered documentation.
|
|
142
|
+
assert.ok(/^(100644|100755) blob [a-f0-9]{40}\t/u.test(entry), `${failure}: Writer deleted or redirected documentation`);
|
|
143
|
+
const body = sdkDocumentationBody(git(['cat-file', 'blob', `${integration.writer}:${path}`]));
|
|
144
|
+
assert.ok(body && /[\p{L}\p{N}]/u.test(body), `${failure}: Empty documentation is not a delivered product`);
|
|
145
|
+
const previous = git(['ls-tree', '-z', engineer, '--', path]);
|
|
146
|
+
if (previous.length && body === sdkDocumentationBody(git(['cat-file', 'blob', `${engineer}:${path}`]))) continue;
|
|
147
|
+
documented++;
|
|
148
|
+
}
|
|
149
|
+
assert.ok(documented > 0, `${failure}: Actual repository documentation must change`);
|
|
150
|
+
|
|
151
|
+
git(['merge-base', '--is-ancestor', integration.writer, integration.release]);
|
|
152
|
+
assert.equal(git(['rev-parse', `${integration.release}^{tree}`]).toString().trim(),
|
|
153
|
+
git(['rev-parse', `${integration.writer}^{tree}`]).toString().trim(), `${failure}: Integration contains unreviewed changes`);
|
|
154
|
+
}
|
|
155
|
+
const implementation = git(['diff', '--name-only', '--no-renames', '-z', tester, engineer]).toString('utf8').split('\0').filter(Boolean);
|
|
156
|
+
assert.ok(implementation.every(path => !path.startsWith('tests/') && !path.startsWith('scripts/')
|
|
157
|
+
&& !['package.json', 'package-lock.json', 'npm-shrinkwrap.json', '.npmrc'].includes(path)
|
|
158
|
+
&& !/^(?:vitest|vite|tsconfig)(?:\.[^/]+)?\.(?:ts|mts|cts|js|mjs|cjs|json)$/u.test(path)),
|
|
159
|
+
`${failure}: Engineer must retain every approved test and the original complete-suite runner`);
|
|
160
|
+
assert.ok(implementation.some(path => /^src\/.*\.ts$/u.test(path)
|
|
161
|
+
&& /^100(?:644|755) blob [a-f0-9]{40}\t/u.test(git(['ls-tree', '-z', engineer, '--', path]).toString('utf8'))),
|
|
162
|
+
`${failure}: Engineer must produce a native source implementation after approved tests`);
|
|
163
|
+
const changed = git(['diff', '--name-only', '--no-renames', '-z', base, tester]).toString('utf8').split('\0').filter(Boolean);
|
|
164
|
+
assert.ok(changed.length > 0 && new Set(changed).size === changed.length, failure);
|
|
165
|
+
assert.ok(changed.every(path => /^tests\//u.test(path) && !path.split('/').some(part => part === '..' || part === '.' || part === '')), failure);
|
|
166
|
+
assert.ok(changed.some(path => /\.(?:test|spec)\.ts$/u.test(path)), failure);
|
|
167
|
+
const tests = changed.map(path => {
|
|
168
|
+
const original = git(['ls-tree', '-z', tester, '--', path]), consumed = git(['ls-tree', '-z', engineer, '--', path]);
|
|
169
|
+
assert.deepEqual(consumed, original, `${failure}: Engineer changed approved test ${path}`);
|
|
170
|
+
if (integration) for (const commit of [integration.writer, integration.release])
|
|
171
|
+
assert.deepEqual(git(['ls-tree', '-z', commit, '--', path]), original, `${failure}: Integrated candidate changed approved test ${path}`);
|
|
172
|
+
const match = /^(100644|100755) blob ([a-f0-9]{40})\t([^\0]+)\0$/u.exec(original.toString('utf8'));
|
|
173
|
+
assert.ok(match && match[3] === path, `${failure}: Tester deleted or redirected test ${path}`);
|
|
174
|
+
const blob = git(['cat-file', 'blob', `${tester}:${path}`]);
|
|
175
|
+
assert.deepEqual(git(['cat-file', 'blob', `${engineer}:${path}`]), blob, failure);
|
|
176
|
+
return { path, mode: match[1]!, objectId: match[2]!, digest: createHash('sha256').update(blob).digest('hex') };
|
|
177
|
+
});
|
|
178
|
+
for (const commit of [base, tester, engineer]) assert.equal(git(['rev-parse', '--verify', `${commit}^{commit}`]).toString().trim(), commit, failure);
|
|
179
|
+
return tests;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export {verifySdkBaseRed,verifySdkIntentRuntime} from './base-red.ts';
|
|
183
|
+
|
|
184
|
+
/** Resolve actual Writer documentation bytes from the independently published native Git repository. */
|
|
185
|
+
export function verifySdkReferenceDocumentation(repository:string,engineer:string,writer:string):void{
|
|
186
|
+
const label='ACCEPTANCE_SDK_DOCUMENTATION';for(const commit of [engineer,writer])assert.match(commit,/^[a-f0-9]{40}$/u,label);
|
|
187
|
+
const git=nativePublishedGit(repository);git(['merge-base','--is-ancestor',engineer,writer]);
|
|
188
|
+
const paths=git(['diff','--name-only','--no-renames','-z',engineer,writer]).toString('utf8').split('\0').filter(path=>/^(?:[^/]+\.mdx?|docs\/.+\.mdx?)$/u.test(path));
|
|
189
|
+
const documents:string[]=[];for(const path of paths){const entry=git(['ls-tree','-z',writer,'--',path]).toString('utf8');if(!entry)continue;assert.ok(/^100(?:644|755) blob [a-f0-9]{40}\t/u.test(entry),label+': Redirected reference page');documents.push(sdkDocumentationBody(git(['cat-file','blob',writer+':'+path])));}
|
|
190
|
+
verifySdkDocumentationExamples(documents);
|
|
191
|
+
assert.equal(git(['rev-parse',writer+'^{commit}']).toString().trim(),writer,label);
|
|
192
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
id: "@treeseed/sdk"
|
|
2
|
+
name: TreeSeed SDK
|
|
3
|
+
kind: node-typescript
|
|
4
|
+
type: node-library
|
|
5
|
+
repository: treeseed-ai/sdk
|
|
6
|
+
publishTarget: npm
|
|
7
|
+
capabilities: { save: true, verify: true, publish: true, deploy: false, localOnly: false }
|
|
8
|
+
workflowTemplateVersion: "1"
|
|
9
|
+
githubEnvironments:
|
|
10
|
+
- production
|
|
11
|
+
requiredSecrets:
|
|
12
|
+
- NPM_TOKEN
|
|
13
|
+
verify:
|
|
14
|
+
fast: npm run test:contracts
|
|
15
|
+
local: npm run verify:direct
|
|
16
|
+
release: npm run release:verify
|
|
17
|
+
artifacts:
|
|
18
|
+
- provider: npm
|
|
19
|
+
name: "@treeseed/sdk"
|
|
20
|
+
releaseGate:
|
|
21
|
+
workflow: verify.yml
|
|
22
|
+
development:
|
|
23
|
+
schemaVersion: treeseed.development-runtime/v1
|
|
24
|
+
project: { id: sdk, repository: treeseed-ai/sdk }
|
|
25
|
+
defaults: { leaseSeconds: 14400, restoreOnFailure: true }
|
|
26
|
+
targets:
|
|
27
|
+
- id: package
|
|
28
|
+
kind: package-watch
|
|
29
|
+
platforms: [linux-amd64, linux-arm64, darwin-arm64, darwin-amd64]
|
|
30
|
+
runtimeRequirements: [node>=22]
|
|
31
|
+
sourceRoots: [src, scripts/build, scripts/development]
|
|
32
|
+
ignoredPaths: [dist, node_modules]
|
|
33
|
+
operations:
|
|
34
|
+
watch: { command: node, args: [--watch-path=src, --watch-path=package.json, --import, tsx, scripts/development/build-watch.ts], environment: {}, timeoutSeconds: 86400 }
|
|
35
|
+
build: { command: node, args: [--import, tsx, scripts/development/build-watch.ts], environment: {}, timeoutSeconds: 900 }
|
|
36
|
+
verify: { command: npm, args: [run, test:contracts], environment: {}, timeoutSeconds: 900 }
|
|
37
|
+
ready: { kind: marker, path: dist/.treeseed-build-complete.json, timeoutSeconds: 120 }
|
|
38
|
+
outputs: [{ path: dist, mediaType: application/vnd.treeseed.node-package, completionMarker: dist/.treeseed-build-complete.json, digestAlgorithm: sha256 }]
|
|
39
|
+
endpoints: []
|
|
40
|
+
dependencies: []
|
|
41
|
+
statePolicy: stateless
|
|
42
|
+
migrationPolicy: none
|
|
43
|
+
secretRefs: {}
|
|
44
|
+
shutdown: { graceSeconds: 10, activeWorkPolicy: block }
|
|
45
|
+
resources: {}
|
|
46
|
+
logs: [.treeseed/development/package.log]
|
|
47
|
+
forbiddenOperations: [publish, production-tag]
|
|
48
|
+
freeze:
|
|
49
|
+
kind: npm-package
|
|
50
|
+
operation: { command: npm, args: [pack, --json], environment: {}, timeoutSeconds: 900 }
|
|
51
|
+
artifacts: [treeseed-sdk-*.tgz]
|
|
52
|
+
contractOperations:
|
|
53
|
+
- { command: npm, args: [run, standards:build], environment: {}, timeoutSeconds: 900 }
|
|
54
|
+
- { command: npm, args: [run, standards:compatibility], environment: {}, timeoutSeconds: 900 }
|
|
55
|
+
promotion: { liveAdmissible: false, candidateRequiresVerification: true }
|
|
56
|
+
standards:
|
|
57
|
+
schemaVersion: 1
|
|
58
|
+
workflow:
|
|
59
|
+
enabled: true
|
|
60
|
+
acceptedBaseline:
|
|
61
|
+
packageName: "@treeseed/sdk"
|
|
62
|
+
packageVersion: "0.12.62"
|
|
63
|
+
sourceCommit: "d12a97fdd3fdca1358895a7a64fa2012197b2942"
|
|
64
|
+
npmIntegrity: "sha512-wR5ukK2pqw0fUE9gJMYgJmIUlMTy4NoYKJrHEo6NAN/QFNrpru+9vilaS4kCPrcZQl/YAleuv962Z8c/pwwrBQ=="
|
|
65
|
+
artifactDigest: "sha256:9ccef82ccd452905e5a1733a5ced81d6d629b0c0f0d893cf19ea1a3ed53bc9f5"
|
|
66
|
+
openApiSourceDigest: "sha256:53b87f22ad3b3e4a24f4050f764e9f27081c3968130431909a366b16baa9bebd"
|
|
67
|
+
produced:
|
|
68
|
+
- id: "@treeseed/sdk/typescript-public-api"
|
|
69
|
+
family: typescript
|
|
70
|
+
version: "1.0.0"
|
|
71
|
+
semanticRange: "^1.0.0"
|
|
72
|
+
source: dist
|
|
73
|
+
artifact: .treeseed/standards/typescript-public-api.json
|
|
74
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
75
|
+
- id: "@treeseed/sdk/openapi"
|
|
76
|
+
family: openapi
|
|
77
|
+
version: "1.0.0"
|
|
78
|
+
semanticRange: "^1.0.0"
|
|
79
|
+
source: docs/api/openapi.json
|
|
80
|
+
artifact: .treeseed/standards/openapi.json
|
|
81
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
82
|
+
- id: "@treeseed/sdk/control-plane-catalog"
|
|
83
|
+
family: json-schema
|
|
84
|
+
version: "1.0.0"
|
|
85
|
+
semanticRange: "^1.0.0"
|
|
86
|
+
source: src/operator-contracts/control-plane-operations.ts
|
|
87
|
+
artifact: .treeseed/standards/control-plane-catalog.json
|
|
88
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
89
|
+
- id: "@treeseed/sdk/guarantee-verifier-contract"
|
|
90
|
+
family: behavioral
|
|
91
|
+
version: "1.0.0"
|
|
92
|
+
semanticRange: "^1.0.0"
|
|
93
|
+
source: src/guarantees
|
|
94
|
+
artifact: .treeseed/standards/guarantee-verifier-contract.json
|
|
95
|
+
verifier: runUiEvidenceTrustVerifier
|
|
96
|
+
- id: "@treeseed/sdk/mcp-catalog-input"
|
|
97
|
+
family: behavioral
|
|
98
|
+
version: "1.0.0"
|
|
99
|
+
semanticRange: "^1.0.0"
|
|
100
|
+
source: src/operator-contracts/mcp.ts
|
|
101
|
+
artifact: .treeseed/standards/mcp-catalog-input.json
|
|
102
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
103
|
+
- id: "@treeseed/sdk/treedx-service-contract"
|
|
104
|
+
family: behavioral
|
|
105
|
+
version: "1.0.0"
|
|
106
|
+
semanticRange: "^1.0.0"
|
|
107
|
+
source: src/treedx/contract.ts
|
|
108
|
+
artifact: .treeseed/standards/treedx-service-contract.json
|
|
109
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
110
|
+
- id: "@treeseed/sdk/treeai-service-contract"
|
|
111
|
+
family: behavioral
|
|
112
|
+
version: "1.0.0"
|
|
113
|
+
semanticRange: "^1.0.0"
|
|
114
|
+
source: src/treeai/contract.ts
|
|
115
|
+
artifact: .treeseed/standards/treeai-service-contract.json
|
|
116
|
+
verifier: scripts/standards/compare-compatibility.ts
|
|
117
|
+
consumed:
|
|
118
|
+
- id: "@treeseed/treeai/openapi"
|
|
119
|
+
family: openapi
|
|
120
|
+
version: "0.11.0-rc2"
|
|
121
|
+
semanticRange: "0.11.0-rc2"
|
|
122
|
+
source: contracts/services/treeai/treeai-contract-release.json
|
|
123
|
+
artifact: contracts/services/treeai-adoption.json
|
|
124
|
+
verifier: scripts/standards/build-contract-bundle.ts
|
|
125
|
+
- id: "@treeseed/treedx/openapi"
|
|
126
|
+
family: openapi
|
|
127
|
+
version: "0.11.0"
|
|
128
|
+
semanticRange: "0.11.0"
|
|
129
|
+
source: node_modules/@treeseed/treedx/openapi.yaml
|
|
130
|
+
artifact: contracts/services/treedx-adoption.json
|
|
131
|
+
verifier: scripts/standards/build-contract-bundle.ts
|
|
132
|
+
guarantees:
|
|
133
|
+
- deterministic-contract-bundle
|
|
134
|
+
- exact-artifact-and-source-binding
|
|
135
|
+
- semantic-version-sufficiency
|
|
136
|
+
- artifact-bound-guarantee-evidence
|
|
137
|
+
- authoritative-treedx-service-adoption
|
|
138
|
+
- authoritative-treeai-service-adoption
|
|
139
|
+
deprecations: []
|
|
140
|
+
runtimes:
|
|
141
|
+
- node>=22
|
|
142
|
+
rollbackOperations:
|
|
143
|
+
- remove-prerelease-dist-tag
|
|
144
|
+
- restore-accepted-composition
|
|
145
|
+
projectArchitecture:
|
|
146
|
+
topology: package_only
|
|
147
|
+
rootPath: .
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"completedAt":"2026-09-19T18:29:15.010Z"}
|
|
@@ -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,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
|
-
};
|