@codeam/shared 2.61.77 → 2.61.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1896,6 +1896,145 @@ function getIntegrationBranding(id) {
1896
1896
  return INTEGRATION_BRANDING[id] ?? null;
1897
1897
  }
1898
1898
 
1899
+ // src/integrations/stack-detect.ts
1900
+ var DEP_TO_INTEGRATION = {
1901
+ // errors / observability
1902
+ "@sentry/node": "sentry",
1903
+ "@sentry/react": "sentry",
1904
+ "@sentry/nextjs": "sentry",
1905
+ "@sentry/browser": "sentry",
1906
+ "sentry-sdk": "sentry",
1907
+ "dd-trace": "datadog",
1908
+ "datadog-api-client": "datadog",
1909
+ "datadog-metrics": "datadog",
1910
+ // analytics
1911
+ "posthog-js": "posthog",
1912
+ "posthog-node": "posthog",
1913
+ posthog: "posthog",
1914
+ mixpanel: "mixpanel",
1915
+ "mixpanel-browser": "mixpanel",
1916
+ // database / backend platforms
1917
+ convex: "convex",
1918
+ "@supabase/supabase-js": "supabase",
1919
+ "supabase": "supabase",
1920
+ // infra / deploy
1921
+ vercel: "vercel",
1922
+ "@vercel/node": "vercel",
1923
+ wrangler: "cloudflare",
1924
+ // comms
1925
+ "@slack/web-api": "slack",
1926
+ "@slack/bolt": "slack",
1927
+ "discord.js": "discord",
1928
+ "discord-py": "discord",
1929
+ "discord": "discord",
1930
+ // trackers / docs / design
1931
+ "@linear/sdk": "linear",
1932
+ "@notionhq/client": "notion",
1933
+ "jira.js": "jira",
1934
+ jira: "jira",
1935
+ newman: "postman",
1936
+ "figma-api": "figma",
1937
+ "figma-js": "figma",
1938
+ // email / automation
1939
+ resend: "resend",
1940
+ n8n: "n8n"
1941
+ };
1942
+ var DEP_PREFIX_TO_INTEGRATION = [
1943
+ ["@sentry/", "sentry"],
1944
+ ["@vercel/", "vercel"],
1945
+ ["@cloudflare/", "cloudflare"],
1946
+ ["@supabase/", "supabase"],
1947
+ ["@slack/", "slack"],
1948
+ ["@datadog/", "datadog"],
1949
+ ["@linear/", "linear"],
1950
+ ["@notionhq/", "notion"]
1951
+ ];
1952
+ var FRONTEND_MARKERS = [
1953
+ "react",
1954
+ "react-dom",
1955
+ "next",
1956
+ "vue",
1957
+ "nuxt",
1958
+ "@angular/core",
1959
+ "svelte",
1960
+ "@sveltejs/kit",
1961
+ "solid-js",
1962
+ "astro",
1963
+ "gatsby",
1964
+ "remix",
1965
+ "@remix-run/react"
1966
+ ];
1967
+ var MOBILE_MARKERS = ["react-native", "expo", "@react-native/core", "@ionic/core", "flutter"];
1968
+ var BACKEND_MARKERS = [
1969
+ "express",
1970
+ "fastify",
1971
+ "@nestjs/core",
1972
+ "koa",
1973
+ "@hapi/hapi",
1974
+ "django",
1975
+ "flask",
1976
+ "fastapi",
1977
+ "rails",
1978
+ "sinatra",
1979
+ "gin-gonic",
1980
+ "laravel/framework",
1981
+ "actix-web",
1982
+ "spring-boot"
1983
+ ];
1984
+ function hasAny(deps, markers) {
1985
+ for (const m of markers) if (deps.has(m)) return true;
1986
+ return false;
1987
+ }
1988
+ function classifyStack(depNames) {
1989
+ const deps = new Set(depNames);
1990
+ const mobile = hasAny(deps, MOBILE_MARKERS);
1991
+ if (mobile) return "mobile";
1992
+ const frontend = hasAny(deps, FRONTEND_MARKERS);
1993
+ const backend = hasAny(deps, BACKEND_MARKERS);
1994
+ if (frontend && backend) return "fullstack";
1995
+ if (frontend) return "frontend";
1996
+ if (backend) return "backend";
1997
+ return "unknown";
1998
+ }
1999
+ function detectedIntegrationsFromDeps(depNames) {
2000
+ const out = [];
2001
+ const seen = /* @__PURE__ */ new Set();
2002
+ const push = (id) => {
2003
+ if (!seen.has(id)) {
2004
+ seen.add(id);
2005
+ out.push(id);
2006
+ }
2007
+ };
2008
+ for (const name of depNames) {
2009
+ const exact = DEP_TO_INTEGRATION[name];
2010
+ if (exact) {
2011
+ push(exact);
2012
+ continue;
2013
+ }
2014
+ for (const [prefix, id] of DEP_PREFIX_TO_INTEGRATION) {
2015
+ if (name.startsWith(prefix)) {
2016
+ push(id);
2017
+ break;
2018
+ }
2019
+ }
2020
+ }
2021
+ return out;
2022
+ }
2023
+ var STACK_TO_RECOMMENDED = {
2024
+ frontend: ["figma", "sentry", "posthog", "vercel"],
2025
+ backend: ["sentry", "datadog", "supabase", "convex", "cloudflare"],
2026
+ fullstack: ["sentry", "posthog", "vercel", "supabase", "convex"],
2027
+ mobile: ["sentry", "posthog"],
2028
+ unknown: []
2029
+ };
2030
+ function recommendForDeps(depNames) {
2031
+ const stack = classifyStack(depNames);
2032
+ const detected = detectedIntegrationsFromDeps(depNames);
2033
+ const detectedSet = new Set(detected);
2034
+ const recommended = STACK_TO_RECOMMENDED[stack].filter((id) => !detectedSet.has(id));
2035
+ return { stack, detected, recommended, source: "scan" };
2036
+ }
2037
+
1899
2038
  // src/skills/code-review.ts
1900
2039
  var CODE_REVIEW_BODY = `Use this skill when reviewing a pull request. It defines what a high-signal
1901
2040
  review looks like so your inline comments are worth the author's time.
@@ -2330,6 +2469,14 @@ var USER_EVENTS = {
2330
2469
  INTEGRATION_LINKED: "integration_linked",
2331
2470
  INTEGRATION_UNLINKED: "integration_unlinked",
2332
2471
  INTEGRATION_CREDENTIAL_INVALID: "integration_credential_invalid",
2472
+ // Session Tools — add/remove Agent Toolkit integrations on an ALREADY-ACTIVE
2473
+ // session. The backend publishes SESSION_INTEGRATIONS_CHANGED after it persists
2474
+ // the new attached set + relays `integrations_sync` to the box (the CLI rewrites
2475
+ // the manifest + reprovisions the live agent, answered synchronously via the
2476
+ // command result). Drives live UI on the sending device AND any other paired
2477
+ // device on the same session. Mirrored in repo A. (`integrations_detect` is a
2478
+ // pure request/response over the relay — no event.)
2479
+ SESSION_INTEGRATIONS_CHANGED: "session_integrations_changed",
2333
2480
  // CodeRabbit reviewer — the CLI posts these to /api/coderabbit/events; the
2334
2481
  // backend re-publishes them on the per-user SSE bus (mirrored in repo A).
2335
2482
  CODERABBIT_PROGRESS: "coderabbit_progress",
@@ -2395,6 +2542,7 @@ OUTPUT JSON ONLY. NO MARKDOWN. NO COMMENTARY.
2395
2542
  export {
2396
2543
  AGENT_REGISTRY,
2397
2544
  DEFAULT_API_BASE_URL,
2545
+ DEP_TO_INTEGRATION,
2398
2546
  DEV_API_BASE_URL,
2399
2547
  HEADROOM_BACKEND_ENV,
2400
2548
  HEADROOM_EXTRAS_BY_SURFACE,
@@ -2419,10 +2567,13 @@ export {
2419
2567
  PUBLIC_TO_INTERNAL,
2420
2568
  SKILL_REGISTRY,
2421
2569
  SSE_SOCKET_TIMEOUT_MS,
2570
+ STACK_TO_RECOMMENDED,
2422
2571
  TERMINAL_AGENT_PREFIX,
2423
2572
  UNKNOWN_MODEL_PRICING,
2424
2573
  UPCOMING_INTEGRATION_IDS,
2425
2574
  USER_EVENTS,
2575
+ classifyStack,
2576
+ detectedIntegrationsFromDeps,
2426
2577
  getAgent,
2427
2578
  getContextWindow,
2428
2579
  getEnabledAgents,
@@ -2445,6 +2596,7 @@ export {
2445
2596
  isSkillId,
2446
2597
  normalizeAgentId,
2447
2598
  publicToInternal,
2599
+ recommendForDeps,
2448
2600
  renderToLines,
2449
2601
  resolveApiBaseUrl,
2450
2602
  skillHasRail,