@tangle-network/agent-core 0.2.0 → 0.2.1
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/auth/browser.d.ts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/{index-CtebBodu.d.ts → index-BOD4IhTr.d.ts} +2 -2
- package/dist/{index-CtebBodu.d.ts.map → index-BOD4IhTr.d.ts.map} +1 -1
- package/dist/{index-DiQX9bjq.d.ts → index-BRyMBSkE.d.ts} +1 -1
- package/dist/{index-DiQX9bjq.d.ts.map → index-BRyMBSkE.d.ts.map} +1 -1
- package/dist/{index-DlPznmKA.d.ts → index-C7zlWVGc.d.ts} +1 -1
- package/dist/{index-DlPznmKA.d.ts.map → index-C7zlWVGc.d.ts.map} +1 -1
- package/dist/index-CBGkvDtv.d.ts +303 -0
- package/dist/index-CBGkvDtv.d.ts.map +1 -0
- package/dist/{index-z2wPdzFb.d.ts → index-Dz1ZLn3K.d.ts} +2 -2
- package/dist/{index-z2wPdzFb.d.ts.map → index-Dz1ZLn3K.d.ts.map} +1 -1
- package/dist/{index-CFA8kgHJ.d.ts → index-VcOZI9jN.d.ts} +1 -1
- package/dist/{index-CFA8kgHJ.d.ts.map → index-VcOZI9jN.d.ts.map} +1 -1
- package/dist/index.d.ts +8 -85
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -106
- package/dist/index.js.map +1 -1
- package/dist/resilience/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry-D2XGH5UL.js +699 -0
- package/dist/telemetry-D2XGH5UL.js.map +1 -0
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/{transport-mKLoQep5.js → transport-XLxpQmUW.js} +1 -1
- package/dist/{transport-mKLoQep5.js.map → transport-XLxpQmUW.js.map} +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/{types-D5VLaol0.js → types-Ci7hcTnp.js} +1 -1
- package/dist/{types-D5VLaol0.js.map → types-Ci7hcTnp.js.map} +1 -1
- package/dist/{types-DiDSGM8K.d.ts → types-D32txapu.d.ts} +2 -2
- package/dist/{types-DiDSGM8K.d.ts.map → types-D32txapu.d.ts.map} +1 -1
- package/package.json +7 -2
package/dist/auth/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ReadTokenAuth, S as NoAuth, T as StaticTokenAuth, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, f as ReadTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "../types-
|
|
1
|
+
import { C as ReadTokenAuth, S as NoAuth, T as StaticTokenAuth, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, f as ReadTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "../types-D32txapu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/tokens-browser.d.ts
|
|
4
4
|
/**
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ReadTokenAuth, S as NoAuth, T as StaticTokenAuth, _ as SessionScopedTokenPayloadSchema, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, d as ProjectScopedTokenPayloadSchema, f as ReadTokenPayload, g as SessionScopedTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, n as BatchScopedTokenPayloadSchema, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, t as BatchScopedTokenPayload, u as ProjectScopedTokenPayload, v as TokenScope, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "../types-
|
|
1
|
+
import { C as ReadTokenAuth, S as NoAuth, T as StaticTokenAuth, _ as SessionScopedTokenPayloadSchema, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, d as ProjectScopedTokenPayloadSchema, f as ReadTokenPayload, g as SessionScopedTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, n as BatchScopedTokenPayloadSchema, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, t as BatchScopedTokenPayload, u as ProjectScopedTokenPayload, v as TokenScope, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "../types-D32txapu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/channel-access.d.ts
|
|
4
4
|
/**
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EventChannel, c as EventBufferConfig, i as ChannelHandler, n as EventDeduplicator, o as BufferedEvent, r as ChannelConfig, s as EventBuffer, t as DeduplicatorConfig } from "../index-
|
|
1
|
+
import { a as EventChannel, c as EventBufferConfig, i as ChannelHandler, n as EventDeduplicator, o as BufferedEvent, r as ChannelConfig, s as EventBuffer, t as DeduplicatorConfig } from "../index-C7zlWVGc.js";
|
|
2
2
|
export { BufferedEvent, ChannelConfig, ChannelHandler, DeduplicatorConfig, EventBuffer, EventBufferConfig, EventChannel, EventDeduplicator };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SDKError } from "./index-
|
|
1
|
+
import { n as SDKError } from "./index-BRyMBSkE.js";
|
|
2
2
|
|
|
3
3
|
//#region src/resilience/circuit-breaker.d.ts
|
|
4
4
|
type CircuitState = "closed" | "open" | "half-open";
|
|
@@ -105,4 +105,4 @@ declare function createTimeoutController(timeoutMs: number): {
|
|
|
105
105
|
declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
106
106
|
//#endregion
|
|
107
107
|
export { ProtectionOptions as a, CircuitBreaker as c, CircuitOpenError as d, CircuitState as f, withTimeout as i, CircuitBreakerConfig as l, createTimeoutController as n, createProtectedFn as o, sleep as r, withProtection as s, TimeoutError as t, CircuitBreakerStats as u };
|
|
108
|
-
//# sourceMappingURL=index-
|
|
108
|
+
//# sourceMappingURL=index-BOD4IhTr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BOD4IhTr.d.ts","names":[],"sources":["../src/resilience/circuit-breaker.ts","../src/resilience/protection.ts","../src/resilience/timeout.ts"],"mappings":";;;KAeY,YAAA;AAAA,UAEK,oBAAA;EAQf;EANA,gBAAA;EAM+B;EAJ/B,cAAA;EAOe;EALf,gBAAA;;EAEA,aAAA,IAAiB,KAAA;AAAA;AAAA,UAGF,mBAAA;EACf,KAAA,EAAO,YAAA;EACP,QAAA;EACA,SAAA;EACA,eAAA;EACA,aAAA;EACA,cAAA;EACA,aAAA;AAAA;AAAA,cAGW,gBAAA,SAAyB,QAAA;EAAA,SAC3B,WAAA;EAAA,SACA,YAAA;cAEG,IAAA,UAAc,YAAA;AAAA;AAAA,cAaf,cAAA;EAAA,iBAYQ,IAAA;EAAA,iBACA,MAAA;EAAA,QAZX,KAAA;EAAA,QACA,QAAA;EAAA,QACA,SAAA;EAAA,QACA,eAAA;EAAA,QAGA,aAAA;EAAA,QACA,cAAA;EAAA,QACA,aAAA;cAGW,IAAA,UACA,MAAA,EAAQ,oBAAA;EAiBQ;;;;EAA7B,OAAA,GAAA,CAAW,EAAA,QAAU,OAAA,CAAQ,CAAA,IAAK,OAAA,CAAQ,CAAA;EAAA,QA6BxC,SAAA;EAAA,QAiBA,SAAA;EA6BuB;EAL/B,QAAA,CAAA,GAAY,YAAA;EAvFO;EA4FnB,QAAA,CAAA,GAAY,mBAAA;EAvGJ;EAoHR,kBAAA,CAAA;EAlHQ;EAgIR,KAAA,CAAA;EA5HQ;EAoIR,IAAA,CAAA;AAAA;;;UC5Le,iBAAA;;EAEf,SAAA;EDMsB;ECJtB,OAAA,GAAU,cAAA;EDMyB;ECJnC,aAAA;AAAA;;;;;;;;ADeF;;iBCHsB,cAAA,GAAA,CACpB,EAAA,QAAU,OAAA,CAAQ,CAAA,GAClB,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,CAAA;;;;iBAoBK,iBAAA,kCAAA,CACd,EAAA,MAAQ,IAAA,EAAM,KAAA,KAAU,OAAA,CAAQ,OAAA,GAChC,OAAA,EAAS,iBAAA,OACJ,IAAA,EAAM,KAAA,KAAU,OAAA,CAAQ,OAAA;;;cC3ClB,YAAA,SAAqB,QAAA;EAAA,SACvB,SAAA;cAEG,OAAA,UAAiB,SAAA;AAAA;;;;;iBAef,WAAA,GAAA,CACd,OAAA,EAAS,OAAA,CAAQ,CAAA,GACjB,SAAA,UACA,OAAA,YACC,OAAA,CAAQ,CAAA;;;;;iBA2BK,uBAAA,CAAwB,SAAA;EACtC,UAAA,EAAY,eAAA;EACZ,OAAA;AAAA;;;;;iBAyBc,KAAA,CAAM,EAAA,UAAY,MAAA,GAAS,WAAA,GAAc,OAAA"}
|
|
@@ -52,4 +52,4 @@ declare function isSDKError(error: unknown): error is SDKError;
|
|
|
52
52
|
declare function isRetryable(error: unknown): boolean;
|
|
53
53
|
//#endregion
|
|
54
54
|
export { isSDKError as i, SDKError as n, isRetryable as r, ErrorCode as t };
|
|
55
|
-
//# sourceMappingURL=index-
|
|
55
|
+
//# sourceMappingURL=index-BRyMBSkE.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BRyMBSkE.d.ts","names":[],"sources":["../src/errors/index.ts"],"mappings":";;AAOA;;;;;KAAY,SAAA;;cAaC,QAAA,SAAiB,KAAA;EAAA,SACnB,IAAA,EAAM,SAAA;EAAA,SACN,MAAA;EAAA,SACA,SAAA;EAAA,SACA,YAAA;EAAA,SACA,OAAA,GAAU,MAAA;cAGjB,OAAA,UACA,OAAA;IACE,IAAA,EAAM,SAAA;IACN,MAAA;IACA,SAAA;IACA,YAAA;IACA,OAAA,GAAU,MAAA;IACV,KAAA,GAAQ,KAAA;EAAA;EAAA,QAaJ,cAAA;EAzBC;EAAA,OAqCF,YAAA,CAAa,MAAA,UAAgB,IAAA,aAAiB,QAAA;EAnC5C;EAAA,OAmGF,SAAA,CAAU,KAAA,YAAiB,QAAA;;;;;;;;;;;;;;;;;iBA8CnB,sBAAA;EA9CR;EAsFP,aAAA,CAAA;AAAA;;iBASc,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,QAAA;;iBAKrC,WAAA,CAAY,KAAA"}
|
|
@@ -155,4 +155,4 @@ declare class EventDeduplicator {
|
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
157
|
export { EventChannel as a, EventBufferConfig as c, ChannelHandler as i, EventDeduplicator as n, BufferedEvent as o, ChannelConfig as r, EventBuffer as s, DeduplicatorConfig as t };
|
|
158
|
-
//# sourceMappingURL=index-
|
|
158
|
+
//# sourceMappingURL=index-C7zlWVGc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-C7zlWVGc.d.ts","names":[],"sources":["../src/events/buffer.ts","../src/events/channel.ts","../src/events/deduplication.ts"],"mappings":";;AAOA;;;;;UAAiB,iBAAA;EAMf;EAJA,OAAA;EAIgB;EAFhB,KAAA;EAK4B;EAH5B,gBAAA;AAAA;AAAA,UAGe,aAAA;EACf,EAAA;EACA,IAAA,EAAM,CAAA;EACN,SAAA;EACA,SAAA;AAAA;AAAA,cASW,WAAA;EAAA,iBACM,MAAA;EAAA,QACT,MAAA;EAAA,QACA,OAAA;EAAA,QACA,YAAA;cAEI,MAAA,GAAQ,OAAA,CAAQ,iBAAA;EAAR;EAMp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FtBW;;;EEgCpB,OAAA,CAAQ,OAAA;EFSqC;;;EEA7C,KAAA,CAAA;EFUmD;;;EEHnD,IAAA,CAAA;EFpDQ;;;EE2DR,OAAA,CAAA;EAAA,QAQQ,WAAA;EAAA,QAQA,YAAA;EAAA,QASA,YAAA;AAAA"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
//#region src/telemetry/content-attributes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Content-key alias vocabulary — the single source of truth for "where does a
|
|
4
|
+
* trace producer put the human-readable CONTENT of a turn": the task, the
|
|
5
|
+
* prompt, the model completion, and a tool call's name / args / result.
|
|
6
|
+
*
|
|
7
|
+
* This is the content sibling of {@link ./genai-attributes.ts} (model / token /
|
|
8
|
+
* cost vocabulary) and follows the identical pattern: writers emit a producer's
|
|
9
|
+
* own keys; the ingest READER accepts a wider candidate list per normalized
|
|
10
|
+
* field because every coding agent and SDK spells the same field differently
|
|
11
|
+
* (OTel GenAI, OpenInference, our own `tangle.*`, Claude Code's `claude_code.*`,
|
|
12
|
+
* Codex's `codex.*`, OpenCode's `message.*` / `tool.*`). Co-locating the per-field
|
|
13
|
+
* candidate lists and the resolver here is the drift guard: a producer's emitted
|
|
14
|
+
* key and the reader's candidate list can never silently disagree, and adding an
|
|
15
|
+
* agent is a DATA change (one alias row) rather than a code change in every
|
|
16
|
+
* reader.
|
|
17
|
+
*
|
|
18
|
+
* Both consumers — the Intelligence ingest (span + log-record content recovery,
|
|
19
|
+
* onboarding content check) and the standalone OpenCode exporter (which WRITES
|
|
20
|
+
* under these keys) — import this layer, so "the producer shipped content" and
|
|
21
|
+
* "the product can read it" mean the same thing by construction.
|
|
22
|
+
*
|
|
23
|
+
* Coding agents frequently carry this content on OTLP LOG events rather than
|
|
24
|
+
* spans; {@link logRecordContentBag} is the one place that decides how a log row
|
|
25
|
+
* becomes a bag the resolver can read.
|
|
26
|
+
*
|
|
27
|
+
* Fail-loud: a key whose value isn't a usable non-empty string (or, for
|
|
28
|
+
* `messages`, a parseable array) is NOT recorded — {@link extractContent}
|
|
29
|
+
* returns only the fields it actually found, never a fabricated default. An
|
|
30
|
+
* empty bag returns an empty object, never sentinels.
|
|
31
|
+
*/
|
|
32
|
+
/** The normalized content a single attribute bag can carry. Every field is
|
|
33
|
+
* optional: a bag carries only the slices the emitter put on it. */
|
|
34
|
+
interface NormalizedContent {
|
|
35
|
+
task?: string;
|
|
36
|
+
prompt?: string;
|
|
37
|
+
completion?: string;
|
|
38
|
+
toolName?: string;
|
|
39
|
+
toolArgs?: string;
|
|
40
|
+
toolResult?: string;
|
|
41
|
+
messages?: unknown[];
|
|
42
|
+
}
|
|
43
|
+
/** The normalized field a content key maps to. `messages` is parsed as an
|
|
44
|
+
* array (or a JSON string that decodes to one); every other field is a
|
|
45
|
+
* non-empty string. */
|
|
46
|
+
type ContentField = keyof NormalizedContent;
|
|
47
|
+
/** Prompt / user message — the writer key OpenCode's user-turn export uses. */
|
|
48
|
+
declare const CONTENT_PROMPT_KEY = "gen_ai.prompt";
|
|
49
|
+
/** Model completion — the writer key OpenCode's assistant-text export uses. */
|
|
50
|
+
declare const CONTENT_COMPLETION_KEY = "message.part.text";
|
|
51
|
+
/** Invoked tool's name. */
|
|
52
|
+
declare const CONTENT_TOOL_NAME_KEY = "tool.name";
|
|
53
|
+
/** Tool call arguments. */
|
|
54
|
+
declare const CONTENT_TOOL_ARGS_KEY = "tool.input";
|
|
55
|
+
/** Tool call output / result. */
|
|
56
|
+
declare const CONTENT_TOOL_RESULT_KEY = "tool.output";
|
|
57
|
+
/**
|
|
58
|
+
* Every content key the alias layer knows about. Callers use this to detect
|
|
59
|
+
* "is there any content on this bag at all" without re-deriving the set.
|
|
60
|
+
* Frozen so a caller can't mutate the shared table. Excludes the span-only
|
|
61
|
+
* prompt spellings, which are intent-recovery candidates rather than
|
|
62
|
+
* content-presence signals.
|
|
63
|
+
*/
|
|
64
|
+
declare const CONTENT_KEYS: readonly string[];
|
|
65
|
+
/** Map of every known content key → its normalized field, exposed read-only
|
|
66
|
+
* for callers that want to inspect or extend the mapping (e.g. enrichment
|
|
67
|
+
* joins that need to know which field a matched key feeds). */
|
|
68
|
+
declare const CONTENT_KEY_FIELD: Readonly<Record<string, ContentField>>;
|
|
69
|
+
/** A non-empty trimmed string, or null. Absent/blank/non-string values are an
|
|
70
|
+
* honest miss, never "". */
|
|
71
|
+
declare function asContentField(value: unknown): string | null;
|
|
72
|
+
/** Flatten a tool-args / tool-result value to a string. Strings pass through;
|
|
73
|
+
* objects/arrays are JSON-stringified so a structured tool payload is still
|
|
74
|
+
* readable content. Null/empty → null (never "" or "null"). */
|
|
75
|
+
declare function asContentString(value: unknown): string | null;
|
|
76
|
+
/**
|
|
77
|
+
* Extract normalized content from a flattened attribute bag (span attributes
|
|
78
|
+
* OR a log record's merged attribute bag). Pure: same input → same output, no
|
|
79
|
+
* I/O, no env reads. Returns only the fields actually present; an empty/absent
|
|
80
|
+
* bag returns `{}`.
|
|
81
|
+
*/
|
|
82
|
+
declare function extractContent(attributes: Record<string, unknown> | undefined | null): NormalizedContent;
|
|
83
|
+
/** True when the bag carries ANY known content key with a usable value. A cheap
|
|
84
|
+
* presence check that SHORT-CIRCUITS on the first usable key — it does not
|
|
85
|
+
* build the NormalizedContent object or JSON-parse `messages` bodies, so a hot
|
|
86
|
+
* scan path (onboarding) pays per-row only until the first hit. */
|
|
87
|
+
declare function hasContent(attributes: Record<string, unknown> | undefined | null): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Build the content-detection bag for a single OTLP log record. A log carries
|
|
90
|
+
* its content either as flattened attributes (keyed by a content key) OR as the
|
|
91
|
+
* record `body` for a prompt event whose text has no attribute key (a
|
|
92
|
+
* `*.user_prompt` event whose prompt IS the body). This is the ONE place that
|
|
93
|
+
* decides "how a log row becomes a bag `extractContent` can read", so the
|
|
94
|
+
* intent-audit recovery, the trace-analyst log enrichment, and the onboarding
|
|
95
|
+
* content check can never drift on it.
|
|
96
|
+
*
|
|
97
|
+
* The body is surfaced under the standard `prompt` alias ONLY for `*.user_prompt`
|
|
98
|
+
* events (a generic log body is not content); an attribute-carried `prompt`
|
|
99
|
+
* already present is never overwritten.
|
|
100
|
+
*/
|
|
101
|
+
declare function logRecordContentBag(attributes: Record<string, unknown> | null | undefined, body: string | null | undefined): Record<string, unknown>;
|
|
102
|
+
/**
|
|
103
|
+
* Deterministic coding-agent label for an attribute bag, by the namespace of
|
|
104
|
+
* the content/event keys it carries, then the standard `gen_ai.system` /
|
|
105
|
+
* `service.name` identity. Returns a stable lowercase id
|
|
106
|
+
* (`claude-code` | `codex` | `opencode` | the gen_ai.system name) or
|
|
107
|
+
* `"unknown"` when nothing reliably identifies the emitter — never a fabricated
|
|
108
|
+
* default that pretends to know which agent produced the row.
|
|
109
|
+
*
|
|
110
|
+
* `service.name` is matched against a KNOWN-AGENT ALLOWLIST (exact), not a
|
|
111
|
+
* substring guess, so an arbitrary customer service named e.g. `claude-helper`
|
|
112
|
+
* stays `unknown` rather than being mislabelled `claude-code` and driving a
|
|
113
|
+
* wrong onboarding hint.
|
|
114
|
+
*/
|
|
115
|
+
declare function classifyAgent(bag: Record<string, unknown> | null | undefined): string;
|
|
116
|
+
/** A declared-intent recovery from a bag: the recovered text plus the source
|
|
117
|
+
* it came from — either the exact attribute key that matched, or `"messages"`
|
|
118
|
+
* when it came from the first user message of a parsed messages array. Lets a
|
|
119
|
+
* caller record traceable evidence (which key carried the intent) while still
|
|
120
|
+
* resolving through the ONE shared vocabulary. */
|
|
121
|
+
interface DeclaredIntentMatch {
|
|
122
|
+
text: string;
|
|
123
|
+
/** The matched attribute key, or `"messages"` for a messages-array source. */
|
|
124
|
+
source: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Recover the declared intent from a flattened attribute bag through the shared
|
|
128
|
+
* task/prompt/messages vocabulary, reporting WHICH key matched. The span path
|
|
129
|
+
* and the log-record path both call this, so they resolve intent through one
|
|
130
|
+
* key source and a key added to the shared layer is read by both. Walks the
|
|
131
|
+
* `task` field's keys, then the `prompt` field's keys (which include the
|
|
132
|
+
* span-only `user_request` / `input` / `llm.input` spellings folded into the
|
|
133
|
+
* priority list), then the first user message of a messages body. Returns null
|
|
134
|
+
* when nothing usable is present — never a fabricated intent.
|
|
135
|
+
*/
|
|
136
|
+
declare function resolveDeclaredIntent(bag: Record<string, unknown> | null | undefined): DeclaredIntentMatch | null;
|
|
137
|
+
/**
|
|
138
|
+
* Best-effort declared-task text from normalized content, in the order a
|
|
139
|
+
* declared intent is most likely to live: an explicit task, then the prompt,
|
|
140
|
+
* then the first user message in a messages array. Deliberately does NOT
|
|
141
|
+
* consult `completion` — an assistant completion is the agent's OUTPUT, not the
|
|
142
|
+
* declared task; treating it as the task would fabricate intent. Returns null
|
|
143
|
+
* when no genuine declared-task source is present — the caller skips, never
|
|
144
|
+
* fabricates.
|
|
145
|
+
*/
|
|
146
|
+
declare function declaredTaskText(content: NormalizedContent): string | null;
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/telemetry/genai-attributes.d.ts
|
|
149
|
+
/**
|
|
150
|
+
* OpenTelemetry GenAI semantic-convention span attributes — the single
|
|
151
|
+
* vocabulary every trace producer in the stack emits and the intelligence
|
|
152
|
+
* ingest reads, so model / token / cost attribution is identical regardless of
|
|
153
|
+
* which producer lowered the span (workflow emitter, SDK trace sink, …).
|
|
154
|
+
*
|
|
155
|
+
* Writers emit the PRIMARY keys (`GEN_AI_*`). The ingest reader accepts the
|
|
156
|
+
* wider candidate lists (`GEN_AI_*_KEYS`) because foreign SDKs spell the same
|
|
157
|
+
* field differently (Langfuse, raw OTLP GenAI, our own legacy `model`).
|
|
158
|
+
* Co-locating writer keys and reader candidates here is the drift guard: a
|
|
159
|
+
* writer's key and the reader's first candidate can never silently disagree.
|
|
160
|
+
*
|
|
161
|
+
* Spec: OpenTelemetry GenAI semantic conventions (`gen_ai.*`).
|
|
162
|
+
*/
|
|
163
|
+
/** Model that served a request — the primary key writers emit. */
|
|
164
|
+
declare const GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
|
|
165
|
+
/** Model named on a response — a reader fallback; writers prefer request.model. */
|
|
166
|
+
declare const GEN_AI_RESPONSE_MODEL = "gen_ai.response.model";
|
|
167
|
+
/** Prompt / input token count. */
|
|
168
|
+
declare const GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
|
|
169
|
+
/** Completion / output token count. */
|
|
170
|
+
declare const GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
|
|
171
|
+
/** Operation name (e.g. `"invoke_agent"`). */
|
|
172
|
+
declare const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
|
|
173
|
+
/** Conversation / session id grouping a multi-turn agent run. */
|
|
174
|
+
declare const GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
|
|
175
|
+
/**
|
|
176
|
+
* Reader candidate keys for the model, highest priority first. The first entry
|
|
177
|
+
* is the writers' primary key; the rest accept foreign-SDK spellings.
|
|
178
|
+
*/
|
|
179
|
+
declare const GEN_AI_MODEL_KEYS: readonly string[];
|
|
180
|
+
/** Reader candidate keys for input tokens, highest priority first. These name
|
|
181
|
+
* SPAN ATTRIBUTES on a lowered span — for the raw producer `tokenUsage` OBJECT
|
|
182
|
+
* field names (a distinct layer) see `TOKEN_USAGE_INPUT_KEYS` in
|
|
183
|
+
* `token-usage.ts`; a new producer shape may need an entry in both. */
|
|
184
|
+
declare const GEN_AI_INPUT_TOKEN_KEYS: readonly string[];
|
|
185
|
+
/** Reader candidate keys for output tokens, highest priority first. */
|
|
186
|
+
declare const GEN_AI_OUTPUT_TOKEN_KEYS: readonly string[];
|
|
187
|
+
/** A model/token usage record to lower into the GenAI attribute bag. */
|
|
188
|
+
interface GenAiUsage {
|
|
189
|
+
/** Model slug; omitted from the attribute bag when absent or empty. */
|
|
190
|
+
model?: string;
|
|
191
|
+
/** Prompt tokens; omitted unless a finite, non-negative number. */
|
|
192
|
+
inputTokens?: number;
|
|
193
|
+
/** Completion tokens; omitted unless a finite, non-negative number. */
|
|
194
|
+
outputTokens?: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Lower a usage record to the GenAI semantic-convention attribute bag, OMITTING
|
|
198
|
+
* any unknown field. A synthesized zero token count or empty model would
|
|
199
|
+
* corrupt every downstream token/cost aggregate, so absent stays absent — the
|
|
200
|
+
* ingest then reads "cost not computed", never "free". This is the writer-side
|
|
201
|
+
* mirror of {@link GEN_AI_MODEL_KEYS} / the `*_TOKEN_KEYS` reader candidates.
|
|
202
|
+
*/
|
|
203
|
+
declare function genAiUsageAttributes(usage: GenAiUsage): Record<string, string | number>;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/telemetry/spine-attributes.d.ts
|
|
206
|
+
/**
|
|
207
|
+
* Spine run/subject/tree + trigger span-attribute vocabulary — the single set of
|
|
208
|
+
* `tangle.*` keys that name a run, its parent, its kind, its trigger, and the
|
|
209
|
+
* durable subject it worked on. Co-located here so the WRITER (the platform
|
|
210
|
+
* workflow-trace-emitter) and the READERS (intelligence-api's run-attrs derivers
|
|
211
|
+
* + reconstruct) key off one source and can never silently drift.
|
|
212
|
+
*
|
|
213
|
+
* Writers emit the PRIMARY keys (`*_KEY`). The ingest reader accepts the wider
|
|
214
|
+
* CANDIDATE lists (`*_ATTRS`) because the emit sites disagree on spelling: the
|
|
215
|
+
* workflow emitter writes camel `tangle.runId`, the agent setup prompt documents
|
|
216
|
+
* dotted `tangle.run.id`. Each candidate list's first entry is a writer primary
|
|
217
|
+
* key, so the drift guard (`spine-attributes.test.ts`) can assert writer/reader
|
|
218
|
+
* agreement.
|
|
219
|
+
*
|
|
220
|
+
* The DERIVATION LOGIC (priority resolution, parent!=own-run guard, run-kind
|
|
221
|
+
* inference, subject `'default'` fallback, `source:id` formatting) lives in
|
|
222
|
+
* intelligence-api's `run-attrs.ts`; only the key constants and candidate lists
|
|
223
|
+
* live here. The foreign subject candidates (`symphony.issue.identifier`,
|
|
224
|
+
* `git.repository`, `service.name`) are members of {@link SUBJECT_KEY_ATTRS}.
|
|
225
|
+
*/
|
|
226
|
+
/** Primary run-id key writers stamp; first entry of {@link RUN_KEY_ATTRS}. */
|
|
227
|
+
declare const TANGLE_RUN_ID_KEY = "tangle.run.id";
|
|
228
|
+
/** Camel run-id key the workflow emitter actually writes on every span. */
|
|
229
|
+
declare const TANGLE_RUN_ID_CAMEL_KEY = "tangle.runId";
|
|
230
|
+
/** Primary parent-run-id key; first entry of {@link PARENT_RUN_KEY_ATTRS}. */
|
|
231
|
+
declare const TANGLE_RUN_PARENT_ID_KEY = "tangle.run.parent_id";
|
|
232
|
+
/** Primary run-kind key; the sole entry of {@link RUN_KIND_ATTRS}. */
|
|
233
|
+
declare const TANGLE_RUN_KIND_KEY = "tangle.run.kind";
|
|
234
|
+
/** Primary subject key; first entry of {@link SUBJECT_KEY_ATTRS}. */
|
|
235
|
+
declare const TANGLE_SUBJECT_KEY = "tangle.subject.key";
|
|
236
|
+
/** Primary trigger-source key; first entry of {@link TRIGGER_SOURCE_ATTRS}. */
|
|
237
|
+
declare const TANGLE_TRIGGER_SOURCE_KEY = "tangle.workflow.trigger.source";
|
|
238
|
+
/** Trigger-kind key the workflow emitter writes on the root span. */
|
|
239
|
+
declare const TANGLE_TRIGGER_KIND_KEY = "tangle.trigger.kind";
|
|
240
|
+
/** Primary trigger-id key; first entry of {@link TRIGGER_ID_ATTRS}. */
|
|
241
|
+
declare const TANGLE_TRIGGER_ID_KEY = "tangle.workflow.trigger.id";
|
|
242
|
+
/** Workflow-id key the workflow emitter writes on the root span; a
|
|
243
|
+
* {@link WORKFLOW_MARKER_ATTRS} member. */
|
|
244
|
+
declare const TANGLE_WORKFLOW_ID_KEY = "tangle.workflowId";
|
|
245
|
+
/** Run-id reader candidates, highest priority first. */
|
|
246
|
+
declare const RUN_KEY_ATTRS: readonly string[];
|
|
247
|
+
/**
|
|
248
|
+
* Parent-run-id reader candidates, highest priority first. After the explicit
|
|
249
|
+
* parent keys come the workflow-run ids, which name a parent only when this span
|
|
250
|
+
* is a distinct child run (the deriver's own-run guard enforces that).
|
|
251
|
+
*/
|
|
252
|
+
declare const PARENT_RUN_KEY_ATTRS: readonly string[];
|
|
253
|
+
/** Trigger-source reader candidates, highest priority first. */
|
|
254
|
+
declare const TRIGGER_SOURCE_ATTRS: readonly string[];
|
|
255
|
+
/** Trigger-id reader candidates, highest priority first. */
|
|
256
|
+
declare const TRIGGER_ID_ATTRS: readonly string[];
|
|
257
|
+
/**
|
|
258
|
+
* Subject-key reader candidates, highest priority first: declared subject key /
|
|
259
|
+
* project, else the agent's own work-item identity, else repo, else service. The
|
|
260
|
+
* deriver appends a `'default'` fallback so no run is orphaned.
|
|
261
|
+
*/
|
|
262
|
+
declare const SUBJECT_KEY_ATTRS: readonly string[];
|
|
263
|
+
/** Explicit run-kind reader candidates (exact `workflow`/`consultant`/`session`
|
|
264
|
+
* wins in the deriver). */
|
|
265
|
+
declare const RUN_KIND_ATTRS: readonly string[];
|
|
266
|
+
/** Workflow-presence markers — any one present implies a `workflow` run kind. */
|
|
267
|
+
declare const WORKFLOW_MARKER_ATTRS: readonly string[];
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/telemetry/token-usage.d.ts
|
|
270
|
+
/**
|
|
271
|
+
* Candidate field names for a producer-supplied `tokenUsage` bag on a
|
|
272
|
+
* `message.updated` trace event. Agents and SDK layers disagree on the
|
|
273
|
+
* spelling: `StreamTokenUsage` emits `inputTokens`/`outputTokens`, the eval and
|
|
274
|
+
* workflow agent.run paths emit `input`/`output`, and persisted / foreign
|
|
275
|
+
* shapes use snake_case or prompt/completion naming. A reader that wants the
|
|
276
|
+
* token counts must try all of them, highest-priority first, or it silently
|
|
277
|
+
* drops usage for the producers it does not name.
|
|
278
|
+
*
|
|
279
|
+
* Shared so every `tokenUsage` reader (the trace sink's root-span aggregation,
|
|
280
|
+
* the signal extractor) keys off the identical set and cannot drift.
|
|
281
|
+
*
|
|
282
|
+
* Distinct layer from `genai-attributes.ts`: those keys (`GEN_AI_*_TOKEN_KEYS`)
|
|
283
|
+
* name OTel SPAN ATTRIBUTES on an already-lowered span; these name the fields of
|
|
284
|
+
* the raw producer `tokenUsage` OBJECT before lowering. A new producer that
|
|
285
|
+
* spells token usage differently may need an entry in BOTH places.
|
|
286
|
+
*/
|
|
287
|
+
declare const TOKEN_USAGE_INPUT_KEYS: readonly string[];
|
|
288
|
+
declare const TOKEN_USAGE_OUTPUT_KEYS: readonly string[];
|
|
289
|
+
declare const TOKEN_USAGE_COST_KEYS: readonly string[];
|
|
290
|
+
interface TokenUsageCounts {
|
|
291
|
+
inputTokens: number;
|
|
292
|
+
outputTokens: number;
|
|
293
|
+
}
|
|
294
|
+
declare function tokenCount(value: unknown): number | undefined;
|
|
295
|
+
declare function firstTokenCount(source: Record<string, unknown> | undefined, keys: readonly string[]): number | undefined;
|
|
296
|
+
declare function firstUsageCostUsd(source: Record<string, unknown> | undefined, keys?: readonly string[]): number | undefined;
|
|
297
|
+
declare function tokenUsageSource(data: Record<string, unknown>): Record<string, unknown>;
|
|
298
|
+
declare function readTokenUsage(data: Record<string, unknown>): TokenUsageCounts | undefined;
|
|
299
|
+
declare function readTokenCostUsd(data: Record<string, unknown>): number | undefined;
|
|
300
|
+
declare function addTokenUsage(current: TokenUsageCounts | undefined, next: TokenUsageCounts): TokenUsageCounts;
|
|
301
|
+
//#endregion
|
|
302
|
+
export { extractContent as $, GEN_AI_MODEL_KEYS as A, CONTENT_KEYS as B, TANGLE_TRIGGER_SOURCE_KEY as C, WORKFLOW_MARKER_ATTRS as D, TRIGGER_SOURCE_ATTRS as E, GEN_AI_USAGE_INPUT_TOKENS as F, CONTENT_TOOL_RESULT_KEY as G, CONTENT_PROMPT_KEY as H, GEN_AI_USAGE_OUTPUT_TOKENS as I, NormalizedContent as J, ContentField as K, GenAiUsage as L, GEN_AI_OUTPUT_TOKEN_KEYS as M, GEN_AI_REQUEST_MODEL as N, GEN_AI_CONVERSATION_ID as O, GEN_AI_RESPONSE_MODEL as P, declaredTaskText as Q, genAiUsageAttributes as R, TANGLE_TRIGGER_KIND_KEY as S, TRIGGER_ID_ATTRS as T, CONTENT_TOOL_ARGS_KEY as U, CONTENT_KEY_FIELD as V, CONTENT_TOOL_NAME_KEY as W, asContentString as X, asContentField as Y, classifyAgent as Z, TANGLE_RUN_ID_KEY as _, addTokenUsage as a, TANGLE_SUBJECT_KEY as b, readTokenCostUsd as c, tokenUsageSource as d, hasContent as et, PARENT_RUN_KEY_ATTRS as f, TANGLE_RUN_ID_CAMEL_KEY as g, SUBJECT_KEY_ATTRS as h, TokenUsageCounts as i, GEN_AI_OPERATION_NAME as j, GEN_AI_INPUT_TOKEN_KEYS as k, readTokenUsage as l, RUN_KIND_ATTRS as m, TOKEN_USAGE_INPUT_KEYS as n, resolveDeclaredIntent as nt, firstTokenCount as o, RUN_KEY_ATTRS as p, DeclaredIntentMatch as q, TOKEN_USAGE_OUTPUT_KEYS as r, firstUsageCostUsd as s, TOKEN_USAGE_COST_KEYS as t, logRecordContentBag as tt, tokenCount as u, TANGLE_RUN_KIND_KEY as v, TANGLE_WORKFLOW_ID_KEY as w, TANGLE_TRIGGER_ID_KEY as x, TANGLE_RUN_PARENT_ID_KEY as y, CONTENT_COMPLETION_KEY as z };
|
|
303
|
+
//# sourceMappingURL=index-CBGkvDtv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CBGkvDtv.d.ts","names":[],"sources":["../src/telemetry/content-attributes.ts","../src/telemetry/genai-attributes.ts","../src/telemetry/spine-attributes.ts","../src/telemetry/token-usage.ts"],"mappings":";;AAiCA;;;;;;;;;;;;;AAaA;;;;;AAYA;;;;;AAEA;;;;;AAEA;;;UA7BiB,iBAAA;EACf,IAAA;EACA,MAAA;EACA,UAAA;EACA,QAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA;AAAA;;;;KAMU,YAAA,SAAqB,iBAAA;;cAYpB,kBAAA;;cAEA,sBAAA;AAwKb;A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,sBAAA;AF2Bb;AAAA,cExBa,aAAA;;;;AFmLb;;cEzKa,oBAAA;;cASA,oBAAA;AFuKb;AAAA,cEhKa,gBAAA;;;;;;cAUA,iBAAA;;;cAUA,cAAA;;cAKA,qBAAA;;;;AF5Db;;;;;;;;;;;;;AAaA;;;cG7Ba,sBAAA;AAAA,cAQA,uBAAA;AAAA,cAQA,qBAAA;AAAA,UAQI,gBAAA;EACf,WAAA;EACA,YAAA;AAAA;AAAA,iBAGc,UAAA,CAAW,KAAA;AAAA,iBAeX,eAAA,CACd,MAAA,EAAQ,MAAA,+BACR,IAAA;AAAA,iBAwBc,iBAAA,CACd,MAAA,EAAQ,MAAA,+BACR,IAAA;AAAA,iBAUc,gBAAA,CACd,IAAA,EAAM,MAAA,oBACL,MAAA;AAAA,iBAUa,cAAA,CACd,IAAA,EAAM,MAAA,oBACL,gBAAA;AAAA,iBAaa,gBAAA,CACd,IAAA,EAAM,MAAA;AAAA,iBAOQ,aAAA,CACd,OAAA,EAAS,gBAAA,cACT,IAAA,EAAM,gBAAA,GACL,gBAAA"}
|
|
@@ -5,8 +5,8 @@ import { FilePart, Part, Part as Part$1, PartBase, ReasoningPart, SubtaskPart, T
|
|
|
5
5
|
declare const AgentEventTypeSchema: z.ZodEnum<{
|
|
6
6
|
error: "error";
|
|
7
7
|
heartbeat: "heartbeat";
|
|
8
|
-
"message.part.updated": "message.part.updated";
|
|
9
8
|
status: "status";
|
|
9
|
+
"message.part.updated": "message.part.updated";
|
|
10
10
|
"connection.init": "connection.init";
|
|
11
11
|
"history.replay.start": "history.replay.start";
|
|
12
12
|
"history.replay.end": "history.replay.end";
|
|
@@ -130,4 +130,4 @@ interface TerminalExitEvent {
|
|
|
130
130
|
type TerminalEvent = TerminalDataEvent | TerminalResizeEvent | TerminalExitEvent;
|
|
131
131
|
//#endregion
|
|
132
132
|
export { ToolStateCompleted as A, TerminalDataEvent as C, TextPart as D, TerminalResizeEvent as E, isReasoningPart as F, isSubtaskPart as I, isTextPart as L, ToolStatePending as M, ToolStateRunning as N, ToolPart as O, isFilePart as P, isToolPart as R, SubtaskPart as S, TerminalExitEvent as T, ReplayEndEvent as _, DoneEvent as a, SessionUpdatedEvent as b, ExecutionCompletedEvent as c, FilePart as d, HeartbeatEvent as f, ReasoningPart as g, PartBase as h, ConnectionInitEvent as i, ToolStateError as j, ToolState as k, ExecutionFailedEvent as l, Part$1 as m, AgentEventType as n, ErrorEvent as o, MessagePartUpdatedEvent as p, AgentEventTypeSchema as r, EventMetadata as s, AgentEvent as t, ExecutionStartedEvent as u, ReplayStartEvent as v, TerminalEvent as w, StatusEvent as x, ResultEvent as y };
|
|
133
|
-
//# sourceMappingURL=index-
|
|
133
|
+
//# sourceMappingURL=index-Dz1ZLn3K.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Dz1ZLn3K.d.ts","names":[],"sources":["../src/types/events.ts"],"mappings":";;;;cAsCa,oBAAA,EAAoB,CAAA,CAAA,OAAA;;;;;;;;;;;;;;;KAgBrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,UAG3B,aAAA;EACf,gBAAA;EACA,GAAA;EACA,OAAA;EACA,MAAA;AAAA;AAAA,UAOe,uBAAA;EACf,IAAA;EACA,IAAA,EAAM,IAAA;EACN,KAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,UAIO,WAAA;EACf,IAAA;EACA,MAAA;EACA,MAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,UAIO,UAAA;EACf,IAAA;EACA,IAAA;EACA,OAAA;EACA,OAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,UAIO,cAAA;EACf,IAAA;EACA,SAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,UAIO,mBAAA;EACf,IAAA;EACA,gBAAA;EACA,QAAA;EACA,UAAA;EACA,SAAA;EACA,KAAA,GAAQ,aAAA;AAAA;AAAA,UAIO,gBAAA;EACf,IAAA;EACA,WAAA;EACA,SAAA;EACA,WAAA;EACA,MAAA;AAAA;AAAA,UAGe,cAAA;EACf,IAAA;EACA,WAAA;EACA,mBAAA;EACA,MAAA;EACA,UAAA;AAAA;AAAA,UAIe,qBAAA;EACf,IAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAGe,uBAAA;EACf,IAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAGe,oBAAA;EACf,IAAA;EACA,WAAA;EACA,SAAA;EACA,KAAA;EACA,SAAA;AAAA;AAAA,UAIe,mBAAA;EACf,IAAA;EACA,SAAA;EACA,KAAA;EACA,IAAA;IAAS,OAAA;IAAkB,OAAA;EAAA;AAAA;AAAA,UAIZ,WAAA;EACf,IAAA;EACA,SAAA;EACA,eAAA;EACA,UAAA,GAAa,MAAA;EACb,MAAA,GAAS,MAAA;EACT,QAAA,GAAW,MAAA;AAAA;AAAA,UAII,SAAA;EACf,IAAA;EACA,SAAA;AAAA;AAAA,KAIU,UAAA,GACR,uBAAA,GACA,WAAA,GACA,UAAA,GACA,cAAA,GACA,mBAAA,GACA,gBAAA,GACA,cAAA,GACA,qBAAA,GACA,uBAAA,GACA,oBAAA,GACA,mBAAA,GACA,WAAA,GACA,SAAA;AAAA,UAGa,iBAAA;EACf,IAAA;EACA,IAAA;EACA,UAAA;AAAA;AAAA,UAGe,mBAAA;EACf,IAAA;EACA,IAAA;EACA,IAAA;EACA,UAAA;AAAA;AAAA,UAGe,iBAAA;EACf,IAAA;EACA,QAAA;EACA,UAAA;AAAA;AAAA,KAGU,aAAA,GACR,iBAAA,GACA,mBAAA,GACA,iBAAA"}
|
|
@@ -349,4 +349,4 @@ declare class MockTransportAdapter extends BaseTransportAdapter {
|
|
|
349
349
|
}
|
|
350
350
|
//#endregion
|
|
351
351
|
export { TransportMode as S, StreamOptions as _, RecordedRequest as a, TransportEvents as b, TransportAdapter as c, ConnectionQuality as d, ConnectionState as f, SSEEvent as g, RequestOptions as h, MockTransportConfig as i, ConnectionManager as l, ReconnectionConfig as m, MockStreamEvent as n, BaseTransportAdapter as o, DEFAULT_RECONNECTION_CONFIG as p, MockTransportAdapter as r, Subscription as s, MockResponse as t, ConnectionManagerConfig as u, SubscriptionState as v, TransportMetrics as x, TransportConfig as y };
|
|
352
|
-
//# sourceMappingURL=index-
|
|
352
|
+
//# sourceMappingURL=index-VcOZI9jN.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-VcOZI9jN.d.ts","names":[],"sources":["../src/transport/types.ts","../src/transport/connection-manager.ts","../src/transport/interface.ts","../src/transport/mock.ts"],"mappings":";;AAOA;;;;;KAAY,eAAA;;KAQA,iBAAA;;;AAQZ;;;;KAAY,aAAA;AAGZ;AAAA,UAAiB,QAAA;EACf,EAAA;EACA,KAAA;EACA,IAAA;EACA,KAAA;AAAA;;UAIe,cAAA;EACf,MAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA,GAAU,MAAA;EACV,MAAA,GAAS,WAAA;EACT,OAAA;AAAA;;UAIe,aAAA;EANL;EAQV,MAAA;EACA,IAAA;EAPA;EASA,IAAA;EACA,OAAA,GAAU,MAAA;EANK;EAQf,WAAA;;EAEA,SAAA,GAAY,kBAAA;EAAA;EAEZ,MAAA,GAAS,WAAA;AAAA;;UAIM,kBAAA;EAbf;EAeA,cAAA;EAZA;EAcA,UAAA;EAZA;EAcA,UAAA;EAZY;EAcZ,MAAA;EAZS;EAcT,WAAA;AAAA;AAVF;AAAA,cAca,2BAAA,EAA6B,QAAA,CAAS,kBAAA;;UASlC,gBAAA;EArBf;EAuBA,YAAA;EAnBA;EAqBA,cAAA;EAjBA;EAmBA,YAAA;EAnBW;EAqBX,mBAAA;EAXD;EAaC,kBAAA;EAnBwC;EAqBxC,gBAAA;EAZe;EAcf,aAAA;;EAEA,QAAA;AAAA;;UAIe,eAAA;EAZf;EAcA,WAAA,GA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essionScopedTokenPayloadSchema, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, d as ProjectScopedTokenPayloadSchema, f as ReadTokenPayload, g as SessionScopedTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, n as BatchScopedTokenPayloadSchema, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, t as BatchScopedTokenPayload, u as ProjectScopedTokenPayload, v as TokenScope, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "./types-
|
|
1
|
+
import { i as isSDKError, n as SDKError, r as isRetryable, t as ErrorCode } from "./index-BRyMBSkE.js";
|
|
2
|
+
import { C as ReadTokenAuth, S as NoAuth, T as StaticTokenAuth, _ as SessionScopedTokenPayloadSchema, a as CreateSessionResponse, b as AuthProvider, c as ProductSchema, d as ProjectScopedTokenPayloadSchema, f as ReadTokenPayload, g as SessionScopedTokenPayload, h as SendMessageRequestSchema, i as CreateSessionRequestSchema, l as ProductSecrets, m as SendMessageRequest, n as BatchScopedTokenPayloadSchema, o as Product, p as ReadTokenPayloadSchema, r as CreateSessionRequest, s as ProductAuthInfo, t as BatchScopedTokenPayload, u as ProjectScopedTokenPayload, v as TokenScope, w as RefreshableTokenAuth, x as CallbackAuth, y as TokenValidationResult } from "./types-D32txapu.js";
|
|
3
3
|
import { ChannelAccessResult, EnvTokenAuth, ProductAuth, ProductTokenIssuer, SidecarAuth, canBatchTokenAccessChannel, canProjectTokenAccessChannel, canSessionTokenAccessChannel, canTokenAccessChannel, decodeToken, extractProjectFromChannel, extractSessionFromChannel, generateApiKey, generateSecureToken, generateSigningSecret, getAllowedChannelPatterns, getTokenScope, getTokenTTL, hashApiKey, isBatchScopedToken, isProjectScopedToken, isSessionScopedToken, isTokenExpiringSoon, issueBatchScopedToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, validateChannelSubscription, validateTokenScope, verifyApiKey, verifyReadToken } from "./auth/index.js";
|
|
4
|
-
import { a as EventChannel, c as EventBufferConfig, i as ChannelHandler, n as EventDeduplicator, o as BufferedEvent, r as ChannelConfig, s as EventBuffer, t as DeduplicatorConfig } from "./index-
|
|
5
|
-
import { S as TransportMode, _ as StreamOptions, a as RecordedRequest, b as TransportEvents, c as TransportAdapter, d as ConnectionQuality, f as ConnectionState, g as SSEEvent, h as RequestOptions, i as MockTransportConfig, l as ConnectionManager, m as ReconnectionConfig, n as MockStreamEvent, o as BaseTransportAdapter, p as DEFAULT_RECONNECTION_CONFIG, r as MockTransportAdapter, s as Subscription, t as MockResponse, u as ConnectionManagerConfig, v as SubscriptionState, x as TransportMetrics, y as TransportConfig } from "./index-
|
|
6
|
-
import { a as ProtectionOptions, c as CircuitBreaker, d as CircuitOpenError, f as CircuitState, i as withTimeout, l as CircuitBreakerConfig, n as createTimeoutController, o as createProtectedFn, r as sleep, s as withProtection, t as TimeoutError, u as CircuitBreakerStats } from "./index-
|
|
4
|
+
import { a as EventChannel, c as EventBufferConfig, i as ChannelHandler, n as EventDeduplicator, o as BufferedEvent, r as ChannelConfig, s as EventBuffer, t as DeduplicatorConfig } from "./index-C7zlWVGc.js";
|
|
5
|
+
import { S as TransportMode, _ as StreamOptions, a as RecordedRequest, b as TransportEvents, c as TransportAdapter, d as ConnectionQuality, f as ConnectionState, g as SSEEvent, h as RequestOptions, i as MockTransportConfig, l as ConnectionManager, m as ReconnectionConfig, n as MockStreamEvent, o as BaseTransportAdapter, p as DEFAULT_RECONNECTION_CONFIG, r as MockTransportAdapter, s as Subscription, t as MockResponse, u as ConnectionManagerConfig, v as SubscriptionState, x as TransportMetrics, y as TransportConfig } from "./index-VcOZI9jN.js";
|
|
6
|
+
import { a as ProtectionOptions, c as CircuitBreaker, d as CircuitOpenError, f as CircuitState, i as withTimeout, l as CircuitBreakerConfig, n as createTimeoutController, o as createProtectedFn, r as sleep, s as withProtection, t as TimeoutError, u as CircuitBreakerStats } from "./index-BOD4IhTr.js";
|
|
7
7
|
import { ParsedSSEEvent, SSEChunkParser, SSEEventData, SSEParserOptions, StreamTokenUsage, StreamUsageAccumulator, StreamUsageExtractor, consumeSSEStream, createStreamUsageExtractor, createUsageCallback, parseSSEData, parseSSEStream } from "./sse/index.js";
|
|
8
|
-
import { A as
|
|
8
|
+
import { $ as extractContent, A as GEN_AI_MODEL_KEYS, B as CONTENT_KEYS, C as TANGLE_TRIGGER_SOURCE_KEY, D as WORKFLOW_MARKER_ATTRS, E as TRIGGER_SOURCE_ATTRS, F as GEN_AI_USAGE_INPUT_TOKENS, G as CONTENT_TOOL_RESULT_KEY, H as CONTENT_PROMPT_KEY, I as GEN_AI_USAGE_OUTPUT_TOKENS, J as NormalizedContent, K as ContentField, L as GenAiUsage, M as GEN_AI_OUTPUT_TOKEN_KEYS, N as GEN_AI_REQUEST_MODEL, O as GEN_AI_CONVERSATION_ID, P as GEN_AI_RESPONSE_MODEL, Q as declaredTaskText, R as genAiUsageAttributes, S as TANGLE_TRIGGER_KIND_KEY, T as TRIGGER_ID_ATTRS, U as CONTENT_TOOL_ARGS_KEY, V as CONTENT_KEY_FIELD, W as CONTENT_TOOL_NAME_KEY, X as asContentString, Y as asContentField, Z as classifyAgent, _ as TANGLE_RUN_ID_KEY, a as addTokenUsage, b as TANGLE_SUBJECT_KEY, c as readTokenCostUsd, d as tokenUsageSource, et as hasContent, f as PARENT_RUN_KEY_ATTRS, g as TANGLE_RUN_ID_CAMEL_KEY, h as SUBJECT_KEY_ATTRS, i as TokenUsageCounts, j as GEN_AI_OPERATION_NAME, k as GEN_AI_INPUT_TOKEN_KEYS, l as readTokenUsage, m as RUN_KIND_ATTRS, n as TOKEN_USAGE_INPUT_KEYS, nt as resolveDeclaredIntent, o as firstTokenCount, p as RUN_KEY_ATTRS, q as DeclaredIntentMatch, r as TOKEN_USAGE_OUTPUT_KEYS, s as firstUsageCostUsd, t as TOKEN_USAGE_COST_KEYS, tt as logRecordContentBag, u as tokenCount, v as TANGLE_RUN_KIND_KEY, w as TANGLE_WORKFLOW_ID_KEY, x as TANGLE_TRIGGER_ID_KEY, y as TANGLE_RUN_PARENT_ID_KEY, z as CONTENT_COMPLETION_KEY } from "./index-CBGkvDtv.js";
|
|
9
|
+
import { A as ToolStateCompleted, C as TerminalDataEvent, D as TextPart, E as TerminalResizeEvent, F as isReasoningPart, I as isSubtaskPart, L as isTextPart, M as ToolStatePending, N as ToolStateRunning, O as ToolPart, P as isFilePart, R as isToolPart, S as SubtaskPart, T as TerminalExitEvent, _ as ReplayEndEvent, a as DoneEvent, b as SessionUpdatedEvent, c as ExecutionCompletedEvent, d as FilePart, f as HeartbeatEvent, g as ReasoningPart, h as PartBase, i as ConnectionInitEvent, j as ToolStateError, k as ToolState, l as ExecutionFailedEvent, m as Part, n as AgentEventType, o as ErrorEvent, p as MessagePartUpdatedEvent, r as AgentEventTypeSchema, s as EventMetadata, t as AgentEvent, u as ExecutionStartedEvent, v as ReplayStartEvent, w as TerminalEvent, x as StatusEvent, y as ResultEvent } from "./index-Dz1ZLn3K.js";
|
|
9
10
|
|
|
10
11
|
//#region src/cache/index.d.ts
|
|
11
12
|
/**
|
|
@@ -418,84 +419,6 @@ declare function generateIdempotencyKey(): string;
|
|
|
418
419
|
/** Retry decorator for class methods */
|
|
419
420
|
declare function Retryable(config?: RetryConfig): <T>(_target: object, _propertyKey: string, descriptor: TypedPropertyDescriptor<(...args: unknown[]) => Promise<T>>) => TypedPropertyDescriptor<(...args: unknown[]) => Promise<T>>;
|
|
420
421
|
//#endregion
|
|
421
|
-
//#region src/telemetry/genai-attributes.d.ts
|
|
422
|
-
/**
|
|
423
|
-
* OpenTelemetry GenAI semantic-convention span attributes — the single
|
|
424
|
-
* vocabulary every trace producer in the stack emits and the intelligence
|
|
425
|
-
* ingest reads, so model / token / cost attribution is identical regardless of
|
|
426
|
-
* which producer lowered the span (workflow emitter, SDK trace sink, …).
|
|
427
|
-
*
|
|
428
|
-
* Writers emit the PRIMARY keys (`GEN_AI_*`). The ingest reader accepts the
|
|
429
|
-
* wider candidate lists (`GEN_AI_*_KEYS`) because foreign SDKs spell the same
|
|
430
|
-
* field differently (Langfuse, raw OTLP GenAI, our own legacy `model`).
|
|
431
|
-
* Co-locating writer keys and reader candidates here is the drift guard: a
|
|
432
|
-
* writer's key and the reader's first candidate can never silently disagree.
|
|
433
|
-
*
|
|
434
|
-
* Spec: OpenTelemetry GenAI semantic conventions (`gen_ai.*`).
|
|
435
|
-
*/
|
|
436
|
-
/** Model that served a request — the primary key writers emit. */
|
|
437
|
-
declare const GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
|
|
438
|
-
/** Model named on a response — a reader fallback; writers prefer request.model. */
|
|
439
|
-
declare const GEN_AI_RESPONSE_MODEL = "gen_ai.response.model";
|
|
440
|
-
/** Prompt / input token count. */
|
|
441
|
-
declare const GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
|
|
442
|
-
/** Completion / output token count. */
|
|
443
|
-
declare const GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
|
|
444
|
-
/** Operation name (e.g. `"invoke_agent"`). */
|
|
445
|
-
declare const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
|
|
446
|
-
/** Conversation / session id grouping a multi-turn agent run. */
|
|
447
|
-
declare const GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
|
|
448
|
-
/**
|
|
449
|
-
* Reader candidate keys for the model, highest priority first. The first entry
|
|
450
|
-
* is the writers' primary key; the rest accept foreign-SDK spellings.
|
|
451
|
-
*/
|
|
452
|
-
declare const GEN_AI_MODEL_KEYS: readonly string[];
|
|
453
|
-
/** Reader candidate keys for input tokens, highest priority first. These name
|
|
454
|
-
* SPAN ATTRIBUTES on a lowered span — for the raw producer `tokenUsage` OBJECT
|
|
455
|
-
* field names (a distinct layer) see `TOKEN_USAGE_INPUT_KEYS` in
|
|
456
|
-
* `token-usage.ts`; a new producer shape may need an entry in both. */
|
|
457
|
-
declare const GEN_AI_INPUT_TOKEN_KEYS: readonly string[];
|
|
458
|
-
/** Reader candidate keys for output tokens, highest priority first. */
|
|
459
|
-
declare const GEN_AI_OUTPUT_TOKEN_KEYS: readonly string[];
|
|
460
|
-
/** A model/token usage record to lower into the GenAI attribute bag. */
|
|
461
|
-
interface GenAiUsage {
|
|
462
|
-
/** Model slug; omitted from the attribute bag when absent or empty. */
|
|
463
|
-
model?: string;
|
|
464
|
-
/** Prompt tokens; omitted unless a finite, non-negative number. */
|
|
465
|
-
inputTokens?: number;
|
|
466
|
-
/** Completion tokens; omitted unless a finite, non-negative number. */
|
|
467
|
-
outputTokens?: number;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Lower a usage record to the GenAI semantic-convention attribute bag, OMITTING
|
|
471
|
-
* any unknown field. A synthesized zero token count or empty model would
|
|
472
|
-
* corrupt every downstream token/cost aggregate, so absent stays absent — the
|
|
473
|
-
* ingest then reads "cost not computed", never "free". This is the writer-side
|
|
474
|
-
* mirror of {@link GEN_AI_MODEL_KEYS} / the `*_TOKEN_KEYS` reader candidates.
|
|
475
|
-
*/
|
|
476
|
-
declare function genAiUsageAttributes(usage: GenAiUsage): Record<string, string | number>;
|
|
477
|
-
//#endregion
|
|
478
|
-
//#region src/telemetry/token-usage.d.ts
|
|
479
|
-
/**
|
|
480
|
-
* Candidate field names for a producer-supplied `tokenUsage` bag on a
|
|
481
|
-
* `message.updated` trace event. Agents and SDK layers disagree on the
|
|
482
|
-
* spelling: `StreamTokenUsage` emits `inputTokens`/`outputTokens`, the eval and
|
|
483
|
-
* workflow agent.run paths emit `input`/`output`, and persisted / foreign
|
|
484
|
-
* shapes use snake_case or prompt/completion naming. A reader that wants the
|
|
485
|
-
* token counts must try all of them, highest-priority first, or it silently
|
|
486
|
-
* drops usage for the producers it does not name.
|
|
487
|
-
*
|
|
488
|
-
* Shared so every `tokenUsage` reader (the trace sink's root-span aggregation,
|
|
489
|
-
* the signal extractor) keys off the identical set and cannot drift.
|
|
490
|
-
*
|
|
491
|
-
* Distinct layer from `genai-attributes.ts`: those keys (`GEN_AI_*_TOKEN_KEYS`)
|
|
492
|
-
* name OTel SPAN ATTRIBUTES on an already-lowered span; these name the fields of
|
|
493
|
-
* the raw producer `tokenUsage` OBJECT before lowering. A new producer that
|
|
494
|
-
* spells token usage differently may need an entry in BOTH places.
|
|
495
|
-
*/
|
|
496
|
-
declare const TOKEN_USAGE_INPUT_KEYS: readonly string[];
|
|
497
|
-
declare const TOKEN_USAGE_OUTPUT_KEYS: readonly string[];
|
|
498
|
-
//#endregion
|
|
499
422
|
//#region src/utils/channel-matching.d.ts
|
|
500
423
|
/**
|
|
501
424
|
* Channel Pattern Matching
|
|
@@ -561,5 +484,5 @@ declare function createSessionTranslator(translation: SessionTranslation): <T>(e
|
|
|
561
484
|
*/
|
|
562
485
|
declare function extractSessionId(event: unknown): string | null;
|
|
563
486
|
//#endregion
|
|
564
|
-
export { type AgentEvent, type AgentEventType, AgentEventTypeSchema, type AuthProvider, BaseTransportAdapter, type BatchScopedTokenPayload, BatchScopedTokenPayloadSchema, BrowserNetworkInfo, BrowserPersistence, type BufferedEvent, type CacheConfig, type CacheStorage, CallbackAuth, type ChannelAccessResult, type ChannelConfig, type ChannelHandler, CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type ConnectionInitEvent, ConnectionManager, type ConnectionManagerConfig, type ConnectionQuality, type ConnectionState, type CreateSessionRequest, CreateSessionRequestSchema, type CreateSessionResponse, DEFAULT_RECONNECTION_CONFIG, type DeduplicatorConfig, type DoneEvent, EnvTokenAuth, type ErrorCode, type ErrorContext, type ErrorEvent, EventBuffer, type EventBufferConfig, EventChannel, EventDeduplicator, type EventMetadata, type ExecutionCompletedEvent, type ExecutionFailedEvent, type ExecutionStartedEvent, type FilePart, GEN_AI_CONVERSATION_ID, GEN_AI_INPUT_TOKEN_KEYS, GEN_AI_MODEL_KEYS, GEN_AI_OPERATION_NAME, GEN_AI_OUTPUT_TOKEN_KEYS, GEN_AI_REQUEST_MODEL, GEN_AI_RESPONSE_MODEL, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, type GenAiUsage, type HeartbeatEvent, type Interceptor, InterceptorChain, LocalStorage, MemoryCache, MemorySecureStorage, MemoryStorage, type MessagePartUpdatedEvent, type MockResponse, type MockStreamEvent, MockTransportAdapter, type MockTransportConfig, type NetworkInfo, NoAuth, NodeNetworkInfo, OfflineQueue, type ParsedSSEEvent, type Part, type PartBase, type PersistenceAdapter, type PlatformAdapter, type PlatformCapabilities, type Product, ProductAuth, type ProductAuthInfo, ProductSchema, type ProductSecrets, ProductTokenIssuer, type ProjectScopedTokenPayload, ProjectScopedTokenPayloadSchema, type ProtectionOptions, type QueuedRequest, ReadTokenAuth, type ReadTokenPayload, ReadTokenPayloadSchema, type ReasoningPart, type ReconnectionConfig, type RecordedRequest, RefreshableTokenAuth, type ReplayEndEvent, type ReplayStartEvent, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type ResultEvent, type RetryConfig, Retryable, SDKError, SSEChunkParser, type SSEEvent, type SSEEventData, type SSEParserOptions, type SecureStorage, type SendMessageRequest, SendMessageRequestSchema, type SessionScopedTokenPayload, SessionScopedTokenPayloadSchema, type SessionTranslation, type SessionUpdatedEvent, SidecarAuth, StaticTokenAuth, type StatusEvent, type Storage, StoragePersistence, type StreamOptions, type StreamTokenUsage, type StreamUsageAccumulator, StreamUsageExtractor, type Subscription, type SubscriptionState, type SubtaskPart, TOKEN_USAGE_INPUT_KEYS, TOKEN_USAGE_OUTPUT_KEYS, type TerminalDataEvent, type TerminalEvent, type TerminalExitEvent, type TerminalResizeEvent, type TextPart, TimeoutError, type TokenScope, type TokenValidationResult, type ToolPart, type ToolState, type ToolStateCompleted, type ToolStateError, type ToolStatePending, type ToolStateRunning, type TransportAdapter, type TransportConfig, type TransportEvents, type TransportMetrics, type TransportMode, calculateDelay, canBatchTokenAccessChannel, canProjectTokenAccessChannel, canSessionTokenAccessChannel, canTokenAccessChannel, consumeSSEStream, createDefaultPlatformAdapter, createHeaderInterceptor, createLoggingInterceptor, createMetricsInterceptor, createPlatformAdapter, createProtectedFn, createSessionTranslator, createStreamUsageExtractor, createTimeoutController, createUsageCallback, decodeToken, detectPlatform, detectStorage, extractProjectFromChannel, extractSessionFromChannel, extractSessionId, genAiUsageAttributes, generateApiKey, generateIdempotencyKey, generateRequestId, generateSecureToken, generateSigningSecret, getAllowedChannelPatterns, getTokenScope, getTokenTTL, hashApiKey, isBatchScopedToken, isFilePart, isProjectScopedToken, isReasoningPart, isRetryable, isSDKError, isSessionScopedToken, isSubtaskPart, isTextPart, isTokenExpiringSoon, isToolPart, issueBatchScopedToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, matchesAnyChannel, matchesChannel, parseSSEData, parseSSEStream, sleep, translateSessionId, validateChannelSubscription, validateTokenScope, verifyApiKey, verifyReadToken, withProtection, withRetry, withTimeout };
|
|
487
|
+
export { type AgentEvent, type AgentEventType, AgentEventTypeSchema, type AuthProvider, BaseTransportAdapter, type BatchScopedTokenPayload, BatchScopedTokenPayloadSchema, BrowserNetworkInfo, BrowserPersistence, type BufferedEvent, CONTENT_COMPLETION_KEY, CONTENT_KEYS, CONTENT_KEY_FIELD, CONTENT_PROMPT_KEY, CONTENT_TOOL_ARGS_KEY, CONTENT_TOOL_NAME_KEY, CONTENT_TOOL_RESULT_KEY, type CacheConfig, type CacheStorage, CallbackAuth, type ChannelAccessResult, type ChannelConfig, type ChannelHandler, CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerStats, CircuitOpenError, type CircuitState, type ConnectionInitEvent, ConnectionManager, type ConnectionManagerConfig, type ConnectionQuality, type ConnectionState, type ContentField, type CreateSessionRequest, CreateSessionRequestSchema, type CreateSessionResponse, DEFAULT_RECONNECTION_CONFIG, type DeclaredIntentMatch, type DeduplicatorConfig, type DoneEvent, EnvTokenAuth, type ErrorCode, type ErrorContext, type ErrorEvent, EventBuffer, type EventBufferConfig, EventChannel, EventDeduplicator, type EventMetadata, type ExecutionCompletedEvent, type ExecutionFailedEvent, type ExecutionStartedEvent, type FilePart, GEN_AI_CONVERSATION_ID, GEN_AI_INPUT_TOKEN_KEYS, GEN_AI_MODEL_KEYS, GEN_AI_OPERATION_NAME, GEN_AI_OUTPUT_TOKEN_KEYS, GEN_AI_REQUEST_MODEL, GEN_AI_RESPONSE_MODEL, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, type GenAiUsage, type HeartbeatEvent, type Interceptor, InterceptorChain, LocalStorage, MemoryCache, MemorySecureStorage, MemoryStorage, type MessagePartUpdatedEvent, type MockResponse, type MockStreamEvent, MockTransportAdapter, type MockTransportConfig, type NetworkInfo, NoAuth, NodeNetworkInfo, type NormalizedContent, OfflineQueue, PARENT_RUN_KEY_ATTRS, type ParsedSSEEvent, type Part, type PartBase, type PersistenceAdapter, type PlatformAdapter, type PlatformCapabilities, type Product, ProductAuth, type ProductAuthInfo, ProductSchema, type ProductSecrets, ProductTokenIssuer, type ProjectScopedTokenPayload, ProjectScopedTokenPayloadSchema, type ProtectionOptions, type QueuedRequest, RUN_KEY_ATTRS, RUN_KIND_ATTRS, ReadTokenAuth, type ReadTokenPayload, ReadTokenPayloadSchema, type ReasoningPart, type ReconnectionConfig, type RecordedRequest, RefreshableTokenAuth, type ReplayEndEvent, type ReplayStartEvent, type RequestContext, type RequestOptions, ResponseCache, type ResponseContext, type ResultEvent, type RetryConfig, Retryable, SDKError, SSEChunkParser, type SSEEvent, type SSEEventData, type SSEParserOptions, SUBJECT_KEY_ATTRS, type SecureStorage, type SendMessageRequest, SendMessageRequestSchema, type SessionScopedTokenPayload, SessionScopedTokenPayloadSchema, type SessionTranslation, type SessionUpdatedEvent, SidecarAuth, StaticTokenAuth, type StatusEvent, type Storage, StoragePersistence, type StreamOptions, type StreamTokenUsage, type StreamUsageAccumulator, StreamUsageExtractor, type Subscription, type SubscriptionState, type SubtaskPart, TANGLE_RUN_ID_CAMEL_KEY, TANGLE_RUN_ID_KEY, TANGLE_RUN_KIND_KEY, TANGLE_RUN_PARENT_ID_KEY, TANGLE_SUBJECT_KEY, TANGLE_TRIGGER_ID_KEY, TANGLE_TRIGGER_KIND_KEY, TANGLE_TRIGGER_SOURCE_KEY, TANGLE_WORKFLOW_ID_KEY, TOKEN_USAGE_COST_KEYS, TOKEN_USAGE_INPUT_KEYS, TOKEN_USAGE_OUTPUT_KEYS, TRIGGER_ID_ATTRS, TRIGGER_SOURCE_ATTRS, type TerminalDataEvent, type TerminalEvent, type TerminalExitEvent, type TerminalResizeEvent, type TextPart, TimeoutError, type TokenScope, type TokenUsageCounts, type TokenValidationResult, type ToolPart, type ToolState, type ToolStateCompleted, type ToolStateError, type ToolStatePending, type ToolStateRunning, type TransportAdapter, type TransportConfig, type TransportEvents, type TransportMetrics, type TransportMode, WORKFLOW_MARKER_ATTRS, addTokenUsage, asContentField, asContentString, calculateDelay, canBatchTokenAccessChannel, canProjectTokenAccessChannel, canSessionTokenAccessChannel, canTokenAccessChannel, classifyAgent, consumeSSEStream, createDefaultPlatformAdapter, createHeaderInterceptor, createLoggingInterceptor, createMetricsInterceptor, createPlatformAdapter, createProtectedFn, createSessionTranslator, createStreamUsageExtractor, createTimeoutController, createUsageCallback, declaredTaskText, decodeToken, detectPlatform, detectStorage, extractContent, extractProjectFromChannel, extractSessionFromChannel, extractSessionId, firstTokenCount, firstUsageCostUsd, genAiUsageAttributes, generateApiKey, generateIdempotencyKey, generateRequestId, generateSecureToken, generateSigningSecret, getAllowedChannelPatterns, getTokenScope, getTokenTTL, hasContent, hashApiKey, isBatchScopedToken, isFilePart, isProjectScopedToken, isReasoningPart, isRetryable, isSDKError, isSessionScopedToken, isSubtaskPart, isTextPart, isTokenExpiringSoon, isToolPart, issueBatchScopedToken, issueProjectScopedToken, issueReadToken, issueSessionScopedToken, logRecordContentBag, matchesAnyChannel, matchesChannel, parseSSEData, parseSSEStream, readTokenCostUsd, readTokenUsage, resolveDeclaredIntent, sleep, tokenCount, tokenUsageSource, translateSessionId, validateChannelSubscription, validateTokenScope, verifyApiKey, verifyReadToken, withProtection, withRetry, withTimeout };
|
|
565
488
|
//# sourceMappingURL=index.d.ts.map
|