maskweaver 0.9.4 → 0.9.6
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.ko.md +638 -592
- package/README.md +671 -667
- package/dist/cli/doctor.js +5 -21
- package/dist/cli/install.d.ts +0 -8
- package/dist/cli/install.js +0 -39
- package/dist/context/config.d.ts +0 -22
- package/dist/context/config.js +0 -28
- package/dist/context/feature.d.ts +0 -39
- package/dist/context/feature.js +0 -77
- package/dist/context/files.d.ts +0 -13
- package/dist/context/files.js +1 -24
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -12
- package/dist/context/project.d.ts +0 -21
- package/dist/context/project.js +0 -30
- package/dist/context/types.d.ts +0 -48
- package/dist/context/types.js +0 -12
- package/dist/context/utils.d.ts +0 -18
- package/dist/context/utils.js +0 -27
- package/dist/core/engine/promptBuilder.d.ts +0 -17
- package/dist/core/engine/promptBuilder.js +0 -28
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/loader/MaskLoader.d.ts +0 -23
- package/dist/core/loader/MaskLoader.js +0 -29
- package/dist/core/schema/types.d.ts +0 -47
- package/dist/core/schema/types.js +0 -6
- package/dist/core/schema/validator.d.ts +0 -14
- package/dist/core/schema/validator.js +0 -18
- package/dist/i18n/index.d.ts +0 -18
- package/dist/i18n/index.js +4 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/lib.d.ts +0 -5
- package/dist/lib.js +0 -12
- package/dist/memory/chunking.d.ts +0 -22
- package/dist/memory/chunking.js +2 -37
- package/dist/memory/core.d.ts +0 -29
- package/dist/memory/core.js +1 -52
- package/dist/memory/index.d.ts +0 -5
- package/dist/memory/index.js +0 -10
- package/dist/memory/indexer.d.ts +0 -21
- package/dist/memory/indexer.js +0 -44
- package/dist/memory/providers/examples.d.ts +0 -5
- package/dist/memory/providers/examples.js +4 -64
- package/dist/memory/providers/factory.d.ts +0 -44
- package/dist/memory/providers/factory.js +0 -46
- package/dist/memory/providers/index.d.ts +0 -26
- package/dist/memory/providers/index.js +0 -28
- package/dist/memory/providers/ollama.d.ts +0 -6
- package/dist/memory/providers/ollama.js +1 -8
- package/dist/memory/providers/openai.d.ts +0 -6
- package/dist/memory/providers/openai.js +1 -8
- package/dist/memory/providers/openrouter.d.ts +0 -6
- package/dist/memory/providers/openrouter.js +0 -8
- package/dist/memory/providers/text-only.d.ts +0 -13
- package/dist/memory/providers/text-only.js +0 -17
- package/dist/memory/providers/types.d.ts +0 -39
- package/dist/memory/providers/types.js +0 -7
- package/dist/memory/providers/voyage.d.ts +0 -22
- package/dist/memory/providers/voyage.js +1 -24
- package/dist/memory/search/hybrid.d.ts +0 -12
- package/dist/memory/search/hybrid.js +1 -22
- package/dist/memory/store/sqlite.d.ts +0 -72
- package/dist/memory/store/sqlite.js +4 -127
- package/dist/plugin/config/index.d.ts +0 -112
- package/dist/plugin/config/index.js +0 -115
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +1 -123
- package/dist/plugin/tools/command-registry.d.ts +0 -6
- package/dist/plugin/tools/command-registry.js +0 -14
- package/dist/plugin/tools/context.d.ts +0 -12
- package/dist/plugin/tools/context.js +0 -58
- package/dist/plugin/tools/maskSave.d.ts +0 -3
- package/dist/plugin/tools/maskSave.js +0 -3
- package/dist/plugin/tools/memoryGet.d.ts +0 -3
- package/dist/plugin/tools/memoryGet.js +0 -3
- package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
- package/dist/plugin/tools/memoryIndexer.js +0 -10
- package/dist/plugin/tools/memorySearch.d.ts +0 -31
- package/dist/plugin/tools/memorySearch.js +0 -79
- package/dist/plugin/tools/memoryWrite.d.ts +0 -8
- package/dist/plugin/tools/memoryWrite.js +0 -32
- package/dist/plugin/tools/retrospect.d.ts +0 -3
- package/dist/plugin/tools/retrospect.js +0 -3
- package/dist/plugin/tools/slashcommand.d.ts +0 -11
- package/dist/plugin/tools/slashcommand.js +0 -38
- package/dist/plugin/tools/squad.d.ts +0 -12
- package/dist/plugin/tools/squad.js +11 -83
- package/dist/plugin/tools/weave.d.ts +0 -6
- package/dist/plugin/tools/weave.js +0 -78
- package/dist/plugin/types.d.ts +0 -20
- package/dist/plugin/types.js +0 -7
- package/dist/retrospect/index.d.ts +0 -7
- package/dist/retrospect/index.js +0 -9
- package/dist/retrospect/mask-save.d.ts +0 -12
- package/dist/retrospect/mask-save.js +1 -80
- package/dist/retrospect/retrospect.d.ts +0 -18
- package/dist/retrospect/retrospect.js +0 -63
- package/dist/retrospect/strategies/base.d.ts +0 -15
- package/dist/retrospect/strategies/base.js +0 -7
- package/dist/retrospect/strategies/deep.d.ts +0 -12
- package/dist/retrospect/strategies/deep.js +0 -24
- package/dist/retrospect/strategies/index.d.ts +0 -12
- package/dist/retrospect/strategies/index.js +0 -12
- package/dist/retrospect/strategies/quick.d.ts +0 -12
- package/dist/retrospect/strategies/quick.js +0 -19
- package/dist/retrospect/strategies/standard.d.ts +0 -12
- package/dist/retrospect/strategies/standard.js +0 -15
- package/dist/retrospect/types.d.ts +0 -7
- package/dist/retrospect/types.js +0 -7
- package/dist/shared/config.d.ts +0 -105
- package/dist/shared/config.js +0 -33
- package/dist/shared/errors.d.ts +0 -18
- package/dist/shared/errors.js +0 -19
- package/dist/shared/generate-agents.d.ts +0 -69
- package/dist/shared/generate-agents.js +2 -86
- package/dist/shared/image.d.ts +0 -67
- package/dist/shared/image.js +6 -104
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/index.js +0 -7
- package/dist/shared/model-registry.d.ts +0 -72
- package/dist/shared/model-registry.js +5 -95
- package/dist/shared/types.d.ts +0 -15
- package/dist/shared/types.js +0 -3
- package/dist/shared-context/dag.d.ts +0 -105
- package/dist/shared-context/dag.js +3 -114
- package/dist/shared-context/index.d.ts +0 -5
- package/dist/shared-context/index.js +0 -15
- package/dist/shared-context/logger.d.ts +0 -37
- package/dist/shared-context/logger.js +0 -41
- package/dist/shared-context/parallel-executor.d.ts +0 -54
- package/dist/shared-context/parallel-executor.js +4 -56
- package/dist/shared-context/session.d.ts +0 -56
- package/dist/shared-context/session.js +0 -47
- package/dist/shared-context/squad.d.ts +0 -68
- package/dist/shared-context/squad.js +0 -63
- package/dist/shared-context/storage.d.ts +0 -132
- package/dist/shared-context/storage.js +0 -116
- package/dist/shared-context/task.d.ts +0 -120
- package/dist/shared-context/task.js +0 -152
- package/dist/shared-context/test/dag.test.js +9 -14
- package/dist/shared-context/test/logger.test.d.ts +0 -8
- package/dist/shared-context/test/logger.test.js +0 -52
- package/dist/shared-context/test/session.test.d.ts +0 -7
- package/dist/shared-context/test/session.test.js +0 -63
- package/dist/shared-context/test/squad.test.d.ts +0 -10
- package/dist/shared-context/test/squad.test.js +2 -68
- package/dist/shared-context/test/storage.test.d.ts +0 -8
- package/dist/shared-context/test/storage.test.js +0 -68
- package/dist/shared-context/test/task.test.d.ts +0 -7
- package/dist/shared-context/test/task.test.js +0 -54
- package/dist/shared-context/test/watchdog.test.d.ts +0 -7
- package/dist/shared-context/test/watchdog.test.js +3 -58
- package/dist/shared-context/types.d.ts +0 -215
- package/dist/shared-context/types.js +0 -125
- package/dist/shared-context/watchdog.d.ts +0 -127
- package/dist/shared-context/watchdog.js +0 -148
- package/dist/shared-context/worktree.d.ts +0 -68
- package/dist/shared-context/worktree.js +2 -34
- package/dist/verify/budget.d.ts +0 -29
- package/dist/verify/budget.js +0 -34
- package/dist/verify/critical-files.d.ts +0 -17
- package/dist/verify/critical-files.js +0 -37
- package/dist/verify/escalation.d.ts +0 -20
- package/dist/verify/escalation.js +0 -22
- package/dist/verify/index.d.ts +0 -5
- package/dist/verify/index.js +0 -11
- package/dist/verify/prompts.d.ts +0 -20
- package/dist/verify/prompts.js +0 -20
- package/dist/verify/types.d.ts +0 -26
- package/dist/verify/types.js +1 -12
- package/dist/verify/verifier.d.ts +0 -29
- package/dist/verify/verifier.js +0 -54
- package/dist/version.d.ts +1 -16
- package/dist/version.js +1 -16
- package/dist/weave/bridge.d.ts +0 -35
- package/dist/weave/bridge.js +0 -51
- package/dist/weave/environment/detector.d.ts +0 -6
- package/dist/weave/environment/detector.js +4 -45
- package/dist/weave/environment/index.d.ts +0 -19
- package/dist/weave/environment/index.js +1 -39
- package/dist/weave/environment/issues.d.ts +0 -35
- package/dist/weave/environment/issues.js +0 -59
- package/dist/weave/git.d.ts +0 -8
- package/dist/weave/git.js +0 -8
- package/dist/weave/index.d.ts +0 -13
- package/dist/weave/index.js +2 -28
- package/dist/weave/knowledge/global.d.ts +0 -39
- package/dist/weave/knowledge/global.js +2 -78
- package/dist/weave/loop.js +0 -3
- package/dist/weave/orchestrator.d.ts +0 -69
- package/dist/weave/orchestrator.js +1 -101
- package/dist/weave/phase-manager.d.ts +0 -64
- package/dist/weave/phase-manager.js +0 -89
- package/dist/weave/security/secret-scan.d.ts +0 -14
- package/dist/weave/security/secret-scan.js +0 -19
- package/dist/weave/stages/build.js +0 -15
- package/dist/weave/stages/execute.d.ts +0 -42
- package/dist/weave/stages/execute.js +4 -86
- package/dist/weave/stages/handoff.d.ts +0 -7
- package/dist/weave/stages/handoff.js +0 -43
- package/dist/weave/stages/index.d.ts +0 -3
- package/dist/weave/stages/index.js +0 -3
- package/dist/weave/stages/intake.d.ts +0 -8
- package/dist/weave/stages/intake.js +5 -65
- package/dist/weave/stages/map.d.ts +0 -1
- package/dist/weave/stages/openspec.d.ts +0 -1
- package/dist/weave/stages/plan.d.ts +0 -11
- package/dist/weave/stages/plan.js +1 -53
- package/dist/weave/stages/refine.d.ts +0 -7
- package/dist/weave/stages/refine.js +0 -7
- package/dist/weave/stages/research.d.ts +0 -6
- package/dist/weave/stages/research.js +0 -6
- package/dist/weave/stages/spec.d.ts +0 -12
- package/dist/weave/stages/spec.js +0 -17
- package/dist/weave/types.d.ts +0 -20
- package/dist/weave/types.js +0 -5
- package/dist/weave/verification/commands.d.ts +0 -12
- package/dist/weave/verification/commands.js +0 -19
- package/dist/weave/verification/index.d.ts +0 -6
- package/dist/weave/verification/index.js +1 -19
- package/dist/weave/verification/playwright.d.ts +0 -47
- package/dist/weave/verification/playwright.js +1 -90
- package/dist/weave/worktree.d.ts +0 -16
- package/dist/weave/worktree.js +0 -23
- package/dist/weave/yaml-repair.d.ts +0 -39
- package/dist/weave/yaml-repair.js +13 -116
- package/package.json +1 -1
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Context Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* Core types for multi-agent collaboration system.
|
|
5
|
-
* "State. You're doing it wrong." - Rich Hickey
|
|
6
|
-
*
|
|
7
|
-
* Design principles:
|
|
8
|
-
* - Data is immutable and validatable
|
|
9
|
-
* - Validate at boundaries, trust internally
|
|
10
|
-
* - Parse, don't validate
|
|
11
|
-
*
|
|
12
|
-
* @author Kent Beck's Dummy Human
|
|
13
|
-
*/
|
|
14
1
|
import { z } from "zod";
|
|
15
|
-
/** Lifecycle status for squads and tasks */
|
|
16
2
|
export type Status = "pending" | "active" | "paused" | "completed" | "failed";
|
|
17
|
-
/** Task priority levels */
|
|
18
3
|
export type Priority = "low" | "medium" | "high" | "critical";
|
|
19
|
-
/** Unique identifier for an agent */
|
|
20
4
|
export type AgentId = string;
|
|
21
|
-
/** UUID for correlation across events */
|
|
22
5
|
export type CorrelationId = string;
|
|
23
|
-
/**
|
|
24
|
-
* Generic result type for operations that may fail.
|
|
25
|
-
* Use this pattern instead of throwing for expected failures.
|
|
26
|
-
*
|
|
27
|
-
* @template T - The type of data on success
|
|
28
|
-
*/
|
|
29
6
|
export interface Result<T> {
|
|
30
|
-
/** Whether the operation succeeded */
|
|
31
7
|
success: boolean;
|
|
32
|
-
/** The result data (only present on success) */
|
|
33
8
|
data?: T;
|
|
34
|
-
/** Error message (only present on failure) */
|
|
35
9
|
error?: string;
|
|
36
10
|
}
|
|
37
|
-
/** Status enum schema */
|
|
38
11
|
export declare const StatusSchema: z.ZodEnum<{
|
|
39
12
|
active: "active";
|
|
40
13
|
paused: "paused";
|
|
@@ -42,43 +15,26 @@ export declare const StatusSchema: z.ZodEnum<{
|
|
|
42
15
|
pending: "pending";
|
|
43
16
|
failed: "failed";
|
|
44
17
|
}>;
|
|
45
|
-
/** Priority enum schema */
|
|
46
18
|
export declare const PrioritySchema: z.ZodEnum<{
|
|
47
19
|
low: "low";
|
|
48
20
|
medium: "medium";
|
|
49
21
|
high: "high";
|
|
50
22
|
critical: "critical";
|
|
51
23
|
}>;
|
|
52
|
-
/** Agent ID schema (non-empty string) */
|
|
53
24
|
export declare const AgentIdSchema: z.ZodString;
|
|
54
|
-
/** Correlation ID schema (UUID format) */
|
|
55
25
|
export declare const CorrelationIdSchema: z.ZodString;
|
|
56
|
-
/**
|
|
57
|
-
* Session manifest containing metadata and squad references.
|
|
58
|
-
* This is the root document for a collaboration session.
|
|
59
|
-
*/
|
|
60
26
|
export interface Manifest {
|
|
61
|
-
/** UUID of the session */
|
|
62
27
|
sessionId: string;
|
|
63
|
-
/** Schema version for migration support */
|
|
64
28
|
version: number;
|
|
65
|
-
/** High-level goal for the session */
|
|
66
29
|
goal: string;
|
|
67
|
-
/** ISO timestamp of creation */
|
|
68
30
|
createdAt: string;
|
|
69
|
-
/** Agent ID of the session creator */
|
|
70
31
|
createdBy: AgentId;
|
|
71
|
-
/** List of squad IDs in this session */
|
|
72
32
|
squads: string[];
|
|
73
|
-
/** Optional resource constraints */
|
|
74
33
|
constraints?: {
|
|
75
|
-
/** Maximum duration (e.g., "1h", "30m") */
|
|
76
34
|
timeout?: string;
|
|
77
|
-
/** Maximum token budget */
|
|
78
35
|
tokenBudget?: number;
|
|
79
36
|
};
|
|
80
37
|
}
|
|
81
|
-
/** Manifest schema for runtime validation */
|
|
82
38
|
export declare const ManifestSchema: z.ZodObject<{
|
|
83
39
|
sessionId: z.ZodString;
|
|
84
40
|
version: z.ZodNumber;
|
|
@@ -91,37 +47,21 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
91
47
|
tokenBudget: z.ZodOptional<z.ZodNumber>;
|
|
92
48
|
}, z.core.$strip>>;
|
|
93
49
|
}, z.core.$strip>;
|
|
94
|
-
/**
|
|
95
|
-
* Squad specification defining mission, constraints, and scope.
|
|
96
|
-
* Immutable after creation - use SquadState for mutable data.
|
|
97
|
-
*/
|
|
98
50
|
export interface SquadSpec {
|
|
99
|
-
/** Unique squad identifier (e.g., "squad-a1b2c3d4") */
|
|
100
51
|
squadId: string;
|
|
101
|
-
/** The squad's mission objective */
|
|
102
52
|
mission: string;
|
|
103
|
-
/** Agent ID of the squad operator */
|
|
104
53
|
operator: AgentId;
|
|
105
|
-
/** Resource constraints for the squad */
|
|
106
54
|
constraints?: {
|
|
107
|
-
/** Maximum duration */
|
|
108
55
|
timeout?: string;
|
|
109
|
-
/** Maximum token budget */
|
|
110
56
|
tokenBudget?: number;
|
|
111
|
-
/** Maximum number of worker agents */
|
|
112
57
|
maxWorkers?: number;
|
|
113
58
|
};
|
|
114
|
-
/** File and directory scope for the squad */
|
|
115
59
|
scope?: {
|
|
116
|
-
/** Files the squad can modify */
|
|
117
60
|
files?: string[];
|
|
118
|
-
/** Directories the squad can access */
|
|
119
61
|
directories?: string[];
|
|
120
62
|
};
|
|
121
|
-
/** ISO timestamp of creation */
|
|
122
63
|
createdAt: string;
|
|
123
64
|
}
|
|
124
|
-
/** SquadSpec schema for runtime validation */
|
|
125
65
|
export declare const SquadSpecSchema: z.ZodObject<{
|
|
126
66
|
squadId: z.ZodString;
|
|
127
67
|
mission: z.ZodString;
|
|
@@ -137,32 +77,18 @@ export declare const SquadSpecSchema: z.ZodObject<{
|
|
|
137
77
|
}, z.core.$strip>>;
|
|
138
78
|
createdAt: z.ZodString;
|
|
139
79
|
}, z.core.$strip>;
|
|
140
|
-
/**
|
|
141
|
-
* Individual task state within a squad.
|
|
142
|
-
*/
|
|
143
80
|
export interface TaskState {
|
|
144
|
-
/** Unique task identifier */
|
|
145
81
|
taskId: string;
|
|
146
|
-
/** Agent assigned to this task */
|
|
147
82
|
assignee: AgentId;
|
|
148
|
-
/** Current task status */
|
|
149
83
|
status: Status;
|
|
150
|
-
/** Task priority */
|
|
151
84
|
priority: Priority;
|
|
152
|
-
/** Human-readable task description */
|
|
153
85
|
description: string;
|
|
154
|
-
/** IDs of tasks this depends on */
|
|
155
86
|
dependencies?: string[];
|
|
156
|
-
/** ISO timestamp of creation */
|
|
157
87
|
createdAt: string;
|
|
158
|
-
/** ISO timestamp when work started */
|
|
159
88
|
startedAt?: string;
|
|
160
|
-
/** ISO timestamp when completed */
|
|
161
89
|
completedAt?: string;
|
|
162
|
-
/** Task result data */
|
|
163
90
|
result?: unknown;
|
|
164
91
|
}
|
|
165
|
-
/** TaskState schema for runtime validation */
|
|
166
92
|
export declare const TaskStateSchema: z.ZodObject<{
|
|
167
93
|
taskId: z.ZodString;
|
|
168
94
|
assignee: z.ZodString;
|
|
@@ -186,23 +112,13 @@ export declare const TaskStateSchema: z.ZodObject<{
|
|
|
186
112
|
completedAt: z.ZodOptional<z.ZodString>;
|
|
187
113
|
result: z.ZodOptional<z.ZodUnknown>;
|
|
188
114
|
}, z.core.$strip>;
|
|
189
|
-
/**
|
|
190
|
-
* Options for creating a new task.
|
|
191
|
-
* "Make implicit concepts explicit" - Eric Evans
|
|
192
|
-
*/
|
|
193
115
|
export interface CreateTaskOptions {
|
|
194
|
-
/** Agent responsible for executing this task */
|
|
195
116
|
assignee: AgentId;
|
|
196
|
-
/** Human-readable description of what needs to be done */
|
|
197
117
|
description: string;
|
|
198
|
-
/** Task priority (defaults to 'medium' if not specified) */
|
|
199
118
|
priority?: Priority;
|
|
200
|
-
/** Task IDs that must complete before this task can start */
|
|
201
119
|
dependencies?: string[];
|
|
202
|
-
/** Maximum time allowed for task execution in milliseconds */
|
|
203
120
|
timeout?: number;
|
|
204
121
|
}
|
|
205
|
-
/** CreateTaskOptions schema for runtime validation */
|
|
206
122
|
export declare const CreateTaskOptionsSchema: z.ZodObject<{
|
|
207
123
|
assignee: z.ZodString;
|
|
208
124
|
description: z.ZodString;
|
|
@@ -215,42 +131,28 @@ export declare const CreateTaskOptionsSchema: z.ZodObject<{
|
|
|
215
131
|
dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
132
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
217
133
|
}, z.core.$strip>;
|
|
218
|
-
/** Structured error information for failed tasks */
|
|
219
134
|
export interface TaskError {
|
|
220
|
-
/** Machine-readable error code (e.g., "TIMEOUT", "DEPENDENCY_FAILED") */
|
|
221
135
|
code: string;
|
|
222
|
-
/** Human-readable error description */
|
|
223
136
|
message: string;
|
|
224
137
|
}
|
|
225
|
-
/** TaskError schema */
|
|
226
138
|
export declare const TaskErrorSchema: z.ZodObject<{
|
|
227
139
|
code: z.ZodString;
|
|
228
140
|
message: z.ZodString;
|
|
229
141
|
}, z.core.$strip>;
|
|
230
|
-
/** Execution metrics captured during task processing */
|
|
231
142
|
export interface TaskMetrics {
|
|
232
|
-
/** Task execution duration in milliseconds */
|
|
233
143
|
duration: number;
|
|
234
|
-
/** Number of tokens consumed (if applicable) */
|
|
235
144
|
tokensUsed?: number;
|
|
236
145
|
}
|
|
237
|
-
/** TaskMetrics schema */
|
|
238
146
|
export declare const TaskMetricsSchema: z.ZodObject<{
|
|
239
147
|
duration: z.ZodNumber;
|
|
240
148
|
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
241
149
|
}, z.core.$strip>;
|
|
242
|
-
/** The outcome of a completed task */
|
|
243
150
|
export interface TaskResult {
|
|
244
|
-
/** Whether the task completed successfully */
|
|
245
151
|
success: boolean;
|
|
246
|
-
/** Task output data (present on success) */
|
|
247
152
|
output?: unknown;
|
|
248
|
-
/** Structured error information (present on failure) */
|
|
249
153
|
error?: TaskError;
|
|
250
|
-
/** Execution metrics for observability */
|
|
251
154
|
metrics?: TaskMetrics;
|
|
252
155
|
}
|
|
253
|
-
/** TaskResult schema for runtime validation */
|
|
254
156
|
export declare const TaskResultSchema: z.ZodObject<{
|
|
255
157
|
success: z.ZodBoolean;
|
|
256
158
|
output: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -263,24 +165,17 @@ export declare const TaskResultSchema: z.ZodObject<{
|
|
|
263
165
|
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
264
166
|
}, z.core.$strip>>;
|
|
265
167
|
}, z.core.$strip>;
|
|
266
|
-
/** Actions to take when a timeout occurs */
|
|
267
168
|
export type TimeoutAction = "fail" | "pause" | "notify";
|
|
268
|
-
/** Timeout action schema */
|
|
269
169
|
export declare const TimeoutActionSchema: z.ZodEnum<{
|
|
270
170
|
fail: "fail";
|
|
271
171
|
pause: "pause";
|
|
272
172
|
notify: "notify";
|
|
273
173
|
}>;
|
|
274
|
-
/** Custom timeout configuration for squads and tasks */
|
|
275
174
|
export interface TimeoutConfig {
|
|
276
|
-
/** Custom timeout in milliseconds (overrides LIMITS.watchdogTimeoutMs) */
|
|
277
175
|
timeoutMs?: number;
|
|
278
|
-
/** Grace period before hard kill */
|
|
279
176
|
gracePeriodMs?: number;
|
|
280
|
-
/** Action to take on timeout: fail (default), pause for retry, or notify only */
|
|
281
177
|
onTimeout?: TimeoutAction;
|
|
282
178
|
}
|
|
283
|
-
/** TimeoutConfig schema for runtime validation */
|
|
284
179
|
export declare const TimeoutConfigSchema: z.ZodObject<{
|
|
285
180
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
286
181
|
gracePeriodMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -290,43 +185,26 @@ export declare const TimeoutConfigSchema: z.ZodObject<{
|
|
|
290
185
|
notify: "notify";
|
|
291
186
|
}>>;
|
|
292
187
|
}, z.core.$strip>;
|
|
293
|
-
/** Real-time timeout status from watchdog health check */
|
|
294
188
|
export interface TimeoutStatus {
|
|
295
|
-
/** Whether the timeout has expired */
|
|
296
189
|
isExpired: boolean;
|
|
297
|
-
/** Milliseconds elapsed since start or last activity */
|
|
298
190
|
elapsedMs: number;
|
|
299
|
-
/** Milliseconds remaining before timeout (negative if expired) */
|
|
300
191
|
remainingMs: number;
|
|
301
|
-
/** ISO timestamp of last recorded activity */
|
|
302
192
|
lastActivityAt: string;
|
|
303
193
|
}
|
|
304
|
-
/** TimeoutStatus schema for runtime validation */
|
|
305
194
|
export declare const TimeoutStatusSchema: z.ZodObject<{
|
|
306
195
|
isExpired: z.ZodBoolean;
|
|
307
196
|
elapsedMs: z.ZodNumber;
|
|
308
197
|
remainingMs: z.ZodNumber;
|
|
309
198
|
lastActivityAt: z.ZodString;
|
|
310
199
|
}, z.core.$strip>;
|
|
311
|
-
/**
|
|
312
|
-
* Mutable squad state including status, progress, and tasks.
|
|
313
|
-
* Updated frequently as work progresses.
|
|
314
|
-
*/
|
|
315
200
|
export interface SquadState {
|
|
316
|
-
/** Squad ID (matches SquadSpec.squadId) */
|
|
317
201
|
squadId: string;
|
|
318
|
-
/** Current squad status */
|
|
319
202
|
status: Status;
|
|
320
|
-
/** Progress percentage (0-100) */
|
|
321
203
|
progress: number;
|
|
322
|
-
/** List of tasks in this squad */
|
|
323
204
|
tasks: TaskState[];
|
|
324
|
-
/** Shared context data between workers */
|
|
325
205
|
sharedContext: Record<string, unknown>;
|
|
326
|
-
/** ISO timestamp of last update */
|
|
327
206
|
updatedAt: string;
|
|
328
207
|
}
|
|
329
|
-
/** SquadState schema for runtime validation */
|
|
330
208
|
export declare const SquadStateSchema: z.ZodObject<{
|
|
331
209
|
squadId: z.ZodString;
|
|
332
210
|
status: z.ZodEnum<{
|
|
@@ -369,10 +247,6 @@ export interface Session {
|
|
|
369
247
|
sessionPath: string;
|
|
370
248
|
}
|
|
371
249
|
import { StorageAdapter } from "./storage.js";
|
|
372
|
-
/**
|
|
373
|
-
* Discriminated union of all possible log event types.
|
|
374
|
-
* Each event has a `type` field for discrimination and `ts` for timestamp.
|
|
375
|
-
*/
|
|
376
250
|
export type LogEvent = {
|
|
377
251
|
type: "squad_started";
|
|
378
252
|
ts: string;
|
|
@@ -406,10 +280,6 @@ export type LogEvent = {
|
|
|
406
280
|
message: string;
|
|
407
281
|
source?: AgentId;
|
|
408
282
|
};
|
|
409
|
-
/**
|
|
410
|
-
* Log event input type (without timestamp).
|
|
411
|
-
* Used for logEvent() function - timestamp is added automatically.
|
|
412
|
-
*/
|
|
413
283
|
export type LogEventInput = {
|
|
414
284
|
type: "squad_started";
|
|
415
285
|
squadId: string;
|
|
@@ -437,7 +307,6 @@ export type LogEventInput = {
|
|
|
437
307
|
message: string;
|
|
438
308
|
source?: AgentId;
|
|
439
309
|
};
|
|
440
|
-
/** LogEvent schema for runtime validation (discriminated union) */
|
|
441
310
|
export declare const LogEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
442
311
|
type: z.ZodLiteral<"squad_started">;
|
|
443
312
|
ts: z.ZodString;
|
|
@@ -477,112 +346,28 @@ export declare const LogEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
477
346
|
message: z.ZodString;
|
|
478
347
|
source: z.ZodOptional<z.ZodString>;
|
|
479
348
|
}, z.core.$strip>], "type">;
|
|
480
|
-
/**
|
|
481
|
-
* System limits to prevent resource exhaustion.
|
|
482
|
-
* These values are enforced at runtime.
|
|
483
|
-
*
|
|
484
|
-
* Watchdog timeouts follow the principle:
|
|
485
|
-
* "If you can't measure it, you can't improve it." - Brendan Gregg
|
|
486
|
-
*/
|
|
487
349
|
export declare const LIMITS: {
|
|
488
|
-
/** Maximum number of squads per session */
|
|
489
350
|
readonly maxSquadsPerSession: 10;
|
|
490
|
-
/** Maximum number of worker agents per squad */
|
|
491
351
|
readonly maxWorkersPerSquad: 5;
|
|
492
|
-
/** Maximum number of tasks per squad */
|
|
493
352
|
readonly maxTasksPerSquad: 50;
|
|
494
|
-
/** Maximum size of shared context data (1MB) */
|
|
495
353
|
readonly maxSharedContextSize: number;
|
|
496
|
-
/** Maximum size of log file (10MB) */
|
|
497
354
|
readonly maxLogSize: number;
|
|
498
|
-
/** Lock acquisition timeout in milliseconds */
|
|
499
355
|
readonly lockTimeout: 5000;
|
|
500
|
-
/** Time after which a lock is considered stale (ms) */
|
|
501
356
|
readonly lockStale: 30000;
|
|
502
|
-
/** Number of retry attempts for lock acquisition */
|
|
503
357
|
readonly lockRetries: 3;
|
|
504
|
-
/** Default watchdog timeout (5 minutes) - kills stuck agents */
|
|
505
358
|
readonly watchdogTimeoutMs: number;
|
|
506
|
-
/** Watchdog health check interval (30 seconds) */
|
|
507
359
|
readonly watchdogCheckIntervalMs: number;
|
|
508
|
-
/** Grace period before hard timeout (10 seconds) - allows cleanup */
|
|
509
360
|
readonly watchdogGracePeriodMs: number;
|
|
510
361
|
};
|
|
511
|
-
/**
|
|
512
|
-
* Validate manifest data at system boundaries.
|
|
513
|
-
* Parse once at the edge, trust internally.
|
|
514
|
-
*
|
|
515
|
-
* @param data - Unknown data from external source
|
|
516
|
-
* @returns Validated Manifest
|
|
517
|
-
* @throws {z.ZodError} If validation fails
|
|
518
|
-
*/
|
|
519
362
|
export declare function validateManifest(data: unknown): Manifest;
|
|
520
|
-
/**
|
|
521
|
-
* Validate squad spec data.
|
|
522
|
-
*
|
|
523
|
-
* @param data - Unknown data from external source
|
|
524
|
-
* @returns Validated SquadSpec
|
|
525
|
-
* @throws {z.ZodError} If validation fails
|
|
526
|
-
*/
|
|
527
363
|
export declare function validateSquadSpec(data: unknown): SquadSpec;
|
|
528
|
-
/**
|
|
529
|
-
* Validate squad state data.
|
|
530
|
-
*
|
|
531
|
-
* @param data - Unknown data from external source
|
|
532
|
-
* @returns Validated SquadState
|
|
533
|
-
* @throws {z.ZodError} If validation fails
|
|
534
|
-
*/
|
|
535
364
|
export declare function validateSquadState(data: unknown): SquadState;
|
|
536
|
-
/**
|
|
537
|
-
* Validate task state data.
|
|
538
|
-
*
|
|
539
|
-
* @param data - Unknown data from external source
|
|
540
|
-
* @returns Validated TaskState
|
|
541
|
-
* @throws {z.ZodError} If validation fails
|
|
542
|
-
*/
|
|
543
365
|
export declare function validateTaskState(data: unknown): TaskState;
|
|
544
|
-
/**
|
|
545
|
-
* Validate log event data.
|
|
546
|
-
*
|
|
547
|
-
* @param data - Unknown data from external source
|
|
548
|
-
* @returns Validated LogEvent
|
|
549
|
-
* @throws {z.ZodError} If validation fails
|
|
550
|
-
*/
|
|
551
366
|
export declare function validateLogEvent(data: unknown): LogEvent;
|
|
552
|
-
/**
|
|
553
|
-
* Validate task creation options.
|
|
554
|
-
*/
|
|
555
367
|
export declare function validateCreateTaskOptions(data: unknown): CreateTaskOptions;
|
|
556
|
-
/**
|
|
557
|
-
* Validate task result data.
|
|
558
|
-
*/
|
|
559
368
|
export declare function validateTaskResult(data: unknown): TaskResult;
|
|
560
|
-
/**
|
|
561
|
-
* Validate timeout config data.
|
|
562
|
-
*/
|
|
563
369
|
export declare function validateTimeoutConfig(data: unknown): TimeoutConfig;
|
|
564
|
-
/**
|
|
565
|
-
* Validate timeout status data.
|
|
566
|
-
*/
|
|
567
370
|
export declare function validateTimeoutStatus(data: unknown): TimeoutStatus;
|
|
568
|
-
/**
|
|
569
|
-
* Safely validate manifest data without throwing.
|
|
570
|
-
*
|
|
571
|
-
* @param data - Unknown data from external source
|
|
572
|
-
* @returns Result with validated data or error message
|
|
573
|
-
*/
|
|
574
371
|
export declare function safeValidateManifest(data: unknown): Result<Manifest>;
|
|
575
|
-
/**
|
|
576
|
-
* Safely validate squad spec data without throwing.
|
|
577
|
-
*
|
|
578
|
-
* @param data - Unknown data from external source
|
|
579
|
-
* @returns Result with validated data or error message
|
|
580
|
-
*/
|
|
581
372
|
export declare function safeValidateSquadSpec(data: unknown): Result<SquadSpec>;
|
|
582
|
-
/**
|
|
583
|
-
* Safely validate squad state data without throwing.
|
|
584
|
-
*
|
|
585
|
-
* @param data - Unknown data from external source
|
|
586
|
-
* @returns Result with validated data or error message
|
|
587
|
-
*/
|
|
588
373
|
export declare function safeValidateSquadState(data: unknown): Result<SquadState>;
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Context Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* Core types for multi-agent collaboration system.
|
|
5
|
-
* "State. You're doing it wrong." - Rich Hickey
|
|
6
|
-
*
|
|
7
|
-
* Design principles:
|
|
8
|
-
* - Data is immutable and validatable
|
|
9
|
-
* - Validate at boundaries, trust internally
|
|
10
|
-
* - Parse, don't validate
|
|
11
|
-
*
|
|
12
|
-
* @author Kent Beck's Dummy Human
|
|
13
|
-
*/
|
|
14
1
|
import { z } from "zod";
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// Zod Schemas - Validate at boundaries, trust internally
|
|
17
|
-
// ============================================================================
|
|
18
|
-
/** Status enum schema */
|
|
19
2
|
export const StatusSchema = z.enum(["pending", "active", "paused", "completed", "failed"]);
|
|
20
|
-
/** Priority enum schema */
|
|
21
3
|
export const PrioritySchema = z.enum(["low", "medium", "high", "critical"]);
|
|
22
|
-
/** Agent ID schema (non-empty string) */
|
|
23
4
|
export const AgentIdSchema = z.string().min(1);
|
|
24
|
-
/** Correlation ID schema (UUID format) */
|
|
25
5
|
export const CorrelationIdSchema = z.string().uuid();
|
|
26
|
-
/** Manifest schema for runtime validation */
|
|
27
6
|
export const ManifestSchema = z.object({
|
|
28
7
|
sessionId: z.string().uuid(),
|
|
29
8
|
version: z.number().int().positive(),
|
|
@@ -36,7 +15,6 @@ export const ManifestSchema = z.object({
|
|
|
36
15
|
tokenBudget: z.number().optional(),
|
|
37
16
|
}).optional(),
|
|
38
17
|
});
|
|
39
|
-
/** SquadSpec schema for runtime validation */
|
|
40
18
|
export const SquadSpecSchema = z.object({
|
|
41
19
|
squadId: z.string().min(1),
|
|
42
20
|
mission: z.string().min(1),
|
|
@@ -52,7 +30,6 @@ export const SquadSpecSchema = z.object({
|
|
|
52
30
|
}).optional(),
|
|
53
31
|
createdAt: z.string().datetime(),
|
|
54
32
|
});
|
|
55
|
-
/** TaskState schema for runtime validation */
|
|
56
33
|
export const TaskStateSchema = z.object({
|
|
57
34
|
taskId: z.string().min(1),
|
|
58
35
|
assignee: AgentIdSchema,
|
|
@@ -65,7 +42,6 @@ export const TaskStateSchema = z.object({
|
|
|
65
42
|
completedAt: z.string().datetime().optional(),
|
|
66
43
|
result: z.unknown().optional(),
|
|
67
44
|
});
|
|
68
|
-
/** CreateTaskOptions schema for runtime validation */
|
|
69
45
|
export const CreateTaskOptionsSchema = z.object({
|
|
70
46
|
assignee: AgentIdSchema,
|
|
71
47
|
description: z.string().min(1, "Description cannot be empty"),
|
|
@@ -73,17 +49,14 @@ export const CreateTaskOptionsSchema = z.object({
|
|
|
73
49
|
dependencies: z.array(z.string().min(1)).optional(),
|
|
74
50
|
timeout: z.number().int().positive().optional(),
|
|
75
51
|
});
|
|
76
|
-
/** TaskError schema */
|
|
77
52
|
export const TaskErrorSchema = z.object({
|
|
78
53
|
code: z.string().min(1),
|
|
79
54
|
message: z.string().min(1),
|
|
80
55
|
});
|
|
81
|
-
/** TaskMetrics schema */
|
|
82
56
|
export const TaskMetricsSchema = z.object({
|
|
83
57
|
duration: z.number().int().nonnegative(),
|
|
84
58
|
tokensUsed: z.number().int().nonnegative().optional(),
|
|
85
59
|
});
|
|
86
|
-
/** TaskResult schema for runtime validation */
|
|
87
60
|
export const TaskResultSchema = z.object({
|
|
88
61
|
success: z.boolean(),
|
|
89
62
|
output: z.unknown().optional(),
|
|
@@ -96,22 +69,18 @@ export const TaskResultSchema = z.object({
|
|
|
96
69
|
return false;
|
|
97
70
|
return true;
|
|
98
71
|
}, { message: "Failed tasks must have error, successful tasks must not have error" });
|
|
99
|
-
/** Timeout action schema */
|
|
100
72
|
export const TimeoutActionSchema = z.enum(["fail", "pause", "notify"]);
|
|
101
|
-
/** TimeoutConfig schema for runtime validation */
|
|
102
73
|
export const TimeoutConfigSchema = z.object({
|
|
103
74
|
timeoutMs: z.number().int().positive().optional(),
|
|
104
75
|
gracePeriodMs: z.number().int().positive().optional(),
|
|
105
76
|
onTimeout: TimeoutActionSchema.optional(),
|
|
106
77
|
});
|
|
107
|
-
/** TimeoutStatus schema for runtime validation */
|
|
108
78
|
export const TimeoutStatusSchema = z.object({
|
|
109
79
|
isExpired: z.boolean(),
|
|
110
80
|
elapsedMs: z.number().int().nonnegative(),
|
|
111
81
|
remainingMs: z.number().int(),
|
|
112
82
|
lastActivityAt: z.string().datetime(),
|
|
113
83
|
});
|
|
114
|
-
/** SquadState schema for runtime validation */
|
|
115
84
|
export const SquadStateSchema = z.object({
|
|
116
85
|
squadId: z.string().min(1),
|
|
117
86
|
status: StatusSchema,
|
|
@@ -120,7 +89,6 @@ export const SquadStateSchema = z.object({
|
|
|
120
89
|
sharedContext: z.record(z.string(), z.unknown()),
|
|
121
90
|
updatedAt: z.string().datetime(),
|
|
122
91
|
});
|
|
123
|
-
/** LogEvent schema for runtime validation (discriminated union) */
|
|
124
92
|
export const LogEventSchema = z.discriminatedUnion("type", [
|
|
125
93
|
z.object({
|
|
126
94
|
type: z.literal("squad_started"),
|
|
@@ -161,127 +129,46 @@ export const LogEventSchema = z.discriminatedUnion("type", [
|
|
|
161
129
|
source: AgentIdSchema.optional(),
|
|
162
130
|
}),
|
|
163
131
|
]);
|
|
164
|
-
// ============================================================================
|
|
165
|
-
// Limits and Constants
|
|
166
|
-
// ============================================================================
|
|
167
|
-
/**
|
|
168
|
-
* System limits to prevent resource exhaustion.
|
|
169
|
-
* These values are enforced at runtime.
|
|
170
|
-
*
|
|
171
|
-
* Watchdog timeouts follow the principle:
|
|
172
|
-
* "If you can't measure it, you can't improve it." - Brendan Gregg
|
|
173
|
-
*/
|
|
174
132
|
export const LIMITS = {
|
|
175
|
-
/** Maximum number of squads per session */
|
|
176
133
|
maxSquadsPerSession: 10,
|
|
177
|
-
/** Maximum number of worker agents per squad */
|
|
178
134
|
maxWorkersPerSquad: 5,
|
|
179
|
-
/** Maximum number of tasks per squad */
|
|
180
135
|
maxTasksPerSquad: 50,
|
|
181
|
-
/** Maximum size of shared context data (1MB) */
|
|
182
136
|
maxSharedContextSize: 1024 * 1024,
|
|
183
|
-
/** Maximum size of log file (10MB) */
|
|
184
137
|
maxLogSize: 10 * 1024 * 1024,
|
|
185
|
-
/** Lock acquisition timeout in milliseconds */
|
|
186
138
|
lockTimeout: 5000,
|
|
187
|
-
/** Time after which a lock is considered stale (ms) */
|
|
188
139
|
lockStale: 30000,
|
|
189
|
-
/** Number of retry attempts for lock acquisition */
|
|
190
140
|
lockRetries: 3,
|
|
191
|
-
/** Default watchdog timeout (5 minutes) - kills stuck agents */
|
|
192
141
|
watchdogTimeoutMs: 5 * 60 * 1000,
|
|
193
|
-
/** Watchdog health check interval (30 seconds) */
|
|
194
142
|
watchdogCheckIntervalMs: 30 * 1000,
|
|
195
|
-
/** Grace period before hard timeout (10 seconds) - allows cleanup */
|
|
196
143
|
watchdogGracePeriodMs: 10 * 1000,
|
|
197
144
|
};
|
|
198
|
-
// ============================================================================
|
|
199
|
-
// Validation Functions - Parse, don't validate
|
|
200
|
-
// ============================================================================
|
|
201
|
-
/**
|
|
202
|
-
* Validate manifest data at system boundaries.
|
|
203
|
-
* Parse once at the edge, trust internally.
|
|
204
|
-
*
|
|
205
|
-
* @param data - Unknown data from external source
|
|
206
|
-
* @returns Validated Manifest
|
|
207
|
-
* @throws {z.ZodError} If validation fails
|
|
208
|
-
*/
|
|
209
145
|
export function validateManifest(data) {
|
|
210
146
|
return ManifestSchema.parse(data);
|
|
211
147
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Validate squad spec data.
|
|
214
|
-
*
|
|
215
|
-
* @param data - Unknown data from external source
|
|
216
|
-
* @returns Validated SquadSpec
|
|
217
|
-
* @throws {z.ZodError} If validation fails
|
|
218
|
-
*/
|
|
219
148
|
export function validateSquadSpec(data) {
|
|
220
149
|
return SquadSpecSchema.parse(data);
|
|
221
150
|
}
|
|
222
|
-
/**
|
|
223
|
-
* Validate squad state data.
|
|
224
|
-
*
|
|
225
|
-
* @param data - Unknown data from external source
|
|
226
|
-
* @returns Validated SquadState
|
|
227
|
-
* @throws {z.ZodError} If validation fails
|
|
228
|
-
*/
|
|
229
151
|
export function validateSquadState(data) {
|
|
230
152
|
return SquadStateSchema.parse(data);
|
|
231
153
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Validate task state data.
|
|
234
|
-
*
|
|
235
|
-
* @param data - Unknown data from external source
|
|
236
|
-
* @returns Validated TaskState
|
|
237
|
-
* @throws {z.ZodError} If validation fails
|
|
238
|
-
*/
|
|
239
154
|
export function validateTaskState(data) {
|
|
240
155
|
return TaskStateSchema.parse(data);
|
|
241
156
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Validate log event data.
|
|
244
|
-
*
|
|
245
|
-
* @param data - Unknown data from external source
|
|
246
|
-
* @returns Validated LogEvent
|
|
247
|
-
* @throws {z.ZodError} If validation fails
|
|
248
|
-
*/
|
|
249
157
|
export function validateLogEvent(data) {
|
|
250
158
|
return LogEventSchema.parse(data);
|
|
251
159
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Validate task creation options.
|
|
254
|
-
*/
|
|
255
160
|
export function validateCreateTaskOptions(data) {
|
|
256
161
|
return CreateTaskOptionsSchema.parse(data);
|
|
257
162
|
}
|
|
258
|
-
/**
|
|
259
|
-
* Validate task result data.
|
|
260
|
-
*/
|
|
261
163
|
export function validateTaskResult(data) {
|
|
262
164
|
return TaskResultSchema.parse(data);
|
|
263
165
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Validate timeout config data.
|
|
266
|
-
*/
|
|
267
166
|
export function validateTimeoutConfig(data) {
|
|
268
167
|
return TimeoutConfigSchema.parse(data);
|
|
269
168
|
}
|
|
270
|
-
/**
|
|
271
|
-
* Validate timeout status data.
|
|
272
|
-
*/
|
|
273
169
|
export function validateTimeoutStatus(data) {
|
|
274
170
|
return TimeoutStatusSchema.parse(data);
|
|
275
171
|
}
|
|
276
|
-
// ============================================================================
|
|
277
|
-
// Safe Validation - Result pattern (doesn't throw)
|
|
278
|
-
// ============================================================================
|
|
279
|
-
/**
|
|
280
|
-
* Safely validate manifest data without throwing.
|
|
281
|
-
*
|
|
282
|
-
* @param data - Unknown data from external source
|
|
283
|
-
* @returns Result with validated data or error message
|
|
284
|
-
*/
|
|
285
172
|
export function safeValidateManifest(data) {
|
|
286
173
|
const result = ManifestSchema.safeParse(data);
|
|
287
174
|
if (result.success) {
|
|
@@ -289,12 +176,6 @@ export function safeValidateManifest(data) {
|
|
|
289
176
|
}
|
|
290
177
|
return { success: false, error: result.error.message };
|
|
291
178
|
}
|
|
292
|
-
/**
|
|
293
|
-
* Safely validate squad spec data without throwing.
|
|
294
|
-
*
|
|
295
|
-
* @param data - Unknown data from external source
|
|
296
|
-
* @returns Result with validated data or error message
|
|
297
|
-
*/
|
|
298
179
|
export function safeValidateSquadSpec(data) {
|
|
299
180
|
const result = SquadSpecSchema.safeParse(data);
|
|
300
181
|
if (result.success) {
|
|
@@ -302,12 +183,6 @@ export function safeValidateSquadSpec(data) {
|
|
|
302
183
|
}
|
|
303
184
|
return { success: false, error: result.error.message };
|
|
304
185
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Safely validate squad state data without throwing.
|
|
307
|
-
*
|
|
308
|
-
* @param data - Unknown data from external source
|
|
309
|
-
* @returns Result with validated data or error message
|
|
310
|
-
*/
|
|
311
186
|
export function safeValidateSquadState(data) {
|
|
312
187
|
const result = SquadStateSchema.safeParse(data);
|
|
313
188
|
if (result.success) {
|