Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions apps/ai/src/platform/genai-spans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Gen-AI semconv content for Maple's own agents: the model call, the tool call and the agent pass.
*
* Effect AI's providers annotate the model-call span with the requested and served model, the
* response id, the finish reasons and two token totals. Everything else the convention defines —
* response id, the finish reasons, the output type and two token totals. Everything else the convention defines —
* the provider name, the messages, the system instructions, the tool definitions, the cache and
* reasoning buckets, the cost the provider billed, time to first chunk — is added here. Agent
* Sessions reads all of it off the spans, and without it an investigation renders as a list of
Expand Down Expand Up @@ -272,7 +272,7 @@ interface CallTiming {

const modelCallTransformer =
(telemetry: ModelCallTelemetry, timing: CallTiming): Telemetry.SpanTransformer =>
({ span, prompt, responseFormat, response }) => {
({ span, prompt, response }) => {
// Read before the serialization below, which is this side's work and not the model's.
const endedMs = timing.now()
const input = messagesJson(inputMessages(prompt), INPUT_MESSAGES_BUDGET)
Expand All @@ -290,7 +290,6 @@ const modelCallTransformer =
...(telemetry.reasoningLevel === undefined
? undefined
: { "gen_ai.request.reasoning.level": telemetry.reasoningLevel }),
"gen_ai.output.type": responseFormat.type,
"gen_ai.input.messages": input.json,
...(input.dropped > 0 ? { [MAPLE_GENAI_INPUT_MESSAGES_DROPPED_ATTR]: input.dropped } : undefined),
...(system === undefined ? undefined : { "gen_ai.system_instructions": system }),
Expand Down
8 changes: 8 additions & 0 deletions apps/ios/Packages/MapleAPI/Sources/MapleAPI/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"properties": {
"attempt_number": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"attempted_at": {
Expand Down Expand Up @@ -549,6 +550,7 @@
2
],
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"consecutive_healthy_required": {
Expand All @@ -557,6 +559,7 @@
3
],
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"created_at": {
Expand Down Expand Up @@ -628,6 +631,7 @@
"examples": [
50
],
"maximum": 9007199254740991,
"minimum": 0,
"type": "integer"
},
Expand Down Expand Up @@ -676,6 +680,7 @@
60
],
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"service_names": {
Expand Down Expand Up @@ -2490,6 +2495,7 @@
"properties": {
"bucket_seconds": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"end_time": {
Expand Down Expand Up @@ -2825,6 +2831,7 @@
},
"bucket_seconds": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"end_time": {
Expand Down Expand Up @@ -2902,6 +2909,7 @@
},
"bucket_seconds": {
"exclusiveMinimum": 0,
"maximum": 9007199254740991,
"type": "integer"
},
"end_time": {
Expand Down
76 changes: 40 additions & 36 deletions bun.lock

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"typescript": "catalog:tooling"
},
"overrides": {
"@effect/sql-d1": "4.0.1",
"@effect/sql-sqlite-do": "4.0.1",
"@effect/sql-d1": "4.0.4",
"@effect/sql-sqlite-do": "4.0.4",
"workerd": "1.20261002.1"
},
"packageManager": "bun@1.4.0",
Expand All @@ -96,14 +96,14 @@
"@tanstack/charts-scales": "1.0.0"
},
"effect": {
"@effect/ai-openai-compat": "4.0.1",
"@effect/ai-openrouter": "4.0.1",
"@effect/atom-react": "4.0.1",
"@effect/language-service": "^0.87.3",
"@effect/platform-bun": "4.0.1",
"@effect/platform-node": "4.0.1",
"@effect/vitest": "4.0.1",
"effect": "4.0.1"
"@effect/ai-openai-compat": "4.0.4",
"@effect/ai-openrouter": "4.0.4",
"@effect/atom-react": "4.0.4",
"@effect/language-service": "^0.87.4",
"@effect/platform-bun": "4.0.4",
"@effect/platform-node": "4.0.4",
"@effect/vitest": "4.0.4",
"effect": "4.0.4"
},
"react": {
"@types/react": "^19.3.0",
Expand All @@ -129,9 +129,9 @@
}
},
"patchedDependencies": {
"@effect/ai-openrouter@4.0.1": "patches/@effect%2Fai-openrouter@4.0.1.patch",
"@effect/vitest@4.0.1": "patches/@effect%2Fvitest@4.0.1.patch",
"effect@4.0.1": "patches/effect@4.0.1.patch",
"@effect/ai-openrouter@4.0.4": "patches/@effect%2Fai-openrouter@4.0.4.patch",
"@effect/vitest@4.0.4": "patches/@effect%2Fvitest@4.0.4.patch",
"effect@4.0.4": "patches/effect@4.0.4.patch",
"@cloudflare/workers-types@5.20261005.1": "patches/@cloudflare%2Fworkers-types@5.20261005.1.patch"
}
}
4 changes: 2 additions & 2 deletions packages/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"db:backfill:dashboards-v3": "bun scripts/backfill-dashboard-datasource-v3.ts"
},
"dependencies": {
"@effect/sql-pg": "4.0.1",
"@effect/sql-pglite": "4.0.1",
"@effect/sql-pg": "4.0.4",
"@effect/sql-pglite": "4.0.4",
"@electric-sql/pglite": "^0.5.8",
"@maple/domain": "workspace:*",
"@maple-dev/effect-orm": "0.5.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/eventing-core/schemas/cloud-event.v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
},
"projectionrevision": {
"type": "integer",
"maximum": 9007199254740991,
"exclusiveMinimum": 0
},
"projectorid": {
Expand All @@ -73,6 +74,7 @@
},
"projectorversion": {
"type": "integer",
"maximum": 9007199254740991,
"exclusiveMinimum": 0
},
"sourceoccurrenceid": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
},
"revision": {
"type": "integer",
"maximum": 9007199254740991,
"exclusiveMinimum": 0
},
"enabled": {
Expand Down Expand Up @@ -354,6 +355,7 @@
},
"version": {
"type": "integer",
"maximum": 9007199254740991,
"exclusiveMinimum": 0
},
"config": {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/dist/OpenRouterLanguageModel.js b/dist/OpenRouterLanguageModel.js
index 464d9e4..e76b1e8 100644
index 8cf04d2..02e891c 100644
--- a/dist/OpenRouterLanguageModel.js
+++ b/dist/OpenRouterLanguageModel.js
@@ -726,7 +726,22 @@ const makeStreamResponse = /*#__PURE__*/Effect.fnUntraced(function* ({
Expand Down
26 changes: 13 additions & 13 deletions patches/effect@4.0.1.patch → patches/effect@4.0.4.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/dist/ai/LanguageModel.js b/dist/ai/LanguageModel.js
index 7a53537..7c25061 100644
index 187aa7e..dd11574 100644
--- a/dist/ai/LanguageModel.js
+++ b/dist/ai/LanguageModel.js
@@ -344,16 +344,19 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
@@ -337,16 +337,19 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
previousResponseId: undefined,
incrementalPrompt: undefined
};
Expand Down Expand Up @@ -35,7 +35,7 @@ index 7a53537..7c25061 100644
const tracker = Option.getOrUndefined(yield* Effect.serviceOption(ResponseIdTracker.ResponseIdTracker));
const toolChoice = options.toolChoice ?? "auto";
const concurrency = options.concurrency ?? "unbounded";
@@ -556,6 +559,43 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
@@ -560,6 +563,43 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
if (part.type !== "response-metadata") emitted = true;
})), Stream.catchReason("AiError", "InvalidRequestError", (_, error) => emitted ? Stream.fail(error) : params.streamText(fallbackOptions))) : params.streamText(requestOptions);
};
Expand Down Expand Up @@ -79,9 +79,9 @@ index 7a53537..7c25061 100644
// Check for pending approvals that need resolution
const {
approved: pendingApproved,
@@ -585,14 +625,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
@@ -589,14 +629,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
}
const schema = Schema.NonEmptyArray(Response.StreamPart(Toolkit.empty));
const schema = Schema.NonEmptyArray(withUndeclaredToolCalls(Response.StreamPart(Toolkit.empty), deferToolCallValidation));
const decodeParts = Schema.decodeEffect(schema);
- return pipe(streamWithNonIncrementalFallback(), Stream.mapArrayEffect(parts => decodeParts(parts).pipe(tracker ? Effect.tap(decodedParts => {
- for (const part of decodedParts) {
Expand All @@ -95,9 +95,9 @@ index 7a53537..7c25061 100644
}
// If there is a toolkit resolve and apply it to the provider options
const toolkit = yield* resolveToolkit(options.toolkit);
@@ -617,14 +650,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
@@ -621,14 +654,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
}
const schema = Schema.NonEmptyArray(Response.StreamPart(Toolkit.empty));
const schema = Schema.NonEmptyArray(withUndeclaredToolCalls(Response.StreamPart(Toolkit.empty), deferToolCallValidation));
const decodeParts = Schema.decodeEffect(schema);
- return pipe(streamWithNonIncrementalFallback(), Stream.mapArrayEffect(parts => decodeParts(parts).pipe(tracker ? Effect.tap(decodedParts => {
- for (const part of decodedParts) {
Expand All @@ -111,27 +111,27 @@ index 7a53537..7c25061 100644
}
// Pre-resolve pending tool approvals before calling the LLM
let preResolvedStreamParts = [];
@@ -687,14 +713,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
// If tool call resolution is disabled, return the response without
@@ -692,14 +718,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (params) {
// resolving the tool calls that were generated
if (options.disableToolCallResolution === true) {
- return streamWithNonIncrementalFallback().pipe(Stream.mapArrayEffect(parts => decodeParts(parts).pipe(tracker ? Effect.tap(decodedParts => {
const encodedToolkit = deferToolCallValidation ? makeToolkitWithEncodedParameters(toolkit) : undefined;
- return streamWithNonIncrementalFallback().pipe(Stream.mapArrayEffect(parts => decodeParts(parts).pipe(encodedToolkit ? Effect.tap(() => validateProviderExecutedToolCalls(encodedToolkit, parts)) : identity, tracker ? Effect.tap(decodedParts => {
- for (const part of decodedParts) {
- if (part.type === "response-metadata" && Predicate.isNotUndefined(part.id)) {
- tracker.markParts(providerOptions.prompt.content, part.id);
- }
- }
- return Effect.void;
- }) : identity)));
+ return deferDecodeFailure(streamWithNonIncrementalFallback(), decodeParts);
+ return deferDecodeFailure(streamWithNonIncrementalFallback(), encodedToolkit ? parts => decodeParts(parts).pipe(Effect.tap(() => validateProviderExecutedToolCalls(encodedToolkit, parts))) : decodeParts);
}
// Queue for decoded parts and tool results
const queue = yield* Queue.make();
diff --git a/dist/http-api/HttpApiBuilder.js b/dist/http-api/HttpApiBuilder.js
index e1686d6..21ab531 100644
index f9fa473..b9bb293 100644
--- a/dist/http-api/HttpApiBuilder.js
+++ b/dist/http-api/HttpApiBuilder.js
@@ -372,7 +372,10 @@ function handlerToHttpEffect(api, group, endpoint, context, handler, isRaw) {
@@ -373,7 +373,10 @@ function handlerToHttpEffect(api, group, endpoint, context, handler, isRaw) {
*/
export function handlerToRoute(api, group, handler, context) {
const endpoint = handler.endpoint;
Expand Down
Loading