@lensmcp/protocol-types 1.25.59 → 1.25.60

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 CHANGED
@@ -15,6 +15,7 @@ export * from './lib/flood-guard.js';
15
15
  export * from './lib/dashboard.js';
16
16
  export * from './lib/log-query.js';
17
17
  export * from './lib/error-dismissal.js';
18
+ export * from './lib/metrics-reset.js';
18
19
  export * from './lib/ai-content.js';
19
20
  export * from './lib/http-exchange.js';
20
21
  export * from './lib/ai-call.js';
@@ -42,6 +43,7 @@ export * from './lib/overseer-rounds.js';
42
43
  export * from './lib/goal-design.js';
43
44
  export * from './lib/overseer-messages.js';
44
45
  export * from './lib/team-roadmap.js';
46
+ export * from './lib/team-prompts.js';
45
47
  export type { TaskTimePhase, TaskAttempt, TaskTiming } from './lib/task-timing.js';
46
48
  export type { ProofFingerprint, ProofEvidence, RuntimeProofIdentity } from './lib/proof.js';
47
49
  export type { GoalAdmission, GoalDeliveryPolicy, DeliveryProofRequirement, PackageContract, PackagePublication, PackageCandidate, DeliveryFailureKind, DeliveryFinding, PackageDelivery, DeliveryAssignment, PackageDeliverySummary } from './lib/team-delivery.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/log-query.js";export*from"./lib/error-dismissal.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-origins.js";export*from"./lib/ai-playground.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/team.js";export*from"./lib/team-review-changes.js";export*from"./lib/goal-outcome.js";export*from"./lib/goal-retro.js";export*from"./lib/team-design.js";export*from"./lib/team-library.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";
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/log-query.js";export*from"./lib/error-dismissal.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-origins.js";export*from"./lib/ai-playground.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/team.js";export*from"./lib/team-review-changes.js";export*from"./lib/goal-outcome.js";export*from"./lib/goal-retro.js";export*from"./lib/team-design.js";export*from"./lib/team-library.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";
@@ -14,6 +14,7 @@ import type { HttpExchange } from './http-exchange.js';
14
14
  import type { DashTeamDesignRun, TeamDesign } from './team-design.js';
15
15
  import type { PageVisitNavType, PageVisitRaw, PageVisitReadyBy, PageVisitRequest, PageVisitVitals } from './page-visit.js';
16
16
  import type { WorktreeRunOutcome } from './workspace-actions.js';
17
+ import type { DashExternalBefore, DashSqlBefore } from './metrics-reset.js';
17
18
  /** Bumped only on a breaking change to the stream framing itself. */
18
19
  export declare const DASHBOARD_PROTOCOL = 1;
19
20
  /** The swimlane a flow event belongs to (mirrors `FlowArea` in `@lensmcp/core`'s flow-shape). */
@@ -1553,6 +1554,10 @@ export interface DashEndpointSummary {
1553
1554
  lastStatus?: number;
1554
1555
  lastError?: string;
1555
1556
  ai?: DashAiUse[];
1557
+ /** Since a person reset its numbers (metrics-reset.ts): its calls, failures and timings count from this moment. */
1558
+ countedFrom?: number;
1559
+ /** What it had counted before — «All time» adds it back. */
1560
+ before?: DashExternalBefore;
1556
1561
  }
1557
1562
  export type DashExternalHealth = 'failing' | 'slow' | 'ok';
1558
1563
  export interface DashExternalHost {
@@ -1571,6 +1576,10 @@ export interface DashExternalHost {
1571
1576
  lastSeenAt: number;
1572
1577
  endpoints: number;
1573
1578
  ai?: DashAiUse[];
1579
+ /** Since a person reset its numbers (metrics-reset.ts): its calls, failures, timings and health count from this moment. */
1580
+ countedFrom?: number;
1581
+ /** What it had counted before — «All time» adds it back. */
1582
+ before?: DashExternalBefore;
1574
1583
  }
1575
1584
  export interface DashExternalHostDetail extends DashExternalHost {
1576
1585
  /** A call at or over this is slow (the lens's egress threshold). */
@@ -1600,6 +1609,8 @@ export interface DashExternalCatalog {
1600
1609
  /** A call at or over this is slow (the lens's egress threshold). */
1601
1610
  slowMs: number;
1602
1611
  since?: number;
1612
+ /** The newest reset of every host's numbers at once (metrics-reset.ts), until it is undone. */
1613
+ countedFrom?: number;
1603
1614
  }
1604
1615
  /** One execution of a statement, as the pg tap recorded it. */
1605
1616
  export interface DashSqlExecution {
@@ -1759,6 +1770,10 @@ export interface DashSqlTemplateSummary {
1759
1770
  suppressedMaxMs?: number;
1760
1771
  /** The statement is known whole (a tap that sends it), not only its first 500 characters. */
1761
1772
  complete: boolean;
1773
+ /** Since a person reset its numbers (metrics-reset.ts): its runs, timings and rows count from this moment. */
1774
+ countedFrom?: number;
1775
+ /** What it had counted before — «All time» adds it back. */
1776
+ before?: DashSqlBefore;
1762
1777
  }
1763
1778
  export interface DashSqlTemplateDetail extends DashSqlTemplateSummary {
1764
1779
  /** The statement as sent, up to 8 KB — or its first 500 characters when `complete` is false. */
@@ -1811,6 +1826,8 @@ export interface DashSqlCatalog {
1811
1826
  since?: number;
1812
1827
  /** The most statements the catalog keeps: past it, the one run least recently is dropped — at it, `templates` is a cap. */
1813
1828
  maxTemplates?: number;
1829
+ /** The newest reset of every statement's numbers at once (metrics-reset.ts), until it is undone. */
1830
+ countedFrom?: number;
1814
1831
  }
1815
1832
  /** `/api/db/stores` — every declared store as this checkout sees it, and what the lens could read of it. */
1816
1833
  export interface DashDbStores {
@@ -0,0 +1,104 @@
1
+ import type { BaseEvent } from './event.js';
2
+ /**
3
+ * A person reset a catalog's numbers — and what that is allowed to mean.
4
+ *
5
+ * A statement fixed last week still showed its 20 s Max beside today's 2 ms runs: the catalogs keep running totals
6
+ * (runs, the slowest run, the samples p50 and p95 are read from) for 30 days, and nothing lowered them. A reset marks
7
+ * a moment; the numbers the pages show count only runs after it. Nothing is thrown away: what a statement (or a host,
8
+ * or an endpoint) had counted before is kept beside it as `before`, an «All time» view adds it back, and the undo
9
+ * (`metrics-restored`) folds it in again.
10
+ *
11
+ * A reset is an EVENT ON THE BUS, not a change in one process, for the reason a dismissed error is
12
+ * (error-dismissal.ts): the dashboard and every MCP server keep their own catalogs from the same bus file, and a
13
+ * restart replays it — so every one of them folds the same reset in the same place among the runs it was about.
14
+ *
15
+ * Its moment is the event's own timestamp at the latest (the reader clamps it), so no event can reset ahead.
16
+ *
17
+ * WHO writes one: a person in the dashboard (Data › Databases › Queries, Data › External APIs). It names a scope and,
18
+ * optionally, what in it — statements by their shape id, hosts by name, endpoints by `<host> <METHOD> <path>`; none
19
+ * named is everything in the scope.
20
+ */
21
+ export declare const METRICS_RESET = "metrics-reset";
22
+ export declare const METRICS_RESTORED = "metrics-restored";
23
+ /** Which catalog's numbers: the SQL statements (`catalog://sql`), or the third-party hosts and endpoints (`catalog://external`). */
24
+ export type MetricsScope = 'sql' | 'external';
25
+ export declare const METRICS_SCOPES: readonly MetricsScope[];
26
+ /** The most ids one request may name — the SQL catalog's own cap on statements (apps/catalog sql.ts `MAX_TEMPLATES`). */
27
+ export declare const MAX_METRICS_RESET_IDS = 500;
28
+ /** The longest id read — an endpoint id is a host, a method and a path with its ids folded. */
29
+ export declare const MAX_METRICS_RESET_ID_LENGTH = 512;
30
+ /**
31
+ * The most ids one event carries. The bus keeps a list of at most 64 items whole (`DEFAULT_MAX_ARRAY_ITEMS`,
32
+ * bounded-clone.ts) and an event's `raw` within 32 KiB, so a reset of more is written as several events — each one
33
+ * whole, each one a reset of its own ids at the same moment.
34
+ */
35
+ export declare const METRICS_RESET_IDS_PER_EVENT = 64;
36
+ export interface MetricsReset {
37
+ kind: typeof METRICS_RESET;
38
+ scope: MetricsScope;
39
+ /** What in the scope; absent is everything in it — a run from before it that reports late counts for none. */
40
+ ids?: string[];
41
+ /** The numbers count from this moment. */
42
+ at: number;
43
+ }
44
+ export interface MetricsRestoral {
45
+ kind: typeof METRICS_RESTORED;
46
+ scope: MetricsScope;
47
+ /** What in the scope to count whole again; absent is everything in it. */
48
+ ids?: string[];
49
+ }
50
+ /** A reset or its undo before it is an event: what a writer hands to the event builder (`@lensmcp/core/lens-events`). */
51
+ export type MetricsChange = {
52
+ kind: typeof METRICS_RESET | typeof METRICS_RESTORED;
53
+ scope: MetricsScope;
54
+ ids?: readonly string[];
55
+ };
56
+ /**
57
+ * Read a reset or its undo out of a bus event, or nothing. Total: the bus is a file any local process appends to, so
58
+ * every field is checked — and a list of ids none of which can be read is not a reset of everything.
59
+ */
60
+ export declare function readMetricsReset(event: Pick<BaseEvent, 'source' | 'timestamp' | 'raw'>): MetricsReset | MetricsRestoral | undefined;
61
+ /** Ids split into the events that carry them, each kept whole by the bus (`METRICS_RESET_IDS_PER_EVENT`). */
62
+ export declare function metricsIdBatches(ids: readonly string[]): string[][];
63
+ /** `POST /api/metrics/reset` and `/api/metrics/restore` — the body: a scope, and what in it (none: everything). */
64
+ export interface DashMetricsResetBody {
65
+ scope: MetricsScope;
66
+ ids?: string[];
67
+ }
68
+ /** …and the answer: the moment written, and how many statements (or hosts and endpoints) it named. */
69
+ export interface DashMetricsResetResult {
70
+ ok: true;
71
+ at: number;
72
+ count: number;
73
+ }
74
+ /**
75
+ * A statement's numbers from before its reset — every earlier reset's summed (the most of them the most). Its p50 and
76
+ * p95 are those of the longer of the periods summed: the samples of two periods were never kept together, so they
77
+ * cannot be read as one.
78
+ */
79
+ export interface DashSqlBefore {
80
+ runs: number;
81
+ errors: number;
82
+ totalMs: number;
83
+ maxMs: number;
84
+ rowsTotal: number;
85
+ rowsMax: number;
86
+ perRequestMax: number;
87
+ suppressed: number;
88
+ suppressedSlow?: number;
89
+ suppressedFailed?: number;
90
+ suppressedMaxMs?: number;
91
+ p50?: number;
92
+ p95?: number;
93
+ }
94
+ /** A host's or an endpoint's numbers from before its reset, summed the same way. */
95
+ export interface DashExternalBefore {
96
+ calls: number;
97
+ failed: number;
98
+ maxMs: number;
99
+ /** An endpoint's only. */
100
+ status4xx?: number;
101
+ status5xx?: number;
102
+ p50?: number;
103
+ p95?: number;
104
+ }
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var i=(t,e)=>a(t,"name",{value:e,configurable:!0});var S=Object.defineProperty,o=i((t,e)=>S(t,"name",{value:e,configurable:!0}),"s");import{LENS_EVENT_SOURCE as f}from"./error-dismissal.js";export const METRICS_RESET="metrics-reset",METRICS_RESTORED="metrics-restored",METRICS_SCOPES=["sql","external"],MAX_METRICS_RESET_IDS=500,MAX_METRICS_RESET_ID_LENGTH=512,METRICS_RESET_IDS_PER_EVENT=64;const l=16*1024,u=o(t=>t==="sql"||t==="external","isScope"),E=o(t=>typeof t=="string"&&t.length>0&&t.length<=MAX_METRICS_RESET_ID_LENGTH,"isId");export function readMetricsReset(t){if(t.source!==f||!t.raw||typeof t.raw!="object")return;const e=t.raw,r=e.kind;if(r!==METRICS_RESET&&r!==METRICS_RESTORED)return;const n=e.scope;if(!u(n))return;let s;if(e.ids!==void 0&&(!Array.isArray(e.ids)||(s=[...new Set(e.ids.filter(E))].slice(0,METRICS_RESET_IDS_PER_EVENT),!s.length)))return;if(r===METRICS_RESTORED)return{kind:r,scope:n,...s?{ids:s}:{}};const c=e.at;if(!(typeof c!="number"||!Number.isFinite(c)))return{kind:r,scope:n,at:Math.min(c,t.timestamp),...s?{ids:s}:{}}}i(readMetricsReset,"readMetricsReset"),o(readMetricsReset,"readMetricsReset");export function metricsIdBatches(t){const e=[];let r=[],n=0;for(const s of new Set(t.filter(E)))r.length&&(r.length>=METRICS_RESET_IDS_PER_EVENT||n+s.length+3>l)&&(e.push(r),r=[],n=0),r.push(s),n+=s.length+3;return r.length&&e.push(r),e}i(metricsIdBatches,"metricsIdBatches"),o(metricsIdBatches,"metricsIdBatches");
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The prompt that starts a goal manager in Claude Code or Codex (FoodGuard, 2026-11-05). The person copies it from the
3
+ * Team page («Manager prompt», on every tab), or a terminal prints it: `lensmcp agent prompt manager`, as in
4
+ * `claude "$(lensmcp agent prompt manager)"`. It holds the loop only — join, pick the next goal in the roadmap's order,
5
+ * read its design, design its team, break it down, run it, close it, clear and continue. The repository's own rules
6
+ * (its merge, its QA gates, its checks) reach the agent through agent_join: its role's rules and the project brief.
7
+ *
8
+ * Every tool and resource it names is checked against the agent's (apps/agent/src/tools/manager-prompt.spec.ts), and
9
+ * every `lensmcp agent …` command against the CLI's usage (servers/lensmcp-mcp/src/manager-prompt.spec.ts).
10
+ */
11
+ export declare const MANAGER_PROMPT = "You are this repository's LensMCP goal manager. You run one goal at a time from claim to merge, then take the next one the roadmap offers, until nothing is left you may claim. You never push, deploy, approve a design, accept a goal's output or edit the team's files \u2014 those are the person's.\n\n1. Join\n- agent_join { role: \"manager\", manager: \"user\", listening: true, credential: <the credential your start hook gave you> }. Never print the credential.\n- Follow role.rules for the whole session. Read `project` (the brief) and every section it names as left out before work it is about. Load the skills role.skills names (Claude Code: /lensmcp:team). Keep the rulesHash.\n- After a compacted context: agent_join again with ifRulesHash, then agent_sync { full: true }.\n\n2. Pick the next goal\n- A goal you already hold (claimed, or in recovery) comes first: read its checkpoint and log, then continue it.\n- Else agent_task_list { credential, claimable: true }: goals come in the roadmap's order (Team \u203A Roadmap) \u2014 approved designs whose dependencies are completed and accepted. agent_task_claim the first; keep its claimGeneration.\n- None claimable: agent_wait { timeoutSec: 900 }, then look again. Never claim or create a goal still in design.\n\n3. Read the goal\n- Its whole design: `lensmcp agent design show <goalId>` \u2014 outcome, Done means, the plan with paths and estimates, Not in this goal, budget, the answered questions. Its plan (builds, hours) is the budget LensMCP enforces.\n- Your first commit puts the design in the repository: `lensmcp agent design export <goalId> --to <the file its description names>`.\n- The claim names the goal's worktree when goal worktrees are on: worktree_switch to it and do all the goal's work there (it stays parked until an agent runs it).\n- A question about the design \u2192 agent_ask (its author answers). A change of scope, Done means or plan is an amendment the person approves; keep working on what it does not touch.\n\n4. Design the goal's team\n- Before breaking it down: agent_goal_team { goalId, team: [{ role, rules, model?, effort?, reviews?, max? }] }.\n- Each role the plan needs (team://roles is this team; team://library the roles it could add), with this goal's rules for it: the paths it works in, the Done-means lines it proves, the checks it runs.\n- A high-risk goal staffs a second review role (security-reviewer) with `reviews` over the plan's paths \u2014 LensMCP refuses a high-risk package without one. `max` only lowers a role's capacity.\n- A role the work needs and the team lacks: name the library role to the person; never invent one.\n\n5. Break it down\n- One build task per plan package: kind, role, priority, parentId (the goal), its paths, its Done-means lines, links to its evidence. No two open builds on overlapping paths unless blockedBy orders them.\n- Never create test, review, qa or docs tasks: completing a build hands them off.\n- Work the plan does not hold \u2192 the goal's next list (agent_task_update { taskId: <goal>, action: \"next\", title, result }), never the board.\n\n6. Run it\n- agent_spawn { role, brief, taskId? }: one long-lived agent per role for the goal. A launch refused for want of a slot is queued \u2014 agent_wait, then spawn again; never retry in a loop.\n- Between decisions agent_wait \u2014 never sleep or poll. Read the overview it brings first, then your messages.\n- Answer workers with agent_answer. A decision only the person can make goes through agent_ask, never your client's own prompt. Log each decision on the goal; rework goes back to whoever built it.\n\n7. Close the goal\n- When every package is built, tested and reviewed, LensMCP opens the goal's QA run. Let it run.\n- QA passed (or the person recorded a waiver): in the goal's worktree merge current main into the branch, re-run the goal's checks if main moved, leave the checkout clean.\n- agent_task_update { taskId: <goal>, action: \"merge\" } lands it on main as flow.json sets (e.g. one squash commit titled with the goal). Never merge a goal twice.\n- Complete the goal (action \"complete\") with each Done-means line and how it was verified, the merge commit, the branch tip, and the review, test and QA task ids \u2014 an unproved line is named with its owner instead.\n- LensMCP removes the worktree once the goal completes; if it says the worktree is still there, worktree_remove { name } and keep the branch.\n- Report to the person: what finished, what is open and who holds it, each decision only they can make with your recommendation. If other goals need this one (Team \u203A Roadmap), ask them to accept its output there with the merge commit \u2014 those goals stay blocked until they do.\n\n8. Clear and continue\n- Release anything you still hold under the finished goal; its agents close themselves when no work is left for them.\n- A checkpoint of about 2,000 characters: decisions, the next step, open questions.\n- Read and acknowledge your messages, then go back to step 2. When nothing is claimable and nothing waits for you: agent_session { action: \"close\" }.";
12
+ /** The prompts the Team page and `lensmcp agent prompt <name>` hand out, by name. */
13
+ export declare const TEAM_PROMPTS: {
14
+ readonly manager: "You are this repository's LensMCP goal manager. You run one goal at a time from claim to merge, then take the next one the roadmap offers, until nothing is left you may claim. You never push, deploy, approve a design, accept a goal's output or edit the team's files — those are the person's.\n\n1. Join\n- agent_join { role: \"manager\", manager: \"user\", listening: true, credential: <the credential your start hook gave you> }. Never print the credential.\n- Follow role.rules for the whole session. Read `project` (the brief) and every section it names as left out before work it is about. Load the skills role.skills names (Claude Code: /lensmcp:team). Keep the rulesHash.\n- After a compacted context: agent_join again with ifRulesHash, then agent_sync { full: true }.\n\n2. Pick the next goal\n- A goal you already hold (claimed, or in recovery) comes first: read its checkpoint and log, then continue it.\n- Else agent_task_list { credential, claimable: true }: goals come in the roadmap's order (Team › Roadmap) — approved designs whose dependencies are completed and accepted. agent_task_claim the first; keep its claimGeneration.\n- None claimable: agent_wait { timeoutSec: 900 }, then look again. Never claim or create a goal still in design.\n\n3. Read the goal\n- Its whole design: `lensmcp agent design show <goalId>` — outcome, Done means, the plan with paths and estimates, Not in this goal, budget, the answered questions. Its plan (builds, hours) is the budget LensMCP enforces.\n- Your first commit puts the design in the repository: `lensmcp agent design export <goalId> --to <the file its description names>`.\n- The claim names the goal's worktree when goal worktrees are on: worktree_switch to it and do all the goal's work there (it stays parked until an agent runs it).\n- A question about the design → agent_ask (its author answers). A change of scope, Done means or plan is an amendment the person approves; keep working on what it does not touch.\n\n4. Design the goal's team\n- Before breaking it down: agent_goal_team { goalId, team: [{ role, rules, model?, effort?, reviews?, max? }] }.\n- Each role the plan needs (team://roles is this team; team://library the roles it could add), with this goal's rules for it: the paths it works in, the Done-means lines it proves, the checks it runs.\n- A high-risk goal staffs a second review role (security-reviewer) with `reviews` over the plan's paths — LensMCP refuses a high-risk package without one. `max` only lowers a role's capacity.\n- A role the work needs and the team lacks: name the library role to the person; never invent one.\n\n5. Break it down\n- One build task per plan package: kind, role, priority, parentId (the goal), its paths, its Done-means lines, links to its evidence. No two open builds on overlapping paths unless blockedBy orders them.\n- Never create test, review, qa or docs tasks: completing a build hands them off.\n- Work the plan does not hold → the goal's next list (agent_task_update { taskId: <goal>, action: \"next\", title, result }), never the board.\n\n6. Run it\n- agent_spawn { role, brief, taskId? }: one long-lived agent per role for the goal. A launch refused for want of a slot is queued — agent_wait, then spawn again; never retry in a loop.\n- Between decisions agent_wait — never sleep or poll. Read the overview it brings first, then your messages.\n- Answer workers with agent_answer. A decision only the person can make goes through agent_ask, never your client's own prompt. Log each decision on the goal; rework goes back to whoever built it.\n\n7. Close the goal\n- When every package is built, tested and reviewed, LensMCP opens the goal's QA run. Let it run.\n- QA passed (or the person recorded a waiver): in the goal's worktree merge current main into the branch, re-run the goal's checks if main moved, leave the checkout clean.\n- agent_task_update { taskId: <goal>, action: \"merge\" } lands it on main as flow.json sets (e.g. one squash commit titled with the goal). Never merge a goal twice.\n- Complete the goal (action \"complete\") with each Done-means line and how it was verified, the merge commit, the branch tip, and the review, test and QA task ids — an unproved line is named with its owner instead.\n- LensMCP removes the worktree once the goal completes; if it says the worktree is still there, worktree_remove { name } and keep the branch.\n- Report to the person: what finished, what is open and who holds it, each decision only they can make with your recommendation. If other goals need this one (Team › Roadmap), ask them to accept its output there with the merge commit — those goals stay blocked until they do.\n\n8. Clear and continue\n- Release anything you still hold under the finished goal; its agents close themselves when no work is left for them.\n- A checkpoint of about 2,000 characters: decisions, the next step, open questions.\n- Read and acknowledge your messages, then go back to step 2. When nothing is claimable and nothing waits for you: agent_session { action: \"close\" }.";
15
+ };
16
+ export type TeamPromptName = keyof typeof TEAM_PROMPTS;
17
+ export declare const TEAM_PROMPT_NAMES: TeamPromptName[];
@@ -0,0 +1,46 @@
1
+ "use strict";export const MANAGER_PROMPT=`You are this repository's LensMCP goal manager. You run one goal at a time from claim to merge, then take the next one the roadmap offers, until nothing is left you may claim. You never push, deploy, approve a design, accept a goal's output or edit the team's files \u2014 those are the person's.
2
+
3
+ 1. Join
4
+ - agent_join { role: "manager", manager: "user", listening: true, credential: <the credential your start hook gave you> }. Never print the credential.
5
+ - Follow role.rules for the whole session. Read \`project\` (the brief) and every section it names as left out before work it is about. Load the skills role.skills names (Claude Code: /lensmcp:team). Keep the rulesHash.
6
+ - After a compacted context: agent_join again with ifRulesHash, then agent_sync { full: true }.
7
+
8
+ 2. Pick the next goal
9
+ - A goal you already hold (claimed, or in recovery) comes first: read its checkpoint and log, then continue it.
10
+ - Else agent_task_list { credential, claimable: true }: goals come in the roadmap's order (Team \u203A Roadmap) \u2014 approved designs whose dependencies are completed and accepted. agent_task_claim the first; keep its claimGeneration.
11
+ - None claimable: agent_wait { timeoutSec: 900 }, then look again. Never claim or create a goal still in design.
12
+
13
+ 3. Read the goal
14
+ - Its whole design: \`lensmcp agent design show <goalId>\` \u2014 outcome, Done means, the plan with paths and estimates, Not in this goal, budget, the answered questions. Its plan (builds, hours) is the budget LensMCP enforces.
15
+ - Your first commit puts the design in the repository: \`lensmcp agent design export <goalId> --to <the file its description names>\`.
16
+ - The claim names the goal's worktree when goal worktrees are on: worktree_switch to it and do all the goal's work there (it stays parked until an agent runs it).
17
+ - A question about the design \u2192 agent_ask (its author answers). A change of scope, Done means or plan is an amendment the person approves; keep working on what it does not touch.
18
+
19
+ 4. Design the goal's team
20
+ - Before breaking it down: agent_goal_team { goalId, team: [{ role, rules, model?, effort?, reviews?, max? }] }.
21
+ - Each role the plan needs (team://roles is this team; team://library the roles it could add), with this goal's rules for it: the paths it works in, the Done-means lines it proves, the checks it runs.
22
+ - A high-risk goal staffs a second review role (security-reviewer) with \`reviews\` over the plan's paths \u2014 LensMCP refuses a high-risk package without one. \`max\` only lowers a role's capacity.
23
+ - A role the work needs and the team lacks: name the library role to the person; never invent one.
24
+
25
+ 5. Break it down
26
+ - One build task per plan package: kind, role, priority, parentId (the goal), its paths, its Done-means lines, links to its evidence. No two open builds on overlapping paths unless blockedBy orders them.
27
+ - Never create test, review, qa or docs tasks: completing a build hands them off.
28
+ - Work the plan does not hold \u2192 the goal's next list (agent_task_update { taskId: <goal>, action: "next", title, result }), never the board.
29
+
30
+ 6. Run it
31
+ - agent_spawn { role, brief, taskId? }: one long-lived agent per role for the goal. A launch refused for want of a slot is queued \u2014 agent_wait, then spawn again; never retry in a loop.
32
+ - Between decisions agent_wait \u2014 never sleep or poll. Read the overview it brings first, then your messages.
33
+ - Answer workers with agent_answer. A decision only the person can make goes through agent_ask, never your client's own prompt. Log each decision on the goal; rework goes back to whoever built it.
34
+
35
+ 7. Close the goal
36
+ - When every package is built, tested and reviewed, LensMCP opens the goal's QA run. Let it run.
37
+ - QA passed (or the person recorded a waiver): in the goal's worktree merge current main into the branch, re-run the goal's checks if main moved, leave the checkout clean.
38
+ - agent_task_update { taskId: <goal>, action: "merge" } lands it on main as flow.json sets (e.g. one squash commit titled with the goal). Never merge a goal twice.
39
+ - Complete the goal (action "complete") with each Done-means line and how it was verified, the merge commit, the branch tip, and the review, test and QA task ids \u2014 an unproved line is named with its owner instead.
40
+ - LensMCP removes the worktree once the goal completes; if it says the worktree is still there, worktree_remove { name } and keep the branch.
41
+ - Report to the person: what finished, what is open and who holds it, each decision only they can make with your recommendation. If other goals need this one (Team \u203A Roadmap), ask them to accept its output there with the merge commit \u2014 those goals stay blocked until they do.
42
+
43
+ 8. Clear and continue
44
+ - Release anything you still hold under the finished goal; its agents close themselves when no work is left for them.
45
+ - A checkpoint of about 2,000 characters: decisions, the next step, open questions.
46
+ - Read and acknowledge your messages, then go back to step 2. When nothing is claimable and nothing waits for you: agent_session { action: "close" }.`,TEAM_PROMPTS={manager:MANAGER_PROMPT},TEAM_PROMPT_NAMES=Object.keys(TEAM_PROMPTS);
package/lib/team.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DashTeamTaskDesign } from './goal-design.js';
1
+ import type { DashTeamTaskDesign, DesignStage } from './goal-design.js';
2
2
  import type { TaskTiming } from './task-timing.js';
3
3
  import type { GoalAdmission, PackageDeliverySummary } from './team-delivery.js';
4
4
  /**
@@ -1516,6 +1516,49 @@ export interface DashTeamQuestionsAnswer {
1516
1516
  scope?: DashTeamBoardScope;
1517
1517
  observedAt: number;
1518
1518
  }
1519
+ /** A goal the dashboard's search found (`GET /api/team/search`): enough to name it and open it — on the board, or its design. */
1520
+ export interface DashTeamSearchGoal {
1521
+ id: string;
1522
+ title: string;
1523
+ state: DashTeamTaskState;
1524
+ priority: number;
1525
+ /** Its design, briefly: where it is and its newest version — a goal with one opens it from Inbox › Designs too. */
1526
+ design?: {
1527
+ stage: DesignStage;
1528
+ version?: number;
1529
+ amendment?: boolean;
1530
+ };
1531
+ /** Where the words were found, a few words around the first one its title lacks — none when the title holds them all. */
1532
+ match?: string;
1533
+ updatedAt: number;
1534
+ }
1535
+ /** An agent's question the dashboard's search found: its first words, where it is, who asked it, about what. */
1536
+ export interface DashTeamSearchQuestion {
1537
+ id: string;
1538
+ /** Its words, cut at {@link DASH_TEAM_SEARCH_QUESTION_MAX} characters. */
1539
+ question: string;
1540
+ state: DashTeamQuestionState;
1541
+ blocking: boolean;
1542
+ askerName?: string;
1543
+ askerRole?: string;
1544
+ taskTitle?: string;
1545
+ match?: string;
1546
+ updatedAt: number;
1547
+ }
1548
+ export declare const DASH_TEAM_SEARCH_QUESTION_MAX = 300;
1549
+ /**
1550
+ * `GET /api/team/search?q=&limit=` — the goals (with their designs) and the agents' questions holding every word of `q`:
1551
+ * live goals and open questions first, then the newest. The goals are the repository's; the questions the checkout's
1552
+ * scope, as its Inbox's.
1553
+ */
1554
+ export interface DashTeamSearchAnswer {
1555
+ q: string;
1556
+ goals: DashTeamSearchGoal[];
1557
+ questions: DashTeamSearchQuestion[];
1558
+ /** Set on a worktree's page: its own questions only. */
1559
+ scope?: DashTeamBoardScope;
1560
+ observedAt: number;
1561
+ }
1519
1562
  /** `POST /api/team/questions/<id>/answer` — the person answers: an option, their own words, or both. Answered: `{ question }`. */
1520
1563
  export interface DashTeamAnswerQuestion {
1521
1564
  answer?: string;
package/lib/team.js CHANGED
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});var i=Object.defineProperty,a=r((t,e)=>i(t,"name",{value:e,configurable:!0}),"r");export const DASH_TEAM_KINDS=["goal","build","bug","review","test","qa","docs","marketing","research","chore"],DASH_TEAM_LINK_KINDS=["task","flow","error","suggestion","ai-call","review","page","route","commit","branch","worktree","file","finding","test"];export function modelClient(t){const e=t?.trim()??"";if(/\b(claude|opus|sonnet|haiku|fable)\b/i.test(e))return"claude";if(/^(gpt|o\d+|codex)\b/i.test(e))return"codex"}r(modelClient,"modelClient"),a(modelClient,"modelClient");
1
+ "use strict";var o=Object.defineProperty;var r=(t,e)=>o(t,"name",{value:e,configurable:!0});var i=Object.defineProperty,n=r((t,e)=>i(t,"name",{value:e,configurable:!0}),"o");export const DASH_TEAM_KINDS=["goal","build","bug","review","test","qa","docs","marketing","research","chore"],DASH_TEAM_LINK_KINDS=["task","flow","error","suggestion","ai-call","review","page","route","commit","branch","worktree","file","finding","test"];export function modelClient(t){const e=t?.trim()??"";if(/\b(claude|opus|sonnet|haiku|fable)\b/i.test(e))return"claude";if(/^(gpt|o\d+|codex)\b/i.test(e))return"codex"}r(modelClient,"modelClient"),n(modelClient,"modelClient");export const DASH_TEAM_SEARCH_QUESTION_MAX=300;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/protocol-types",
3
- "version": "1.25.59",
3
+ "version": "1.25.60",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",