@shpitdev/convex-cliproxy-observability 0.1.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 (129) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +40 -0
  4. package/dist/capture/index.d.ts +79 -0
  5. package/dist/capture/index.d.ts.map +1 -0
  6. package/dist/capture/index.js +182 -0
  7. package/dist/capture/index.js.map +1 -0
  8. package/dist/client.d.ts +129 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +232 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/component/_generated/api.d.ts +12 -0
  13. package/dist/component/_generated/api.d.ts.map +1 -0
  14. package/dist/component/_generated/api.js +7 -0
  15. package/dist/component/_generated/api.js.map +1 -0
  16. package/dist/component/_generated/component.d.ts +17 -0
  17. package/dist/component/_generated/component.d.ts.map +1 -0
  18. package/dist/component/_generated/component.js +3 -0
  19. package/dist/component/_generated/component.js.map +1 -0
  20. package/dist/component/_generated/dataModel.d.ts +8 -0
  21. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  22. package/dist/component/_generated/dataModel.js +3 -0
  23. package/dist/component/_generated/dataModel.js.map +1 -0
  24. package/dist/component/_generated/server.d.ts +21 -0
  25. package/dist/component/_generated/server.d.ts.map +1 -0
  26. package/dist/component/_generated/server.js +11 -0
  27. package/dist/component/_generated/server.js.map +1 -0
  28. package/dist/component/convex.config.d.ts +4 -0
  29. package/dist/component/convex.config.d.ts.map +1 -0
  30. package/dist/component/convex.config.js +4 -0
  31. package/dist/component/convex.config.js.map +1 -0
  32. package/dist/component/ingest.d.ts +64 -0
  33. package/dist/component/ingest.d.ts.map +1 -0
  34. package/dist/component/ingest.js +309 -0
  35. package/dist/component/ingest.js.map +1 -0
  36. package/dist/component/queries.d.ts +136 -0
  37. package/dist/component/queries.d.ts.map +1 -0
  38. package/dist/component/queries.js +219 -0
  39. package/dist/component/queries.js.map +1 -0
  40. package/dist/component/schema.d.ts +159 -0
  41. package/dist/component/schema.d.ts.map +1 -0
  42. package/dist/component/schema.js +74 -0
  43. package/dist/component/schema.js.map +1 -0
  44. package/dist/content/index.d.ts +8 -0
  45. package/dist/content/index.d.ts.map +1 -0
  46. package/dist/content/index.js +41 -0
  47. package/dist/content/index.js.map +1 -0
  48. package/dist/model-call/index.d.ts +120 -0
  49. package/dist/model-call/index.d.ts.map +1 -0
  50. package/dist/model-call/index.js +96 -0
  51. package/dist/model-call/index.js.map +1 -0
  52. package/dist/projection.d.ts +19 -0
  53. package/dist/projection.d.ts.map +1 -0
  54. package/dist/projection.js +83 -0
  55. package/dist/projection.js.map +1 -0
  56. package/dist/protocols/anthropic-messages.d.ts +11 -0
  57. package/dist/protocols/anthropic-messages.d.ts.map +1 -0
  58. package/dist/protocols/anthropic-messages.js +114 -0
  59. package/dist/protocols/anthropic-messages.js.map +1 -0
  60. package/dist/protocols/chat-completions.d.ts +10 -0
  61. package/dist/protocols/chat-completions.d.ts.map +1 -0
  62. package/dist/protocols/chat-completions.js +89 -0
  63. package/dist/protocols/chat-completions.js.map +1 -0
  64. package/dist/protocols/checkpoint.d.ts +20 -0
  65. package/dist/protocols/checkpoint.d.ts.map +1 -0
  66. package/dist/protocols/checkpoint.js +318 -0
  67. package/dist/protocols/checkpoint.js.map +1 -0
  68. package/dist/protocols/content.d.ts +34 -0
  69. package/dist/protocols/content.d.ts.map +1 -0
  70. package/dist/protocols/content.js +40 -0
  71. package/dist/protocols/content.js.map +1 -0
  72. package/dist/protocols/framing.d.ts +20 -0
  73. package/dist/protocols/framing.d.ts.map +1 -0
  74. package/dist/protocols/framing.js +67 -0
  75. package/dist/protocols/framing.js.map +1 -0
  76. package/dist/protocols/index.d.ts +20 -0
  77. package/dist/protocols/index.d.ts.map +1 -0
  78. package/dist/protocols/index.js +139 -0
  79. package/dist/protocols/index.js.map +1 -0
  80. package/dist/protocols/output.d.ts +4 -0
  81. package/dist/protocols/output.d.ts.map +1 -0
  82. package/dist/protocols/output.js +81 -0
  83. package/dist/protocols/output.js.map +1 -0
  84. package/dist/protocols/responses.d.ts +12 -0
  85. package/dist/protocols/responses.d.ts.map +1 -0
  86. package/dist/protocols/responses.js +189 -0
  87. package/dist/protocols/responses.js.map +1 -0
  88. package/dist/protocols/types.d.ts +27 -0
  89. package/dist/protocols/types.d.ts.map +1 -0
  90. package/dist/protocols/types.js +2 -0
  91. package/dist/protocols/types.js.map +1 -0
  92. package/dist/protocols/usage.d.ts +3 -0
  93. package/dist/protocols/usage.d.ts.map +1 -0
  94. package/dist/protocols/usage.js +27 -0
  95. package/dist/protocols/usage.js.map +1 -0
  96. package/dist/protocols/values.d.ts +10 -0
  97. package/dist/protocols/values.d.ts.map +1 -0
  98. package/dist/protocols/values.js +32 -0
  99. package/dist/protocols/values.js.map +1 -0
  100. package/dist/test.d.ts +155 -0
  101. package/dist/test.d.ts.map +1 -0
  102. package/dist/test.js +8 -0
  103. package/dist/test.js.map +1 -0
  104. package/package.json +90 -0
  105. package/src/capture/index.ts +277 -0
  106. package/src/client.ts +286 -0
  107. package/src/component/_generated/api.ts +19 -0
  108. package/src/component/_generated/component.ts +32 -0
  109. package/src/component/_generated/dataModel.ts +15 -0
  110. package/src/component/_generated/server.ts +43 -0
  111. package/src/component/convex.config.ts +3 -0
  112. package/src/component/ingest.ts +328 -0
  113. package/src/component/queries.ts +248 -0
  114. package/src/component/schema.ts +73 -0
  115. package/src/content/index.ts +53 -0
  116. package/src/model-call/index.ts +224 -0
  117. package/src/projection.ts +99 -0
  118. package/src/protocols/anthropic-messages.ts +115 -0
  119. package/src/protocols/chat-completions.ts +94 -0
  120. package/src/protocols/checkpoint.ts +342 -0
  121. package/src/protocols/content.ts +41 -0
  122. package/src/protocols/framing.ts +62 -0
  123. package/src/protocols/index.ts +140 -0
  124. package/src/protocols/output.ts +78 -0
  125. package/src/protocols/responses.ts +188 -0
  126. package/src/protocols/types.ts +26 -0
  127. package/src/protocols/usage.ts +36 -0
  128. package/src/protocols/values.ts +35 -0
  129. package/src/test.ts +16 -0
@@ -0,0 +1,129 @@
1
+ import type { GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, FunctionArgs } from "convex/server";
2
+ import type { ComponentApi } from "./component/_generated/component.js";
3
+ import type { CaptureObservationV1 } from "./capture/index.js";
4
+ import type { ModelCallV1 } from "./model-call/index.js";
5
+ import type { PrivateCaptureStorage } from "./content/index.js";
6
+ export * from "./model-call/index.js";
7
+ export { resolveCallBlob, type PrivateCaptureStorage } from "./content/index.js";
8
+ export type CliproxyObservabilityComponent = ComponentApi;
9
+ type ReadContext = Pick<GenericQueryCtx<GenericDataModel> | GenericMutationCtx<GenericDataModel> | GenericActionCtx<GenericDataModel>, "runQuery">;
10
+ type ActionContext = Pick<GenericActionCtx<GenericDataModel>, "runMutation" | "runQuery">;
11
+ export declare class CliproxyObservability {
12
+ readonly component: ComponentApi;
13
+ constructor(component: ComponentApi);
14
+ pageRecentSummaries(ctx: ReadContext, args: FunctionArgs<ComponentApi["queries"]["pageRecentSummaries"]>): Promise<{
15
+ calls: ModelCallV1[];
16
+ cursor: {
17
+ receivedAt: number;
18
+ creationTime: number;
19
+ } | null;
20
+ done: boolean;
21
+ }>;
22
+ pageCorrelationSummaries(ctx: ReadContext, args: FunctionArgs<ComponentApi["queries"]["pageRecentSummaries"]> & {
23
+ correlation: NonNullable<FunctionArgs<ComponentApi["queries"]["pageRecentSummaries"]>["correlation"]>;
24
+ }): Promise<{
25
+ calls: ModelCallV1[];
26
+ cursor: {
27
+ receivedAt: number;
28
+ creationTime: number;
29
+ } | null;
30
+ done: boolean;
31
+ }>;
32
+ getCall(ctx: ReadContext, args: {
33
+ destinationId: string;
34
+ callId: string;
35
+ }): Promise<{
36
+ summaryJson: string;
37
+ checkpointJson: undefined;
38
+ _id: import("convex/values").GenericId<"calls">;
39
+ _creationTime: number;
40
+ terminalSequence?: number | undefined;
41
+ projectionFailure?: {
42
+ reason: string;
43
+ at: number;
44
+ } | undefined;
45
+ requestId?: string | undefined;
46
+ runId?: string | undefined;
47
+ jobId?: string | undefined;
48
+ rootExecutionId?: string | undefined;
49
+ opencodeSessionId?: string | undefined;
50
+ destinationId: string;
51
+ callId: string;
52
+ instanceId: string;
53
+ pluginBootId: string;
54
+ executionId: string;
55
+ receivedAt: number;
56
+ revision: number;
57
+ projectedThroughSequence: number;
58
+ persistedThroughSequence: number;
59
+ } | null>;
60
+ pageEventSegments(ctx: ReadContext, args: FunctionArgs<ComponentApi["queries"]["pageEventSegments"]>): Promise<{
61
+ segments: {
62
+ _id: import("convex/values").GenericId<"segments">;
63
+ _creationTime: number;
64
+ destinationId: string;
65
+ callId: string;
66
+ receivedAt: number;
67
+ reference: {
68
+ key: string;
69
+ sha256: string;
70
+ byteLength: number;
71
+ contentType: string;
72
+ };
73
+ sequence: number;
74
+ throughSequence: number;
75
+ identity: string;
76
+ digest: string;
77
+ }[];
78
+ cursor: number;
79
+ done: boolean;
80
+ }>;
81
+ getBootHealth(ctx: ReadContext, args: {
82
+ destinationId: string;
83
+ instanceId: string;
84
+ pluginBootId: string;
85
+ }): Promise<{
86
+ _id: import("convex/values").GenericId<"bootHealth">;
87
+ _creationTime: number;
88
+ destinationId: string;
89
+ instanceId: string;
90
+ pluginBootId: string;
91
+ observedAt: number;
92
+ healthJson: string;
93
+ } | null>;
94
+ getCaptureCoverage(ctx: ReadContext, args: {
95
+ destinationId: string;
96
+ }): Promise<{
97
+ retention: "indefinite";
98
+ preHook: "unavailable";
99
+ previews: "not_enrolled";
100
+ attemptDetail: "unavailable";
101
+ sources: {
102
+ _id: import("convex/values").GenericId<"sourceStatus">;
103
+ _creationTime: number;
104
+ healthJson?: string | undefined;
105
+ destinationId: string;
106
+ instanceId: string;
107
+ pluginBootId: string;
108
+ lastObservedAt: string;
109
+ lastReceivedAt: number;
110
+ coverage: string;
111
+ }[];
112
+ sourcesComplete: boolean;
113
+ }>;
114
+ }
115
+ export declare function initialCall(o: CaptureObservationV1, callId: string, receivedAt: number): ModelCallV1;
116
+ export type CaptureHandlerOptions = {
117
+ client: CliproxyObservability;
118
+ destinationId: string;
119
+ deploymentId: string;
120
+ environment: "dev" | "prod";
121
+ instanceIds: readonly string[];
122
+ tokens: readonly string[];
123
+ storage: PrivateCaptureStorage;
124
+ scheduleProjection: (ctx: ActionContext, callId: string) => Promise<void>;
125
+ };
126
+ export declare function readBoundedCaptureBody(request: Request): Promise<Uint8Array>;
127
+ export declare function handleCliproxyCaptureRequest(ctx: ActionContext, request: Request, options: CaptureHandlerOptions): Promise<Response>;
128
+ export { projectPendingSegments } from "./projection.js";
129
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAClF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACjF,MAAM,MAAM,8BAA8B,GAAG,YAAY,CAAC;AAC1D,KAAK,WAAW,GAAG,IAAI,CACnB,eAAe,CAAC,gBAAgB,CAAC,GACjC,kBAAkB,CAAC,gBAAgB,CAAC,GACpC,gBAAgB,CAAC,gBAAgB,CAAC,EACpC,UAAU,CACX,CAAC;AACF,KAAK,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,aAAa,GAAG,UAAU,CAAC,CAAC;AAC1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aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,kBAAkB,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E,CAAC;AAOF,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CA4BlF;AACD,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,QAAQ,CAAC,CA2HnB;AACD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/client.js ADDED
@@ -0,0 +1,232 @@
1
+ import { MAX_ENVELOPE_BYTES, validateSegment, sha256 } from "./capture/index.js";
2
+ import { nanoTime, protocolForRoute, PARSER_VERSION } from "./protocols/index.js";
3
+ export * from "./model-call/index.js";
4
+ export { resolveCallBlob } from "./content/index.js";
5
+ export class CliproxyObservability {
6
+ component;
7
+ constructor(component) {
8
+ this.component = component;
9
+ }
10
+ pageRecentSummaries(ctx, args) {
11
+ return ctx.runQuery(this.component.queries.pageRecentSummaries, args);
12
+ }
13
+ pageCorrelationSummaries(ctx, args) {
14
+ return this.pageRecentSummaries(ctx, args);
15
+ }
16
+ getCall(ctx, args) {
17
+ return ctx.runQuery(this.component.queries.getCall, args);
18
+ }
19
+ pageEventSegments(ctx, args) {
20
+ return ctx.runQuery(this.component.queries.pageEventSegments, args);
21
+ }
22
+ getBootHealth(ctx, args) {
23
+ return ctx.runQuery(this.component.queries.getBootHealth, args);
24
+ }
25
+ getCaptureCoverage(ctx, args) {
26
+ return ctx.runQuery(this.component.queries.getCaptureCoverage, args);
27
+ }
28
+ }
29
+ export function initialCall(o, callId, receivedAt) {
30
+ return {
31
+ schemaVersion: 1,
32
+ source: "cliproxy",
33
+ callId,
34
+ sourceDocumentId: "",
35
+ gateway: "cliproxy",
36
+ authType: "unknown",
37
+ route: o.route,
38
+ configRevision: o.configRevision,
39
+ destinationId: o.destinationId,
40
+ instanceId: o.instanceId,
41
+ pluginBootId: o.pluginBootId,
42
+ executionId: o.requestId,
43
+ sourceTraceId: o.sourceTraceId,
44
+ traceId: o.correlation?.traceId,
45
+ requestModel: o.requestedModel?.slice(0, 256),
46
+ operation: o.route === "GET /v1/models"
47
+ ? "discovery"
48
+ : o.route === "POST /v1/messages/count_tokens"
49
+ ? "token_count"
50
+ : "generation",
51
+ clientProtocol: protocolForRoute(o.route),
52
+ state: "in_progress",
53
+ timingSource: "plugin_observed",
54
+ startTimeUnixNano: nanoTime(o.observedAt),
55
+ correlation: o.correlation ?? {},
56
+ correlationConflicts: o.correlationConflicts ?? [],
57
+ usage: [],
58
+ cost: { kind: "unknown" },
59
+ attemptDetail: "unavailable",
60
+ capture: {
61
+ raw: "partial",
62
+ projection: "partial",
63
+ usage: "unavailable",
64
+ preHook: "unavailable",
65
+ projectedThroughSequence: 0,
66
+ persistedThroughSequence: 0,
67
+ gaps: [],
68
+ parserVersion: PARSER_VERSION,
69
+ pluginVersion: o.pluginVersion,
70
+ redactionVersion: o.redactionVersion,
71
+ lastObservedAt: o.observedAt,
72
+ },
73
+ receivedAt,
74
+ };
75
+ }
76
+ function tokenMatches(presented, expected) {
77
+ let diff = presented.length ^ expected.length;
78
+ for (let i = 0; i < Math.max(presented.length, expected.length); i++)
79
+ diff |= (presented.charCodeAt(i) || 0) ^ (expected.charCodeAt(i) || 0);
80
+ return diff === 0;
81
+ }
82
+ export async function readBoundedCaptureBody(request) {
83
+ if (Number(request.headers.get("Content-Length")) > MAX_ENVELOPE_BYTES)
84
+ throw new RangeError("envelope limit");
85
+ const reader = request.body?.getReader();
86
+ if (!reader)
87
+ return new Uint8Array();
88
+ let size = 0;
89
+ const chunks = [];
90
+ try {
91
+ while (true) {
92
+ const { done, value } = await reader.read();
93
+ if (done)
94
+ break;
95
+ size += value.byteLength;
96
+ if (size > MAX_ENVELOPE_BYTES) {
97
+ await reader.cancel();
98
+ throw new RangeError("envelope limit");
99
+ }
100
+ chunks.push(value);
101
+ }
102
+ }
103
+ finally {
104
+ reader.releaseLock();
105
+ }
106
+ const out = new Uint8Array(size);
107
+ let offset = 0;
108
+ for (const chunk of chunks) {
109
+ out.set(chunk, offset);
110
+ offset += chunk.length;
111
+ }
112
+ return out;
113
+ }
114
+ export async function handleCliproxyCaptureRequest(ctx, request, options) {
115
+ if (request.method !== "POST")
116
+ return new Response("method not allowed", { status: 405 });
117
+ if (options.tokens.length === 0 || options.tokens.some((x) => x.length < 24))
118
+ return new Response("capture unavailable", { status: 503 });
119
+ const bearer = request.headers.get("Authorization") ?? "";
120
+ if (!/^Bearer [^,\r\n]+$/.test(bearer) ||
121
+ !options.tokens.some((token) => tokenMatches(bearer, `Bearer ${token}`)))
122
+ return new Response("unauthorized", { status: 401 });
123
+ if (request.headers.get("Content-Type")?.split(";")[0]?.trim() !== "application/json")
124
+ return new Response("unsupported content type", { status: 415 });
125
+ let parsed;
126
+ try {
127
+ const raw = await readBoundedCaptureBody(request);
128
+ const candidate = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(raw));
129
+ if (candidate?.operation === "health") {
130
+ if (candidate.schemaVersion !== 1 ||
131
+ candidate.destinationId !== options.destinationId ||
132
+ !options.instanceIds.includes(candidate.instanceId))
133
+ return new Response("scope mismatch", { status: 403 });
134
+ return Response.json({
135
+ ready: true,
136
+ destinationId: options.destinationId,
137
+ deploymentId: options.deploymentId,
138
+ instanceId: candidate.instanceId,
139
+ schemaVersion: 1,
140
+ });
141
+ }
142
+ if (candidate?.operation === "health_record") {
143
+ if (raw.length > 16384 ||
144
+ candidate.schemaVersion !== 1 ||
145
+ candidate.destinationId !== options.destinationId ||
146
+ !options.instanceIds.includes(candidate.instanceId) ||
147
+ !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$/.test(candidate.pluginBootId) ||
148
+ candidate.precommitCoverage !== "unknown_before_local_commit")
149
+ return new Response("invalid health scope", { status: 403 });
150
+ const result = await ctx.runMutation(options.client.component.ingest.recordHealth, {
151
+ destinationId: options.destinationId,
152
+ instanceId: candidate.instanceId,
153
+ pluginBootId: candidate.pluginBootId,
154
+ startedAt: candidate.startedAt,
155
+ observedAt: candidate.observedAt,
156
+ observationsTotal: candidate.observationsTotal,
157
+ droppedObservationsTotal: candidate.droppedObservationsTotal,
158
+ lostControlObservationsTotal: candidate.lostControlObservationsTotal,
159
+ scopeConflictsTotal: candidate.scopeConflictsTotal,
160
+ expiredScopesTotal: candidate.expiredScopesTotal,
161
+ activeCalls: candidate.activeCalls,
162
+ });
163
+ return Response.json({
164
+ ...result,
165
+ digest: await sha256(raw),
166
+ destinationId: options.destinationId,
167
+ deploymentId: options.deploymentId,
168
+ });
169
+ }
170
+ parsed = await validateSegment(raw, options);
171
+ }
172
+ catch (error) {
173
+ return new Response("invalid capture segment", {
174
+ status: error instanceof RangeError ? 413 : 400,
175
+ });
176
+ }
177
+ const { envelope, content, callId, identity, digest, observations } = parsed;
178
+ const first = observations[0];
179
+ const reference = {
180
+ key: `observability/cliproxy/v2/${envelope.destinationId}/${envelope.instanceId}/${callId}/${envelope.firstSequence}-${digest}.ndjson`,
181
+ sha256: digest,
182
+ byteLength: content.byteLength,
183
+ contentType: "application/x-ndjson",
184
+ };
185
+ try {
186
+ await options.storage.put(reference, content);
187
+ const correlation = first.correlation ?? {};
188
+ const terminal = observations.find((o) => o.kind === "completion");
189
+ const receipt = await ctx.runMutation(options.client.component.ingest.admit, {
190
+ destinationId: envelope.destinationId,
191
+ instanceId: envelope.instanceId,
192
+ pluginBootId: envelope.pluginBootId,
193
+ executionId: envelope.requestId,
194
+ callId,
195
+ sequence: envelope.firstSequence,
196
+ throughSequence: envelope.throughSequence,
197
+ terminalSequence: terminal?.sequence,
198
+ identity,
199
+ digest,
200
+ reference,
201
+ summaryJson: JSON.stringify({
202
+ ...initialCall(first, callId, Date.now()),
203
+ deploymentId: options.deploymentId,
204
+ environment: options.environment,
205
+ }),
206
+ observedAt: first.observedAt,
207
+ correlation: {
208
+ requestId: correlation.requestId,
209
+ runId: correlation.runId,
210
+ jobId: correlation.jobId,
211
+ rootExecutionId: correlation.rootExecutionId,
212
+ opencodeSessionId: correlation.opencodeSessionId,
213
+ },
214
+ });
215
+ // Scheduling failure returns retryable 503 after durable receipt; retry is idempotent.
216
+ await options.scheduleProjection(ctx, callId);
217
+ return Response.json({ ...receipt, rawCommitted: true, projectionCommitted: false });
218
+ }
219
+ catch (error) {
220
+ const message = error instanceof Error ? error.message : "";
221
+ return new Response(message.includes("capture_digest_conflict") || message.includes("capture_sequence_conflict")
222
+ ? "capture identity conflict"
223
+ : "capture temporarily unavailable", {
224
+ status: message.includes("capture_digest_conflict") ||
225
+ message.includes("capture_sequence_conflict")
226
+ ? 409
227
+ : 503,
228
+ });
229
+ }
230
+ }
231
+ export { projectPendingSegments } from "./projection.js";
232
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAClF,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,eAAe,EAA8B,MAAM,oBAAoB,CAAC;AASjF,MAAM,OAAO,qBAAqB;IACX;IAArB,YAAqB,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IAAG,CAAC;IAChD,mBAAmB,CACjB,GAAgB,EAChB,IAAkE;QAElE,OAA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AY;gBAClC,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC;YACF,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,WAAW,EAAE;gBACX,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,eAAe,EAAE,WAAW,CAAC,eAAe;gBAC5C,iBAAiB,EAAE,WAAW,CAAC,iBAAiB;aACjD;SACF,CAAC,CAAC;QACH,uFAAuF;QACvF,MAAM,OAAO,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAC;IACvF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,OAAO,IAAI,QAAQ,CACjB,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC1F,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,iCAAiC,EACrC;YACE,MAAM,EACJ,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC;gBAC3C,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC;gBAC3C,CAAC,CAAC,GAAG;gBACL,CAAC,CAAC,GAAG;SACV,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AACD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type * as ingest from "../ingest.js";
2
+ import type * as queries from "../queries.js";
3
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
4
+ declare const fullApi: ApiFromModules<{
5
+ ingest: typeof ingest;
6
+ queries: typeof queries;
7
+ }>;
8
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
9
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
10
+ export declare const components: {};
11
+ export {};
12
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,OAAO,CAAC;CACzB,CAAiB,CAAC;AAEnB,eAAO,MAAM,GAAG,EAAE,SAAS,CAAC,OAAO,OAAO,EAAE,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAiB,CAAC;AAC9F,eAAO,MAAM,QAAQ,EAAE,SAAS,CAAC,OAAO,OAAO,EAAE,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAiB,CAAC;AACrG,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /* eslint-disable */
2
+ import { anyApi, componentsGeneric } from "convex/server";
3
+ const fullApi = anyApi;
4
+ export const api = anyApi;
5
+ export const internal = anyApi;
6
+ export const components = componentsGeneric();
7
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AASpB,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAGR,MAAa,CAAC;AAEnB,MAAM,CAAC,MAAM,GAAG,GAAgE,MAAa,CAAC;AAC9F,MAAM,CAAC,MAAM,QAAQ,GAAkE,MAAa,CAAC;AACrG,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { FunctionReference, RegisteredMutation, RegisteredQuery } from "convex/server";
2
+ import type * as ingest from "../ingest.js";
3
+ import type * as queries from "../queries.js";
4
+ type ComponentQuery<Registered, Name extends string | undefined> = Registered extends RegisteredQuery<any, infer Args, infer Returns> ? FunctionReference<"query", "internal", Args, Awaited<Returns>, Name> : never;
5
+ type PublicQueries<Module, Name extends string | undefined> = {
6
+ [Key in keyof Module as Module[Key] extends RegisteredQuery<"public", any, any> ? Key : never]: ComponentQuery<Module[Key], Name>;
7
+ };
8
+ type ComponentMutation<Registered, Name extends string | undefined> = Registered extends RegisteredMutation<any, infer Args, infer Returns> ? FunctionReference<"mutation", "internal", Args, Awaited<Returns>, Name> : never;
9
+ type PublicMutations<Module, Name extends string | undefined> = {
10
+ [Key in keyof Module as Module[Key] extends RegisteredMutation<"public", any, any> ? Key : never]: ComponentMutation<Module[Key], Name>;
11
+ };
12
+ export type ComponentApi<Name extends string | undefined = string | undefined> = {
13
+ ingest: PublicMutations<typeof ingest, Name>;
14
+ queries: PublicQueries<typeof queries, Name>;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAE9C,KAAK,cAAc,CAAC,UAAU,EAAE,IAAI,SAAS,MAA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,aAAa,CAAC,OAAO,OAAO,EAAE,IAAI,CAAC,CAAC;CAC9C,CAAC"}
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ export {};
3
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB"}
@@ -0,0 +1,8 @@
1
+ import type { DataModelFromSchemaDefinition, DocumentByName, SystemTableNames, TableNamesInDataModel } from "convex/server";
2
+ import type { GenericId } from "convex/values";
3
+ import schema from "../schema.js";
4
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
5
+ export type TableNames = TableNamesInDataModel<DataModel>;
6
+ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
7
+ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
8
+ //# sourceMappingURL=dataModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC;AACrE,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAC1D,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACrF,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ import schema from "../schema.js";
3
+ //# sourceMappingURL=dataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AASpB,OAAO,MAAM,MAAM,cAAc,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { ActionBuilder, GenericActionCtx, GenericDatabaseReader, GenericDatabaseWriter, GenericMutationCtx, GenericQueryCtx, HttpActionBuilder, MutationBuilder, QueryBuilder } from "convex/server";
2
+ import type { DataModel } from "./dataModel.js";
3
+ type Env = {
4
+ readonly CONVEX_CLOUD_URL: string;
5
+ readonly CONVEX_SITE_URL: string;
6
+ };
7
+ export declare const query: QueryBuilder<DataModel, "public">;
8
+ export declare const internalQuery: QueryBuilder<DataModel, "internal">;
9
+ export declare const mutation: MutationBuilder<DataModel, "public">;
10
+ export declare const internalMutation: MutationBuilder<DataModel, "internal">;
11
+ export declare const action: ActionBuilder<DataModel, "public">;
12
+ export declare const internalAction: ActionBuilder<DataModel, "internal">;
13
+ export declare const httpAction: HttpActionBuilder;
14
+ export declare const env: Env;
15
+ export type QueryCtx = GenericQueryCtx<DataModel>;
16
+ export type MutationCtx = GenericMutationCtx<DataModel>;
17
+ export type ActionCtx = GenericActionCtx<DataModel>;
18
+ export type DatabaseReader = GenericDatabaseReader<DataModel>;
19
+ export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
20
+ export {};
21
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,YAAY,EACb,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,KAAK,GAAG,GAAG;IACT,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AACrE,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CAAwB,CAAC;AACvF,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAC9E,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAA2B,CAAC;AAChG,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AACxE,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CAAyB,CAAC;AAC1F,eAAO,MAAM,UAAU,EAAE,iBAAqC,CAAC;AAC/D,eAAO,MAAM,GAAG,EAAE,GAAsE,CAAC;AAEzF,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACpD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ import { actionGeneric, httpActionGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, mutationGeneric, queryGeneric, } from "convex/server";
3
+ export const query = queryGeneric;
4
+ export const internalQuery = internalQueryGeneric;
5
+ export const mutation = mutationGeneric;
6
+ export const internalMutation = internalMutationGeneric;
7
+ export const action = actionGeneric;
8
+ export const internalAction = internalActionGeneric;
9
+ export const httpAction = httpActionGeneric;
10
+ export const env = globalThis.process.env;
11
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAapB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,YAAY,GACb,MAAM,eAAe,CAAC;AAQvB,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAwC,oBAAoB,CAAC;AACvF,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAA2C,uBAAuB,CAAC;AAChG,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AACxE,MAAM,CAAC,MAAM,cAAc,GAAyC,qBAAqB,CAAC;AAC1F,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC;AAC/D,MAAM,CAAC,MAAM,GAAG,GAAS,UAAmD,CAAC,OAAO,CAAC,GAAG,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Retention is indefinite. No finite fallback or expiration scheduler exists. */
2
+ declare const _default: import("convex/server").ComponentDefinition<any, {}>;
3
+ export default _default;
4
+ //# sourceMappingURL=convex.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AACA,kFAAkF;;AAClF,wBAAwD"}
@@ -0,0 +1,4 @@
1
+ import { defineComponent } from "convex/server";
2
+ /** Retention is indefinite. No finite fallback or expiration scheduler exists. */
3
+ export default defineComponent("cliproxyObservability");
4
+ //# sourceMappingURL=convex.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,kFAAkF;AAClF,eAAe,eAAe,CAAC,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ export declare const admit: import("convex/server").RegisteredMutation<"public", {
2
+ terminalSequence?: number | undefined;
3
+ destinationId: string;
4
+ callId: string;
5
+ instanceId: string;
6
+ pluginBootId: string;
7
+ executionId: string;
8
+ summaryJson: string;
9
+ reference: {
10
+ key: string;
11
+ sha256: string;
12
+ byteLength: number;
13
+ contentType: string;
14
+ };
15
+ sequence: number;
16
+ throughSequence: number;
17
+ identity: string;
18
+ digest: string;
19
+ observedAt: string;
20
+ correlation: {
21
+ requestId?: string | undefined;
22
+ runId?: string | undefined;
23
+ jobId?: string | undefined;
24
+ rootExecutionId?: string | undefined;
25
+ opencodeSessionId?: string | undefined;
26
+ };
27
+ }, Promise<{
28
+ identity: string;
29
+ digest: string;
30
+ callId: string;
31
+ duplicate: boolean;
32
+ }>>;
33
+ export declare const commitProjection: import("convex/server").RegisteredMutation<"public", {
34
+ destinationId: string;
35
+ callId: string;
36
+ summaryJson: string;
37
+ checkpointJson: string;
38
+ throughSequence: number;
39
+ expectedRevision: number;
40
+ }, Promise<{
41
+ committed: boolean;
42
+ revision: number;
43
+ }>>;
44
+ export declare const recordProjectionFailure: import("convex/server").RegisteredMutation<"public", {
45
+ destinationId: string;
46
+ callId: string;
47
+ expectedRevision: number;
48
+ }, Promise<void>>;
49
+ export declare const recordHealth: import("convex/server").RegisteredMutation<"public", {
50
+ destinationId: string;
51
+ instanceId: string;
52
+ pluginBootId: string;
53
+ observedAt: string;
54
+ startedAt: string;
55
+ observationsTotal: number;
56
+ droppedObservationsTotal: number;
57
+ lostControlObservationsTotal: number;
58
+ scopeConflictsTotal: number;
59
+ expiredScopesTotal: number;
60
+ activeCalls: number;
61
+ }, Promise<{
62
+ committed: boolean;
63
+ }>>;
64
+ //# sourceMappingURL=ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/component/ingest.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgLhB,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;GAmD3B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;iBAclC,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;GAwEvB,CAAC"}