@hyperdrive.bot/paseo-protocol 0.3.35 → 0.3.36

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.
@@ -0,0 +1,187 @@
1
+ import { z } from "zod";
2
+ import { LoopDecisionKindSchema, LoopDecisionOptionSchema, LoopDecisionPostureSchema, LoopDecisionSchema, } from "./decisions.js";
3
+ import { LoopParamValueSchema } from "./params.js";
4
+ import { FleetExecutionSchema, FleetLoopModeSchema, FleetLoopSummarySchema, StoredFleetLoopSchema, } from "./types.js";
5
+ // --- requests ---------------------------------------------------------------
6
+ export const FleetListRequestSchema = z.object({
7
+ type: z.literal("fleet/list"),
8
+ requestId: z.string(),
9
+ });
10
+ export const FleetInspectRequestSchema = z.object({
11
+ type: z.literal("fleet/inspect"),
12
+ requestId: z.string(),
13
+ name: z.string(),
14
+ });
15
+ export const FleetRunNowRequestSchema = z.object({
16
+ type: z.literal("fleet/run-now"),
17
+ requestId: z.string(),
18
+ name: z.string(),
19
+ });
20
+ export const FleetPauseRequestSchema = z.object({
21
+ type: z.literal("fleet/pause"),
22
+ requestId: z.string(),
23
+ name: z.string(),
24
+ });
25
+ export const FleetResumeRequestSchema = z.object({
26
+ type: z.literal("fleet/resume"),
27
+ requestId: z.string(),
28
+ name: z.string(),
29
+ });
30
+ // --- responses --------------------------------------------------------------
31
+ export const FleetListResponseSchema = z.object({
32
+ type: z.literal("fleet/list/response"),
33
+ payload: z.object({
34
+ requestId: z.string(),
35
+ loops: z.array(FleetLoopSummarySchema),
36
+ error: z.string().nullable(),
37
+ }),
38
+ });
39
+ export const FleetInspectResponseSchema = z.object({
40
+ type: z.literal("fleet/inspect/response"),
41
+ payload: z.object({
42
+ requestId: z.string(),
43
+ loop: StoredFleetLoopSchema.nullable(),
44
+ error: z.string().nullable(),
45
+ }),
46
+ });
47
+ export const FleetRunNowResponseSchema = z.object({
48
+ type: z.literal("fleet/run-now/response"),
49
+ payload: z.object({
50
+ requestId: z.string(),
51
+ loop: StoredFleetLoopSchema.nullable(),
52
+ started: z.boolean(),
53
+ error: z.string().nullable(),
54
+ }),
55
+ });
56
+ export const FleetPauseResponseSchema = z.object({
57
+ type: z.literal("fleet/pause/response"),
58
+ payload: z.object({
59
+ requestId: z.string(),
60
+ loop: FleetLoopSummarySchema.nullable(),
61
+ error: z.string().nullable(),
62
+ }),
63
+ });
64
+ export const FleetResumeResponseSchema = z.object({
65
+ type: z.literal("fleet/resume/response"),
66
+ payload: z.object({
67
+ requestId: z.string(),
68
+ loop: FleetLoopSummarySchema.nullable(),
69
+ error: z.string().nullable(),
70
+ }),
71
+ });
72
+ export const FleetCreateRequestSchema = z.object({
73
+ type: z.literal("fleet/create"),
74
+ requestId: z.string(),
75
+ name: z.string(),
76
+ description: z.string(),
77
+ cron: z.string(),
78
+ action: z.string(),
79
+ mode: z.enum(["live", "dry-run"]).optional(),
80
+ rails: z.string().optional(),
81
+ allowed: z.string().optional(),
82
+ });
83
+ export const FleetCreateResponseSchema = z.object({
84
+ type: z.literal("fleet/create/response"),
85
+ payload: z.object({
86
+ requestId: z.string(),
87
+ loop: StoredFleetLoopSchema.nullable(),
88
+ cronLine: z.string().nullable(),
89
+ error: z.string().nullable(),
90
+ }),
91
+ });
92
+ export const FleetSetModeRequestSchema = z.object({
93
+ type: z.literal("fleet/set-mode"),
94
+ requestId: z.string(),
95
+ name: z.string(),
96
+ mode: z.enum(["live", "dry-run"]),
97
+ });
98
+ export const FleetSetModeResponseSchema = z.object({
99
+ type: z.literal("fleet/set-mode/response"),
100
+ payload: z.object({
101
+ requestId: z.string(),
102
+ loop: FleetLoopSummarySchema.nullable(),
103
+ /** Mode the loop was in before this call, so the UI can report the transition. */
104
+ previousMode: FleetLoopModeSchema.nullable(),
105
+ /** False when the loop was already in the requested mode: nothing was written. */
106
+ changed: z.boolean(),
107
+ error: z.string().nullable(),
108
+ }),
109
+ });
110
+ export const FleetAskRequestSchema = z.object({
111
+ type: z.literal("fleet/ask"),
112
+ requestId: z.string(),
113
+ name: z.string(),
114
+ kind: LoopDecisionKindSchema,
115
+ question: z.string(),
116
+ posture: LoopDecisionPostureSchema,
117
+ options: z.array(LoopDecisionOptionSchema).min(1),
118
+ runId: z.string().optional(),
119
+ itemKey: z.string().optional(),
120
+ evidence: z.string().optional(),
121
+ onExpiry: z.string().optional(),
122
+ expiresInMs: z.number().int().positive().optional(),
123
+ });
124
+ export const FleetAskResponseSchema = z.object({
125
+ type: z.literal("fleet/ask/response"),
126
+ payload: z.object({
127
+ requestId: z.string(),
128
+ decision: LoopDecisionSchema.nullable(),
129
+ error: z.string().nullable(),
130
+ }),
131
+ });
132
+ export const FleetDecisionsRequestSchema = z.object({
133
+ type: z.literal("fleet/decisions"),
134
+ requestId: z.string(),
135
+ name: z.string().optional(),
136
+ includeResolved: z.boolean().optional(),
137
+ });
138
+ export const FleetDecisionsResponseSchema = z.object({
139
+ type: z.literal("fleet/decisions/response"),
140
+ payload: z.object({
141
+ requestId: z.string(),
142
+ decisions: z.array(LoopDecisionSchema),
143
+ error: z.string().nullable(),
144
+ }),
145
+ });
146
+ export const FleetResolveDecisionRequestSchema = z.object({
147
+ type: z.literal("fleet/resolve-decision"),
148
+ requestId: z.string(),
149
+ decisionId: z.string(),
150
+ optionId: z.string(),
151
+ });
152
+ export const FleetResolveDecisionResponseSchema = z.object({
153
+ type: z.literal("fleet/resolve-decision/response"),
154
+ payload: z.object({
155
+ requestId: z.string(),
156
+ decision: LoopDecisionSchema.nullable(),
157
+ error: z.string().nullable(),
158
+ }),
159
+ });
160
+ export const FleetSetParamsRequestSchema = z.object({
161
+ type: z.literal("fleet/set-params"),
162
+ requestId: z.string(),
163
+ name: z.string(),
164
+ values: z.record(z.string(), LoopParamValueSchema),
165
+ });
166
+ export const FleetSetParamsResponseSchema = z.object({
167
+ type: z.literal("fleet/set-params/response"),
168
+ payload: z.object({
169
+ requestId: z.string(),
170
+ loop: StoredFleetLoopSchema.nullable(),
171
+ error: z.string().nullable(),
172
+ }),
173
+ });
174
+ export const FleetExecutionsRequestSchema = z.object({
175
+ type: z.literal("fleet/executions"),
176
+ requestId: z.string(),
177
+ name: z.string(),
178
+ });
179
+ export const FleetExecutionsResponseSchema = z.object({
180
+ type: z.literal("fleet/executions/response"),
181
+ payload: z.object({
182
+ requestId: z.string(),
183
+ executions: z.array(FleetExecutionSchema),
184
+ error: z.string().nullable(),
185
+ }),
186
+ });
187
+ //# sourceMappingURL=rpc-schemas.js.map
@@ -0,0 +1,170 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Fleet = the super-repo autonomous "loop" fleet, surfaced as a first-class paseo
4
+ * entity. Presented in the UI as "Loops"; namespaced `fleet` internally because the
5
+ * `loop` token is already taken by the Ralph worker/verifier entity.
6
+ *
7
+ * These loops are NOT owned by the daemon — they run as bash+cron under the
8
+ * super-repo. The daemon reads their state (see server/fleet/fleet-reader.ts) and
9
+ * optionally drives run-now / pause / resume. The record is therefore derived on
10
+ * read, not persisted like a schedule.
11
+ */
12
+ export declare const FleetLoopModeSchema: z.ZodEnum<{
13
+ unknown: "unknown";
14
+ live: "live";
15
+ "dry-run": "dry-run";
16
+ }>;
17
+ export type FleetLoopMode = z.infer<typeof FleetLoopModeSchema>;
18
+ export declare const FleetLoopStatusSchema: z.ZodEnum<{
19
+ error: "error";
20
+ idle: "idle";
21
+ unknown: "unknown";
22
+ paused: "paused";
23
+ healthy: "healthy";
24
+ blocked: "blocked";
25
+ unscheduled: "unscheduled";
26
+ }>;
27
+ export type FleetLoopStatus = z.infer<typeof FleetLoopStatusSchema>;
28
+ export declare const FleetFindingSchema: z.ZodObject<{
29
+ key: z.ZodString;
30
+ title: z.ZodOptional<z.ZodString>;
31
+ evidence: z.ZodOptional<z.ZodString>;
32
+ actionable: z.ZodBoolean;
33
+ outcome: z.ZodOptional<z.ZodString>;
34
+ handledAt: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ export type FleetFinding = z.infer<typeof FleetFindingSchema>;
37
+ export declare const FleetRunDaySchema: z.ZodObject<{
38
+ date: z.ZodString;
39
+ gateCount: z.ZodNumber;
40
+ freshCount: z.ZodNumber;
41
+ doneCount: z.ZodNumber;
42
+ }, z.core.$strip>;
43
+ export type FleetRunDay = z.infer<typeof FleetRunDaySchema>;
44
+ export declare const StoredFleetLoopSchema: z.ZodObject<{
45
+ name: z.ZodString;
46
+ displayName: z.ZodString;
47
+ description: z.ZodOptional<z.ZodString>;
48
+ dir: z.ZodString;
49
+ statePrefix: z.ZodString;
50
+ scheduled: z.ZodBoolean;
51
+ paused: z.ZodBoolean;
52
+ cadence: z.ZodOptional<z.ZodString>;
53
+ mode: z.ZodEnum<{
54
+ unknown: "unknown";
55
+ live: "live";
56
+ "dry-run": "dry-run";
57
+ }>;
58
+ status: z.ZodEnum<{
59
+ error: "error";
60
+ idle: "idle";
61
+ unknown: "unknown";
62
+ paused: "paused";
63
+ healthy: "healthy";
64
+ blocked: "blocked";
65
+ unscheduled: "unscheduled";
66
+ }>;
67
+ lastRunAt: z.ZodOptional<z.ZodString>;
68
+ findingCount: z.ZodNumber;
69
+ openFindings: z.ZodArray<z.ZodObject<{
70
+ key: z.ZodString;
71
+ title: z.ZodOptional<z.ZodString>;
72
+ evidence: z.ZodOptional<z.ZodString>;
73
+ actionable: z.ZodBoolean;
74
+ outcome: z.ZodOptional<z.ZodString>;
75
+ handledAt: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>>;
77
+ errorTail: z.ZodOptional<z.ZodString>;
78
+ recentRuns: z.ZodArray<z.ZodObject<{
79
+ date: z.ZodString;
80
+ gateCount: z.ZodNumber;
81
+ freshCount: z.ZodNumber;
82
+ doneCount: z.ZodNumber;
83
+ }, z.core.$strip>>;
84
+ paramsSchema: z.ZodOptional<z.ZodObject<{
85
+ fields: z.ZodArray<z.ZodObject<{
86
+ key: z.ZodString;
87
+ label: z.ZodString;
88
+ type: z.ZodEnum<{
89
+ string: "string";
90
+ number: "number";
91
+ boolean: "boolean";
92
+ enum: "enum";
93
+ "string-list": "string-list";
94
+ }>;
95
+ description: z.ZodOptional<z.ZodString>;
96
+ required: z.ZodDefault<z.ZodBoolean>;
97
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ min: z.ZodOptional<z.ZodNumber>;
99
+ max: z.ZodOptional<z.ZodNumber>;
100
+ default: z.ZodOptional<z.ZodUnknown>;
101
+ }, z.core.$strip>>;
102
+ }, z.core.$strip>>;
103
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
104
+ }, z.core.$strip>;
105
+ export type StoredFleetLoop = z.infer<typeof StoredFleetLoopSchema>;
106
+ /** List projection: drop the heavy detail arrays, keep the count. */
107
+ export declare const FleetLoopSummarySchema: z.ZodObject<{
108
+ mode: z.ZodEnum<{
109
+ unknown: "unknown";
110
+ live: "live";
111
+ "dry-run": "dry-run";
112
+ }>;
113
+ description: z.ZodOptional<z.ZodString>;
114
+ name: z.ZodString;
115
+ status: z.ZodEnum<{
116
+ error: "error";
117
+ idle: "idle";
118
+ unknown: "unknown";
119
+ paused: "paused";
120
+ healthy: "healthy";
121
+ blocked: "blocked";
122
+ unscheduled: "unscheduled";
123
+ }>;
124
+ paused: z.ZodBoolean;
125
+ cadence: z.ZodOptional<z.ZodString>;
126
+ lastRunAt: z.ZodOptional<z.ZodString>;
127
+ displayName: z.ZodString;
128
+ dir: z.ZodString;
129
+ statePrefix: z.ZodString;
130
+ scheduled: z.ZodBoolean;
131
+ findingCount: z.ZodNumber;
132
+ paramsSchema: z.ZodOptional<z.ZodObject<{
133
+ fields: z.ZodArray<z.ZodObject<{
134
+ key: z.ZodString;
135
+ label: z.ZodString;
136
+ type: z.ZodEnum<{
137
+ string: "string";
138
+ number: "number";
139
+ boolean: "boolean";
140
+ enum: "enum";
141
+ "string-list": "string-list";
142
+ }>;
143
+ description: z.ZodOptional<z.ZodString>;
144
+ required: z.ZodDefault<z.ZodBoolean>;
145
+ options: z.ZodOptional<z.ZodArray<z.ZodString>>;
146
+ min: z.ZodOptional<z.ZodNumber>;
147
+ max: z.ZodOptional<z.ZodNumber>;
148
+ default: z.ZodOptional<z.ZodUnknown>;
149
+ }, z.core.$strip>>;
150
+ }, z.core.$strip>>;
151
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
152
+ }, z.core.$strip>;
153
+ export type FleetLoopSummary = z.infer<typeof FleetLoopSummarySchema>;
154
+ /**
155
+ * One execution of a loop, i.e. a paseo agent the loop spawned (labeled loop=<name>).
156
+ * Projected from an agent snapshot so the Loops detail can list runs + link to sessions.
157
+ */
158
+ export declare const FleetExecutionSchema: z.ZodObject<{
159
+ agentId: z.ZodString;
160
+ title: z.ZodNullable<z.ZodString>;
161
+ status: z.ZodString;
162
+ createdAt: z.ZodString;
163
+ updatedAt: z.ZodString;
164
+ requiresAttention: z.ZodOptional<z.ZodBoolean>;
165
+ attentionReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
166
+ costUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
167
+ run: z.ZodOptional<z.ZodString>;
168
+ }, z.core.$strip>;
169
+ export type FleetExecution = z.infer<typeof FleetExecutionSchema>;
170
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ import { LoopParamsSchemaSchema, LoopParamValueSchema } from "./params.js";
3
+ /**
4
+ * Fleet = the super-repo autonomous "loop" fleet, surfaced as a first-class paseo
5
+ * entity. Presented in the UI as "Loops"; namespaced `fleet` internally because the
6
+ * `loop` token is already taken by the Ralph worker/verifier entity.
7
+ *
8
+ * These loops are NOT owned by the daemon — they run as bash+cron under the
9
+ * super-repo. The daemon reads their state (see server/fleet/fleet-reader.ts) and
10
+ * optionally drives run-now / pause / resume. The record is therefore derived on
11
+ * read, not persisted like a schedule.
12
+ */
13
+ export const FleetLoopModeSchema = z.enum(["live", "dry-run", "unknown"]);
14
+ export const FleetLoopStatusSchema = z.enum([
15
+ "healthy",
16
+ "idle",
17
+ "blocked",
18
+ "error",
19
+ "paused",
20
+ "unscheduled",
21
+ "unknown",
22
+ ]);
23
+ export const FleetFindingSchema = z.object({
24
+ key: z.string(),
25
+ title: z.string().optional(),
26
+ evidence: z.string().optional(),
27
+ actionable: z.boolean(),
28
+ /** Terminal outcome from the loop's seen-ledger, if handled. */
29
+ outcome: z.string().optional(),
30
+ handledAt: z.string().optional(),
31
+ });
32
+ export const FleetRunDaySchema = z.object({
33
+ date: z.string(),
34
+ gateCount: z.number().int().nonnegative(),
35
+ freshCount: z.number().int().nonnegative(),
36
+ doneCount: z.number().int().nonnegative(),
37
+ });
38
+ export const StoredFleetLoopSchema = z.object({
39
+ name: z.string(),
40
+ displayName: z.string(),
41
+ description: z.string().optional(),
42
+ dir: z.string(),
43
+ statePrefix: z.string(),
44
+ scheduled: z.boolean(),
45
+ paused: z.boolean(),
46
+ cadence: z.string().optional(),
47
+ mode: FleetLoopModeSchema,
48
+ status: FleetLoopStatusSchema,
49
+ lastRunAt: z.string().optional(),
50
+ findingCount: z.number().int().nonnegative(),
51
+ openFindings: z.array(FleetFindingSchema),
52
+ errorTail: z.string().optional(),
53
+ recentRuns: z.array(FleetRunDaySchema),
54
+ /** The loop's declared knobs, when it ships a params.schema.json. */
55
+ paramsSchema: LoopParamsSchemaSchema.optional(),
56
+ /** Current values from params.json. */
57
+ params: z.record(z.string(), LoopParamValueSchema).optional(),
58
+ });
59
+ /** List projection: drop the heavy detail arrays, keep the count. */
60
+ export const FleetLoopSummarySchema = StoredFleetLoopSchema.omit({
61
+ openFindings: true,
62
+ recentRuns: true,
63
+ errorTail: true,
64
+ });
65
+ /**
66
+ * One execution of a loop, i.e. a paseo agent the loop spawned (labeled loop=<name>).
67
+ * Projected from an agent snapshot so the Loops detail can list runs + link to sessions.
68
+ */
69
+ export const FleetExecutionSchema = z.object({
70
+ agentId: z.string(),
71
+ title: z.string().nullable(),
72
+ status: z.string(),
73
+ createdAt: z.string(),
74
+ updatedAt: z.string(),
75
+ requiresAttention: z.boolean().optional(),
76
+ attentionReason: z.string().nullable().optional(),
77
+ costUsd: z.number().nullable().optional(),
78
+ run: z.string().optional(),
79
+ });
80
+ //# sourceMappingURL=types.js.map