@reticlehq/core 2.12.0 → 2.13.0

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.
@@ -690,72 +690,6 @@ export declare const BugFoundSchema: z.ZodObject<{
690
690
  fingerprint?: string | undefined;
691
691
  }>;
692
692
  export type BugFound = z.infer<typeof BugFoundSchema>;
693
- /**
694
- * WHY a tool could not do what was asked.
695
- *
696
- * Derived from the refusal paths that actually exist rather than invented: every member below is a
697
- * bucket over `error-recovery.ts`'s recovery table, which is the single place a thrown message is
698
- * turned into a next action. That table is the vocabulary; this is its coarse grouping, and a new
699
- * entry there cannot compile without being classified here.
700
- *
701
- * The five that matter belong to four different owners, which is the whole reason for splitting
702
- * them: `no_session` is the install's second half never happening, `bad_args` is the agent's own
703
- * call, `not_ready` is the environment, and `no_match` / `unsupported` are the app and our own
704
- * capability surface. One undifferentiated "the agent stopped" number cannot be acted on by anyone.
705
- */
706
- export declare const RefusalReason: {
707
- /** There was no app to reach: nothing connected, no session by that id, or several with none named. */
708
- readonly NO_SESSION: "no_session";
709
- /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */
710
- readonly NO_MATCH: "no_match";
711
- /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */
712
- readonly UNSUPPORTED: "unsupported";
713
- /** The call did not match the schema, or named a value our own validators reject. */
714
- readonly BAD_ARGS: "bad_args";
715
- /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */
716
- readonly NOT_READY: "not_ready";
717
- /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */
718
- readonly OTHER: "other";
719
- };
720
- export type RefusalReason = (typeof RefusalReason)[keyof typeof RefusalReason];
721
- /** One tool call that could not be served. */
722
- export declare const ToolRefusalSchema: z.ZodObject<{
723
- /** Which tool. A name from our own fixed namespace, never app data. */
724
- tool: z.ZodString;
725
- reason: z.ZodNativeEnum<{
726
- /** There was no app to reach: nothing connected, no session by that id, or several with none named. */
727
- readonly NO_SESSION: "no_session";
728
- /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */
729
- readonly NO_MATCH: "no_match";
730
- /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */
731
- readonly UNSUPPORTED: "unsupported";
732
- /** The call did not match the schema, or named a value our own validators reject. */
733
- readonly BAD_ARGS: "bad_args";
734
- /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */
735
- readonly NOT_READY: "not_ready";
736
- /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */
737
- readonly OTHER: "other";
738
- }>;
739
- /**
740
- * TRUE when the call immediately before this one was the SAME tool, also refused.
741
- *
742
- * Reported on the RETRY rather than on the first refusal, because the first refusal has to be sent
743
- * at the moment it happens: deferring it until the next call is known would lose it entirely for
744
- * the agent that gives up, and that agent is the whole population this event exists to describe.
745
- * So count `retried: true` for retries; the ratio against all refusals is whether our diagnosis
746
- * gets anybody unstuck.
747
- */
748
- retried: z.ZodBoolean;
749
- }, "strip", z.ZodTypeAny, {
750
- reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
751
- tool: string;
752
- retried: boolean;
753
- }, {
754
- reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
755
- tool: string;
756
- retried: boolean;
757
- }>;
758
- export type ToolRefusal = z.infer<typeof ToolRefusalSchema>;
759
693
  /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
760
694
  export declare const McpConnectionSchema: z.ZodObject<{
761
695
  /** False the first time a client attaches to this daemon; true for every attach after. */
@@ -768,14 +702,33 @@ export declare const McpConnectionSchema: z.ZodObject<{
768
702
  daemonAgeMs: z.ZodNumber;
769
703
  /** Which client, from its own handshake (`claude-code`, `cursor`). */
770
704
  client: z.ZodOptional<z.ZodString>;
705
+ /**
706
+ * Was an app carrying the SDK already attached to this daemon when the agent arrived.
707
+ *
708
+ * The mirror of `AppInstrumentation.agentAttached`, and the closest thing we have to WHAT THE
709
+ * AGENT SAW. Most clients that attach never call a single tool, and that cohort was reachable only
710
+ * by subtraction — `tool_refused` cannot describe it, because an agent that reads the server
711
+ * instructions, learns nothing is wired and stops has refused nothing. It made no call at all.
712
+ *
713
+ * `false` means the handshake happened against a daemon with no app to look at, which is the state
714
+ * the first-move instructions describe and the state in which no tool could have answered
715
+ * anything. Split the never-drove population on this and the two halves need opposite fixes: one
716
+ * is an install that never finished, the other is an agent that had everything it needed and did
717
+ * not use it.
718
+ *
719
+ * OPTIONAL because an older sender has none. Absent means not measured, never `false`.
720
+ */
721
+ appConnected: z.ZodOptional<z.ZodBoolean>;
771
722
  }, "strip", z.ZodTypeAny, {
772
723
  reconnect: boolean;
773
724
  daemonAgeMs: number;
774
725
  client?: string | undefined;
726
+ appConnected?: boolean | undefined;
775
727
  }, {
776
728
  reconnect: boolean;
777
729
  daemonAgeMs: number;
778
730
  client?: string | undefined;
731
+ appConnected?: boolean | undefined;
779
732
  }>;
780
733
  export type McpConnection = z.infer<typeof McpConnectionSchema>;
781
734
  /**
@@ -995,8 +948,23 @@ export declare const InitConfirmation: {
995
948
  readonly CONNECTED: "connected";
996
949
  /** Nothing was listening on the bridge port, so no session could arrive. Not a failed install. */
997
950
  readonly NO_DAEMON: "no_daemon";
998
- /** A daemon was up and no app connected inside the window — the dev server is the outstanding step. */
951
+ /**
952
+ * A daemon was up, no app connected, and no instrumented dev server announced itself either — so
953
+ * the dev server is the outstanding step.
954
+ *
955
+ * Meaning unchanged, deliberately, so the funnel stays comparable across the change that added
956
+ * NO_PAGE below. It is also still the honest answer for every stack whose plugin does not announce
957
+ * yet: nothing was observed, and "not observed" must never be reported as "not running".
958
+ */
999
959
  readonly NO_SESSION: "no_session";
960
+ /**
961
+ * A dev server with Reticle loaded IS running, and no page dialled.
962
+ *
963
+ * The half of NO_SESSION that used to be invisible, and the one with a completely different fix:
964
+ * the config is right and the process was restarted, so telling this person to restart their dev
965
+ * server is an instruction they have already followed. They need to open the app.
966
+ */
967
+ readonly NO_PAGE: "no_page";
1000
968
  };
1001
969
  export type InitConfirmation = (typeof InitConfirmation)[keyof typeof InitConfirmation];
1002
970
  /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
@@ -1020,21 +988,36 @@ export declare const InitOutcomeSchema: z.ZodObject<{
1020
988
  readonly CONNECTED: "connected";
1021
989
  /** Nothing was listening on the bridge port, so no session could arrive. Not a failed install. */
1022
990
  readonly NO_DAEMON: "no_daemon";
1023
- /** A daemon was up and no app connected inside the window — the dev server is the outstanding step. */
991
+ /**
992
+ * A daemon was up, no app connected, and no instrumented dev server announced itself either — so
993
+ * the dev server is the outstanding step.
994
+ *
995
+ * Meaning unchanged, deliberately, so the funnel stays comparable across the change that added
996
+ * NO_PAGE below. It is also still the honest answer for every stack whose plugin does not announce
997
+ * yet: nothing was observed, and "not observed" must never be reported as "not running".
998
+ */
1024
999
  readonly NO_SESSION: "no_session";
1000
+ /**
1001
+ * A dev server with Reticle loaded IS running, and no page dialled.
1002
+ *
1003
+ * The half of NO_SESSION that used to be invisible, and the one with a completely different fix:
1004
+ * the config is right and the process was restarted, so telling this person to restart their dev
1005
+ * server is an instruction they have already followed. They need to open the app.
1006
+ */
1007
+ readonly NO_PAGE: "no_page";
1025
1008
  }>>;
1026
1009
  }, "strip", z.ZodTypeAny, {
1027
1010
  ok: boolean;
1028
1011
  stack?: string | undefined;
1029
1012
  reason?: string | undefined;
1030
1013
  mcpRegistered?: boolean | undefined;
1031
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
1014
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
1032
1015
  }, {
1033
1016
  ok: boolean;
1034
1017
  stack?: string | undefined;
1035
1018
  reason?: string | undefined;
1036
1019
  mcpRegistered?: boolean | undefined;
1037
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
1020
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
1038
1021
  }>;
1039
1022
  export type InitOutcome = z.infer<typeof InitOutcomeSchema>;
1040
1023
  /**
@@ -1417,6 +1400,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1417
1400
  unknownToolCalls: z.ZodOptional<z.ZodNumber>;
1418
1401
  unknownTools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1419
1402
  noSessionErrors: z.ZodOptional<z.ZodNumber>;
1403
+ postSocketFailures: z.ZodOptional<z.ZodNumber>;
1404
+ postRetriesSaved: z.ZodOptional<z.ZodNumber>;
1420
1405
  consecutiveRepeats: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1421
1406
  abandonedActions: z.ZodOptional<z.ZodNumber>;
1422
1407
  machine: z.ZodOptional<z.ZodObject<{
@@ -1452,6 +1437,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1452
1437
  errorsRecovered: z.ZodOptional<z.ZodNumber>;
1453
1438
  errorsRepeated: z.ZodOptional<z.ZodNumber>;
1454
1439
  endedWithVerdict: z.ZodOptional<z.ZodBoolean>;
1440
+ updateNudged: z.ZodOptional<z.ZodBoolean>;
1441
+ updateOffered: z.ZodOptional<z.ZodString>;
1455
1442
  final: z.ZodBoolean;
1456
1443
  exit: z.ZodOptional<z.ZodEnum<["idle", "signal", "unknown"]>>;
1457
1444
  }, "strip", z.ZodTypeAny, {
@@ -1494,6 +1481,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1494
1481
  unknownToolCalls?: number | undefined;
1495
1482
  unknownTools?: Record<string, number> | undefined;
1496
1483
  noSessionErrors?: number | undefined;
1484
+ postSocketFailures?: number | undefined;
1485
+ postRetriesSaved?: number | undefined;
1497
1486
  consecutiveRepeats?: Record<string, number> | undefined;
1498
1487
  abandonedActions?: number | undefined;
1499
1488
  machine?: {
@@ -1514,6 +1503,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1514
1503
  errorsRecovered?: number | undefined;
1515
1504
  errorsRepeated?: number | undefined;
1516
1505
  endedWithVerdict?: boolean | undefined;
1506
+ updateNudged?: boolean | undefined;
1507
+ updateOffered?: string | undefined;
1517
1508
  exit?: "signal" | "idle" | "unknown" | undefined;
1518
1509
  }, {
1519
1510
  durationMs: number;
@@ -1555,6 +1546,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1555
1546
  unknownToolCalls?: number | undefined;
1556
1547
  unknownTools?: Record<string, number> | undefined;
1557
1548
  noSessionErrors?: number | undefined;
1549
+ postSocketFailures?: number | undefined;
1550
+ postRetriesSaved?: number | undefined;
1558
1551
  consecutiveRepeats?: Record<string, number> | undefined;
1559
1552
  abandonedActions?: number | undefined;
1560
1553
  machine?: {
@@ -1575,12 +1568,21 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1575
1568
  errorsRecovered?: number | undefined;
1576
1569
  errorsRepeated?: number | undefined;
1577
1570
  endedWithVerdict?: boolean | undefined;
1571
+ updateNudged?: boolean | undefined;
1572
+ updateOffered?: string | undefined;
1578
1573
  exit?: "signal" | "idle" | "unknown" | undefined;
1579
1574
  }>>;
1580
1575
  /** Only on `project_profiled`: the shape and depth-of-use of the project. */
1581
1576
  project: z.ZodOptional<z.ZodObject<{
1582
1577
  stack: z.ZodOptional<z.ZodString>;
1583
1578
  stackSource: z.ZodOptional<z.ZodEnum<["cwd", "workspace"]>>;
1579
+ stackUnknownReason: z.ZodOptional<z.ZodNativeEnum<{
1580
+ readonly NO_APP_FOUND: "no_app_found";
1581
+ readonly MANIFEST_UNRECOGNISED: "manifest_unrecognised";
1582
+ readonly WORKSPACE_APPS_UNRECOGNISED: "workspace_apps_unrecognised";
1583
+ readonly WORKSPACE_ROOT_NO_APPS: "workspace_root_no_apps";
1584
+ readonly DISCOVERY_FAILED: "discovery_failed";
1585
+ }>>;
1584
1586
  stackMajor: z.ZodOptional<z.ZodNumber>;
1585
1587
  size: z.ZodOptional<z.ZodNativeEnum<{
1586
1588
  readonly TINY: "tiny";
@@ -1610,6 +1612,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1610
1612
  visualBaselineCount: z.ZodNumber;
1611
1613
  runCount: z.ZodNumber;
1612
1614
  hasContract: z.ZodBoolean;
1615
+ initialized: z.ZodOptional<z.ZodBoolean>;
1616
+ appConnectedBefore: z.ZodOptional<z.ZodBoolean>;
1613
1617
  capsuleCount: z.ZodNumber;
1614
1618
  featuresUsed: z.ZodArray<z.ZodString, "many">;
1615
1619
  featureDepth: z.ZodNumber;
@@ -1626,10 +1630,13 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1626
1630
  stack?: string | undefined;
1627
1631
  stackMajor?: number | undefined;
1628
1632
  stackSource?: "cwd" | "workspace" | undefined;
1633
+ stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
1629
1634
  size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
1630
1635
  monorepo?: boolean | undefined;
1631
1636
  forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
1632
1637
  ageWeeks?: number | undefined;
1638
+ initialized?: boolean | undefined;
1639
+ appConnectedBefore?: boolean | undefined;
1633
1640
  }, {
1634
1641
  git: "none" | "local_only" | "remote";
1635
1642
  flowCount: number;
@@ -1643,10 +1650,13 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1643
1650
  stack?: string | undefined;
1644
1651
  stackMajor?: number | undefined;
1645
1652
  stackSource?: "cwd" | "workspace" | undefined;
1653
+ stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
1646
1654
  size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
1647
1655
  monorepo?: boolean | undefined;
1648
1656
  forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
1649
1657
  ageWeeks?: number | undefined;
1658
+ initialized?: boolean | undefined;
1659
+ appConnectedBefore?: boolean | undefined;
1650
1660
  }>>;
1651
1661
  /** Only on `verification_completed`. */
1652
1662
  verification: z.ZodOptional<z.ZodObject<{
@@ -1955,14 +1965,33 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1955
1965
  daemonAgeMs: z.ZodNumber;
1956
1966
  /** Which client, from its own handshake (`claude-code`, `cursor`). */
1957
1967
  client: z.ZodOptional<z.ZodString>;
1968
+ /**
1969
+ * Was an app carrying the SDK already attached to this daemon when the agent arrived.
1970
+ *
1971
+ * The mirror of `AppInstrumentation.agentAttached`, and the closest thing we have to WHAT THE
1972
+ * AGENT SAW. Most clients that attach never call a single tool, and that cohort was reachable only
1973
+ * by subtraction — `tool_refused` cannot describe it, because an agent that reads the server
1974
+ * instructions, learns nothing is wired and stops has refused nothing. It made no call at all.
1975
+ *
1976
+ * `false` means the handshake happened against a daemon with no app to look at, which is the state
1977
+ * the first-move instructions describe and the state in which no tool could have answered
1978
+ * anything. Split the never-drove population on this and the two halves need opposite fixes: one
1979
+ * is an install that never finished, the other is an agent that had everything it needed and did
1980
+ * not use it.
1981
+ *
1982
+ * OPTIONAL because an older sender has none. Absent means not measured, never `false`.
1983
+ */
1984
+ appConnected: z.ZodOptional<z.ZodBoolean>;
1958
1985
  }, "strip", z.ZodTypeAny, {
1959
1986
  reconnect: boolean;
1960
1987
  daemonAgeMs: number;
1961
1988
  client?: string | undefined;
1989
+ appConnected?: boolean | undefined;
1962
1990
  }, {
1963
1991
  reconnect: boolean;
1964
1992
  daemonAgeMs: number;
1965
1993
  client?: string | undefined;
1994
+ appConnected?: boolean | undefined;
1966
1995
  }>>;
1967
1996
  /** Only on `init_completed`. */
1968
1997
  init: z.ZodOptional<z.ZodObject<{
@@ -1985,21 +2014,36 @@ export declare const TelemetryEventSchema: z.ZodObject<{
1985
2014
  readonly CONNECTED: "connected";
1986
2015
  /** Nothing was listening on the bridge port, so no session could arrive. Not a failed install. */
1987
2016
  readonly NO_DAEMON: "no_daemon";
1988
- /** A daemon was up and no app connected inside the window — the dev server is the outstanding step. */
2017
+ /**
2018
+ * A daemon was up, no app connected, and no instrumented dev server announced itself either — so
2019
+ * the dev server is the outstanding step.
2020
+ *
2021
+ * Meaning unchanged, deliberately, so the funnel stays comparable across the change that added
2022
+ * NO_PAGE below. It is also still the honest answer for every stack whose plugin does not announce
2023
+ * yet: nothing was observed, and "not observed" must never be reported as "not running".
2024
+ */
1989
2025
  readonly NO_SESSION: "no_session";
2026
+ /**
2027
+ * A dev server with Reticle loaded IS running, and no page dialled.
2028
+ *
2029
+ * The half of NO_SESSION that used to be invisible, and the one with a completely different fix:
2030
+ * the config is right and the process was restarted, so telling this person to restart their dev
2031
+ * server is an instruction they have already followed. They need to open the app.
2032
+ */
2033
+ readonly NO_PAGE: "no_page";
1990
2034
  }>>;
1991
2035
  }, "strip", z.ZodTypeAny, {
1992
2036
  ok: boolean;
1993
2037
  stack?: string | undefined;
1994
2038
  reason?: string | undefined;
1995
2039
  mcpRegistered?: boolean | undefined;
1996
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
2040
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
1997
2041
  }, {
1998
2042
  ok: boolean;
1999
2043
  stack?: string | undefined;
2000
2044
  reason?: string | undefined;
2001
2045
  mcpRegistered?: boolean | undefined;
2002
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
2046
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
2003
2047
  }>>;
2004
2048
  /** Only on `bug_found`. */
2005
2049
  bug: z.ZodOptional<z.ZodObject<{
@@ -2102,40 +2146,36 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2102
2146
  }>>;
2103
2147
  /** Only on `tool_refused`: which tool, why, and whether the agent tried the same thing again. */
2104
2148
  refusal: z.ZodOptional<z.ZodObject<{
2105
- /** Which tool. A name from our own fixed namespace, never app data. */
2106
2149
  tool: z.ZodString;
2107
2150
  reason: z.ZodNativeEnum<{
2108
- /** There was no app to reach: nothing connected, no session by that id, or several with none named. */
2109
2151
  readonly NO_SESSION: "no_session";
2110
- /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */
2111
2152
  readonly NO_MATCH: "no_match";
2112
- /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */
2113
2153
  readonly UNSUPPORTED: "unsupported";
2114
- /** The call did not match the schema, or named a value our own validators reject. */
2115
2154
  readonly BAD_ARGS: "bad_args";
2116
- /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */
2117
2155
  readonly NOT_READY: "not_ready";
2118
- /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */
2119
2156
  readonly OTHER: "other";
2120
2157
  }>;
2121
- /**
2122
- * TRUE when the call immediately before this one was the SAME tool, also refused.
2123
- *
2124
- * Reported on the RETRY rather than on the first refusal, because the first refusal has to be sent
2125
- * at the moment it happens: deferring it until the next call is known would lose it entirely for
2126
- * the agent that gives up, and that agent is the whole population this event exists to describe.
2127
- * So count `retried: true` for retries; the ratio against all refusals is whether our diagnosis
2128
- * gets anybody unstuck.
2129
- */
2158
+ noSessionReason: z.ZodOptional<z.ZodNativeEnum<{
2159
+ readonly LEASE_EXPIRED: "lease_expired";
2160
+ readonly TAB_GONE: "tab_gone";
2161
+ readonly APP_NOT_REOPENED: "app_not_reopened";
2162
+ readonly CONFIG_ELSEWHERE: "config_elsewhere";
2163
+ readonly NO_LISTENER_NO_CONFIG: "no_listener_no_config";
2164
+ readonly NO_LISTENER: "no_listener";
2165
+ readonly NO_CONFIG: "no_config";
2166
+ readonly SDK_NOT_REACHING_DAEMON: "sdk_not_reaching_daemon";
2167
+ }>>;
2130
2168
  retried: z.ZodBoolean;
2131
2169
  }, "strip", z.ZodTypeAny, {
2132
2170
  reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
2133
2171
  tool: string;
2134
2172
  retried: boolean;
2173
+ noSessionReason?: "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
2135
2174
  }, {
2136
2175
  reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
2137
2176
  tool: string;
2138
2177
  retried: boolean;
2178
+ noSessionReason?: "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
2139
2179
  }>>;
2140
2180
  /** Only on `mcp_connection_lost`: which stage of the outage, why, and after how many retries. */
2141
2181
  outage: z.ZodOptional<z.ZodObject<{
@@ -2266,6 +2306,18 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2266
2306
  readonly EXPIRED: "expired";
2267
2307
  readonly EVAL: "eval";
2268
2308
  }>>;
2309
+ /**
2310
+ * A key was PLACED in the environment, whatever this build concluded about it.
2311
+ *
2312
+ * Rides even when `licenseStatus` is absent, and that combination is the entire reason it exists:
2313
+ * a build with no issuer key baked reports no status at all, so a customer who pasted a real
2314
+ * enterprise key into one produced no licence signal whatsoever and looked identical to someone
2315
+ * who has never held a key. `licenseKeyPresent: true` with no `licenseStatus` is precisely the
2316
+ * "their key is not taking effect" case, and it was previously unobservable.
2317
+ *
2318
+ * A boolean, never the key. The key is a credential and does not leave the machine.
2319
+ */
2320
+ licenseKeyPresent: z.ZodOptional<z.ZodBoolean>;
2269
2321
  }, "strip", z.ZodTypeAny, {
2270
2322
  event: "reticle_installed" | "cli_command_run" | "daemon_started" | "daemon_stopped" | "session_progress" | "verification_completed" | "project_profiled" | "version_changed" | "runtime_crashed" | "feedback_submitted" | "identified" | "mcp_client_connected" | "app_instrumented" | "mcp_connection_lost" | "init_completed" | "bug_found" | "tool_refused";
2271
2323
  version: string;
@@ -2299,10 +2351,13 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2299
2351
  stack?: string | undefined;
2300
2352
  stackMajor?: number | undefined;
2301
2353
  stackSource?: "cwd" | "workspace" | undefined;
2354
+ stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
2302
2355
  size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
2303
2356
  monorepo?: boolean | undefined;
2304
2357
  forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
2305
2358
  ageWeeks?: number | undefined;
2359
+ initialized?: boolean | undefined;
2360
+ appConnectedBefore?: boolean | undefined;
2306
2361
  } | undefined;
2307
2362
  session?: {
2308
2363
  durationMs: number;
@@ -2344,6 +2399,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2344
2399
  unknownToolCalls?: number | undefined;
2345
2400
  unknownTools?: Record<string, number> | undefined;
2346
2401
  noSessionErrors?: number | undefined;
2402
+ postSocketFailures?: number | undefined;
2403
+ postRetriesSaved?: number | undefined;
2347
2404
  consecutiveRepeats?: Record<string, number> | undefined;
2348
2405
  abandonedActions?: number | undefined;
2349
2406
  machine?: {
@@ -2364,8 +2421,11 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2364
2421
  errorsRecovered?: number | undefined;
2365
2422
  errorsRepeated?: number | undefined;
2366
2423
  endedWithVerdict?: boolean | undefined;
2424
+ updateNudged?: boolean | undefined;
2425
+ updateOffered?: string | undefined;
2367
2426
  exit?: "signal" | "idle" | "unknown" | undefined;
2368
2427
  } | undefined;
2428
+ licenseKeyPresent?: boolean | undefined;
2369
2429
  automation?: "container" | "hosted_workspace" | "no_tty" | undefined;
2370
2430
  projectIdSource?: "cwd" | "git_origin" | "git_root" | "package_root" | undefined;
2371
2431
  tzOffsetMin?: number | undefined;
@@ -2440,18 +2500,20 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2440
2500
  reconnect: boolean;
2441
2501
  daemonAgeMs: number;
2442
2502
  client?: string | undefined;
2503
+ appConnected?: boolean | undefined;
2443
2504
  } | undefined;
2444
2505
  init?: {
2445
2506
  ok: boolean;
2446
2507
  stack?: string | undefined;
2447
2508
  reason?: string | undefined;
2448
2509
  mcpRegistered?: boolean | undefined;
2449
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
2510
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
2450
2511
  } | undefined;
2451
2512
  refusal?: {
2452
2513
  reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
2453
2514
  tool: string;
2454
2515
  retried: boolean;
2516
+ noSessionReason?: "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
2455
2517
  } | undefined;
2456
2518
  outage?: {
2457
2519
  reason: "other" | "sse_ended" | "daemon_shutdown" | "sse_error" | "sse_aborted" | "sse_closed" | "connect_error";
@@ -2500,10 +2562,13 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2500
2562
  stack?: string | undefined;
2501
2563
  stackMajor?: number | undefined;
2502
2564
  stackSource?: "cwd" | "workspace" | undefined;
2565
+ stackUnknownReason?: "no_app_found" | "manifest_unrecognised" | "workspace_apps_unrecognised" | "workspace_root_no_apps" | "discovery_failed" | undefined;
2503
2566
  size?: "medium" | "tiny" | "small" | "large" | "huge" | undefined;
2504
2567
  monorepo?: boolean | undefined;
2505
2568
  forge?: "github" | "gitlab" | "bitbucket" | "azure" | "sourcehut" | "codeberg" | "self_hosted" | undefined;
2506
2569
  ageWeeks?: number | undefined;
2570
+ initialized?: boolean | undefined;
2571
+ appConnectedBefore?: boolean | undefined;
2507
2572
  } | undefined;
2508
2573
  session?: {
2509
2574
  durationMs: number;
@@ -2545,6 +2610,8 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2545
2610
  unknownToolCalls?: number | undefined;
2546
2611
  unknownTools?: Record<string, number> | undefined;
2547
2612
  noSessionErrors?: number | undefined;
2613
+ postSocketFailures?: number | undefined;
2614
+ postRetriesSaved?: number | undefined;
2548
2615
  consecutiveRepeats?: Record<string, number> | undefined;
2549
2616
  abandonedActions?: number | undefined;
2550
2617
  machine?: {
@@ -2565,8 +2632,11 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2565
2632
  errorsRecovered?: number | undefined;
2566
2633
  errorsRepeated?: number | undefined;
2567
2634
  endedWithVerdict?: boolean | undefined;
2635
+ updateNudged?: boolean | undefined;
2636
+ updateOffered?: string | undefined;
2568
2637
  exit?: "signal" | "idle" | "unknown" | undefined;
2569
2638
  } | undefined;
2639
+ licenseKeyPresent?: boolean | undefined;
2570
2640
  automation?: "container" | "hosted_workspace" | "no_tty" | undefined;
2571
2641
  projectIdSource?: "cwd" | "git_origin" | "git_root" | "package_root" | undefined;
2572
2642
  tzOffsetMin?: number | undefined;
@@ -2641,18 +2711,20 @@ export declare const TelemetryEventSchema: z.ZodObject<{
2641
2711
  reconnect: boolean;
2642
2712
  daemonAgeMs: number;
2643
2713
  client?: string | undefined;
2714
+ appConnected?: boolean | undefined;
2644
2715
  } | undefined;
2645
2716
  init?: {
2646
2717
  ok: boolean;
2647
2718
  stack?: string | undefined;
2648
2719
  reason?: string | undefined;
2649
2720
  mcpRegistered?: boolean | undefined;
2650
- confirmation?: "no_session" | "connected" | "no_daemon" | undefined;
2721
+ confirmation?: "no_session" | "connected" | "no_daemon" | "no_page" | undefined;
2651
2722
  } | undefined;
2652
2723
  refusal?: {
2653
2724
  reason: "other" | "no_session" | "no_match" | "unsupported" | "bad_args" | "not_ready";
2654
2725
  tool: string;
2655
2726
  retried: boolean;
2727
+ noSessionReason?: "lease_expired" | "tab_gone" | "app_not_reopened" | "config_elsewhere" | "no_listener_no_config" | "no_listener" | "no_config" | "sdk_not_reaching_daemon" | undefined;
2656
2728
  } | undefined;
2657
2729
  outage?: {
2658
2730
  reason: "other" | "sse_ended" | "daemon_shutdown" | "sse_error" | "sse_aborted" | "sse_closed" | "connect_error";
package/dist/telemetry.js CHANGED
@@ -16,6 +16,7 @@
16
16
  * `z.nativeEnum`, timestamps are epoch-ms NUMBERS, no `any`.
17
17
  */
18
18
  import { z } from 'zod';
19
+ import { ToolRefusalSchema } from './telemetry-refusal.js';
19
20
  import { MachineSnapshotSchema, ProjectProfileSchema, SessionSummarySchema, } from './telemetry-session.js';
20
21
  import { BrowserBrand, FeedbackSchema } from './telemetry-feedback.js';
21
22
  import { CaptureLoss, VerifiedReason } from './verified-constants.js';
@@ -542,49 +543,6 @@ export const BugFoundSchema = z.object({
542
543
  */
543
544
  fingerprint: z.string().max(16).optional(),
544
545
  });
545
- /**
546
- * WHY a tool could not do what was asked.
547
- *
548
- * Derived from the refusal paths that actually exist rather than invented: every member below is a
549
- * bucket over `error-recovery.ts`'s recovery table, which is the single place a thrown message is
550
- * turned into a next action. That table is the vocabulary; this is its coarse grouping, and a new
551
- * entry there cannot compile without being classified here.
552
- *
553
- * The five that matter belong to four different owners, which is the whole reason for splitting
554
- * them: `no_session` is the install's second half never happening, `bad_args` is the agent's own
555
- * call, `not_ready` is the environment, and `no_match` / `unsupported` are the app and our own
556
- * capability surface. One undifferentiated "the agent stopped" number cannot be acted on by anyone.
557
- */
558
- export const RefusalReason = {
559
- /** There was no app to reach: nothing connected, no session by that id, or several with none named. */
560
- NO_SESSION: 'no_session',
561
- /** The target did not exist: a stale ref, a missing baseline, an option value the select has not got. */
562
- NO_MATCH: 'no_match',
563
- /** Reticle refuses to pretend: a rich-text surface, a disabled field, a destructive control. */
564
- UNSUPPORTED: 'unsupported',
565
- /** The call did not match the schema, or named a value our own validators reject. */
566
- BAD_ARGS: 'bad_args',
567
- /** Nothing is wrong with the call; the world is not ready — a throttled tab, a timeout, no browser. */
568
- NOT_READY: 'not_ready',
569
- /** A refusal this list does not name. A classifier that cannot say "I don't know" lies instead. */
570
- OTHER: 'other',
571
- };
572
- /** One tool call that could not be served. */
573
- export const ToolRefusalSchema = z.object({
574
- /** Which tool. A name from our own fixed namespace, never app data. */
575
- tool: z.string().min(1).max(64),
576
- reason: z.nativeEnum(RefusalReason),
577
- /**
578
- * TRUE when the call immediately before this one was the SAME tool, also refused.
579
- *
580
- * Reported on the RETRY rather than on the first refusal, because the first refusal has to be sent
581
- * at the moment it happens: deferring it until the next call is known would lose it entirely for
582
- * the agent that gives up, and that agent is the whole population this event exists to describe.
583
- * So count `retried: true` for retries; the ratio against all refusals is whether our diagnosis
584
- * gets anybody unstuck.
585
- */
586
- retried: z.boolean(),
587
- });
588
546
  /** An MCP client attaching. Separates "installed and running" from "someone is actually using it". */
589
547
  export const McpConnectionSchema = z.object({
590
548
  /** False the first time a client attaches to this daemon; true for every attach after. */
@@ -597,6 +555,23 @@ export const McpConnectionSchema = z.object({
597
555
  daemonAgeMs: z.number().int().nonnegative(),
598
556
  /** Which client, from its own handshake (`claude-code`, `cursor`). */
599
557
  client: z.string().min(1).max(64).optional(),
558
+ /**
559
+ * Was an app carrying the SDK already attached to this daemon when the agent arrived.
560
+ *
561
+ * The mirror of `AppInstrumentation.agentAttached`, and the closest thing we have to WHAT THE
562
+ * AGENT SAW. Most clients that attach never call a single tool, and that cohort was reachable only
563
+ * by subtraction — `tool_refused` cannot describe it, because an agent that reads the server
564
+ * instructions, learns nothing is wired and stops has refused nothing. It made no call at all.
565
+ *
566
+ * `false` means the handshake happened against a daemon with no app to look at, which is the state
567
+ * the first-move instructions describe and the state in which no tool could have answered
568
+ * anything. Split the never-drove population on this and the two halves need opposite fixes: one
569
+ * is an install that never finished, the other is an agent that had everything it needed and did
570
+ * not use it.
571
+ *
572
+ * OPTIONAL because an older sender has none. Absent means not measured, never `false`.
573
+ */
574
+ appConnected: z.boolean().optional(),
600
575
  });
601
576
  /**
602
577
  * `app_instrumented`: an app carrying the SDK reached this daemon for the first time.
@@ -754,8 +729,23 @@ export const InitConfirmation = {
754
729
  CONNECTED: 'connected',
755
730
  /** Nothing was listening on the bridge port, so no session could arrive. Not a failed install. */
756
731
  NO_DAEMON: 'no_daemon',
757
- /** A daemon was up and no app connected inside the window — the dev server is the outstanding step. */
732
+ /**
733
+ * A daemon was up, no app connected, and no instrumented dev server announced itself either — so
734
+ * the dev server is the outstanding step.
735
+ *
736
+ * Meaning unchanged, deliberately, so the funnel stays comparable across the change that added
737
+ * NO_PAGE below. It is also still the honest answer for every stack whose plugin does not announce
738
+ * yet: nothing was observed, and "not observed" must never be reported as "not running".
739
+ */
758
740
  NO_SESSION: 'no_session',
741
+ /**
742
+ * A dev server with Reticle loaded IS running, and no page dialled.
743
+ *
744
+ * The half of NO_SESSION that used to be invisible, and the one with a completely different fix:
745
+ * the config is right and the process was restarted, so telling this person to restart their dev
746
+ * server is an instruction they have already followed. They need to open the app.
747
+ */
748
+ NO_PAGE: 'no_page',
759
749
  };
760
750
  /** How `reticle init` went. The onboarding funnel, which had no instrumentation whatsoever. */
761
751
  export const InitOutcomeSchema = z.object({
@@ -894,4 +884,16 @@ export const TelemetryEventSchema = z.object({
894
884
  licenseId: z.string().min(1).max(64).optional(),
895
885
  /** How activation resolved. Absent on a build with no issuer key baked, i.e. every OSS install. */
896
886
  licenseStatus: z.nativeEnum(LicenseActivation).optional(),
887
+ /**
888
+ * A key was PLACED in the environment, whatever this build concluded about it.
889
+ *
890
+ * Rides even when `licenseStatus` is absent, and that combination is the entire reason it exists:
891
+ * a build with no issuer key baked reports no status at all, so a customer who pasted a real
892
+ * enterprise key into one produced no licence signal whatsoever and looked identical to someone
893
+ * who has never held a key. `licenseKeyPresent: true` with no `licenseStatus` is precisely the
894
+ * "their key is not taking effect" case, and it was previously unobservable.
895
+ *
896
+ * A boolean, never the key. The key is a credential and does not leave the machine.
897
+ */
898
+ licenseKeyPresent: z.boolean().optional(),
897
899
  });