@armoriq/sdk-dev 0.6.10 → 0.8.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 (96) hide show
  1. package/README.md +168 -1
  2. package/dist/_version.d.ts +1 -1
  3. package/dist/_version.d.ts.map +1 -1
  4. package/dist/_version.js +1 -1
  5. package/dist/_version.js.map +1 -1
  6. package/dist/cli/commands/auth.d.ts +12 -0
  7. package/dist/cli/commands/auth.d.ts.map +1 -1
  8. package/dist/cli/commands/auth.js +522 -49
  9. package/dist/cli/commands/auth.js.map +1 -1
  10. package/dist/client.d.ts +8 -15
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +20 -18
  13. package/dist/client.js.map +1 -1
  14. package/dist/config.d.ts +0 -17
  15. package/dist/config.d.ts.map +1 -1
  16. package/dist/config.js +1 -19
  17. package/dist/config.js.map +1 -1
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +8 -14
  21. package/dist/index.js.map +1 -1
  22. package/dist/integrations/google_adk.d.ts +155 -7
  23. package/dist/integrations/google_adk.d.ts.map +1 -1
  24. package/dist/integrations/google_adk.js +727 -46
  25. package/dist/integrations/google_adk.js.map +1 -1
  26. package/dist/integrations/langchain.d.ts +48 -2
  27. package/dist/integrations/langchain.d.ts.map +1 -1
  28. package/dist/integrations/langchain.js +528 -33
  29. package/dist/integrations/langchain.js.map +1 -1
  30. package/dist/integrations/strands.d.ts +65 -1
  31. package/dist/integrations/strands.d.ts.map +1 -1
  32. package/dist/integrations/strands.js +456 -36
  33. package/dist/integrations/strands.js.map +1 -1
  34. package/dist/models.d.ts +2 -2
  35. package/dist/models.d.ts.map +1 -1
  36. package/dist/observability/content-capture.d.ts +103 -0
  37. package/dist/observability/content-capture.d.ts.map +1 -0
  38. package/dist/observability/content-capture.js +423 -0
  39. package/dist/observability/content-capture.js.map +1 -0
  40. package/dist/observability/index.d.ts +6 -7
  41. package/dist/observability/index.d.ts.map +1 -1
  42. package/dist/observability/index.js +18 -27
  43. package/dist/observability/index.js.map +1 -1
  44. package/dist/observability/otel-config.d.ts +47 -0
  45. package/dist/observability/otel-config.d.ts.map +1 -0
  46. package/dist/observability/otel-config.js +268 -0
  47. package/dist/observability/otel-config.js.map +1 -0
  48. package/dist/observability/otel-export-ceiling.d.ts +96 -0
  49. package/dist/observability/otel-export-ceiling.d.ts.map +1 -0
  50. package/dist/observability/otel-export-ceiling.js +271 -0
  51. package/dist/observability/otel-export-ceiling.js.map +1 -0
  52. package/dist/observability/otel-runtime.d.ts +103 -0
  53. package/dist/observability/otel-runtime.d.ts.map +1 -0
  54. package/dist/observability/otel-runtime.js +680 -0
  55. package/dist/observability/otel-runtime.js.map +1 -0
  56. package/dist/observability/otel-session.d.ts +168 -0
  57. package/dist/observability/otel-session.d.ts.map +1 -0
  58. package/dist/observability/otel-session.js +630 -0
  59. package/dist/observability/otel-session.js.map +1 -0
  60. package/dist/observability/otel-shutdown.d.ts +17 -0
  61. package/dist/observability/otel-shutdown.d.ts.map +1 -0
  62. package/dist/observability/otel-shutdown.js +54 -0
  63. package/dist/observability/otel-shutdown.js.map +1 -0
  64. package/dist/observability/policy-lease.d.ts +22 -0
  65. package/dist/observability/policy-lease.d.ts.map +1 -0
  66. package/dist/observability/policy-lease.js +102 -0
  67. package/dist/observability/policy-lease.js.map +1 -0
  68. package/dist/plan_builder.d.ts +5 -4
  69. package/dist/plan_builder.d.ts.map +1 -1
  70. package/dist/plan_builder.js +14 -15
  71. package/dist/plan_builder.js.map +1 -1
  72. package/dist/session.d.ts +61 -93
  73. package/dist/session.d.ts.map +1 -1
  74. package/dist/session.js +388 -804
  75. package/dist/session.js.map +1 -1
  76. package/dist/token_usage.d.ts +11 -18
  77. package/dist/token_usage.d.ts.map +1 -1
  78. package/dist/token_usage.js +29 -94
  79. package/dist/token_usage.js.map +1 -1
  80. package/dist/tool_name.d.ts +18 -0
  81. package/dist/tool_name.d.ts.map +1 -0
  82. package/dist/tool_name.js +29 -0
  83. package/dist/tool_name.js.map +1 -0
  84. package/dist/tool_push.d.ts +28 -0
  85. package/dist/tool_push.d.ts.map +1 -0
  86. package/dist/tool_push.js +151 -0
  87. package/dist/tool_push.js.map +1 -0
  88. package/dist/tool_registry.d.ts +100 -0
  89. package/dist/tool_registry.d.ts.map +1 -0
  90. package/dist/tool_registry.js +440 -0
  91. package/dist/tool_registry.js.map +1 -0
  92. package/dist/tool_schema.d.ts +22 -0
  93. package/dist/tool_schema.d.ts.map +1 -0
  94. package/dist/tool_schema.js +163 -0
  95. package/dist/tool_schema.js.map +1 -0
  96. package/package.json +12 -7
package/README.md CHANGED
@@ -88,7 +88,7 @@ USER_ID=your-user-id
88
88
  AGENT_ID=your-agent-id
89
89
 
90
90
  # Optional
91
- ARMORIQ_ENV=production # or 'development' for local
91
+ ARMORIQ_ENV=production # or 'local' for local development
92
92
  CONTEXT_ID=default
93
93
  IAP_ENDPOINT=https://iap.armoriq.ai
94
94
  PROXY_ENDPOINT=https://proxy.armoriq.ai
@@ -97,6 +97,167 @@ BACKEND_ENDPOINT=https://api.armoriq.ai
97
97
 
98
98
  ---
99
99
 
100
+ ## Native OpenTelemetry observability
101
+
102
+ Version 0.7.0 has one native OpenTelemetry span tree per session. It supports
103
+ exactly three exporter choices. Organization policy still governs every choice;
104
+ when observability is off or policy authority is unavailable, the SDK does not
105
+ export telemetry and agent execution continues.
106
+
107
+ ### 1. ArmorIQ OTLP
108
+
109
+ ArmorIQ OTLP is the default. No endpoint configuration is needed.
110
+
111
+ ```typescript
112
+ const session = client.startSession({ mode: 'sdk' });
113
+ ```
114
+
115
+ ### 2. Generic external OTLP endpoint
116
+
117
+ Use a standards-compatible HTTP/protobuf endpoint through options or standard
118
+ OpenTelemetry environment variables.
119
+
120
+ ```typescript
121
+ const client = new ArmorIQClient({
122
+ apiKey: 'ak_your_key_here',
123
+ observability: {
124
+ exporter: 'external',
125
+ endpoint: 'https://collector.example.com/v1/traces',
126
+ headers: { Authorization: 'Bearer token' },
127
+ },
128
+ });
129
+ ```
130
+
131
+ ```bash
132
+ OTEL_SERVICE_NAME=my-agent
133
+ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://observability.example.com/v1/traces
134
+ OTEL_EXPORTER_OTLP_TRACES_HEADERS=Authorization=Bearer%20token,x-tenant-id=my-tenant
135
+ ```
136
+
137
+ You can instead supply a base endpoint. The SDK appends `/v1/traces` only for
138
+ this base form:
139
+
140
+ ```bash
141
+ OTEL_EXPORTER_OTLP_ENDPOINT=https://collector.example.com
142
+ OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer%20token
143
+ ```
144
+
145
+ Trace-specific settings take precedence over general settings:
146
+
147
+ ```text
148
+ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT > OTEL_EXPORTER_OTLP_ENDPOINT
149
+ OTEL_EXPORTER_OTLP_TRACES_HEADERS > OTEL_EXPORTER_OTLP_HEADERS
150
+ OTEL_EXPORTER_OTLP_TRACES_PROTOCOL > OTEL_EXPORTER_OTLP_PROTOCOL
151
+ OTEL_EXPORTER_OTLP_TRACES_TIMEOUT > OTEL_EXPORTER_OTLP_TIMEOUT
152
+ ```
153
+
154
+ ### 3. Caller-owned tracer provider
155
+
156
+ Pass your own OpenTelemetry tracer provider when your application owns provider
157
+ lifecycle and exporter setup.
158
+
159
+ ```typescript
160
+ import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
161
+
162
+ const provider = new NodeTracerProvider();
163
+ const session = client.startSession({
164
+ observability: { exporter: 'provider', tracerProvider: provider },
165
+ });
166
+ ```
167
+
168
+ Only `http/protobuf` is supported for the SDK-managed external exporter. gRPC,
169
+ OTLP/JSON, compression, HTTP proxy configuration, and mTLS configuration are
170
+ not supported by that exporter.
171
+ Set those features on an OpenTelemetry Collector when they are required. The
172
+ exporter is fail-open: a remote outage, bad response, or timeout never changes
173
+ the result of an agent request. `content-type` headers are ignored because the
174
+ SDK always sends `application/x-protobuf`.
175
+
176
+ Before the first external trace, the SDK waits up to 1.4 seconds for the
177
+ organization policy authority. This one-time bound prevents unauthorized data
178
+ from reaching a third party. If authority is not available within the bound,
179
+ external telemetry stays disabled for that session and the agent continues.
180
+
181
+ One SDK runtime has one exporter choice. For fan-out to ArmorIQ and external
182
+ tools, use an OpenTelemetry Collector to route permitted traces.
183
+
184
+ ### Langfuse example
185
+
186
+ Langfuse is one OTLP-compatible destination. Configure its OTLP endpoint and
187
+ standard headers in the environment; do not add Langfuse-specific runtime code
188
+ to your agent:
189
+
190
+ ```bash
191
+ OTEL_SERVICE_NAME=my-agent
192
+ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://cloud.langfuse.com/api/public/otel/v1/traces
193
+ OTEL_EXPORTER_OTLP_TRACES_HEADERS=Authorization=Basic%20BASE64_PUBLIC_KEY_COLON_SECRET_KEY,x-langfuse-ingestion-version=4
194
+ ```
195
+
196
+ For another vendor, use that vendor's documented OTLP trace endpoint and
197
+ headers. The SDK does not infer vendor URLs, credentials, or private fields.
198
+
199
+ ### What is exported externally
200
+
201
+ External OTLP export always includes the trace hierarchy, stable span names,
202
+ service identity, supported GenAI model and token-use attributes, and safe
203
+ resource attributes. API keys, policy payloads, private ArmorIQ IDs, and
204
+ arbitrary user metadata are never exported to an external destination.
205
+
206
+ Prompt content, outputs, and tool arguments/results are withheld by default.
207
+ They are exported to an external destination only when the organization's
208
+ policy lease grants both content capture and external content capture, and
209
+ the effective capture mode is `enhanced` or `debug` — every other combination
210
+ (including a policy fetch that is not currently authoritative) withholds
211
+ them. Do not rely on external export being content-free by default if your
212
+ organization runs with those grants and capture modes enabled; check your
213
+ organization's observability policy if that guarantee matters to you.
214
+
215
+ Supported safe resource attributes are:
216
+
217
+ ```bash
218
+ OTEL_SERVICE_NAME=my-agent
219
+ OTEL_RESOURCE_ATTRIBUTES=service.namespace=education,deployment.environment.name=staging
220
+ ```
221
+
222
+ Do not put secrets or user content in resource attributes. Unsupported resource
223
+ attributes, malformed attributes, and values that look like a phone number,
224
+ SSN, or payment-card number are ignored before export.
225
+
226
+ ### Capture modes and per-session opt-out
227
+
228
+ The capture modes are exactly `off`, `metadata`, `enhanced`, and `debug`.
229
+ Select an upper bound with `ARMORIQ_OTEL_CAPTURE_MODE` or
230
+ `observability.captureMode`; the organization policy can only narrow it.
231
+
232
+ ```typescript
233
+ const noTelemetrySession = client.startSession({
234
+ observability: { enabled: false },
235
+ });
236
+ ```
237
+
238
+ ### Transcript token usage
239
+
240
+ Pass the session's native OTel bridge when you record transcript usage so model
241
+ tokens and cost become `gen_ai.chat` spans on the same trace.
242
+
243
+ ```typescript
244
+ await client.captureTranscriptTokens({
245
+ transcriptPath: '/tmp/transcript.jsonl',
246
+ product: 'armorclaude',
247
+ sessionId: session.sessionId,
248
+ otel: session.otelSession,
249
+ });
250
+ ```
251
+
252
+ ### 0.7.0 breaking changes
253
+
254
+ The prior pipeline selector, JSON recorder and shipper APIs, recorder handles,
255
+ schema and trace-summary exports, and `defaultObservabilityConfig` are removed.
256
+ Use `session.otelSession` for native spans. See the 0.7.0 breaking-change notes
257
+ in [CHANGELOG.md](CHANGELOG.md) for the complete removed public surface.
258
+
259
+ ---
260
+
100
261
  ## Advanced Usage
101
262
 
102
263
  ### Delegation
@@ -189,6 +350,12 @@ interface SDKConfig {
189
350
 
190
351
  For complete documentation, visit [docs.armoriq.ai](https://docs.armoriq.ai)
191
352
 
353
+ For native framework adapter versions, lifecycle hooks, callback chaining, and
354
+ known limits, see the [framework compatibility matrix](docs/integrations/compatibility-matrix.md).
355
+
356
+ For the OTLP-only 0.7.0 release sequence, see the
357
+ [release runbook](docs/release-0.7.0-otlp-only.md).
358
+
192
359
  ---
193
360
 
194
361
  ## Links
@@ -8,5 +8,5 @@
8
8
  * Must match `version` in package.json and the locked version in
9
9
  * package-lock.json. tests/package_metadata.test.ts enforces they agree.
10
10
  */
11
- export declare const VERSION = "0.6.10";
11
+ export declare const VERSION = "0.8.0";
12
12
  //# sourceMappingURL=_version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src/_version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,OAAO,WAAW,CAAC"}
1
+ {"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../src/_version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/_version.js CHANGED
@@ -11,5 +11,5 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.VERSION = void 0;
14
- exports.VERSION = '0.6.10';
14
+ exports.VERSION = '0.8.0';
15
15
  //# sourceMappingURL=_version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_version.js","sourceRoot":"","sources":["../src/_version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEU,QAAA,OAAO,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"_version.js","sourceRoot":"","sources":["../src/_version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEU,QAAA,OAAO,GAAG,OAAO,CAAC"}
@@ -6,6 +6,17 @@
6
6
  * local callback with the key, or — if the callback can't be reached —
7
7
  * we fall back to polling /auth/device/token.
8
8
  */
9
+ import * as fs from 'fs';
10
+ type DeviceIdentityFs = Pick<typeof fs, 'readFileSync' | 'mkdirSync' | 'writeFileSync' | 'unlinkSync' | 'linkSync' | 'statSync' | 'openSync' | 'writeSync' | 'fsyncSync' | 'closeSync'>;
11
+ /**
12
+ * The installation's stable, opaque device id, or null when it could not be
13
+ * persisted.
14
+ *
15
+ * Null rather than an unpersisted UUID: a value that is not on disk differs on
16
+ * every login, and the backend keys per-device key rotation on it, so returning
17
+ * one would provision a new key each time for what is one installation.
18
+ */
19
+ export declare function loadOrCreateDeviceId(identityFs?: DeviceIdentityFs): string | null;
9
20
  export declare function cmdLogin(args: {
10
21
  backend?: string;
11
22
  org?: string;
@@ -14,4 +25,5 @@ export declare function cmdLogin(args: {
14
25
  }): Promise<number>;
15
26
  export declare function cmdLogout(): number;
16
27
  export declare function cmdWhoami(): number;
28
+ export {};
17
29
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiPH,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkIlB;AAED,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAkBlC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAkCzB,KAAK,gBAAgB,GAAG,IAAI,CAC1B,OAAO,EAAE,EACP,cAAc,GACd,WAAW,GACX,eAAe,GACf,YAAY,GACZ,UAAU,GACV,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,CACd,CAAC;AAsHF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,gBAAqB,GAAG,MAAM,GAAG,IAAI,CAyCrF;AAieD,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyOlB;AAED,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAkBlC"}