@relayfx/sdk 0.0.44 → 0.0.45
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/ai.js +78 -7
- package/dist/index.js +78 -7
- package/package.json +1 -1
package/dist/ai.js
CHANGED
|
@@ -11418,6 +11418,70 @@ class Service37 extends Context50.Service()("@relayfx/runtime/RelaySessionStore"
|
|
|
11418
11418
|
var mapError = (error) => new exports_session.SessionStoreError({ message: error.message });
|
|
11419
11419
|
var entryId = (id2) => exports_ids_schema.SessionEntryId.make(id2);
|
|
11420
11420
|
var metadata10 = (value) => value;
|
|
11421
|
+
var entrySuffix = (entryPrefix, id2) => Number.parseInt(id2.slice(entryPrefix.length), 10);
|
|
11422
|
+
var maxScopedSuffix = (entryPrefix, entries) => Math.max(...entries.map((entry) => entrySuffix(entryPrefix, entry.id)).filter(Number.isFinite));
|
|
11423
|
+
var recordAppendInput = (record2) => {
|
|
11424
|
+
switch (record2._tag) {
|
|
11425
|
+
case "Message":
|
|
11426
|
+
return {
|
|
11427
|
+
_tag: "Message",
|
|
11428
|
+
message: record2.message,
|
|
11429
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11430
|
+
};
|
|
11431
|
+
case "ToolCall":
|
|
11432
|
+
return {
|
|
11433
|
+
_tag: "ToolCall",
|
|
11434
|
+
part: record2.part,
|
|
11435
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11436
|
+
};
|
|
11437
|
+
case "ToolResult":
|
|
11438
|
+
return {
|
|
11439
|
+
_tag: "ToolResult",
|
|
11440
|
+
part: record2.part,
|
|
11441
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11442
|
+
};
|
|
11443
|
+
case "Memory":
|
|
11444
|
+
return {
|
|
11445
|
+
_tag: "Memory",
|
|
11446
|
+
items: record2.items,
|
|
11447
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11448
|
+
};
|
|
11449
|
+
case "Skill":
|
|
11450
|
+
return {
|
|
11451
|
+
_tag: "Skill",
|
|
11452
|
+
name: record2.name,
|
|
11453
|
+
body: record2.body,
|
|
11454
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11455
|
+
};
|
|
11456
|
+
case "Steering":
|
|
11457
|
+
return {
|
|
11458
|
+
_tag: "Steering",
|
|
11459
|
+
message: record2.message,
|
|
11460
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11461
|
+
};
|
|
11462
|
+
case "Handoff":
|
|
11463
|
+
return {
|
|
11464
|
+
_tag: "Handoff",
|
|
11465
|
+
target: record2.target,
|
|
11466
|
+
summary: record2.summary,
|
|
11467
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11468
|
+
};
|
|
11469
|
+
case "Compaction":
|
|
11470
|
+
return {
|
|
11471
|
+
_tag: "Compaction",
|
|
11472
|
+
summary: record2.summary,
|
|
11473
|
+
firstKeptEntryId: record2.firstKeptEntryId,
|
|
11474
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11475
|
+
};
|
|
11476
|
+
case "BranchSummary":
|
|
11477
|
+
return {
|
|
11478
|
+
_tag: "BranchSummary",
|
|
11479
|
+
summary: record2.summary,
|
|
11480
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11481
|
+
};
|
|
11482
|
+
}
|
|
11483
|
+
};
|
|
11484
|
+
var appendInputMatchesRecord = (input, record2) => exports_shared_schema.canonicalString(input) === exports_shared_schema.canonicalString(recordAppendInput(record2));
|
|
11421
11485
|
var toAppendInput = (input) => {
|
|
11422
11486
|
switch (input._tag) {
|
|
11423
11487
|
case "Message":
|
|
@@ -11483,20 +11547,21 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11483
11547
|
const repository = yield* exports_session_repository.Service;
|
|
11484
11548
|
const state = yield* Ref15.make(undefined);
|
|
11485
11549
|
const entryPrefix = `${sessionId}:entry:${entryScope}:`;
|
|
11486
|
-
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* () {
|
|
11550
|
+
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* (input) {
|
|
11487
11551
|
const current2 = yield* Ref15.get(state);
|
|
11488
11552
|
if (current2 !== undefined)
|
|
11489
11553
|
return current2;
|
|
11490
11554
|
const currentPath = yield* repository.path({ sessionId }).pipe(Effect57.mapError(mapError));
|
|
11491
|
-
const
|
|
11492
|
-
const
|
|
11493
|
-
const initialized = { leaf:
|
|
11555
|
+
const scopedEntries = currentPath.filter((entry) => entry.id.startsWith(entryPrefix));
|
|
11556
|
+
const firstScopedEntry = scopedEntries[0];
|
|
11557
|
+
const initialized = firstScopedEntry === undefined ? { leaf: currentPath.at(-1)?.id ?? null, next: 0 } : appendInputMatchesRecord(input, firstScopedEntry) ? { leaf: firstScopedEntry.parentId, next: entrySuffix(entryPrefix, firstScopedEntry.id) } : {
|
|
11558
|
+
leaf: scopedEntries.at(-1)?.id ?? firstScopedEntry.id,
|
|
11559
|
+
next: maxScopedSuffix(entryPrefix, scopedEntries) + 1
|
|
11560
|
+
};
|
|
11494
11561
|
yield* Ref15.set(state, initialized);
|
|
11495
11562
|
return initialized;
|
|
11496
11563
|
});
|
|
11497
|
-
const
|
|
11498
|
-
const current2 = yield* initialState2();
|
|
11499
|
-
const now = yield* Clock4.currentTimeMillis;
|
|
11564
|
+
const appendFromState = Effect57.fn("RelaySessionStore.appendFromState")(function* (input, current2, now) {
|
|
11500
11565
|
const entry = yield* repository.appendEntry({
|
|
11501
11566
|
id: exports_ids_schema.SessionEntryId.make(`${entryPrefix}${current2.next}`),
|
|
11502
11567
|
sessionId,
|
|
@@ -11507,6 +11572,12 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11507
11572
|
yield* Ref15.set(state, { leaf: entry.id, next: current2.next + 1 });
|
|
11508
11573
|
return entry;
|
|
11509
11574
|
});
|
|
11575
|
+
const append4 = Effect57.fn("RelaySessionStore.append")(function* (input) {
|
|
11576
|
+
const appendInput = toAppendInput(input);
|
|
11577
|
+
const current2 = yield* initialState2(appendInput);
|
|
11578
|
+
const now = yield* Clock4.currentTimeMillis;
|
|
11579
|
+
return yield* appendFromState(input, current2, now);
|
|
11580
|
+
});
|
|
11510
11581
|
const path2 = Effect57.fn("RelaySessionStore.path")((leaf2) => repository.path({
|
|
11511
11582
|
sessionId,
|
|
11512
11583
|
...leaf2 === undefined ? {} : { leafId: entryId(leaf2) }
|
package/dist/index.js
CHANGED
|
@@ -11471,6 +11471,70 @@ class Service37 extends Context50.Service()("@relayfx/runtime/RelaySessionStore"
|
|
|
11471
11471
|
var mapError = (error) => new exports_session.SessionStoreError({ message: error.message });
|
|
11472
11472
|
var entryId = (id2) => exports_ids_schema.SessionEntryId.make(id2);
|
|
11473
11473
|
var metadata10 = (value) => value;
|
|
11474
|
+
var entrySuffix = (entryPrefix, id2) => Number.parseInt(id2.slice(entryPrefix.length), 10);
|
|
11475
|
+
var maxScopedSuffix = (entryPrefix, entries) => Math.max(...entries.map((entry) => entrySuffix(entryPrefix, entry.id)).filter(Number.isFinite));
|
|
11476
|
+
var recordAppendInput = (record2) => {
|
|
11477
|
+
switch (record2._tag) {
|
|
11478
|
+
case "Message":
|
|
11479
|
+
return {
|
|
11480
|
+
_tag: "Message",
|
|
11481
|
+
message: record2.message,
|
|
11482
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11483
|
+
};
|
|
11484
|
+
case "ToolCall":
|
|
11485
|
+
return {
|
|
11486
|
+
_tag: "ToolCall",
|
|
11487
|
+
part: record2.part,
|
|
11488
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11489
|
+
};
|
|
11490
|
+
case "ToolResult":
|
|
11491
|
+
return {
|
|
11492
|
+
_tag: "ToolResult",
|
|
11493
|
+
part: record2.part,
|
|
11494
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11495
|
+
};
|
|
11496
|
+
case "Memory":
|
|
11497
|
+
return {
|
|
11498
|
+
_tag: "Memory",
|
|
11499
|
+
items: record2.items,
|
|
11500
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11501
|
+
};
|
|
11502
|
+
case "Skill":
|
|
11503
|
+
return {
|
|
11504
|
+
_tag: "Skill",
|
|
11505
|
+
name: record2.name,
|
|
11506
|
+
body: record2.body,
|
|
11507
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11508
|
+
};
|
|
11509
|
+
case "Steering":
|
|
11510
|
+
return {
|
|
11511
|
+
_tag: "Steering",
|
|
11512
|
+
message: record2.message,
|
|
11513
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11514
|
+
};
|
|
11515
|
+
case "Handoff":
|
|
11516
|
+
return {
|
|
11517
|
+
_tag: "Handoff",
|
|
11518
|
+
target: record2.target,
|
|
11519
|
+
summary: record2.summary,
|
|
11520
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11521
|
+
};
|
|
11522
|
+
case "Compaction":
|
|
11523
|
+
return {
|
|
11524
|
+
_tag: "Compaction",
|
|
11525
|
+
summary: record2.summary,
|
|
11526
|
+
firstKeptEntryId: record2.firstKeptEntryId,
|
|
11527
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11528
|
+
};
|
|
11529
|
+
case "BranchSummary":
|
|
11530
|
+
return {
|
|
11531
|
+
_tag: "BranchSummary",
|
|
11532
|
+
summary: record2.summary,
|
|
11533
|
+
...record2.metadata === undefined ? {} : { metadata: record2.metadata }
|
|
11534
|
+
};
|
|
11535
|
+
}
|
|
11536
|
+
};
|
|
11537
|
+
var appendInputMatchesRecord = (input, record2) => exports_shared_schema.canonicalString(input) === exports_shared_schema.canonicalString(recordAppendInput(record2));
|
|
11474
11538
|
var toAppendInput = (input) => {
|
|
11475
11539
|
switch (input._tag) {
|
|
11476
11540
|
case "Message":
|
|
@@ -11536,20 +11600,21 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11536
11600
|
const repository = yield* exports_session_repository.Service;
|
|
11537
11601
|
const state = yield* Ref15.make(undefined);
|
|
11538
11602
|
const entryPrefix = `${sessionId}:entry:${entryScope}:`;
|
|
11539
|
-
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* () {
|
|
11603
|
+
const initialState2 = Effect57.fn("RelaySessionStore.initialState")(function* (input) {
|
|
11540
11604
|
const current2 = yield* Ref15.get(state);
|
|
11541
11605
|
if (current2 !== undefined)
|
|
11542
11606
|
return current2;
|
|
11543
11607
|
const currentPath = yield* repository.path({ sessionId }).pipe(Effect57.mapError(mapError));
|
|
11544
|
-
const
|
|
11545
|
-
const
|
|
11546
|
-
const initialized = { leaf:
|
|
11608
|
+
const scopedEntries = currentPath.filter((entry) => entry.id.startsWith(entryPrefix));
|
|
11609
|
+
const firstScopedEntry = scopedEntries[0];
|
|
11610
|
+
const initialized = firstScopedEntry === undefined ? { leaf: currentPath.at(-1)?.id ?? null, next: 0 } : appendInputMatchesRecord(input, firstScopedEntry) ? { leaf: firstScopedEntry.parentId, next: entrySuffix(entryPrefix, firstScopedEntry.id) } : {
|
|
11611
|
+
leaf: scopedEntries.at(-1)?.id ?? firstScopedEntry.id,
|
|
11612
|
+
next: maxScopedSuffix(entryPrefix, scopedEntries) + 1
|
|
11613
|
+
};
|
|
11547
11614
|
yield* Ref15.set(state, initialized);
|
|
11548
11615
|
return initialized;
|
|
11549
11616
|
});
|
|
11550
|
-
const
|
|
11551
|
-
const current2 = yield* initialState2();
|
|
11552
|
-
const now = yield* Clock4.currentTimeMillis;
|
|
11617
|
+
const appendFromState = Effect57.fn("RelaySessionStore.appendFromState")(function* (input, current2, now) {
|
|
11553
11618
|
const entry = yield* repository.appendEntry({
|
|
11554
11619
|
id: exports_ids_schema.SessionEntryId.make(`${entryPrefix}${current2.next}`),
|
|
11555
11620
|
sessionId,
|
|
@@ -11560,6 +11625,12 @@ var make8 = Effect57.fn("RelaySessionStore.make")(function* (sessionId, entrySco
|
|
|
11560
11625
|
yield* Ref15.set(state, { leaf: entry.id, next: current2.next + 1 });
|
|
11561
11626
|
return entry;
|
|
11562
11627
|
});
|
|
11628
|
+
const append4 = Effect57.fn("RelaySessionStore.append")(function* (input) {
|
|
11629
|
+
const appendInput = toAppendInput(input);
|
|
11630
|
+
const current2 = yield* initialState2(appendInput);
|
|
11631
|
+
const now = yield* Clock4.currentTimeMillis;
|
|
11632
|
+
return yield* appendFromState(input, current2, now);
|
|
11633
|
+
});
|
|
11563
11634
|
const path2 = Effect57.fn("RelaySessionStore.path")((leaf2) => repository.path({
|
|
11564
11635
|
sessionId,
|
|
11565
11636
|
...leaf2 === undefined ? {} : { leafId: entryId(leaf2) }
|