@bli-cockpit/telemetry-core 0.1.64 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-setup.d.ts +57 -0
- package/dist/agent-setup.js +20 -0
- package/dist/collector-heartbeat.d.ts +54 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ingest-dto.d.ts +2 -2
- package/dist/log-digest/index.d.ts +1 -1
- package/dist/log-digest/index.js +1 -1
- package/dist/log-digest/log-projects.d.ts +42 -0
- package/dist/log-digest/log-projects.js +40 -0
- package/dist/setup-receipt.d.ts +54 -0
- package/dist/setup-receipt.js +2 -0
- package/dist/work-context.d.ts +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SetupNameSchema: z.ZodString;
|
|
3
|
+
export declare const AgentSetupSchema: z.ZodObject<{
|
|
4
|
+
checked_at: z.ZodString;
|
|
5
|
+
os: z.ZodEnum<{
|
|
6
|
+
darwin: "darwin";
|
|
7
|
+
win32: "win32";
|
|
8
|
+
other: "other";
|
|
9
|
+
}>;
|
|
10
|
+
cli_version: z.ZodString;
|
|
11
|
+
claude: z.ZodObject<{
|
|
12
|
+
version: z.ZodNullable<z.ZodString>;
|
|
13
|
+
model: z.ZodNullable<z.ZodString>;
|
|
14
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
15
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
16
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
17
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
18
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
19
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
transport: z.ZodEnum<{
|
|
22
|
+
unknown: "unknown";
|
|
23
|
+
stdio: "stdio";
|
|
24
|
+
http: "http";
|
|
25
|
+
sse: "sse";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strict>>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
codex: z.ZodObject<{
|
|
30
|
+
version: z.ZodNullable<z.ZodString>;
|
|
31
|
+
model: z.ZodNullable<z.ZodString>;
|
|
32
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
33
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
34
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
35
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
36
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
37
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
transport: z.ZodEnum<{
|
|
40
|
+
unknown: "unknown";
|
|
41
|
+
stdio: "stdio";
|
|
42
|
+
http: "http";
|
|
43
|
+
sse: "sse";
|
|
44
|
+
}>;
|
|
45
|
+
}, z.core.$strict>>>;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
instructions: z.ZodArray<z.ZodObject<{
|
|
48
|
+
name: z.ZodEnum<{
|
|
49
|
+
"CLAUDE.md": "CLAUDE.md";
|
|
50
|
+
"AGENTS.md": "AGENTS.md";
|
|
51
|
+
}>;
|
|
52
|
+
exists: z.ZodNullable<z.ZodBoolean>;
|
|
53
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
54
|
+
bytes: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
export type AgentSetup = z.infer<typeof AgentSetupSchema>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { containsSecretLikeContent } from "./secret-guards.js";
|
|
3
|
+
// Names are the only free text allowed to cross this boundary. No command,
|
|
4
|
+
// URL, argument, path, environment value or configuration body is accepted.
|
|
5
|
+
export const SetupNameSchema = z.string().max(100).regex(/^[a-z0-9][a-z0-9_.@+-]*$/i)
|
|
6
|
+
.refine(value => !containsSecretLikeContent(value), "secret_like_name");
|
|
7
|
+
const names = z.array(SetupNameSchema).max(500);
|
|
8
|
+
const tool = z.object({
|
|
9
|
+
version: SetupNameSchema.nullable(), model: SetupNameSchema.nullable(), effort: SetupNameSchema.nullable(),
|
|
10
|
+
skills: names.nullable(), plugins: names.nullable(), agents: names.nullable(), hooks: names.nullable(),
|
|
11
|
+
mcp: z.array(z.object({ name: SetupNameSchema, transport: z.enum(["stdio", "http", "sse", "unknown"]) }).strict()).max(500).nullable(),
|
|
12
|
+
}).strict();
|
|
13
|
+
export const AgentSetupSchema = z.object({
|
|
14
|
+
checked_at: z.string().datetime(), os: z.enum(["darwin", "win32", "other"]), cli_version: SetupNameSchema,
|
|
15
|
+
claude: tool, codex: tool,
|
|
16
|
+
instructions: z.array(z.object({
|
|
17
|
+
name: z.enum(["CLAUDE.md", "AGENTS.md"]), exists: z.boolean().nullable(),
|
|
18
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/).nullable(), bytes: z.number().int().nonnegative().nullable(),
|
|
19
|
+
}).strict()).max(2),
|
|
20
|
+
}).strict();
|
|
@@ -172,6 +172,60 @@ export declare const CollectorHeartbeatSchema: z.ZodObject<{
|
|
|
172
172
|
}, z.core.$strict>>;
|
|
173
173
|
setup_receipt: z.ZodOptional<z.ZodObject<{
|
|
174
174
|
schema_version: z.ZodLiteral<"setup-receipt.v1">;
|
|
175
|
+
agent_setup: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
checked_at: z.ZodString;
|
|
177
|
+
os: z.ZodEnum<{
|
|
178
|
+
darwin: "darwin";
|
|
179
|
+
win32: "win32";
|
|
180
|
+
other: "other";
|
|
181
|
+
}>;
|
|
182
|
+
cli_version: z.ZodString;
|
|
183
|
+
claude: z.ZodObject<{
|
|
184
|
+
version: z.ZodNullable<z.ZodString>;
|
|
185
|
+
model: z.ZodNullable<z.ZodString>;
|
|
186
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
187
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
188
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
189
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
190
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
191
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
192
|
+
name: z.ZodString;
|
|
193
|
+
transport: z.ZodEnum<{
|
|
194
|
+
unknown: "unknown";
|
|
195
|
+
stdio: "stdio";
|
|
196
|
+
http: "http";
|
|
197
|
+
sse: "sse";
|
|
198
|
+
}>;
|
|
199
|
+
}, z.core.$strict>>>;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
codex: z.ZodObject<{
|
|
202
|
+
version: z.ZodNullable<z.ZodString>;
|
|
203
|
+
model: z.ZodNullable<z.ZodString>;
|
|
204
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
205
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
206
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
207
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
208
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
209
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
transport: z.ZodEnum<{
|
|
212
|
+
unknown: "unknown";
|
|
213
|
+
stdio: "stdio";
|
|
214
|
+
http: "http";
|
|
215
|
+
sse: "sse";
|
|
216
|
+
}>;
|
|
217
|
+
}, z.core.$strict>>>;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
instructions: z.ZodArray<z.ZodObject<{
|
|
220
|
+
name: z.ZodEnum<{
|
|
221
|
+
"CLAUDE.md": "CLAUDE.md";
|
|
222
|
+
"AGENTS.md": "AGENTS.md";
|
|
223
|
+
}>;
|
|
224
|
+
exists: z.ZodNullable<z.ZodBoolean>;
|
|
225
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
226
|
+
bytes: z.ZodNullable<z.ZodNumber>;
|
|
227
|
+
}, z.core.$strict>>;
|
|
228
|
+
}, z.core.$strict>>;
|
|
175
229
|
checked_at: z.ZodString;
|
|
176
230
|
browser: z.ZodObject<{
|
|
177
231
|
status: z.ZodEnum<{
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/ingest-dto.d.ts
CHANGED
|
@@ -427,6 +427,7 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
|
|
|
427
427
|
topic_summary_redacted: z.ZodOptional<z.ZodString>;
|
|
428
428
|
work_intent: z.ZodOptional<z.ZodEnum<{
|
|
429
429
|
unknown: "unknown";
|
|
430
|
+
other: "other";
|
|
430
431
|
implementation: "implementation";
|
|
431
432
|
bug_fix: "bug_fix";
|
|
432
433
|
root_cause_analysis: "root_cause_analysis";
|
|
@@ -440,10 +441,10 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
|
|
|
440
441
|
coordination: "coordination";
|
|
441
442
|
maintenance: "maintenance";
|
|
442
443
|
analysis: "analysis";
|
|
443
|
-
other: "other";
|
|
444
444
|
}>>;
|
|
445
445
|
work_phase: z.ZodOptional<z.ZodEnum<{
|
|
446
446
|
unknown: "unknown";
|
|
447
|
+
other: "other";
|
|
447
448
|
implementation: "implementation";
|
|
448
449
|
planning: "planning";
|
|
449
450
|
discovery: "discovery";
|
|
@@ -452,7 +453,6 @@ export declare const TelemetryIngestEnvelopeSchema: z.ZodObject<{
|
|
|
452
453
|
documentation: "documentation";
|
|
453
454
|
release: "release";
|
|
454
455
|
analysis: "analysis";
|
|
455
|
-
other: "other";
|
|
456
456
|
debugging: "debugging";
|
|
457
457
|
handoff: "handoff";
|
|
458
458
|
}>>;
|
|
@@ -15,5 +15,5 @@ export { VERCEL_PROJECT, VERCEL_SCOPE, readDashboard, routeTemplate, vercelRecor
|
|
|
15
15
|
export { readStdin } from "./sources/stdin.js";
|
|
16
16
|
export { LOCAL_ACCESS_REFUSALS, STORED_MAX_TEMPLATES_PER_WINDOW, digestLines, mergeStored, notReadLines, scrubRow, storedRowBytes, toStoredRows, type DigestedLines, type StillRefusing, type StoredMerge, type StoredRow, type StoredWindow, type UnreadableSource, } from "./stored.js";
|
|
17
17
|
export { PROJECT_TABLES, projectClassTable } from "./project-classes.js";
|
|
18
|
-
export { LOG_EXCLUDED, LOG_EXCLUDED_SUPABASE_REFS, LOG_PROJECTS, LOG_PROJECT_IDS, LOG_PROJECT_PATTERN, TOWER_RAILWAY, VERCEL_TEAM_ID, findLogProject, type GcpSource, type LogProject, type LogSource, type NotWiredSource, type RailwaySource, type SupabaseSource, type SupabaseStream, type VercelSource, } from "./log-projects.js";
|
|
18
|
+
export { BRAIN_PROJECT_IDS, LOG_EXCLUDED, LOG_EXCLUDED_SUPABASE_REFS, LOG_PROJECTS, LOG_PROJECT_IDS, LOG_PROJECT_PATTERN, TOWER_RAILWAY, VERCEL_TEAM_ID, brainRouteFor, findLogProject, type BrainConfig, type BrainMergePolicy, type BrainRoute, type GcpSource, type LogProject, type LogSource, type NotWiredSource, type RailwaySource, type SupabaseSource, type SupabaseStream, type VercelSource, } from "./log-projects.js";
|
|
19
19
|
export { STORED_EXAMPLE_CHARS, STORED_TEMPLATE_CHARS, scrubForStorage, scrubLine, scrubUnit } from "./scrub.js";
|
package/dist/log-digest/index.js
CHANGED
|
@@ -15,5 +15,5 @@ export { VERCEL_PROJECT, VERCEL_SCOPE, readDashboard, routeTemplate, vercelRecor
|
|
|
15
15
|
export { readStdin } from "./sources/stdin.js";
|
|
16
16
|
export { LOCAL_ACCESS_REFUSALS, STORED_MAX_TEMPLATES_PER_WINDOW, digestLines, mergeStored, notReadLines, scrubRow, storedRowBytes, toStoredRows, } from "./stored.js";
|
|
17
17
|
export { PROJECT_TABLES, projectClassTable } from "./project-classes.js";
|
|
18
|
-
export { LOG_EXCLUDED, LOG_EXCLUDED_SUPABASE_REFS, LOG_PROJECTS, LOG_PROJECT_IDS, LOG_PROJECT_PATTERN, TOWER_RAILWAY, VERCEL_TEAM_ID, findLogProject, } from "./log-projects.js";
|
|
18
|
+
export { BRAIN_PROJECT_IDS, LOG_EXCLUDED, LOG_EXCLUDED_SUPABASE_REFS, LOG_PROJECTS, LOG_PROJECT_IDS, LOG_PROJECT_PATTERN, TOWER_RAILWAY, VERCEL_TEAM_ID, brainRouteFor, findLogProject, } from "./log-projects.js";
|
|
19
19
|
export { STORED_EXAMPLE_CHARS, STORED_TEMPLATE_CHARS, scrubForStorage, scrubLine, scrubUnit } from "./scrub.js";
|
|
@@ -71,11 +71,35 @@ export interface NotWiredSource extends SourceBase {
|
|
|
71
71
|
reason: string;
|
|
72
72
|
}
|
|
73
73
|
export type LogSource = VercelSource | RailwaySource | SupabaseSource | GcpSource | NotWiredSource;
|
|
74
|
+
/**
|
|
75
|
+
* How the brain may land a fix (BLI-12859). `on_green`: the PR gets auto-merge, which GitHub performs only once the
|
|
76
|
+
* repo's own required checks pass. `pr_only`: the brain opens the PR and stops; a person merges.
|
|
77
|
+
*/
|
|
78
|
+
export type BrainMergePolicy = "on_green" | "pr_only";
|
|
79
|
+
/**
|
|
80
|
+
* Where and how the brain may act on one project (BLI-12859). A project WITHOUT this block is never acted on: the
|
|
81
|
+
* brain reads the registry, finds no route and leaves the incident alone, which is how Kaiben stays out of reach.
|
|
82
|
+
*/
|
|
83
|
+
export interface BrainConfig {
|
|
84
|
+
repos: {
|
|
85
|
+
/** `owner/name` the fix goes to when no source below is named. */
|
|
86
|
+
default: string;
|
|
87
|
+
/** `owner/name` per source label (`LogSource.source`), for a project whose sources live in different repos. */
|
|
88
|
+
by_source?: Readonly<Record<string, string>>;
|
|
89
|
+
};
|
|
90
|
+
/** The branch the PR targets and the checkout starts from. */
|
|
91
|
+
base_branch: string;
|
|
92
|
+
merge: BrainMergePolicy;
|
|
93
|
+
/** Claude sessions the brain may start for this project per UTC day (triage and workers both count). */
|
|
94
|
+
daily_runs: number;
|
|
95
|
+
}
|
|
74
96
|
export interface LogProject {
|
|
75
97
|
/** What `cockpit logs <project>` takes. */
|
|
76
98
|
id: string;
|
|
77
99
|
name: string;
|
|
78
100
|
sources: readonly LogSource[];
|
|
101
|
+
/** Absent means the brain never acts on this project. */
|
|
102
|
+
brain?: BrainConfig;
|
|
79
103
|
}
|
|
80
104
|
export declare const LOG_PROJECTS: readonly LogProject[];
|
|
81
105
|
/** Not Tower, so not here: Veetesh's own Vercel project. */
|
|
@@ -87,6 +111,24 @@ export declare const LOG_EXCLUDED: readonly ["bli-cockpit-oversight"];
|
|
|
87
111
|
export declare const LOG_EXCLUDED_SUPABASE_REFS: Readonly<Record<string, string>>;
|
|
88
112
|
export declare function findLogProject(id: string): LogProject | null;
|
|
89
113
|
export declare const LOG_PROJECT_IDS: readonly string[];
|
|
114
|
+
/** Ids of the projects the brain may act on: the ones with a `brain` block. */
|
|
115
|
+
export declare const BRAIN_PROJECT_IDS: readonly string[];
|
|
116
|
+
export interface BrainRoute {
|
|
117
|
+
project: string;
|
|
118
|
+
/** `owner/name` the fix is made in. */
|
|
119
|
+
repo: string;
|
|
120
|
+
base_branch: string;
|
|
121
|
+
merge: BrainMergePolicy;
|
|
122
|
+
daily_runs: number;
|
|
123
|
+
/** The source label that chose the repo, or `default` when none did. */
|
|
124
|
+
matched: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Where the brain may work on one incident: the project's `brain` block, with the repo chosen by the incident's source
|
|
128
|
+
* labels (the first label that has its own repo wins, otherwise `default`). `null` means the brain must not act: the
|
|
129
|
+
* project is unknown or has no `brain` block.
|
|
130
|
+
*/
|
|
131
|
+
export declare function brainRouteFor(projectId: string, sources?: readonly string[]): BrainRoute | null;
|
|
90
132
|
/** A project id as `cockpit logs <project>` spells it: lowercase letters, digits and dashes. */
|
|
91
133
|
export declare const LOG_PROJECT_PATTERN: RegExp;
|
|
92
134
|
export {};
|
|
@@ -56,6 +56,8 @@ export const LOG_PROJECTS = [
|
|
|
56
56
|
{ kind: "railway", source: "railway:bli-cockpit-inference", family: "railway", ...TOWER_RAILWAY },
|
|
57
57
|
supabase("BLI-Cockpit", "bnwolptxyrjalnppqyaf"),
|
|
58
58
|
],
|
|
59
|
+
// AGENTS.md "Velocity": merge on green without asking. `main`'s ruleset requires its checks and allows squash only.
|
|
60
|
+
brain: { repos: { default: "BLI-INC/bli-cockpit" }, base_branch: "main", merge: "on_green", daily_runs: 10 },
|
|
59
61
|
},
|
|
60
62
|
{
|
|
61
63
|
id: "portpal",
|
|
@@ -64,6 +66,11 @@ export const LOG_PROJECTS = [
|
|
|
64
66
|
vercel("portpal-2", "prj_QfzQ7rmAAlIdYphezkFXY4JebM3W"),
|
|
65
67
|
supabase("PortPal", "qcnozghkxbnlofahaqig"),
|
|
66
68
|
],
|
|
69
|
+
// The Vercel project portpal-2 is git-linked to BLI-INC/portpal-2 (production branch main; `vercel api /v9/projects`,
|
|
70
|
+
// 2026-10-07); BLI-INC/PORTPAL has not been pushed since 2026-07-31. Its AGENTS.md lets in-session subagents "merge on
|
|
71
|
+
// local green" for the speed check but never says an autonomous agent may merge a PR, and a merge to main applies
|
|
72
|
+
// production migrations and ships phone updates, so the brain stops at the PR.
|
|
73
|
+
brain: { repos: { default: "BLI-INC/portpal-2" }, base_branch: "main", merge: "pr_only", daily_runs: 4 },
|
|
67
74
|
},
|
|
68
75
|
{
|
|
69
76
|
id: "blue-pearl-website",
|
|
@@ -87,6 +94,14 @@ export const LOG_PROJECTS = [
|
|
|
87
94
|
gcpCloudRun("buildlaunchiterate", "blue-pearl-mortgage"),
|
|
88
95
|
notWired("sentry:build-launch-iterate/javascript-nextjs", "sentry", "sentry_token_not_mintable: the Pearl frontend also reports to Sentry (org build-launch-iterate, project javascript-nextjs); a read-only internal-integration token (event:read, project:read, org:read) needs org-level write that the existing Sentry login lacks (creating the integration answered 403), so no token was minted and Edward's broader personal token was not copied; create the integration in Sentry settings, then register the source"),
|
|
89
96
|
],
|
|
97
|
+
// Both repos' AGENTS.md say "Do not auto-merge. Stop at PR unless user says merge" (read 2026-10-07), so pr_only. A line
|
|
98
|
+
// from the Cloud Run backend is fixed in its own repo; every other source is the frontend.
|
|
99
|
+
brain: {
|
|
100
|
+
repos: { default: "BLI-INC/bluepearl-frontend", by_source: { "gcp:blue-pearl-mortgage": "BLI-INC/blue-pearl-mortgage-backend" } },
|
|
101
|
+
base_branch: "main",
|
|
102
|
+
merge: "pr_only",
|
|
103
|
+
daily_runs: 6,
|
|
104
|
+
},
|
|
90
105
|
},
|
|
91
106
|
{
|
|
92
107
|
id: "triage-ocr",
|
|
@@ -112,6 +127,9 @@ export const LOG_PROJECTS = [
|
|
|
112
127
|
// Kolm PRODUCTION (the Kolm session's handoff on ticket 12860). The CLI lists this ref under the name "kolm-v15-staging".
|
|
113
128
|
supabase("Kolm", "hvhoyqalnkvbnpteggpi"),
|
|
114
129
|
],
|
|
130
|
+
// Ticket 12860's comment: PRs only, and never apply a migration (its AGENTS.md rule 24 puts them behind independent
|
|
131
|
+
// review). Its AGENTS.md has no merge-on-green permission either.
|
|
132
|
+
brain: { repos: { default: "BLI-INC/kolm-dashboard-v15" }, base_branch: "main", merge: "pr_only", daily_runs: 6 },
|
|
115
133
|
},
|
|
116
134
|
{
|
|
117
135
|
id: "kaiben",
|
|
@@ -169,5 +187,27 @@ export function findLogProject(id) {
|
|
|
169
187
|
return LOG_PROJECTS.find((project) => project.id === id) ?? null;
|
|
170
188
|
}
|
|
171
189
|
export const LOG_PROJECT_IDS = LOG_PROJECTS.map((project) => project.id);
|
|
190
|
+
/** Ids of the projects the brain may act on: the ones with a `brain` block. */
|
|
191
|
+
export const BRAIN_PROJECT_IDS = LOG_PROJECTS.filter((project) => project.brain).map((project) => project.id);
|
|
192
|
+
/**
|
|
193
|
+
* Where the brain may work on one incident: the project's `brain` block, with the repo chosen by the incident's source
|
|
194
|
+
* labels (the first label that has its own repo wins, otherwise `default`). `null` means the brain must not act: the
|
|
195
|
+
* project is unknown or has no `brain` block.
|
|
196
|
+
*/
|
|
197
|
+
export function brainRouteFor(projectId, sources = []) {
|
|
198
|
+
const brain = findLogProject(projectId)?.brain;
|
|
199
|
+
if (!brain)
|
|
200
|
+
return null;
|
|
201
|
+
const bySource = brain.repos.by_source ?? {};
|
|
202
|
+
const matched = sources.find((label) => Object.hasOwn(bySource, label));
|
|
203
|
+
return {
|
|
204
|
+
project: projectId,
|
|
205
|
+
repo: matched === undefined ? brain.repos.default : bySource[matched],
|
|
206
|
+
base_branch: brain.base_branch,
|
|
207
|
+
merge: brain.merge,
|
|
208
|
+
daily_runs: brain.daily_runs,
|
|
209
|
+
matched: matched ?? "default",
|
|
210
|
+
};
|
|
211
|
+
}
|
|
172
212
|
/** A project id as `cockpit logs <project>` spells it: lowercase letters, digits and dashes. */
|
|
173
213
|
export const LOG_PROJECT_PATTERN = /^[a-z][a-z0-9-]{1,40}$/;
|
package/dist/setup-receipt.d.ts
CHANGED
|
@@ -66,6 +66,60 @@ declare const PieceSchema: z.ZodObject<{
|
|
|
66
66
|
export type SetupPiece = z.infer<typeof PieceSchema>;
|
|
67
67
|
export declare const SetupReceiptSchema: z.ZodObject<{
|
|
68
68
|
schema_version: z.ZodLiteral<"setup-receipt.v1">;
|
|
69
|
+
agent_setup: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
checked_at: z.ZodString;
|
|
71
|
+
os: z.ZodEnum<{
|
|
72
|
+
darwin: "darwin";
|
|
73
|
+
win32: "win32";
|
|
74
|
+
other: "other";
|
|
75
|
+
}>;
|
|
76
|
+
cli_version: z.ZodString;
|
|
77
|
+
claude: z.ZodObject<{
|
|
78
|
+
version: z.ZodNullable<z.ZodString>;
|
|
79
|
+
model: z.ZodNullable<z.ZodString>;
|
|
80
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
81
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
82
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
83
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
84
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
85
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
transport: z.ZodEnum<{
|
|
88
|
+
unknown: "unknown";
|
|
89
|
+
stdio: "stdio";
|
|
90
|
+
http: "http";
|
|
91
|
+
sse: "sse";
|
|
92
|
+
}>;
|
|
93
|
+
}, z.core.$strict>>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
codex: z.ZodObject<{
|
|
96
|
+
version: z.ZodNullable<z.ZodString>;
|
|
97
|
+
model: z.ZodNullable<z.ZodString>;
|
|
98
|
+
effort: z.ZodNullable<z.ZodString>;
|
|
99
|
+
skills: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
100
|
+
plugins: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
101
|
+
agents: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
102
|
+
hooks: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
103
|
+
mcp: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
transport: z.ZodEnum<{
|
|
106
|
+
unknown: "unknown";
|
|
107
|
+
stdio: "stdio";
|
|
108
|
+
http: "http";
|
|
109
|
+
sse: "sse";
|
|
110
|
+
}>;
|
|
111
|
+
}, z.core.$strict>>>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
instructions: z.ZodArray<z.ZodObject<{
|
|
114
|
+
name: z.ZodEnum<{
|
|
115
|
+
"CLAUDE.md": "CLAUDE.md";
|
|
116
|
+
"AGENTS.md": "AGENTS.md";
|
|
117
|
+
}>;
|
|
118
|
+
exists: z.ZodNullable<z.ZodBoolean>;
|
|
119
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
120
|
+
bytes: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
}, z.core.$strict>>;
|
|
69
123
|
checked_at: z.ZodString;
|
|
70
124
|
browser: z.ZodObject<{
|
|
71
125
|
status: z.ZodEnum<{
|
package/dist/setup-receipt.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { AgentSetupSchema } from "./agent-setup.js";
|
|
2
3
|
import { IsoDateTimeSchema } from "./common.js";
|
|
3
4
|
/**
|
|
4
5
|
* "Is this machine actually connected?" — one block, read back off the machine
|
|
@@ -86,6 +87,7 @@ const PieceSchema = z
|
|
|
86
87
|
export const SetupReceiptSchema = z
|
|
87
88
|
.object({
|
|
88
89
|
schema_version: z.literal(SETUP_RECEIPT_SCHEMA_VERSION),
|
|
90
|
+
agent_setup: AgentSetupSchema.optional(),
|
|
89
91
|
/** When these words were read off this machine. Ages out; never trusted stale. */
|
|
90
92
|
checked_at: IsoDateTimeSchema,
|
|
91
93
|
/** Did a person ever sign a browser in for this machine? */
|
package/dist/work-context.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const TicketBindingCandidateSchema: z.ZodObject<{
|
|
|
27
27
|
export type TicketBindingCandidate = z.infer<typeof TicketBindingCandidateSchema>;
|
|
28
28
|
export declare const WorkIntentSchema: z.ZodEnum<{
|
|
29
29
|
unknown: "unknown";
|
|
30
|
+
other: "other";
|
|
30
31
|
implementation: "implementation";
|
|
31
32
|
bug_fix: "bug_fix";
|
|
32
33
|
root_cause_analysis: "root_cause_analysis";
|
|
@@ -40,11 +41,11 @@ export declare const WorkIntentSchema: z.ZodEnum<{
|
|
|
40
41
|
coordination: "coordination";
|
|
41
42
|
maintenance: "maintenance";
|
|
42
43
|
analysis: "analysis";
|
|
43
|
-
other: "other";
|
|
44
44
|
}>;
|
|
45
45
|
export type WorkIntent = z.infer<typeof WorkIntentSchema>;
|
|
46
46
|
export declare const WorkPhaseSchema: z.ZodEnum<{
|
|
47
47
|
unknown: "unknown";
|
|
48
|
+
other: "other";
|
|
48
49
|
implementation: "implementation";
|
|
49
50
|
planning: "planning";
|
|
50
51
|
discovery: "discovery";
|
|
@@ -53,7 +54,6 @@ export declare const WorkPhaseSchema: z.ZodEnum<{
|
|
|
53
54
|
documentation: "documentation";
|
|
54
55
|
release: "release";
|
|
55
56
|
analysis: "analysis";
|
|
56
|
-
other: "other";
|
|
57
57
|
debugging: "debugging";
|
|
58
58
|
handoff: "handoff";
|
|
59
59
|
}>;
|
|
@@ -106,6 +106,7 @@ export declare const LocalWorkContextSchema: z.ZodObject<{
|
|
|
106
106
|
topic_summary_redacted: z.ZodOptional<z.ZodString>;
|
|
107
107
|
work_intent: z.ZodOptional<z.ZodEnum<{
|
|
108
108
|
unknown: "unknown";
|
|
109
|
+
other: "other";
|
|
109
110
|
implementation: "implementation";
|
|
110
111
|
bug_fix: "bug_fix";
|
|
111
112
|
root_cause_analysis: "root_cause_analysis";
|
|
@@ -119,10 +120,10 @@ export declare const LocalWorkContextSchema: z.ZodObject<{
|
|
|
119
120
|
coordination: "coordination";
|
|
120
121
|
maintenance: "maintenance";
|
|
121
122
|
analysis: "analysis";
|
|
122
|
-
other: "other";
|
|
123
123
|
}>>;
|
|
124
124
|
work_phase: z.ZodOptional<z.ZodEnum<{
|
|
125
125
|
unknown: "unknown";
|
|
126
|
+
other: "other";
|
|
126
127
|
implementation: "implementation";
|
|
127
128
|
planning: "planning";
|
|
128
129
|
discovery: "discovery";
|
|
@@ -131,7 +132,6 @@ export declare const LocalWorkContextSchema: z.ZodObject<{
|
|
|
131
132
|
documentation: "documentation";
|
|
132
133
|
release: "release";
|
|
133
134
|
analysis: "analysis";
|
|
134
|
-
other: "other";
|
|
135
135
|
debugging: "debugging";
|
|
136
136
|
handoff: "handoff";
|
|
137
137
|
}>>;
|