@lensmcp/protocol-types 1.26.14 → 1.26.16
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/index.d.ts +2 -0
- package/index.js +1 -1
- package/lib/accounts.d.ts +35 -6
- package/lib/conversations.d.ts +385 -0
- package/lib/conversations.js +1 -0
- package/lib/dashboard-lint.d.ts +31 -0
- package/lib/lint-ignores.d.ts +154 -0
- package/lib/lint-ignores.js +2 -0
- package/lib/peers.d.ts +259 -7
- package/lib/peers.js +1 -1
- package/lib/static-checks.d.ts +6 -0
- package/lib/team.d.ts +21 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './lib/dashboard-path.js';
|
|
|
17
17
|
export * from './lib/dashboard-lint.js';
|
|
18
18
|
export * from './lib/dashboard-typecheck.js';
|
|
19
19
|
export * from './lib/lint-coverage.js';
|
|
20
|
+
export * from './lib/lint-ignores.js';
|
|
20
21
|
export * from './lib/static-checks.js';
|
|
21
22
|
export * from './lib/log-query.js';
|
|
22
23
|
export * from './lib/error-dismissal.js';
|
|
@@ -58,6 +59,7 @@ export * from './lib/host-agents.js';
|
|
|
58
59
|
export * from './lib/remote-instances.js';
|
|
59
60
|
export * from './lib/team.js';
|
|
60
61
|
export * from './lib/sessions.js';
|
|
62
|
+
export * from './lib/conversations.js';
|
|
61
63
|
export * from './lib/backlog.js';
|
|
62
64
|
export * from './lib/team-review-changes.js';
|
|
63
65
|
export * from './lib/goal-outcome.js';
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/dashboard-path.js";export*from"./lib/dashboard-lint.js";export*from"./lib/dashboard-typecheck.js";export*from"./lib/lint-coverage.js";export*from"./lib/static-checks.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/expected-failure.js";export*from"./lib/error-verdict.js";export*from"./lib/finding-proof.js";export*from"./lib/error-cause.js";export*from"./lib/metrics-reset.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/ai-call.js";export*from"./lib/ai-call-row.js";export*from"./lib/ai-call-groups.js";export*from"./lib/ai-context.js";export*from"./lib/ai-cache-facts.js";export*from"./lib/ai-cache.js";export*from"./lib/ai-cache-verdict.js";export*from"./lib/ai-together.js";export*from"./lib/ai-origins.js";export*from"./lib/ai-playground.js";export*from"./lib/ai-compare.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";export*from"./lib/event-loop.js";export*from"./lib/workspace-actions.js";export*from"./lib/docker-jobs.js";export*from"./lib/docker-report.js";export*from"./lib/docker-runs.js";export*from"./lib/docker-errors.js";export*from"./lib/peers.js";export*from"./lib/hosts.js";export*from"./lib/cluster-hosts.js";export*from"./lib/dashboard-updates.js";export*from"./lib/accounts.js";export*from"./lib/host-agents.js";export*from"./lib/remote-instances.js";export*from"./lib/team.js";export*from"./lib/sessions.js";export*from"./lib/backlog.js";export*from"./lib/team-review-changes.js";export*from"./lib/goal-outcome.js";export*from"./lib/role-fidelity.js";export*from"./lib/goal-retro.js";export*from"./lib/follow-ups.js";export*from"./lib/changes.js";export*from"./lib/main-mirror.js";export*from"./lib/team-design.js";export*from"./lib/team-library.js";export*from"./lib/team-skills.js";export*from"./lib/system-report.js";export*from"./lib/overseer-findings.js";export*from"./lib/overseer-rounds.js";export*from"./lib/goal-design.js";export*from"./lib/overseer-messages.js";export*from"./lib/team-roadmap.js";export*from"./lib/team-prompts.js";export{PROOF_ACTIONS,NOT_RUN_KINDS}from"./lib/team-delivery.js";
|
|
1
|
+
"use strict";export*from"./lib/schema-version.js";export*from"./lib/source-location.js";export*from"./lib/context.js";export*from"./lib/event.js";export*from"./lib/node.js";export*from"./lib/edge.js";export*from"./lib/attributes.js";export*from"./lib/producer-health.js";export*from"./lib/resources.js";export*from"./lib/tokens.js";export*from"./lib/capture-demand.js";export*from"./lib/bounded-clone.js";export*from"./lib/bounded-map.js";export*from"./lib/flood-guard.js";export*from"./lib/dashboard.js";export*from"./lib/dashboard-path.js";export*from"./lib/dashboard-lint.js";export*from"./lib/dashboard-typecheck.js";export*from"./lib/lint-coverage.js";export*from"./lib/lint-ignores.js";export*from"./lib/static-checks.js";export*from"./lib/log-query.js";export*from"./lib/error-dismissal.js";export*from"./lib/expected-failure.js";export*from"./lib/error-verdict.js";export*from"./lib/finding-proof.js";export*from"./lib/error-cause.js";export*from"./lib/metrics-reset.js";export*from"./lib/ai-content.js";export*from"./lib/http-exchange.js";export*from"./lib/ai-call.js";export*from"./lib/ai-call-row.js";export*from"./lib/ai-call-groups.js";export*from"./lib/ai-context.js";export*from"./lib/ai-cache-facts.js";export*from"./lib/ai-cache.js";export*from"./lib/ai-cache-verdict.js";export*from"./lib/ai-together.js";export*from"./lib/ai-origins.js";export*from"./lib/ai-playground.js";export*from"./lib/ai-compare.js";export*from"./lib/pod-memory.js";export*from"./lib/perf-rules.js";export*from"./lib/sources.js";export*from"./lib/page-visit.js";export*from"./lib/replay.js";export*from"./lib/event-loop.js";export*from"./lib/workspace-actions.js";export*from"./lib/docker-jobs.js";export*from"./lib/docker-report.js";export*from"./lib/docker-runs.js";export*from"./lib/docker-errors.js";export*from"./lib/peers.js";export*from"./lib/hosts.js";export*from"./lib/cluster-hosts.js";export*from"./lib/dashboard-updates.js";export*from"./lib/accounts.js";export*from"./lib/host-agents.js";export*from"./lib/remote-instances.js";export*from"./lib/team.js";export*from"./lib/sessions.js";export*from"./lib/conversations.js";export*from"./lib/backlog.js";export*from"./lib/team-review-changes.js";export*from"./lib/goal-outcome.js";export*from"./lib/role-fidelity.js";export*from"./lib/goal-retro.js";export*from"./lib/follow-ups.js";export*from"./lib/changes.js";export*from"./lib/main-mirror.js";export*from"./lib/team-design.js";export*from"./lib/team-library.js";export*from"./lib/team-skills.js";export*from"./lib/system-report.js";export*from"./lib/overseer-findings.js";export*from"./lib/overseer-rounds.js";export*from"./lib/goal-design.js";export*from"./lib/overseer-messages.js";export*from"./lib/team-roadmap.js";export*from"./lib/team-prompts.js";export{PROOF_ACTIONS,NOT_RUN_KINDS}from"./lib/team-delivery.js";
|
package/lib/accounts.d.ts
CHANGED
|
@@ -32,8 +32,19 @@ export interface DashAccountRow {
|
|
|
32
32
|
/** Its name — «The client's own sign-in» for an own one. */
|
|
33
33
|
label: string;
|
|
34
34
|
own?: true;
|
|
35
|
-
/** The plan
|
|
35
|
+
/** The plan in a word or two (`Ultra ×10`, `Max ×5`, `Pro`, `Team`, `Business`…), when known — its label only. */
|
|
36
36
|
plan?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The plan as a key — what the page decides from, never its label. Claude: `ultra` (Claude Code's `max_20x`), `max-5x`,
|
|
39
|
+
* `max` (a Max it does not size), `pro`, `team`, `enterprise`, `free`, or the word Claude Code said; Codex: its
|
|
40
|
+
* `planType` as Codex says it (`plus`, `prolite`, `team`, `self_serve_business_prolite`…). Ultra has no 5-hour window.
|
|
41
|
+
*/
|
|
42
|
+
planTier?: string;
|
|
43
|
+
/**
|
|
44
|
+
* On a client's own sign-in: the added account it is (the server compared who the two sign-ins are one way — no email,
|
|
45
|
+
* nor any key of one, is sent). The page shows that account once.
|
|
46
|
+
*/
|
|
47
|
+
sameAs?: string;
|
|
37
48
|
/** New launches of its client use it (`lensmcp claude`, a goal with no account). */
|
|
38
49
|
default?: true;
|
|
39
50
|
/** Kept for the person's own sessions: no team agent runs on it; `run` starts the client on it by hand. */
|
|
@@ -52,9 +63,27 @@ export interface DashAccountRow {
|
|
|
52
63
|
readHow?: string;
|
|
53
64
|
/** Why the newest read failed, when it did — `windows` are then the last good reading. */
|
|
54
65
|
readWhy?: string;
|
|
55
|
-
/** While its sign-in runs: when it started,
|
|
56
|
-
signingIn?:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
/** While its sign-in runs: when it started, the link the client printed, and what the page needs to finish it. */
|
|
67
|
+
signingIn?: DashAccountSigningIn;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A sign-in the dashboard runs (`POST /api/accounts/add`, `/login`). Claude Code's runs on a terminal of its own, so
|
|
71
|
+
* when claude.ai shows a code instead of returning to Claude Code, the page takes it (`POST /api/accounts/code`) and
|
|
72
|
+
* types it there; `POST /api/accounts/cancel` stops it. No code is ever in an answer.
|
|
73
|
+
*/
|
|
74
|
+
export interface DashAccountSigningIn {
|
|
75
|
+
startedAt: number;
|
|
76
|
+
/** When the lens stops it if it has not finished (10 minutes on). Absent from a lens before it. */
|
|
77
|
+
stopsAt?: number;
|
|
78
|
+
/** The sign-in page's link, as the client printed it — the browser it opened may be another one. */
|
|
79
|
+
link?: string;
|
|
80
|
+
/** The client asks for the code its sign-in page shows («Paste code here if prompted»): the page offers a field for it. */
|
|
81
|
+
codeWanted?: true;
|
|
82
|
+
/** A code was typed into it and the client has not answered yet. */
|
|
83
|
+
checking?: true;
|
|
84
|
+
/**
|
|
85
|
+
* The client's last complaint, in its words — «Couldn't log in: Authentication failed: Invalid authorization code»,
|
|
86
|
+
* «That doesn't look like the full code…». Never what was typed.
|
|
87
|
+
*/
|
|
88
|
+
problem?: string;
|
|
60
89
|
}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conversations (planning/sessions/01-conversations.md): LensMCP holds every agent conversation of a repository — Claude
|
|
3
|
+
* Code and Codex, every account folder and the own sign-ins, on each Mac — normalized into turns, so any agent on any
|
|
4
|
+
* client, account or Mac continues one through `conversation_get` instead of a native resume. Summaries, memories and
|
|
5
|
+
* action items are made with LensMCP's own model key, on request.
|
|
6
|
+
*/
|
|
7
|
+
import type { DashAiTrigger } from './dashboard.js';
|
|
8
|
+
import type { DashClientSession, DashClientSessionClient, DashClientSessionKind } from './sessions.js';
|
|
9
|
+
/** `cv-` + 16 hex: a hash of (Mac fingerprint, client, native id) — the same conversation has the same id on both Macs. */
|
|
10
|
+
export type ConversationId = string;
|
|
11
|
+
export declare const CONVERSATION_ID: RegExp;
|
|
12
|
+
/** Where a conversation stands: running now, ended (its process gone), or only on record (its transcript is gone). */
|
|
13
|
+
export type DashConversationState = 'running' | 'ended' | 'kept';
|
|
14
|
+
/** One conversation of the repository, as the store lists it. */
|
|
15
|
+
export interface DashConversation {
|
|
16
|
+
id: ConversationId;
|
|
17
|
+
client: DashClientSessionClient;
|
|
18
|
+
/** The client's own id: a Claude Code session id, a Codex thread id. */
|
|
19
|
+
nativeId: string;
|
|
20
|
+
/** The Mac it ran on: this one's name, or the worker's. */
|
|
21
|
+
mac: {
|
|
22
|
+
name: string;
|
|
23
|
+
fingerprint?: string;
|
|
24
|
+
here: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** The account it ran under (`ac-…`), or the client's own sign-in (`own:claude`, `own:codex`). */
|
|
27
|
+
account: string;
|
|
28
|
+
accountNick?: string;
|
|
29
|
+
checkout: {
|
|
30
|
+
root: string;
|
|
31
|
+
branch?: string;
|
|
32
|
+
key?: string;
|
|
33
|
+
};
|
|
34
|
+
cwd?: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
/** The first prompt, or the newest summary's first line. */
|
|
37
|
+
title: string;
|
|
38
|
+
startedAt: number;
|
|
39
|
+
lastAt: number;
|
|
40
|
+
state: DashConversationState;
|
|
41
|
+
turns: number;
|
|
42
|
+
/** What LensMCP knows it as: a person session, a team launch, a session started outside LensMCP. */
|
|
43
|
+
kind?: DashClientSessionKind;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
launchId?: string;
|
|
46
|
+
role?: string;
|
|
47
|
+
goalId?: string;
|
|
48
|
+
goalTitle?: string;
|
|
49
|
+
taskId?: string;
|
|
50
|
+
/** The conversation this one continues (it started from that one's handoff), and the ones that continue it. */
|
|
51
|
+
continues?: ConversationId;
|
|
52
|
+
continuedIn?: ConversationId[];
|
|
53
|
+
/** The newest summary: when, and up to which turn. */
|
|
54
|
+
summarized?: {
|
|
55
|
+
at: number;
|
|
56
|
+
throughSeq: number;
|
|
57
|
+
};
|
|
58
|
+
/** Open action items and memories waiting for the person. */
|
|
59
|
+
open?: {
|
|
60
|
+
actions: number;
|
|
61
|
+
memories: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export type DashConversationTurnKind = 'prompt' | 'reply' | 'tool' | 'compaction' | 'subagent';
|
|
65
|
+
/** One normalized step. Thinking is never kept; tool output is cut to a bound. */
|
|
66
|
+
export interface DashConversationTurn {
|
|
67
|
+
seq: number;
|
|
68
|
+
at?: number;
|
|
69
|
+
kind: DashConversationTurnKind;
|
|
70
|
+
/** The words — a prompt, a reply, a compaction's summary — cut to a bound (`cut` says so). */
|
|
71
|
+
text: string;
|
|
72
|
+
cut?: true;
|
|
73
|
+
/** A tool call: its name (`Edit`, `exec_command`, `mcp__lensmcp__lint`), what it acted on, and how it ended. */
|
|
74
|
+
tool?: {
|
|
75
|
+
name: string;
|
|
76
|
+
target?: string;
|
|
77
|
+
outcome?: 'ok' | 'error';
|
|
78
|
+
output?: string;
|
|
79
|
+
};
|
|
80
|
+
/** Files it changed (a tool call's edits). */
|
|
81
|
+
files?: string[];
|
|
82
|
+
}
|
|
83
|
+
/** How much an action item matters (an older item, made before summaries ranked them, reads as `normal`). */
|
|
84
|
+
export type DashConversationPriority = 'high' | 'normal' | 'low';
|
|
85
|
+
/** How bad a risk would be (an older summary's risks read as `medium`). */
|
|
86
|
+
export type DashConversationSeverity = 'high' | 'medium' | 'low';
|
|
87
|
+
/** Who an action item is for: the person, an agent (its role in `owner`), or whoever takes it (an older item: `anyone`). */
|
|
88
|
+
export type DashConversationOwnerKind = 'person' | 'agent' | 'anyone';
|
|
89
|
+
/** One beat of a summary's story: what happened over turns `fromSeq`–`toSeq`, in a sentence. */
|
|
90
|
+
export interface DashConversationStoryBeat {
|
|
91
|
+
text: string;
|
|
92
|
+
fromSeq: number;
|
|
93
|
+
toSeq: number;
|
|
94
|
+
}
|
|
95
|
+
/** A rolling summary: it covers turns 1..`throughSeq`; the next one reads it and the turns after. */
|
|
96
|
+
export interface DashConversationSummary {
|
|
97
|
+
at: number;
|
|
98
|
+
throughSeq: number;
|
|
99
|
+
summary: string;
|
|
100
|
+
state: {
|
|
101
|
+
status: 'done' | 'in-progress' | 'blocked';
|
|
102
|
+
next?: string;
|
|
103
|
+
};
|
|
104
|
+
decisions: string[];
|
|
105
|
+
files: string[];
|
|
106
|
+
risks: string[];
|
|
107
|
+
model: string;
|
|
108
|
+
costUsd?: number;
|
|
109
|
+
trigger: DashAiTrigger;
|
|
110
|
+
/** 3–6 beats of what happened over turns 1..`throughSeq`, in order. An older summary has none: the tab splits its prose. */
|
|
111
|
+
story?: DashConversationStoryBeat[];
|
|
112
|
+
/** How bad each of `risks` would be, by index. An older summary has none: each of its risks reads as `medium`. */
|
|
113
|
+
riskSeverity?: DashConversationSeverity[];
|
|
114
|
+
}
|
|
115
|
+
export type DashConversationItemKind = 'action' | 'memory' | 'decision';
|
|
116
|
+
export type DashConversationItemState = 'proposed' | 'kept' | 'dropped' | 'done';
|
|
117
|
+
/** An action item or a memory a summary proposed: the person keeps it (to the backlog, to lessons) or drops it. */
|
|
118
|
+
export interface DashConversationItem {
|
|
119
|
+
id: string;
|
|
120
|
+
conversation: ConversationId;
|
|
121
|
+
kind: DashConversationItemKind;
|
|
122
|
+
text: string;
|
|
123
|
+
why?: string;
|
|
124
|
+
/** An action item's owner as the summary named it: the person's name, an agent's role — absent for anyone. */
|
|
125
|
+
owner?: string;
|
|
126
|
+
/** An action item's: who it is for (absent on an older item: `anyone`) and how much it matters (absent: `normal`). */
|
|
127
|
+
ownerKind?: DashConversationOwnerKind;
|
|
128
|
+
priority?: DashConversationPriority;
|
|
129
|
+
state: DashConversationItemState;
|
|
130
|
+
/**
|
|
131
|
+
* The repository files it is about, as the conversation named them: the files a kept memory's lesson rests on (cites)
|
|
132
|
+
* and is recalled for (paths) — a lesson without a file is a guess (planning/team/18 RT-D15) — and the file refs of a
|
|
133
|
+
* kept action's backlog item.
|
|
134
|
+
*/
|
|
135
|
+
files?: string[];
|
|
136
|
+
/** Where a kept one went: a backlog item, a lesson. */
|
|
137
|
+
keptAs?: {
|
|
138
|
+
backlog?: string;
|
|
139
|
+
lesson?: string;
|
|
140
|
+
};
|
|
141
|
+
at: number;
|
|
142
|
+
}
|
|
143
|
+
/** What an agent reads to continue a conversation (`conversation_get`, part `handoff`). */
|
|
144
|
+
export interface ConversationHandoff {
|
|
145
|
+
conversation: DashConversation;
|
|
146
|
+
summary?: DashConversationSummary;
|
|
147
|
+
items: DashConversationItem[];
|
|
148
|
+
/** Files the conversation changed, newest first. */
|
|
149
|
+
files: string[];
|
|
150
|
+
/** The newest turns, oldest first, filling what the summary leaves of the budget. */
|
|
151
|
+
turns: DashConversationTurn[];
|
|
152
|
+
/** Older turns exist before `turns[0]`: page them with part `turns`, `before`. */
|
|
153
|
+
more: boolean;
|
|
154
|
+
/** What to do next, in a sentence: «continue from the next step», «the summary is N turns old», … */
|
|
155
|
+
next: string;
|
|
156
|
+
}
|
|
157
|
+
/** `GET /api/conversations?…` and `conversation_list`. */
|
|
158
|
+
export interface ConversationListQuery {
|
|
159
|
+
checkout?: string;
|
|
160
|
+
goalId?: string;
|
|
161
|
+
taskId?: string;
|
|
162
|
+
role?: string;
|
|
163
|
+
client?: DashClientSessionClient;
|
|
164
|
+
account?: string;
|
|
165
|
+
mac?: string;
|
|
166
|
+
state?: DashConversationState;
|
|
167
|
+
since?: number;
|
|
168
|
+
text?: string;
|
|
169
|
+
limit?: number;
|
|
170
|
+
}
|
|
171
|
+
export interface DashConversationsAnswer {
|
|
172
|
+
conversations: DashConversation[];
|
|
173
|
+
/** More match than were listed. */
|
|
174
|
+
more: boolean;
|
|
175
|
+
}
|
|
176
|
+
/** `GET /api/conversations/one?id=&before=&limit=`: a conversation, its turns (newest page), its summaries and items. */
|
|
177
|
+
export interface DashConversationDetail {
|
|
178
|
+
conversation: DashConversation;
|
|
179
|
+
turns: DashConversationTurn[];
|
|
180
|
+
more: boolean;
|
|
181
|
+
summaries: DashConversationSummary[];
|
|
182
|
+
items: DashConversationItem[];
|
|
183
|
+
}
|
|
184
|
+
/** `POST /api/conversations/summarize` `{ id }` — the person's «Summarize» (trigger `click`). */
|
|
185
|
+
export interface DashConversationSummarizeRequest {
|
|
186
|
+
id: ConversationId;
|
|
187
|
+
}
|
|
188
|
+
/** A trigger's daily allowance as a summary spends from it (UTC day, estimated USD). */
|
|
189
|
+
export interface DashConversationAllowance {
|
|
190
|
+
trigger: DashAiTrigger;
|
|
191
|
+
capUsd: number;
|
|
192
|
+
spentUsd: number;
|
|
193
|
+
leftUsd: number;
|
|
194
|
+
}
|
|
195
|
+
/** What «Summarize» answers: the new summary, the items it proposed (only new ones), what it cost and what is left. */
|
|
196
|
+
export interface DashConversationSummarizeAnswer {
|
|
197
|
+
summary: DashConversationSummary;
|
|
198
|
+
items: DashConversationItem[];
|
|
199
|
+
/** Calls made: a long tail of turns is read in passes, each pass the previous one's summary plus the next turns. */
|
|
200
|
+
passes: number;
|
|
201
|
+
/** Turns after `summary.throughSeq` were left for the next «Summarize» — the passes' bound, or a pass that failed. */
|
|
202
|
+
more: boolean;
|
|
203
|
+
/** Why the passes stopped before the newest turn, when one failed after others held (their summary is kept). */
|
|
204
|
+
stopped?: string;
|
|
205
|
+
allowance?: DashConversationAllowance;
|
|
206
|
+
/** How long it took, from the click to the summary kept. */
|
|
207
|
+
madeInMs?: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* A summary being made, as the dashboard tracks it — one at a time per conversation (a second «Summarize» waits for it):
|
|
211
|
+
* `GET /api/conversations/summarize/progress?id=` answers the running one, or the last one for two minutes after it
|
|
212
|
+
* ended, so a reload mid-run or right after shows it. Stages in order: `reading` the turns, then per pass `asking` the
|
|
213
|
+
* model and `checking` its answer, then `saving` — and `done` or `failed`.
|
|
214
|
+
*/
|
|
215
|
+
export type DashSummaryJobStage = 'reading' | 'asking' | 'checking' | 'saving' | 'done' | 'failed';
|
|
216
|
+
export interface DashSummaryJob {
|
|
217
|
+
/** `sj-` + hex: this run's own id. */
|
|
218
|
+
id: string;
|
|
219
|
+
conversation: ConversationId;
|
|
220
|
+
trigger: DashAiTrigger;
|
|
221
|
+
model: string;
|
|
222
|
+
provider: 'anthropic' | 'openai';
|
|
223
|
+
/** The provider streams its answer (Anthropic): output counts up as it is written. Else (OpenAI) it answers whole — only the time waited shows. */
|
|
224
|
+
streams: boolean;
|
|
225
|
+
startedAt: number;
|
|
226
|
+
endedAt?: number;
|
|
227
|
+
stage: DashSummaryJobStage;
|
|
228
|
+
/** The pass being made, from 1 (0 while reading), and how many it will make — from the turns left and a pass's input budget; fewer when one fails or it is stopped. */
|
|
229
|
+
pass: number;
|
|
230
|
+
passes: number;
|
|
231
|
+
/**
|
|
232
|
+
* Turns: `from`–`to` this pass reads; `through` the newest summary covers so far (this run's finished passes in);
|
|
233
|
+
* `start` the summary it began from covered (0: none); `end` the last turn this run will read; `total` the conversation's.
|
|
234
|
+
*/
|
|
235
|
+
turns: {
|
|
236
|
+
from: number;
|
|
237
|
+
to: number;
|
|
238
|
+
through: number;
|
|
239
|
+
total: number;
|
|
240
|
+
start: number;
|
|
241
|
+
end: number;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* Tokens: `input` this pass sent (the provider's count once it says, an estimate until then), `output` this pass wrote
|
|
245
|
+
* so far (counted from the stream as it comes — `estimated` until the pass ends with the provider's usage), and every
|
|
246
|
+
* pass's together.
|
|
247
|
+
*/
|
|
248
|
+
tokens: {
|
|
249
|
+
input: number;
|
|
250
|
+
output: number;
|
|
251
|
+
inputTotal: number;
|
|
252
|
+
outputTotal: number;
|
|
253
|
+
estimated: boolean;
|
|
254
|
+
};
|
|
255
|
+
/** Spent so far (estimated USD): the finished passes' usage, and the pass being written priced from its tokens so far. */
|
|
256
|
+
costUsd: number;
|
|
257
|
+
elapsedMs: number;
|
|
258
|
+
/** What is left today of the allowance it spends from (UTC). */
|
|
259
|
+
allowanceLeftUsd?: number;
|
|
260
|
+
/** The person asked it to stop: no pass starts after the one being written — that pass is still paid, and kept. */
|
|
261
|
+
stopping?: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Why it failed — the allowance's words, the model's refusal, an answer that did not hold — what it spent all the
|
|
264
|
+
* same, the AI calls page's run of the call that failed, and the stage it failed at.
|
|
265
|
+
*/
|
|
266
|
+
error?: {
|
|
267
|
+
message: string;
|
|
268
|
+
reason: string;
|
|
269
|
+
costUsd?: number;
|
|
270
|
+
runId?: string;
|
|
271
|
+
at?: Exclude<DashSummaryJobStage, 'done' | 'failed'>;
|
|
272
|
+
};
|
|
273
|
+
/** What it made, once done: what «Summarize» answers. */
|
|
274
|
+
answer?: DashConversationSummarizeAnswer;
|
|
275
|
+
}
|
|
276
|
+
/** `GET /api/conversations/summarize/progress?id=`: the conversation's running summary, or the last one for two minutes after; none: `{}`. */
|
|
277
|
+
export interface DashSummaryProgressAnswer {
|
|
278
|
+
job?: DashSummaryJob;
|
|
279
|
+
}
|
|
280
|
+
/** `POST /api/conversations/summarize/stop` `{ id }`: no pass starts after the one being written. Answers the job as it is. */
|
|
281
|
+
export interface DashSummaryStopRequest {
|
|
282
|
+
id: ConversationId;
|
|
283
|
+
}
|
|
284
|
+
/** A finished summary run stays readable on the progress route this long after it ended. */
|
|
285
|
+
export declare const SUMMARY_JOB_KEEP_MS = 120000;
|
|
286
|
+
/**
|
|
287
|
+
* `GET /api/conversations/summarizer?client=` — what a summary of a conversation of that client runs on: its model and
|
|
288
|
+
* provider (Settings › Features › AI — Codex conversations their own choice, CV-D4), whether LensMCP summarizes by
|
|
289
|
+
* itself — only at a handoff it starts, before the launch that continues a conversation (CV-D3; Settings › Features
|
|
290
|
+
* `handoffSummary`, on by default) — and the click allowance left today.
|
|
291
|
+
*/
|
|
292
|
+
export interface DashConversationSummarizer {
|
|
293
|
+
model: string;
|
|
294
|
+
provider: 'anthropic' | 'openai';
|
|
295
|
+
auto: 'off' | 'on';
|
|
296
|
+
allowance: DashConversationAllowance;
|
|
297
|
+
/** A key of that provider can answer. */
|
|
298
|
+
hasKey: boolean;
|
|
299
|
+
}
|
|
300
|
+
/** `POST /api/conversations/item` `{ id, item, to }` — keep or drop a proposed memory / action item, or mark one done. */
|
|
301
|
+
export interface DashConversationItemRequest {
|
|
302
|
+
id: ConversationId;
|
|
303
|
+
item: string;
|
|
304
|
+
to: 'kept' | 'dropped' | 'done';
|
|
305
|
+
}
|
|
306
|
+
/** What `POST /api/conversations/item` answers: the item as it is now (a kept one says where it went in `keptAs`). */
|
|
307
|
+
export interface DashConversationItemAnswer {
|
|
308
|
+
item: DashConversationItem;
|
|
309
|
+
}
|
|
310
|
+
/** `POST /api/conversations/continue` — «Continue on…»: a new session on a client and account (and Mac) from its handoff. */
|
|
311
|
+
export interface DashConversationContinueRequest {
|
|
312
|
+
id: ConversationId;
|
|
313
|
+
client: DashClientSessionClient;
|
|
314
|
+
/** An account id, or null for the client's own sign-in. */
|
|
315
|
+
account: string | null;
|
|
316
|
+
/** The worker's fingerprint to continue there; absent: this Mac. Refused until the two-Mac slice (CV5) lands. */
|
|
317
|
+
mac?: string;
|
|
318
|
+
/** The checkout key it starts in; absent: the conversation's own checkout. */
|
|
319
|
+
checkout?: string;
|
|
320
|
+
/** A retry with the same id answers the session that request started (a person session's `requestId`). */
|
|
321
|
+
requestId?: string;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* What «Continue on…» answers: the person session it started — its first prompt names the conversation and tells the
|
|
325
|
+
* agent to call `conversation_get { id, continue: true }` before anything else — and the conversation it continues.
|
|
326
|
+
*/
|
|
327
|
+
export interface DashConversationContinueAnswer {
|
|
328
|
+
session: DashClientSession;
|
|
329
|
+
conversation: ConversationId;
|
|
330
|
+
/** The first prompt the session was given. */
|
|
331
|
+
prompt: string;
|
|
332
|
+
}
|
|
333
|
+
/** `conversation_get`'s parts: the handoff packet, or a page of older turns. */
|
|
334
|
+
export type ConversationGetPart = 'handoff' | 'turns';
|
|
335
|
+
/** `conversation_get`, part `turns`: the turns before `before` (exclusive), oldest first, filling the budget. */
|
|
336
|
+
export interface ConversationTurnsPage {
|
|
337
|
+
conversation: DashConversation;
|
|
338
|
+
turns: DashConversationTurn[];
|
|
339
|
+
/** Older turns exist before `turns[0]`: ask again with `before: turns[0].seq`. */
|
|
340
|
+
more: boolean;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* `conversation_get { continue: true }`: the caller's own conversation recorded as this one's continuation. The store has
|
|
344
|
+
* one writer (the dashboard), so the link is handed to it and applied on its next pass (`applied: false` until then).
|
|
345
|
+
*/
|
|
346
|
+
export interface ConversationContinued {
|
|
347
|
+
recorded: boolean;
|
|
348
|
+
/** The caller's conversation, as the store names it (or will, once its transcript is indexed). */
|
|
349
|
+
conversation?: ConversationId;
|
|
350
|
+
client?: DashClientSessionClient;
|
|
351
|
+
nativeId?: string;
|
|
352
|
+
/** The store holds the link now (true) or the dashboard writes it on its next pass (false). */
|
|
353
|
+
applied?: boolean;
|
|
354
|
+
why: string;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* `conversation_get { summary: 'make' }` (trigger `agent`) and a handoff LensMCP starts (trigger `auto`): what making a
|
|
358
|
+
* summary came to. `made`: a new summary was made now — the answer's `summary` is it — and handed to the dashboard,
|
|
359
|
+
* which keeps it (with its proposals) on its next pass; until then every reader of the store reads it as kept.
|
|
360
|
+
* Not made: `why` says so (the newest summary already covers every turn).
|
|
361
|
+
*/
|
|
362
|
+
export interface ConversationSummaryMade {
|
|
363
|
+
made: boolean;
|
|
364
|
+
trigger: DashAiTrigger;
|
|
365
|
+
/** Through which turn it reads (when made). */
|
|
366
|
+
throughSeq?: number;
|
|
367
|
+
/** Calls made, and what they cost together (estimated USD). */
|
|
368
|
+
passes?: number;
|
|
369
|
+
costUsd?: number;
|
|
370
|
+
/** Turns after `throughSeq` were left for the next summary. */
|
|
371
|
+
more?: boolean;
|
|
372
|
+
why: string;
|
|
373
|
+
}
|
|
374
|
+
/** A handoff LensMCP starts makes a summary first when the newest one is missing or more than this many turns old (CV-D3). */
|
|
375
|
+
export declare const CONVERSATION_HANDOFF_SUMMARY_TURNS = 30;
|
|
376
|
+
/** `conversation_list` and `GET /api/conversations` list this many by default, and at most this many. */
|
|
377
|
+
export declare const CONVERSATION_LIST_LIMIT = 20;
|
|
378
|
+
export declare const CONVERSATION_LIST_MAX = 100;
|
|
379
|
+
/** The handoff budget `conversation_get` fills by default, in tokens. */
|
|
380
|
+
export declare const CONVERSATION_HANDOFF_TOKENS = 12000;
|
|
381
|
+
/** A turn's text and a tool's output are cut to these, in characters, when stored. */
|
|
382
|
+
export declare const CONVERSATION_TURN_CHARS = 16384;
|
|
383
|
+
export declare const CONVERSATION_TOOL_OUTPUT_CHARS = 2048;
|
|
384
|
+
/** A conversation's normalized copy is kept this long after its last turn (CV-D7). */
|
|
385
|
+
export declare const CONVERSATION_KEEP_DAYS = 180;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export const CONVERSATION_ID=/^cv-[0-9a-f]{16}$/,SUMMARY_JOB_KEEP_MS=12e4,CONVERSATION_HANDOFF_SUMMARY_TURNS=30,CONVERSATION_LIST_LIMIT=20,CONVERSATION_LIST_MAX=100,CONVERSATION_HANDOFF_TOKENS=12e3,CONVERSATION_TURN_CHARS=16384,CONVERSATION_TOOL_OUTPUT_CHARS=2048,CONVERSATION_KEEP_DAYS=180;
|
package/lib/dashboard-lint.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LintCoverageKind } from './lint-coverage.js';
|
|
2
|
+
import type { LintIgnoreCount, LintIgnoreProposal } from './lint-ignores.js';
|
|
2
3
|
import type { CheckAnswer, LintFinding } from './static-checks.js';
|
|
3
4
|
/**
|
|
4
5
|
* The dashboard's Lint page (Investigate › Lint, `GET /api/lint`): the ESLint findings `lint://errors` and
|
|
@@ -58,6 +59,12 @@ export interface DashLintGroup {
|
|
|
58
59
|
findings: DashLintFinding[];
|
|
59
60
|
/** Its findings past `findings`. */
|
|
60
61
|
more: number;
|
|
62
|
+
/** The rules in projects it spans — what the Ignore action offers — most findings first, at most 12. */
|
|
63
|
+
pairs?: Array<{
|
|
64
|
+
rule: string;
|
|
65
|
+
project: string;
|
|
66
|
+
count: number;
|
|
67
|
+
}>;
|
|
61
68
|
}
|
|
62
69
|
export interface DashLintRunDiff {
|
|
63
70
|
newErrors: number;
|
|
@@ -207,6 +214,30 @@ export interface DashLint {
|
|
|
207
214
|
compared: boolean;
|
|
208
215
|
/** The saved lint of the whole checkout — absent before a full lint. */
|
|
209
216
|
whole?: DashLintWhole;
|
|
217
|
+
/** What the person ignored (`.lensmcp/lint/ignores.json`): left out of everything above. Absent: nothing is ignored. */
|
|
218
|
+
ignored?: DashLintIgnored;
|
|
219
|
+
/** Agents' proposals to ignore a rule in a project, open for the person — newest first. */
|
|
220
|
+
proposals?: LintIgnoreProposal[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The page's «Ignored» pane: each rule ignored in a project, why, by whom and when, and what it hides now — the lint
|
|
224
|
+
* runs still report them; the page, the error groups, the status and the agents' answers leave them out.
|
|
225
|
+
*/
|
|
226
|
+
export interface DashLintIgnored {
|
|
227
|
+
/** The file, relative to the workspace. */
|
|
228
|
+
file: string;
|
|
229
|
+
errors: number;
|
|
230
|
+
warnings: number;
|
|
231
|
+
rules: Array<LintIgnoreCount & {
|
|
232
|
+
proposal?: string;
|
|
233
|
+
}>;
|
|
234
|
+
/** Entries of the file that do not hold, and why. */
|
|
235
|
+
problems: string[];
|
|
236
|
+
/**
|
|
237
|
+
* Git ignores the file: the repository's .gitignore keeps `.lensmcp/lint/` out, so the ignores are this checkout's
|
|
238
|
+
* only until its LensMCP lines are brought up to date (`lensmcp install`, or Settings › Project › Setup).
|
|
239
|
+
*/
|
|
240
|
+
gitIgnored?: true;
|
|
210
241
|
}
|
|
211
242
|
/**
|
|
212
243
|
* `GET /api/lint/findings?offset=&limit=&detail=1` — the page's full list and its coverage strip, read from the RECORD
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lint findings the person chose to ignore (owner, 2026-11-19: «hide or ignore specific lints — api-e2e's
|
|
3
|
+
* @nx/enforce-module-boundaries can be ignored because it's e2e»), kept IN THE REPOSITORY so every checkout, every
|
|
4
|
+
* agent and every teammate reads the same: `.lensmcp/lint/ignores.json`, a folder the LensMCP .gitignore lines let back
|
|
5
|
+
* in (`@lensmcp/core` lens-dir.ts `LENS_SHARED_DIRS`).
|
|
6
|
+
*
|
|
7
|
+
* The unit is ONE RULE IN ONE PROJECT — the project that owns the file, as the Lint page and the `lint` tool name it.
|
|
8
|
+
* Not a rule everywhere and not a path glob: a rule that is wrong for the whole workspace is the ESLint config's to
|
|
9
|
+
* turn off, and a folder is a project's. An ignore never changes ESLint — `nx lint` still reports the finding — it
|
|
10
|
+
* changes what the lens counts: the Lint page's numbers, the «N lint errors in <project>» error groups, `lint://` and
|
|
11
|
+
* the session's status, and the `lint` tool's totals and verdict, which each say how many they left out and why.
|
|
12
|
+
*
|
|
13
|
+
* { "version": 1, "ignores": [{ "rule": "@nx/enforce-module-boundaries", "project": "api-e2e",
|
|
14
|
+
* "reason": "e2e project imports app internals by design", "by": "person", "at": "2026-11-19T10:00:00.000Z" }] }
|
|
15
|
+
*
|
|
16
|
+
* A fatal parse error (no rule) is never ignored. An agent PROPOSES an ignore (`lint_ignore_propose`); only the person
|
|
17
|
+
* turns a proposal into one, on the Lint page.
|
|
18
|
+
*
|
|
19
|
+
* Pure: what the file may hold, read and written as text; the disk is `@lensmcp/static-checks` lint-ignores-file.ts.
|
|
20
|
+
*/
|
|
21
|
+
/** Where the ignores are kept, relative to the workspace root — committed with the code. */
|
|
22
|
+
export declare const LINT_IGNORES_FILE = ".lensmcp/lint/ignores.json";
|
|
23
|
+
export declare const LINT_IGNORE_LIMITS: {
|
|
24
|
+
readonly rule: 200;
|
|
25
|
+
readonly project: 200;
|
|
26
|
+
readonly reason: 500;
|
|
27
|
+
readonly evidence: 1000;
|
|
28
|
+
readonly by: 80;
|
|
29
|
+
readonly ignores: 500;
|
|
30
|
+
};
|
|
31
|
+
/** One ignored lint: a rule in a project, and why. */
|
|
32
|
+
export interface LintIgnore {
|
|
33
|
+
/** ESLint's rule id, as a finding names it (`@nx/enforce-module-boundaries`). */
|
|
34
|
+
rule: string;
|
|
35
|
+
/** The project that owns the files (`api-e2e`). */
|
|
36
|
+
project: string;
|
|
37
|
+
/** Why it is not to be fixed — what a teammate and an agent read. */
|
|
38
|
+
reason: string;
|
|
39
|
+
/** Who decided it: `person` from the Lint page, or a hand edit's own word. */
|
|
40
|
+
by?: string;
|
|
41
|
+
/** When, as ISO 8601. */
|
|
42
|
+
at?: string;
|
|
43
|
+
/** The agent's proposal it was accepted from (`lp_…`), when it was. */
|
|
44
|
+
proposal?: string;
|
|
45
|
+
}
|
|
46
|
+
/** The file read: the ignores that hold, and what in it does not (each a sentence; the entry is left out). */
|
|
47
|
+
export interface LintIgnoresRead {
|
|
48
|
+
ignores: LintIgnore[];
|
|
49
|
+
problems: string[];
|
|
50
|
+
}
|
|
51
|
+
/** An ignore in the words an answer gives it, with what it leaves out now. */
|
|
52
|
+
export interface LintIgnoreCount {
|
|
53
|
+
rule: string;
|
|
54
|
+
project: string;
|
|
55
|
+
reason: string;
|
|
56
|
+
by?: string;
|
|
57
|
+
at?: string;
|
|
58
|
+
errors: number;
|
|
59
|
+
warnings: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* What an answer left out because the person ignored it — on `lint://current`, `lint://errors`, `lint://warnings` and
|
|
63
|
+
* the `lint` tool's answer. `rules` are every ignore in the file, each with what it hides now (0 and 0: nothing now).
|
|
64
|
+
*/
|
|
65
|
+
export interface LintIgnoredSummary {
|
|
66
|
+
file: string;
|
|
67
|
+
errors: number;
|
|
68
|
+
warnings: number;
|
|
69
|
+
/** The ones that hide something now first, most first; at most {@link LINT_IGNORED_RULES_SAID}. */
|
|
70
|
+
rules: LintIgnoreCount[];
|
|
71
|
+
/** Ignores past `rules`. */
|
|
72
|
+
moreRules?: number;
|
|
73
|
+
/** Entries of the file that do not hold, and why. */
|
|
74
|
+
problems?: string[];
|
|
75
|
+
/** For an agent: what this means. */
|
|
76
|
+
note: string;
|
|
77
|
+
}
|
|
78
|
+
/** The ignores an answer names; the file may hold more. */
|
|
79
|
+
export declare const LINT_IGNORED_RULES_SAID = 50;
|
|
80
|
+
/** What every summary tells the agent that reads it. */
|
|
81
|
+
export declare const LINT_IGNORED_NOTE = "The person ignored these lints in the repository (each a rule in a project, with why): they are left out of the counts, the verdict and the status \u2014 do not fix them, and do not edit the ESLint config or this file for them. ESLint itself (`nx lint`) still reports them. To ask for another, `lint_ignore_propose`; only the person accepts.";
|
|
82
|
+
/** One ignore's key: the rule in the project. */
|
|
83
|
+
export declare function lintIgnoreKey(rule: string, project: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* A rule, project and reason as an ignore may hold them, or why not — what the Lint page's form, an accepted proposal
|
|
86
|
+
* and the file's own entries are each held to.
|
|
87
|
+
*/
|
|
88
|
+
export declare function checkLintIgnore(input: {
|
|
89
|
+
rule?: unknown;
|
|
90
|
+
project?: unknown;
|
|
91
|
+
reason?: unknown;
|
|
92
|
+
}): {
|
|
93
|
+
rule: string;
|
|
94
|
+
project: string;
|
|
95
|
+
reason: string;
|
|
96
|
+
} | {
|
|
97
|
+
problem: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* The file's text read: every entry that holds, in its order; one that does not is left out and said. A second entry
|
|
101
|
+
* for the same rule in the same project is said too — the first stands. Text that is not the file's shape is one
|
|
102
|
+
* problem and no ignore: a broken file never hides anything.
|
|
103
|
+
*/
|
|
104
|
+
export declare function parseLintIgnores(raw: string | undefined): LintIgnoresRead;
|
|
105
|
+
/** The file's text for a list: by project, then rule — so a diff shows one line moved, never the list reordered. */
|
|
106
|
+
export declare function lintIgnoresText(ignores: readonly LintIgnore[]): string;
|
|
107
|
+
/** The list with one ignore set — added, or the same rule in the same project replaced (a new reason). */
|
|
108
|
+
export declare function withLintIgnore(ignores: readonly LintIgnore[], next: LintIgnore): LintIgnore[];
|
|
109
|
+
/** The list without a rule in a project; the same list when it was not there. */
|
|
110
|
+
export declare function withoutLintIgnore(ignores: readonly LintIgnore[], rule: string, project: string): LintIgnore[];
|
|
111
|
+
/**
|
|
112
|
+
* Which ignore holds a finding: its rule (none for a fatal parse error: never) in the project that owns its file.
|
|
113
|
+
* `project` is that owner when the caller knows it; `scope` is what the finding's run named, read only when no owner is
|
|
114
|
+
* known — a workspace with no project census.
|
|
115
|
+
*/
|
|
116
|
+
export declare function lintIgnoreMatcher(ignores: readonly LintIgnore[]): (finding: {
|
|
117
|
+
rule: string | null | undefined;
|
|
118
|
+
project: string | undefined;
|
|
119
|
+
scope?: string | undefined;
|
|
120
|
+
}) => LintIgnore | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* The summary an answer carries: each ignore with what it hid now (`hid`, by key), the totals, the file's problems.
|
|
123
|
+
* Undefined when the file holds no ignore and no problem — an answer then says nothing of it.
|
|
124
|
+
*/
|
|
125
|
+
export declare function lintIgnoredSummary(read: LintIgnoresRead, hid: ReadonlyMap<string, {
|
|
126
|
+
errors: number;
|
|
127
|
+
warnings: number;
|
|
128
|
+
}>): LintIgnoredSummary | undefined;
|
|
129
|
+
/** What became of a proposal: open for the person, accepted (the ignore is written), or declined. */
|
|
130
|
+
export type LintIgnoreProposalState = 'open' | 'accepted' | 'declined';
|
|
131
|
+
/** An agent's proposal to ignore a rule in a project — data for the person, who accepts or declines it on the Lint page. */
|
|
132
|
+
export interface LintIgnoreProposal {
|
|
133
|
+
/** `lp_…`. */
|
|
134
|
+
id: string;
|
|
135
|
+
at: number;
|
|
136
|
+
rule: string;
|
|
137
|
+
project: string;
|
|
138
|
+
reason: string;
|
|
139
|
+
/** What the agent saw that says it is noise («the project is an e2e suite that imports the app's internals by design»). */
|
|
140
|
+
evidence?: string;
|
|
141
|
+
/** Who proposed it, as the agent said. */
|
|
142
|
+
by: string;
|
|
143
|
+
/** The agent's request id: the same proposal sent again answers the first. */
|
|
144
|
+
requestId?: string;
|
|
145
|
+
state: LintIgnoreProposalState;
|
|
146
|
+
closedAt?: number;
|
|
147
|
+
/** The person's word on it — the reason they kept, or why they declined. */
|
|
148
|
+
note?: string;
|
|
149
|
+
}
|
|
150
|
+
export declare const LINT_IGNORE_PROPOSAL_LIMITS: {
|
|
151
|
+
readonly open: 30;
|
|
152
|
+
readonly kept: 200;
|
|
153
|
+
readonly requestId: 200;
|
|
154
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var y=Object.defineProperty;var p=(e,t)=>y(e,"name",{value:t,configurable:!0});var j=Object.defineProperty,l=p((e,t)=>j(e,"name",{value:t,configurable:!0}),"l");export const LINT_IGNORES_FILE=".lensmcp/lint/ignores.json",LINT_IGNORE_LIMITS={rule:200,project:200,reason:500,evidence:1e3,by:80,ignores:500},LINT_IGNORED_RULES_SAID=50,LINT_IGNORED_NOTE="The person ignored these lints in the repository (each a rule in a project, with why): they are left out of the counts, the verdict and the status \u2014 do not fix them, and do not edit the ESLint config or this file for them. ESLint itself (`nx lint`) still reports them. To ask for another, `lint_ignore_propose`; only the person accepts.";const I=l(e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,"obj"),u=l(e=>typeof e=="string"&&e.trim()?e.replace(/\s+/g," ").trim():void 0,"text");export function lintIgnoreKey(e,t){return`${t}\0${e}`}p(lintIgnoreKey,"lintIgnoreKey"),l(lintIgnoreKey,"lintIgnoreKey");export function checkLintIgnore(e){const t=u(e.rule),n=u(e.project),r=u(e.reason),o=LINT_IGNORE_LIMITS;return t?t==="fatal"?{problem:"a file ESLint could not parse is never ignored \u2014 fix it"}:t.length>o.rule?{problem:`the rule is at most ${o.rule} characters`}:n?n.length>o.project?{problem:`the project is at most ${o.project} characters`}:r?r.length>o.reason?{problem:`the reason is at most ${o.reason} characters`}:{rule:t,project:n,reason:r}:{problem:"say why it is not to be fixed \u2014 the reason is what a teammate and an agent read"}:{problem:"name the project that owns the files"}:{problem:"name the rule (ESLint\u2019s rule id, as the finding names it)"}}p(checkLintIgnore,"checkLintIgnore"),l(checkLintIgnore,"checkLintIgnore");export function parseLintIgnores(e){if(e===void 0||!e.trim())return{ignores:[],problems:[]};let t;try{t=JSON.parse(e)}catch(i){return{ignores:[],problems:[`${LINT_IGNORES_FILE} is not JSON (${i instanceof Error?i.message:String(i)}) \u2014 no lint is ignored until it is`]}}const n=I(t),r=n?n.ignores:void 0;if(!n||!Array.isArray(r))return{ignores:[],problems:[`${LINT_IGNORES_FILE} holds no "ignores" list \u2014 no lint is ignored until it does`]};const o=[],a=[],s=new Set;return r.forEach((i,h)=>{const g=I(i);if(!g){a.push(`ignores[${h}] is not an object`);return}const c=checkLintIgnore(g);if("problem"in c){a.push(`ignores[${h}]: ${c.problem}`);return}const f=lintIgnoreKey(c.rule,c.project);if(s.has(f)){a.push(`ignores[${h}]: ${c.rule} in ${c.project} is ignored above already \u2014 the first stands`);return}if(o.length>=LINT_IGNORE_LIMITS.ignores){a.push(`ignores[${h}]: past ${LINT_IGNORE_LIMITS.ignores} ignores \u2014 the rest are not read`);return}s.add(f);const b=u(g.by)?.slice(0,LINT_IGNORE_LIMITS.by),m=u(g.at),d=u(g.proposal);o.push({...c,...b?{by:b}:{},...m&&!Number.isNaN(Date.parse(m))?{at:m}:{},...d?{proposal:d.slice(0,40)}:{}})}),{ignores:o,problems:a}}p(parseLintIgnores,"parseLintIgnores"),l(parseLintIgnores,"parseLintIgnores");export function lintIgnoresText(e){const t=[...e].sort((r,o)=>r.project<o.project?-1:r.project>o.project?1:r.rule<o.rule?-1:r.rule>o.rule?1:0),n=l(r=>({rule:r.rule,project:r.project,reason:r.reason,...r.by?{by:r.by}:{},...r.at?{at:r.at}:{},...r.proposal?{proposal:r.proposal}:{}}),"entry");return`${JSON.stringify({version:1,ignores:t.map(n)},null,2)}
|
|
2
|
+
`}p(lintIgnoresText,"lintIgnoresText"),l(lintIgnoresText,"lintIgnoresText");export function withLintIgnore(e,t){const n=lintIgnoreKey(t.rule,t.project);return[...e.filter(r=>lintIgnoreKey(r.rule,r.project)!==n),t]}p(withLintIgnore,"withLintIgnore"),l(withLintIgnore,"withLintIgnore");export function withoutLintIgnore(e,t,n){const r=lintIgnoreKey(t,n);return e.filter(o=>lintIgnoreKey(o.rule,o.project)!==r)}p(withoutLintIgnore,"withoutLintIgnore"),l(withoutLintIgnore,"withoutLintIgnore");export function lintIgnoreMatcher(e){if(!e.length)return()=>{};const t=new Map(e.map(n=>[lintIgnoreKey(n.rule,n.project),n]));return({rule:n,project:r,scope:o})=>{if(!n||n==="fatal")return;const a=r??o;return a===void 0?void 0:t.get(lintIgnoreKey(n,a))}}p(lintIgnoreMatcher,"lintIgnoreMatcher"),l(lintIgnoreMatcher,"lintIgnoreMatcher");export function lintIgnoredSummary(e,t){if(!e.ignores.length&&!e.problems.length)return;let n=0,r=0;const o=e.ignores.map(s=>{const i=t.get(lintIgnoreKey(s.rule,s.project))??{errors:0,warnings:0};return n+=i.errors,r+=i.warnings,{rule:s.rule,project:s.project,reason:s.reason,...s.by?{by:s.by}:{},...s.at?{at:s.at}:{},errors:i.errors,warnings:i.warnings}}).map((s,i)=>({r:s,i})).sort((s,i)=>i.r.errors-s.r.errors||i.r.warnings-s.r.warnings||s.i-i.i).map(({r:s})=>s),a=o.length-LINT_IGNORED_RULES_SAID;return{file:LINT_IGNORES_FILE,errors:n,warnings:r,rules:o.slice(0,LINT_IGNORED_RULES_SAID),...a>0?{moreRules:a}:{},...e.problems.length?{problems:e.problems.slice(0,10)}:{},note:LINT_IGNORED_NOTE}}p(lintIgnoredSummary,"lintIgnoredSummary"),l(lintIgnoredSummary,"lintIgnoredSummary");export const LINT_IGNORE_PROPOSAL_LIMITS={open:30,kept:200,requestId:200};
|
package/lib/peers.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type DockerRunState, type DockerVmRead, type LensJobLinkLoss } from './docker-jobs.js';
|
|
3
|
+
import { type ConversationGetPart, type ConversationHandoff, type ConversationListQuery, type ConversationTurnsPage, type DashConversationState, type DashConversationTurn, type DashConversationsAnswer } from './conversations.js';
|
|
3
4
|
import type { HostAgentsAdvert } from './host-agents.js';
|
|
5
|
+
import type { DashClientSessionClient, DashClientSessionKind } from './sessions.js';
|
|
4
6
|
import type { WorkspaceActionLane, WorkspaceActionState } from './workspace-actions.js';
|
|
5
7
|
/**
|
|
6
8
|
* WORKER MACS — the peer contract (planning/docker/00-plan.md §§ 7–10 and «The contract»; issues/closed/overseer-74).
|
|
@@ -771,6 +773,8 @@ export interface PeerBodies {
|
|
|
771
773
|
'goal.sent': GoalSent;
|
|
772
774
|
'goal.changes': GoalChanges;
|
|
773
775
|
'goal.update': GoalUpdate;
|
|
776
|
+
'conversation.sync': ConversationSync;
|
|
777
|
+
'conversation.read': ConversationRead;
|
|
774
778
|
}
|
|
775
779
|
export type PeerMessageType = keyof PeerBodies;
|
|
776
780
|
/** One control message: the discriminated union, by `type`. */
|
|
@@ -780,7 +784,7 @@ export type PeerMessage = {
|
|
|
780
784
|
/** What the organizer sends (§ 8, left column). */
|
|
781
785
|
export declare const TO_WORKER: readonly ["job.offer", "job.cancel", "bundle.ready", "tunnel.open", "tunnel.close", "launch.start", "launch.stop", "store.reply", "version.install", "main.moved", "instance.tunnel.open", "goal.place", "goal.changes", "goal.update"];
|
|
782
786
|
/** What the worker sends (§ 8, right column), and `forget`. */
|
|
783
|
-
export declare const TO_ORGANIZER: readonly ["hello", "capacity", "job.state", "job.stage", "job.done", "bundle.sent", "launch.state", "launch.tail", "store.call", "version.state", "forget", "main.state", "instance.state", "store.read", "goal.sent"];
|
|
787
|
+
export declare const TO_ORGANIZER: readonly ["hello", "capacity", "job.state", "job.stage", "job.done", "bundle.sent", "launch.state", "launch.tail", "store.call", "version.state", "forget", "main.state", "instance.state", "store.read", "goal.sent", "conversation.sync", "conversation.read"];
|
|
784
788
|
/** Either side sends a ping. */
|
|
785
789
|
export declare const EITHER_WAY: readonly ["ping"];
|
|
786
790
|
/** The replies: each names the message it answers, and is answered by nothing. */
|
|
@@ -1200,8 +1204,8 @@ export declare const MAIN_MIRROR_SCHEMAS: {
|
|
|
1200
1204
|
sent: z.ZodBoolean;
|
|
1201
1205
|
}, z.core.$strict>>;
|
|
1202
1206
|
follow: z.ZodEnum<{
|
|
1203
|
-
waiting: "waiting";
|
|
1204
1207
|
"in-step": "in-step";
|
|
1208
|
+
waiting: "waiting";
|
|
1205
1209
|
"fast-forward": "fast-forward";
|
|
1206
1210
|
ahead: "ahead";
|
|
1207
1211
|
"to-update": "to-update";
|
|
@@ -1261,8 +1265,8 @@ export declare const MAIN_MIRROR_ANSWER_SCHEMAS: {
|
|
|
1261
1265
|
needWhole: z.ZodOptional<z.ZodBoolean>;
|
|
1262
1266
|
why: z.ZodOptional<z.ZodString>;
|
|
1263
1267
|
follow: z.ZodOptional<z.ZodEnum<{
|
|
1264
|
-
waiting: "waiting";
|
|
1265
1268
|
"in-step": "in-step";
|
|
1269
|
+
waiting: "waiting";
|
|
1266
1270
|
"fast-forward": "fast-forward";
|
|
1267
1271
|
ahead: "ahead";
|
|
1268
1272
|
"to-update": "to-update";
|
|
@@ -1329,11 +1333,11 @@ export declare const PEER_WORK_SCHEMAS: {
|
|
|
1329
1333
|
runId: z.ZodString;
|
|
1330
1334
|
at: z.ZodNumber;
|
|
1331
1335
|
state: z.ZodEnum<{
|
|
1332
|
-
passed: "passed";
|
|
1333
1336
|
failed: "failed";
|
|
1337
|
+
passed: "passed";
|
|
1338
|
+
errored: "errored";
|
|
1334
1339
|
cancelled: "cancelled";
|
|
1335
1340
|
timeout: "timeout";
|
|
1336
|
-
errored: "errored";
|
|
1337
1341
|
}>;
|
|
1338
1342
|
note: z.ZodOptional<z.ZodString>;
|
|
1339
1343
|
step: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1798,8 +1802,8 @@ export declare const GOAL_PEER_SCHEMAS: {
|
|
|
1798
1802
|
sha256: z.ZodString;
|
|
1799
1803
|
}, z.core.$strict>;
|
|
1800
1804
|
services: z.ZodOptional<z.ZodEnum<{
|
|
1801
|
-
none: "none";
|
|
1802
1805
|
"on-demand": "on-demand";
|
|
1806
|
+
none: "none";
|
|
1803
1807
|
always: "always";
|
|
1804
1808
|
}>>;
|
|
1805
1809
|
at: z.ZodNumber;
|
|
@@ -1815,8 +1819,8 @@ export declare const GOAL_PEER_SCHEMAS: {
|
|
|
1815
1819
|
readonly 'goal.changes': z.ZodObject<{
|
|
1816
1820
|
goal: z.ZodString;
|
|
1817
1821
|
what: z.ZodEnum<{
|
|
1818
|
-
files: "files";
|
|
1819
1822
|
commit: "commit";
|
|
1823
|
+
files: "files";
|
|
1820
1824
|
row: "row";
|
|
1821
1825
|
diff: "diff";
|
|
1822
1826
|
commits: "commits";
|
|
@@ -1892,3 +1896,251 @@ export declare const GOAL_PEER_ANSWER_SCHEMAS: {
|
|
|
1892
1896
|
needWhole: z.ZodOptional<z.ZodBoolean>;
|
|
1893
1897
|
}, z.core.$strict>;
|
|
1894
1898
|
};
|
|
1899
|
+
/**
|
|
1900
|
+
* CONVERSATIONS ON TWO MACS (planning/sessions/01-conversations.md § 6, CV-D2; slice CV5). Each Mac's lens keeps its own
|
|
1901
|
+
* conversations (libs/storage conversations/store.ts). A worker sends the organizer the conversations of the
|
|
1902
|
+
* organizer's repositories it holds — the checkouts of the goals placed on it and of the main it follows — on a beat of
|
|
1903
|
+
* their own (`conversation.sync`): per conversation, its row and the turns after the seq the organizer last said it
|
|
1904
|
+
* holds, and the tool calls it sent open that settled since — bounded per message and per beat. The organizer keeps them
|
|
1905
|
+
* with the worker's Mac in the row, under the WORKER's ids (a hash of the worker's Mac basis: checked, never recomputed),
|
|
1906
|
+
* and answers the seq it holds of each: the worker's cursor. A worker asks the organizer for a conversation it does not
|
|
1907
|
+
* hold (`conversation.read`): a list, a handoff or a page of turns, bounded to one line of the stream.
|
|
1908
|
+
*
|
|
1909
|
+
* Both bodies carry their own `v: 1` and `kind`, as `store.call` does. An organizer of an older LensMCP refuses them —
|
|
1910
|
+
* `unknown-type` (it knows no such message), `not-handled` (it knows the type, its slice is not built) — and the worker
|
|
1911
|
+
* stops sending them until its next connection: never more than once a connection, so the channel's strikes (twenty
|
|
1912
|
+
* refusals in a minute close it) are never reached. Nothing here names a folder the other side acts on: a row's checkout
|
|
1913
|
+
* and cwd are the words the worker's store holds, shown, never opened.
|
|
1914
|
+
*/
|
|
1915
|
+
export declare const CONVERSATION_PEER_LIMITS: {
|
|
1916
|
+
/** One `conversation.sync`, or one `conversation.read`'s answer, encoded: a line of the control stream with room for its envelope. */
|
|
1917
|
+
readonly messageBytes: number;
|
|
1918
|
+
/** Conversations one sync carries, and turns of one conversation in it. */
|
|
1919
|
+
readonly conversations: 32;
|
|
1920
|
+
readonly turns: 500;
|
|
1921
|
+
/** Tool calls sent with no outcome yet, settled by a later sync: per conversation. */
|
|
1922
|
+
readonly settles: 64;
|
|
1923
|
+
/** One turn, encoded, at most: a longer one is cut to it (`cut`). */
|
|
1924
|
+
readonly turnBytes: number;
|
|
1925
|
+
/** A tool call's target as it is sent (a store keeps whole commands). */
|
|
1926
|
+
readonly targetChars: 4096;
|
|
1927
|
+
/** What one beat sends at most: bytes over its syncs, and conversations. */
|
|
1928
|
+
readonly beatBytes: number;
|
|
1929
|
+
readonly beatConversations: 64;
|
|
1930
|
+
/** A forwarded read's budget at most, in tokens: a 100,000-token handoff is no line of the stream. */
|
|
1931
|
+
readonly readTokens: 60000;
|
|
1932
|
+
};
|
|
1933
|
+
/** A conversation as the worker's store holds it: everything but its turns — no transcript path, no Mac (the organizer writes its own word for the Mac). */
|
|
1934
|
+
export interface ConversationSyncRow {
|
|
1935
|
+
id: string;
|
|
1936
|
+
client: DashClientSessionClient;
|
|
1937
|
+
nativeId: string;
|
|
1938
|
+
account: string;
|
|
1939
|
+
accountNick?: string;
|
|
1940
|
+
checkout: {
|
|
1941
|
+
root: string;
|
|
1942
|
+
branch?: string;
|
|
1943
|
+
key?: string;
|
|
1944
|
+
};
|
|
1945
|
+
cwd?: string;
|
|
1946
|
+
model?: string;
|
|
1947
|
+
startedAt: number;
|
|
1948
|
+
lastAt: number;
|
|
1949
|
+
state: DashConversationState;
|
|
1950
|
+
kind?: DashClientSessionKind;
|
|
1951
|
+
sessionId?: string;
|
|
1952
|
+
launchId?: string;
|
|
1953
|
+
role?: string;
|
|
1954
|
+
goalId?: string;
|
|
1955
|
+
goalTitle?: string;
|
|
1956
|
+
taskId?: string;
|
|
1957
|
+
/** The conversation it continues (it started from that one's handoff) — an organizer's conversation, often. */
|
|
1958
|
+
continues?: string;
|
|
1959
|
+
}
|
|
1960
|
+
/** A tool call sent with no outcome, as it ended: settled by its seq. */
|
|
1961
|
+
export interface ConversationSyncSettle {
|
|
1962
|
+
seq: number;
|
|
1963
|
+
outcome: 'ok' | 'error';
|
|
1964
|
+
output?: string;
|
|
1965
|
+
}
|
|
1966
|
+
/** One conversation of a sync: its row, its turns from `turns[0].seq` (consecutive), the calls it settled. */
|
|
1967
|
+
export interface ConversationSyncEntry {
|
|
1968
|
+
row: ConversationSyncRow;
|
|
1969
|
+
turns: DashConversationTurn[];
|
|
1970
|
+
settles?: ConversationSyncSettle[];
|
|
1971
|
+
/** The worker read it again from its first turn (its transcript was rewritten shorter): the organizer drops what it held first. */
|
|
1972
|
+
rewound?: true;
|
|
1973
|
+
}
|
|
1974
|
+
/** `conversation.sync` (worker → organizer) — slice CV5. Answered by a {@link ConversationSyncAnswer}. */
|
|
1975
|
+
export interface ConversationSync {
|
|
1976
|
+
v: 1;
|
|
1977
|
+
kind: 'conversation.sync';
|
|
1978
|
+
/** The organizer's repository, as its stores name it (`repoId`): one the organizer placed a goal of, or sends main of, on this worker. */
|
|
1979
|
+
repository: string;
|
|
1980
|
+
/** The basis the worker's store names its conversation ids by (`conversationIdOf`): kept in each row's Mac, never recomputed. */
|
|
1981
|
+
macBasis: string;
|
|
1982
|
+
conversations: ConversationSyncEntry[];
|
|
1983
|
+
}
|
|
1984
|
+
/** What the organizer holds of each conversation now — the newest seq, the worker's cursor — or why it took none of it. */
|
|
1985
|
+
export interface ConversationSyncAnswer {
|
|
1986
|
+
v: 1;
|
|
1987
|
+
held: Array<{
|
|
1988
|
+
id: string;
|
|
1989
|
+
seq: number;
|
|
1990
|
+
refused?: string;
|
|
1991
|
+
}>;
|
|
1992
|
+
}
|
|
1993
|
+
/** What a worker asks of the organizer's conversations: a list (`conversation_list`), or one (`conversation_get`). */
|
|
1994
|
+
export type ConversationReadAsk = {
|
|
1995
|
+
what: 'list';
|
|
1996
|
+
query: ConversationListQuery;
|
|
1997
|
+
} | {
|
|
1998
|
+
what: 'get';
|
|
1999
|
+
id: string;
|
|
2000
|
+
part: ConversationGetPart;
|
|
2001
|
+
maxTokens?: number;
|
|
2002
|
+
before?: number;
|
|
2003
|
+
};
|
|
2004
|
+
/** `conversation.read` (worker → organizer) — slice CV5: a read of the organizer's store for the repository. */
|
|
2005
|
+
export interface ConversationRead {
|
|
2006
|
+
v: 1;
|
|
2007
|
+
kind: 'conversation.read';
|
|
2008
|
+
repository: string;
|
|
2009
|
+
ask: ConversationReadAsk;
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* The organizer's answer: who answered, whether it holds what was asked, and the answer — `list`, `handoff` or `page`,
|
|
2013
|
+
* each as the store answers it, a conversation's `mac.here` said for the WORKER (true: one of the worker's own).
|
|
2014
|
+
*/
|
|
2015
|
+
export interface ConversationReadAnswer {
|
|
2016
|
+
v: 1;
|
|
2017
|
+
from: {
|
|
2018
|
+
name: string;
|
|
2019
|
+
fingerprint?: string;
|
|
2020
|
+
};
|
|
2021
|
+
found: boolean;
|
|
2022
|
+
why?: string;
|
|
2023
|
+
list?: DashConversationsAnswer;
|
|
2024
|
+
handoff?: ConversationHandoff;
|
|
2025
|
+
page?: ConversationTurnsPage;
|
|
2026
|
+
}
|
|
2027
|
+
/** The schemas of slice CV5's messages, strict: what the hub's handlers are registered with, and what the worker checks before it sends. */
|
|
2028
|
+
export declare const CONVERSATION_PEER_SCHEMAS: {
|
|
2029
|
+
readonly 'conversation.sync': z.ZodObject<{
|
|
2030
|
+
v: z.ZodLiteral<1>;
|
|
2031
|
+
kind: z.ZodLiteral<"conversation.sync">;
|
|
2032
|
+
repository: z.ZodString;
|
|
2033
|
+
macBasis: z.ZodString;
|
|
2034
|
+
conversations: z.ZodArray<z.ZodObject<{
|
|
2035
|
+
row: z.ZodObject<{
|
|
2036
|
+
id: z.ZodString;
|
|
2037
|
+
client: z.ZodEnum<{
|
|
2038
|
+
claude: "claude";
|
|
2039
|
+
codex: "codex";
|
|
2040
|
+
}>;
|
|
2041
|
+
nativeId: z.ZodString;
|
|
2042
|
+
account: z.ZodString;
|
|
2043
|
+
accountNick: z.ZodOptional<z.ZodString>;
|
|
2044
|
+
checkout: z.ZodObject<{
|
|
2045
|
+
root: z.ZodString;
|
|
2046
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
2047
|
+
key: z.ZodOptional<z.ZodString>;
|
|
2048
|
+
}, z.core.$strict>;
|
|
2049
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
2050
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2051
|
+
startedAt: z.ZodNumber;
|
|
2052
|
+
lastAt: z.ZodNumber;
|
|
2053
|
+
state: z.ZodEnum<{
|
|
2054
|
+
running: "running";
|
|
2055
|
+
ended: "ended";
|
|
2056
|
+
kept: "kept";
|
|
2057
|
+
}>;
|
|
2058
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
2059
|
+
person: "person";
|
|
2060
|
+
team: "team";
|
|
2061
|
+
outside: "outside";
|
|
2062
|
+
}>>;
|
|
2063
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2064
|
+
launchId: z.ZodOptional<z.ZodString>;
|
|
2065
|
+
role: z.ZodOptional<z.ZodString>;
|
|
2066
|
+
goalId: z.ZodOptional<z.ZodString>;
|
|
2067
|
+
goalTitle: z.ZodOptional<z.ZodString>;
|
|
2068
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
2069
|
+
continues: z.ZodOptional<z.ZodString>;
|
|
2070
|
+
}, z.core.$strict>;
|
|
2071
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
2072
|
+
seq: z.ZodNumber;
|
|
2073
|
+
at: z.ZodOptional<z.ZodNumber>;
|
|
2074
|
+
kind: z.ZodEnum<{
|
|
2075
|
+
prompt: "prompt";
|
|
2076
|
+
reply: "reply";
|
|
2077
|
+
tool: "tool";
|
|
2078
|
+
compaction: "compaction";
|
|
2079
|
+
subagent: "subagent";
|
|
2080
|
+
}>;
|
|
2081
|
+
text: z.ZodString;
|
|
2082
|
+
cut: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2083
|
+
tool: z.ZodOptional<z.ZodObject<{
|
|
2084
|
+
name: z.ZodString;
|
|
2085
|
+
target: z.ZodOptional<z.ZodString>;
|
|
2086
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
2087
|
+
ok: "ok";
|
|
2088
|
+
error: "error";
|
|
2089
|
+
}>>;
|
|
2090
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2091
|
+
}, z.core.$strict>>;
|
|
2092
|
+
files: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2093
|
+
}, z.core.$strict>>;
|
|
2094
|
+
settles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2095
|
+
seq: z.ZodNumber;
|
|
2096
|
+
outcome: z.ZodEnum<{
|
|
2097
|
+
ok: "ok";
|
|
2098
|
+
error: "error";
|
|
2099
|
+
}>;
|
|
2100
|
+
output: z.ZodOptional<z.ZodString>;
|
|
2101
|
+
}, z.core.$strict>>>;
|
|
2102
|
+
rewound: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2103
|
+
}, z.core.$strict>>;
|
|
2104
|
+
}, z.core.$strict>;
|
|
2105
|
+
readonly 'conversation.read': z.ZodObject<{
|
|
2106
|
+
v: z.ZodLiteral<1>;
|
|
2107
|
+
kind: z.ZodLiteral<"conversation.read">;
|
|
2108
|
+
repository: z.ZodString;
|
|
2109
|
+
ask: z.ZodType<ConversationReadAsk, unknown, z.core.$ZodTypeInternals<ConversationReadAsk, unknown>>;
|
|
2110
|
+
}, z.core.$strict>;
|
|
2111
|
+
};
|
|
2112
|
+
/** The answers, as the worker reads its `ack`'s result. A read's answer is checked here for its frame; the tool's own output schema reads the rest. */
|
|
2113
|
+
export declare const CONVERSATION_PEER_ANSWER_SCHEMAS: {
|
|
2114
|
+
readonly 'conversation.sync': z.ZodObject<{
|
|
2115
|
+
v: z.ZodLiteral<1>;
|
|
2116
|
+
held: z.ZodArray<z.ZodObject<{
|
|
2117
|
+
id: z.ZodString;
|
|
2118
|
+
seq: z.ZodNumber;
|
|
2119
|
+
refused: z.ZodOptional<z.ZodString>;
|
|
2120
|
+
}, z.core.$strict>>;
|
|
2121
|
+
}, z.core.$strict>;
|
|
2122
|
+
readonly 'conversation.read': z.ZodObject<{
|
|
2123
|
+
v: z.ZodLiteral<1>;
|
|
2124
|
+
from: z.ZodObject<{
|
|
2125
|
+
name: z.ZodString;
|
|
2126
|
+
fingerprint: z.ZodOptional<z.ZodString>;
|
|
2127
|
+
}, z.core.$strict>;
|
|
2128
|
+
found: z.ZodBoolean;
|
|
2129
|
+
why: z.ZodOptional<z.ZodString>;
|
|
2130
|
+
list: z.ZodOptional<z.ZodObject<{
|
|
2131
|
+
conversations: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2132
|
+
more: z.ZodBoolean;
|
|
2133
|
+
}, z.core.$loose>>;
|
|
2134
|
+
handoff: z.ZodOptional<z.ZodObject<{
|
|
2135
|
+
conversation: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2136
|
+
turns: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2137
|
+
more: z.ZodBoolean;
|
|
2138
|
+
next: z.ZodString;
|
|
2139
|
+
}, z.core.$loose>>;
|
|
2140
|
+
page: z.ZodOptional<z.ZodObject<{
|
|
2141
|
+
conversation: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2142
|
+
turns: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2143
|
+
more: z.ZodBoolean;
|
|
2144
|
+
}, z.core.$loose>>;
|
|
2145
|
+
}, z.core.$strict>;
|
|
2146
|
+
};
|
package/lib/peers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var W=Object.defineProperty;var _=(t,a)=>W(t,"name",{value:a,configurable:!0});var G=Object.defineProperty,s=_((t,a)=>G(t,"name",{value:a,configurable:!0}),"r");import{z as e}from"zod";import{RUN_ID_PATTERN as I}from"./docker-jobs.js";import{REMOTE_DASHBOARD_BASE_PATTERN as U,REMOTE_INSTANCE_ID_PATTERN as S,REMOTE_INSTANCE_NAME_PREFIX as K}from"./remote-instances.js";export const PEER_PROTOCOL="peer/v1",PEER_PORT=7466,PEER_TIMING={pingMs:5e3,lostMs:45e3,windowMs:10*6e4,approveMs:10*6e4,capacityMs:3e4},PAIRING_CODE={length:10,tries:5},CROCKFORD_ALPHABET="0123456789ABCDEFGHJKMNPQRSTVWXYZ",PEER_PATHS={pair:"/peer/v1/pair",control:"/peer/v1/control",runs:"/peer/v1/runs/",bundles:"/peer/v1/bundles/",sent:"/peer/v1/sent/",tunnel:"/peer/v1/tunnel/"},RUN_UPLOAD_KINDS=["log","samples","events","artifacts"],RUN_UPLOAD_RANGE={from:"x-lensmcp-from",to:"x-lensmcp-to"},PEER_FILES={dir:"peers",key:"identity.key",cert:"identity.crt",window:"window.json",workers:"workers.json",organizer:"organizer.json",hub:"hub.json",hubLock:"hub.lock",hubLog:"hub.log",runs:"runs",instances:"instances"},FINGERPRINT_PATTERN=/^[0-9a-f]{64}$/,REMOTE_RUN_LOST="lost",PEER_MESSAGE_ID=/^[A-Za-z0-9_-]{1,64}$/,TO_WORKER=["job.offer","job.cancel","bundle.ready","tunnel.open","tunnel.close","launch.start","launch.stop","store.reply","version.install","main.moved","instance.tunnel.open","goal.place","goal.changes","goal.update"],TO_ORGANIZER=["hello","capacity","job.state","job.stage","job.done","bundle.sent","launch.state","launch.tail","store.call","version.state","forget","main.state","instance.state","store.read","goal.sent"],EITHER_WAY=["ping"],PEER_REPLIES=["ack","error","pong"],PEER_MESSAGE_SLICE={hello:"D12 (versions: D13, capacity: D14)",ping:"D12",pong:"D12",ack:"D12",error:"D12",forget:"D11",capacity:"D14","job.offer":"D14","job.cancel":"D14/D18","job.state":"D14/D16","job.stage":"D16","job.done":"D16","bundle.ready":"D15","bundle.sent":"D34 (goal branches: D30)","tunnel.open":"D17","tunnel.close":"D17","launch.start":"D29","launch.stop":"D29","launch.state":"D29","launch.tail":"D29","store.call":"D27/D28","store.reply":"D27/D28","version.install":"D13","version.state":"D13","main.moved":"D34","main.state":"D34","instance.tunnel.open":"D35","instance.state":"D35 (sent by D30)","store.read":"D32","goal.place":"D30","goal.sent":"D30","goal.changes":"D30","goal.update":"D30"};const h=s((t,a)=>t.includes(a),"has");export const isPeerMessageType=s(t=>Object.prototype.hasOwnProperty.call(PEER_MESSAGE_SLICE,t),"isPeerMessageType");export function peerMaySend(t,a){return h(EITHER_WAY,a)||h(PEER_REPLIES,a)?!0:h(t==="organizer"?TO_WORKER:TO_ORGANIZER,a)}_(peerMaySend,"peerMaySend"),s(peerMaySend,"peerMaySend");export const isPeerReply=s(t=>h(PEER_REPLIES,t),"isPeerReply");const l=/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]*$/u,g=s(t=>e.string().min(1).max(t).regex(l),"shownText"),z=e.string().regex(/^[A-Za-z0-9_-]{43}$/),D=e.string().regex(/^[0-9a-f]{64}$/),r=e.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),F=e.tuple([e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/),e.string().regex(/^[a-z]{3,8}$/)]),n=e.number().int().nonnegative();export const PeerEnvelopeSchema=e.strictObject({v:e.literal(1),id:e.string().regex(PEER_MESSAGE_ID),replyTo:e.string().regex(PEER_MESSAGE_ID).optional(),type:e.string().min(1).max(40),body:e.record(e.string(),e.unknown())});const Y=["unknown-type","wrong-direction","bad-message","hello-first","not-handled","too-large","busy","refused","timeout","lost","internal","no-window","window-used","window-closed","wrong-code","protocol"];export const PeerErrorBodySchema=e.strictObject({code:e.enum(Y),message:e.string().max(500),triesLeft:e.number().int().min(0).max(PAIRING_CODE.tries).optional(),retryAfterMs:e.number().int().min(0).max(36e5).optional()});const c=e.string().regex(I);export const WorkerAdvertSchema=e.record(e.string(),e.unknown()).superRefine((t,a)=>{const x=t.runs;x!==void 0&&(!Array.isArray(x)||x.length>256||!x.every(v=>typeof v=="string"&&I.test(v)))&&a.addIssue({code:"custom",message:"runs: at most 256 run ids"})}),PEER_BODY_SCHEMAS={hello:e.strictObject({protocol:e.literal(PEER_PROTOCOL),lensmcp:r,follow:e.boolean().optional(),store:e.array(r).max(64).optional(),capacity:WorkerAdvertSchema.optional()}),ping:e.strictObject({at:n}),pong:e.strictObject({at:n}),ack:e.strictObject({result:e.unknown().optional()}),error:PeerErrorBodySchema,forget:e.strictObject({why:e.string().max(200).regex(l).optional()})},PeerWelcomeSchema=e.strictObject({protocol:e.literal(PEER_PROTOCOL),lensmcp:r,name:g(64),inStep:e.boolean().optional(),why:e.string().max(500).optional()}),PAIR_BODY_SCHEMAS={"pair.hello":e.strictObject({protocol:e.literal(PEER_PROTOCOL),nonce:z,name:g(64),model:g(40),lensmcp:r}),"pair.resume":e.strictObject({protocol:e.literal(PEER_PROTOCOL)}),"pair.challenge":e.strictObject({nonce:z}),"pair.proof":e.strictObject({proof:D}),"pair.accepted":e.strictObject({proof:D,name:g(64),model:g(40),words:F,approveBy:n}),"pair.approved":e.strictObject({at:n}),"pair.declined":e.strictObject({why:e.string().max(500)}),error:PeerErrorBodySchema},MAIN_MIRROR={branch:"main",quietMs:10*6e4,snapshotEveryMs:60*6e4,maxSendBytes:512*1024*1024,maxWipBytes:256*1024*1024,maxHaves:16},MAIN_BRING_IN=["in-main","brought-in","waiting","not-ff","refused"],MAIN_FOLLOW_STATES=["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"];const o=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),f=e.string().regex(/^[0-9a-f]{16,64}$/),$=e.string().regex(/^[0-9a-f]{64}$/),M=e.string().regex(/^[0-9a-f]{16}$/),d=e.number().int().min(0).max(1e7),O=e.string().min(1).max(250).regex(/^[A-Za-z0-9._/-]+$/),y=e.string().max(1e3),k=e.strictObject({state:e.enum(["in-main","brought-in","waiting","not-ff","refused"]),count:d,sha:o.optional(),main:o.optional(),why:y,at:n}),q=e.strictObject({outcome:e.enum(["merged","fast-forward","current","conflicts","waiting","refused"]),at:n,why:y,sha:o.optional(),conflicts:e.array(e.string().min(1).max(4096)).max(200).optional(),asked:e.array(e.strictObject({who:e.enum(["person","manager"]),goal:e.string().max(64).optional(),to:e.string().max(200).optional()})).max(20).optional()}),P=e.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":e.strictObject({bundleId:M,repository:f,refs:e.array(O).length(1),size:e.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:$}),"main.moved":e.strictObject({repository:f,branch:O,sha:o,bundle:e.strictObject({id:M,size:e.number().int().positive(),sha256:$}),verdict:k.optional(),at:n}),"main.state":e.strictObject({repository:f,branch:O,head:o.optional(),organizerHead:o.optional(),haves:e.array(o).max(MAIN_MIRROR.maxHaves),notSent:d,toPull:d,uncommitted:e.strictObject({files:d,changedAt:n.optional()}),snapshot:e.strictObject({sha:o,at:n,files:d,sent:e.boolean()}).optional(),follow:P,update:q.optional(),at:n})},MAIN_MIRROR_ANSWER_SCHEMAS={"bundle.sent":e.strictObject({took:e.boolean(),ref:O,sha:o.optional(),code:e.string().max(40).optional(),why:y.optional(),verdict:k.optional()}),"main.moved":e.strictObject({took:e.boolean(),needWhole:e.boolean().optional(),why:y.optional(),follow:P.optional(),head:o.optional()})};const X=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),w=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),T=e.string().regex(/^[0-9a-f]{16,64}$/),u=e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),C=s(t=>e.string().min(1).max(t).regex(l),"sentence"),p=e.record(e.string(),e.unknown()),J=e.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,99}$/),i=e.strictObject({lensmcp:r,protocol:e.string().regex(/^peer\/v[1-9]\d{0,3}$/)});export const PEER_WORK_SCHEMAS={capacity:WorkerAdvertSchema,"job.offer":e.strictObject({runId:c,job:X,candidate:w,repository:T,lane:e.enum(["light","heavy"]).optional(),kind:e.enum(["compose","testcontainers","playwright"]).optional(),hostMb:e.number().int().min(0).max(1024*1024).optional(),vmMb:e.number().int().min(0).max(1024*1024).optional(),proof:e.boolean().optional(),timeoutMinutes:e.number().positive().max(360).optional(),onLinkLoss:e.union([e.literal("cancel"),e.strictObject({continueMinutes:e.number().int().min(1).max(360)})]).optional(),secrets:e.record(J,e.string().min(1).max(8192)).refine(t=>Object.keys(t).length<=16,"at most 16 secrets").optional(),origin:e.string().max(300).regex(/^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$/).optional()}),"job.cancel":e.strictObject({runId:c,why:C(300)}),"job.state":e.strictObject({runId:c,at:n,started:e.literal(!0).optional(),state:e.enum(["queued","running"]).optional(),note:e.string().max(1e3).optional(),queue:p.optional(),docker:p.optional(),edgePort:e.number().int().min(1024).max(65535).optional()}),"job.stage":e.strictObject({runId:c,stage:C(120),at:n}),"job.done":e.strictObject({runId:c,at:n,state:e.enum(["passed","failed","errored","cancelled","timeout"]),note:e.string().max(1e3).optional(),step:p.optional(),docker:p.optional(),givenBack:e.strictObject({why:e.string().min(1).max(1e3)}).optional(),refused:e.strictObject({why:e.string().min(1).max(1e3)}).optional(),proof:p.optional()}),"bundle.ready":e.strictObject({runId:c.optional(),bundleId:u,repository:T,heads:e.array(w).min(1).max(16),basis:e.array(w).max(256).optional(),size:e.number().int().positive().max(64*1024*1024*1024),sha256:e.string().regex(/^[0-9a-f]{64}$/),shipment:p.optional(),blobs:e.record(e.string().regex(/^[0-9a-f]{64}$/),u).refine(t=>Object.keys(t).length<=101,"at most 101 blobs").optional()}),"tunnel.open":e.strictObject({tunnelId:u,runId:c,port:e.number().int().min(1).max(65535).optional()}),"tunnel.close":e.strictObject({tunnelId:u,why:e.string().max(300).optional()}),"version.install":e.strictObject({version:r,from:e.enum(["registry","organizer"]),tarball:e.strictObject({bundleId:u,sha256:e.string().regex(/^[0-9a-f]{64}$/),size:e.number().int().positive().max(8*1024*1024*1024)}).optional()}),"version.state":e.discriminatedUnion("state",[e.strictObject({state:e.literal("in-step"),worker:i,organizer:i}),e.strictObject({state:e.literal("installing"),worker:i,organizer:i,from:e.enum(["registry","organizer"]),since:n}),e.strictObject({state:e.literal("waiting-for-person"),worker:i,organizer:i,stored:e.boolean()}),e.strictObject({state:e.literal("out-of-step"),worker:i,organizer:i,why:e.object({kind:e.enum(["protocol","version","installed","restarting","install-failed","restart-failed","no-store"])}).catchall(e.union([e.string().max(600),e.number(),e.boolean()]))})])},STORE_CALL_LIMITS={args:16,argsBytes:256*1024,answerBytes:480*1024},PEER_LAUNCH_KEY_PATTERN=/^[A-Za-z0-9_-]{43}$/;const N=e.strictObject({added:e.number().int().nonnegative().nullable(),removed:e.number().int().nonnegative().nullable()});export const StoreCallSchema=e.strictObject({v:e.literal(1),kind:e.literal("store.call"),id:e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),method:e.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:e.array(e.unknown()).max(STORE_CALL_LIMITS.args),launchKey:e.string().min(16).max(512),observe:e.strictObject({intervalMs:e.number().int().min(0).max(864e5).optional(),snapshot:e.strictObject({branch:e.string().max(300).nullable(),head:e.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).nullable(),files:e.array(e.strictObject({path:e.string().min(1).max(4096),from:e.string().max(4096).optional(),status:e.string().max(2),staged:N.optional(),unstaged:N.optional()})).max(1e3),truncated:e.boolean()}).optional(),failed:e.literal(!0).optional()}).optional()}),StoreReplySchema=e.strictObject({v:e.literal(1),kind:e.literal("store.reply"),id:e.string().max(100),wrote:e.boolean(),result:e.unknown().optional(),error:e.strictObject({name:e.enum(["CoordinationError","CapacityRefusal","CoordinationBusyError","StoreCallRefused","Error"]),message:e.string().max(4e3),room:e.record(e.string(),e.unknown()).optional(),step:e.enum(["open","write","commit","read"]).optional(),waitedMs:e.number().nonnegative().optional(),tries:e.number().int().nonnegative().optional(),wrote:e.boolean().optional(),where:e.string().max(300).optional(),wal:e.boolean().optional()}).optional()}),REMOTE_INSTANCE_BODY_SCHEMAS={"instance.tunnel.open":e.strictObject({tunnelId:e.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),instanceId:e.string().regex(S)}),"instance.state":e.strictObject({instanceId:e.string().regex(S),state:e.enum(["up","gone"]),apex:e.string().max(253).regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.localhost$/).startsWith(K).optional(),dashboardBase:e.string().regex(U).optional(),at:n,why:e.string().max(500).regex(l).optional()})},PEER_LAUNCH_LIMITS={promptChars:64*1024,roleTextChars:64*1024,maxMinutes:720,tailLines:40,tailLineChars:400},PEER_LAUNCH_ID=/^ln-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const b=e.string().regex(PEER_LAUNCH_ID),Q=e.string().regex(PEER_LAUNCH_KEY_PATTERN),L=e.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),V=e.string().regex(/^[a-z][a-z0-9-]{0,39}$/),Z=s(t=>e.string().min(1).max(t).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/),"clientWord"),A=e.string().min(2).max(1024).regex(/^\/[^\0\r\n]*$/).refine(t=>!t.split("/").includes(".."),"no .. part"),R=e.string().min(1).max(100).regex(/^[A-Za-z0-9._:-]+$/);export const PEER_LAUNCH_SCHEMAS={"launch.start":e.strictObject({launchId:b,repository:f,goal:R,task:L.optional(),role:V,by:R,client:e.enum(["claude","codex"]),model:Z(80).optional(),effort:Z(40).optional(),worktree:A.optional(),placedGoal:e.literal(!0).optional(),prompt:e.string().min(1).max(PEER_LAUNCH_LIMITS.promptChars),roleText:e.string().max(PEER_LAUNCH_LIMITS.roleTextChars).optional(),name:e.string().min(1).max(80).regex(l).optional(),maxMinutes:e.number().int().min(1).max(PEER_LAUNCH_LIMITS.maxMinutes),account:e.string().regex(/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/).optional(),launchKey:Q,lensmcp:r,resume:e.strictObject({launchId:b,threadId:L,from:A.optional()}).optional(),capKind:e.enum(["writers","checkers"]).optional()}).refine(t=>t.worktree===void 0!=(t.placedGoal===void 0),"a launch names its worktree, or that its goal is placed there \u2014 exactly one"),"launch.stop":e.strictObject({launchId:b,why:e.string().max(300).regex(l).optional()}),"launch.state":e.strictObject({launchId:b,state:e.enum(["running","exited","stopped","failed"]),at:n,pid:e.number().int().min(0).max(99999999).optional(),exitCode:e.number().int().min(-1).max(1024).optional(),endedAt:n.optional(),threadId:R.optional(),ended:e.strictObject({quota:e.strictObject({client:e.enum(["claude","codex"]),why:e.string().min(1).max(300),until:n,firstTurn:e.boolean(),account:e.string().max(40).optional()}).optional(),context:e.string().min(1).max(600).optional()}).optional()}),"launch.tail":e.strictObject({launchId:b,lines:e.array(e.string().max(PEER_LAUNCH_LIMITS.tailLineChars+8)).max(PEER_LAUNCH_LIMITS.tailLines),at:n})},LaunchStartedSchema=e.strictObject({started:e.literal(!0),pid:e.number().int().min(2).max(99999999),worktree:A,branch:e.string().max(250).optional(),startedAt:n,deadline:n,threadId:e.string().max(200).optional(),lensmcp:r}),STORE_READ_LIMITS={calls:24,argsBytes:64*1024,answerBytes:STORE_CALL_LIMITS.answerBytes},StoreReadSchema=e.strictObject({v:e.literal(1),kind:e.literal("store.read"),id:e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),repoId:e.string().regex(/^[0-9a-f]{16,64}$/),calls:e.array(e.strictObject({method:e.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:e.array(e.unknown()).max(STORE_CALL_LIMITS.args)})).min(1).max(STORE_READ_LIMITS.calls)}),GOAL_ON_WORKER={maxSendBytes:512*1024*1024,maxChangesBytes:400*1024,branchPrefix:"lensmcp/g-"};const j=e.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),B=e.strictObject({id:e.string().regex(/^[0-9a-f]{16}$/),size:e.number().int().positive().max(64*1024*1024*1024),sha256:e.string().regex(/^[0-9a-f]{64}$/)}),ee=e.string().min(1).max(200).regex(/^lensmcp\/g-[a-z0-9-]{1,30}$/),m=e.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),H=e.string().regex(/^[0-9a-f]{16,64}$/),E=e.string().max(1e3);export const GOAL_PEER_SCHEMAS={"goal.place":e.strictObject({goal:j,title:e.string().min(1).max(300).regex(l),repository:H,worktreeId:e.string().regex(/^[0-9a-f]{24}$/),name:e.string().regex(/^g-[a-z0-9](?:[a-z0-9-]{0,17}[a-z0-9])?$/),branch:ee,base:m,bundle:B,services:e.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":e.strictObject({bundleId:e.string().regex(/^[0-9a-f]{16}$/),repository:H,goal:j,ref:e.string().min(1).max(250).regex(/^heads\/lensmcp\/g-[a-z0-9-]{1,30}$/),size:e.number().int().positive().max(GOAL_ON_WORKER.maxSendBytes),sha256:e.string().regex(/^[0-9a-f]{64}$/)}),"goal.changes":e.strictObject({goal:j,what:e.enum(["row","files","diff","commits","commit","against"]),path:e.string().min(1).max(4096).optional(),sha:m.optional(),full:e.boolean().optional(),againstMain:e.boolean().optional()}),"goal.update":e.strictObject({goal:j,main:e.strictObject({branch:e.string().min(1).max(200).regex(/^[A-Za-z0-9._/-]+$/),sha:m,bundle:B}),at:n})},GOAL_PEER_ANSWER_SCHEMAS={"goal.place":e.strictObject({state:e.enum(["ready","creating","failed"]),head:m.optional(),onDemand:e.boolean().optional(),needWhole:e.boolean().optional(),why:E.optional()}),"goal.sent":e.strictObject({took:e.boolean(),ref:e.string().max(250),sha:m.optional(),mirror:e.enum(["created","fast-forward","current","not-ff","checked-out"]).optional(),told:e.string().max(200).optional(),code:e.string().max(40).optional(),why:E.optional()}),"goal.changes":e.strictObject({ok:e.boolean(),value:e.unknown().optional(),status:e.number().int().min(100).max(599).optional(),why:E.optional(),shortened:e.boolean().optional()}),"goal.update":e.strictObject({outcome:e.enum(["current","merged","asked","conflicts","refused"]),why:E,sha:m.optional(),behind:e.number().int().min(0).max(1e7).optional(),dirty:e.number().int().min(0).max(1e7).optional(),conflicts:e.array(e.string().min(1).max(4096)).max(200).optional(),needWhole:e.boolean().optional()})};
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var w=(e,o)=>Y(e,"name",{value:o,configurable:!0});var X=Object.defineProperty,i=w((e,o)=>X(e,"name",{value:o,configurable:!0}),"i");import{z as t}from"zod";import{RUN_ID_PATTERN as T}from"./docker-jobs.js";import{CONVERSATION_ID as J,CONVERSATION_LIST_MAX as D,CONVERSATION_TOOL_OUTPUT_CHARS as M,CONVERSATION_TURN_CHARS as Q}from"./conversations.js";import{REMOTE_DASHBOARD_BASE_PATTERN as tt,REMOTE_INSTANCE_ID_PATTERN as N,REMOTE_INSTANCE_NAME_PREFIX as et}from"./remote-instances.js";export const PEER_PROTOCOL="peer/v1",PEER_PORT=7466,PEER_TIMING={pingMs:5e3,lostMs:45e3,windowMs:10*6e4,approveMs:10*6e4,capacityMs:3e4},PAIRING_CODE={length:10,tries:5},CROCKFORD_ALPHABET="0123456789ABCDEFGHJKMNPQRSTVWXYZ",PEER_PATHS={pair:"/peer/v1/pair",control:"/peer/v1/control",runs:"/peer/v1/runs/",bundles:"/peer/v1/bundles/",sent:"/peer/v1/sent/",tunnel:"/peer/v1/tunnel/"},RUN_UPLOAD_KINDS=["log","samples","events","artifacts"],RUN_UPLOAD_RANGE={from:"x-lensmcp-from",to:"x-lensmcp-to"},PEER_FILES={dir:"peers",key:"identity.key",cert:"identity.crt",window:"window.json",workers:"workers.json",organizer:"organizer.json",hub:"hub.json",hubLock:"hub.lock",hubLog:"hub.log",runs:"runs",instances:"instances"},FINGERPRINT_PATTERN=/^[0-9a-f]{64}$/,REMOTE_RUN_LOST="lost",PEER_MESSAGE_ID=/^[A-Za-z0-9_-]{1,64}$/,TO_WORKER=["job.offer","job.cancel","bundle.ready","tunnel.open","tunnel.close","launch.start","launch.stop","store.reply","version.install","main.moved","instance.tunnel.open","goal.place","goal.changes","goal.update"],TO_ORGANIZER=["hello","capacity","job.state","job.stage","job.done","bundle.sent","launch.state","launch.tail","store.call","version.state","forget","main.state","instance.state","store.read","goal.sent","conversation.sync","conversation.read"],EITHER_WAY=["ping"],PEER_REPLIES=["ack","error","pong"],PEER_MESSAGE_SLICE={hello:"D12 (versions: D13, capacity: D14)",ping:"D12",pong:"D12",ack:"D12",error:"D12",forget:"D11",capacity:"D14","job.offer":"D14","job.cancel":"D14/D18","job.state":"D14/D16","job.stage":"D16","job.done":"D16","bundle.ready":"D15","bundle.sent":"D34 (goal branches: D30)","tunnel.open":"D17","tunnel.close":"D17","launch.start":"D29","launch.stop":"D29","launch.state":"D29","launch.tail":"D29","store.call":"D27/D28","store.reply":"D27/D28","version.install":"D13","version.state":"D13","main.moved":"D34","main.state":"D34","instance.tunnel.open":"D35","instance.state":"D35 (sent by D30)","store.read":"D32","goal.place":"D30","goal.sent":"D30","goal.changes":"D30","goal.update":"D30","conversation.sync":"CV5","conversation.read":"CV5"};const f=i((e,o)=>e.includes(o),"has");export const isPeerMessageType=i(e=>Object.prototype.hasOwnProperty.call(PEER_MESSAGE_SLICE,e),"isPeerMessageType");export function peerMaySend(e,o){return f(EITHER_WAY,o)||f(PEER_REPLIES,o)?!0:f(e==="organizer"?TO_WORKER:TO_ORGANIZER,o)}w(peerMaySend,"peerMaySend"),i(peerMaySend,"peerMaySend");export const isPeerReply=i(e=>f(PEER_REPLIES,e),"isPeerReply");const s=/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]*$/u,d=i(e=>t.string().min(1).max(e).regex(s),"shownText"),$=t.string().regex(/^[A-Za-z0-9_-]{43}$/),C=t.string().regex(/^[0-9a-f]{64}$/),l=t.string().min(1).max(64).regex(/^[0-9A-Za-z.+_-]+$/),nt=t.tuple([t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/),t.string().regex(/^[a-z]{3,8}$/)]),n=t.number().int().nonnegative();export const PeerEnvelopeSchema=t.strictObject({v:t.literal(1),id:t.string().regex(PEER_MESSAGE_ID),replyTo:t.string().regex(PEER_MESSAGE_ID).optional(),type:t.string().min(1).max(40),body:t.record(t.string(),t.unknown())});const at=["unknown-type","wrong-direction","bad-message","hello-first","not-handled","too-large","busy","refused","timeout","lost","internal","no-window","window-used","window-closed","wrong-code","protocol"];export const PeerErrorBodySchema=t.strictObject({code:t.enum(at),message:t.string().max(500),triesLeft:t.number().int().min(0).max(PAIRING_CODE.tries).optional(),retryAfterMs:t.number().int().min(0).max(36e5).optional()});const p=t.string().regex(T);export const WorkerAdvertSchema=t.record(t.string(),t.unknown()).superRefine((e,o)=>{const O=e.runs;O!==void 0&&(!Array.isArray(O)||O.length>256||!O.every(z=>typeof z=="string"&&T.test(z)))&&o.addIssue({code:"custom",message:"runs: at most 256 run ids"})}),PEER_BODY_SCHEMAS={hello:t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,follow:t.boolean().optional(),store:t.array(l).max(64).optional(),capacity:WorkerAdvertSchema.optional()}),ping:t.strictObject({at:n}),pong:t.strictObject({at:n}),ack:t.strictObject({result:t.unknown().optional()}),error:PeerErrorBodySchema,forget:t.strictObject({why:t.string().max(200).regex(s).optional()})},PeerWelcomeSchema=t.strictObject({protocol:t.literal(PEER_PROTOCOL),lensmcp:l,name:d(64),inStep:t.boolean().optional(),why:t.string().max(500).optional()}),PAIR_BODY_SCHEMAS={"pair.hello":t.strictObject({protocol:t.literal(PEER_PROTOCOL),nonce:$,name:d(64),model:d(40),lensmcp:l}),"pair.resume":t.strictObject({protocol:t.literal(PEER_PROTOCOL)}),"pair.challenge":t.strictObject({nonce:$}),"pair.proof":t.strictObject({proof:C}),"pair.accepted":t.strictObject({proof:C,name:d(64),model:d(40),words:nt,approveBy:n}),"pair.approved":t.strictObject({at:n}),"pair.declined":t.strictObject({why:t.string().max(500)}),error:PeerErrorBodySchema},MAIN_MIRROR={branch:"main",quietMs:10*6e4,snapshotEveryMs:60*6e4,maxSendBytes:512*1024*1024,maxWipBytes:256*1024*1024,maxHaves:16},MAIN_BRING_IN=["in-main","brought-in","waiting","not-ff","refused"],MAIN_FOLLOW_STATES=["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"];const r=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),y=t.string().regex(/^[0-9a-f]{16,64}$/),P=t.string().regex(/^[0-9a-f]{64}$/),L=t.string().regex(/^[0-9a-f]{16}$/),u=t.number().int().min(0).max(1e7),j=t.string().min(1).max(250).regex(/^[A-Za-z0-9._/-]+$/),E=t.string().max(1e3),Z=t.strictObject({state:t.enum(["in-main","brought-in","waiting","not-ff","refused"]),count:u,sha:r.optional(),main:r.optional(),why:E,at:n}),ot=t.strictObject({outcome:t.enum(["merged","fast-forward","current","conflicts","waiting","refused"]),at:n,why:E,sha:r.optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),asked:t.array(t.strictObject({who:t.enum(["person","manager"]),goal:t.string().max(64).optional(),to:t.string().max(200).optional()})).max(20).optional()}),B=t.enum(["in-step","fast-forward","ahead","waiting","to-update","not-following","off-branch"]);export const MAIN_MIRROR_SCHEMAS={"bundle.sent":t.strictObject({bundleId:L,repository:y,refs:t.array(j).length(1),size:t.number().int().positive().max(MAIN_MIRROR.maxSendBytes),sha256:P}),"main.moved":t.strictObject({repository:y,branch:j,sha:r,bundle:t.strictObject({id:L,size:t.number().int().positive(),sha256:P}),verdict:Z.optional(),at:n}),"main.state":t.strictObject({repository:y,branch:j,head:r.optional(),organizerHead:r.optional(),haves:t.array(r).max(MAIN_MIRROR.maxHaves),notSent:u,toPull:u,uncommitted:t.strictObject({files:u,changedAt:n.optional()}),snapshot:t.strictObject({sha:r,at:n,files:u,sent:t.boolean()}).optional(),follow:B,update:ot.optional(),at:n})},MAIN_MIRROR_ANSWER_SCHEMAS={"bundle.sent":t.strictObject({took:t.boolean(),ref:j,sha:r.optional(),code:t.string().max(40).optional(),why:E.optional(),verdict:Z.optional()}),"main.moved":t.strictObject({took:t.boolean(),needWhole:t.boolean().optional(),why:E.optional(),follow:B.optional(),head:r.optional()})};const rt=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/),v=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),H=t.string().regex(/^[0-9a-f]{16,64}$/),b=t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),W=i(e=>t.string().min(1).max(e).regex(s),"sentence"),m=t.record(t.string(),t.unknown()),it=t.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,99}$/),c=t.strictObject({lensmcp:l,protocol:t.string().regex(/^peer\/v[1-9]\d{0,3}$/)});export const PEER_WORK_SCHEMAS={capacity:WorkerAdvertSchema,"job.offer":t.strictObject({runId:p,job:rt,candidate:v,repository:H,lane:t.enum(["light","heavy"]).optional(),kind:t.enum(["compose","testcontainers","playwright"]).optional(),hostMb:t.number().int().min(0).max(1024*1024).optional(),vmMb:t.number().int().min(0).max(1024*1024).optional(),proof:t.boolean().optional(),timeoutMinutes:t.number().positive().max(360).optional(),onLinkLoss:t.union([t.literal("cancel"),t.strictObject({continueMinutes:t.number().int().min(1).max(360)})]).optional(),secrets:t.record(it,t.string().min(1).max(8192)).refine(e=>Object.keys(e).length<=16,"at most 16 secrets").optional(),origin:t.string().max(300).regex(/^https?:\/\/[A-Za-z0-9.-]+(?::\d{1,5})?$/).optional()}),"job.cancel":t.strictObject({runId:p,why:W(300)}),"job.state":t.strictObject({runId:p,at:n,started:t.literal(!0).optional(),state:t.enum(["queued","running"]).optional(),note:t.string().max(1e3).optional(),queue:m.optional(),docker:m.optional(),edgePort:t.number().int().min(1024).max(65535).optional()}),"job.stage":t.strictObject({runId:p,stage:W(120),at:n}),"job.done":t.strictObject({runId:p,at:n,state:t.enum(["passed","failed","errored","cancelled","timeout"]),note:t.string().max(1e3).optional(),step:m.optional(),docker:m.optional(),givenBack:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),refused:t.strictObject({why:t.string().min(1).max(1e3)}).optional(),proof:m.optional()}),"bundle.ready":t.strictObject({runId:p.optional(),bundleId:b,repository:H,heads:t.array(v).min(1).max(16),basis:t.array(v).max(256).optional(),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/),shipment:m.optional(),blobs:t.record(t.string().regex(/^[0-9a-f]{64}$/),b).refine(e=>Object.keys(e).length<=101,"at most 101 blobs").optional()}),"tunnel.open":t.strictObject({tunnelId:b,runId:p,port:t.number().int().min(1).max(65535).optional()}),"tunnel.close":t.strictObject({tunnelId:b,why:t.string().max(300).optional()}),"version.install":t.strictObject({version:l,from:t.enum(["registry","organizer"]),tarball:t.strictObject({bundleId:b,sha256:t.string().regex(/^[0-9a-f]{64}$/),size:t.number().int().positive().max(8*1024*1024*1024)}).optional()}),"version.state":t.discriminatedUnion("state",[t.strictObject({state:t.literal("in-step"),worker:c,organizer:c}),t.strictObject({state:t.literal("installing"),worker:c,organizer:c,from:t.enum(["registry","organizer"]),since:n}),t.strictObject({state:t.literal("waiting-for-person"),worker:c,organizer:c,stored:t.boolean()}),t.strictObject({state:t.literal("out-of-step"),worker:c,organizer:c,why:t.object({kind:t.enum(["protocol","version","installed","restarting","install-failed","restart-failed","no-store"])}).catchall(t.union([t.string().max(600),t.number(),t.boolean()]))})])},STORE_CALL_LIMITS={args:16,argsBytes:256*1024,answerBytes:480*1024},PEER_LAUNCH_KEY_PATTERN=/^[A-Za-z0-9_-]{43}$/;const G=t.strictObject({added:t.number().int().nonnegative().nullable(),removed:t.number().int().nonnegative().nullable()});export const StoreCallSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.call"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args),launchKey:t.string().min(16).max(512),observe:t.strictObject({intervalMs:t.number().int().min(0).max(864e5).optional(),snapshot:t.strictObject({branch:t.string().max(300).nullable(),head:t.string().regex(/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/).nullable(),files:t.array(t.strictObject({path:t.string().min(1).max(4096),from:t.string().max(4096).optional(),status:t.string().max(2),staged:G.optional(),unstaged:G.optional()})).max(1e3),truncated:t.boolean()}).optional(),failed:t.literal(!0).optional()}).optional()}),StoreReplySchema=t.strictObject({v:t.literal(1),kind:t.literal("store.reply"),id:t.string().max(100),wrote:t.boolean(),result:t.unknown().optional(),error:t.strictObject({name:t.enum(["CoordinationError","CapacityRefusal","CoordinationBusyError","StoreCallRefused","Error"]),message:t.string().max(4e3),room:t.record(t.string(),t.unknown()).optional(),step:t.enum(["open","write","commit","read"]).optional(),waitedMs:t.number().nonnegative().optional(),tries:t.number().int().nonnegative().optional(),wrote:t.boolean().optional(),where:t.string().max(300).optional(),wal:t.boolean().optional()}).optional()}),REMOTE_INSTANCE_BODY_SCHEMAS={"instance.tunnel.open":t.strictObject({tunnelId:t.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{7,79}$/),instanceId:t.string().regex(N)}),"instance.state":t.strictObject({instanceId:t.string().regex(N),state:t.enum(["up","gone"]),apex:t.string().max(253).regex(/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.localhost$/).startsWith(et).optional(),dashboardBase:t.string().regex(tt).optional(),at:n,why:t.string().max(500).regex(s).optional()})},PEER_LAUNCH_LIMITS={promptChars:64*1024,roleTextChars:64*1024,maxMinutes:720,tailLines:40,tailLineChars:400},PEER_LAUNCH_ID=/^ln-[a-z0-9]{1,12}-[a-f0-9]{6}$/;const x=t.string().regex(PEER_LAUNCH_ID),st=t.string().regex(PEER_LAUNCH_KEY_PATTERN),U=t.string().regex(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i),lt=t.string().regex(/^[a-z][a-z0-9-]{0,39}$/),K=i(e=>t.string().min(1).max(e).regex(/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/),"clientWord"),R=t.string().min(2).max(1024).regex(/^\/[^\0\r\n]*$/).refine(e=>!e.split("/").includes(".."),"no .. part"),I=t.string().min(1).max(100).regex(/^[A-Za-z0-9._:-]+$/);export const PEER_LAUNCH_SCHEMAS={"launch.start":t.strictObject({launchId:x,repository:y,goal:I,task:U.optional(),role:lt,by:I,client:t.enum(["claude","codex"]),model:K(80).optional(),effort:K(40).optional(),worktree:R.optional(),placedGoal:t.literal(!0).optional(),prompt:t.string().min(1).max(PEER_LAUNCH_LIMITS.promptChars),roleText:t.string().max(PEER_LAUNCH_LIMITS.roleTextChars).optional(),name:t.string().min(1).max(80).regex(s).optional(),maxMinutes:t.number().int().min(1).max(PEER_LAUNCH_LIMITS.maxMinutes),account:t.string().regex(/^ac-[a-z0-9]{1,12}-[a-f0-9]{6}$/).optional(),launchKey:st,lensmcp:l,resume:t.strictObject({launchId:x,threadId:U,from:R.optional()}).optional(),capKind:t.enum(["writers","checkers"]).optional()}).refine(e=>e.worktree===void 0!=(e.placedGoal===void 0),"a launch names its worktree, or that its goal is placed there \u2014 exactly one"),"launch.stop":t.strictObject({launchId:x,why:t.string().max(300).regex(s).optional()}),"launch.state":t.strictObject({launchId:x,state:t.enum(["running","exited","stopped","failed"]),at:n,pid:t.number().int().min(0).max(99999999).optional(),exitCode:t.number().int().min(-1).max(1024).optional(),endedAt:n.optional(),threadId:I.optional(),ended:t.strictObject({quota:t.strictObject({client:t.enum(["claude","codex"]),why:t.string().min(1).max(300),until:n,firstTurn:t.boolean(),account:t.string().max(40).optional()}).optional(),context:t.string().min(1).max(600).optional()}).optional()}),"launch.tail":t.strictObject({launchId:x,lines:t.array(t.string().max(PEER_LAUNCH_LIMITS.tailLineChars+8)).max(PEER_LAUNCH_LIMITS.tailLines),at:n})},LaunchStartedSchema=t.strictObject({started:t.literal(!0),pid:t.number().int().min(2).max(99999999),worktree:R,branch:t.string().max(250).optional(),startedAt:n,deadline:n,threadId:t.string().max(200).optional(),lensmcp:l}),STORE_READ_LIMITS={calls:24,argsBytes:64*1024,answerBytes:STORE_CALL_LIMITS.answerBytes},StoreReadSchema=t.strictObject({v:t.literal(1),kind:t.literal("store.read"),id:t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),repoId:t.string().regex(/^[0-9a-f]{16,64}$/),calls:t.array(t.strictObject({method:t.string().regex(/^[A-Za-z][A-Za-z0-9]{0,79}$/),args:t.array(t.unknown()).max(STORE_CALL_LIMITS.args)})).min(1).max(STORE_READ_LIMITS.calls)}),GOAL_ON_WORKER={maxSendBytes:512*1024*1024,maxChangesBytes:400*1024,branchPrefix:"lensmcp/g-"};const _=t.string().regex(/^[A-Za-z0-9._:-]{1,100}$/),V=t.strictObject({id:t.string().regex(/^[0-9a-f]{16}$/),size:t.number().int().positive().max(64*1024*1024*1024),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),ct=t.string().min(1).max(200).regex(/^lensmcp\/g-[a-z0-9-]{1,30}$/),g=t.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),q=t.string().regex(/^[0-9a-f]{16,64}$/),A=t.string().max(1e3);export const GOAL_PEER_SCHEMAS={"goal.place":t.strictObject({goal:_,title:t.string().min(1).max(300).regex(s),repository:q,worktreeId:t.string().regex(/^[0-9a-f]{24}$/),name:t.string().regex(/^g-[a-z0-9](?:[a-z0-9-]{0,17}[a-z0-9])?$/),branch:ct,base:g,bundle:V,services:t.enum(["on-demand","none","always"]).optional(),at:n}),"goal.sent":t.strictObject({bundleId:t.string().regex(/^[0-9a-f]{16}$/),repository:q,goal:_,ref:t.string().min(1).max(250).regex(/^heads\/lensmcp\/g-[a-z0-9-]{1,30}$/),size:t.number().int().positive().max(GOAL_ON_WORKER.maxSendBytes),sha256:t.string().regex(/^[0-9a-f]{64}$/)}),"goal.changes":t.strictObject({goal:_,what:t.enum(["row","files","diff","commits","commit","against"]),path:t.string().min(1).max(4096).optional(),sha:g.optional(),full:t.boolean().optional(),againstMain:t.boolean().optional()}),"goal.update":t.strictObject({goal:_,main:t.strictObject({branch:t.string().min(1).max(200).regex(/^[A-Za-z0-9._/-]+$/),sha:g,bundle:V}),at:n})},GOAL_PEER_ANSWER_SCHEMAS={"goal.place":t.strictObject({state:t.enum(["ready","creating","failed"]),head:g.optional(),onDemand:t.boolean().optional(),needWhole:t.boolean().optional(),why:A.optional()}),"goal.sent":t.strictObject({took:t.boolean(),ref:t.string().max(250),sha:g.optional(),mirror:t.enum(["created","fast-forward","current","not-ff","checked-out"]).optional(),told:t.string().max(200).optional(),code:t.string().max(40).optional(),why:A.optional()}),"goal.changes":t.strictObject({ok:t.boolean(),value:t.unknown().optional(),status:t.number().int().min(100).max(599).optional(),why:A.optional(),shortened:t.boolean().optional()}),"goal.update":t.strictObject({outcome:t.enum(["current","merged","asked","conflicts","refused"]),why:A,sha:g.optional(),behind:t.number().int().min(0).max(1e7).optional(),dirty:t.number().int().min(0).max(1e7).optional(),conflicts:t.array(t.string().min(1).max(4096)).max(200).optional(),needWhole:t.boolean().optional()})},CONVERSATION_PEER_LIMITS={messageBytes:384*1024,conversations:32,turns:500,settles:64,turnBytes:64*1024,targetChars:4096,beatBytes:1024*1024,beatConversations:64,readTokens:6e4};const S=t.string().regex(J),F=t.string().regex(/^[0-9a-f]{16,64}$/),a=i(e=>t.string().max(e),"cvWords"),k=t.number().int().min(1).max(Number.MAX_SAFE_INTEGER),pt=t.strictObject({id:S,client:t.enum(["claude","codex"]),nativeId:t.string().regex(/^[\w.-]{8,128}$/),account:t.string().min(1).max(4200),accountNick:a(200).optional(),checkout:t.strictObject({root:t.string().min(1).max(4096),branch:a(300).optional(),key:a(300).optional()}),cwd:a(4096).optional(),model:a(200).optional(),startedAt:n,lastAt:n,state:t.enum(["running","ended","kept"]),kind:t.enum(["person","team","outside"]).optional(),sessionId:a(200).optional(),launchId:a(200).optional(),role:a(80).optional(),goalId:a(120).optional(),goalTitle:a(300).optional(),taskId:a(120).optional(),continues:S.optional()}),mt=t.strictObject({seq:k,at:n.optional(),kind:t.enum(["prompt","reply","tool","compaction","subagent"]),text:a(Q),cut:t.literal(!0).optional(),tool:t.strictObject({name:t.string().min(1).max(200),target:a(CONVERSATION_PEER_LIMITS.targetChars).optional(),outcome:t.enum(["ok","error"]).optional(),output:a(M).optional()}).optional(),files:t.array(t.string().min(1).max(4096)).max(50).optional()}),gt=t.strictObject({checkout:a(400).min(1).optional(),goalId:a(120).min(1).optional(),taskId:a(120).min(1).optional(),role:a(80).min(1).optional(),client:t.enum(["claude","codex"]).optional(),account:a(4200).min(1).optional(),mac:a(128).min(1).optional(),state:t.enum(["running","ended","kept"]).optional(),since:n.optional(),text:a(400).min(1).optional(),limit:t.number().int().min(1).max(D).optional()}),h=t.record(t.string(),t.unknown()),dt=t.discriminatedUnion("what",[t.strictObject({what:t.literal("list"),query:gt}),t.strictObject({what:t.literal("get"),id:t.string().min(1).max(200),part:t.enum(["handoff","turns"]),maxTokens:t.number().int().min(500).max(1e5).optional(),before:k.optional()})]);export const CONVERSATION_PEER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),kind:t.literal("conversation.sync"),repository:F,macBasis:t.string().regex(/^[\w-]{8,128}$/),conversations:t.array(t.strictObject({row:pt,turns:t.array(mt).max(CONVERSATION_PEER_LIMITS.turns),settles:t.array(t.strictObject({seq:k,outcome:t.enum(["ok","error"]),output:a(M).optional()})).max(CONVERSATION_PEER_LIMITS.settles).optional(),rewound:t.literal(!0).optional()})).min(1).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),kind:t.literal("conversation.read"),repository:F,ask:dt})},CONVERSATION_PEER_ANSWER_SCHEMAS={"conversation.sync":t.strictObject({v:t.literal(1),held:t.array(t.strictObject({id:S,seq:t.number().int().min(0),refused:a(500).optional()})).max(CONVERSATION_PEER_LIMITS.conversations)}),"conversation.read":t.strictObject({v:t.literal(1),from:t.strictObject({name:t.string().min(1).max(64).regex(s),fingerprint:t.string().regex(FINGERPRINT_PATTERN).optional()}),found:t.boolean(),why:a(1e3).optional(),list:t.object({conversations:t.array(h).max(D),more:t.boolean()}).passthrough().optional(),handoff:t.object({conversation:h,turns:t.array(h),more:t.boolean(),next:t.string()}).passthrough().optional(),page:t.object({conversation:h,turns:t.array(h),more:t.boolean()}).passthrough().optional()})};
|
package/lib/static-checks.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* its file — and a coverage block that says what the answer is worth: what was checked, what is stale, what has no
|
|
8
8
|
* producer, and which checkers gave no verdict. A checker that failed is never counted as clean.
|
|
9
9
|
*/
|
|
10
|
+
import type { LintIgnoredSummary } from './lint-ignores.js';
|
|
10
11
|
export type StaticCheckKind = 'typecheck' | 'lint';
|
|
11
12
|
/** `warm`: from the checkout's current state. `cold`: at an exact SHA, in a clean checkout. */
|
|
12
13
|
export type StaticCheckMode = 'warm' | 'cold';
|
|
@@ -118,6 +119,11 @@ export interface CheckAnswer<F> {
|
|
|
118
119
|
id: string;
|
|
119
120
|
place: number;
|
|
120
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Lint: the findings the person ignored in the repository (`.lensmcp/lint/ignores.json`) — left out of `totals`,
|
|
124
|
+
* `groups` and the verdict; each rule in its project with why, and how many it left out.
|
|
125
|
+
*/
|
|
126
|
+
ignored?: LintIgnoredSummary;
|
|
121
127
|
at: number;
|
|
122
128
|
}
|
|
123
129
|
export interface Coverage {
|
package/lib/team.d.ts
CHANGED
|
@@ -1452,11 +1452,32 @@ export interface DashTeamLaunch {
|
|
|
1452
1452
|
resumedFrom?: string;
|
|
1453
1453
|
/** The checkout that conversation ran in, when it continues in this launch's other one (foodguard-241). */
|
|
1454
1454
|
movedFrom?: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* The conversation this launch continues from its handoff (planning/sessions/01-conversations.md § 4, CV4): a native
|
|
1457
|
+
* resume could not run it, so this one started fresh, its first prompt telling it to read that conversation with
|
|
1458
|
+
* `conversation_get { id, continue: true }` before anything else. Absent: a fresh launch from nothing, or a native
|
|
1459
|
+
* resume (`resumedFrom`).
|
|
1460
|
+
*/
|
|
1461
|
+
continues?: DashTeamLaunchContinues;
|
|
1455
1462
|
/** The newest lines of its output, readable — what it said before it joined, or why it ended. */
|
|
1456
1463
|
tail?: string[];
|
|
1457
1464
|
/** The worker Mac it runs on — its host as placement recorded it (overseer-74 D29), shown «on <host>» (D32). Absent: this Mac. */
|
|
1458
1465
|
on?: DashTeamHostMark;
|
|
1459
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* What a continuation launch continues (CV4, CV-D1: native first; a handoff otherwise): the launch whose conversation it
|
|
1469
|
+
* is, that conversation by its client's own id (`thread`) and — when the conversations store held it — by its
|
|
1470
|
+
* `conversation` id (`cv-…`), and why it could not resume natively: `quota` — the account it ran under is out of quota
|
|
1471
|
+
* and the role fell back to the other client; `mac` — it ran on another Mac, and a conversation resumes natively only
|
|
1472
|
+
* on the Mac it ran on.
|
|
1473
|
+
*/
|
|
1474
|
+
export interface DashTeamLaunchContinues {
|
|
1475
|
+
launchId: string;
|
|
1476
|
+
client: DashTeamLaunchClient;
|
|
1477
|
+
thread: string;
|
|
1478
|
+
conversation?: string;
|
|
1479
|
+
why: 'quota' | 'mac';
|
|
1480
|
+
}
|
|
1460
1481
|
/** `GET /api/team/launches` — the repository's launched agents, newest first, and whether launching is on. */
|
|
1461
1482
|
export interface DashTeamLaunchesAnswer {
|
|
1462
1483
|
/** Features › Team launches agents. */
|