@treeseed/sdk 0.13.0-rc.126 → 0.13.0-rc.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +2 -1
- package/dist/agent-capacity/workday.d.ts +13 -4
- package/dist/agent-capacity/workday.js +10 -26
- package/dist/operator-contracts/workday-lifecycle.d.ts +3 -2
- package/dist/operator-contracts/workday-lifecycle.js +4 -4
- package/guarantees/agent/golden/scenes/component-boundaries.scene.yaml +3 -0
- package/guarantees/verifiers/golden.verifiers.yaml +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,12 @@ and cleanup. It must not interpret agent identity, profile, proposal, review, or
|
|
|
58
58
|
release policy. Workload preparation and task interpretation belong to the
|
|
59
59
|
configured application handlers.
|
|
60
60
|
|
|
61
|
+
The shared workday selection normalizer accepts activity phases only. It rejects
|
|
62
|
+
agent names, class IDs, class slugs, union matching and unknown fields even on
|
|
63
|
+
internal calls. Proposal groups and discussion addressing supply participants;
|
|
64
|
+
the phase selection describes which activities run. Fair allocation weights
|
|
65
|
+
still use the agent's one class and are independent of participation.
|
|
66
|
+
|
|
61
67
|
## TreeDX API
|
|
62
68
|
|
|
63
69
|
```ts
|
|
@@ -134,8 +134,9 @@ export declare const workdayScheduleSchema: z.ZodObject<{
|
|
|
134
134
|
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
135
135
|
}>>;
|
|
136
136
|
agentSelection: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
137
|
-
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
138
137
|
mode: z.ZodOptional<z.ZodLiteral<"intersection">>;
|
|
138
|
+
} & {
|
|
139
|
+
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
139
140
|
}, "strict", z.ZodTypeAny, {
|
|
140
141
|
mode?: "intersection" | undefined;
|
|
141
142
|
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
export interface WorkdayPlanningAgent {
|
|
2
3
|
slug: string;
|
|
3
4
|
activityType?: string | null;
|
|
@@ -5,13 +6,21 @@ export interface WorkdayPlanningAgent {
|
|
|
5
6
|
projectAgentClassSlug?: string | null;
|
|
6
7
|
projectAgentClassId?: string | null;
|
|
7
8
|
}
|
|
9
|
+
export declare const workdayActivitySelectionSchema: z.ZodObject<{
|
|
10
|
+
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
11
|
+
mode: z.ZodOptional<z.ZodLiteral<"intersection">>;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
mode?: "intersection" | undefined;
|
|
14
|
+
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
mode?: "intersection" | undefined;
|
|
17
|
+
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
18
|
+
}>;
|
|
8
19
|
export interface WorkdayAgentSelection {
|
|
9
|
-
classIds: string[];
|
|
10
|
-
classSlugs: string[];
|
|
11
|
-
agentSlugs: string[];
|
|
12
20
|
activityTypes: string[];
|
|
13
|
-
mode: 'intersection'
|
|
21
|
+
mode: 'intersection';
|
|
14
22
|
}
|
|
23
|
+
/** Normalize activity phases only. Group resolution owns the agent audience. */
|
|
15
24
|
export declare function normalizeWorkdayAgentSelection(value: unknown): WorkdayAgentSelection;
|
|
16
25
|
export declare function workdayAgentSelectionActive(selection: WorkdayAgentSelection): boolean;
|
|
17
26
|
export declare function selectWorkdayAgents<T extends WorkdayPlanningAgent>(agents: T[], value: unknown): T[];
|
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const workdayActivitySelectionSchema = z.object({
|
|
3
|
+
activityTypes: z.array(z.enum(["planning", "estimating", "reviewing", "reporting", "chat"])).optional(),
|
|
4
|
+
mode: z.literal("intersection").optional()
|
|
5
|
+
}).strict();
|
|
5
6
|
function normalizeWorkdayAgentSelection(value) {
|
|
6
|
-
const
|
|
7
|
-
return {
|
|
8
|
-
classIds: uniqueStrings(input.classIds),
|
|
9
|
-
classSlugs: uniqueStrings(input.classSlugs),
|
|
10
|
-
agentSlugs: uniqueStrings(input.agentSlugs),
|
|
11
|
-
activityTypes: uniqueStrings(input.activityTypes),
|
|
12
|
-
mode: input.mode === "union" ? "union" : "intersection"
|
|
13
|
-
};
|
|
7
|
+
const parsed = workdayActivitySelectionSchema.parse(value === void 0 ? {} : value);
|
|
8
|
+
return { activityTypes: [...new Set(parsed.activityTypes ?? [])].sort(), mode: "intersection" };
|
|
14
9
|
}
|
|
15
10
|
function workdayAgentSelectionActive(selection) {
|
|
16
|
-
return selection.
|
|
11
|
+
return selection.activityTypes.length > 0;
|
|
17
12
|
}
|
|
18
13
|
function selectWorkdayAgents(agents, value) {
|
|
19
14
|
const selection = normalizeWorkdayAgentSelection(value);
|
|
20
|
-
|
|
21
|
-
const classSelectors = /* @__PURE__ */ new Set([...selection.classIds, ...selection.classSlugs]);
|
|
22
|
-
const agentSelectors = new Set(selection.agentSlugs);
|
|
23
|
-
const activitySelectors = new Set(selection.activityTypes);
|
|
24
|
-
return agents.filter((agent) => {
|
|
25
|
-
const classMatch = classSelectors.size === 0 || [agent.projectAgentClassId, agent.projectAgentClassSlug].some((candidate) => candidate && [...classSelectors].some((selector) => selector === candidate || selector.endsWith(`:${candidate}`)));
|
|
26
|
-
const agentMatch = agentSelectors.size === 0 || agentSelectors.has(agent.slug);
|
|
27
|
-
const activityMatch = activitySelectors.size === 0 || Boolean(agent.activityType && activitySelectors.has(agent.activityType));
|
|
28
|
-
if (selection.mode === "union") {
|
|
29
|
-
return classSelectors.size > 0 && classMatch || agentSelectors.size > 0 && agentMatch || activitySelectors.size > 0 && activityMatch;
|
|
30
|
-
}
|
|
31
|
-
return classMatch && agentMatch && activityMatch;
|
|
32
|
-
});
|
|
15
|
+
return !selection.activityTypes.length ? agents : agents.filter((agent) => Boolean(agent.activityType && selection.activityTypes.includes(agent.activityType)));
|
|
33
16
|
}
|
|
34
17
|
function record(value) {
|
|
35
18
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
@@ -101,5 +84,6 @@ export {
|
|
|
101
84
|
record,
|
|
102
85
|
selectFairPlanningAgentCycles,
|
|
103
86
|
selectWorkdayAgents,
|
|
87
|
+
workdayActivitySelectionSchema,
|
|
104
88
|
workdayAgentSelectionActive
|
|
105
89
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export { normalizeWorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
4
4
|
export declare const workdayIntentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
@@ -37,8 +37,9 @@ export declare const workdayIntentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<
|
|
|
37
37
|
agentClassPercentages?: Record<string, Record<string, number>> | undefined;
|
|
38
38
|
}>>;
|
|
39
39
|
agentSelection: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
40
|
-
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
41
40
|
mode: z.ZodOptional<z.ZodLiteral<"intersection">>;
|
|
41
|
+
} & {
|
|
42
|
+
activityTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["planning", "estimating", "reviewing", "reporting", "chat"]>, "many">>;
|
|
42
43
|
}, "strict", z.ZodTypeAny, {
|
|
43
44
|
mode?: "intersection" | undefined;
|
|
44
45
|
activityTypes?: ("planning" | "estimating" | "reviewing" | "reporting" | "chat")[] | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { workdayActivitySelectionSchema } from "../agent-capacity/workday.js";
|
|
1
2
|
import { workdayAllocationOverridesSchema } from "../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { leaseSchema } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
|
|
@@ -5,10 +6,9 @@ import { alternativeProperties, conditionalFields, exclusiveProperties, exclusiv
|
|
|
5
6
|
import { normalizeWorkdayAgentSelection } from "../agent-capacity/workday.js";
|
|
6
7
|
const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
|
|
7
8
|
const selectedIdentities = uniqueArray(z.array(identifier).min(1).max(64));
|
|
8
|
-
const intentAgentSelectionSchema = alternativeProperties(
|
|
9
|
-
activityTypes:
|
|
10
|
-
|
|
11
|
-
}).strict(), ["activityTypes"]);
|
|
9
|
+
const intentAgentSelectionSchema = alternativeProperties(workdayActivitySelectionSchema.extend({
|
|
10
|
+
activityTypes: workdayActivitySelectionSchema.shape.activityTypes.unwrap().min(1).optional()
|
|
11
|
+
}), ["activityTypes"]);
|
|
12
12
|
const workdayIntentFields = z.object({
|
|
13
13
|
schemaVersion: z.literal("treeseed.workday-intent/v1"),
|
|
14
14
|
teamId: identifier,
|
|
@@ -3,6 +3,9 @@ id: sdk.golden.component-boundaries
|
|
|
3
3
|
title: sdk golden component boundaries
|
|
4
4
|
scope: local-component-tests
|
|
5
5
|
workflow:
|
|
6
|
+
- id: group-phase-selection
|
|
7
|
+
action: { verifier: sdk.golden.group-phase-selection }
|
|
8
|
+
expect: { status: passed }
|
|
6
9
|
- id: integration-reviewed-input-unit
|
|
7
10
|
action: { verifier: sdk.golden.integration-reviewed-input-unit }
|
|
8
11
|
expect: { status: passed }
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
schemaVersion: treeseed.guarantee-verifiers/v1
|
|
2
2
|
ownerPackage: "@treeseed/sdk"
|
|
3
3
|
verifiers:
|
|
4
|
+
sdk.golden.group-phase-selection:
|
|
5
|
+
kind: vitestCase
|
|
6
|
+
ownerPackage: "@treeseed/sdk"
|
|
7
|
+
testFile: tests/unit/operator-contracts/group-workday-intent.test.ts
|
|
8
|
+
testName: "keeps normalized internal phase snapshots free of identity filters and rejects legacy targeting"
|
|
4
9
|
sdk.golden.cli-read-library-unit:
|
|
5
10
|
kind: vitestCase
|
|
6
11
|
ownerPackage: "@treeseed/sdk"
|