lace-mcp 0.0.2-alpha.13 → 0.0.2-alpha.14

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 (2) hide show
  1. package/dist/cli.js +76 -19
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -6979,7 +6979,9 @@ function normalizeKey(key) {
6979
6979
  }
6980
6980
  function shouldRedactKey(key) {
6981
6981
  const normalized = normalizeKey(key);
6982
- if (SECRET_KEYS.has(normalized) || CONTENT_KEYS.has(normalized)) return true;
6982
+ if (SECRET_KEYS.has(normalized)) return true;
6983
+ if (SAFE_METADATA_KEYS.has(normalized)) return false;
6984
+ if (CONTENT_KEYS.has(normalized)) return true;
6983
6985
  return CONTENT_SUFFIXES.some((suffix) => normalized.endsWith(suffix));
6984
6986
  }
6985
6987
  function describeBinary(value) {
@@ -7062,7 +7064,7 @@ function sanitizeObservabilityProperties(properties) {
7062
7064
  if (!properties) return void 0;
7063
7065
  return sanitizeObservabilityPayload(properties);
7064
7066
  }
7065
- var OBSERVABILITY_REDACTED, OBSERVABILITY_MAX_ARRAY_ITEMS, DEFAULT_MAX_DEPTH, DATA_URL_PATTERN, LONG_STRING_LIMIT, SECRET_KEYS, CONTENT_KEYS, CONTENT_SUFFIXES, UNSANITIZED;
7067
+ var OBSERVABILITY_REDACTED, OBSERVABILITY_MAX_ARRAY_ITEMS, DEFAULT_MAX_DEPTH, DATA_URL_PATTERN, LONG_STRING_LIMIT, SECRET_KEYS, CONTENT_KEYS, CONTENT_SUFFIXES, SAFE_METADATA_KEYS, UNSANITIZED;
7066
7068
  var init_observability = __esm({
7067
7069
  "../../libs/shared/src/observability.ts"() {
7068
7070
  "use strict";
@@ -7114,7 +7116,6 @@ var init_observability = __esm({
7114
7116
  "answer",
7115
7117
  "body",
7116
7118
  "completion",
7117
- "content",
7118
7119
  "html",
7119
7120
  "image",
7120
7121
  "input",
@@ -7127,6 +7128,34 @@ var init_observability = __esm({
7127
7128
  "text",
7128
7129
  "transcript"
7129
7130
  ];
7131
+ SAFE_METADATA_KEYS = /* @__PURE__ */ new Set([
7132
+ "annotationcount",
7133
+ "app",
7134
+ "artifactcount",
7135
+ "canprompt",
7136
+ "currentstatus",
7137
+ "filecount",
7138
+ "granted",
7139
+ "hasautomaticuiparse",
7140
+ "hasgraphcontext",
7141
+ "hasproject",
7142
+ "hasscreencontext",
7143
+ "identified",
7144
+ "kind",
7145
+ "method",
7146
+ "pagecount",
7147
+ "permissionkind",
7148
+ "platform",
7149
+ "previousenabled",
7150
+ "previoushaselements",
7151
+ "rawstatus",
7152
+ "reason",
7153
+ "retrycount",
7154
+ "source",
7155
+ "surface",
7156
+ "thinkharder",
7157
+ "tool"
7158
+ ]);
7130
7159
  UNSANITIZED = Symbol("unsanitized");
7131
7160
  }
7132
7161
  });
@@ -7136,14 +7165,14 @@ function setAnalyticsIdentity(orgId) {
7136
7165
  distinctId = orgId;
7137
7166
  }
7138
7167
  function trackToolInvoked(tool) {
7139
- if (!distinctId) return;
7140
7168
  const properties = sanitizeObservabilityProperties({
7141
7169
  app: "mcp",
7142
- tool
7170
+ tool,
7171
+ identified: distinctId !== null
7143
7172
  });
7144
7173
  queue.push({
7145
7174
  event: MCP_EVENT,
7146
- distinct_id: distinctId,
7175
+ distinct_id: distinctId ?? ANONYMOUS_DISTINCT_ID,
7147
7176
  properties
7148
7177
  });
7149
7178
  }
@@ -7160,14 +7189,15 @@ async function flushAnalytics() {
7160
7189
  } catch {
7161
7190
  }
7162
7191
  }
7163
- var POSTHOG_API_KEY, POSTHOG_HOST, FLUSH_TIMEOUT_MS, queue, distinctId, MCP_EVENT;
7192
+ var POSTHOG_API_KEY, POSTHOG_HOST, FLUSH_TIMEOUT_MS, ANONYMOUS_DISTINCT_ID, queue, distinctId, MCP_EVENT;
7164
7193
  var init_analytics = __esm({
7165
7194
  "src/analytics.ts"() {
7166
7195
  "use strict";
7167
7196
  init_observability();
7168
- POSTHOG_API_KEY = process.env.POSTHOG_API_KEY ?? "";
7169
- POSTHOG_HOST = process.env.POSTHOG_HOST ?? "https://us.i.posthog.com";
7197
+ POSTHOG_API_KEY = "phc_PI54LjLx0OeL87sF26kvjUJM5X7kP36PktknitV2bZ1" ? "phc_PI54LjLx0OeL87sF26kvjUJM5X7kP36PktknitV2bZ1" : process.env.POSTHOG_API_KEY ?? "";
7198
+ POSTHOG_HOST = "https://us.i.posthog.com" ? "https://us.i.posthog.com" : process.env.POSTHOG_HOST ?? "https://us.i.posthog.com";
7170
7199
  FLUSH_TIMEOUT_MS = 3e3;
7200
+ ANONYMOUS_DISTINCT_ID = "mcp-anonymous";
7171
7201
  queue = [];
7172
7202
  distinctId = null;
7173
7203
  MCP_EVENT = "mcp_tool_invoked";
@@ -36924,10 +36954,34 @@ var init_decisionCanvas = __esm({
36924
36954
  });
36925
36955
 
36926
36956
  // ../../libs/shared/src/commentPlacementReadModel.ts
36927
- function isTrustedDecisionPlacement(placement) {
36928
- if (!isCanvasDecisionAnnotation(placement)) return false;
36929
- if (placement.resolved_at === null) return false;
36930
- return placement.anchor_state !== "detached" && placement.anchor_state !== "reanchored";
36957
+ function placementTime(placement) {
36958
+ const createdAt = Date.parse(placement.created_at);
36959
+ return Number.isFinite(createdAt) ? createdAt : 0;
36960
+ }
36961
+ function placementKey(placement) {
36962
+ const lineageId = placement.comment_lineage_id?.trim();
36963
+ return lineageId ? `lineage:${lineageId}` : `placement:${placement.id}`;
36964
+ }
36965
+ function isResolvedCommentPlacement(placement) {
36966
+ return placement.status === "resolved";
36967
+ }
36968
+ function currentCommentPlacements(placements) {
36969
+ const byLineage = /* @__PURE__ */ new Map();
36970
+ for (const placement of placements) {
36971
+ if (!isCanvasDecisionAnnotation(placement)) continue;
36972
+ const key = placementKey(placement);
36973
+ const existing = byLineage.get(key);
36974
+ if (!existing || placementTime(placement) > placementTime(existing)) {
36975
+ byLineage.set(key, placement);
36976
+ }
36977
+ }
36978
+ return Array.from(byLineage.values());
36979
+ }
36980
+ function resolvedDecisionPlacements(placements) {
36981
+ return currentCommentPlacements(placements).filter(isResolvedCommentPlacement);
36982
+ }
36983
+ function resolvedDecisionViews(placements) {
36984
+ return resolvedDecisionPlacements(placements);
36931
36985
  }
36932
36986
  var init_commentPlacementReadModel = __esm({
36933
36987
  "../../libs/shared/src/commentPlacementReadModel.ts"() {
@@ -36949,8 +37003,7 @@ function optionalAttr(name, value) {
36949
37003
  return attr(name, value);
36950
37004
  }
36951
37005
  function deriveDecisionStatus(decision) {
36952
- if (decision.resolved_at !== null) return "resolved";
36953
- return "suggested";
37006
+ return decision.status;
36954
37007
  }
36955
37008
  function canvasAnnotationToMcpDecisionView(decision) {
36956
37009
  return {
@@ -37007,8 +37060,8 @@ function dedupeMcpDecisionEntries(entries) {
37007
37060
  return [...seen.values()];
37008
37061
  }
37009
37062
  function deriveFlowContext(decision, allDecisions) {
37010
- const siblings = allDecisions.filter(
37011
- (candidate) => candidate.canvas_id === decision.canvas_id && isTrustedDecisionPlacement(candidate)
37063
+ const siblings = resolvedDecisionPlacements(allDecisions).filter(
37064
+ (candidate) => candidate.canvas_id === decision.canvas_id
37012
37065
  );
37013
37066
  if (siblings.length < 2) return null;
37014
37067
  const sorted = siblings.slice().sort((a, b) => {
@@ -37156,8 +37209,11 @@ async function loadMcpDecisionEntries() {
37156
37209
  credentialsMissing: false
37157
37210
  };
37158
37211
  }
37159
- const decisions = result.decisions;
37160
- const canvasEntries = decisions.filter((d) => d.resolved_at !== null).map((d) => ({ view: canvasAnnotationToMcpDecisionView(d), canvas: d }));
37212
+ const decisions = resolvedDecisionViews(result.decisions);
37213
+ const canvasEntries = decisions.map((d) => ({
37214
+ view: canvasAnnotationToMcpDecisionView(d),
37215
+ canvas: d
37216
+ }));
37161
37217
  const allDecisions = canvasEntries.map((entry) => entry.canvas);
37162
37218
  const deduped = dedupeMcpDecisionEntries(canvasEntries);
37163
37219
  const ranked = rankMcpDecisionViews(deduped.map((e) => e.view)).slice(0, 8);
@@ -37271,6 +37327,7 @@ var API_FETCH_TIMEOUT_MS;
37271
37327
  var init_decisions = __esm({
37272
37328
  "src/decisions.ts"() {
37273
37329
  "use strict";
37330
+ init_commentPlacementReadModel();
37274
37331
  init_mcpDecisionTools();
37275
37332
  init_auth();
37276
37333
  API_FETCH_TIMEOUT_MS = 1e4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lace-mcp",
3
- "version": "0.0.2-alpha.13",
3
+ "version": "0.0.2-alpha.14",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/cli.js",
@@ -27,6 +27,6 @@
27
27
  "install-claude-desktop": "tsx src/install.ts claude-desktop",
28
28
  "install-cursor": "tsx src/install.ts cursor",
29
29
  "install-codex": "tsx src/install.ts codex",
30
- "build": "rm -rf dist && esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.js"
30
+ "build": "rm -rf dist && node scripts/build.mjs"
31
31
  }
32
32
  }