@treeseed/sdk 0.13.0-rc.122 → 0.13.0-rc.124
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 +1392 -974
- package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +72 -27
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +34 -34
- 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 +1 -0
- 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 +1 -3
- package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +21 -15
- 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 +227 -66
- package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +54 -19
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +214 -5
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.js +19 -0
- package/dist/agent-capacity/contracts/operations/agent-team-clone.d.ts +47 -47
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +119 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.js +16 -0
- package/dist/agent-capacity/contracts/support/execution-graph.d.ts +434 -230
- package/dist/agent-capacity/contracts/support/execution-graph.js +20 -18
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +2 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +286 -254
- package/dist/agent-capacity/validation/agent-definition-schema.js +22 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +1 -1
- package/dist/agent-capacity/validation/assignment-records.js +45 -0
- package/dist/capacity/agents/agent-capacity.d.ts +1 -0
- package/dist/capacity/agents/agent-capacity.js +1 -0
- package/dist/capacity-provider/capability-ontology.d.ts +102 -102
- package/dist/capacity-provider/client.d.ts +14 -7
- package/dist/capacity-provider/client.js +1 -4
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +0 -1
- package/dist/capacity-provider/contracts/environment-profiles.d.ts +40 -40
- 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 +22 -22
- package/dist/capacity-provider/environment-catalog.js +1 -1
- package/dist/capacity-provider/install-configuration.d.ts +4 -4
- package/dist/capacity-provider/sandbox-contracts.d.ts +54 -54
- package/dist/capacity-provider/source-workspace.d.ts +76 -76
- 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 +120 -118
- package/dist/content/validation/agent-operational-content-schemas.js +2 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +92 -92
- package/dist/content/validation/content-model-schemas.d.ts +3155 -2512
- package/dist/content/validation/content-model-schemas.js +97 -87
- package/dist/content/validation/portable-content-data.d.ts +173 -168
- 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 +20 -20
- package/dist/deployment/ai-hosting.d.ts +12 -12
- package/dist/deployment/ai-instance.d.ts +12 -12
- package/dist/deployment/ai-mode.d.ts +34 -34
- package/dist/deployment/hosted-topology-template.d.ts +25 -25
- package/dist/deployment/hosted-topology.d.ts +146 -146
- package/dist/deployment/postgres/transfer.d.ts +2 -2
- package/dist/deployment/schemas.d.ts +504 -504
- package/dist/development/schemas.d.ts +325 -325
- 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/operator-contracts/canonical-command-tree.js +22 -8
- package/dist/operator-contracts/catalog/agents/agent-team-clone-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +25 -25
- package/dist/operator-contracts/catalog/commands/command-tree-builders.d.ts +11 -9
- package/dist/operator-contracts/catalog/communication-operations.d.ts +108 -90
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +33 -33
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +27 -27
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.d.ts +4 -4
- package/dist/operator-contracts/catalog/infrastructure/ai-instance-operations.js +2 -1
- package/dist/operator-contracts/catalog/knowledge-share-operations.d.ts +5 -5
- 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 +7 -6
- package/dist/operator-contracts/communication/contracts.d.ts +340 -198
- 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 +469 -442
- package/dist/operator-contracts/control-plane-operations.js +26 -10
- package/dist/operator-contracts/inbox/contracts.d.ts +100 -100
- package/dist/operator-contracts/knowledge/contracts.d.ts +6 -6
- package/dist/operator-contracts/mcp.js +4 -3
- package/dist/operator-contracts/workday-lifecycle.d.ts +192 -2
- package/dist/operator-contracts/workday-lifecycle.js +108 -45
- package/dist/platform/agent-schema-verification.js +316 -33
- 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 +4 -0
- 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 +1 -1
- package/dist/secrets-capability/shared-resources.d.ts +30 -30
- package/dist/security/encrypted-envelope.d.ts +6 -6
- 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/dist/types/agents/agent-activity-profile.d.ts +1 -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 +10 -5
- 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
|
@@ -9,17 +9,17 @@ export declare const knowledgeShareGrantInputSchema: z.ZodObject<{
|
|
|
9
9
|
expiresAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
11
|
expiresAt: string | null;
|
|
12
|
+
operations: ("query" | "read" | "context" | "graph")[];
|
|
12
13
|
projectIds: string[];
|
|
13
14
|
paths: string[];
|
|
14
|
-
operations: ("query" | "read" | "context" | "graph")[];
|
|
15
15
|
targetTeamId: string;
|
|
16
16
|
contentModels: string[];
|
|
17
17
|
}, {
|
|
18
18
|
projectIds: string[];
|
|
19
19
|
targetTeamId: string;
|
|
20
20
|
expiresAt?: string | null | undefined;
|
|
21
|
-
paths?: string[] | undefined;
|
|
22
21
|
operations?: ("query" | "read" | "context" | "graph")[] | undefined;
|
|
22
|
+
paths?: string[] | undefined;
|
|
23
23
|
contentModels?: string[] | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
|
|
@@ -44,9 +44,9 @@ export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
|
|
|
44
44
|
schemaVersion: "treeseed.knowledge-share/v1";
|
|
45
45
|
createdAt: string;
|
|
46
46
|
updatedAt: string;
|
|
47
|
+
operations: ("query" | "read" | "context" | "graph")[];
|
|
47
48
|
projectIds: string[];
|
|
48
49
|
paths: string[];
|
|
49
|
-
operations: ("query" | "read" | "context" | "graph")[];
|
|
50
50
|
targetTeamId: string;
|
|
51
51
|
contentModels: string[];
|
|
52
52
|
sourceTeamId: string;
|
|
@@ -62,8 +62,8 @@ export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
|
|
|
62
62
|
sourceTeamId: string;
|
|
63
63
|
revokedAt: string | null;
|
|
64
64
|
expiresAt?: string | null | undefined;
|
|
65
|
-
paths?: string[] | undefined;
|
|
66
65
|
operations?: ("query" | "read" | "context" | "graph")[] | undefined;
|
|
66
|
+
paths?: string[] | undefined;
|
|
67
67
|
contentModels?: string[] | undefined;
|
|
68
68
|
}>, {
|
|
69
69
|
status: "active" | "revoked" | "expired";
|
|
@@ -72,9 +72,9 @@ export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
|
|
|
72
72
|
schemaVersion: "treeseed.knowledge-share/v1";
|
|
73
73
|
createdAt: string;
|
|
74
74
|
updatedAt: string;
|
|
75
|
+
operations: ("query" | "read" | "context" | "graph")[];
|
|
75
76
|
projectIds: string[];
|
|
76
77
|
paths: string[];
|
|
77
|
-
operations: ("query" | "read" | "context" | "graph")[];
|
|
78
78
|
targetTeamId: string;
|
|
79
79
|
contentModels: string[];
|
|
80
80
|
sourceTeamId: string;
|
|
@@ -90,8 +90,8 @@ export declare const knowledgeShareSchema: z.ZodEffects<z.ZodObject<{
|
|
|
90
90
|
sourceTeamId: string;
|
|
91
91
|
revokedAt: string | null;
|
|
92
92
|
expiresAt?: string | null | undefined;
|
|
93
|
-
paths?: string[] | undefined;
|
|
94
93
|
operations?: ("query" | "read" | "context" | "graph")[] | undefined;
|
|
94
|
+
paths?: string[] | undefined;
|
|
95
95
|
contentModels?: string[] | undefined;
|
|
96
96
|
}>;
|
|
97
97
|
export declare const teamKnowledgeRequestSchema: z.ZodObject<{
|
|
@@ -21,12 +21,13 @@ function resourcePath(restPath) {
|
|
|
21
21
|
}
|
|
22
22
|
function operationToMcpResource(operation) {
|
|
23
23
|
if (!operation.surfaces.includes("mcp_resource")) return null;
|
|
24
|
-
|
|
24
|
+
const rest = operation.rest;
|
|
25
|
+
if (operation.kind !== "read" || !rest || rest.method !== "GET") {
|
|
25
26
|
throw new Error(`MCP resource operation ${operation.operationId} must be a read-only GET operation.`);
|
|
26
27
|
}
|
|
27
|
-
const uriTemplate = `treeseed://${resourcePath(
|
|
28
|
+
const uriTemplate = `treeseed://${resourcePath(rest.path)}`;
|
|
28
29
|
const parameters = (value) => [...value.matchAll(/\{([^}]+)\}/gu)].map((match) => match[1]).sort();
|
|
29
|
-
if (JSON.stringify(parameters(uriTemplate)) !== JSON.stringify(parameters(
|
|
30
|
+
if (JSON.stringify(parameters(uriTemplate)) !== JSON.stringify(parameters(rest.path))) {
|
|
30
31
|
throw new Error(`MCP resource ${operation.operationId} must preserve its REST path parameter names.`);
|
|
31
32
|
}
|
|
32
33
|
return {
|
|
@@ -1,5 +1,187 @@
|
|
|
1
1
|
import type { WorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
export { normalizeWorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
4
|
+
export declare const workdayIntentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
5
|
+
schemaVersion: z.ZodLiteral<"treeseed.workday-intent/v1">;
|
|
6
|
+
teamId: z.ZodString;
|
|
7
|
+
profileId: z.ZodString;
|
|
8
|
+
projects: z.ZodEffects<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>]>, any, any>;
|
|
9
|
+
executionMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<["simulation", "production"]>>>;
|
|
10
|
+
startsAt: z.ZodString;
|
|
11
|
+
endsAt: z.ZodOptional<z.ZodString>;
|
|
12
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
planningOnly: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
objectiveFilters: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
proposalIds: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
16
|
+
decisionIds: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
17
|
+
groupIds: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
18
|
+
reportingAgentId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
continueFromWorkdayId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
allocation: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
planningPercent: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
allocationWeight: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
planningTurnMaximumSeconds: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
projectPercentages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
25
|
+
agentClassPercentages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
planningPercent?: number | undefined;
|
|
28
|
+
allocationWeight?: number | undefined;
|
|
29
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
30
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
31
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
planningPercent?: number | undefined;
|
|
34
|
+
allocationWeight?: number | undefined;
|
|
35
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
36
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
37
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
38
|
+
}>>;
|
|
39
|
+
agentSelection: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
40
|
+
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
41
|
+
mode: z.ZodOptional<z.ZodLiteral<"intersection">>;
|
|
42
|
+
}, "strict", z.ZodTypeAny, {
|
|
43
|
+
mode?: "intersection" | undefined;
|
|
44
|
+
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
mode?: "intersection" | undefined;
|
|
47
|
+
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
48
|
+
}>, {
|
|
49
|
+
[x: string]: any;
|
|
50
|
+
}, {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
}>>;
|
|
53
|
+
operatorConstraints: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
providerIds: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
|
|
55
|
+
maxConcurrency: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
}, "strict", z.ZodTypeAny, {
|
|
57
|
+
providerIds?: string[] | undefined;
|
|
58
|
+
maxConcurrency?: number | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
providerIds?: string[] | undefined;
|
|
61
|
+
maxConcurrency?: number | undefined;
|
|
62
|
+
}>>;
|
|
63
|
+
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
schemaVersion: "treeseed.workday-intent/v1";
|
|
65
|
+
teamId: string;
|
|
66
|
+
profileId: string;
|
|
67
|
+
startsAt: string;
|
|
68
|
+
groupIds?: string[] | undefined;
|
|
69
|
+
durationSeconds?: number | undefined;
|
|
70
|
+
projects?: any;
|
|
71
|
+
executionMode?: "simulation" | "production" | undefined;
|
|
72
|
+
reportingAgentId?: string | undefined;
|
|
73
|
+
endsAt?: string | undefined;
|
|
74
|
+
planningOnly?: boolean | undefined;
|
|
75
|
+
objectiveFilters?: string[] | undefined;
|
|
76
|
+
proposalIds?: string[] | undefined;
|
|
77
|
+
decisionIds?: string[] | undefined;
|
|
78
|
+
continueFromWorkdayId?: string | undefined;
|
|
79
|
+
allocation?: {
|
|
80
|
+
planningPercent?: number | undefined;
|
|
81
|
+
allocationWeight?: number | undefined;
|
|
82
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
83
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
84
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
85
|
+
} | undefined;
|
|
86
|
+
agentSelection?: {
|
|
87
|
+
[x: string]: any;
|
|
88
|
+
} | undefined;
|
|
89
|
+
operatorConstraints?: {
|
|
90
|
+
providerIds?: string[] | undefined;
|
|
91
|
+
maxConcurrency?: number | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
schemaVersion: "treeseed.workday-intent/v1";
|
|
95
|
+
teamId: string;
|
|
96
|
+
profileId: string;
|
|
97
|
+
startsAt: string;
|
|
98
|
+
groupIds?: string[] | undefined;
|
|
99
|
+
durationSeconds?: number | undefined;
|
|
100
|
+
projects?: any;
|
|
101
|
+
executionMode?: "simulation" | "production" | undefined;
|
|
102
|
+
reportingAgentId?: string | undefined;
|
|
103
|
+
endsAt?: string | undefined;
|
|
104
|
+
planningOnly?: boolean | undefined;
|
|
105
|
+
objectiveFilters?: string[] | undefined;
|
|
106
|
+
proposalIds?: string[] | undefined;
|
|
107
|
+
decisionIds?: string[] | undefined;
|
|
108
|
+
continueFromWorkdayId?: string | undefined;
|
|
109
|
+
allocation?: {
|
|
110
|
+
planningPercent?: number | undefined;
|
|
111
|
+
allocationWeight?: number | undefined;
|
|
112
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
113
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
114
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
agentSelection?: {
|
|
117
|
+
[x: string]: any;
|
|
118
|
+
} | undefined;
|
|
119
|
+
operatorConstraints?: {
|
|
120
|
+
providerIds?: string[] | undefined;
|
|
121
|
+
maxConcurrency?: number | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
}>, {
|
|
124
|
+
schemaVersion: "treeseed.workday-intent/v1";
|
|
125
|
+
teamId: string;
|
|
126
|
+
profileId: string;
|
|
127
|
+
startsAt: string;
|
|
128
|
+
groupIds?: string[] | undefined;
|
|
129
|
+
durationSeconds?: number | undefined;
|
|
130
|
+
projects?: any;
|
|
131
|
+
executionMode?: "simulation" | "production" | undefined;
|
|
132
|
+
reportingAgentId?: string | undefined;
|
|
133
|
+
endsAt?: string | undefined;
|
|
134
|
+
planningOnly?: boolean | undefined;
|
|
135
|
+
objectiveFilters?: string[] | undefined;
|
|
136
|
+
proposalIds?: string[] | undefined;
|
|
137
|
+
decisionIds?: string[] | undefined;
|
|
138
|
+
continueFromWorkdayId?: string | undefined;
|
|
139
|
+
allocation?: {
|
|
140
|
+
planningPercent?: number | undefined;
|
|
141
|
+
allocationWeight?: number | undefined;
|
|
142
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
143
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
144
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
agentSelection?: {
|
|
147
|
+
[x: string]: any;
|
|
148
|
+
} | undefined;
|
|
149
|
+
operatorConstraints?: {
|
|
150
|
+
providerIds?: string[] | undefined;
|
|
151
|
+
maxConcurrency?: number | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
schemaVersion: "treeseed.workday-intent/v1";
|
|
155
|
+
teamId: string;
|
|
156
|
+
profileId: string;
|
|
157
|
+
startsAt: string;
|
|
158
|
+
groupIds?: string[] | undefined;
|
|
159
|
+
durationSeconds?: number | undefined;
|
|
160
|
+
projects?: any;
|
|
161
|
+
executionMode?: "simulation" | "production" | undefined;
|
|
162
|
+
reportingAgentId?: string | undefined;
|
|
163
|
+
endsAt?: string | undefined;
|
|
164
|
+
planningOnly?: boolean | undefined;
|
|
165
|
+
objectiveFilters?: string[] | undefined;
|
|
166
|
+
proposalIds?: string[] | undefined;
|
|
167
|
+
decisionIds?: string[] | undefined;
|
|
168
|
+
continueFromWorkdayId?: string | undefined;
|
|
169
|
+
allocation?: {
|
|
170
|
+
planningPercent?: number | undefined;
|
|
171
|
+
allocationWeight?: number | undefined;
|
|
172
|
+
planningTurnMaximumSeconds?: number | undefined;
|
|
173
|
+
projectPercentages?: Record<string, number> | undefined;
|
|
174
|
+
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
175
|
+
} | undefined;
|
|
176
|
+
agentSelection?: {
|
|
177
|
+
[x: string]: any;
|
|
178
|
+
} | undefined;
|
|
179
|
+
operatorConstraints?: {
|
|
180
|
+
providerIds?: string[] | undefined;
|
|
181
|
+
maxConcurrency?: number | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
}>, any, any>;
|
|
184
|
+
export declare const workdayIntentRequestSchema: z.ZodEffects<z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>, any, Record<string, unknown>>;
|
|
3
185
|
export type WorkdayDemandMode = 'planning' | 'acting';
|
|
4
186
|
export interface WorkdayIntent {
|
|
5
187
|
schemaVersion: 'treeseed.workday-intent/v1';
|
|
@@ -16,10 +198,16 @@ export interface WorkdayIntent {
|
|
|
16
198
|
planningOnly?: boolean;
|
|
17
199
|
/** Selects exact governed proposals for cooperative planning and estimating. */
|
|
18
200
|
proposalIds?: string[];
|
|
201
|
+
/** Shared proposal groups; membership, never named-agent selection, supplies participants. */
|
|
202
|
+
groupIds?: string[];
|
|
19
203
|
/** Selects accepted decisions for API-derived acting work; it does not grant acting authority. */
|
|
20
204
|
decisionIds?: string[];
|
|
21
|
-
/**
|
|
22
|
-
|
|
205
|
+
/** Selects one configured closeout agent; the API resolves its frozen reporting profile. */
|
|
206
|
+
reportingAgentId?: string;
|
|
207
|
+
/** Continue exact accepted work from a settled workday; omission starts a fresh simulation. */
|
|
208
|
+
continueFromWorkdayId?: string;
|
|
209
|
+
/** Selects activity phases without excluding group participants by identity or class. */
|
|
210
|
+
agentSelection?: Partial<Pick<WorkdayAgentSelection, 'activityTypes' | 'mode'>>;
|
|
23
211
|
/** High-level overrides of the canonical workday allocation policy. */
|
|
24
212
|
allocation?: Partial<Pick<import('../agent-capacity/contracts/capacity/workdays/workday-allocation.js').WorkdayPolicy, 'planningPercent' | 'allocationWeight' | 'planningTurnMaximumSeconds' | 'projectPercentages' | 'agentClassPercentages'>>;
|
|
25
213
|
operatorConstraints?: {
|
|
@@ -143,6 +331,8 @@ export interface WorkdayLifecycleDiagnostic {
|
|
|
143
331
|
message: string;
|
|
144
332
|
}
|
|
145
333
|
export declare function validateWorkdayIntent(intent: WorkdayIntent): WorkdayLifecycleDiagnostic[];
|
|
334
|
+
/** Preserve raw caller evidence; normalize only legitimate selector input. */
|
|
335
|
+
export declare function normalizeWorkdayIntent(intent: WorkdayIntent): WorkdayIntent;
|
|
146
336
|
export declare function validateWorkdayIntentSelection(value: unknown): WorkdayLifecycleDiagnostic[];
|
|
147
337
|
export declare function validateSelectedDemand(demand: WorkdaySelectedDemand): WorkdayLifecycleDiagnostic[];
|
|
148
338
|
export declare function validateWorkdayPreflight(receipt: WorkdayPreflightReceipt, now?: Date): WorkdayLifecycleDiagnostic[];
|
|
@@ -1,54 +1,114 @@
|
|
|
1
1
|
import { workdayAllocationOverridesSchema } from "../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { leaseSchema } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
4
|
+
import { alternativeProperties, conditionalFields, exclusiveProperties, exclusiveUnion, uniqueArray } from "../content/validation/schema-constraints.js";
|
|
2
5
|
import { normalizeWorkdayAgentSelection } from "../agent-capacity/workday.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
|
|
7
|
+
const selectedIdentities = uniqueArray(z.array(identifier).min(1).max(64));
|
|
8
|
+
const intentAgentSelectionSchema = alternativeProperties(z.object({
|
|
9
|
+
activityTypes: z.array(z.enum(["planning", "estimating", "reviewing", "reporting", "chat"])).min(1).optional(),
|
|
10
|
+
mode: z.literal("intersection").optional()
|
|
11
|
+
}).strict(), ["activityTypes"]);
|
|
12
|
+
const workdayIntentFields = z.object({
|
|
13
|
+
schemaVersion: z.literal("treeseed.workday-intent/v1"),
|
|
14
|
+
teamId: identifier,
|
|
15
|
+
profileId: identifier,
|
|
16
|
+
projects: exclusiveUnion(z.union([z.literal("all"), uniqueArray(z.array(identifier).min(1))])),
|
|
17
|
+
executionMode: z.enum(["simulation", "production"]).default("simulation").optional(),
|
|
18
|
+
startsAt: timestamp,
|
|
19
|
+
endsAt: timestamp.optional(),
|
|
20
|
+
durationSeconds: z.number().int().positive().optional(),
|
|
21
|
+
planningOnly: z.boolean().optional(),
|
|
22
|
+
objectiveFilters: z.array(identifier).optional(),
|
|
23
|
+
proposalIds: selectedIdentities.optional(),
|
|
24
|
+
decisionIds: selectedIdentities.optional(),
|
|
25
|
+
groupIds: selectedIdentities.optional(),
|
|
26
|
+
reportingAgentId: identifier.optional(),
|
|
27
|
+
continueFromWorkdayId: z.string().min(1).max(128).regex(/\S/u).optional(),
|
|
28
|
+
allocation: workdayAllocationOverridesSchema.optional(),
|
|
29
|
+
agentSelection: intentAgentSelectionSchema.optional(),
|
|
30
|
+
operatorConstraints: z.object({ providerIds: uniqueArray(z.array(identifier)).optional(), maxConcurrency: z.number().int().positive().optional() }).strict().optional()
|
|
31
|
+
}).strict();
|
|
32
|
+
const continuationRules = [{
|
|
33
|
+
field: "continueFromWorkdayId",
|
|
34
|
+
alternatives: [["decisionIds"]],
|
|
35
|
+
forbidden: { fields: ["proposalIds"], conditions: [{ field: "planningOnly", equals: true }] },
|
|
36
|
+
path: ["continueFromWorkdayId"],
|
|
37
|
+
message: "Continuation requires exact decisions, not new proposal planning."
|
|
38
|
+
}];
|
|
39
|
+
const workdayIntentSchema = exclusiveProperties(conditionalFields(workdayIntentFields, continuationRules), ["endsAt", "durationSeconds"]);
|
|
40
|
+
const requestIntentFields = z.preprocess((value) => {
|
|
41
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || !("decisionIds" in value) || !Array.isArray(value.decisionIds)) return value;
|
|
42
|
+
return { ...value, decisionIds: value.decisionIds.map((entry) => typeof entry === "string" ? entry.trim() : entry) };
|
|
43
|
+
}, exclusiveProperties(conditionalFields(workdayIntentFields.partial({ schemaVersion: true, teamId: true }), continuationRules), ["endsAt", "durationSeconds"])).superRefine((intent, context) => {
|
|
44
|
+
if (!validIntentRange(intent)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endsAt"], message: "endsAt must be after startsAt." });
|
|
45
|
+
});
|
|
46
|
+
const workdayIntentRequestSchema = z.custom((value) => Boolean(value && typeof value === "object" && !Array.isArray(value))).transform((intent, context) => {
|
|
47
|
+
const parsed = requestIntentFields.safeParse(intent);
|
|
48
|
+
if (!parsed.success) {
|
|
49
|
+
for (const issue of parsed.error.issues) context.addIssue(issue);
|
|
50
|
+
return z.NEVER;
|
|
20
51
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
return { ...intent, ...parsed.data, ...parsed.data.decisionIds ? { decisionIds: [...parsed.data.decisionIds].sort() } : {} };
|
|
53
|
+
});
|
|
54
|
+
function validIntentRange(intent) {
|
|
55
|
+
return intent.endsAt === void 0 || Date.parse(intent.endsAt) > Date.parse(intent.startsAt);
|
|
56
|
+
}
|
|
57
|
+
function portableIntentInput(intent) {
|
|
58
|
+
return { ...intent, ...Array.isArray(intent.decisionIds) ? { decisionIds: intent.decisionIds.map((value) => typeof value === "string" ? value.trim() : value) } : {} };
|
|
59
|
+
}
|
|
60
|
+
function validateWorkdayIntent(intent) {
|
|
61
|
+
const result = workdayIntentSchema.safeParse(portableIntentInput(intent));
|
|
62
|
+
const codes = {
|
|
63
|
+
schemaVersion: "schema_version_invalid",
|
|
64
|
+
teamId: "team_required",
|
|
65
|
+
profileId: "profile_required",
|
|
66
|
+
projects: "project_selection_invalid",
|
|
67
|
+
operatorConstraints: "operator_constraints_invalid",
|
|
68
|
+
executionMode: "execution_mode_invalid",
|
|
69
|
+
startsAt: "start_invalid",
|
|
70
|
+
endsAt: "end_invalid",
|
|
71
|
+
durationSeconds: "duration_invalid",
|
|
72
|
+
planningOnly: "planning_only_invalid",
|
|
73
|
+
objectiveFilters: "objective_selection_invalid",
|
|
74
|
+
proposalIds: "proposal_selection_invalid",
|
|
75
|
+
decisionIds: "decision_selection_invalid",
|
|
76
|
+
groupIds: "group_selection_invalid",
|
|
77
|
+
reportingAgentId: "reporting_agent_selection_invalid",
|
|
78
|
+
continueFromWorkdayId: "continuation_invalid",
|
|
79
|
+
agentSelection: "agent_selection_invalid",
|
|
80
|
+
allocation: "allocation_invalid"
|
|
81
|
+
};
|
|
82
|
+
const diagnostics = result.success ? [] : result.error.issues.flatMap((issue) => {
|
|
83
|
+
if (issue.code === z.ZodIssueCode.unrecognized_keys && !issue.path.length)
|
|
84
|
+
return issue.keys.map((key) => ({ code: "field_forbidden", path: key, message: "Derived execution state is not portable workday intent." }));
|
|
85
|
+
const root = String(issue.path[0] ?? "");
|
|
86
|
+
return [{
|
|
87
|
+
code: root === "endsAt" && intent.durationSeconds !== void 0 && intent.endsAt !== void 0 ? "time_range_ambiguous" : codes[root] ?? "intent_invalid",
|
|
88
|
+
path: root === "allocation" || root === "agentSelection" ? issue.path.join(".") : root,
|
|
27
89
|
message: issue.message
|
|
28
|
-
}
|
|
29
|
-
}
|
|
90
|
+
}];
|
|
91
|
+
});
|
|
92
|
+
if (!validIntentRange(intent))
|
|
93
|
+
diagnostics.push({ code: "end_invalid", path: "endsAt", message: "endsAt must be after startsAt." });
|
|
30
94
|
return diagnostics;
|
|
31
95
|
}
|
|
96
|
+
function normalizeWorkdayIntent(intent) {
|
|
97
|
+
const diagnostics = validateWorkdayIntent(intent);
|
|
98
|
+
if (diagnostics.length) throw new Error(`Invalid workday intent: ${diagnostics.map((value) => `${value.path}: ${value.message}`).join("; ")}`);
|
|
99
|
+
const normalized = workdayIntentSchema.parse(portableIntentInput(intent));
|
|
100
|
+
return { ...intent, ...normalized, ...normalized.decisionIds ? { decisionIds: [...normalized.decisionIds].sort() } : {} };
|
|
101
|
+
}
|
|
32
102
|
function validateWorkdayIntentSelection(value) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (entries === void 0) continue;
|
|
43
|
-
if (!Array.isArray(entries) || entries.length > 128 || entries.some((entry) => typeof entry !== "string" || !entry.trim() || entry.length > 128)) {
|
|
44
|
-
diagnostics.push(invalid(field, "Selectors must be a bounded array of nonempty strings."));
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
selected += entries.length;
|
|
48
|
-
if (field === "activityTypes" && entries.some((entry) => !["planning", "estimating", "reviewing", "reporting", "chat"].includes(String(entry).trim()))) diagnostics.push(invalid(field, "Select a planning activity; acting is controlled by accepted decisions and estimates."));
|
|
49
|
-
}
|
|
50
|
-
if (!selected) diagnostics.push(invalid("", "Explicit selection must select an agent, class, or activity; omit it to select all."));
|
|
51
|
-
return diagnostics;
|
|
103
|
+
const input = value && typeof value === "object" && !Array.isArray(value) ? Object.fromEntries(
|
|
104
|
+
Object.entries(value).map(([key, entries]) => [key, Array.isArray(entries) ? entries.map((entry) => typeof entry === "string" ? entry.trim() : entry) : entries])
|
|
105
|
+
) : value;
|
|
106
|
+
const result = intentAgentSelectionSchema.safeParse(input);
|
|
107
|
+
return result.success ? [] : result.error.issues.map((issue) => ({
|
|
108
|
+
code: "agent_selection_invalid",
|
|
109
|
+
path: ["agentSelection", ...issue.path].join("."),
|
|
110
|
+
message: issue.message
|
|
111
|
+
}));
|
|
52
112
|
}
|
|
53
113
|
function validateSelectedDemand(demand) {
|
|
54
114
|
const diagnostics = [];
|
|
@@ -94,10 +154,13 @@ function validateWorkdaySettlement(settlement) {
|
|
|
94
154
|
}
|
|
95
155
|
export {
|
|
96
156
|
normalizeWorkdayAgentSelection,
|
|
157
|
+
normalizeWorkdayIntent,
|
|
97
158
|
validateSelectedDemand,
|
|
98
159
|
validateWorkdayIntent,
|
|
99
160
|
validateWorkdayIntentSelection,
|
|
100
161
|
validateWorkdayPreflight,
|
|
101
162
|
validateWorkdayPreflightFreshness,
|
|
102
|
-
validateWorkdaySettlement
|
|
163
|
+
validateWorkdaySettlement,
|
|
164
|
+
workdayIntentRequestSchema,
|
|
165
|
+
workdayIntentSchema
|
|
103
166
|
};
|