@treeseed/sdk 0.13.0-rc.115 → 0.13.0-rc.117
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/.treeseed-build-complete.json +1 -1
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +2 -2
- package/dist/content/validation/content-model-schemas.d.ts +5 -5
- package/dist/content/validation/portable-content-data.d.ts +1 -1
- package/dist/operator-contracts/canonical-command-tree.js +6 -3
- package/dist/operator-contracts/catalog/workdays/profile-commands.d.ts +4 -0
- package/dist/operator-contracts/catalog/workdays/profile-commands.js +20 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +16 -0
- package/dist/operator-contracts/catalog/workdays/profile-operations.js +48 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.d.ts +3 -0
- package/dist/operator-contracts/catalog/workdays/selection-commands.js +15 -0
- package/dist/operator-contracts/command-tree.d.ts +1 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +14 -0
- package/dist/operator-contracts/control-plane-operations.js +2 -0
- package/dist/operator-contracts/workday-lifecycle.d.ts +5 -0
- package/dist/operator-contracts/workday-lifecycle.js +25 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"completedAt":"2026-09-
|
|
1
|
+
{"completedAt":"2026-09-11T13:05:00.879Z"}
|
|
@@ -157,6 +157,7 @@ export declare const agentForensicPayloadSchema: z.ZodObject<{
|
|
|
157
157
|
severity: "error" | "warning" | "info";
|
|
158
158
|
}>, "many">>;
|
|
159
159
|
}, "strict", z.ZodTypeAny, {
|
|
160
|
+
activity: AgentActivityEvent;
|
|
160
161
|
diagnostics: {
|
|
161
162
|
code: string;
|
|
162
163
|
path: string;
|
|
@@ -164,7 +165,6 @@ export declare const agentForensicPayloadSchema: z.ZodObject<{
|
|
|
164
165
|
severity: "error" | "warning" | "info";
|
|
165
166
|
}[];
|
|
166
167
|
contract: "treeseed.agent-forensic-payload/v1";
|
|
167
|
-
activity: AgentActivityEvent;
|
|
168
168
|
payload?: Record<string, unknown> | undefined;
|
|
169
169
|
transcript?: {
|
|
170
170
|
entries: Record<string, unknown>[];
|
|
@@ -177,8 +177,8 @@ export declare const agentForensicPayloadSchema: z.ZodObject<{
|
|
|
177
177
|
redactionStatus: "sanitized" | "partially-redacted" | "withheld";
|
|
178
178
|
} | undefined;
|
|
179
179
|
}, {
|
|
180
|
-
contract: "treeseed.agent-forensic-payload/v1";
|
|
181
180
|
activity: AgentActivityEvent;
|
|
181
|
+
contract: "treeseed.agent-forensic-payload/v1";
|
|
182
182
|
payload?: Record<string, unknown> | undefined;
|
|
183
183
|
diagnostics?: {
|
|
184
184
|
code: string;
|
|
@@ -2090,7 +2090,7 @@ declare const schemas: {
|
|
|
2090
2090
|
related_books?: string[] | undefined;
|
|
2091
2091
|
primary_contributor?: string | undefined;
|
|
2092
2092
|
related_notes?: string[] | undefined;
|
|
2093
|
-
decision_type?: "approved" | "rejected" | "
|
|
2093
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
2094
2094
|
rationale?: string | undefined;
|
|
2095
2095
|
}, {
|
|
2096
2096
|
title: string;
|
|
@@ -2108,7 +2108,7 @@ declare const schemas: {
|
|
|
2108
2108
|
related_books?: string[] | undefined;
|
|
2109
2109
|
primary_contributor?: string | undefined;
|
|
2110
2110
|
related_notes?: string[] | undefined;
|
|
2111
|
-
decision_type?: "approved" | "rejected" | "
|
|
2111
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
2112
2112
|
rationale?: string | undefined;
|
|
2113
2113
|
}>;
|
|
2114
2114
|
book: z.ZodObject<{
|
|
@@ -11915,7 +11915,7 @@ export declare function validateContentFrontmatter(model: PortableContentModel,
|
|
|
11915
11915
|
related_books?: string[] | undefined;
|
|
11916
11916
|
primary_contributor?: string | undefined;
|
|
11917
11917
|
related_notes?: string[] | undefined;
|
|
11918
|
-
decision_type?: "approved" | "rejected" | "
|
|
11918
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
11919
11919
|
rationale?: string | undefined;
|
|
11920
11920
|
} | {
|
|
11921
11921
|
status: "review" | "archived" | "draft" | "published";
|
|
@@ -21630,7 +21630,7 @@ export declare function describeContentFrontmatterSchema(model: PortableContentM
|
|
|
21630
21630
|
related_books?: string[] | undefined;
|
|
21631
21631
|
primary_contributor?: string | undefined;
|
|
21632
21632
|
related_notes?: string[] | undefined;
|
|
21633
|
-
decision_type?: "approved" | "rejected" | "
|
|
21633
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
21634
21634
|
rationale?: string | undefined;
|
|
21635
21635
|
}, {
|
|
21636
21636
|
title: string;
|
|
@@ -21648,7 +21648,7 @@ export declare function describeContentFrontmatterSchema(model: PortableContentM
|
|
|
21648
21648
|
related_books?: string[] | undefined;
|
|
21649
21649
|
primary_contributor?: string | undefined;
|
|
21650
21650
|
related_notes?: string[] | undefined;
|
|
21651
|
-
decision_type?: "approved" | "rejected" | "
|
|
21651
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
21652
21652
|
rationale?: string | undefined;
|
|
21653
21653
|
}> | z.ZodObject<{
|
|
21654
21654
|
schemaVersion: z.ZodLiteral<"treeseed.book/v2">;
|
|
@@ -2001,7 +2001,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
2001
2001
|
related_books?: string[] | undefined;
|
|
2002
2002
|
primary_contributor?: string | undefined;
|
|
2003
2003
|
related_notes?: string[] | undefined;
|
|
2004
|
-
decision_type?: "approved" | "rejected" | "
|
|
2004
|
+
decision_type?: "approved" | "rejected" | "superseded" | "deferred" | "request_changes" | undefined;
|
|
2005
2005
|
rationale?: string | undefined;
|
|
2006
2006
|
} | {
|
|
2007
2007
|
status: "review" | "archived" | "draft" | "published";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { commandPaths } from "./catalog/infrastructure/command-tree-paths.js";
|
|
2
2
|
import { managedSecretCommands } from "./catalog/services/secret-commands.js";
|
|
3
3
|
import { identityLoginCommand } from "./catalog/services/identity-commands.js";
|
|
4
|
+
import { WORKDAY_PROFILE_COMMAND_BINDINGS } from "./catalog/workdays/profile-commands.js";
|
|
5
|
+
import { WORKDAY_PLAN_OPTIONS, WORKDAY_SELECTION_INPUTS } from "./catalog/workdays/selection-commands.js";
|
|
4
6
|
import { hostProviderEnvironmentBranch, PROVIDER_ENVIRONMENT_COMMAND_BINDINGS, providerEnvironmentBranches } from "./catalog/provider-environment-commands.js";
|
|
5
7
|
const unavailable = (reason = "This capability is not enabled until its control-plane operation is accepted.") => ({
|
|
6
8
|
kind: "unavailable",
|
|
@@ -131,7 +133,8 @@ const operationBindings = {
|
|
|
131
133
|
"seeds verify": operation("seeds.verify", [field("path", "name", "argument", "seed", true)]),
|
|
132
134
|
"plans list": operation("plans.list", [field("path", "decisionId", "option", "decision", true), ...page()]),
|
|
133
135
|
"plans show": operation("plans.show", [field("path", "capacityPlanId", "argument", "plan", true)]),
|
|
134
|
-
"workdays plan": operation("workdays.plan", [field("path", "teamId", "context", "team", true), field("body", "profileId", "option", "profile"), field("body", "projects", "option", "projects", false, "csv"), field("body", "startsAt", "option", "start"), field("body", "endsAt", "option", "end"), field("body", "durationSeconds", "option", "duration", false, "integer"), field("body", "objectiveFilters", "option", "objective", false, "csv")]),
|
|
136
|
+
"workdays plan": operation("workdays.plan", [field("path", "teamId", "context", "team", true), field("body", "profileId", "option", "profile"), field("body", "projects", "option", "projects", false, "csv"), field("body", "startsAt", "option", "start"), field("body", "endsAt", "option", "end"), field("body", "durationSeconds", "option", "duration", false, "integer"), field("body", "objectiveFilters", "option", "objective", false, "csv"), ...WORKDAY_SELECTION_INPUTS]),
|
|
137
|
+
...WORKDAY_PROFILE_COMMAND_BINDINGS,
|
|
135
138
|
"workdays start": operation("workdays.start", [field("path", "teamId", "context", "team", true), field("body", "preflightId", "option", "preflight", true), field("body", "preflightDigest", "option", "digest", true)]),
|
|
136
139
|
"workdays list": operation("workdays.list", [field("path", "teamId", "context", "team", true), ...page()]),
|
|
137
140
|
"workdays show": operation("workdays.show", [field("path", "teamId", "context", "team", true), field("path", "runId", "argument", "workday", true)]),
|
|
@@ -454,8 +457,8 @@ const commandTree = {
|
|
|
454
457
|
branch("capacity", [leaf("status"), leaf("explain"), leaf("usage"), leaf("ledger"), leaf("audit")]),
|
|
455
458
|
branch("plans", [leaf("list"), leaf("show", "read", "plan"), leaf("explain", "read", "plan"), { nodeType: "leaf", segment: "diff", description: "Compare two API-derived plans.", kind: "read", arguments: [{ name: "left", description: "Left plan identity.", required: true }, { name: "right", description: "Right plan identity.", required: true }], resultSchemaId: "treeseed.command.plans.diff/v1", execution: unavailable() }]),
|
|
456
459
|
branch("workdays", [
|
|
457
|
-
branch("profiles", [leaf("list"), leaf("show", "read", "profile"), leaf("validate", "read", "file")]),
|
|
458
|
-
leaf("plan", "mutation"),
|
|
460
|
+
branch("profiles", [leaf("list"), leaf("show", "read", "profile"), leaf("reconcile", "mutation", "project", "authority"), leaf("validate", "read", "file")]),
|
|
461
|
+
{ ...leaf("plan", "mutation"), nodeType: "leaf", segment: "plan", kind: "mutation", description: "Plan a workday with optional targeted cooperative planning; acting stays decision-governed.", resultSchemaId: "treeseed.command.workdays.plan/v1", options: WORKDAY_PLAN_OPTIONS },
|
|
459
462
|
leaf("start", "mutation", void 0, "authority"),
|
|
460
463
|
leaf("list"),
|
|
461
464
|
leaf("show", "read", "workday"),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const team = { target: "path", field: "teamId", source: "context", name: "team", required: true, transform: "identity" };
|
|
2
|
+
const WORKDAY_PROFILE_COMMAND_BINDINGS = {
|
|
3
|
+
"workdays profiles list": { kind: "operation", operationId: "workdays.profiles.list", input: [
|
|
4
|
+
team,
|
|
5
|
+
{ target: "query", field: "limit", source: "option", name: "limit", transform: "integer" },
|
|
6
|
+
{ target: "query", field: "cursor", source: "option", name: "cursor", transform: "identity" },
|
|
7
|
+
{ target: "query", field: "status", source: "option", name: "status", transform: "identity" }
|
|
8
|
+
] },
|
|
9
|
+
"workdays profiles show": { kind: "operation", operationId: "workdays.profiles.show", input: [
|
|
10
|
+
team,
|
|
11
|
+
{ target: "path", field: "profileId", source: "argument", name: "profile", required: true, transform: "identity" }
|
|
12
|
+
] },
|
|
13
|
+
"workdays profiles reconcile": { kind: "operation", operationId: "workdays.profiles.reconcile", input: [
|
|
14
|
+
team,
|
|
15
|
+
{ target: "path", field: "projectId", source: "argument", name: "project", required: true, transform: "identity" }
|
|
16
|
+
] }
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
WORKDAY_PROFILE_COMMAND_BINDINGS
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const WORKDAY_PROFILE_OPERATIONS: {
|
|
2
|
+
profilesList: import("../../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, undefined, Record<string, unknown>>;
|
|
7
|
+
profilesShow: import("../../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}, {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
}, undefined, Record<string, unknown>>;
|
|
12
|
+
profilesReconcile: import("../../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
13
|
+
projectId: string;
|
|
14
|
+
teamId: string;
|
|
15
|
+
}, {}, {}, Record<string, unknown>>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../../operation-builder.js";
|
|
3
|
+
const team = z.object({ teamId: z.string().min(1) }).strict();
|
|
4
|
+
const empty = z.object({}).strict();
|
|
5
|
+
const output = z.record(z.unknown());
|
|
6
|
+
const read = (operationId, path, parameters, query, pagination) => defineOperation({
|
|
7
|
+
operationId,
|
|
8
|
+
description: "Read accepted repository workday profile generations.",
|
|
9
|
+
rest: { method: "GET", path },
|
|
10
|
+
parameters: `treeseed.${operationId}.parameters/v1`,
|
|
11
|
+
capability: "workdays.read",
|
|
12
|
+
authentication: "oauth",
|
|
13
|
+
oauthScopes: ["treeseed:read"],
|
|
14
|
+
kind: "read",
|
|
15
|
+
riskClass: "ordinary",
|
|
16
|
+
confirmation: "never",
|
|
17
|
+
surfaces: ["rest", "cli"],
|
|
18
|
+
cacheScope: "principal",
|
|
19
|
+
pagination
|
|
20
|
+
}, { path: parameters, query, body: z.undefined(), output });
|
|
21
|
+
const WORKDAY_PROFILE_OPERATIONS = {
|
|
22
|
+
profilesList: read(
|
|
23
|
+
"workdays.profiles.list",
|
|
24
|
+
"/v1/teams/{teamId}/workday-profiles",
|
|
25
|
+
team,
|
|
26
|
+
z.object({ limit: z.coerce.number().int().min(1).max(100).optional(), cursor: z.string().optional(), status: z.enum(["active", "archived", "superseded"]).optional() }).strict(),
|
|
27
|
+
"cursor"
|
|
28
|
+
),
|
|
29
|
+
profilesShow: read("workdays.profiles.show", "/v1/teams/{teamId}/workday-profiles/{profileId}", team.extend({ profileId: z.string().min(1) }), empty, "none"),
|
|
30
|
+
profilesReconcile: defineOperation({
|
|
31
|
+
operationId: "workdays.profiles.reconcile",
|
|
32
|
+
description: "Reconcile a bound repository profile after exact successful source verification.",
|
|
33
|
+
rest: { method: "POST", path: "/v1/teams/{teamId}/projects/{projectId}/workday-profiles/reconcile" },
|
|
34
|
+
parameters: "treeseed.workdays.profiles.reconcile.parameters/v1",
|
|
35
|
+
capability: "workdays.execute",
|
|
36
|
+
authentication: "oauth",
|
|
37
|
+
oauthScopes: ["treeseed:execution"],
|
|
38
|
+
kind: "mutation",
|
|
39
|
+
riskClass: "authority",
|
|
40
|
+
confirmation: "input_required",
|
|
41
|
+
surfaces: ["rest", "cli"],
|
|
42
|
+
cacheScope: "none",
|
|
43
|
+
pagination: "none"
|
|
44
|
+
}, { path: team.extend({ projectId: z.string().min(1) }), query: empty, body: empty, output })
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
WORKDAY_PROFILE_OPERATIONS
|
|
48
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const WORKDAY_SELECTION_INPUTS = [
|
|
2
|
+
{ target: "body", field: "agentSelection.agentSlugs", source: "option", name: "agent", transform: "csv" },
|
|
3
|
+
{ target: "body", field: "agentSelection.activityTypes", source: "option", name: "activity", transform: "csv" },
|
|
4
|
+
{ target: "body", field: "agentSelection.classSlugs", source: "option", name: "class", transform: "csv" }
|
|
5
|
+
];
|
|
6
|
+
const WORKDAY_PLAN_OPTIONS = [
|
|
7
|
+
{ name: "--plan", description: "Return the request without creating a preflight.", type: "boolean" },
|
|
8
|
+
{ name: "--agent", description: "Planning agent slug; repeat or comma-separate. Intersects with class/activity selectors.", type: "string[]" },
|
|
9
|
+
{ name: "--activity", description: "Planning activity: planning, estimating, reviewing, reporting, or chat; repeat or comma-separate.", type: "string[]" },
|
|
10
|
+
{ name: "--class", description: "Planning class slug; repeat or comma-separate. Acting remains governed by accepted decisions.", type: "string[]" }
|
|
11
|
+
];
|
|
12
|
+
export {
|
|
13
|
+
WORKDAY_PLAN_OPTIONS,
|
|
14
|
+
WORKDAY_SELECTION_INPUTS
|
|
15
|
+
};
|
|
@@ -23,6 +23,7 @@ export interface CommandAuthorizationDescriptor {
|
|
|
23
23
|
export type CommandInputSource = 'argument' | 'context' | 'option';
|
|
24
24
|
export type CommandInputTarget = 'path' | 'query' | 'body';
|
|
25
25
|
export interface CommandInputBinding {
|
|
26
|
+
/** Dot-separated object path in the selected target; unsafe prototype keys are forbidden. */
|
|
26
27
|
field: string;
|
|
27
28
|
source: CommandInputSource;
|
|
28
29
|
name: string;
|
|
@@ -2004,6 +2004,20 @@ export declare const CONTROL_PLANE_OPERATIONS: {
|
|
|
2004
2004
|
teamId: string;
|
|
2005
2005
|
scheduleId: string;
|
|
2006
2006
|
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
2007
|
+
readonly profilesList: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
2008
|
+
[x: string]: any;
|
|
2009
|
+
}, {
|
|
2010
|
+
[x: string]: any;
|
|
2011
|
+
}, undefined, Record<string, unknown>>;
|
|
2012
|
+
readonly profilesShow: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
2013
|
+
[x: string]: any;
|
|
2014
|
+
}, {
|
|
2015
|
+
[x: string]: any;
|
|
2016
|
+
}, undefined, Record<string, unknown>>;
|
|
2017
|
+
readonly profilesReconcile: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
2018
|
+
projectId: string;
|
|
2019
|
+
teamId: string;
|
|
2020
|
+
}, {}, {}, Record<string, unknown>>;
|
|
2007
2021
|
};
|
|
2008
2022
|
readonly assignments: {
|
|
2009
2023
|
readonly list: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { defineOperation as define, defineTreeDxProxyOperation as treedxProxy, defineReadOperation as read } from "./operation-builder.js";
|
|
3
3
|
import { communicationOperations, providerCommunicationLifecycleOperations, providerDiscussionResponseOperation } from "./catalog/communication-operations.js";
|
|
4
4
|
import { inboxOperations } from "./catalog/inbox-operations.js";
|
|
5
|
+
import { WORKDAY_PROFILE_OPERATIONS } from "./catalog/workdays/profile-operations.js";
|
|
5
6
|
import { adminAccountOperations, adminTeamOperations } from "./catalog/admin-account-team-operations.js";
|
|
6
7
|
import { TREEAI_CONTROL_PLANE_OPERATIONS } from "./catalog/treeai-operations.js";
|
|
7
8
|
import { capabilityOntologyOperations } from "./catalog/capability-ontology-operations.js";
|
|
@@ -305,6 +306,7 @@ const CONTROL_PLANE_OPERATIONS = {
|
|
|
305
306
|
show: resource("plans.show", "GET", "/v1/capacity-plans/{capacityPlanId}", { capacityPlanId: z.string().min(1) }, { capability: "plans.read", surfaces: ["rest", "cli", "mcp_resource"] })
|
|
306
307
|
},
|
|
307
308
|
workdays: {
|
|
309
|
+
...WORKDAY_PROFILE_OPERATIONS,
|
|
308
310
|
list: resource("workdays.list", "GET", "/v1/teams/{teamId}/workday-runs", { teamId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
|
|
309
311
|
preflight: resource("workdays.plan", "POST", "/v1/teams/{teamId}/workday-runs/preflight", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"] }),
|
|
310
312
|
start: resource("workdays.start", "POST", "/v1/teams/{teamId}/workday-runs", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "authority" }),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type WorkdayBorrowingEvidence } from './workday-profile.js';
|
|
2
|
+
import type { WorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
3
|
+
export { normalizeWorkdayAgentSelection } from '../agent-capacity/workday.js';
|
|
2
4
|
export type WorkdayDemandMode = 'planning' | 'acting';
|
|
3
5
|
export interface WorkdayIntent {
|
|
4
6
|
schemaVersion: 'treeseed.workday-intent/v1';
|
|
@@ -9,6 +11,8 @@ export interface WorkdayIntent {
|
|
|
9
11
|
endsAt?: string;
|
|
10
12
|
durationSeconds?: number;
|
|
11
13
|
objectiveFilters?: string[];
|
|
14
|
+
/** Limits cooperative planning; acting still requires accepted decision/estimate authority. */
|
|
15
|
+
agentSelection?: Partial<WorkdayAgentSelection>;
|
|
12
16
|
operatorConstraints?: {
|
|
13
17
|
providerIds?: string[];
|
|
14
18
|
maxConcurrency?: number;
|
|
@@ -151,6 +155,7 @@ export interface WorkdayLifecycleDiagnostic {
|
|
|
151
155
|
message: string;
|
|
152
156
|
}
|
|
153
157
|
export declare function validateWorkdayIntent(intent: WorkdayIntent): WorkdayLifecycleDiagnostic[];
|
|
158
|
+
export declare function validateWorkdayIntentSelection(value: unknown): WorkdayLifecycleDiagnostic[];
|
|
154
159
|
export declare function validateSelectedDemand(demand: WorkdaySelectedDemand): WorkdayLifecycleDiagnostic[];
|
|
155
160
|
export declare function validateWorkdayPreflight(receipt: WorkdayPreflightReceipt, now?: Date): WorkdayLifecycleDiagnostic[];
|
|
156
161
|
export declare function validateWorkdayPreflightFreshness(receipt: WorkdayPreflightReceipt, observed: WorkdayPreflightObservation): WorkdayLifecycleDiagnostic[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { validateWorkdayBorrowingEvidence } from "./workday-profile.js";
|
|
2
|
+
import { normalizeWorkdayAgentSelection } from "../agent-capacity/workday.js";
|
|
2
3
|
function validateWorkdayIntent(intent) {
|
|
3
4
|
const diagnostics = [];
|
|
4
5
|
if (intent.schemaVersion !== "treeseed.workday-intent/v1") diagnostics.push({ code: "schema_version_invalid", path: "schemaVersion", message: "Unsupported workday intent schema." });
|
|
@@ -9,6 +10,28 @@ function validateWorkdayIntent(intent) {
|
|
|
9
10
|
if (!Number.isFinite(start)) diagnostics.push({ code: "start_invalid", path: "startsAt", message: "startsAt must be an ISO timestamp." });
|
|
10
11
|
if (intent.endsAt !== void 0 && (!Number.isFinite(Date.parse(intent.endsAt)) || Date.parse(intent.endsAt) <= start)) diagnostics.push({ code: "end_invalid", path: "endsAt", message: "endsAt must be a valid timestamp after startsAt." });
|
|
11
12
|
if (intent.durationSeconds !== void 0 && (!Number.isInteger(intent.durationSeconds) || intent.durationSeconds <= 0)) diagnostics.push({ code: "duration_invalid", path: "durationSeconds", message: "durationSeconds must be a positive integer." });
|
|
13
|
+
if (intent.agentSelection !== void 0) diagnostics.push(...validateWorkdayIntentSelection(intent.agentSelection));
|
|
14
|
+
return diagnostics;
|
|
15
|
+
}
|
|
16
|
+
function validateWorkdayIntentSelection(value) {
|
|
17
|
+
const invalid = (path, message) => ({ code: "agent_selection_invalid", path: `agentSelection${path ? `.${path}` : ""}`, message });
|
|
18
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return [invalid("", "Agent selection must be an object.")];
|
|
19
|
+
const selection = value, diagnostics = [];
|
|
20
|
+
const fields = ["classIds", "classSlugs", "agentSlugs", "activityTypes"];
|
|
21
|
+
for (const key of Object.keys(selection)) if (![...fields, "mode"].includes(key)) diagnostics.push(invalid(key, "Unknown selection field."));
|
|
22
|
+
if (selection.mode !== void 0 && !["intersection", "union"].includes(String(selection.mode))) diagnostics.push(invalid("mode", "Select intersection or union."));
|
|
23
|
+
let selected = 0;
|
|
24
|
+
for (const field of fields) {
|
|
25
|
+
const entries = selection[field];
|
|
26
|
+
if (entries === void 0) continue;
|
|
27
|
+
if (!Array.isArray(entries) || entries.length > 128 || entries.some((entry) => typeof entry !== "string" || !entry.trim() || entry.length > 128)) {
|
|
28
|
+
diagnostics.push(invalid(field, "Selectors must be a bounded array of nonempty strings."));
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
selected += entries.length;
|
|
32
|
+
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."));
|
|
33
|
+
}
|
|
34
|
+
if (!selected) diagnostics.push(invalid("", "Explicit selection must select an agent, class, or activity; omit it to select all."));
|
|
12
35
|
return diagnostics;
|
|
13
36
|
}
|
|
14
37
|
function validateSelectedDemand(demand) {
|
|
@@ -57,8 +80,10 @@ function validateWorkdaySettlement(settlement) {
|
|
|
57
80
|
return diagnostics;
|
|
58
81
|
}
|
|
59
82
|
export {
|
|
83
|
+
normalizeWorkdayAgentSelection,
|
|
60
84
|
validateSelectedDemand,
|
|
61
85
|
validateWorkdayIntent,
|
|
86
|
+
validateWorkdayIntentSelection,
|
|
62
87
|
validateWorkdayPreflight,
|
|
63
88
|
validateWorkdayPreflightFreshness,
|
|
64
89
|
validateWorkdaySettlement
|