@relayfx/sdk 0.4.0 → 0.4.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/{index-p43mg4kt.js → index-p2d0xyat.js} +36 -20
- package/dist/{index-cs3be24t.js → index-vthtj624.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/mysql.js +2 -2
- package/dist/postgres.js +2 -2
- package/dist/sqlite.js +2 -2
- package/dist/types/runtime/agent/agent-loop-events.d.ts +1 -1
- package/package.json +1 -1
|
@@ -15772,6 +15772,13 @@ var modelMetadata = (agent) => ({
|
|
|
15772
15772
|
model: agent.model.model,
|
|
15773
15773
|
...agent.model.registration_key === undefined ? {} : { registration_key: agent.model.registration_key }
|
|
15774
15774
|
});
|
|
15775
|
+
var serviceTier = (part) => {
|
|
15776
|
+
const openai = part.metadata.openai;
|
|
15777
|
+
if (openai === null || typeof openai !== "object" || Array.isArray(openai))
|
|
15778
|
+
return;
|
|
15779
|
+
const value = openai.serviceTier;
|
|
15780
|
+
return typeof value === "string" ? value : undefined;
|
|
15781
|
+
};
|
|
15775
15782
|
var inputPreparedEvent = (input, definitions2) => ({
|
|
15776
15783
|
id: exports_ids_schema.EventId.make(`event:${input.executionId}:model:${input.eventSequence}:input-prepared`),
|
|
15777
15784
|
execution_id: input.executionId,
|
|
@@ -15787,25 +15794,30 @@ var inputPreparedEvent = (input, definitions2) => ({
|
|
|
15787
15794
|
},
|
|
15788
15795
|
created_at: input.startedAt
|
|
15789
15796
|
});
|
|
15790
|
-
var usageReportedEvent = (input, part, sequence) =>
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15797
|
+
var usageReportedEvent = (input, part, modelSnapshot, sequence) => {
|
|
15798
|
+
const tier = serviceTier(part);
|
|
15799
|
+
return {
|
|
15800
|
+
id: exports_ids_schema.EventId.make(`event:${input.executionId}:model:${sequence}:usage`),
|
|
15801
|
+
execution_id: input.executionId,
|
|
15802
|
+
type: "model.usage.reported",
|
|
15803
|
+
sequence,
|
|
15804
|
+
cursor: `${input.executionId}:model:${sequence}:usage`,
|
|
15805
|
+
data: {
|
|
15806
|
+
provider: input.agent.model.provider,
|
|
15807
|
+
model: input.agent.model.model,
|
|
15808
|
+
...modelSnapshot === undefined ? {} : { model_snapshot: modelSnapshot },
|
|
15809
|
+
...tier === undefined ? {} : { service_tier: tier },
|
|
15810
|
+
finish_reason: part.reason,
|
|
15811
|
+
input_tokens: part.usage.inputTokens.total ?? null,
|
|
15812
|
+
input_tokens_uncached: part.usage.inputTokens.uncached ?? null,
|
|
15813
|
+
input_tokens_cache_read: part.usage.inputTokens.cacheRead ?? null,
|
|
15814
|
+
input_tokens_cache_write: part.usage.inputTokens.cacheWrite ?? null,
|
|
15815
|
+
output_tokens: part.usage.outputTokens.total ?? null,
|
|
15816
|
+
output_tokens_reasoning: part.usage.outputTokens.reasoning ?? null
|
|
15817
|
+
},
|
|
15818
|
+
created_at: input.startedAt + (sequence - input.eventSequence)
|
|
15819
|
+
};
|
|
15820
|
+
};
|
|
15809
15821
|
var budgetExceededEvent = (input, tokensUsed, tokenBudget, sequence) => ({
|
|
15810
15822
|
id: exports_ids_schema.EventId.make(`event:${input.executionId}:budget:${sequence}:exceeded`),
|
|
15811
15823
|
execution_id: input.executionId,
|
|
@@ -16500,6 +16512,8 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16500
16512
|
if (part.type === "tool-params-start") {
|
|
16501
16513
|
return { ...state, toolCallNames: { ...state.toolCallNames, [part.id]: part.name } };
|
|
16502
16514
|
}
|
|
16515
|
+
if (part.type === "response-metadata")
|
|
16516
|
+
return { ...state, modelId: part.modelId };
|
|
16503
16517
|
if (part.type === "tool-params-delta") {
|
|
16504
16518
|
const sequence = yield* allocator.allocate(1);
|
|
16505
16519
|
const deltaIndex = state.toolCallDeltaIndexes[part.id] ?? 0;
|
|
@@ -16512,7 +16526,7 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16512
16526
|
if (part.type === "finish") {
|
|
16513
16527
|
const finish = part;
|
|
16514
16528
|
const sequence = yield* allocator.allocate(1);
|
|
16515
|
-
yield* appendEvent(eventLog, allocator, usageReportedEvent2(input, finish, sequence), sequence + 1);
|
|
16529
|
+
yield* appendEvent(eventLog, allocator, usageReportedEvent2(input, finish, state.modelId, sequence), sequence + 1);
|
|
16516
16530
|
yield* recordModelUsage({
|
|
16517
16531
|
provider: input.agent.model.provider,
|
|
16518
16532
|
model: input.agent.model.model,
|
|
@@ -16522,6 +16536,7 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16522
16536
|
});
|
|
16523
16537
|
return {
|
|
16524
16538
|
...state,
|
|
16539
|
+
modelId: undefined,
|
|
16525
16540
|
tokensUsed: state.tokensUsed + (finish.usage.inputTokens.total ?? 0) + (finish.usage.outputTokens.total ?? 0)
|
|
16526
16541
|
};
|
|
16527
16542
|
}
|
|
@@ -16555,6 +16570,7 @@ var make12 = (layerOptions) => Effect93.gen(function* () {
|
|
|
16555
16570
|
text: "",
|
|
16556
16571
|
transcript: undefined,
|
|
16557
16572
|
turn: undefined,
|
|
16573
|
+
modelId: undefined,
|
|
16558
16574
|
tokensUsed: seededTokens,
|
|
16559
16575
|
toolCallNames: {},
|
|
16560
16576
|
toolCallDeltaIndexes: {}
|
package/dist/index.js
CHANGED
package/dist/mysql.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-vthtj624.js";
|
|
6
6
|
import {
|
|
7
7
|
MigratorError,
|
|
8
8
|
RuntimeMigrationError,
|
|
9
9
|
SqlFailure
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-p2d0xyat.js";
|
|
11
11
|
import"./index-x32kbvxv.js";
|
|
12
12
|
import"./index-3w6txjtg.js";
|
|
13
13
|
import"./index-nb39b5ae.js";
|
package/dist/postgres.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-vthtj624.js";
|
|
6
6
|
import {
|
|
7
7
|
Dialect,
|
|
8
8
|
RuntimeMigrationError,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
fromDbTimestamp,
|
|
15
15
|
fromNullableDbTimestamp,
|
|
16
16
|
timestampParam
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-p2d0xyat.js";
|
|
18
18
|
import"./index-x32kbvxv.js";
|
|
19
19
|
import {
|
|
20
20
|
exports_ids_schema
|
package/dist/sqlite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-vthtj624.js";
|
|
6
6
|
import {
|
|
7
7
|
DatabaseAlreadyOwned,
|
|
8
8
|
RuntimeConfigurationError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
make,
|
|
13
13
|
makeDatabaseIdentity,
|
|
14
14
|
runtimeLayer
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-p2d0xyat.js";
|
|
16
16
|
import"./index-x32kbvxv.js";
|
|
17
17
|
import"./index-3w6txjtg.js";
|
|
18
18
|
import"./index-nb39b5ae.js";
|
|
@@ -2,7 +2,7 @@ import { Content, Execution, Shared, Tool } from "../../schema/index";
|
|
|
2
2
|
import type { Response } from "effect/unstable/ai";
|
|
3
3
|
import type { RunInput } from "./agent-loop-service";
|
|
4
4
|
declare const inputPreparedEvent: (input: RunInput, definitions: ReadonlyArray<Tool.Definition>) => Execution.ExecutionEvent;
|
|
5
|
-
declare const usageReportedEvent: (input: RunInput, part: Response.FinishPart, sequence: Execution.ExecutionEventSequence) => Execution.ExecutionEvent;
|
|
5
|
+
declare const usageReportedEvent: (input: RunInput, part: Response.FinishPart, modelSnapshot: string | undefined, sequence: Execution.ExecutionEventSequence) => Execution.ExecutionEvent;
|
|
6
6
|
declare const budgetExceededEvent: (input: RunInput, tokensUsed: number, tokenBudget: number, sequence: Execution.ExecutionEventSequence) => Execution.ExecutionEvent;
|
|
7
7
|
declare const outputDeltaEvent: (input: RunInput, part: Response.TextDeltaPart, deltaIndex: number) => Execution.ExecutionEvent;
|
|
8
8
|
declare const reasoningDeltaEvent: (input: RunInput, part: Response.ReasoningPart | Response.ReasoningDeltaPart, deltaIndex: number) => Execution.ExecutionEvent;
|
package/package.json
CHANGED