@rynfar/meridian 1.60.0 → 1.62.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.
- package/README.md +3 -1
- package/dist/{cli-k1djafvr.js → cli-k36dddkm.js} +998 -282
- package/dist/cli.js +1 -1
- package/dist/{profilePage-naychnb8.js → profilePage-gtazq15d.js} +9 -0
- package/dist/proxy/adapters/detect.d.ts.map +1 -1
- package/dist/proxy/adapters/jcode.d.ts +13 -0
- package/dist/proxy/adapters/jcode.d.ts.map +1 -0
- package/dist/proxy/adapters/prime.d.ts +99 -0
- package/dist/proxy/adapters/prime.d.ts.map +1 -0
- package/dist/proxy/errors.d.ts +14 -0
- package/dist/proxy/errors.d.ts.map +1 -1
- package/dist/proxy/messages.d.ts +28 -0
- package/dist/proxy/messages.d.ts.map +1 -1
- package/dist/proxy/oauthUsage.d.ts +34 -1
- package/dist/proxy/oauthUsage.d.ts.map +1 -1
- package/dist/proxy/openai.d.ts +5 -1
- package/dist/proxy/openai.d.ts.map +1 -1
- package/dist/proxy/passthroughEarlyStop.d.ts +48 -0
- package/dist/proxy/passthroughEarlyStop.d.ts.map +1 -1
- package/dist/proxy/query.d.ts +3 -2
- package/dist/proxy/query.d.ts.map +1 -1
- package/dist/proxy/sdkFeatures.d.ts.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/session/cache.d.ts +1 -1
- package/dist/proxy/session/cache.d.ts.map +1 -1
- package/dist/proxy/session/lineage.d.ts +70 -0
- package/dist/proxy/session/lineage.d.ts.map +1 -1
- package/dist/proxy/sessionStore.d.ts +5 -1
- package/dist/proxy/sessionStore.d.ts.map +1 -1
- package/dist/proxy/transform.d.ts +33 -0
- package/dist/proxy/transform.d.ts.map +1 -1
- package/dist/proxy/transforms/prime.d.ts +3 -0
- package/dist/proxy/transforms/prime.d.ts.map +1 -0
- package/dist/proxy/transforms/registry.d.ts.map +1 -1
- package/dist/proxy/turnOutcome.d.ts +179 -0
- package/dist/proxy/turnOutcome.d.ts.map +1 -0
- package/dist/server.js +1 -1
- package/dist/telemetry/landing.d.ts.map +1 -1
- package/dist/telemetry/profilePage.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -19,8 +19,12 @@ export interface StoredSession {
|
|
|
19
19
|
lineageHash?: string;
|
|
20
20
|
/** Per-message content hashes for precise diff-based compaction detection */
|
|
21
21
|
messageHashes?: string[];
|
|
22
|
+
/** Per-message hashes of individual content blocks for append-only tool results */
|
|
23
|
+
messageBlockHashes?: string[][];
|
|
22
24
|
/** Per-message SDK assistant UUIDs for undo rollback (null for user messages) */
|
|
23
25
|
sdkMessageUuids?: Array<string | null>;
|
|
26
|
+
/** Uuid of the last persisted passthrough deny — resume boundary after an early stop. */
|
|
27
|
+
passthroughResumeUuid?: string;
|
|
24
28
|
/** Last observed token usage for this Claude session */
|
|
25
29
|
contextUsage?: TokenUsage;
|
|
26
30
|
/** Previous Claude session ID preserved when the session mapping is replaced.
|
|
@@ -36,7 +40,7 @@ export declare function setSessionStoreDir(dir: string | null, opts?: {
|
|
|
36
40
|
}): void;
|
|
37
41
|
export declare function lookupSharedSession(key: string): StoredSession | undefined;
|
|
38
42
|
export declare function lookupSharedSessionByClaudeId(claudeSessionId: string): StoredSession | undefined;
|
|
39
|
-
export declare function storeSharedSession(key: string, claudeSessionId: string, messageCount?: number, lineageHash?: string, messageHashes?: string[], sdkMessageUuids?: Array<string | null>, contextUsage?: TokenUsage): void;
|
|
43
|
+
export declare function storeSharedSession(key: string, claudeSessionId: string, messageCount?: number, lineageHash?: string, messageHashes?: string[], sdkMessageUuids?: Array<string | null>, contextUsage?: TokenUsage, messageBlockHashes?: string[][], passthroughResumeUuid?: string | null): void;
|
|
40
44
|
/** Remove a single session from the shared file store.
|
|
41
45
|
* Used when a session is detected as stale (e.g. expired upstream). */
|
|
42
46
|
export declare function evictSharedSession(key: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.d.ts","sourceRoot":"","sources":["../../src/proxy/sessionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,iFAAiF;IACjF,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACtC,wDAAwD;IACxD,YAAY,CAAC,EAAE,UAAU,CAAA;IACzB;;kEAE8D;IAC9D,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC;AA0DD;;oFAEoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAG7F;AAsED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAG1E;AAED,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAYhG;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,MAAM,EACvB,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,EACtC,YAAY,CAAC,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"sessionStore.d.ts","sourceRoot":"","sources":["../../src/proxy/sessionStore.ts"],"names":[],"m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AAkB,CAAC,EAAE,MAAM,EAAE,EAAE,EAC/B,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,GACpC,IAAI,CAkDN;AAED;wEACwE;AACxE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAkBpD;AAED;;6DAE6D;AAC7D,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG;IAClD,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,SAAS,CAWZ;AAED;uEACuE;AACvE,wBAAgB,kBAAkB,IAAI,KAAK,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAC,CAUD;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAO1C"}
|
|
@@ -93,8 +93,41 @@ export interface TelemetryContext {
|
|
|
93
93
|
readonly cacheCreationTokens: number;
|
|
94
94
|
readonly cacheHitRate: number;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* A lineage decision, after it has been made.
|
|
98
|
+
*
|
|
99
|
+
* Observe-only in practice: the pipeline takes the returned context, but
|
|
100
|
+
* nothing downstream reads it back, so a plugin cannot change how a session
|
|
101
|
+
* resumes. That is deliberate — resume correctness is core's to own, and the
|
|
102
|
+
* three stale-lineage defects it has already produced are not a surface to
|
|
103
|
+
* open to third parties.
|
|
104
|
+
*
|
|
105
|
+
* `mismatch` is present only on a divergence, which is the case worth
|
|
106
|
+
* diagnosing: it names WHICH message stopped matching, where `prefix overlap
|
|
107
|
+
* 50/51` only ever said how many did. Content never appears — roles, block
|
|
108
|
+
* types, byte counts, and digests are enough to tell a late tool result from a
|
|
109
|
+
* rewritten transcript, and they are safe to write to a log.
|
|
110
|
+
*/
|
|
96
111
|
export interface SessionContext {
|
|
97
112
|
readonly adapter: string;
|
|
113
|
+
readonly lineage: "continuation" | "compaction" | "undo" | "diverged";
|
|
114
|
+
/** Set when lineage is `diverged`. */
|
|
115
|
+
readonly reason?: string;
|
|
116
|
+
readonly sessionKey?: string;
|
|
117
|
+
readonly storedCount?: number;
|
|
118
|
+
readonly incomingCount?: number;
|
|
119
|
+
readonly prefixOverlap?: number;
|
|
120
|
+
readonly mismatch?: {
|
|
121
|
+
readonly index: number;
|
|
122
|
+
readonly storedDigest?: string;
|
|
123
|
+
readonly incomingDigest?: string;
|
|
124
|
+
readonly previousDigest?: string;
|
|
125
|
+
readonly incomingShape?: {
|
|
126
|
+
readonly role: string;
|
|
127
|
+
readonly blocks: string;
|
|
128
|
+
readonly bytes: number;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
98
131
|
[key: string]: unknown;
|
|
99
132
|
}
|
|
100
133
|
export interface ToolUseContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/proxy/transform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAGnE;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IAGnB,SAAS,CAAC,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAAA;IA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,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/proxy/transforms/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/proxy/transforms/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAyC7C,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAE9E"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Was a turn productive, or did it come back silent?
|
|
3
|
+
*
|
|
4
|
+
* Three separate defects have now ended the same way: the proxy hands the
|
|
5
|
+
* client a well-formed terminal envelope — `stop_reason: "end_turn"`, HTTP 200,
|
|
6
|
+
* `error: null` — carrying nothing the client can act on. An interrupted tail
|
|
7
|
+
* (#768), an unsettled client abort (#768), a spent deny at the boundary seam
|
|
8
|
+
* (#768). Each was found by tracing its own cause; each was invisible until
|
|
9
|
+
* someone read a transcript.
|
|
10
|
+
*
|
|
11
|
+
* The causes differ, the shape does not. So this module states the shape as an
|
|
12
|
+
* invariant instead of chasing the next cause:
|
|
13
|
+
*
|
|
14
|
+
* A terminal envelope must carry text or a tool call.
|
|
15
|
+
*
|
|
16
|
+
* Anything else is a silent turn, and a silent turn is a defect — never a
|
|
17
|
+
* successful response. In an interactive session it costs a confused user and a
|
|
18
|
+
* retyped prompt. In an autonomous run there is nobody to retype: the loop sees
|
|
19
|
+
* a finished turn with no work in it and stops, or worse, reads its own
|
|
20
|
+
* unfulfilled promise on the next turn and reports the failure as its own.
|
|
21
|
+
*
|
|
22
|
+
* `thinking` deliberately does not count. The empty-turn signature IS thinking
|
|
23
|
+
* with an empty text block — counting it as content would classify the exact
|
|
24
|
+
* defect this module exists to catch as healthy.
|
|
25
|
+
*
|
|
26
|
+
* Text is treated as an answer, full stop. An earlier version also flagged a
|
|
27
|
+
* short text-only final on a deny-boundary continuation as an "announce" stall
|
|
28
|
+
* — "Let me read the config…" with no tool call — and spent a recovery turn on
|
|
29
|
+
* it. Measured against a live model that window turned out to be the shape of
|
|
30
|
+
* an ordinary concise answer: 12 recoveries across 12 healthy turns, zero
|
|
31
|
+
* genuine silences, and one case where the recovery rewrote a completed prose
|
|
32
|
+
* answer into a tool_use envelope the client would then execute. The cost of a
|
|
33
|
+
* false positive was not "one redundant closing turn"; it was acting on a
|
|
34
|
+
* question already answered. If that stall is real it needs a signal that
|
|
35
|
+
* distinguishes it from a short answer — length and conversation depth do not.
|
|
36
|
+
*
|
|
37
|
+
* Pure module — no I/O, no imports from server.ts or session/.
|
|
38
|
+
*/
|
|
39
|
+
/** What a completed turn delivered to the client. */
|
|
40
|
+
export type TurnOutcome = {
|
|
41
|
+
kind: "productive";
|
|
42
|
+
} | {
|
|
43
|
+
kind: "silent";
|
|
44
|
+
reason: SilentReason;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Why a turn is silent. Both shapes reach the client identically; they are
|
|
48
|
+
* distinguished so telemetry can tell "the model said nothing" from "the model
|
|
49
|
+
* said nothing and we never even opened a message".
|
|
50
|
+
*/
|
|
51
|
+
export type SilentReason =
|
|
52
|
+
/** Nothing at all — no blocks were forwarded. */
|
|
53
|
+
"no_blocks"
|
|
54
|
+
/** Blocks were forwarded, but none of them carried text or a tool call. */
|
|
55
|
+
| "no_actionable_content";
|
|
56
|
+
/**
|
|
57
|
+
* Classify a turn by what actually reached the client.
|
|
58
|
+
*
|
|
59
|
+
* `textEvents` counts forwarded text deltas, not text blocks: an EMPTY text
|
|
60
|
+
* block produces a block start and stop with no delta between them, which is
|
|
61
|
+
* precisely the shape a spent-deny turn takes. Counting blocks would miss it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function classifyTurnOutcome(input: {
|
|
64
|
+
/** Forwarded `text_delta` events (or, non-streaming, non-empty text blocks). */
|
|
65
|
+
textEvents: number;
|
|
66
|
+
/** Tool calls the client will execute — actionable even with no prose. */
|
|
67
|
+
toolUses: number;
|
|
68
|
+
/** Blocks forwarded in total, including thinking. */
|
|
69
|
+
blocksForwarded: number;
|
|
70
|
+
}): TurnOutcome;
|
|
71
|
+
/**
|
|
72
|
+
* The nudge sent to recover a silent turn, in the same SDK session.
|
|
73
|
+
*
|
|
74
|
+
* Deliberately not the CLI's own nudge ("your previous response had no visible
|
|
75
|
+
* output"). That one is issued INSIDE the session with the offending
|
|
76
|
+
* instruction still in context, so on the observed cases the model obeyed the
|
|
77
|
+
* instruction a second time and answered empty again. This one names the
|
|
78
|
+
* contradiction and discharges it, the same move that fixed the boundary seam.
|
|
79
|
+
*
|
|
80
|
+
* Says nothing about which defect caused the silence: the recovery is for the
|
|
81
|
+
* class, and the model does not need our diagnosis to answer.
|
|
82
|
+
*/
|
|
83
|
+
export declare const SILENT_TURN_NUDGE: string;
|
|
84
|
+
/**
|
|
85
|
+
* Fault injection: swallow the upstream text of this request's turn.
|
|
86
|
+
*
|
|
87
|
+
* The defect's live rate is roughly three in five hundred requests, all on a
|
|
88
|
+
* session's second turn. A harness cannot wait for that — a ten-attempt run
|
|
89
|
+
* expects 0.06 occurrences — so without injection a green E2E is ambiguous:
|
|
90
|
+
* the guard works, or the defect simply did not happen. That ambiguity is
|
|
91
|
+
* exactly what let two earlier "verified" fixes ship broken.
|
|
92
|
+
*
|
|
93
|
+
* So the shape is reproduced on demand: drop the text the upstream turn
|
|
94
|
+
* produced, leaving its block start and stop in place — an EMPTY text block,
|
|
95
|
+
* which is the production signature exactly. Everything downstream (detection,
|
|
96
|
+
* recovery, envelope, telemetry) then runs for real against a real model; only
|
|
97
|
+
* the trigger is synthetic.
|
|
98
|
+
*
|
|
99
|
+
* EVERY text delta of the turn is dropped, not just the first: one surviving
|
|
100
|
+
* delta makes the turn productive and the guard never engages. The recovery
|
|
101
|
+
* turn is unaffected because it forwards through its own path, not the upstream
|
|
102
|
+
* forward site this gates.
|
|
103
|
+
*
|
|
104
|
+
* Off unless MERIDIAN_DEBUG_FORCE_SILENT_TURN names a session id (or `1` for
|
|
105
|
+
* every session). Debug-only — never a production path.
|
|
106
|
+
*/
|
|
107
|
+
export declare function shouldInjectSilentTurn(input: {
|
|
108
|
+
raw: string | undefined;
|
|
109
|
+
sessionId: string | undefined;
|
|
110
|
+
}): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* One frame of a recovery turn, re-indexed for the client's wire. `kind`
|
|
113
|
+
* doubles as the enqueue label suffix, so telemetry keeps the exact names the
|
|
114
|
+
* recovery has always logged (silent_recovery_block_start, …).
|
|
115
|
+
*/
|
|
116
|
+
export type RecoveryLift = {
|
|
117
|
+
kind: "block_start";
|
|
118
|
+
frame: {
|
|
119
|
+
type: "content_block_start";
|
|
120
|
+
index: number;
|
|
121
|
+
content_block: {
|
|
122
|
+
type: "text";
|
|
123
|
+
text: string;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
} | {
|
|
127
|
+
kind: "text_delta";
|
|
128
|
+
frame: {
|
|
129
|
+
type: "content_block_delta";
|
|
130
|
+
index: number;
|
|
131
|
+
delta: {
|
|
132
|
+
type: "text_delta";
|
|
133
|
+
text: unknown;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/** Characters delivered — 0 when the delta carried a non-string text. */
|
|
137
|
+
textChars: number;
|
|
138
|
+
} | {
|
|
139
|
+
kind: "block_stop";
|
|
140
|
+
frame: {
|
|
141
|
+
type: "content_block_stop";
|
|
142
|
+
index: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Lift a recovery turn's stream events into the message already open on the
|
|
147
|
+
* client's wire.
|
|
148
|
+
*
|
|
149
|
+
* Only text is lifted. A tool call arriving in the recovery turn would need
|
|
150
|
+
* its own block index space and the client's turn boundary to match — out of
|
|
151
|
+
* scope for a recovery; it still counts as one, through the shared PreToolUse
|
|
152
|
+
* capture at the recovery site in server.ts.
|
|
153
|
+
*
|
|
154
|
+
* The lifter owns the re-indexing handshake: a text block start allocates a
|
|
155
|
+
* client index from the caller's space — so the recovery block continues the
|
|
156
|
+
* open message's numbering instead of colliding with it — deltas are rewritten
|
|
157
|
+
* onto that index, and stop releases it. Deltas and stops outside an open
|
|
158
|
+
* block are dropped: emitting them would be malformed SSE.
|
|
159
|
+
*/
|
|
160
|
+
export declare function createRecoveryLifter(allocateBlockIndex: () => number): {
|
|
161
|
+
lift(innerEvent: unknown): RecoveryLift | undefined;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Is one in-session recovery attempt worth making?
|
|
165
|
+
*
|
|
166
|
+
* Only for a stalled turn — silent or announce — at most once, and never when
|
|
167
|
+
* the client is already gone: a disconnected client cannot receive the
|
|
168
|
+
* recovered answer, and spending a model turn to write into a closed socket is
|
|
169
|
+
* pure waste.
|
|
170
|
+
*/
|
|
171
|
+
export declare function shouldAttemptRecovery(input: {
|
|
172
|
+
outcome: TurnOutcome;
|
|
173
|
+
alreadyAttempted: boolean;
|
|
174
|
+
clientGone: boolean;
|
|
175
|
+
/** The SDK session to resume; without it there is nothing to continue from. */
|
|
176
|
+
sessionId?: string;
|
|
177
|
+
enabled: boolean;
|
|
178
|
+
}): boolean;
|
|
179
|
+
//# sourceMappingURL=turnOutcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turnOutcome.d.ts","sourceRoot":"","sources":["../../src/proxy/turnOutcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,qDAAqD;AACrD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,CAAA;AAE5C;;;;GAIG;AACH,MAAM,MAAM,YAAY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,wBAAgB,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,MAAM,GAAG;IACtE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAAA;CACpD,CAgCA;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,OAAO,EAAE,WAAW,CAAA;IACpB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAMV"}
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing.d.ts","sourceRoot":"","sources":["../../src/telemetry/landing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"landing.d.ts","sourceRoot":"","sources":["../../src/telemetry/landing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,eAAO,MAAM,WAAW,QA8QhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profilePage.d.ts","sourceRoot":"","sources":["../../src/telemetry/profilePage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"profilePage.d.ts","sourceRoot":"","sources":["../../src/telemetry/profilePage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,eAAe,QA8bpB,CAAA"}
|
package/package.json
CHANGED