@lensmcp/protocol-types 1.26.12 → 1.26.13

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.
Files changed (49) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +1 -1
  3. package/lib/accounts.d.ts +60 -0
  4. package/lib/accounts.js +1 -0
  5. package/lib/ai-cache-facts.js +1 -1
  6. package/lib/ai-cache-verdict.js +1 -1
  7. package/lib/ai-cache.js +3 -3
  8. package/lib/ai-call-groups.js +2 -2
  9. package/lib/ai-call-row.js +3 -3
  10. package/lib/ai-call.js +9 -9
  11. package/lib/ai-compare.js +3 -3
  12. package/lib/ai-context.js +6 -6
  13. package/lib/ai-origins.js +9 -9
  14. package/lib/ai-together.js +5 -5
  15. package/lib/bounded-clone.js +1 -1
  16. package/lib/bounded-map.js +1 -1
  17. package/lib/bounded-writer.js +1 -1
  18. package/lib/capture-demand.js +1 -1
  19. package/lib/dashboard-path.js +1 -1
  20. package/lib/docker-errors.js +1 -1
  21. package/lib/docker-jobs.js +1 -1
  22. package/lib/docker-report.js +2 -2
  23. package/lib/docker-runs.js +3 -3
  24. package/lib/error-cause.js +6 -6
  25. package/lib/error-dismissal.js +1 -1
  26. package/lib/error-verdict.js +3 -3
  27. package/lib/event-loop.js +1 -1
  28. package/lib/expected-failure.js +2 -2
  29. package/lib/finding-proof.js +1 -1
  30. package/lib/flood-guard.js +1 -1
  31. package/lib/goal-design.js +1 -1
  32. package/lib/host-agents.js +1 -1
  33. package/lib/lint-coverage.js +1 -1
  34. package/lib/log-query.js +1 -1
  35. package/lib/metrics-reset.js +1 -1
  36. package/lib/overseer-findings.js +1 -1
  37. package/lib/peers.d.ts +1 -1
  38. package/lib/peers.js +1 -1
  39. package/lib/perf-rules.js +1 -1
  40. package/lib/pod-memory.js +1 -1
  41. package/lib/producer-health.js +1 -1
  42. package/lib/remote-instances.js +1 -1
  43. package/lib/sessions.d.ts +17 -1
  44. package/lib/sources.js +1 -1
  45. package/lib/static-checks.js +1 -1
  46. package/lib/system-report.js +1 -1
  47. package/lib/team-design.d.ts +113 -3
  48. package/lib/team.js +1 -1
  49. package/package.json +1 -1
package/lib/sources.js CHANGED
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var a=(t,r)=>T(t,"name",{value:r,configurable:!0});var U=Object.defineProperty,e=a((t,r)=>U(t,"name",{value:r,configurable:!0}),"r");export const SOURCE_KINDS=["queue","loop","store","traffic"],SOURCE_KINDS_READ=["queue","loop","store","traffic"],sourceWireSchema=e(t=>`lensmcp.${t}/v1`,"sourceWireSchema"),QUEUE_WIRE_SCHEMA="lensmcp.queue/v1",LOOP_WIRE_SCHEMA="lensmcp.loop/v1",STORE_WIRE_SCHEMA="lensmcp.store/v1",TRAFFIC_WIRE_SCHEMA="lensmcp.traffic/v1",SOURCE_SNAPSHOT_FIELD={queue:"snapshot",loop:"loop",store:"store",traffic:"traffic"},URI_SOURCES="process://sources",SOURCE_PROVENANCE="reported",QUEUE_OLDEST_WAIT_RULE="queue/oldest-wait",QUEUE_STALLED_RULE="queue/stalled",LOOP_OVERDUE_RULE="loop/overdue",LOOP_FAILING_RULE="loop/failing",LOOP_IDLE_RULE="loop/idle-while-fed",STORE_QUOTA_RULE="store/near-quota",STORE_ERRORS_RULE="store/errors",STORE_ORPHANS_RULE="store/orphans",TRAFFIC_FAILURES_RULE="traffic/failures",TRAFFIC_LATENCY_RULE="traffic/latency",TRAFFIC_RATE_LIMITED_RULE="traffic/rate-limited",SOURCE_RULES=[QUEUE_OLDEST_WAIT_RULE,QUEUE_STALLED_RULE,LOOP_OVERDUE_RULE,LOOP_FAILING_RULE,LOOP_IDLE_RULE,STORE_QUOTA_RULE,STORE_ERRORS_RULE,STORE_ORPHANS_RULE,TRAFFIC_FAILURES_RULE,TRAFFIC_LATENCY_RULE,TRAFFIC_RATE_LIMITED_RULE],SOURCE_EVENT_KINDS=["source-poll","source-declaration","source-event"],CUSTOM_EVENT_SOURCE="custom",QUEUE_EVENTS=["enqueued","admitted","completed","failed","parked"],LOOP_EVENTS=["run-start","run-end"],LOOP_OUTCOMES=["ok","failed","skipped"],STORE_EVENTS=["write","delete","error"],TRAFFIC_EVENTS=["inbound","outbound"],TRAFFIC_OUTCOMES=["ok","failed","rate-limited"],SOURCE_PUSH_EVENTS={queue:QUEUE_EVENTS,loop:LOOP_EVENTS,store:STORE_EVENTS,traffic:TRAFFIC_EVENTS},SOURCE_PUSH_OUTCOMES={queue:[],loop:LOOP_OUTCOMES,store:[],traffic:TRAFFIC_OUTCOMES},SOURCE_POLL_STATES=["current","unreachable","refused","malformed","not-running"],SOURCE_STATES=[...SOURCE_POLL_STATES,"stale","never-polled"],SOURCE_DEFAULT_INTERVAL_SEC=10,SOURCE_MIN_INTERVAL_SEC=2,QUEUE_DEFAULT_OLDEST_WAIT_MIN=10,QUEUE_DEFAULT_STALLED_MIN=15,LOOP_DEFAULT_IDLE_MIN=10,LOOP_OVERDUE_INTERVALS=2,LOOP_FAILING_RUNS=3,SOURCE_FULL_REPORT_MS=6e4,SOURCE_HISTORY_POINTS=60,SOURCE_RUNS_KEPT=30,SOURCE_PUSHED_KEPT=20,STORE_DEFAULT_QUOTA_PCT=90,STORE_DEFAULT_ERROR_RATE_PCT=5,STORE_DEFAULT_ORPHAN_MIN=60,TRAFFIC_DEFAULT_FAILURE_PCT=5,TRAFFIC_DEFAULT_P95_MS=2e3,TRAFFIC_DEFAULT_RATE_LIMITED=1,TRAFFIC_MIN_MESSAGES=10,TRAFFIC_PUSH_WINDOW_MS=10*6e4,TRAFFIC_PUSH_CHANNELS=50,TRAFFIC_PUSH_EVENTS_PER_CHANNEL=1e3,SOURCE_MAX_GROUPS=500,SOURCE_MAX_BYTES=256*1024,SOURCE_STALE_PERIODS=3,SOURCE_STALE_MIN_MS=3e4;export function sourceStaleAfterMs(t){return Math.max(SOURCE_STALE_MIN_MS,SOURCE_STALE_PERIODS*Math.max(0,t))}a(sourceStaleAfterMs,"sourceStaleAfterMs"),e(sourceStaleAfterMs,"sourceStaleAfterMs");const n=e(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isObj"),s=e(t=>typeof t=="number"&&Number.isInteger(t)&&t>=0,"isCount"),E=e(t=>typeof t=="number"&&Number.isFinite(t)&&t>0,"isTime"),u=e((t,r)=>typeof t=="string"&&t.length>0&&t.length<=r,"isStr"),v=e(t=>t===void 0||typeof t=="number"&&t>0,"isMin");function _(t){if(!SOURCE_KINDS_READ.includes(t.sourceKind)||typeof t.path!="string"&&!(t.path===void 0&&(t.sourceKind==="traffic"||t.sourceKind==="loop"))||!u(t.name,200)||typeof t.intervalSec!="number"||t.feeds!==void 0&&!u(t.feeds,200))return!1;const r=t.thresholds;if(!n(r))return!1;for(const o of["stalledMin","idleMin","oldestWaitMin","quotaPct","errorRatePct","orphanMin","failurePct","p95Ms","rateLimited"])if(!v(r[o]))return!1;return t.sourceKind!=="queue"||typeof r.oldestWaitMin=="number"}a(_,"l"),e(_,"asDecl");const l=e(t=>t===null||typeof t=="string","isIsoOrNull"),c=e(t=>t===void 0||s(t),"isOptCount");function d(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!E(t.intervalSec)||!l(t.lastRunAt)||t.nextRunAt!==void 0&&!l(t.nextRunAt))return!1;for(const r of["lastDurationMs","lastItems","runsInWindow","itemsInWindow","failuresInWindow","windowSec"])if(!c(t[r]))return!1;return t.lastOutcome!==void 0&&!LOOP_OUTCOMES.includes(t.lastOutcome)?!1:t.lastError===void 0||typeof t.lastError=="string"}a(d,"_"),e(d,"asLoopSnapshot");const f=e(t=>t===void 0||n(t)&&Object.values(t).every(r=>typeof r=="string"),"isLabels");function S(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!s(t.objects)||!s(t.bytes)||t.quotaBytes!==void 0&&t.quotaBytes!==null&&!s(t.quotaBytes))return!1;for(const i of["opsInWindow","writesInWindow","deletesInWindow","errorsInWindow","windowSec"])if(!c(t[i]))return!1;if(t.lastWriteAt!==void 0&&!l(t.lastWriteAt)||t.lastError!==void 0&&typeof t.lastError!="string")return!1;const r=t.truncated;if(r!==void 0&&!(n(r)&&s(r.groups)))return!1;const o=t.groups;return o===void 0?!0:Array.isArray(o)&&o.length<=SOURCE_MAX_GROUPS&&o.every(i=>n(i)&&u(i.group,1e3)&&s(i.objects)&&s(i.bytes)&&f(i.labels))}a(S,"S"),e(S,"asStoreSnapshot");function p(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!Array.isArray(t.channels)||!c(t.windowSec))return!1;const r=t.truncated;return r!==void 0&&!(n(r)&&s(r.channels))?!1:t.channels.length<=SOURCE_MAX_GROUPS&&t.channels.every(o=>{if(!n(o)||!u(o.channel,1e3)||!f(o.labels)||o.direction!==void 0&&o.direction!=="inbound"&&o.direction!=="outbound"||o.counterpart!==void 0&&!u(o.counterpart,200))return!1;for(const i of["messagesInWindow","failuresInWindow","rateLimitedInWindow"])if(!c(o[i]))return!1;return o.p95Ms!==void 0&&!(typeof o.p95Ms=="number"&&Number.isFinite(o.p95Ms)&&o.p95Ms>=0)||o.lastAt!==void 0&&!l(o.lastAt)?!1:o.lastError===void 0||typeof o.lastError=="string"})}a(p,"R"),e(p,"asTrafficSnapshot");function R(t){return n(t)&&u(t.digest,100)&&typeof t.at=="string"&&E(t.receivedAt)}a(R,"A"),e(R,"asSame");function A(t){if(!n(t)||!u(t.group,1e3)||!s(t.pending))return!1;for(const i of["inFlight","failed","completedInWindow"])if(t[i]!==void 0&&!s(t[i]))return!1;const r=t.oldestPendingAt;if(r!=null&&typeof r!="string")return!1;const o=t.labels;return o===void 0||n(o)&&Object.values(o).every(i=>typeof i=="string")}a(A,"O"),e(A,"asGroup");function O(t){if(!n(t)||typeof t.at!="string"||!E(t.receivedAt)||!Array.isArray(t.groups))return!1;const r=t.totals;if(!n(r)||!s(r.groups)||!s(r.pending)||!s(r.inFlight)||!s(r.failed))return!1;const o=t.truncated;return o!==void 0&&!(n(o)&&s(o.groups))?!1:t.groups.length<=SOURCE_MAX_GROUPS&&t.groups.every(A)}a(O,"T"),e(O,"asSnapshot");export function asSourcePollRaw(t){if(!n(t)||t.kind!=="source-poll"||!u(t.project,200)||!_(t)||!SOURCE_POLL_STATES.includes(t.state)||!E(t.polledAt)||!E(t.reportEveryMs)||t.path===void 0)return;const r=SOURCE_SNAPSHOT_FIELD[t.sourceKind];for(const i of Object.values(SOURCE_SNAPSHOT_FIELD))if(i!==r&&t[i]!==void 0)return;const o={snapshot:O,loop:d,store:S,traffic:p}[r];if(!(t[r]!==void 0&&!o(t[r]))&&!(t.same!==void 0&&(!R(t.same)||t[r]!==void 0))&&!(t.state==="current"&&t[r]===void 0&&t.same===void 0))return t}a(asSourcePollRaw,"asSourcePollRaw"),e(asSourcePollRaw,"asSourcePollRaw");export function asSourceEventRaw(t){if(!n(t)||t.kind!=="source-event"||!u(t.project,200)||!u(t.name,200))return;const r=t.sourceKind;if(SOURCE_KINDS_READ.includes(r)&&SOURCE_PUSH_EVENTS[r].includes(t.event)&&!(t.item!==void 0&&!u(t.item,200)||t.group!==void 0&&!u(t.group,200))&&!(!c(t.items)||!c(t.durationMs)||!c(t.bytes))&&!(t.outcome!==void 0&&!SOURCE_PUSH_OUTCOMES[r].includes(t.outcome))){for(const o of["object","channel","counterpart","correlation"])if(t[o]!==void 0&&!u(t[o],200))return;if(!(t.error!==void 0&&typeof t.error!="string"))return t}}a(asSourceEventRaw,"asSourceEventRaw"),e(asSourceEventRaw,"asSourceEventRaw");export function asSourceDeclarationRaw(t){if(!(!n(t)||t.kind!=="source-declaration"||!u(t.project,200))&&!(!Array.isArray(t.sources)||!t.sources.every(r=>n(r)&&_(r)))&&!(!Array.isArray(t.problems)||!t.problems.every(r=>typeof r=="string")))return t}a(asSourceDeclarationRaw,"asSourceDeclarationRaw"),e(asSourceDeclarationRaw,"asSourceDeclarationRaw");
1
+ "use strict";var U=Object.defineProperty;var u=(e,r)=>U(e,"name",{value:r,configurable:!0});var v=Object.defineProperty,c=u((e,r)=>v(e,"name",{value:r,configurable:!0}),"a"),I=Object.defineProperty,n=c((e,r)=>I(e,"name",{value:r,configurable:!0}),"r");export const SOURCE_KINDS=["queue","loop","store","traffic"],SOURCE_KINDS_READ=["queue","loop","store","traffic"],sourceWireSchema=n(e=>`lensmcp.${e}/v1`,"sourceWireSchema"),QUEUE_WIRE_SCHEMA="lensmcp.queue/v1",LOOP_WIRE_SCHEMA="lensmcp.loop/v1",STORE_WIRE_SCHEMA="lensmcp.store/v1",TRAFFIC_WIRE_SCHEMA="lensmcp.traffic/v1",SOURCE_SNAPSHOT_FIELD={queue:"snapshot",loop:"loop",store:"store",traffic:"traffic"},URI_SOURCES="process://sources",SOURCE_PROVENANCE="reported",QUEUE_OLDEST_WAIT_RULE="queue/oldest-wait",QUEUE_STALLED_RULE="queue/stalled",LOOP_OVERDUE_RULE="loop/overdue",LOOP_FAILING_RULE="loop/failing",LOOP_IDLE_RULE="loop/idle-while-fed",STORE_QUOTA_RULE="store/near-quota",STORE_ERRORS_RULE="store/errors",STORE_ORPHANS_RULE="store/orphans",TRAFFIC_FAILURES_RULE="traffic/failures",TRAFFIC_LATENCY_RULE="traffic/latency",TRAFFIC_RATE_LIMITED_RULE="traffic/rate-limited",SOURCE_RULES=[QUEUE_OLDEST_WAIT_RULE,QUEUE_STALLED_RULE,LOOP_OVERDUE_RULE,LOOP_FAILING_RULE,LOOP_IDLE_RULE,STORE_QUOTA_RULE,STORE_ERRORS_RULE,STORE_ORPHANS_RULE,TRAFFIC_FAILURES_RULE,TRAFFIC_LATENCY_RULE,TRAFFIC_RATE_LIMITED_RULE],SOURCE_EVENT_KINDS=["source-poll","source-declaration","source-event"],CUSTOM_EVENT_SOURCE="custom",QUEUE_EVENTS=["enqueued","admitted","completed","failed","parked"],LOOP_EVENTS=["run-start","run-end"],LOOP_OUTCOMES=["ok","failed","skipped"],STORE_EVENTS=["write","delete","error"],TRAFFIC_EVENTS=["inbound","outbound"],TRAFFIC_OUTCOMES=["ok","failed","rate-limited"],SOURCE_PUSH_EVENTS={queue:QUEUE_EVENTS,loop:LOOP_EVENTS,store:STORE_EVENTS,traffic:TRAFFIC_EVENTS},SOURCE_PUSH_OUTCOMES={queue:[],loop:LOOP_OUTCOMES,store:[],traffic:TRAFFIC_OUTCOMES},SOURCE_POLL_STATES=["current","unreachable","refused","malformed","not-running"],SOURCE_STATES=[...SOURCE_POLL_STATES,"stale","never-polled"],SOURCE_DEFAULT_INTERVAL_SEC=10,SOURCE_MIN_INTERVAL_SEC=2,QUEUE_DEFAULT_OLDEST_WAIT_MIN=10,QUEUE_DEFAULT_STALLED_MIN=15,LOOP_DEFAULT_IDLE_MIN=10,LOOP_OVERDUE_INTERVALS=2,LOOP_FAILING_RUNS=3,SOURCE_FULL_REPORT_MS=6e4,SOURCE_HISTORY_POINTS=60,SOURCE_RUNS_KEPT=30,SOURCE_PUSHED_KEPT=20,STORE_DEFAULT_QUOTA_PCT=90,STORE_DEFAULT_ERROR_RATE_PCT=5,STORE_DEFAULT_ORPHAN_MIN=60,TRAFFIC_DEFAULT_FAILURE_PCT=5,TRAFFIC_DEFAULT_P95_MS=2e3,TRAFFIC_DEFAULT_RATE_LIMITED=1,TRAFFIC_MIN_MESSAGES=10,TRAFFIC_PUSH_WINDOW_MS=10*6e4,TRAFFIC_PUSH_CHANNELS=50,TRAFFIC_PUSH_EVENTS_PER_CHANNEL=1e3,SOURCE_MAX_GROUPS=500,SOURCE_MAX_BYTES=256*1024,SOURCE_STALE_PERIODS=3,SOURCE_STALE_MIN_MS=3e4;export function sourceStaleAfterMs(e){return Math.max(SOURCE_STALE_MIN_MS,SOURCE_STALE_PERIODS*Math.max(0,e))}u(sourceStaleAfterMs,"sourceStaleAfterMs"),c(sourceStaleAfterMs,"sourceStaleAfterMs"),n(sourceStaleAfterMs,"sourceStaleAfterMs");const i=n(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj"),t=n(e=>typeof e=="number"&&Number.isInteger(e)&&e>=0,"isCount"),E=n(e=>typeof e=="number"&&Number.isFinite(e)&&e>0,"isTime"),a=n((e,r)=>typeof e=="string"&&e.length>0&&e.length<=r,"isStr"),L=n(e=>e===void 0||typeof e=="number"&&e>0,"isMin");function _(e){if(!SOURCE_KINDS_READ.includes(e.sourceKind)||typeof e.path!="string"&&!(e.path===void 0&&(e.sourceKind==="traffic"||e.sourceKind==="loop"))||!a(e.name,200)||typeof e.intervalSec!="number"||e.feeds!==void 0&&!a(e.feeds,200))return!1;const r=e.thresholds;if(!i(r))return!1;for(const o of["stalledMin","idleMin","oldestWaitMin","quotaPct","errorRatePct","orphanMin","failurePct","p95Ms","rateLimited"])if(!L(r[o]))return!1;return e.sourceKind!=="queue"||typeof r.oldestWaitMin=="number"}u(_,"_"),c(_,"l"),n(_,"asDecl");const d=n(e=>e===null||typeof e=="string","isIsoOrNull"),l=n(e=>e===void 0||t(e),"isOptCount");function f(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!E(e.intervalSec)||!d(e.lastRunAt)||e.nextRunAt!==void 0&&!d(e.nextRunAt))return!1;for(const r of["lastDurationMs","lastItems","runsInWindow","itemsInWindow","failuresInWindow","windowSec"])if(!l(e[r]))return!1;return e.lastOutcome!==void 0&&!LOOP_OUTCOMES.includes(e.lastOutcome)?!1:e.lastError===void 0||typeof e.lastError=="string"}u(f,"d"),c(f,"_"),n(f,"asLoopSnapshot");const T=n(e=>e===void 0||i(e)&&Object.values(e).every(r=>typeof r=="string"),"isLabels");function S(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!t(e.objects)||!t(e.bytes)||e.quotaBytes!==void 0&&e.quotaBytes!==null&&!t(e.quotaBytes))return!1;for(const s of["opsInWindow","writesInWindow","deletesInWindow","errorsInWindow","windowSec"])if(!l(e[s]))return!1;if(e.lastWriteAt!==void 0&&!d(e.lastWriteAt)||e.lastError!==void 0&&typeof e.lastError!="string")return!1;const r=e.truncated;if(r!==void 0&&!(i(r)&&t(r.groups)))return!1;const o=e.groups;return o===void 0?!0:Array.isArray(o)&&o.length<=SOURCE_MAX_GROUPS&&o.every(s=>i(s)&&a(s.group,1e3)&&t(s.objects)&&t(s.bytes)&&T(s.labels))}u(S,"S"),c(S,"S"),n(S,"asStoreSnapshot");function R(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!Array.isArray(e.channels)||!l(e.windowSec))return!1;const r=e.truncated;return r!==void 0&&!(i(r)&&t(r.channels))?!1:e.channels.length<=SOURCE_MAX_GROUPS&&e.channels.every(o=>{if(!i(o)||!a(o.channel,1e3)||!T(o.labels)||o.direction!==void 0&&o.direction!=="inbound"&&o.direction!=="outbound"||o.counterpart!==void 0&&!a(o.counterpart,200))return!1;for(const s of["messagesInWindow","failuresInWindow","rateLimitedInWindow"])if(!l(o[s]))return!1;return o.p95Ms!==void 0&&!(typeof o.p95Ms=="number"&&Number.isFinite(o.p95Ms)&&o.p95Ms>=0)||o.lastAt!==void 0&&!d(o.lastAt)?!1:o.lastError===void 0||typeof o.lastError=="string"})}u(R,"p"),c(R,"R"),n(R,"asTrafficSnapshot");function p(e){return i(e)&&a(e.digest,100)&&typeof e.at=="string"&&E(e.receivedAt)}u(p,"R"),c(p,"A"),n(p,"asSame");function A(e){if(!i(e)||!a(e.group,1e3)||!t(e.pending))return!1;for(const s of["inFlight","failed","completedInWindow"])if(e[s]!==void 0&&!t(e[s]))return!1;const r=e.oldestPendingAt;if(r!=null&&typeof r!="string")return!1;const o=e.labels;return o===void 0||i(o)&&Object.values(o).every(s=>typeof s=="string")}u(A,"A"),c(A,"O"),n(A,"asGroup");function O(e){if(!i(e)||typeof e.at!="string"||!E(e.receivedAt)||!Array.isArray(e.groups))return!1;const r=e.totals;if(!i(r)||!t(r.groups)||!t(r.pending)||!t(r.inFlight)||!t(r.failed))return!1;const o=e.truncated;return o!==void 0&&!(i(o)&&t(o.groups))?!1:e.groups.length<=SOURCE_MAX_GROUPS&&e.groups.every(A)}u(O,"O"),c(O,"T"),n(O,"asSnapshot");export function asSourcePollRaw(e){if(!i(e)||e.kind!=="source-poll"||!a(e.project,200)||!_(e)||!SOURCE_POLL_STATES.includes(e.state)||!E(e.polledAt)||!E(e.reportEveryMs)||e.path===void 0)return;const r=SOURCE_SNAPSHOT_FIELD[e.sourceKind];for(const s of Object.values(SOURCE_SNAPSHOT_FIELD))if(s!==r&&e[s]!==void 0)return;const o={snapshot:O,loop:f,store:S,traffic:R}[r];if(!(e[r]!==void 0&&!o(e[r]))&&!(e.same!==void 0&&(!p(e.same)||e[r]!==void 0))&&!(e.state==="current"&&e[r]===void 0&&e.same===void 0))return e}u(asSourcePollRaw,"asSourcePollRaw"),c(asSourcePollRaw,"asSourcePollRaw"),n(asSourcePollRaw,"asSourcePollRaw");export function asSourceEventRaw(e){if(!i(e)||e.kind!=="source-event"||!a(e.project,200)||!a(e.name,200))return;const r=e.sourceKind;if(SOURCE_KINDS_READ.includes(r)&&SOURCE_PUSH_EVENTS[r].includes(e.event)&&!(e.item!==void 0&&!a(e.item,200)||e.group!==void 0&&!a(e.group,200))&&!(!l(e.items)||!l(e.durationMs)||!l(e.bytes))&&!(e.outcome!==void 0&&!SOURCE_PUSH_OUTCOMES[r].includes(e.outcome))){for(const o of["object","channel","counterpart","correlation"])if(e[o]!==void 0&&!a(e[o],200))return;if(!(e.error!==void 0&&typeof e.error!="string"))return e}}u(asSourceEventRaw,"asSourceEventRaw"),c(asSourceEventRaw,"asSourceEventRaw"),n(asSourceEventRaw,"asSourceEventRaw");export function asSourceDeclarationRaw(e){if(!(!i(e)||e.kind!=="source-declaration"||!a(e.project,200))&&!(!Array.isArray(e.sources)||!e.sources.every(r=>i(r)&&_(r)))&&!(!Array.isArray(e.problems)||!e.problems.every(r=>typeof r=="string")))return e}u(asSourceDeclarationRaw,"asSourceDeclarationRaw"),c(asSourceDeclarationRaw,"asSourceDeclarationRaw"),n(asSourceDeclarationRaw,"asSourceDeclarationRaw");
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var c=(e,o)=>p(e,"name",{value:o,configurable:!0});var g=Object.defineProperty,l=c((e,o)=>g(e,"name",{value:o,configurable:!0}),"c");export const OWNER_WORKSPACE="(workspace)",OWNER_EXTERNAL="(external)",UNCOVERED_REASONS=["no-route","needs-build","tsgo-refused","parity-unproven","parity-differs","held-for-memory","not-in-census"],TOOL_ERROR_KINDS=["config-refused","program-error","timeout","signal","exit-without-diagnostics","spawn-failed","unparseable-output"];export function typecheckFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.code}`}c(typecheckFindingKey,"typecheckFindingKey"),l(typecheckFindingKey,"typecheckFindingKey");export function lintFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.ruleId??""}`}c(lintFindingKey,"lintFindingKey"),l(lintFindingKey,"lintFindingKey");const a=l((e,o)=>e.file<o.file?-1:e.file>o.file?1:e.line-o.line||e.col-o.col,"byPosition");export function dedupeTypecheckFindings(e,o){const n=new Map;for(const{program:i,diagnostics:r}of e)for(const t of r){const s=typecheckFindingKey(t),u=n.get(s);if(!u){n.set(s,{file:t.file,line:t.line,col:t.col,code:t.code,severity:t.severity,message:t.message,project:o(t.file),programs:[i]});continue}u.programs.includes(i)||u.programs.push(i),t.severity==="error"&&(u.severity="error")}const d=[...n.values()];for(const i of d)i.programs.sort();return d.sort((i,r)=>a(i,r)||(i.code<r.code?-1:i.code>r.code?1:0))}c(dedupeTypecheckFindings,"dedupeTypecheckFindings"),l(dedupeTypecheckFindings,"dedupeTypecheckFindings");export function dedupeLintFindings(e,o){const n=new Map;for(const{unit:r,messages:t}of e)for(const s of t){const u=lintFindingKey(s),f=n.get(u);if(!f){n.set(u,{file:s.file,line:s.line,col:s.col,ruleId:s.ruleId,severity:s.severity,message:s.message,project:o(s.file),units:[r],...s.fixable?{fixable:!0}:{}});continue}f.units.includes(r)||f.units.push(r),s.severity==="error"&&(f.severity="error")}const d=[...n.values()];for(const r of d)r.units.sort();const i=l(r=>r.ruleId??"","rule");return d.sort((r,t)=>a(r,t)||(i(r)<i(t)?-1:i(r)>i(t)?1:0))}c(dedupeLintFindings,"dedupeLintFindings"),l(dedupeLintFindings,"dedupeLintFindings");export function verdictOf(e){const{errors:o,coverage:n}=e;return o>0?"errors":n.toolErrors.length>0||n.inScope<=0||n.checked.count<=0?"no-verdict":n.stale.length>0||n.notCovered.length>0||n.checked.count<n.inScope?"partial":"clean"}c(verdictOf,"verdictOf"),l(verdictOf,"verdictOf");export function exitCodeOf(e,o={}){return e==="errors"?1:e==="clean"||e==="partial"&&o.allowPartial?0:2}c(exitCodeOf,"exitCodeOf"),l(exitCodeOf,"exitCodeOf");
1
+ "use strict";var g=Object.defineProperty;var c=(e,n)=>g(e,"name",{value:n,configurable:!0});var y=Object.defineProperty,u=c((e,n)=>y(e,"name",{value:n,configurable:!0}),"c"),v=Object.defineProperty,l=u((e,n)=>v(e,"name",{value:n,configurable:!0}),"c");export const OWNER_WORKSPACE="(workspace)",OWNER_EXTERNAL="(external)",UNCOVERED_REASONS=["no-route","needs-build","tsgo-refused","parity-unproven","parity-differs","held-for-memory","not-in-census"],TOOL_ERROR_KINDS=["config-refused","program-error","timeout","signal","exit-without-diagnostics","spawn-failed","unparseable-output"];export function typecheckFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.code}`}c(typecheckFindingKey,"typecheckFindingKey"),u(typecheckFindingKey,"typecheckFindingKey"),l(typecheckFindingKey,"typecheckFindingKey");export function lintFindingKey(e){return`${e.file}:${e.line}:${e.col}:${e.ruleId??""}`}c(lintFindingKey,"lintFindingKey"),u(lintFindingKey,"lintFindingKey"),l(lintFindingKey,"lintFindingKey");const p=l((e,n)=>e.file<n.file?-1:e.file>n.file?1:e.line-n.line||e.col-n.col,"byPosition");export function dedupeTypecheckFindings(e,n){const i=new Map;for(const{program:t,diagnostics:r}of e)for(const o of r){const s=typecheckFindingKey(o),d=i.get(s);if(!d){i.set(s,{file:o.file,line:o.line,col:o.col,code:o.code,severity:o.severity,message:o.message,project:n(o.file),programs:[t]});continue}d.programs.includes(t)||d.programs.push(t),o.severity==="error"&&(d.severity="error")}const f=[...i.values()];for(const t of f)t.programs.sort();return f.sort((t,r)=>p(t,r)||(t.code<r.code?-1:t.code>r.code?1:0))}c(dedupeTypecheckFindings,"dedupeTypecheckFindings"),u(dedupeTypecheckFindings,"dedupeTypecheckFindings"),l(dedupeTypecheckFindings,"dedupeTypecheckFindings");export function dedupeLintFindings(e,n){const i=new Map;for(const{unit:r,messages:o}of e)for(const s of o){const d=lintFindingKey(s),a=i.get(d);if(!a){i.set(d,{file:s.file,line:s.line,col:s.col,ruleId:s.ruleId,severity:s.severity,message:s.message,project:n(s.file),units:[r],...s.fixable?{fixable:!0}:{}});continue}a.units.includes(r)||a.units.push(r),s.severity==="error"&&(a.severity="error")}const f=[...i.values()];for(const r of f)r.units.sort();const t=l(r=>r.ruleId??"","rule");return f.sort((r,o)=>p(r,o)||(t(r)<t(o)?-1:t(r)>t(o)?1:0))}c(dedupeLintFindings,"dedupeLintFindings"),u(dedupeLintFindings,"dedupeLintFindings"),l(dedupeLintFindings,"dedupeLintFindings");export function verdictOf(e){const{errors:n,coverage:i}=e;return n>0?"errors":i.toolErrors.length>0||i.inScope<=0||i.checked.count<=0?"no-verdict":i.stale.length>0||i.notCovered.length>0||i.checked.count<i.inScope?"partial":"clean"}c(verdictOf,"verdictOf"),u(verdictOf,"verdictOf"),l(verdictOf,"verdictOf");export function exitCodeOf(e,n={}){return e==="errors"?1:e==="clean"||e==="partial"&&n.allowPartial?0:2}c(exitCodeOf,"exitCodeOf"),u(exitCodeOf,"exitCodeOf"),l(exitCodeOf,"exitCodeOf");
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var r=(e,n)=>o(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,s=r((e,n)=>a(e,"name",{value:n,configurable:!0}),"n");export function systemScopeId(e){return e.kind==="machine"?"machine":e.kind==="repository"?`repo:${e.repoId}`:`ws:${e.key}`}r(systemScopeId,"systemScopeId"),s(systemScopeId,"systemScopeId");export function systemItemKey(e,n){return`${systemScopeId(e)}/${n}`}r(systemItemKey,"systemItemKey"),s(systemItemKey,"systemItemKey");export function systemValue(e,n){switch(n){case"bytes":{const t=e/1073741824;return t>=1?`${t.toFixed(t>=100?0:1)} GB`:`${Math.round(e/1024**2)} MB`}case"ms":return e>=1e3?`${(e/1e3).toFixed(1)} s`:`${Math.round(e)} ms`;case"percent":return`${Math.round(e)} %`;case"usd":return`$${e.toFixed(2)}`;case"load":return`load ${e.toFixed(1)}`;case"minutes":return`${Math.round(e)} min`;default:return String(e)}}r(systemValue,"systemValue"),s(systemValue,"systemValue");export function systemScopeLabel(e){return e.kind==="machine"?"machine":e.kind==="repository"?e.name:`${e.name} lens`}r(systemScopeLabel,"systemScopeLabel"),s(systemScopeLabel,"systemScopeLabel");const u={"n/a":0,ok:1,warn:2,bad:3};export function systemStatusRank(e){return u[e]}r(systemStatusRank,"systemStatusRank"),s(systemStatusRank,"systemStatusRank");
1
+ "use strict";var o=Object.defineProperty;var s=(e,t)=>o(e,"name",{value:t,configurable:!0});var u=Object.defineProperty,n=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"r"),c=Object.defineProperty,r=n((e,t)=>c(e,"name",{value:t,configurable:!0}),"n");export function systemScopeId(e){return e.kind==="machine"?"machine":e.kind==="repository"?`repo:${e.repoId}`:`ws:${e.key}`}s(systemScopeId,"systemScopeId"),n(systemScopeId,"systemScopeId"),r(systemScopeId,"systemScopeId");export function systemItemKey(e,t){return`${systemScopeId(e)}/${t}`}s(systemItemKey,"systemItemKey"),n(systemItemKey,"systemItemKey"),r(systemItemKey,"systemItemKey");export function systemValue(e,t){switch(t){case"bytes":{const a=e/1073741824;return a>=1?`${a.toFixed(a>=100?0:1)} GB`:`${Math.round(e/1024**2)} MB`}case"ms":return e>=1e3?`${(e/1e3).toFixed(1)} s`:`${Math.round(e)} ms`;case"percent":return`${Math.round(e)} %`;case"usd":return`$${e.toFixed(2)}`;case"load":return`load ${e.toFixed(1)}`;case"minutes":return`${Math.round(e)} min`;default:return String(e)}}s(systemValue,"systemValue"),n(systemValue,"systemValue"),r(systemValue,"systemValue");export function systemScopeLabel(e){return e.kind==="machine"?"machine":e.kind==="repository"?e.name:`${e.name} lens`}s(systemScopeLabel,"systemScopeLabel"),n(systemScopeLabel,"systemScopeLabel"),r(systemScopeLabel,"systemScopeLabel");const m={"n/a":0,ok:1,warn:2,bad:3};export function systemStatusRank(e){return m[e]}s(systemStatusRank,"systemStatusRank"),n(systemStatusRank,"systemStatusRank"),r(systemStatusRank,"systemStatusRank");
@@ -136,6 +136,54 @@ export interface TeamDesignBasis {
136
136
  projects: string[];
137
137
  trackedFiles: number;
138
138
  at: number;
139
+ /**
140
+ * The team's files as the run read them (planning/team/27): `.lensmcp/team/…` path → sha256 of its text. A file whose
141
+ * text is not this any more changed after the run read it — accepting the run's version of it overwrites that change.
142
+ * Absent on runs made before it was kept: those are compared by the file's modification time against the run's start.
143
+ */
144
+ teamFiles?: Record<string, string>;
145
+ }
146
+ /**
147
+ * What a change does to one role file, counted by LensMCP from the file before and after it, with no model
148
+ * (planning/team/27) — so the person reads «+12 skills, −290 characters of rules» instead of a diff. Each field is
149
+ * there only when it moves; `[before, after]` pairs, and lists of what was added and what was removed.
150
+ */
151
+ export interface TeamFileEffect {
152
+ /** The file is new (no file before), or goes (no file after). */
153
+ created?: true;
154
+ deleted?: true;
155
+ /** Characters of the role's own rules (its `<rules>` sections), before → after. */
156
+ rulesChars?: [number, number];
157
+ /** Rule sections (`<rules id=…>`) added and removed, by id. */
158
+ sections?: {
159
+ added: string[];
160
+ removed: string[];
161
+ };
162
+ skills?: {
163
+ added: string[];
164
+ removed: string[];
165
+ };
166
+ /** Tool lines added and removed, and the tools whose reason changed. */
167
+ tools?: {
168
+ added: string[];
169
+ removed: string[];
170
+ reasons: string[];
171
+ };
172
+ owns?: {
173
+ added: string[];
174
+ removed: string[];
175
+ };
176
+ takes?: {
177
+ added: string[];
178
+ removed: string[];
179
+ };
180
+ base?: [string | null, string | null];
181
+ agents?: [number | null, number | null];
182
+ model?: [string | null, string | null];
183
+ effort?: [string | null, string | null];
184
+ start?: [string | null, string | null];
185
+ /** The file is not a role file (the brief): its characters, before → after. */
186
+ chars?: [number, number];
139
187
  }
140
188
  export interface TeamDesign {
141
189
  version: typeof TEAM_DESIGN_VERSION;
@@ -185,6 +233,11 @@ export interface DashTeamDesignRun {
185
233
  files: string[];
186
234
  goals: string[];
187
235
  };
236
+ /**
237
+ * A done design not accepted yet, against the team as it is NOW (planning/team/27): per role what accepting it would
238
+ * change in that role's file, and what it would undo. Worked out on every read with no model; never kept.
239
+ */
240
+ now?: DashTeamDesignNow;
188
241
  /**
189
242
  * How its research went, from the run's record: the tool calls it made of the most it had, its ceiling, its turns,
190
243
  * and why it ended — Claude answered on its own, the ceiling asked for the answer, or the tool calls ran out.
@@ -197,6 +250,46 @@ export interface DashTeamDesignRun {
197
250
  ended: 'answered' | 'ceiling' | 'tool-calls';
198
251
  };
199
252
  }
253
+ /** One role of a design against its file now: what accepting that role would write over what is there. */
254
+ export interface DashTeamDesignRoleNow {
255
+ id: string;
256
+ /** `.lensmcp/team/roles/<id>.md`. */
257
+ file: string;
258
+ /** `new`: no file; `replaces`: the repository's own file, rewritten whole; `refines`: a LensMCP default refined. */
259
+ is: 'new' | 'replaces' | 'refines';
260
+ /** The file now → the file accepting writes. */
261
+ effect: TeamFileEffect;
262
+ /** The file changed after the design read it (its hash, or its modification time on an older run). */
263
+ changedSince?: true;
264
+ /** Tune changes written to this file after the design ran: accepting the role writes over them. */
265
+ undoes?: Array<{
266
+ runId: string;
267
+ id: string;
268
+ title: string;
269
+ }>;
270
+ }
271
+ /** A role the design switches off, and the file that goes (the repository's own) or the default that stops. */
272
+ export interface DashTeamDesignOffNow {
273
+ id: string;
274
+ file: string;
275
+ exists: boolean;
276
+ changedSince?: true;
277
+ }
278
+ export interface DashTeamDesignNow {
279
+ roles: DashTeamDesignRoleNow[];
280
+ off: DashTeamDesignOffNow[];
281
+ /** The brief the design writes, against `.lensmcp/team/project.md` now. */
282
+ brief?: {
283
+ exists: boolean;
284
+ effect: TeamFileEffect;
285
+ changedSince?: true;
286
+ };
287
+ /** The flow file, when the design changes the flow (`keep: false`). */
288
+ flow?: {
289
+ exists: boolean;
290
+ changedSince?: true;
291
+ };
292
+ }
200
293
  /** What the person keeps of a design. Roles they edited carry their own rules. */
201
294
  export interface DashTeamDesignAccept {
202
295
  runId: string;
@@ -353,7 +446,8 @@ export type TeamCheckupGroup = (typeof TEAM_CHECKUP_GROUPS)[number];
353
446
  * `old-flow`, `duplicate-of-base`, `filler-reason`, `cap-mismatch`, `copied`, `check-unread`, `failed-twice`,
354
447
  * `lesson-stale`;
355
448
  * - skills — `skills-unheld`: project skills no role holds; `role-without-skills`: a role whose kind of work has
356
- * project skills and holds none, with a proposed assignment;
449
+ * project skills and holds none — a finding with the names that match, never a patch: names are not the skills'
450
+ * descriptions, and «Tune the team» reads those (planning/team/27 F2);
357
451
  * - weight — `heavy-instructions`: an instruction file an agent's client loads, past 40,000 characters; `heavy-rules`:
358
452
  * a role file's rules past the length a join carries well; `past-cut`, `long-craft`: text a join cuts or carries long;
359
453
  * - proposals — `open-proposal`: a retrospective's or the overseer's open proposal about the team's files.
@@ -371,8 +465,9 @@ export interface TeamCheckupEdit {
371
465
  }
372
466
  /**
373
467
  * A ready patch to one team file. `safe`: mechanical — it changes no rule and takes no tool or skill a role uses (a
374
- * filler reason replaced by the library's own, a name that resolves nowhere removed, the base's version recorded). A
375
- * patch that is not safe is a proposal (a skills assignment): the person picks it by itself.
468
+ * filler tool line removed where the role's base names the tool, or its reason replaced by the one reason the base's
469
+ * family gives it — planning/team/27 F3; a name that resolves nowhere removed; the base's version recorded). A patch
470
+ * that is not safe is one the person picks by itself (a moved base).
376
471
  */
377
472
  export interface TeamCheckupPatch {
378
473
  file: string;
@@ -496,6 +591,21 @@ export interface TeamTuneChange {
496
591
  at: number;
497
592
  problem?: string;
498
593
  };
594
+ /**
595
+ * The change against its file as it is NOW, worked out by LensMCP on every read with no model (planning/team/27) —
596
+ * on a change with no verdict, or accepted but not written; never kept. `changed`: the file is not what the tune read
597
+ * for this change (the diff made now differs from `diff`). `applies`: its edits still stand once and the file still
598
+ * loads after them — else `problem` says why, and accepting would not write it: the page offers to tune again.
599
+ * `diff`: against the file as it is now, when it changed and still applies.
600
+ */
601
+ now?: {
602
+ changed: boolean;
603
+ applies: boolean;
604
+ problem?: string;
605
+ diff?: string;
606
+ };
607
+ /** What it does to its file (against the file as it is now when `now` is set). */
608
+ effect?: TeamFileEffect;
499
609
  }
500
610
  /** A tune's answer, as LensMCP checked it: a change set, never whole roles. */
501
611
  export interface TeamTune {
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,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;
1
+ "use strict";var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});var n=Object.defineProperty,o=r((t,e)=>n(t,"name",{value:e,configurable:!0}),"r"),a=Object.defineProperty,c=o((t,e)=>a(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"),o(modelClient,"modelClient"),c(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.26.12",
3
+ "version": "1.26.13",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",