@axonflow/sdk 9.1.0 → 9.3.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.
Files changed (76) hide show
  1. package/README.md +238 -22
  2. package/dist/cjs/adapters/langgraph.d.ts.map +1 -1
  3. package/dist/cjs/adapters/langgraph.js +20 -0
  4. package/dist/cjs/adapters/langgraph.js.map +1 -1
  5. package/dist/cjs/authzen.d.ts +353 -0
  6. package/dist/cjs/authzen.d.ts.map +1 -0
  7. package/dist/cjs/authzen.js +901 -0
  8. package/dist/cjs/authzen.js.map +1 -0
  9. package/dist/cjs/client.d.ts +135 -9
  10. package/dist/cjs/client.d.ts.map +1 -1
  11. package/dist/cjs/client.js +397 -30
  12. package/dist/cjs/client.js.map +1 -1
  13. package/dist/cjs/heartbeat.d.ts +55 -4
  14. package/dist/cjs/heartbeat.d.ts.map +1 -1
  15. package/dist/cjs/heartbeat.js +86 -7
  16. package/dist/cjs/heartbeat.js.map +1 -1
  17. package/dist/cjs/index.d.ts +6 -0
  18. package/dist/cjs/index.d.ts.map +1 -1
  19. package/dist/cjs/index.js +55 -1
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/read-identity.d.ts +267 -0
  22. package/dist/cjs/read-identity.d.ts.map +1 -0
  23. package/dist/cjs/read-identity.js +329 -0
  24. package/dist/cjs/read-identity.js.map +1 -0
  25. package/dist/cjs/telemetry.d.ts +176 -13
  26. package/dist/cjs/telemetry.d.ts.map +1 -1
  27. package/dist/cjs/telemetry.js +403 -37
  28. package/dist/cjs/telemetry.js.map +1 -1
  29. package/dist/cjs/types/authzen.gen.d.ts +407 -0
  30. package/dist/cjs/types/authzen.gen.d.ts.map +1 -0
  31. package/dist/cjs/types/authzen.gen.js +804 -0
  32. package/dist/cjs/types/authzen.gen.js.map +1 -0
  33. package/dist/cjs/types/config.d.ts +43 -1
  34. package/dist/cjs/types/config.d.ts.map +1 -1
  35. package/dist/cjs/types/hitl.js +1 -1
  36. package/dist/cjs/types/hitl.js.map +1 -1
  37. package/dist/cjs/version.d.ts +1 -1
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/esm/adapters/langgraph.d.ts.map +1 -1
  40. package/dist/esm/adapters/langgraph.js +20 -0
  41. package/dist/esm/adapters/langgraph.js.map +1 -1
  42. package/dist/esm/authzen.d.ts +353 -0
  43. package/dist/esm/authzen.d.ts.map +1 -0
  44. package/dist/esm/authzen.js +886 -0
  45. package/dist/esm/authzen.js.map +1 -0
  46. package/dist/esm/client.d.ts +135 -9
  47. package/dist/esm/client.d.ts.map +1 -1
  48. package/dist/esm/client.js +397 -30
  49. package/dist/esm/client.js.map +1 -1
  50. package/dist/esm/heartbeat.d.ts +55 -4
  51. package/dist/esm/heartbeat.d.ts.map +1 -1
  52. package/dist/esm/heartbeat.js +85 -7
  53. package/dist/esm/heartbeat.js.map +1 -1
  54. package/dist/esm/index.d.ts +6 -0
  55. package/dist/esm/index.d.ts.map +1 -1
  56. package/dist/esm/index.js +17 -0
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/read-identity.d.ts +267 -0
  59. package/dist/esm/read-identity.d.ts.map +1 -0
  60. package/dist/esm/read-identity.js +320 -0
  61. package/dist/esm/read-identity.js.map +1 -0
  62. package/dist/esm/telemetry.d.ts +176 -13
  63. package/dist/esm/telemetry.d.ts.map +1 -1
  64. package/dist/esm/telemetry.js +397 -37
  65. package/dist/esm/telemetry.js.map +1 -1
  66. package/dist/esm/types/authzen.gen.d.ts +407 -0
  67. package/dist/esm/types/authzen.gen.d.ts.map +1 -0
  68. package/dist/esm/types/authzen.gen.js +779 -0
  69. package/dist/esm/types/authzen.gen.js.map +1 -0
  70. package/dist/esm/types/config.d.ts +43 -1
  71. package/dist/esm/types/config.d.ts.map +1 -1
  72. package/dist/esm/types/hitl.js +1 -1
  73. package/dist/esm/types/hitl.js.map +1 -1
  74. package/dist/esm/version.d.ts +1 -1
  75. package/dist/esm/version.js +1 -1
  76. package/package.json +1 -1
@@ -1,3 +1,77 @@
1
+ /**
2
+ * Declare that a framework adapter is driving this SDK, so the next telemetry
3
+ * heartbeat carries `adapter:<name>` in its `features` array.
4
+ *
5
+ * A framework adapter (LangChain, LangGraph, LiteLLM, …) wrapping this SDK is
6
+ * indistinguishable from bare SDK use on every other telemetry dimension —
7
+ * same `sdk`, same `sdk_version`, same endpoint. This is the one call that
8
+ * makes the difference visible, and it is adoption signal only.
9
+ *
10
+ * IT ADDS NO REQUEST. The name rides the `features` array of the heartbeat
11
+ * that already fires; there is no second ping, no second endpoint and no new
12
+ * configuration surface. Calling it does not itself send anything.
13
+ *
14
+ * CALL IT BEFORE YOUR FIRST API CALL for day-one attribution. The heartbeat
15
+ * fires on the client's FIRST OUTBOUND REQUEST, not at construction, so
16
+ * anything registered before that request is on the very first ping and a name
17
+ * registered afterwards rides the next heartbeat.
18
+ *
19
+ * The SDK's own `AxonFlowLangGraphAdapter` registers from its constructor, so
20
+ * simply using it is enough — an adapter is necessarily built after the client
21
+ * and before any call through it.
22
+ *
23
+ * Idempotent. Repeat registrations of the same name collapse to one entry.
24
+ *
25
+ * THE NAME IS NOT VALIDATED AGAINST A LIST, DELIBERATELY. The canonical
26
+ * vocabulary lives on the receiver (checkpoint-service
27
+ * `NormalizeAdapterFeature`, which folds an unrecognised name into
28
+ * `adapter:unknown` at READ time while keeping the raw name on the row). An
29
+ * allowlist here would be a second vocabulary that drifts from the first: a
30
+ * name this SDK build predates would be dropped at the client instead of
31
+ * arriving and rendering as "someone is using an adapter we do not know
32
+ * about" — precisely the signal the unknown bucket exists to preserve.
33
+ *
34
+ * So the only transformations are the two the receiver also applies before
35
+ * matching: trim surrounding whitespace, and lowercase. What is refused is
36
+ * refused for a reason that is not about vocabulary: a name empty after
37
+ * trimming (there is nothing to declare, and `adapter:` alone is not an
38
+ * identifier), and a name longer than `MAX_RELAYED_VALUE_BYTES` (dropped
39
+ * WHOLE, never truncated). A non-string is refused the same way rather than
40
+ * coerced — `String(undefined)` would put the literal text `undefined` on the
41
+ * wire as an adapter name.
42
+ *
43
+ * Both refusals are silent: this is a telemetry declaration on a
44
+ * fire-and-forget path, and throwing would invite a caller to fail their own
45
+ * startup over an analytics detail.
46
+ */
47
+ export declare function registerAdapter(name: string): void;
48
+ /**
49
+ * Apply the receiver's array bounds: at most `MAX_FEATURES` entries, none over
50
+ * `MAX_FEATURE_BYTES` bytes.
51
+ *
52
+ * An over-long entry is DROPPED rather than truncated, which is where this
53
+ * deliberately differs from the receiver's own `BoundFeatures`. The receiver
54
+ * truncates because it is defending storage against arbitrary clients and a
55
+ * truncated entry harmlessly folds into its unknown bucket. Here the entry is
56
+ * something this process declared about itself, and a truncated adapter name
57
+ * is a name nothing is running.
58
+ */
59
+ export declare function boundFeatures(features: string[]): string[];
60
+ /**
61
+ * Render the registry as the `features` array for one ping.
62
+ *
63
+ * Sorted so the wire is deterministic — two processes that registered the same
64
+ * adapters in a different order produce the same array, which is what lets a
65
+ * test assert on the whole field, and what makes "which 32 survive" a defined
66
+ * answer rather than a Set-iteration accident.
67
+ */
68
+ export declare function registeredFeatures(): string[];
69
+ /** Test-only: empty the registry and return what was there, so the caller can
70
+ * restore it. The registry is module-global by design, so a test that
71
+ * registers an adapter would otherwise leak it into every later test's ping. */
72
+ export declare function _resetAdapterRegistryForTest(): string[];
73
+ /** Test-only: restore a registry saved by `_resetAdapterRegistryForTest`. */
74
+ export declare function _restoreAdapterRegistryForTest(previous: string[]): void;
1
75
  export interface TelemetryPayload {
2
76
  /**
3
77
  * v1 telemetry-schema discriminator (axonflow-enterprise#2008). Always
@@ -43,6 +117,76 @@ export interface TelemetryPayload {
43
117
  * commitment that covers this field.
44
118
  */
45
119
  org_id: string;
120
+ /**
121
+ * Licence tier the connected platform reported on its own `/health`
122
+ * response — `"community"`, `"evaluation"`, `"Enterprise"`, the csaas
123
+ * `"Plus"` alias for EnterprisePlus, or the transient `"starting"`.
124
+ * Coarse adoption signal only: no licence key, no expiry, no seat count,
125
+ * no customer name. Issue #3619.
126
+ *
127
+ * THREE SIMILARLY-NAMED CONCEPTS LIVE NEARBY. Do not merge them:
128
+ *
129
+ * 1. `deployment_mode` (this interface) — SDK-derived TOPOLOGY:
130
+ * `self_hosted | community_saas | unknown`, classified from the
131
+ * endpoint URL. Says WHERE the platform runs.
132
+ * 2. The platform's own `DEPLOYMENT_MODE` env var — a server-side
133
+ * setting deciding which schema/tables the binary uses. Never read by
134
+ * this SDK and never sent on this field.
135
+ * 3. `license_tier` (this field) — what the platform REPORTED about its
136
+ * own licensing, for adoption analytics.
137
+ *
138
+ * ITEM 3 IS NOT AN ENTITLEMENT FACT. This SDK relays whatever `/health`
139
+ * returned, and the receiver cannot verify the relay: whoever operates
140
+ * the endpoint the client was pointed at controls the value completely.
141
+ * It must never gate entitlement, unlock a feature, or enter any
142
+ * authorization or billing decision. See axonflow-enterprise#3619.
143
+ *
144
+ * A community-mode binary can run on any topology and vice versa, so
145
+ * neither field is derivable from the other.
146
+ *
147
+ * Sent verbatim. Casing and alias folding is the receiver's job
148
+ * (checkpoint-service `NormalizeLicenseTier`) and is deliberately NOT
149
+ * duplicated here — a client that folded locally would silently mask a
150
+ * tier this SDK build predates.
151
+ *
152
+ * ABSENT (property omitted) means NOT LEARNED — `/health` unreachable,
153
+ * non-2xx, unparseable, or carrying no `tier` key. Absent must never
154
+ * become a known value: emitting `"community"` for a platform we could
155
+ * not reach would be a false claim about a customer's deployment. The
156
+ * receiver preserves omission for legacy pings, so an omitted field
157
+ * reads as "unknown", not as any particular tier.
158
+ */
159
+ license_tier?: string;
160
+ /**
161
+ * The BUILD the connected platform reported on its own `/health`:
162
+ * `community` or `enterprise`. Relayed verbatim, and it rides the SAME
163
+ * `/health` response the version and the tier already come from — no new
164
+ * request. Issue axonflow-enterprise#3660.
165
+ *
166
+ * NOT an entitlement fact, on the same terms as `license_tier` above:
167
+ * whoever operates the configured endpoint controls the value completely and
168
+ * this SDK relays it unverified.
169
+ *
170
+ * NOT derivable from anything else here either — the Community-SaaS fleet
171
+ * runs the ENTERPRISE build against the community-saas schema, so neither
172
+ * `deployment_mode` nor `license_tier` implies it.
173
+ *
174
+ * ABSENT (property omitted) means NOT LEARNED.
175
+ */
176
+ edition?: string;
177
+ /**
178
+ * The connected platform's OWN deployment mode, as it reported it on
179
+ * `/health` under the member name `deployment_mode`.
180
+ *
181
+ * READ THE FIELD NAMES CAREFULLY — THIS IS THE TRAP THIS CONTRACT IS MOST
182
+ * LIKELY TO BE GOT WRONG ON. The `/health` member is called
183
+ * `deployment_mode` because there the platform is describing ITSELF. On this
184
+ * ping, `deployment_mode` already means something else entirely: the
185
+ * TOPOLOGY bucket this SDK derives from the endpoint URL it was configured
186
+ * with. They are different dimensions, and mapping `/health`'s member onto
187
+ * the topology field would overwrite a value every existing dashboard reads.
188
+ */
189
+ platform_deployment_mode?: string;
46
190
  }
47
191
  /**
48
192
  * Sentinel emitted on the telemetry wire when `ORG_ID` is unset — the
@@ -94,19 +238,6 @@ export declare function classifyDeploymentMode(url: string | null | undefined):
94
238
  * `classifyDeploymentMode`) per the v1 schema (axonflow-enterprise#2008).
95
239
  */
96
240
  export declare function classifyEndpoint(url: string | null | undefined): EndpointType;
97
- /**
98
- * Send a telemetry ping and return whether it landed.
99
- *
100
- * Returns `true` only when the POST received a 2xx response. Network
101
- * failures, timeouts, and non-2xx responses all return `false`. Used by
102
- * the heartbeat orchestrator (see `heartbeat.ts`) where the boolean
103
- * drives stamp-on-DELIVERY semantics: only successful POSTs advance the
104
- * stamp file.
105
- *
106
- * The caller is responsible for the gating decision — this function does
107
- * NOT consult `AXONFLOW_TELEMETRY`, the stamp file, or any rate-limit
108
- * state.
109
- */
110
241
  export declare function sendTelemetryPingNow(options: {
111
242
  mode: string;
112
243
  endpoint: string;
@@ -129,4 +260,36 @@ export declare function sendTelemetryPing(options: {
129
260
  endpoint: string;
130
261
  debug?: boolean;
131
262
  }): void;
263
+ /**
264
+ * What a single `/health` fetch established. Each field is INDEPENDENT: a
265
+ * response carrying one but not the other yields a partially-populated
266
+ * result rather than discarding both. `null` means "not learned" — it never
267
+ * degrades to a default (see `TelemetryPayload.license_tier`).
268
+ */
269
+ export interface PlatformHealthProbe {
270
+ platformVersion: string | null;
271
+ licenseTier: string | null;
272
+ /** `/health` → `edition`. */
273
+ edition: string | null;
274
+ /** `/health` → `deployment_mode`, relayed as `platform_deployment_mode`. */
275
+ platformDeploymentMode: string | null;
276
+ }
277
+ /**
278
+ * Probe the agent's `/health` endpoint ONCE and extract every telemetry
279
+ * dimension it carries. Returns both fields null on any failure —
280
+ * unreachable endpoint, non-2xx, unparseable body, or a body that stalls
281
+ * past the supplied budget — so
282
+ * telemetry degrades to omitting the fields and never fails the ping or
283
+ * surfaces an error to the caller.
284
+ *
285
+ * This is the SDK's only `/health` fetch on the telemetry path; the licence
286
+ * tier rides along on the response already being fetched for the version.
287
+ * Adding a second request here would double the telemetry path's blocking
288
+ * budget and its failure surface — do not.
289
+ *
290
+ * @param timeoutMs — derived from the shared telemetry deadline so the health
291
+ * probe and the checkpoint POST don't stack into a larger combined budget.
292
+ * See enterprise#1707.
293
+ */
294
+ export declare function probePlatformHealth(endpoint: string, timeoutMs: number): Promise<PlatformHealthProbe>;
132
295
  //# sourceMappingURL=telemetry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":"AAmGA,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,eAAe,EAAE,cAAc,CAAC;IAChC;;;;OAIG;IACH,aAAa,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,M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