@pi-sparkles/pi-sparkles 0.1.16 → 0.1.17
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/CHANGELOG.md +6 -0
- package/CONFIGURATION.md +1 -1
- package/README.md +3 -3
- package/SHA256SUMS +10 -10
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/aggregate-lock.json +5 -5
- package/metafile.json +25 -25
- package/package.json +1 -1
- package/release-lock.json +4 -4
- package/runtime.js +671 -399
- package/runtime.js.map +2 -2
package/runtime.js
CHANGED
|
@@ -516434,6 +516434,176 @@ var init_json = __esm(() => {
|
|
|
516434
516434
|
configurable: true
|
|
516435
516435
|
};
|
|
516436
516436
|
});
|
|
516437
|
+
function idFromNumber(value26) {
|
|
516438
|
+
return value26;
|
|
516439
|
+
}
|
|
516440
|
+
function seqFromNumber(value26) {
|
|
516441
|
+
return value26;
|
|
516442
|
+
}
|
|
516443
|
+
function defineDoc(definition3) {
|
|
516444
|
+
validateDefinition(definition3);
|
|
516445
|
+
return { definition: definition3 };
|
|
516446
|
+
}
|
|
516447
|
+
function defineDocFamily(definition3) {
|
|
516448
|
+
validateDefinition(definition3);
|
|
516449
|
+
return { definition: definition3 };
|
|
516450
|
+
}
|
|
516451
|
+
function validateDefinition(definition3) {
|
|
516452
|
+
if (!Number.isSafeInteger(definition3.version) || definition3.version < 1) {
|
|
516453
|
+
throw new TypeError(`Document ${definition3.kind} version must be a positive integer`);
|
|
516454
|
+
}
|
|
516455
|
+
}
|
|
516456
|
+
function resolveAddress(definition3, args) {
|
|
516457
|
+
let index5 = 0;
|
|
516458
|
+
let scope4;
|
|
516459
|
+
switch (definition3.scope) {
|
|
516460
|
+
case "session":
|
|
516461
|
+
scope4 = { kind: "session" };
|
|
516462
|
+
break;
|
|
516463
|
+
case "conversation":
|
|
516464
|
+
scope4 = { kind: "conversation", conversationId: ownerId(args[index5++], definition3) };
|
|
516465
|
+
break;
|
|
516466
|
+
case "task":
|
|
516467
|
+
scope4 = { kind: "task", taskId: ownerId(args[index5++], definition3) };
|
|
516468
|
+
break;
|
|
516469
|
+
}
|
|
516470
|
+
const key211 = definition3.family === true ? args[index5++] : undefined;
|
|
516471
|
+
const address = key211 === undefined ? { kind: definition3.kind, scope: scope4 } : { kind: definition3.kind, scope: scope4, key: key211 };
|
|
516472
|
+
return { address, id: addressId(address), nextArgument: index5 };
|
|
516473
|
+
}
|
|
516474
|
+
function ownerId(value26, definition3) {
|
|
516475
|
+
if (typeof value26 !== "number" || !Number.isSafeInteger(value26)) {
|
|
516476
|
+
throw new TypeError(`Document ${definition3.kind} requires a ${definition3.scope} ID`);
|
|
516477
|
+
}
|
|
516478
|
+
return idFromNumber(value26);
|
|
516479
|
+
}
|
|
516480
|
+
function addressId(address) {
|
|
516481
|
+
const owner210 = address.scope.kind === "session" ? null : address.scope.kind === "conversation" ? address.scope.conversationId : address.scope.taskId;
|
|
516482
|
+
return JSON.stringify([address.kind, address.scope.kind, owner210, address.key ?? null]);
|
|
516483
|
+
}
|
|
516484
|
+
function documentCreate(definition3, address, id24) {
|
|
516485
|
+
const key211 = address.key === undefined ? {} : { key: address.key };
|
|
516486
|
+
switch (address.scope.kind) {
|
|
516487
|
+
case "session":
|
|
516488
|
+
return { id: id24, kind: address.kind, ...key211, scope: address.scope };
|
|
516489
|
+
case "task":
|
|
516490
|
+
return { id: id24, kind: address.kind, ...key211, scope: address.scope };
|
|
516491
|
+
case "conversation":
|
|
516492
|
+
return {
|
|
516493
|
+
id: id24,
|
|
516494
|
+
kind: address.kind,
|
|
516495
|
+
...key211,
|
|
516496
|
+
scope: address.scope,
|
|
516497
|
+
history: definition3.history,
|
|
516498
|
+
fork: definition3.fork
|
|
516499
|
+
};
|
|
516500
|
+
}
|
|
516501
|
+
}
|
|
516502
|
+
function checkRecordScope(definition3, record22) {
|
|
516503
|
+
if (record22.scope.kind !== definition3.scope || record22.scope.kind === "conversation" && (record22.history !== definition3.history || record22.fork !== definition3.fork)) {
|
|
516504
|
+
throw new TypeError(`Document ${record22.id} (${record22.kind}) does not match the supplied definition semantics`);
|
|
516505
|
+
}
|
|
516506
|
+
}
|
|
516507
|
+
function checkRecordVersion(definition3, record22, version8) {
|
|
516508
|
+
if (version8 > definition3.version) {
|
|
516509
|
+
throw new Error(`Document ${record22.id} (${record22.kind}) has newer version ${version8} than ${definition3.version}`);
|
|
516510
|
+
}
|
|
516511
|
+
if (version8 < definition3.version && definition3.migrate === undefined) {
|
|
516512
|
+
throw new Error(`Document ${record22.id} (${record22.kind}) requires migration from version ${version8}`);
|
|
516513
|
+
}
|
|
516514
|
+
}
|
|
516515
|
+
function materializeDocument(definition3, stored3) {
|
|
516516
|
+
return materializeDocumentValue(definition3, stored3.record, stored3.version, stored3.value);
|
|
516517
|
+
}
|
|
516518
|
+
function materializeDocumentValue(definition3, record22, version8, value26) {
|
|
516519
|
+
checkRecordScope(definition3, record22);
|
|
516520
|
+
checkRecordVersion(definition3, record22, version8);
|
|
516521
|
+
if (version8 === definition3.version)
|
|
516522
|
+
return value26;
|
|
516523
|
+
return copyJson(definition3.migrate(value26, version8));
|
|
516524
|
+
}
|
|
516525
|
+
var init_documents = __esm(() => {
|
|
516526
|
+
init_json();
|
|
516527
|
+
});
|
|
516528
|
+
function defineEntry(kind24) {
|
|
516529
|
+
if (typeof kind24 !== "string" || kind24.length === 0)
|
|
516530
|
+
throw new TypeError("Entry kind must be a non-empty string");
|
|
516531
|
+
return {
|
|
516532
|
+
kind: kind24,
|
|
516533
|
+
is: (entry4) => entry4 !== undefined && entry4.kind === kind24
|
|
516534
|
+
};
|
|
516535
|
+
}
|
|
516536
|
+
var UserEntry;
|
|
516537
|
+
var AssistantEntry;
|
|
516538
|
+
var SystemEntry;
|
|
516539
|
+
var ToolResultEntry;
|
|
516540
|
+
var ResetEntry;
|
|
516541
|
+
var CompactionEntry;
|
|
516542
|
+
var init_entries = __esm(() => {
|
|
516543
|
+
UserEntry = defineEntry("pi.user");
|
|
516544
|
+
AssistantEntry = defineEntry("pi.assistant");
|
|
516545
|
+
SystemEntry = defineEntry("pi.system");
|
|
516546
|
+
ToolResultEntry = defineEntry("pi.tool-result");
|
|
516547
|
+
ResetEntry = defineEntry("pi.reset");
|
|
516548
|
+
CompactionEntry = defineEntry("pi.compaction");
|
|
516549
|
+
});
|
|
516550
|
+
function errorMessage(error) {
|
|
516551
|
+
if (error instanceof Error)
|
|
516552
|
+
return error.message;
|
|
516553
|
+
try {
|
|
516554
|
+
return String(error);
|
|
516555
|
+
} catch {
|
|
516556
|
+
return Object.prototype.toString.call(error);
|
|
516557
|
+
}
|
|
516558
|
+
}
|
|
516559
|
+
var ReadAfterWrite;
|
|
516560
|
+
var StorageRequestError;
|
|
516561
|
+
var SessionFailed;
|
|
516562
|
+
var ReadOnlySession;
|
|
516563
|
+
var ConversationBusy;
|
|
516564
|
+
var ConversationIdle;
|
|
516565
|
+
var init_errors = __esm(() => {
|
|
516566
|
+
ReadAfterWrite = class ReadAfterWrite2 extends Error {
|
|
516567
|
+
constructor(operation4) {
|
|
516568
|
+
super(`${operation4} cannot read tables after the first table write`);
|
|
516569
|
+
this.name = "ReadAfterWrite";
|
|
516570
|
+
}
|
|
516571
|
+
};
|
|
516572
|
+
StorageRequestError = class StorageRequestError2 extends Error {
|
|
516573
|
+
constructor(message) {
|
|
516574
|
+
super(message);
|
|
516575
|
+
this.name = "StorageRequestError";
|
|
516576
|
+
}
|
|
516577
|
+
};
|
|
516578
|
+
SessionFailed = class SessionFailed2 extends Error {
|
|
516579
|
+
constructor(cause) {
|
|
516580
|
+
super("Session failed after a storage error; close and reopen it", { cause });
|
|
516581
|
+
this.name = "SessionFailed";
|
|
516582
|
+
}
|
|
516583
|
+
};
|
|
516584
|
+
ReadOnlySession = class ReadOnlySession2 extends Error {
|
|
516585
|
+
constructor(what) {
|
|
516586
|
+
super(`Read-only Harness: ${what} refused`);
|
|
516587
|
+
this.name = "ReadOnlySession";
|
|
516588
|
+
}
|
|
516589
|
+
};
|
|
516590
|
+
ConversationBusy = class ConversationBusy2 extends Error {
|
|
516591
|
+
conversationId;
|
|
516592
|
+
constructor(conversationId) {
|
|
516593
|
+
super(`Conversation ${conversationId} is busy`);
|
|
516594
|
+
this.name = "ConversationBusy";
|
|
516595
|
+
this.conversationId = conversationId;
|
|
516596
|
+
}
|
|
516597
|
+
};
|
|
516598
|
+
ConversationIdle = class ConversationIdle2 extends Error {
|
|
516599
|
+
conversationId;
|
|
516600
|
+
constructor(conversationId) {
|
|
516601
|
+
super(`Conversation ${conversationId} is idle`);
|
|
516602
|
+
this.name = "ConversationIdle";
|
|
516603
|
+
this.conversationId = conversationId;
|
|
516604
|
+
}
|
|
516605
|
+
};
|
|
516606
|
+
});
|
|
516437
516607
|
function createTypedMetrics(metrics, schemas) {
|
|
516438
516608
|
const definitions = new Map;
|
|
516439
516609
|
for (const schema6 of schemas) {
|
|
@@ -516486,6 +516656,16 @@ var init_noop = __esm(() => {
|
|
|
516486
516656
|
function carrierId(carrier) {
|
|
516487
516657
|
return `${carrier["pi-memory-scope"]}:${carrier["pi-memory-span"]}`;
|
|
516488
516658
|
}
|
|
516659
|
+
function telemetryNow() {
|
|
516660
|
+
const clock = performance.now();
|
|
516661
|
+
const wall = Date.now();
|
|
516662
|
+
if (Math.abs(anchor + clock - wall) > TOLERANCE_MS)
|
|
516663
|
+
anchor = wall - clock;
|
|
516664
|
+
return microseconds(anchor + clock);
|
|
516665
|
+
}
|
|
516666
|
+
function microseconds(ms) {
|
|
516667
|
+
return Math.round(ms * 1000) / 1000;
|
|
516668
|
+
}
|
|
516489
516669
|
function copyAttributes(attributes2) {
|
|
516490
516670
|
return Object.fromEntries(Object.entries(attributes2 ?? {}).filter(([, value26]) => value26 !== undefined).map(([name211, value26]) => [name211, Array.isArray(value26) ? [...value26] : value26]));
|
|
516491
516671
|
}
|
|
@@ -516509,7 +516689,7 @@ function createSpan(state2, parent, options) {
|
|
|
516509
516689
|
}
|
|
516510
516690
|
const id24 = state2.nextSpanId++;
|
|
516511
516691
|
return {
|
|
516512
|
-
startedMs:
|
|
516692
|
+
startedMs: telemetryNow(),
|
|
516513
516693
|
clock: performance.now(),
|
|
516514
516694
|
id: id24,
|
|
516515
516695
|
parentId: parent?.localId ?? null,
|
|
@@ -516557,7 +516737,7 @@ async function startInMemorySpan(state2, parent, options, callback2) {
|
|
|
516557
516737
|
return;
|
|
516558
516738
|
recordedSpan.events.push({
|
|
516559
516739
|
name: name211,
|
|
516560
|
-
timeMs: performance.now() - recordedSpan.clock,
|
|
516740
|
+
timeMs: microseconds(performance.now() - recordedSpan.clock),
|
|
516561
516741
|
attributes: copyAttributes(attributes2)
|
|
516562
516742
|
});
|
|
516563
516743
|
},
|
|
@@ -516582,7 +516762,7 @@ async function startInMemorySpan(state2, parent, options, callback2) {
|
|
|
516582
516762
|
throw error;
|
|
516583
516763
|
} finally {
|
|
516584
516764
|
recordedSpan.settled = true;
|
|
516585
|
-
recordedSpan.endedMs = recordedSpan.startedMs + performance.now() - recordedSpan.clock;
|
|
516765
|
+
recordedSpan.endedMs = microseconds(recordedSpan.startedMs + performance.now() - recordedSpan.clock);
|
|
516586
516766
|
recordedSpan.endSequence = state2.nextEndSequence++;
|
|
516587
516767
|
}
|
|
516588
516768
|
}
|
|
@@ -516747,9 +516927,12 @@ class InMemoryTelemetryContext {
|
|
|
516747
516927
|
}));
|
|
516748
516928
|
}
|
|
516749
516929
|
}
|
|
516930
|
+
var TOLERANCE_MS = 10;
|
|
516931
|
+
var anchor;
|
|
516750
516932
|
var contextCarriers;
|
|
516751
516933
|
var init_memory = __esm(() => {
|
|
516752
516934
|
init_noop();
|
|
516935
|
+
anchor = performance.timeOrigin;
|
|
516753
516936
|
contextCarriers = new WeakMap;
|
|
516754
516937
|
});
|
|
516755
516938
|
function defineTelemetrySchema(schema6) {
|
|
@@ -519803,180 +519986,6 @@ var init_watch = __esm(() => {
|
|
|
519803
519986
|
}
|
|
519804
519987
|
};
|
|
519805
519988
|
});
|
|
519806
|
-
var init_dist2 = __esm(() => {
|
|
519807
|
-
init_json();
|
|
519808
|
-
init_watch();
|
|
519809
|
-
});
|
|
519810
|
-
function idFromNumber(value26) {
|
|
519811
|
-
return value26;
|
|
519812
|
-
}
|
|
519813
|
-
function seqFromNumber(value26) {
|
|
519814
|
-
return value26;
|
|
519815
|
-
}
|
|
519816
|
-
function defineDoc(definition3) {
|
|
519817
|
-
validateDefinition(definition3);
|
|
519818
|
-
return { definition: definition3 };
|
|
519819
|
-
}
|
|
519820
|
-
function defineDocFamily(definition3) {
|
|
519821
|
-
validateDefinition(definition3);
|
|
519822
|
-
return { definition: definition3 };
|
|
519823
|
-
}
|
|
519824
|
-
function validateDefinition(definition3) {
|
|
519825
|
-
if (!Number.isSafeInteger(definition3.version) || definition3.version < 1) {
|
|
519826
|
-
throw new TypeError(`Document ${definition3.kind} version must be a positive integer`);
|
|
519827
|
-
}
|
|
519828
|
-
}
|
|
519829
|
-
function resolveAddress(definition3, args) {
|
|
519830
|
-
let index5 = 0;
|
|
519831
|
-
let scope4;
|
|
519832
|
-
switch (definition3.scope) {
|
|
519833
|
-
case "session":
|
|
519834
|
-
scope4 = { kind: "session" };
|
|
519835
|
-
break;
|
|
519836
|
-
case "conversation":
|
|
519837
|
-
scope4 = { kind: "conversation", conversationId: ownerId(args[index5++], definition3) };
|
|
519838
|
-
break;
|
|
519839
|
-
case "task":
|
|
519840
|
-
scope4 = { kind: "task", taskId: ownerId(args[index5++], definition3) };
|
|
519841
|
-
break;
|
|
519842
|
-
}
|
|
519843
|
-
const key211 = definition3.family === true ? args[index5++] : undefined;
|
|
519844
|
-
const address = key211 === undefined ? { kind: definition3.kind, scope: scope4 } : { kind: definition3.kind, scope: scope4, key: key211 };
|
|
519845
|
-
return { address, id: addressId(address), nextArgument: index5 };
|
|
519846
|
-
}
|
|
519847
|
-
function ownerId(value26, definition3) {
|
|
519848
|
-
if (typeof value26 !== "number" || !Number.isSafeInteger(value26)) {
|
|
519849
|
-
throw new TypeError(`Document ${definition3.kind} requires a ${definition3.scope} ID`);
|
|
519850
|
-
}
|
|
519851
|
-
return idFromNumber(value26);
|
|
519852
|
-
}
|
|
519853
|
-
function addressId(address) {
|
|
519854
|
-
const owner210 = address.scope.kind === "session" ? null : address.scope.kind === "conversation" ? address.scope.conversationId : address.scope.taskId;
|
|
519855
|
-
return JSON.stringify([address.kind, address.scope.kind, owner210, address.key ?? null]);
|
|
519856
|
-
}
|
|
519857
|
-
function documentCreate(definition3, address, id24) {
|
|
519858
|
-
const key211 = address.key === undefined ? {} : { key: address.key };
|
|
519859
|
-
switch (address.scope.kind) {
|
|
519860
|
-
case "session":
|
|
519861
|
-
return { id: id24, kind: address.kind, ...key211, scope: address.scope };
|
|
519862
|
-
case "task":
|
|
519863
|
-
return { id: id24, kind: address.kind, ...key211, scope: address.scope };
|
|
519864
|
-
case "conversation":
|
|
519865
|
-
return {
|
|
519866
|
-
id: id24,
|
|
519867
|
-
kind: address.kind,
|
|
519868
|
-
...key211,
|
|
519869
|
-
scope: address.scope,
|
|
519870
|
-
history: definition3.history,
|
|
519871
|
-
fork: definition3.fork
|
|
519872
|
-
};
|
|
519873
|
-
}
|
|
519874
|
-
}
|
|
519875
|
-
function checkRecordScope(definition3, record22) {
|
|
519876
|
-
if (record22.scope.kind !== definition3.scope || record22.scope.kind === "conversation" && (record22.history !== definition3.history || record22.fork !== definition3.fork)) {
|
|
519877
|
-
throw new TypeError(`Document ${record22.id} (${record22.kind}) does not match the supplied definition semantics`);
|
|
519878
|
-
}
|
|
519879
|
-
}
|
|
519880
|
-
function checkRecordVersion(definition3, record22, version8) {
|
|
519881
|
-
if (version8 > definition3.version) {
|
|
519882
|
-
throw new Error(`Document ${record22.id} (${record22.kind}) has newer version ${version8} than ${definition3.version}`);
|
|
519883
|
-
}
|
|
519884
|
-
if (version8 < definition3.version && definition3.migrate === undefined) {
|
|
519885
|
-
throw new Error(`Document ${record22.id} (${record22.kind}) requires migration from version ${version8}`);
|
|
519886
|
-
}
|
|
519887
|
-
}
|
|
519888
|
-
function materializeDocument(definition3, stored3) {
|
|
519889
|
-
return materializeDocumentValue(definition3, stored3.record, stored3.version, stored3.value);
|
|
519890
|
-
}
|
|
519891
|
-
function materializeDocumentValue(definition3, record22, version8, value26) {
|
|
519892
|
-
checkRecordScope(definition3, record22);
|
|
519893
|
-
checkRecordVersion(definition3, record22, version8);
|
|
519894
|
-
if (version8 === definition3.version)
|
|
519895
|
-
return value26;
|
|
519896
|
-
return copyJson(definition3.migrate(value26, version8));
|
|
519897
|
-
}
|
|
519898
|
-
var init_documents = __esm(() => {
|
|
519899
|
-
init_dist2();
|
|
519900
|
-
});
|
|
519901
|
-
function defineEntry(kind24) {
|
|
519902
|
-
if (typeof kind24 !== "string" || kind24.length === 0)
|
|
519903
|
-
throw new TypeError("Entry kind must be a non-empty string");
|
|
519904
|
-
return {
|
|
519905
|
-
kind: kind24,
|
|
519906
|
-
is: (entry4) => entry4 !== undefined && entry4.kind === kind24
|
|
519907
|
-
};
|
|
519908
|
-
}
|
|
519909
|
-
var UserEntry;
|
|
519910
|
-
var AssistantEntry;
|
|
519911
|
-
var SystemEntry;
|
|
519912
|
-
var ToolResultEntry;
|
|
519913
|
-
var ResetEntry;
|
|
519914
|
-
var CompactionEntry;
|
|
519915
|
-
var init_entries = __esm(() => {
|
|
519916
|
-
UserEntry = defineEntry("pi.user");
|
|
519917
|
-
AssistantEntry = defineEntry("pi.assistant");
|
|
519918
|
-
SystemEntry = defineEntry("pi.system");
|
|
519919
|
-
ToolResultEntry = defineEntry("pi.tool-result");
|
|
519920
|
-
ResetEntry = defineEntry("pi.reset");
|
|
519921
|
-
CompactionEntry = defineEntry("pi.compaction");
|
|
519922
|
-
});
|
|
519923
|
-
function errorMessage(error) {
|
|
519924
|
-
if (error instanceof Error)
|
|
519925
|
-
return error.message;
|
|
519926
|
-
try {
|
|
519927
|
-
return String(error);
|
|
519928
|
-
} catch {
|
|
519929
|
-
return Object.prototype.toString.call(error);
|
|
519930
|
-
}
|
|
519931
|
-
}
|
|
519932
|
-
var ReadAfterWrite;
|
|
519933
|
-
var StorageRequestError;
|
|
519934
|
-
var SessionFailed;
|
|
519935
|
-
var ReadOnlySession;
|
|
519936
|
-
var ConversationBusy;
|
|
519937
|
-
var ConversationIdle;
|
|
519938
|
-
var init_errors = __esm(() => {
|
|
519939
|
-
ReadAfterWrite = class ReadAfterWrite2 extends Error {
|
|
519940
|
-
constructor(operation4) {
|
|
519941
|
-
super(`${operation4} cannot read tables after the first table write`);
|
|
519942
|
-
this.name = "ReadAfterWrite";
|
|
519943
|
-
}
|
|
519944
|
-
};
|
|
519945
|
-
StorageRequestError = class StorageRequestError2 extends Error {
|
|
519946
|
-
constructor(message) {
|
|
519947
|
-
super(message);
|
|
519948
|
-
this.name = "StorageRequestError";
|
|
519949
|
-
}
|
|
519950
|
-
};
|
|
519951
|
-
SessionFailed = class SessionFailed2 extends Error {
|
|
519952
|
-
constructor(cause) {
|
|
519953
|
-
super("Session failed after a storage error; close and reopen it", { cause });
|
|
519954
|
-
this.name = "SessionFailed";
|
|
519955
|
-
}
|
|
519956
|
-
};
|
|
519957
|
-
ReadOnlySession = class ReadOnlySession2 extends Error {
|
|
519958
|
-
constructor(what) {
|
|
519959
|
-
super(`Read-only Harness: ${what} refused`);
|
|
519960
|
-
this.name = "ReadOnlySession";
|
|
519961
|
-
}
|
|
519962
|
-
};
|
|
519963
|
-
ConversationBusy = class ConversationBusy2 extends Error {
|
|
519964
|
-
conversationId;
|
|
519965
|
-
constructor(conversationId) {
|
|
519966
|
-
super(`Conversation ${conversationId} is busy`);
|
|
519967
|
-
this.name = "ConversationBusy";
|
|
519968
|
-
this.conversationId = conversationId;
|
|
519969
|
-
}
|
|
519970
|
-
};
|
|
519971
|
-
ConversationIdle = class ConversationIdle2 extends Error {
|
|
519972
|
-
conversationId;
|
|
519973
|
-
constructor(conversationId) {
|
|
519974
|
-
super(`Conversation ${conversationId} is idle`);
|
|
519975
|
-
this.name = "ConversationIdle";
|
|
519976
|
-
this.conversationId = conversationId;
|
|
519977
|
-
}
|
|
519978
|
-
};
|
|
519979
|
-
});
|
|
519980
519989
|
function hostTimers(setTimer, report2) {
|
|
519981
519990
|
const arm = setTimer ?? nativeTimer;
|
|
519982
519991
|
let reported = false;
|
|
@@ -521375,9 +521384,9 @@ var INTERNAL_SCAN_PAGE_SIZE = 256;
|
|
|
521375
521384
|
var EMPTY_OPERATIONS;
|
|
521376
521385
|
var TABLE_JSON_COPY_OPTIONS;
|
|
521377
521386
|
var init_transaction = __esm(() => {
|
|
521378
|
-
init_dist2();
|
|
521379
521387
|
init_context();
|
|
521380
521388
|
init_delta();
|
|
521389
|
+
init_json();
|
|
521381
521390
|
init_documents();
|
|
521382
521391
|
init_errors();
|
|
521383
521392
|
init_forks();
|
|
@@ -522891,9 +522900,9 @@ var defaultRetention = 600000;
|
|
|
522891
522900
|
var DEFAULT_PERSIST_WITHIN_MS = 1000;
|
|
522892
522901
|
var ENDED2;
|
|
522893
522902
|
var init_session = __esm(() => {
|
|
522894
|
-
init_dist2();
|
|
522895
522903
|
init_context();
|
|
522896
522904
|
init_delta();
|
|
522905
|
+
init_watch();
|
|
522897
522906
|
init_documents();
|
|
522898
522907
|
init_errors();
|
|
522899
522908
|
init_timers();
|
|
@@ -522990,6 +522999,28 @@ function applyChange(state2, change4) {
|
|
|
522990
522999
|
throw new RangeError(`maxTurns must be an integer 1 or more, got ${String(maxTurns)}`);
|
|
522991
523000
|
}
|
|
522992
523001
|
set2("maxTurns", maxTurns);
|
|
523002
|
+
const compaction = change4.compaction;
|
|
523003
|
+
set2("compaction", compaction === undefined || compaction === null ? compaction : compactionSettings(compaction));
|
|
523004
|
+
}
|
|
523005
|
+
function compactionSettings(settings) {
|
|
523006
|
+
const { modelOverrides, ...policy31 } = settings;
|
|
523007
|
+
if (modelOverrides === undefined)
|
|
523008
|
+
return compactionFields(policy31);
|
|
523009
|
+
const overrides = Object.entries(modelOverrides).map(([key211, override]) => [key211, compactionFields(override)]);
|
|
523010
|
+
return { ...compactionFields(policy31), modelOverrides: Object.fromEntries(overrides) };
|
|
523011
|
+
}
|
|
523012
|
+
function compactionFields(policy31) {
|
|
523013
|
+
const fields11 = policy31.enabled === undefined ? {} : { enabled: policy31.enabled };
|
|
523014
|
+
for (const key211 of TOKEN_FIELDS) {
|
|
523015
|
+
const value26 = policy31[key211];
|
|
523016
|
+
if (value26 === undefined)
|
|
523017
|
+
continue;
|
|
523018
|
+
if (!(Number.isSafeInteger(value26) && value26 >= 0)) {
|
|
523019
|
+
throw new RangeError(`compaction.${key211} must be an integer 0 or more, got ${String(value26)}`);
|
|
523020
|
+
}
|
|
523021
|
+
fields11[key211] = value26;
|
|
523022
|
+
}
|
|
523023
|
+
return fields11;
|
|
522993
523024
|
}
|
|
522994
523025
|
function isList210(value26) {
|
|
522995
523026
|
return Array.isArray(value26);
|
|
@@ -523077,7 +523108,8 @@ function resolveAgent(state2, snapshot2, settings, report2) {
|
|
|
523077
523108
|
sections: agentSections,
|
|
523078
523109
|
...instructions === undefined ? {} : { instructions },
|
|
523079
523110
|
...state2?.cwd === undefined ? {} : { cwd: state2.cwd },
|
|
523080
|
-
...state2?.maxTurns === undefined ? {} : { maxTurns: state2.maxTurns }
|
|
523111
|
+
...state2?.maxTurns === undefined ? {} : { maxTurns: state2.maxTurns },
|
|
523112
|
+
...state2?.compaction === undefined ? {} : { compaction: state2.compaction }
|
|
523081
523113
|
};
|
|
523082
523114
|
return agent;
|
|
523083
523115
|
}
|
|
@@ -523145,8 +523177,9 @@ var INSTRUCTIONS_KEY = "instructions";
|
|
|
523145
523177
|
var AgentDoc;
|
|
523146
523178
|
var DEFAULT_CONTEXT_RETENTION_MS = 600000;
|
|
523147
523179
|
var DEFAULT_RESTART_LIMIT = 5;
|
|
523180
|
+
var TOKEN_FIELDS;
|
|
523148
523181
|
var init_agent = __esm(() => {
|
|
523149
|
-
|
|
523182
|
+
init_json();
|
|
523150
523183
|
init_documents();
|
|
523151
523184
|
init_session();
|
|
523152
523185
|
DEFAULT_RETRY_POLICY = {
|
|
@@ -523175,6 +523208,7 @@ var init_agent = __esm(() => {
|
|
|
523175
523208
|
initial: () => ({}),
|
|
523176
523209
|
checkpointWhen: () => true
|
|
523177
523210
|
});
|
|
523211
|
+
TOKEN_FIELDS = ["reserveTokens", "keepRecentTokens", "backgroundTokens"];
|
|
523178
523212
|
});
|
|
523179
523213
|
function contentText(content3, separator = `
|
|
523180
523214
|
`) {
|
|
@@ -523323,6 +523357,7 @@ var init_retry = __esm(() => {
|
|
|
523323
523357
|
"stream ended before a terminal response event",
|
|
523324
523358
|
"http2 request did not get a response",
|
|
523325
523359
|
"stream disconnected before completion",
|
|
523360
|
+
"cut short after the reply had begun",
|
|
523326
523361
|
"pending stream has been canceled",
|
|
523327
523362
|
"retry delay",
|
|
523328
523363
|
"you can retry your request",
|
|
@@ -523764,7 +523799,7 @@ async function withdrawQueuedInputs(tx, conversationId, reason3 = "aborted") {
|
|
|
523764
523799
|
}
|
|
523765
523800
|
var InboxDoc;
|
|
523766
523801
|
var init_inbox = __esm(() => {
|
|
523767
|
-
|
|
523802
|
+
init_json();
|
|
523768
523803
|
init_documents();
|
|
523769
523804
|
init_entries();
|
|
523770
523805
|
InboxDoc = defineDoc({
|
|
@@ -525776,12 +525811,11 @@ class TaskScheduler {
|
|
|
525776
525811
|
async#finalize(tx) {
|
|
525777
525812
|
const done = new Set;
|
|
525778
525813
|
const overlay = overlayOf(tx);
|
|
525779
|
-
let round3;
|
|
525814
|
+
let round3 = [...this.#finalizeChecks];
|
|
525815
|
+
this.#finalizeChecks.clear();
|
|
525780
525816
|
for (;; ) {
|
|
525781
525817
|
const ids = round3;
|
|
525782
|
-
const plan18 = await this.#region(() => this.#planRound(ids
|
|
525783
|
-
if (ids === undefined)
|
|
525784
|
-
this.#finalizeChecks.clear();
|
|
525818
|
+
const plan18 = await this.#region(() => this.#planRound(ids, overlay, done), this.#reloadScopes);
|
|
525785
525819
|
for (const { record: record22, terminal } of plan18.finalized) {
|
|
525786
525820
|
tx.setTask(terminal);
|
|
525787
525821
|
overlay.tasks.set(record22.id, terminal);
|
|
@@ -526402,9 +526436,7 @@ class TaskScheduler {
|
|
|
526402
526436
|
}
|
|
526403
526437
|
await this.#loadScopes(false);
|
|
526404
526438
|
this.#wakeDue();
|
|
526405
|
-
const plan18 = await this.#
|
|
526406
|
-
for (const id24 of plan18.dropped)
|
|
526407
|
-
this.#runnable.delete(id24);
|
|
526439
|
+
const plan18 = await this.#planCandidates();
|
|
526408
526440
|
if (plan18.cascade) {
|
|
526409
526441
|
this.#cascadePending = true;
|
|
526410
526442
|
this.#scheduleReconcile();
|
|
@@ -526463,11 +526495,31 @@ class TaskScheduler {
|
|
|
526463
526495
|
this.#dirty = true;
|
|
526464
526496
|
return reservations;
|
|
526465
526497
|
}
|
|
526466
|
-
#
|
|
526498
|
+
async#planCandidates() {
|
|
526499
|
+
const candidates7 = this.#runnable;
|
|
526500
|
+
this.#runnable = new Set;
|
|
526501
|
+
let dropped = new Set;
|
|
526502
|
+
try {
|
|
526503
|
+
const plan18 = await this.#region(() => this.#planReservation(candidates7), this.#reloadScopes);
|
|
526504
|
+
dropped = new Set(plan18.dropped);
|
|
526505
|
+
return plan18;
|
|
526506
|
+
} finally {
|
|
526507
|
+
const merged = new Set;
|
|
526508
|
+
for (const id24 of candidates7) {
|
|
526509
|
+
const status25 = this.#live.get(id24)?.state.status;
|
|
526510
|
+
if (!dropped.has(id24) && status25 !== undefined && status25 !== "completing")
|
|
526511
|
+
merged.add(id24);
|
|
526512
|
+
}
|
|
526513
|
+
for (const id24 of this.#runnable)
|
|
526514
|
+
merged.add(id24);
|
|
526515
|
+
this.#runnable = merged;
|
|
526516
|
+
}
|
|
526517
|
+
}
|
|
526518
|
+
#planReservation(candidates7) {
|
|
526467
526519
|
const dropped = [];
|
|
526468
526520
|
const ready = [];
|
|
526469
526521
|
let cascade = false;
|
|
526470
|
-
for (const id24 of
|
|
526522
|
+
for (const id24 of candidates7) {
|
|
526471
526523
|
if (this.#invocations.has(id24)) {
|
|
526472
526524
|
dropped.push(id24);
|
|
526473
526525
|
continue;
|
|
@@ -527333,9 +527385,9 @@ var ON_WAKE;
|
|
|
527333
527385
|
var TELEMETRY2;
|
|
527334
527386
|
var endedByCrashesStates;
|
|
527335
527387
|
var init_scheduler = __esm(() => {
|
|
527336
|
-
init_dist2();
|
|
527337
527388
|
init_context();
|
|
527338
527389
|
init_delta();
|
|
527390
|
+
init_json();
|
|
527339
527391
|
init_dist();
|
|
527340
527392
|
init_errors();
|
|
527341
527393
|
init_keys();
|
|
@@ -527674,7 +527726,7 @@ var init_output = __esm(() => {
|
|
|
527674
527726
|
|
|
527675
527727
|
class Resolver {
|
|
527676
527728
|
draft;
|
|
527677
|
-
rootBase;
|
|
527729
|
+
rootBase = DEFAULT_BASE;
|
|
527678
527730
|
baseOf = new Map;
|
|
527679
527731
|
dynamicAnchors = new Map;
|
|
527680
527732
|
root;
|
|
@@ -527690,15 +527742,20 @@ class Resolver {
|
|
|
527690
527742
|
this.root = root;
|
|
527691
527743
|
this.options = options;
|
|
527692
527744
|
this.rejectUnresolved = options.unresolvedRefs === "reject";
|
|
527693
|
-
this.rootBase = isSchemaObject(root) ? this.baseFor(root, DEFAULT_BASE) : DEFAULT_BASE;
|
|
527694
527745
|
}
|
|
527695
527746
|
baseFor(node, base) {
|
|
527696
|
-
|
|
527747
|
+
let indexed = this.baseOf.get(node);
|
|
527697
527748
|
if (indexed !== undefined)
|
|
527698
527749
|
return indexed;
|
|
527699
527750
|
const id24 = node.$id;
|
|
527700
527751
|
if (typeof id24 !== "string")
|
|
527701
527752
|
return base;
|
|
527753
|
+
if (!this.indexed) {
|
|
527754
|
+
this.ensureIndexed();
|
|
527755
|
+
indexed = this.baseOf.get(node);
|
|
527756
|
+
if (indexed !== undefined)
|
|
527757
|
+
return indexed;
|
|
527758
|
+
}
|
|
527702
527759
|
if (this.draft === "7" && (typeof node.$ref === "string" || id24.startsWith("#")))
|
|
527703
527760
|
return base;
|
|
527704
527761
|
return documentOf(resolveUri(id24, base));
|
|
@@ -527932,7 +527989,7 @@ class Coercer {
|
|
|
527932
527989
|
}
|
|
527933
527990
|
}
|
|
527934
527991
|
baseOf(node, base) {
|
|
527935
|
-
return isSchemaObject(node) ? this.c.r.
|
|
527992
|
+
return isSchemaObject(node) ? this.c.r.baseFor(node, base) : base;
|
|
527936
527993
|
}
|
|
527937
527994
|
dropOptionalNulls(value27, schema6, base) {
|
|
527938
527995
|
if (!isSchemaObject(schema6))
|
|
@@ -528028,6 +528085,10 @@ class Coercer {
|
|
|
528028
528085
|
return orValue(tryBoolean(value27), value27);
|
|
528029
528086
|
case "null":
|
|
528030
528087
|
return orValue(tryNull(value27), value27);
|
|
528088
|
+
case "bigint":
|
|
528089
|
+
return orValue(tryBigInt(value27), value27);
|
|
528090
|
+
case "undefined":
|
|
528091
|
+
return orValue(tryUndefined(value27), value27);
|
|
528031
528092
|
case "array":
|
|
528032
528093
|
return this.convertArray(node, b, value27);
|
|
528033
528094
|
case "object":
|
|
@@ -528212,7 +528273,7 @@ function orValue(result22, value27) {
|
|
|
528212
528273
|
function convertLiteral(literal, value27) {
|
|
528213
528274
|
if (literal === value27)
|
|
528214
528275
|
return value27;
|
|
528215
|
-
const result22 = typeof literal === "string" ? tryString(value27) : typeof literal === "number" ? tryNumber(value27) : typeof literal === "boolean" ? tryBoolean(value27) : undefined;
|
|
528276
|
+
const result22 = typeof literal === "string" ? tryString(value27) : typeof literal === "number" ? tryNumber(value27) : typeof literal === "boolean" ? tryBoolean(value27) : typeof literal === "bigint" ? tryBigInt(value27) : undefined;
|
|
528216
528277
|
return result22 !== undefined && result22.value === literal ? result22.value : value27;
|
|
528217
528278
|
}
|
|
528218
528279
|
function tryString(value27) {
|
|
@@ -528257,6 +528318,31 @@ function bigIntOfString(value27) {
|
|
|
528257
528318
|
return BigInt(value27);
|
|
528258
528319
|
return;
|
|
528259
528320
|
}
|
|
528321
|
+
function tryBigInt(value27) {
|
|
528322
|
+
if (typeof value27 === "bigint")
|
|
528323
|
+
return { value: value27 };
|
|
528324
|
+
if (typeof value27 === "boolean")
|
|
528325
|
+
return { value: value27 ? 1n : 0n };
|
|
528326
|
+
if (isFiniteNumber(value27))
|
|
528327
|
+
return { value: BigInt(Math.trunc(value27)) };
|
|
528328
|
+
if (value27 === null || value27 === undefined)
|
|
528329
|
+
return { value: 0n };
|
|
528330
|
+
if (typeof value27 !== "string")
|
|
528331
|
+
return;
|
|
528332
|
+
const big = bigIntOfString(value27);
|
|
528333
|
+
if (big !== undefined)
|
|
528334
|
+
return { value: big };
|
|
528335
|
+
const lowercase210 = value27.toLowerCase();
|
|
528336
|
+
return lowercase210 === "false" ? { value: 0n } : lowercase210 === "true" ? { value: 1n } : undefined;
|
|
528337
|
+
}
|
|
528338
|
+
function tryUndefined(value27) {
|
|
528339
|
+
if (value27 === undefined || value27 === null || value27 === 0n || value27 === false || value27 === 0)
|
|
528340
|
+
return { value: undefined };
|
|
528341
|
+
if (typeof value27 !== "string")
|
|
528342
|
+
return;
|
|
528343
|
+
const lowercase210 = value27.toLowerCase();
|
|
528344
|
+
return lowercase210 === "undefined" || lowercase210 === "null" || value27 === "" || value27 === "0" ? { value: undefined } : undefined;
|
|
528345
|
+
}
|
|
528260
528346
|
function tryBoolean(value27) {
|
|
528261
528347
|
if (typeof value27 === "bigint")
|
|
528262
528348
|
return value27 === 0n ? { value: false } : value27 === 1n ? { value: true } : undefined;
|
|
@@ -528302,7 +528388,7 @@ function typesOf(schema6) {
|
|
|
528302
528388
|
function matchesType(value27, type) {
|
|
528303
528389
|
switch (type) {
|
|
528304
528390
|
case "number":
|
|
528305
|
-
return
|
|
528391
|
+
return Number.isFinite(value27);
|
|
528306
528392
|
case "integer":
|
|
528307
528393
|
return typeof value27 === "number" && Number.isInteger(value27);
|
|
528308
528394
|
case "boolean":
|
|
@@ -528311,6 +528397,10 @@ function matchesType(value27, type) {
|
|
|
528311
528397
|
return typeof value27 === "string";
|
|
528312
528398
|
case "null":
|
|
528313
528399
|
return value27 === null;
|
|
528400
|
+
case "bigint":
|
|
528401
|
+
return typeof value27 === "bigint";
|
|
528402
|
+
case "undefined":
|
|
528403
|
+
return value27 === undefined;
|
|
528314
528404
|
case "array":
|
|
528315
528405
|
return Array.isArray(value27);
|
|
528316
528406
|
case "object":
|
|
@@ -528368,22 +528458,64 @@ var init_coerce = __esm(() => {
|
|
|
528368
528458
|
function isObject210(v) {
|
|
528369
528459
|
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Uint8Array);
|
|
528370
528460
|
}
|
|
528371
|
-
function
|
|
528461
|
+
function leafOf(check2) {
|
|
528462
|
+
return leaves.get(check2);
|
|
528463
|
+
}
|
|
528464
|
+
function leaf(code216, arg, check2) {
|
|
528465
|
+
leaves.set(check2, [code216, arg]);
|
|
528466
|
+
return check2;
|
|
528467
|
+
}
|
|
528468
|
+
|
|
528469
|
+
class Bounds2 {
|
|
528470
|
+
min;
|
|
528471
|
+
max;
|
|
528472
|
+
xmin;
|
|
528473
|
+
xmax;
|
|
528474
|
+
constructor(min28, max210, xmin, xmax) {
|
|
528475
|
+
this.min = min28;
|
|
528476
|
+
this.max = max210;
|
|
528477
|
+
this.xmin = xmin;
|
|
528478
|
+
this.xmax = xmax;
|
|
528479
|
+
}
|
|
528480
|
+
}
|
|
528481
|
+
function leafOk(code216, x, arg) {
|
|
528372
528482
|
switch (code216) {
|
|
528373
528483
|
case 1:
|
|
528374
528484
|
return typeof x === "string";
|
|
528375
528485
|
case 2:
|
|
528376
|
-
return
|
|
528486
|
+
return Number.isFinite(x);
|
|
528377
528487
|
case 3:
|
|
528378
528488
|
return Number.isInteger(x);
|
|
528379
528489
|
case 4:
|
|
528380
528490
|
return typeof x === "boolean";
|
|
528381
528491
|
case 5:
|
|
528382
528492
|
return x === null;
|
|
528493
|
+
case 7:
|
|
528494
|
+
return x === arg;
|
|
528495
|
+
case 8: {
|
|
528496
|
+
const list310 = arg;
|
|
528497
|
+
for (let i = 0;i < list310.length; i++)
|
|
528498
|
+
if (list310[i] === x)
|
|
528499
|
+
return true;
|
|
528500
|
+
return false;
|
|
528501
|
+
}
|
|
528502
|
+
case 9:
|
|
528503
|
+
return (typeBits(x) & arg) !== 0;
|
|
528504
|
+
case 10:
|
|
528505
|
+
return Number.isInteger(x) && inBounds(x, arg);
|
|
528506
|
+
case 11:
|
|
528507
|
+
return Number.isFinite(x) && inBounds(x, arg);
|
|
528508
|
+
case 12:
|
|
528509
|
+
return typeof x === "string" && lengthOk(x, arg.min, arg.max);
|
|
528510
|
+
case 13:
|
|
528511
|
+
return typeof x === "string" && arg.test(x);
|
|
528383
528512
|
default:
|
|
528384
528513
|
return true;
|
|
528385
528514
|
}
|
|
528386
528515
|
}
|
|
528516
|
+
function inBounds(x, b) {
|
|
528517
|
+
return x >= b.min && x <= b.max && x > b.xmin && x < b.xmax;
|
|
528518
|
+
}
|
|
528387
528519
|
function and(parts) {
|
|
528388
528520
|
switch (parts.length) {
|
|
528389
528521
|
case 0:
|
|
@@ -528419,15 +528551,43 @@ function scopedCheck(scope4, uri, check2) {
|
|
|
528419
528551
|
};
|
|
528420
528552
|
}
|
|
528421
528553
|
function typeCheck(types) {
|
|
528422
|
-
|
|
528423
|
-
|
|
528424
|
-
|
|
528425
|
-
|
|
528426
|
-
|
|
528427
|
-
|
|
528428
|
-
|
|
528429
|
-
|
|
528430
|
-
|
|
528554
|
+
if (types.length === 1)
|
|
528555
|
+
return (typeof types[0] === "string" ? TYPE_CHECKS.get(types[0]) : undefined) ?? NEVER;
|
|
528556
|
+
return maskCheck(typeMask(types));
|
|
528557
|
+
}
|
|
528558
|
+
function typeMask(types) {
|
|
528559
|
+
let mask210 = 0;
|
|
528560
|
+
for (const t of types)
|
|
528561
|
+
if (typeof t === "string")
|
|
528562
|
+
mask210 |= TYPE_BITS.get(t) ?? 0;
|
|
528563
|
+
return mask210;
|
|
528564
|
+
}
|
|
528565
|
+
function typeBits(v) {
|
|
528566
|
+
switch (typeof v) {
|
|
528567
|
+
case "string":
|
|
528568
|
+
return 1;
|
|
528569
|
+
case "number":
|
|
528570
|
+
return Number.isInteger(v) ? 6 : Number.isFinite(v) ? 2 : 0;
|
|
528571
|
+
case "boolean":
|
|
528572
|
+
return 8;
|
|
528573
|
+
case "object":
|
|
528574
|
+
return v === null ? 16 : Array.isArray(v) ? 32 : v instanceof Uint8Array ? 128 : 64;
|
|
528575
|
+
case "bigint":
|
|
528576
|
+
return 256;
|
|
528577
|
+
case "undefined":
|
|
528578
|
+
return 512;
|
|
528579
|
+
default:
|
|
528580
|
+
return 0;
|
|
528581
|
+
}
|
|
528582
|
+
}
|
|
528583
|
+
function maskCheck(mask210) {
|
|
528584
|
+
return leaf(9, mask210, (v) => (typeBits(v) & mask210) !== 0);
|
|
528585
|
+
}
|
|
528586
|
+
function maskedAnyCheck(mask210, checks) {
|
|
528587
|
+
if (checks.length === 0)
|
|
528588
|
+
return maskCheck(mask210);
|
|
528589
|
+
const rest = checks.length === 1 ? checks[0] : anyCheck(checks);
|
|
528590
|
+
return (v) => (typeBits(v) & mask210) !== 0 || rest(v);
|
|
528431
528591
|
}
|
|
528432
528592
|
function bytesCheck(min28, max210) {
|
|
528433
528593
|
return (v) => v instanceof Uint8Array && v.length >= min28 && v.length <= max210;
|
|
@@ -528454,10 +528614,10 @@ function lengthOk(s, min28, max210) {
|
|
|
528454
528614
|
}
|
|
528455
528615
|
function stringCheck(strict, min28, max210, re, format) {
|
|
528456
528616
|
if (re !== undefined && min28 === 0 && max210 === Number.POSITIVE_INFINITY && format === undefined) {
|
|
528457
|
-
return strict ? (v) => typeof v === "string" && re.test(v) : (v) => typeof v !== "string" || re.test(v);
|
|
528617
|
+
return strict ? leaf(13, re, (v) => typeof v === "string" && re.test(v)) : (v) => typeof v !== "string" || re.test(v);
|
|
528458
528618
|
}
|
|
528459
528619
|
if (re === undefined && format === undefined) {
|
|
528460
|
-
return strict ? (v) => typeof v === "string" && lengthOk(v, min28, max210) : (v) => typeof v !== "string" || lengthOk(v, min28, max210);
|
|
528620
|
+
return strict ? leaf(12, new Bounds2(min28, max210, 0, 0), (v) => typeof v === "string" && lengthOk(v, min28, max210)) : (v) => typeof v !== "string" || lengthOk(v, min28, max210);
|
|
528461
528621
|
}
|
|
528462
528622
|
return (v) => {
|
|
528463
528623
|
if (typeof v !== "string")
|
|
@@ -528466,15 +528626,27 @@ function stringCheck(strict, min28, max210, re, format) {
|
|
|
528466
528626
|
};
|
|
528467
528627
|
}
|
|
528468
528628
|
function numberCheck(mode2, min28, max210, xmin, xmax, multipleOf) {
|
|
528469
|
-
|
|
528470
|
-
if (typeof v !== "number")
|
|
528629
|
+
const check2 = (v) => {
|
|
528630
|
+
if (typeof v !== "number" && typeof v !== "bigint")
|
|
528471
528631
|
return mode2 === 0;
|
|
528632
|
+
if (mode2 === 3 ? typeof v !== "bigint" : mode2 !== 0 && !Number.isFinite(v))
|
|
528633
|
+
return false;
|
|
528472
528634
|
if (mode2 === 2 && !Number.isInteger(v))
|
|
528473
528635
|
return false;
|
|
528474
528636
|
return v >= min28 && v <= max210 && v > xmin && v < xmax && (multipleOf === undefined || isMultiple(v, multipleOf));
|
|
528475
528637
|
};
|
|
528638
|
+
const plain = typeof min28 === "number" && typeof max210 === "number" && typeof xmin === "number" && typeof xmax === "number";
|
|
528639
|
+
if (mode2 === 0 || mode2 === 3 || multipleOf !== undefined || !plain)
|
|
528640
|
+
return check2;
|
|
528641
|
+
return leaf(mode2 === 2 ? 10 : 11, new Bounds2(min28, max210, xmin, xmax), check2);
|
|
528476
528642
|
}
|
|
528477
528643
|
function isMultiple(v, d) {
|
|
528644
|
+
if (typeof v === "bigint" || typeof d === "bigint") {
|
|
528645
|
+
if (typeof v === "number" && !Number.isInteger(v) || typeof d === "number" && !Number.isInteger(d))
|
|
528646
|
+
return false;
|
|
528647
|
+
const divisor = BigInt(d);
|
|
528648
|
+
return divisor !== 0n && BigInt(v) % divisor === 0n;
|
|
528649
|
+
}
|
|
528478
528650
|
const q = v / d;
|
|
528479
528651
|
if (Number.isInteger(q))
|
|
528480
528652
|
return true;
|
|
@@ -528503,21 +528675,26 @@ function declaredObject(entries22, requiredCount, closed, guard) {
|
|
|
528503
528675
|
return guard === GUARD_LOOSE;
|
|
528504
528676
|
const o = v;
|
|
528505
528677
|
let required = 0;
|
|
528678
|
+
let next = 0;
|
|
528506
528679
|
for (const k in o) {
|
|
528507
|
-
let i =
|
|
528508
|
-
|
|
528509
|
-
i
|
|
528510
|
-
|
|
528511
|
-
|
|
528512
|
-
|
|
528513
|
-
|
|
528680
|
+
let i = next;
|
|
528681
|
+
if (entries22[i] !== k) {
|
|
528682
|
+
i = 0;
|
|
528683
|
+
while (i < n && entries22[i] !== k)
|
|
528684
|
+
i += 3;
|
|
528685
|
+
if (i === n) {
|
|
528686
|
+
if (closed)
|
|
528687
|
+
return false;
|
|
528688
|
+
continue;
|
|
528689
|
+
}
|
|
528514
528690
|
}
|
|
528691
|
+
next = i + 3;
|
|
528515
528692
|
const x = o[k];
|
|
528516
|
-
if (x === undefined)
|
|
528517
|
-
continue;
|
|
528518
528693
|
const f = entries22[i + 2];
|
|
528694
|
+
if (x === undefined && !(f & REQUIRED))
|
|
528695
|
+
continue;
|
|
528519
528696
|
const c = f & CODE;
|
|
528520
|
-
if (c !== 0 ? !leafOk(c, x) : !entries22[i + 1](x))
|
|
528697
|
+
if (c !== 0 ? !leafOk(c, x, entries22[i + 1]) : !entries22[i + 1](x))
|
|
528521
528698
|
return false;
|
|
528522
528699
|
if (f & REQUIRED)
|
|
528523
528700
|
required++;
|
|
@@ -528535,13 +528712,13 @@ function openObject(entries22, keys3, extraRequired, patterns, additional, guard
|
|
|
528535
528712
|
const k = entries22[i];
|
|
528536
528713
|
const x = o[k];
|
|
528537
528714
|
const f = entries22[i + 2];
|
|
528538
|
-
if (x === undefined || f & INHERITED && !Object.hasOwn(o, k)) {
|
|
528715
|
+
if (x === undefined && !(f & REQUIRED && Object.hasOwn(o, k)) || f & INHERITED && !Object.hasOwn(o, k)) {
|
|
528539
528716
|
if (f & REQUIRED)
|
|
528540
528717
|
return false;
|
|
528541
528718
|
continue;
|
|
528542
528719
|
}
|
|
528543
528720
|
const c = f & CODE;
|
|
528544
|
-
if (c !== 0 ? !leafOk(c, x) : !entries22[i + 1](x))
|
|
528721
|
+
if (c !== 0 ? !leafOk(c, x, entries22[i + 1]) : !entries22[i + 1](x))
|
|
528545
528722
|
return false;
|
|
528546
528723
|
}
|
|
528547
528724
|
for (let i = 0;i < extraRequired.length; i++)
|
|
@@ -528602,7 +528779,7 @@ function dependentSchemasCheck(entries22) {
|
|
|
528602
528779
|
}
|
|
528603
528780
|
function listCheck(guard, min28, max210, prefix, rest) {
|
|
528604
528781
|
const n = prefix.length;
|
|
528605
|
-
const code216 = rest === undefined ?
|
|
528782
|
+
const [code216, arg] = (rest === undefined ? undefined : leafOf(rest)) ?? NO_LEAF;
|
|
528606
528783
|
return (v) => {
|
|
528607
528784
|
if (!Array.isArray(v))
|
|
528608
528785
|
return guard === GUARD_LOOSE;
|
|
@@ -528617,7 +528794,7 @@ function listCheck(guard, min28, max210, prefix, rest) {
|
|
|
528617
528794
|
return true;
|
|
528618
528795
|
if (code216 !== 0) {
|
|
528619
528796
|
for (let i = n;i < length4; i++)
|
|
528620
|
-
if (!leafOk(code216, v[i]))
|
|
528797
|
+
if (!leafOk(code216, v[i], arg))
|
|
528621
528798
|
return false;
|
|
528622
528799
|
return true;
|
|
528623
528800
|
}
|
|
@@ -528654,12 +528831,12 @@ function uniqueCheck(v) {
|
|
|
528654
528831
|
function enumCheck(values22) {
|
|
528655
528832
|
const primitives = values22.filter((x) => typeof x !== "object" || x === null);
|
|
528656
528833
|
if (primitives.length === values22.length && primitives.length <= 8) {
|
|
528657
|
-
return (v) => {
|
|
528834
|
+
return leaf(8, primitives, (v) => {
|
|
528658
528835
|
for (let i = 0;i < primitives.length; i++)
|
|
528659
528836
|
if (primitives[i] === v)
|
|
528660
528837
|
return true;
|
|
528661
528838
|
return false;
|
|
528662
|
-
};
|
|
528839
|
+
});
|
|
528663
528840
|
}
|
|
528664
528841
|
const set2 = new Set(primitives);
|
|
528665
528842
|
const objects = values22.filter((x) => typeof x === "object" && x !== null);
|
|
@@ -528667,7 +528844,7 @@ function enumCheck(values22) {
|
|
|
528667
528844
|
}
|
|
528668
528845
|
function constCheck(value27) {
|
|
528669
528846
|
if (typeof value27 !== "object" || value27 === null)
|
|
528670
|
-
return (v) => v === value27;
|
|
528847
|
+
return leaf(7, value27, (v) => v === value27);
|
|
528671
528848
|
return (v) => deepEqual(v, value27);
|
|
528672
528849
|
}
|
|
528673
528850
|
function anyCheck(checks) {
|
|
@@ -528735,21 +528912,25 @@ function deepEqual(a, b) {
|
|
|
528735
528912
|
var ALWAYS = () => true;
|
|
528736
528913
|
var NEVER = () => false;
|
|
528737
528914
|
var IS_STRING = (v) => typeof v === "string";
|
|
528738
|
-
var IS_NUMBER = (v) =>
|
|
528915
|
+
var IS_NUMBER = (v) => Number.isFinite(v);
|
|
528739
528916
|
var IS_INTEGER = (v) => Number.isInteger(v);
|
|
528740
528917
|
var IS_BOOLEAN = (v) => typeof v === "boolean";
|
|
528741
528918
|
var IS_NULL = (v) => v === null;
|
|
528742
528919
|
var IS_ARRAY = (v) => Array.isArray(v);
|
|
528743
528920
|
var IS_BYTES = (v) => v instanceof Uint8Array;
|
|
528921
|
+
var IS_BIGINT = (v) => typeof v === "bigint";
|
|
528922
|
+
var IS_UNDEFINED = (v) => v === undefined;
|
|
528744
528923
|
var IS_OBJECT = (v) => isObject210(v);
|
|
528745
528924
|
var TYPE_CHECKS;
|
|
528746
|
-
var
|
|
528925
|
+
var leaves;
|
|
528747
528926
|
var GUARD_NONE = 0;
|
|
528748
528927
|
var GUARD_STRICT = 1;
|
|
528749
528928
|
var GUARD_LOOSE = 2;
|
|
528750
|
-
var CODE =
|
|
528751
|
-
var REQUIRED =
|
|
528752
|
-
var INHERITED =
|
|
528929
|
+
var CODE = 15;
|
|
528930
|
+
var REQUIRED = 16;
|
|
528931
|
+
var INHERITED = 32;
|
|
528932
|
+
var TYPE_BITS;
|
|
528933
|
+
var NO_LEAF;
|
|
528753
528934
|
var init_checks = __esm(() => {
|
|
528754
528935
|
TYPE_CHECKS = new Map([
|
|
528755
528936
|
["string", IS_STRING],
|
|
@@ -528759,16 +528940,31 @@ var init_checks = __esm(() => {
|
|
|
528759
528940
|
["null", IS_NULL],
|
|
528760
528941
|
["array", IS_ARRAY],
|
|
528761
528942
|
["object", IS_OBJECT],
|
|
528762
|
-
["bytes", IS_BYTES]
|
|
528943
|
+
["bytes", IS_BYTES],
|
|
528944
|
+
["bigint", IS_BIGINT],
|
|
528945
|
+
["undefined", IS_UNDEFINED]
|
|
528763
528946
|
]);
|
|
528764
|
-
|
|
528765
|
-
[IS_STRING, 1],
|
|
528766
|
-
[IS_NUMBER, 2],
|
|
528767
|
-
[IS_INTEGER, 3],
|
|
528768
|
-
[IS_BOOLEAN, 4],
|
|
528769
|
-
[IS_NULL, 5],
|
|
528770
|
-
[ALWAYS, 6]
|
|
528947
|
+
leaves = new WeakMap([
|
|
528948
|
+
[IS_STRING, [1, undefined]],
|
|
528949
|
+
[IS_NUMBER, [2, undefined]],
|
|
528950
|
+
[IS_INTEGER, [3, undefined]],
|
|
528951
|
+
[IS_BOOLEAN, [4, undefined]],
|
|
528952
|
+
[IS_NULL, [5, undefined]],
|
|
528953
|
+
[ALWAYS, [6, undefined]]
|
|
528771
528954
|
]);
|
|
528955
|
+
TYPE_BITS = new Map([
|
|
528956
|
+
["string", 1],
|
|
528957
|
+
["number", 2],
|
|
528958
|
+
["integer", 4],
|
|
528959
|
+
["boolean", 8],
|
|
528960
|
+
["null", 16],
|
|
528961
|
+
["array", 32],
|
|
528962
|
+
["object", 64],
|
|
528963
|
+
["bytes", 128],
|
|
528964
|
+
["bigint", 256],
|
|
528965
|
+
["undefined", 512]
|
|
528966
|
+
]);
|
|
528967
|
+
NO_LEAF = [0, undefined];
|
|
528772
528968
|
});
|
|
528773
528969
|
function newAnnotations() {
|
|
528774
528970
|
return { props: null, allProps: false, items: 0, allItems: false, indexes: null };
|
|
@@ -529022,8 +529218,9 @@ class Compiler {
|
|
|
529022
529218
|
const string510 = this.stringGroup(node, single === "string");
|
|
529023
529219
|
if (string510 !== undefined)
|
|
529024
529220
|
parts.push(string510);
|
|
529025
|
-
const numeric = single === "number" || single === "integer";
|
|
529026
|
-
const
|
|
529221
|
+
const numeric = single === "number" || single === "integer" || single === "bigint";
|
|
529222
|
+
const mode2 = single === "number" ? 1 : single === "integer" ? 2 : single === "bigint" ? 3 : 0;
|
|
529223
|
+
const number2 = this.numberGroup(node, mode2);
|
|
529027
529224
|
if (number2 !== undefined)
|
|
529028
529225
|
parts.push(number2);
|
|
529029
529226
|
const object6 = this.objectGroup(node, base, single === "object");
|
|
@@ -529065,7 +529262,7 @@ class Compiler {
|
|
|
529065
529262
|
}
|
|
529066
529263
|
union(branches2, base, exactlyOne) {
|
|
529067
529264
|
const checks = () => branches2.map((s) => this.check(s, base));
|
|
529068
|
-
return constUnion(branches2, exactlyOne) ?? this.tagged(branches2, base) ?? (exactlyOne ? oneCheck(checks()) :
|
|
529265
|
+
return constUnion(branches2, exactlyOne) ?? this.tagged(branches2, base) ?? (exactlyOne ? oneCheck(checks()) : anyOf(checks()));
|
|
529069
529266
|
}
|
|
529070
529267
|
ref(ref, base) {
|
|
529071
529268
|
const target2 = this.r.resolve(ref, base);
|
|
@@ -529147,11 +529344,11 @@ class Compiler {
|
|
|
529147
529344
|
return stringCheck(strict, min28, max210, re, format);
|
|
529148
529345
|
}
|
|
529149
529346
|
numberGroup(node, mode2) {
|
|
529150
|
-
const min28 =
|
|
529151
|
-
const max210 =
|
|
529152
|
-
const xmin =
|
|
529153
|
-
const xmax =
|
|
529154
|
-
const multipleOf =
|
|
529347
|
+
const min28 = bound(node.minimum);
|
|
529348
|
+
const max210 = bound(node.maximum);
|
|
529349
|
+
const xmin = bound(node.exclusiveMinimum);
|
|
529350
|
+
const xmax = bound(node.exclusiveMaximum);
|
|
529351
|
+
const multipleOf = bound(node.multipleOf);
|
|
529155
529352
|
if ([min28, max210, xmin, xmax, multipleOf].every((x) => x === undefined))
|
|
529156
529353
|
return;
|
|
529157
529354
|
const inf = Number.POSITIVE_INFINITY;
|
|
@@ -529206,8 +529403,9 @@ class Compiler {
|
|
|
529206
529403
|
const entries22 = [];
|
|
529207
529404
|
for (const k of keys3) {
|
|
529208
529405
|
const check2 = this.check(properties[k], base);
|
|
529209
|
-
const
|
|
529210
|
-
|
|
529406
|
+
const leaf2 = leafOf(check2);
|
|
529407
|
+
const flags = (leaf2?.[0] ?? 0) | (required.includes(k) ? REQUIRED : 0) | (k in Object.prototype ? INHERITED : 0);
|
|
529408
|
+
entries22.push(k, leaf2 === undefined ? check2 : leaf2[1], flags);
|
|
529211
529409
|
}
|
|
529212
529410
|
const extraRequired = required.filter((k) => !Object.hasOwn(properties, k));
|
|
529213
529411
|
const pats = patternKeys.map((p) => [sharedRegex(p), this.check(patterns[p], base)]);
|
|
@@ -529363,6 +529561,18 @@ function constUnion(branches2, exactlyOne) {
|
|
|
529363
529561
|
}
|
|
529364
529562
|
return enumCheck(values22);
|
|
529365
529563
|
}
|
|
529564
|
+
function anyOf(checks) {
|
|
529565
|
+
const types = [];
|
|
529566
|
+
const rest = [];
|
|
529567
|
+
for (const check2 of checks) {
|
|
529568
|
+
const type = BARE_TYPES.get(check2);
|
|
529569
|
+
if (type === undefined)
|
|
529570
|
+
rest.push(check2);
|
|
529571
|
+
else
|
|
529572
|
+
types.push(type);
|
|
529573
|
+
}
|
|
529574
|
+
return types.length === 0 ? anyCheck(rest) : maskedAnyCheck(typeMask(types), rest);
|
|
529575
|
+
}
|
|
529366
529576
|
function tagOf(branch2, key211) {
|
|
529367
529577
|
const properties = branch2.properties;
|
|
529368
529578
|
if (branch2.type !== "object" || !Array.isArray(branch2.required) || !branch2.required.includes(key211))
|
|
@@ -529372,6 +529582,9 @@ function tagOf(branch2, key211) {
|
|
|
529372
529582
|
return;
|
|
529373
529583
|
return typeof tag3.const === "object" && tag3.const !== null ? undefined : tag3.const;
|
|
529374
529584
|
}
|
|
529585
|
+
function bound(value27) {
|
|
529586
|
+
return typeof value27 === "number" || typeof value27 === "bigint" ? value27 : undefined;
|
|
529587
|
+
}
|
|
529375
529588
|
function number2(value27) {
|
|
529376
529589
|
return typeof value27 === "number" ? value27 : undefined;
|
|
529377
529590
|
}
|
|
@@ -529382,6 +529595,7 @@ var RESTART;
|
|
|
529382
529595
|
var NEUTRAL_KEYWORDS;
|
|
529383
529596
|
var OBJECT_EXTRAS;
|
|
529384
529597
|
var ANNOTATING;
|
|
529598
|
+
var BARE_TYPES;
|
|
529385
529599
|
var init_compiler = __esm(() => {
|
|
529386
529600
|
init_annotations();
|
|
529387
529601
|
init_checks();
|
|
@@ -529436,6 +529650,7 @@ var init_compiler = __esm(() => {
|
|
|
529436
529650
|
"unevaluatedProperties",
|
|
529437
529651
|
"unevaluatedItems"
|
|
529438
529652
|
]);
|
|
529653
|
+
BARE_TYPES = new Map([...TYPE_CHECKS].map(([type, check2]) => [check2, type]));
|
|
529439
529654
|
});
|
|
529440
529655
|
|
|
529441
529656
|
class Explainer {
|
|
@@ -529497,7 +529712,7 @@ class Explainer {
|
|
|
529497
529712
|
this.walkString(node, v, push);
|
|
529498
529713
|
if (v instanceof Uint8Array && node.type === "bytes")
|
|
529499
529714
|
this.walkBytes(node, v, push);
|
|
529500
|
-
if (typeof v === "number")
|
|
529715
|
+
if (typeof v === "number" || typeof v === "bigint")
|
|
529501
529716
|
this.walkNumber(node, v, push);
|
|
529502
529717
|
if (isObject210(v))
|
|
529503
529718
|
this.walkObject(node, b, v, path31, out, push);
|
|
@@ -529577,25 +529792,26 @@ class Explainer {
|
|
|
529577
529792
|
}
|
|
529578
529793
|
}
|
|
529579
529794
|
walkNumber(node, v, push) {
|
|
529580
|
-
|
|
529581
|
-
|
|
529582
|
-
|
|
529583
|
-
|
|
529584
|
-
|
|
529585
|
-
|
|
529586
|
-
|
|
529587
|
-
if (
|
|
529588
|
-
push("exclusiveMaximum", `expected < ${
|
|
529589
|
-
|
|
529590
|
-
|
|
529591
|
-
push("multipleOf", `expected a multiple of ${node.multipleOf}`);
|
|
529592
|
-
}
|
|
529795
|
+
const { minimum, maximum: maximum2, exclusiveMinimum, exclusiveMaximum, multipleOf } = node;
|
|
529796
|
+
if (isBound(minimum) && v < minimum)
|
|
529797
|
+
push("minimum", `expected >= ${minimum}`);
|
|
529798
|
+
if (isBound(maximum2) && v > maximum2)
|
|
529799
|
+
push("maximum", `expected <= ${maximum2}`);
|
|
529800
|
+
if (isBound(exclusiveMinimum) && v <= exclusiveMinimum)
|
|
529801
|
+
push("exclusiveMinimum", `expected > ${exclusiveMinimum}`);
|
|
529802
|
+
if (isBound(exclusiveMaximum) && v >= exclusiveMaximum)
|
|
529803
|
+
push("exclusiveMaximum", `expected < ${exclusiveMaximum}`);
|
|
529804
|
+
if (isBound(multipleOf) && !isMultiple(v, multipleOf))
|
|
529805
|
+
push("multipleOf", `expected a multiple of ${multipleOf}`);
|
|
529593
529806
|
}
|
|
529594
529807
|
walkObject(node, b, v, path31, out, push) {
|
|
529595
529808
|
const properties = isSchemaObject(node.properties) ? node.properties : {};
|
|
529596
529809
|
const required = Array.isArray(node.required) ? node.required : [];
|
|
529597
529810
|
for (const k of required) {
|
|
529598
|
-
if (typeof k
|
|
529811
|
+
if (typeof k !== "string")
|
|
529812
|
+
continue;
|
|
529813
|
+
const accepted = v[k] === undefined && Object.hasOwn(properties, k) && this.ok(properties[k], b, undefined);
|
|
529814
|
+
if (!Object.hasOwn(v, k) || v[k] === undefined && !accepted)
|
|
529599
529815
|
push("required", "missing", pointer(path31, k));
|
|
529600
529816
|
}
|
|
529601
529817
|
for (const k of Object.keys(properties)) {
|
|
@@ -529717,12 +529933,12 @@ class Explainer {
|
|
|
529717
529933
|
out.push(...best?.errors ?? [{ path: path31, keyword, message: "matches no alternative" }]);
|
|
529718
529934
|
}
|
|
529719
529935
|
declaredKeys(s, b, v) {
|
|
529720
|
-
const node = isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, b).node : s;
|
|
529936
|
+
const node = isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s;
|
|
529721
529937
|
const properties = isSchemaObject(node) && isSchemaObject(node.properties) ? node.properties : {};
|
|
529722
529938
|
return Object.keys(v).filter((k) => Object.hasOwn(properties, k)).length;
|
|
529723
529939
|
}
|
|
529724
529940
|
tagOf(branches2, b) {
|
|
529725
|
-
const resolved = branches2.map((s) => isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, b).node : s);
|
|
529941
|
+
const resolved = branches2.map((s) => isSchemaObject(s) && typeof s.$ref === "string" ? this.c.r.resolve(s.$ref, this.c.r.baseFor(s, b)).node : s);
|
|
529726
529942
|
const first4 = resolved[0];
|
|
529727
529943
|
if (!isSchemaObject(first4) || !isSchemaObject(first4.properties))
|
|
529728
529944
|
return;
|
|
@@ -529738,7 +529954,7 @@ class Explainer {
|
|
|
529738
529954
|
return;
|
|
529739
529955
|
}
|
|
529740
529956
|
walkUnevaluated(node, b, v, path31, out) {
|
|
529741
|
-
const { unevaluatedProperties: unevaluatedProperties2, unevaluatedItems: unevaluatedItems2, ...rest } = node;
|
|
529957
|
+
const { unevaluatedProperties: unevaluatedProperties2, unevaluatedItems: unevaluatedItems2, $id: _id, ...rest } = node;
|
|
529742
529958
|
const a = newAnnotations();
|
|
529743
529959
|
this.c.annotating(rest, b)(v, a);
|
|
529744
529960
|
if (isObject210(v) && unevaluatedProperties2 !== undefined && !a.allProps) {
|
|
@@ -529776,6 +529992,9 @@ function containsMessage(min28, max210) {
|
|
|
529776
529992
|
return `expected at most ${max210} matching ${max210 === 1 ? "item" : "items"}`;
|
|
529777
529993
|
return `expected between ${min28} and ${max210} matching items`;
|
|
529778
529994
|
}
|
|
529995
|
+
function isBound(value27) {
|
|
529996
|
+
return typeof value27 === "number" || typeof value27 === "bigint";
|
|
529997
|
+
}
|
|
529779
529998
|
function pointer(path31, key211) {
|
|
529780
529999
|
return `${path31}/${String(key211).replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
529781
530000
|
}
|
|
@@ -529786,8 +530005,12 @@ function typeName(v) {
|
|
|
529786
530005
|
return "array";
|
|
529787
530006
|
if (v instanceof Uint8Array)
|
|
529788
530007
|
return "bytes";
|
|
530008
|
+
if (typeof v === "bigint")
|
|
530009
|
+
return "bigint";
|
|
529789
530010
|
if (typeof v === "number" && Number.isInteger(v))
|
|
529790
530011
|
return "integer";
|
|
530012
|
+
if (typeof v === "number" && !Number.isFinite(v))
|
|
530013
|
+
return String(v);
|
|
529791
530014
|
return typeof v;
|
|
529792
530015
|
}
|
|
529793
530016
|
var LISTED_VALUES = 20;
|
|
@@ -529818,6 +530041,9 @@ class Validator {
|
|
|
529818
530041
|
this.explainer ??= new Explainer(compiler(this.schema, this.options), this.schema);
|
|
529819
530042
|
return this.explainer.errors(value27);
|
|
529820
530043
|
}
|
|
530044
|
+
validate(value27) {
|
|
530045
|
+
return this.check(value27) ? { ok: true, value: value27 } : { ok: false, errors: this.errors(value27) };
|
|
530046
|
+
}
|
|
529821
530047
|
}
|
|
529822
530048
|
function compileCheck(schema6, options) {
|
|
529823
530049
|
return compiler(schema6, options).root();
|
|
@@ -529847,12 +530073,11 @@ var init_validator = __esm(() => {
|
|
|
529847
530073
|
return this.coercer.coerce(value27);
|
|
529848
530074
|
}
|
|
529849
530075
|
parse(value27) {
|
|
529850
|
-
|
|
529851
|
-
return this.check(coerced) ? { ok: true, value: coerced } : { ok: false, errors: this.errors(coerced) };
|
|
530076
|
+
return this.validate(this.coerce(value27));
|
|
529852
530077
|
}
|
|
529853
530078
|
};
|
|
529854
530079
|
});
|
|
529855
|
-
var
|
|
530080
|
+
var init_dist2 = __esm(() => {
|
|
529856
530081
|
init_validator();
|
|
529857
530082
|
});
|
|
529858
530083
|
function IsLeapYear(year) {
|
|
@@ -530493,7 +530718,7 @@ ${JSON.stringify(toolCall.arguments, null, 2)}`;
|
|
|
530493
530718
|
}
|
|
530494
530719
|
var validatorCache;
|
|
530495
530720
|
var init_validation = __esm(() => {
|
|
530496
|
-
|
|
530721
|
+
init_dist2();
|
|
530497
530722
|
init_formats();
|
|
530498
530723
|
validatorCache = new WeakMap;
|
|
530499
530724
|
});
|
|
@@ -530544,7 +530769,7 @@ function addUsageState(sum21, state2) {
|
|
|
530544
530769
|
}
|
|
530545
530770
|
var UsageDoc;
|
|
530546
530771
|
var init_usage = __esm(() => {
|
|
530547
|
-
|
|
530772
|
+
init_json();
|
|
530548
530773
|
init_documents();
|
|
530549
530774
|
UsageDoc = defineDoc({
|
|
530550
530775
|
kind: "pi.usage",
|
|
@@ -530628,7 +530853,7 @@ function validate13(tool, call2, args) {
|
|
|
530628
530853
|
return { error: errorMessage(error) };
|
|
530629
530854
|
}
|
|
530630
530855
|
}
|
|
530631
|
-
function
|
|
530856
|
+
function invalid(message) {
|
|
530632
530857
|
return harnessError("invalid_arguments", message);
|
|
530633
530858
|
}
|
|
530634
530859
|
async function run226(runtime, input24, call2, tool, args, context11) {
|
|
@@ -531139,12 +531364,12 @@ var structuredValidators;
|
|
|
531139
531364
|
var COMPLETED;
|
|
531140
531365
|
var MAX_SUMMARY_ERROR_CHARS = 500;
|
|
531141
531366
|
var init_tool = __esm(() => {
|
|
531142
|
-
init_dist2();
|
|
531143
531367
|
init_context();
|
|
531144
531368
|
init_delta();
|
|
531369
|
+
init_json();
|
|
531145
531370
|
init_output();
|
|
531146
531371
|
init_validation();
|
|
531147
|
-
|
|
531372
|
+
init_dist2();
|
|
531148
531373
|
init_formats();
|
|
531149
531374
|
init_documents();
|
|
531150
531375
|
init_entries();
|
|
@@ -531184,7 +531409,7 @@ var init_tool = __esm(() => {
|
|
|
531184
531409
|
const prepared = prepare5(tool, call2.arguments);
|
|
531185
531410
|
const checked = "error" in prepared ? prepared : validate13(tool, call2, prepared.args);
|
|
531186
531411
|
if ("error" in checked)
|
|
531187
|
-
return reject310(runtime, task.input, call2, tool,
|
|
531412
|
+
return reject310(runtime, task.input, call2, tool, invalid(checked.error), context11);
|
|
531188
531413
|
let args = checked.args;
|
|
531189
531414
|
let block;
|
|
531190
531415
|
await runtime.hooks.each("beforeTool", async (hook) => {
|
|
@@ -531208,7 +531433,7 @@ var init_tool = __esm(() => {
|
|
|
531208
531433
|
}
|
|
531209
531434
|
const validated = validate13(tool, call2, args);
|
|
531210
531435
|
if ("error" in validated)
|
|
531211
|
-
return reject310(runtime, task.input, call2, tool,
|
|
531436
|
+
return reject310(runtime, task.input, call2, tool, invalid(validated.error), context11);
|
|
531212
531437
|
const final = copyJson(validated.args, { omitUndefinedProperties: true });
|
|
531213
531438
|
await runtime.commit(async (tx) => {
|
|
531214
531439
|
const slot = toolSlot(await tx.doc(LiveDoc, runtime.conversationId), runtime.taskId);
|
|
@@ -531515,8 +531740,8 @@ async function classify7(runtime, request4, message, context11) {
|
|
|
531515
531740
|
}
|
|
531516
531741
|
const settings = runtime.settings;
|
|
531517
531742
|
const overflow = message.stopReason === "error" && isContextOverflow(message);
|
|
531518
|
-
const compaction = compactionPolicy(settings, ref);
|
|
531519
|
-
if (
|
|
531743
|
+
const compaction = overflow && compacted === undefined ? compactionPolicy(settings, ref, (await runtime.agent(context11)).compaction) : undefined;
|
|
531744
|
+
if (compaction?.enabled === true) {
|
|
531520
531745
|
const view = await runtime.context(conversationId, context11, { at: cutoff });
|
|
531521
531746
|
if (selectCut(view, compaction.keepRecentTokens) !== undefined) {
|
|
531522
531747
|
const text36 = message.errorMessage ?? "Context overflow";
|
|
@@ -531780,7 +532005,7 @@ function handOver(live, from22, to) {
|
|
|
531780
532005
|
var DEFAULT_POLL_AFTER_MS = 5000;
|
|
531781
532006
|
var GenerationTask;
|
|
531782
532007
|
var init_generation = __esm(() => {
|
|
531783
|
-
|
|
532008
|
+
init_json();
|
|
531784
532009
|
init_overflow();
|
|
531785
532010
|
init_retry();
|
|
531786
532011
|
init_transcript();
|
|
@@ -531847,7 +532072,7 @@ var init_generation = __esm(() => {
|
|
|
531847
532072
|
...optionalExtension(sectionExtension(agent, section.key))
|
|
531848
532073
|
}), context11);
|
|
531849
532074
|
const entries3 = planSystemEntries(view, desired2, agent.tools, runtime.now());
|
|
531850
|
-
const threshold = compacted === undefined ? thresholdCompaction(view, entries3, resolved.contextWindow, compactionPolicy(settings, model)) : undefined;
|
|
532075
|
+
const threshold = compacted === undefined ? thresholdCompaction(view, entries3, resolved.contextWindow, compactionPolicy(settings, model, agent.compaction)) : undefined;
|
|
531851
532076
|
if (threshold === "blocking") {
|
|
531852
532077
|
await runtime.commit(async (tx) => {
|
|
531853
532078
|
const child = await createCompaction(tx, conversationId, { reason: "threshold" }, runtime.taskId);
|
|
@@ -532412,8 +532637,8 @@ async function admitSubmission(tx, conversationId, draft, now, queueModes, span)
|
|
|
532412
532637
|
return { id: id24, status: "placed" };
|
|
532413
532638
|
}
|
|
532414
532639
|
var init_submissions = __esm(() => {
|
|
532415
|
-
init_dist2();
|
|
532416
532640
|
init_context();
|
|
532641
|
+
init_json();
|
|
532417
532642
|
init_dist();
|
|
532418
532643
|
init_errors();
|
|
532419
532644
|
init_generation();
|
|
@@ -532430,14 +532655,21 @@ async function createCompaction(tx, conversationId, input24, owner210) {
|
|
|
532430
532655
|
addCompactionStatus(await tx.doc(LiveDoc, conversationId), status25);
|
|
532431
532656
|
return taskId;
|
|
532432
532657
|
}
|
|
532433
|
-
function compactionPolicy(settings, model) {
|
|
532434
|
-
const
|
|
532435
|
-
const
|
|
532658
|
+
function compactionPolicy(settings, model, conversation) {
|
|
532659
|
+
const key211 = `${model.provider}/${model.modelId}`;
|
|
532660
|
+
const { modelOverrides, ...harness } = settings.compaction;
|
|
532661
|
+
const conversationModel = conversation?.modelOverrides?.[key211];
|
|
532662
|
+
const layers = [
|
|
532663
|
+
conversationModel,
|
|
532664
|
+
modelOverrides?.[key211],
|
|
532665
|
+
conversation
|
|
532666
|
+
];
|
|
532667
|
+
const field211 = (name211) => layers.find((layer) => layer?.[name211] !== undefined)?.[name211] ?? harness[name211];
|
|
532436
532668
|
return {
|
|
532437
|
-
enabled:
|
|
532438
|
-
reserveTokens:
|
|
532439
|
-
keepRecentTokens:
|
|
532440
|
-
backgroundTokens:
|
|
532669
|
+
enabled: conversationModel?.enabled ?? (conversation?.enabled === false ? false : field211("enabled")),
|
|
532670
|
+
reserveTokens: field211("reserveTokens"),
|
|
532671
|
+
keepRecentTokens: field211("keepRecentTokens"),
|
|
532672
|
+
backgroundTokens: field211("backgroundTokens")
|
|
532441
532673
|
};
|
|
532442
532674
|
}
|
|
532443
532675
|
function selectCut(view, keepRecentTokens) {
|
|
@@ -532685,7 +532917,7 @@ var init_compaction = __esm(() => {
|
|
|
532685
532917
|
const model = ref === undefined ? undefined : runtime.models.getModel(ref.provider, ref.modelId);
|
|
532686
532918
|
if (ref === undefined || model === undefined)
|
|
532687
532919
|
return failNoModel2(runtime, ref, context11);
|
|
532688
|
-
const policy31 = compactionPolicy(settings, ref);
|
|
532920
|
+
const policy31 = compactionPolicy(settings, ref, agent.compaction);
|
|
532689
532921
|
const view = await runtime.context(conversationId, context11);
|
|
532690
532922
|
const cut = selectCut(view, policy31.keepRecentTokens);
|
|
532691
532923
|
if (cut === undefined)
|
|
@@ -533181,9 +533413,9 @@ function phaseOf(checkpoint) {
|
|
|
533181
533413
|
var LIVE_STATUSES2;
|
|
533182
533414
|
var SCAN_PAGE_SIZE4 = 256;
|
|
533183
533415
|
var init_task_graph = __esm(() => {
|
|
533184
|
-
init_dist2();
|
|
533185
533416
|
init_context();
|
|
533186
533417
|
init_delta();
|
|
533418
|
+
init_watch();
|
|
533187
533419
|
init_session();
|
|
533188
533420
|
init_scheduler();
|
|
533189
533421
|
init_util();
|
|
@@ -533397,9 +533629,9 @@ var MOUNTED_KINDS;
|
|
|
533397
533629
|
var SCAN_PAGE_SIZE5 = 256;
|
|
533398
533630
|
var VIEWS;
|
|
533399
533631
|
var init_view = __esm(() => {
|
|
533400
|
-
init_dist2();
|
|
533401
533632
|
init_context();
|
|
533402
533633
|
init_delta();
|
|
533634
|
+
init_watch();
|
|
533403
533635
|
init_session();
|
|
533404
533636
|
init_agent();
|
|
533405
533637
|
init_inbox();
|
|
@@ -533531,11 +533763,11 @@ function safeNow(now, report22) {
|
|
|
533531
533763
|
};
|
|
533532
533764
|
}
|
|
533533
533765
|
function boundConversation(id24, binding, submissions2, tasks) {
|
|
533534
|
-
const
|
|
533535
|
-
const
|
|
533766
|
+
const bind = (context11) => withAbortSignal(binding.signal, context11);
|
|
533767
|
+
const bound2 = (operation4) => {
|
|
533536
533768
|
return async (context11) => {
|
|
533537
533769
|
binding.check();
|
|
533538
|
-
return operation4(
|
|
533770
|
+
return operation4(bind(context11));
|
|
533539
533771
|
};
|
|
533540
533772
|
};
|
|
533541
533773
|
async function submit26(first4, second) {
|
|
@@ -533544,12 +533776,12 @@ function boundConversation(id24, binding, submissions2, tasks) {
|
|
|
533544
533776
|
binding.signal.throwIfAborted();
|
|
533545
533777
|
return submissions2.admit(first4, id24, second);
|
|
533546
533778
|
}
|
|
533547
|
-
const submission2 = await submissions2.submit(id24, first4,
|
|
533779
|
+
const submission2 = await submissions2.submit(id24, first4, bind(second));
|
|
533548
533780
|
return {
|
|
533549
533781
|
id: submission2.id,
|
|
533550
|
-
status:
|
|
533551
|
-
wait:
|
|
533552
|
-
abort:
|
|
533782
|
+
status: bound2((callContext) => submission2.status(callContext)),
|
|
533783
|
+
wait: bound2((callContext) => submission2.wait(callContext)),
|
|
533784
|
+
abort: bound2((callContext) => submission2.abort(callContext))
|
|
533553
533785
|
};
|
|
533554
533786
|
}
|
|
533555
533787
|
return {
|
|
@@ -533557,9 +533789,9 @@ function boundConversation(id24, binding, submissions2, tasks) {
|
|
|
533557
533789
|
submit: submit26,
|
|
533558
533790
|
abort: async (context11, options) => {
|
|
533559
533791
|
binding.check();
|
|
533560
|
-
return tasks.abortConversation(id24, options?.background === true,
|
|
533792
|
+
return tasks.abortConversation(id24, options?.background === true, bind(context11));
|
|
533561
533793
|
},
|
|
533562
|
-
waitForIdle:
|
|
533794
|
+
waitForIdle: bound2((callContext) => tasks.waitForIdle(id24, callContext))
|
|
533563
533795
|
};
|
|
533564
533796
|
}
|
|
533565
533797
|
var SCAN_PAGE_SIZE6 = 256;
|
|
@@ -534807,7 +535039,7 @@ __export(exports_dist, {
|
|
|
534807
535039
|
AssistantEntry: () => AssistantEntry,
|
|
534808
535040
|
AgentDoc: () => AgentDoc
|
|
534809
535041
|
});
|
|
534810
|
-
var
|
|
535042
|
+
var init_dist3 = __esm(() => {
|
|
534811
535043
|
init_documents();
|
|
534812
535044
|
init_entries();
|
|
534813
535045
|
init_errors();
|
|
@@ -534937,7 +535169,7 @@ var init_event_stream = __esm(() => {
|
|
|
534937
535169
|
}
|
|
534938
535170
|
};
|
|
534939
535171
|
});
|
|
534940
|
-
function createSetupErrorMessage(model, error, timestamp3) {
|
|
535172
|
+
function createSetupErrorMessage(model, error, timestamp3, stopReason) {
|
|
534941
535173
|
return {
|
|
534942
535174
|
role: "assistant",
|
|
534943
535175
|
content: [],
|
|
@@ -534952,7 +535184,7 @@ function createSetupErrorMessage(model, error, timestamp3) {
|
|
|
534952
535184
|
totalTokens: 0,
|
|
534953
535185
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
534954
535186
|
},
|
|
534955
|
-
stopReason
|
|
535187
|
+
stopReason,
|
|
534956
535188
|
errorMessage: error instanceof Error ? error.message : String(error),
|
|
534957
535189
|
timestamp: timestamp3
|
|
534958
535190
|
};
|
|
@@ -534975,7 +535207,7 @@ async function forwardStream(target2, source17, observer, observeResult) {
|
|
|
534975
535207
|
target2.end(result22);
|
|
534976
535208
|
observeResult(result22);
|
|
534977
535209
|
}
|
|
534978
|
-
function lazyStream(model, setup, observer) {
|
|
535210
|
+
function lazyStream(model, setup, observer, signal2) {
|
|
534979
535211
|
const startedAt = Date.now();
|
|
534980
535212
|
const outer = new AssistantMessageEventStream;
|
|
534981
535213
|
let observedResult = false;
|
|
@@ -534986,8 +535218,9 @@ function lazyStream(model, setup, observer) {
|
|
|
534986
535218
|
observer?.onResult?.(result22);
|
|
534987
535219
|
};
|
|
534988
535220
|
setup().then((inner) => forwardStream(outer, inner, observer, observeResult)).catch((error) => {
|
|
534989
|
-
const
|
|
534990
|
-
const
|
|
535221
|
+
const reason3 = signal2?.aborted ? "aborted" : "error";
|
|
535222
|
+
const message = createSetupErrorMessage(model, error, startedAt, reason3);
|
|
535223
|
+
const event = { type: "error", reason: reason3, error: message };
|
|
534991
535224
|
outer.push(event);
|
|
534992
535225
|
observer?.onEvent?.(event);
|
|
534993
535226
|
outer.end(message);
|
|
@@ -535707,10 +535940,10 @@ class ModelsImpl {
|
|
|
535707
535940
|
throw credentialError;
|
|
535708
535941
|
if (!allowNetwork || signal2.aborted)
|
|
535709
535942
|
return;
|
|
535710
|
-
const
|
|
535711
|
-
if (!
|
|
535943
|
+
const network = await this.resolveNetworkRefresh(provider310, storedCredential, signal2);
|
|
535944
|
+
if (!network)
|
|
535712
535945
|
return;
|
|
535713
|
-
await this.runProviderRefreshPhase(provider310, credential, true, options.force, generation, signal2);
|
|
535946
|
+
await this.runProviderRefreshPhase(provider310, network.credential, true, options.force, generation, signal2);
|
|
535714
535947
|
})();
|
|
535715
535948
|
try {
|
|
535716
535949
|
await raceWithAbortSignal(operation4, signal2);
|
|
@@ -535732,6 +535965,13 @@ class ModelsImpl {
|
|
|
535732
535965
|
}
|
|
535733
535966
|
return { aborted: callerSignal.aborted, errors: new Map(errors) };
|
|
535734
535967
|
}
|
|
535968
|
+
async resolveNetworkRefresh(provider310, stored3, signal2) {
|
|
535969
|
+
if (provider310.refreshModelsAuth === "configured") {
|
|
535970
|
+
return await this.checkProviderAuth(provider310, stored3, signal2) ? {} : undefined;
|
|
535971
|
+
}
|
|
535972
|
+
const credential = await this.resolveRefreshCredential(provider310, stored3, signal2);
|
|
535973
|
+
return credential ? { credential } : undefined;
|
|
535974
|
+
}
|
|
535735
535975
|
async resolveRefreshCredential(provider310, stored3, signal2) {
|
|
535736
535976
|
if (stored3?.type === "oauth") {
|
|
535737
535977
|
const oauth = provider310.auth.oauth;
|
|
@@ -535950,7 +536190,7 @@ class ModelsImpl {
|
|
|
535950
536190
|
const provider310 = this.requireChatProvider(model2);
|
|
535951
536191
|
const { requestModel, requestOptions } = await this.applyAuth(model2, options);
|
|
535952
536192
|
return provider310.stream(requestModel, transcript, requestOptions);
|
|
535953
|
-
}, observeModelRequest(model2, options, false));
|
|
536193
|
+
}, observeModelRequest(model2, options, false), options?.signal);
|
|
535954
536194
|
}
|
|
535955
536195
|
async complete(model2, context11, options) {
|
|
535956
536196
|
return this.stream(model2, context11, options).result();
|
|
@@ -535961,7 +536201,7 @@ class ModelsImpl {
|
|
|
535961
536201
|
const provider310 = this.requireChatProvider(model2);
|
|
535962
536202
|
const { requestModel, requestOptions } = await this.applyAuth(model2, options);
|
|
535963
536203
|
return provider310.streamSimple(requestModel, transcript, requestOptions);
|
|
535964
|
-
}, observeModelRequest(model2, options, false));
|
|
536204
|
+
}, observeModelRequest(model2, options, false), options?.signal);
|
|
535965
536205
|
}
|
|
535966
536206
|
async completeSimple(model2, context11, options) {
|
|
535967
536207
|
return this.streamSimple(model2, context11, options).result();
|
|
@@ -535974,7 +536214,7 @@ class ModelsImpl {
|
|
|
535974
536214
|
}
|
|
535975
536215
|
const { requestModel, requestOptions } = await this.applyAuth(model2, options);
|
|
535976
536216
|
return provider310.fetchDeferred(requestModel, handle, requestOptions);
|
|
535977
|
-
}, observeModelRequest(model2, options, true));
|
|
536217
|
+
}, observeModelRequest(model2, options, true), options?.signal);
|
|
535978
536218
|
}
|
|
535979
536219
|
async fetchDeferred(model2, handle, options) {
|
|
535980
536220
|
return this.streamDeferred(model2, handle, options).result();
|
|
@@ -536044,12 +536284,12 @@ function createProvider(input24) {
|
|
|
536044
536284
|
return merged;
|
|
536045
536285
|
};
|
|
536046
536286
|
const apiFor = (model2) => single ?? byApi?.[model2.api];
|
|
536047
|
-
const dispatch = (model2, run311) => {
|
|
536287
|
+
const dispatch = (model2, run311, signal2) => {
|
|
536048
536288
|
const streams2 = apiFor(model2);
|
|
536049
536289
|
if (!streams2) {
|
|
536050
536290
|
return lazyStream(model2, async () => {
|
|
536051
536291
|
throw new ModelsError("stream", `Provider ${input24.id} has no API implementation for "${model2.api}"`);
|
|
536052
|
-
});
|
|
536292
|
+
}, undefined, signal2);
|
|
536053
536293
|
}
|
|
536054
536294
|
return run311(streams2);
|
|
536055
536295
|
};
|
|
@@ -536087,8 +536327,8 @@ function createProvider(input24) {
|
|
|
536087
536327
|
} : undefined,
|
|
536088
536328
|
filterModels: input24.filterModels,
|
|
536089
536329
|
filterAllModels: input24.filterAllModels,
|
|
536090
|
-
stream: (model2, context11, options) => dispatch(model2, (streams2) => streams2.stream(model2, context11, options)),
|
|
536091
|
-
streamSimple: (model2, context11, options) => dispatch(model2, (streams2) => streams2.streamSimple(model2, context11, options))
|
|
536330
|
+
stream: (model2, context11, options) => dispatch(model2, (streams2) => streams2.stream(model2, context11, options), options?.signal),
|
|
536331
|
+
streamSimple: (model2, context11, options) => dispatch(model2, (streams2) => streams2.streamSimple(model2, context11, options), options?.signal)
|
|
536092
536332
|
};
|
|
536093
536333
|
if (streams.some((entry22) => entry22.fetchDeferred !== undefined)) {
|
|
536094
536334
|
provider310.fetchDeferred = (model2, handle, options) => lazyStream(model2, async () => {
|
|
@@ -536097,7 +536337,7 @@ function createProvider(input24) {
|
|
|
536097
536337
|
throw new ModelsError("provider", `Provider ${input24.id} does not support deferred responses for "${model2.api}"`);
|
|
536098
536338
|
}
|
|
536099
536339
|
return implementation.fetchDeferred(model2, handle, options);
|
|
536100
|
-
});
|
|
536340
|
+
}, undefined, options?.signal);
|
|
536101
536341
|
}
|
|
536102
536342
|
if (streams.some((entry22) => entry22.cancelDeferred !== undefined)) {
|
|
536103
536343
|
provider310.cancelDeferred = async (model2, handle, options) => {
|
|
@@ -537941,10 +538181,12 @@ class JsonlStorage {
|
|
|
537941
538181
|
directory;
|
|
537942
538182
|
mainPath;
|
|
537943
538183
|
fsync;
|
|
538184
|
+
readOnly;
|
|
537944
538185
|
memory = new MemoryStorage;
|
|
537945
538186
|
currentOnlyDocuments = new Set;
|
|
537946
538187
|
liveTaskSidecars = new Set;
|
|
537947
538188
|
closed = false;
|
|
538189
|
+
mainSize = 0;
|
|
537948
538190
|
poisonError;
|
|
537949
538191
|
writing;
|
|
537950
538192
|
constructor(fs, directory2, mainPath, options) {
|
|
@@ -537952,23 +538194,36 @@ class JsonlStorage {
|
|
|
537952
538194
|
this.directory = directory2;
|
|
537953
538195
|
this.mainPath = mainPath;
|
|
537954
538196
|
this.fsync = options.fsync ?? false;
|
|
538197
|
+
this.readOnly = options.readOnly ?? false;
|
|
537955
538198
|
}
|
|
537956
538199
|
static async open(directory2, fs, context11, options = {}) {
|
|
537957
538200
|
const absolute4 = await fs.absolutePath(directory2, context11);
|
|
537958
538201
|
if (!absolute4.ok)
|
|
537959
538202
|
throw errorFromFile("path resolution", absolute4.error);
|
|
537960
|
-
|
|
537961
|
-
|
|
537962
|
-
|
|
538203
|
+
if (options.readOnly !== true) {
|
|
538204
|
+
const created = await fs.createDir(absolute4.value, { recursive: true }, context11);
|
|
538205
|
+
if (!created.ok)
|
|
538206
|
+
throw errorFromFile("directory creation", created.error);
|
|
538207
|
+
}
|
|
537963
538208
|
const mainPathResult = await fs.joinPath([absolute4.value, MAIN_FILE], context11);
|
|
537964
538209
|
if (!mainPathResult.ok)
|
|
537965
538210
|
throw errorFromFile("path join", mainPathResult.error);
|
|
537966
|
-
|
|
537967
|
-
|
|
537968
|
-
|
|
538211
|
+
for (let attempt24 = 1;; attempt24++) {
|
|
538212
|
+
const storage = new JsonlStorage(fs, absolute4.value, mainPathResult.value, options);
|
|
538213
|
+
try {
|
|
538214
|
+
await storage.recover(context11);
|
|
538215
|
+
return storage;
|
|
538216
|
+
} catch (error) {
|
|
538217
|
+
if (!storage.readOnly || attempt24 === READ_ONLY_OPEN_ATTEMPTS || !(error instanceof JsonlCorruptionError) || !await storage.mainChanged(context11)) {
|
|
538218
|
+
throw error;
|
|
538219
|
+
}
|
|
538220
|
+
}
|
|
538221
|
+
}
|
|
537969
538222
|
}
|
|
537970
538223
|
async commit(batches, receive, context11) {
|
|
537971
538224
|
this.assertUsable();
|
|
538225
|
+
if (this.readOnly)
|
|
538226
|
+
throw new JsonlStorageReadOnlyError;
|
|
537972
538227
|
const seqs = [];
|
|
537973
538228
|
const encoded = [];
|
|
537974
538229
|
const reclamations = new Map;
|
|
@@ -538249,7 +538504,8 @@ class JsonlStorage {
|
|
|
538249
538504
|
const fs = this.fs;
|
|
538250
538505
|
const directory2 = this.directory;
|
|
538251
538506
|
const memory = this.memory;
|
|
538252
|
-
const main = await
|
|
538507
|
+
const main = await this.readLines(this.mainPath, MAIN_FILE, context11, (text36, line) => parseMainMarker(text36, line));
|
|
538508
|
+
this.mainSize = main.size;
|
|
538253
538509
|
let previousSeq = 0;
|
|
538254
538510
|
for (const marker of main.lines) {
|
|
538255
538511
|
if (marker.value.seq <= previousSeq) {
|
|
@@ -538261,7 +538517,7 @@ class JsonlStorage {
|
|
|
538261
538517
|
if (!listed.ok)
|
|
538262
538518
|
throw errorFromFile("directory listing", listed.error);
|
|
538263
538519
|
for (const info of listed.value) {
|
|
538264
|
-
if (info.kind === "file" && isReclaimFileName(info.name)) {
|
|
538520
|
+
if (!this.readOnly && info.kind === "file" && isReclaimFileName(info.name)) {
|
|
538265
538521
|
await fs.remove(info.path, { force: true }, context11);
|
|
538266
538522
|
}
|
|
538267
538523
|
}
|
|
@@ -538272,7 +538528,7 @@ class JsonlStorage {
|
|
|
538272
538528
|
const pathResult = await fs.joinPath([directory2, file2], context11);
|
|
538273
538529
|
if (!pathResult.ok)
|
|
538274
538530
|
throw errorFromFile("path join", pathResult.error);
|
|
538275
|
-
const parsed = await
|
|
538531
|
+
const parsed = await this.readLines(pathResult.value, file2, context11, (text36, line) => parseSidecarRecord(text36, file2, line));
|
|
538276
538532
|
parsedFiles.set(file2, parsed);
|
|
538277
538533
|
let previous;
|
|
538278
538534
|
for (const line of parsed.lines) {
|
|
@@ -538396,7 +538652,7 @@ class JsonlStorage {
|
|
|
538396
538652
|
unconfirmedAt = line.start;
|
|
538397
538653
|
}
|
|
538398
538654
|
}
|
|
538399
|
-
if (unconfirmedAt !== undefined) {
|
|
538655
|
+
if (unconfirmedAt !== undefined && !this.readOnly) {
|
|
538400
538656
|
const truncated22 = await fs.truncateFile(parsed.path, unconfirmedAt, context11);
|
|
538401
538657
|
if (!truncated22.ok)
|
|
538402
538658
|
throw errorFromFile(`tail truncation of ${file2}`, truncated22.error);
|
|
@@ -538418,7 +538674,8 @@ class JsonlStorage {
|
|
|
538418
538674
|
reclamations.set(file2, retainedLines.map((line) => jsonLine(line.value)).join(""));
|
|
538419
538675
|
}
|
|
538420
538676
|
}
|
|
538421
|
-
|
|
538677
|
+
if (!this.readOnly)
|
|
538678
|
+
await this.reclaimSidecars(reclamations, context11);
|
|
538422
538679
|
for (const id24 of currentOnlyDocuments)
|
|
538423
538680
|
this.currentOnlyDocuments.add(id24);
|
|
538424
538681
|
for (const [id24, live] of finalTaskIsLive) {
|
|
@@ -538439,20 +538696,22 @@ class JsonlStorage {
|
|
|
538439
538696
|
confirmed.add(key211);
|
|
538440
538697
|
return line.value;
|
|
538441
538698
|
}
|
|
538442
|
-
|
|
538443
|
-
const read211 = await fs.readBinaryFile(path31, context11);
|
|
538699
|
+
async readLines(path31, name211, context11, parse311) {
|
|
538700
|
+
const read211 = await this.fs.readBinaryFile(path31, context11);
|
|
538444
538701
|
if (!read211.ok) {
|
|
538445
538702
|
if (read211.error.code === "not_found")
|
|
538446
|
-
return { path: path31, lines: [] };
|
|
538703
|
+
return { path: path31, lines: [], size: 0 };
|
|
538447
538704
|
throw errorFromFile(`read of ${name211}`, read211.error);
|
|
538448
538705
|
}
|
|
538449
538706
|
const bytes2 = read211.value;
|
|
538450
538707
|
let completeSize = bytes2.length;
|
|
538451
538708
|
if (completeSize > 0 && bytes2[completeSize - 1] !== 10) {
|
|
538452
538709
|
completeSize = bytes2.lastIndexOf(10) + 1;
|
|
538453
|
-
|
|
538454
|
-
|
|
538455
|
-
|
|
538710
|
+
if (!this.readOnly) {
|
|
538711
|
+
const truncated22 = await this.fs.truncateFile(path31, completeSize, context11);
|
|
538712
|
+
if (!truncated22.ok)
|
|
538713
|
+
throw errorFromFile(`torn-line truncation of ${name211}`, truncated22.error);
|
|
538714
|
+
}
|
|
538456
538715
|
}
|
|
538457
538716
|
const lines2 = [];
|
|
538458
538717
|
let start8 = 0;
|
|
@@ -538470,7 +538729,11 @@ class JsonlStorage {
|
|
|
538470
538729
|
start8 = end8 + 1;
|
|
538471
538730
|
lineNumber++;
|
|
538472
538731
|
}
|
|
538473
|
-
return { path: path31, lines: lines2 };
|
|
538732
|
+
return { path: path31, lines: lines2, size: bytes2.length };
|
|
538733
|
+
}
|
|
538734
|
+
async mainChanged(context11) {
|
|
538735
|
+
const info = await this.fs.fileInfo(this.mainPath, context11);
|
|
538736
|
+
return info.ok && info.value.size !== this.mainSize;
|
|
538474
538737
|
}
|
|
538475
538738
|
async resolveFile(file2, context11) {
|
|
538476
538739
|
const path31 = await this.fs.joinPath([this.directory, file2], context11);
|
|
@@ -538501,8 +538764,10 @@ class JsonlStorage {
|
|
|
538501
538764
|
var FORMAT_VERSION = 1;
|
|
538502
538765
|
var MAIN_FILE = "main.jsonl";
|
|
538503
538766
|
var RECLAIM_SUFFIX = ".reclaim";
|
|
538767
|
+
var READ_ONLY_OPEN_ATTEMPTS = 5;
|
|
538504
538768
|
var textDecoder2;
|
|
538505
538769
|
var JsonlCorruptionError;
|
|
538770
|
+
var JsonlStorageReadOnlyError;
|
|
538506
538771
|
var JsonlStoragePoisonedError;
|
|
538507
538772
|
var isObject310 = (value27) => value27 !== null && typeof value27 === "object" && !Array.isArray(value27);
|
|
538508
538773
|
var isSafeInteger = (value27) => Number.isSafeInteger(value27);
|
|
@@ -538614,6 +538879,12 @@ var init_storage = __esm(() => {
|
|
|
538614
538879
|
this.name = "JsonlCorruptionError";
|
|
538615
538880
|
}
|
|
538616
538881
|
};
|
|
538882
|
+
JsonlStorageReadOnlyError = class JsonlStorageReadOnlyError2 extends Error {
|
|
538883
|
+
constructor() {
|
|
538884
|
+
super("JSONL storage is open read-only");
|
|
538885
|
+
this.name = "JsonlStorageReadOnlyError";
|
|
538886
|
+
}
|
|
538887
|
+
};
|
|
538617
538888
|
JsonlStoragePoisonedError = class JsonlStoragePoisonedError2 extends Error {
|
|
538618
538889
|
constructor(cause) {
|
|
538619
538890
|
super("JSONL storage is poisoned and must be reopened", { cause });
|
|
@@ -538624,6 +538895,7 @@ var init_storage = __esm(() => {
|
|
|
538624
538895
|
var exports_node = {};
|
|
538625
538896
|
__export(exports_node, {
|
|
538626
538897
|
openNodeJsonlStorage: () => openNodeJsonlStorage,
|
|
538898
|
+
JsonlStorageReadOnlyError: () => JsonlStorageReadOnlyError,
|
|
538627
538899
|
JsonlStorage: () => JsonlStorage
|
|
538628
538900
|
});
|
|
538629
538901
|
async function openNodeJsonlStorage(directory2, context11, options = {}) {
|
|
@@ -544456,7 +544728,7 @@ function new_runtime(path31, invoke, savePlan, schedulePlan, cyclePlan, project2
|
|
|
544456
544728
|
{ createModels: createModels2 },
|
|
544457
544729
|
{ openNodeJsonlStorage: openNodeJsonlStorage2 }
|
|
544458
544730
|
] = await Promise.all([
|
|
544459
|
-
Promise.resolve().then(() => (
|
|
544731
|
+
Promise.resolve().then(() => (init_dist3(), exports_dist)),
|
|
544460
544732
|
Promise.resolve().then(() => (init_context(), exports_context3)),
|
|
544461
544733
|
Promise.resolve().then(() => (init_models(), exports_models)),
|
|
544462
544734
|
Promise.resolve().then(() => (init_node2(), exports_node))
|
|
@@ -594259,13 +594531,13 @@ function source_json38(source17) {
|
|
|
594259
594531
|
int3109(source17.retrieved_at_unix_ms)
|
|
594260
594532
|
], prepend109(["entitlement", string3109(source17.entitlement)], prepend109(["licence", string3109(source17.licence)], prepend109(["coverage", string3109(source17.coverage)], prepend109(["correctionState", string3109(source17.correction_state)], prepend109(["receipt", string3109(source17.receipt)], List$Empty$const109)))))))))));
|
|
594261
594533
|
}
|
|
594262
|
-
function calculation_json(formula, value29, unit6,
|
|
594534
|
+
function calculation_json(formula, value29, unit6, leaves2) {
|
|
594263
594535
|
if (value29 instanceof Ok109) {
|
|
594264
594536
|
let decimal_value2 = value29[0];
|
|
594265
|
-
return object2109(prepend109(["state", string3109("calculated")], prepend109(["formula", string3109(formula)], prepend109(["value", string3109(to_string271(decimal_value2))], prepend109(["unit", string3109(unit6)], prepend109(["leaves", object2109(
|
|
594537
|
+
return object2109(prepend109(["state", string3109("calculated")], prepend109(["formula", string3109(formula)], prepend109(["value", string3109(to_string271(decimal_value2))], prepend109(["unit", string3109(unit6)], prepend109(["leaves", object2109(leaves2)], prepend109(["rounding", string3109("half_even")], List$Empty$const109)))))));
|
|
594266
594538
|
} else {
|
|
594267
594539
|
let error = value29[0];
|
|
594268
|
-
return object2109(prepend109(["state", string3109("unperformed")], prepend109(["formula", string3109(formula)], prepend109(["reason", string3109(error_message102(error))], prepend109(["unit", string3109(unit6)], prepend109(["leaves", object2109(
|
|
594540
|
+
return object2109(prepend109(["state", string3109("unperformed")], prepend109(["formula", string3109(formula)], prepend109(["reason", string3109(error_message102(error))], prepend109(["unit", string3109(unit6)], prepend109(["leaves", object2109(leaves2)], List$Empty$const109))))));
|
|
594269
594541
|
}
|
|
594270
594542
|
}
|
|
594271
594543
|
function percentage22(numerator, denominator2, scale3) {
|
|
@@ -598052,13 +598324,13 @@ function source_json39(source17) {
|
|
|
598052
598324
|
int3110(source17.retrieved_at_unix_ms)
|
|
598053
598325
|
], prepend110(["entitlement", string3110(source17.entitlement)], prepend110(["licence", string3110(source17.licence)], prepend110(["coverage", string3110(source17.coverage)], prepend110(["correctionState", string3110(source17.correction_state)], prepend110(["receipt", string3110(source17.receipt)], List$Empty$const110)))))))))));
|
|
598054
598326
|
}
|
|
598055
|
-
function calculation_json2(formula, value29, unit6,
|
|
598327
|
+
function calculation_json2(formula, value29, unit6, leaves2) {
|
|
598056
598328
|
if (value29 instanceof Ok110) {
|
|
598057
598329
|
let decimal_value2 = value29[0];
|
|
598058
|
-
return object2110(prepend110(["state", string3110("calculated")], prepend110(["formula", string3110(formula)], prepend110(["value", string3110(to_string272(decimal_value2))], prepend110(["unit", string3110(unit6)], prepend110(["leaves", object2110(
|
|
598330
|
+
return object2110(prepend110(["state", string3110("calculated")], prepend110(["formula", string3110(formula)], prepend110(["value", string3110(to_string272(decimal_value2))], prepend110(["unit", string3110(unit6)], prepend110(["leaves", object2110(leaves2)], prepend110(["rounding", string3110("half_even")], List$Empty$const110)))))));
|
|
598059
598331
|
} else {
|
|
598060
598332
|
let error = value29[0];
|
|
598061
|
-
return object2110(prepend110(["state", string3110("unperformed")], prepend110(["formula", string3110(formula)], prepend110(["reason", string3110(error_message103(error))], prepend110(["unit", string3110(unit6)], prepend110(["leaves", object2110(
|
|
598333
|
+
return object2110(prepend110(["state", string3110("unperformed")], prepend110(["formula", string3110(formula)], prepend110(["reason", string3110(error_message103(error))], prepend110(["unit", string3110(unit6)], prepend110(["leaves", object2110(leaves2)], List$Empty$const110))))));
|
|
598062
598334
|
}
|
|
598063
598335
|
}
|
|
598064
598336
|
function ratio24(numerator, denominator2, scale3) {
|
|
@@ -601826,13 +602098,13 @@ function source_json40(source17) {
|
|
|
601826
602098
|
int3111(source17.retrieved_at_unix_ms)
|
|
601827
602099
|
], prepend111(["entitlement", string3111(source17.entitlement)], prepend111(["licence", string3111(source17.licence)], prepend111(["coverage", string3111(source17.coverage)], prepend111(["correctionState", string3111(source17.correction_state)], prepend111(["receipt", string3111(source17.receipt)], List$Empty$const111)))))))))));
|
|
601828
602100
|
}
|
|
601829
|
-
function calculation_json3(formula, value29, unit6,
|
|
602101
|
+
function calculation_json3(formula, value29, unit6, leaves2) {
|
|
601830
602102
|
if (value29 instanceof Ok111) {
|
|
601831
602103
|
let decimal_value2 = value29[0];
|
|
601832
|
-
return object2111(prepend111(["state", string3111("calculated")], prepend111(["formula", string3111(formula)], prepend111(["value", string3111(to_string273(decimal_value2))], prepend111(["unit", string3111(unit6)], prepend111(["leaves", object2111(
|
|
602104
|
+
return object2111(prepend111(["state", string3111("calculated")], prepend111(["formula", string3111(formula)], prepend111(["value", string3111(to_string273(decimal_value2))], prepend111(["unit", string3111(unit6)], prepend111(["leaves", object2111(leaves2)], prepend111(["rounding", string3111("half_even")], List$Empty$const111)))))));
|
|
601833
602105
|
} else {
|
|
601834
602106
|
let error = value29[0];
|
|
601835
|
-
return object2111(prepend111(["state", string3111("unperformed")], prepend111(["formula", string3111(formula)], prepend111(["reason", string3111(error_message104(error))], prepend111(["unit", string3111(unit6)], prepend111(["leaves", object2111(
|
|
602107
|
+
return object2111(prepend111(["state", string3111("unperformed")], prepend111(["formula", string3111(formula)], prepend111(["reason", string3111(error_message104(error))], prepend111(["unit", string3111(unit6)], prepend111(["leaves", object2111(leaves2)], List$Empty$const111))))));
|
|
601836
602108
|
}
|
|
601837
602109
|
}
|
|
601838
602110
|
function percentage24(numerator, denominator2, scale3) {
|
|
@@ -605630,13 +605902,13 @@ function source_json41(source17) {
|
|
|
605630
605902
|
int3112(source17.retrieved_at_unix_ms)
|
|
605631
605903
|
], prepend112(["entitlement", string3112(source17.entitlement)], prepend112(["licence", string3112(source17.licence)], prepend112(["coverage", string3112(source17.coverage)], prepend112(["correctionState", string3112(source17.correction_state)], prepend112(["receipt", string3112(source17.receipt)], List$Empty$const112)))))))))));
|
|
605632
605904
|
}
|
|
605633
|
-
function calculation_json4(formula, value29, unit6,
|
|
605905
|
+
function calculation_json4(formula, value29, unit6, leaves2) {
|
|
605634
605906
|
if (value29 instanceof Ok112) {
|
|
605635
605907
|
let decimal_value2 = value29[0];
|
|
605636
|
-
return object2112(prepend112(["state", string3112("calculated")], prepend112(["formula", string3112(formula)], prepend112(["value", string3112(to_string274(decimal_value2))], prepend112(["unit", string3112(unit6)], prepend112(["leaves", object2112(
|
|
605908
|
+
return object2112(prepend112(["state", string3112("calculated")], prepend112(["formula", string3112(formula)], prepend112(["value", string3112(to_string274(decimal_value2))], prepend112(["unit", string3112(unit6)], prepend112(["leaves", object2112(leaves2)], prepend112(["rounding", string3112("half_even")], List$Empty$const112)))))));
|
|
605637
605909
|
} else {
|
|
605638
605910
|
let error = value29[0];
|
|
605639
|
-
return object2112(prepend112(["state", string3112("unperformed")], prepend112(["formula", string3112(formula)], prepend112(["reason", string3112(error_message105(error))], prepend112(["unit", string3112(unit6)], prepend112(["leaves", object2112(
|
|
605911
|
+
return object2112(prepend112(["state", string3112("unperformed")], prepend112(["formula", string3112(formula)], prepend112(["reason", string3112(error_message105(error))], prepend112(["unit", string3112(unit6)], prepend112(["leaves", object2112(leaves2)], List$Empty$const112))))));
|
|
605640
605912
|
}
|
|
605641
605913
|
}
|
|
605642
605914
|
function percentage25(numerator, denominator2, scale3) {
|
|
@@ -609282,13 +609554,13 @@ function source_json42(source17) {
|
|
|
609282
609554
|
int3113(source17.retrieved_at_unix_ms)
|
|
609283
609555
|
], prepend113(["entitlement", string3113(source17.entitlement)], prepend113(["licence", string3113(source17.licence)], prepend113(["coverage", string3113(source17.coverage)], prepend113(["correctionState", string3113(source17.correction_state)], prepend113(["receipt", string3113(source17.receipt)], List$Empty$const113)))))))))));
|
|
609284
609556
|
}
|
|
609285
|
-
function calculation_json5(formula, value29, unit6,
|
|
609557
|
+
function calculation_json5(formula, value29, unit6, leaves2) {
|
|
609286
609558
|
if (value29 instanceof Ok113) {
|
|
609287
609559
|
let decimal_value2 = value29[0];
|
|
609288
|
-
return object2113(prepend113(["state", string3113("calculated")], prepend113(["formula", string3113(formula)], prepend113(["value", string3113(to_string275(decimal_value2))], prepend113(["unit", string3113(unit6)], prepend113(["leaves", object2113(
|
|
609560
|
+
return object2113(prepend113(["state", string3113("calculated")], prepend113(["formula", string3113(formula)], prepend113(["value", string3113(to_string275(decimal_value2))], prepend113(["unit", string3113(unit6)], prepend113(["leaves", object2113(leaves2)], prepend113(["rounding", string3113("half_even")], List$Empty$const113)))))));
|
|
609289
609561
|
} else {
|
|
609290
609562
|
let error = value29[0];
|
|
609291
|
-
return object2113(prepend113(["state", string3113("unperformed")], prepend113(["formula", string3113(formula)], prepend113(["reason", string3113(error_message106(error))], prepend113(["unit", string3113(unit6)], prepend113(["leaves", object2113(
|
|
609563
|
+
return object2113(prepend113(["state", string3113("unperformed")], prepend113(["formula", string3113(formula)], prepend113(["reason", string3113(error_message106(error))], prepend113(["unit", string3113(unit6)], prepend113(["leaves", object2113(leaves2)], List$Empty$const113))))));
|
|
609292
609564
|
}
|
|
609293
609565
|
}
|
|
609294
609566
|
function percentage26(numerator, denominator2, scale3) {
|
|
@@ -620125,8 +620397,8 @@ function run229(plan24, capture10) {
|
|
|
620125
620397
|
return map_error112(_pipe$1, (_) => {
|
|
620126
620398
|
return Error$InvalidObservationDate$const;
|
|
620127
620399
|
});
|
|
620128
|
-
})(), (
|
|
620129
|
-
return new Ok115(new Observation13(point,
|
|
620400
|
+
})(), (anchor2) => {
|
|
620401
|
+
return new Ok115(new Observation13(point, anchor2, capture10.retrieved_at, Option$None$const115, source_ref3, new Some115(sha256_value98(capture10.observations_receipt.content_sha256)), Freshness$UnknownFreshness$const47, Entitlement$UnknownEntitlement$const47, (() => {
|
|
620130
620402
|
let $ = point.raw_value;
|
|
620131
620403
|
if ($ === ".") {
|
|
620132
620404
|
return new Missing78(MissingReason$NotReported$const48);
|
|
@@ -624018,13 +624290,13 @@ function option_string_json7(value30) {
|
|
|
624018
624290
|
function fact_json12(fact2) {
|
|
624019
624291
|
return object2116(prepend116(["state", string3116(fact2.state)], prepend116(["raw", option_string_json7(fact2.raw)], prepend116(["unit", string3116(fact2.unit)], prepend116(["observedAtUnixMilliseconds", int3116(fact2.observed_at_unix_ms)], prepend116(["reason", option_string_json7(fact2.reason)], prepend116(["alternatives", array2116(fact2.alternatives, string3116)], prepend116(["receipts", array2116(fact2.receipts, string3116)], List$Empty$const116))))))));
|
|
624020
624292
|
}
|
|
624021
|
-
function calculation_json6(formula, value30, unit6,
|
|
624293
|
+
function calculation_json6(formula, value30, unit6, leaves2) {
|
|
624022
624294
|
if (value30 instanceof Ok116) {
|
|
624023
624295
|
let decimal_value2 = value30[0];
|
|
624024
|
-
return object2116(prepend116(["state", string3116("calculated")], prepend116(["formula", string3116(formula)], prepend116(["value", string3116(to_string277(decimal_value2))], prepend116(["unit", string3116(unit6)], prepend116(["leaves", object2116(
|
|
624296
|
+
return object2116(prepend116(["state", string3116("calculated")], prepend116(["formula", string3116(formula)], prepend116(["value", string3116(to_string277(decimal_value2))], prepend116(["unit", string3116(unit6)], prepend116(["leaves", object2116(leaves2)], prepend116(["rounding", string3116("half_even")], List$Empty$const116)))))));
|
|
624025
624297
|
} else {
|
|
624026
624298
|
let error = value30[0];
|
|
624027
|
-
return object2116(prepend116(["state", string3116("unperformed")], prepend116(["formula", string3116(formula)], prepend116(["reason", string3116(error_message109(error))], prepend116(["unit", string3116(unit6)], prepend116(["leaves", object2116(
|
|
624299
|
+
return object2116(prepend116(["state", string3116("unperformed")], prepend116(["formula", string3116(formula)], prepend116(["reason", string3116(error_message109(error))], prepend116(["unit", string3116(unit6)], prepend116(["leaves", object2116(leaves2)], List$Empty$const116))))));
|
|
624028
624300
|
}
|
|
624029
624301
|
}
|
|
624030
624302
|
function percentage27(numerator, denominator2, scale3) {
|
|
@@ -630811,13 +631083,13 @@ function source_json46(source17) {
|
|
|
630811
631083
|
int3118(source17.retrieved_at_unix_ms)
|
|
630812
631084
|
], prepend118(["entitlement", string3118(source17.entitlement)], prepend118(["licence", string3118(source17.licence)], prepend118(["coverage", string3118(source17.coverage)], prepend118(["correctionState", string3118(source17.correction_state)], prepend118(["receipt", string3118(source17.receipt)], List$Empty$const118)))))))))));
|
|
630813
631085
|
}
|
|
630814
|
-
function calculation_json7(formula, value30, unit6,
|
|
631086
|
+
function calculation_json7(formula, value30, unit6, leaves2) {
|
|
630815
631087
|
if (value30 instanceof Ok118) {
|
|
630816
631088
|
let decimal_value2 = value30[0];
|
|
630817
|
-
return object2118(prepend118(["state", string3118("calculated")], prepend118(["formula", string3118(formula)], prepend118(["value", string3118(to_string278(decimal_value2))], prepend118(["unit", string3118(unit6)], prepend118(["leaves", object2118(
|
|
631089
|
+
return object2118(prepend118(["state", string3118("calculated")], prepend118(["formula", string3118(formula)], prepend118(["value", string3118(to_string278(decimal_value2))], prepend118(["unit", string3118(unit6)], prepend118(["leaves", object2118(leaves2)], prepend118(["rounding", string3118("half_even")], List$Empty$const118)))))));
|
|
630818
631090
|
} else {
|
|
630819
631091
|
let error = value30[0];
|
|
630820
|
-
return object2118(prepend118(["state", string3118("unperformed")], prepend118(["formula", string3118(formula)], prepend118(["reason", string3118(error_message111(error))], prepend118(["unit", string3118(unit6)], prepend118(["leaves", object2118(
|
|
631092
|
+
return object2118(prepend118(["state", string3118("unperformed")], prepend118(["formula", string3118(formula)], prepend118(["reason", string3118(error_message111(error))], prepend118(["unit", string3118(unit6)], prepend118(["leaves", object2118(leaves2)], List$Empty$const118))))));
|
|
630821
631093
|
}
|
|
630822
631094
|
}
|
|
630823
631095
|
function ratio210(numerator, denominator2, scale3) {
|
|
@@ -634540,13 +634812,13 @@ function source_json47(source17) {
|
|
|
634540
634812
|
int3119(source17.retrieved_at_unix_ms)
|
|
634541
634813
|
], prepend119(["entitlement", string3119(source17.entitlement)], prepend119(["licence", string3119(source17.licence)], prepend119(["coverage", string3119(source17.coverage)], prepend119(["correctionState", string3119(source17.correction_state)], prepend119(["receipt", string3119(source17.receipt)], List$Empty$const119)))))))))));
|
|
634542
634814
|
}
|
|
634543
|
-
function calculation_json8(formula, value30, unit6,
|
|
634815
|
+
function calculation_json8(formula, value30, unit6, leaves2) {
|
|
634544
634816
|
if (value30 instanceof Ok119) {
|
|
634545
634817
|
let decimal_value2 = value30[0];
|
|
634546
|
-
return object2119(prepend119(["state", string3119("calculated")], prepend119(["formula", string3119(formula)], prepend119(["value", string3119(to_string279(decimal_value2))], prepend119(["unit", string3119(unit6)], prepend119(["leaves", object2119(
|
|
634818
|
+
return object2119(prepend119(["state", string3119("calculated")], prepend119(["formula", string3119(formula)], prepend119(["value", string3119(to_string279(decimal_value2))], prepend119(["unit", string3119(unit6)], prepend119(["leaves", object2119(leaves2)], prepend119(["rounding", string3119("half_even")], List$Empty$const119)))))));
|
|
634547
634819
|
} else {
|
|
634548
634820
|
let error = value30[0];
|
|
634549
|
-
return object2119(prepend119(["state", string3119("unperformed")], prepend119(["formula", string3119(formula)], prepend119(["reason", string3119(error_message112(error))], prepend119(["unit", string3119(unit6)], prepend119(["leaves", object2119(
|
|
634821
|
+
return object2119(prepend119(["state", string3119("unperformed")], prepend119(["formula", string3119(formula)], prepend119(["reason", string3119(error_message112(error))], prepend119(["unit", string3119(unit6)], prepend119(["leaves", object2119(leaves2)], List$Empty$const119))))));
|
|
634550
634822
|
}
|
|
634551
634823
|
}
|
|
634552
634824
|
function percentage28(numerator, denominator2, scale3) {
|
|
@@ -643119,13 +643391,13 @@ function source_json49(source17) {
|
|
|
643119
643391
|
int3121(source17.retrieved_at_unix_ms)
|
|
643120
643392
|
], prepend121(["entitlement", string3121(source17.entitlement)], prepend121(["licence", string3121(source17.licence)], prepend121(["coverage", string3121(source17.coverage)], prepend121(["correctionState", string3121(source17.correction_state)], prepend121(["receipt", string3121(source17.receipt)], List$Empty$const121)))))))))));
|
|
643121
643393
|
}
|
|
643122
|
-
function calculation_json9(formula, value30, unit6,
|
|
643394
|
+
function calculation_json9(formula, value30, unit6, leaves2) {
|
|
643123
643395
|
if (value30 instanceof Ok121) {
|
|
643124
643396
|
let decimal_value2 = value30[0];
|
|
643125
|
-
return object2121(prepend121(["state", string3121("calculated")], prepend121(["formula", string3121(formula)], prepend121(["value", string3121(to_string280(decimal_value2))], prepend121(["unit", string3121(unit6)], prepend121(["leaves", object2121(
|
|
643397
|
+
return object2121(prepend121(["state", string3121("calculated")], prepend121(["formula", string3121(formula)], prepend121(["value", string3121(to_string280(decimal_value2))], prepend121(["unit", string3121(unit6)], prepend121(["leaves", object2121(leaves2)], prepend121(["rounding", string3121("half_even")], List$Empty$const121)))))));
|
|
643126
643398
|
} else {
|
|
643127
643399
|
let error = value30[0];
|
|
643128
|
-
return object2121(prepend121(["state", string3121("unperformed")], prepend121(["formula", string3121(formula)], prepend121(["reason", string3121(error_message114(error))], prepend121(["unit", string3121(unit6)], prepend121(["leaves", object2121(
|
|
643400
|
+
return object2121(prepend121(["state", string3121("unperformed")], prepend121(["formula", string3121(formula)], prepend121(["reason", string3121(error_message114(error))], prepend121(["unit", string3121(unit6)], prepend121(["leaves", object2121(leaves2)], List$Empty$const121))))));
|
|
643129
643401
|
}
|
|
643130
643402
|
}
|
|
643131
643403
|
function percentage29(numerator, denominator2, scale3) {
|
|
@@ -646959,13 +647231,13 @@ function source_json50(source17) {
|
|
|
646959
647231
|
int3122(source17.retrieved_at_unix_ms)
|
|
646960
647232
|
], prepend122(["entitlement", string3122(source17.entitlement)], prepend122(["licence", string3122(source17.licence)], prepend122(["coverage", string3122(source17.coverage)], prepend122(["correctionState", string3122(source17.correction_state)], prepend122(["receipt", string3122(source17.receipt)], List$Empty$const122)))))))))));
|
|
646961
647233
|
}
|
|
646962
|
-
function calculation_json10(formula, value30, unit6,
|
|
647234
|
+
function calculation_json10(formula, value30, unit6, leaves2) {
|
|
646963
647235
|
if (value30 instanceof Ok122) {
|
|
646964
647236
|
let decimal_value2 = value30[0];
|
|
646965
|
-
return object2122(prepend122(["state", string3122("calculated")], prepend122(["formula", string3122(formula)], prepend122(["value", string3122(to_string281(decimal_value2))], prepend122(["unit", string3122(unit6)], prepend122(["leaves", object2122(
|
|
647237
|
+
return object2122(prepend122(["state", string3122("calculated")], prepend122(["formula", string3122(formula)], prepend122(["value", string3122(to_string281(decimal_value2))], prepend122(["unit", string3122(unit6)], prepend122(["leaves", object2122(leaves2)], prepend122(["rounding", string3122("half_even")], List$Empty$const122)))))));
|
|
646966
647238
|
} else {
|
|
646967
647239
|
let error = value30[0];
|
|
646968
|
-
return object2122(prepend122(["state", string3122("unperformed")], prepend122(["formula", string3122(formula)], prepend122(["reason", string3122(error_message115(error))], prepend122(["unit", string3122(unit6)], prepend122(["leaves", object2122(
|
|
647240
|
+
return object2122(prepend122(["state", string3122("unperformed")], prepend122(["formula", string3122(formula)], prepend122(["reason", string3122(error_message115(error))], prepend122(["unit", string3122(unit6)], prepend122(["leaves", object2122(leaves2)], List$Empty$const122))))));
|
|
646969
647241
|
}
|
|
646970
647242
|
}
|
|
646971
647243
|
function date75(field211, value30) {
|
|
@@ -650901,13 +651173,13 @@ function source_json51(source17) {
|
|
|
650901
651173
|
int3123(source17.retrieved_at_unix_ms)
|
|
650902
651174
|
], prepend123(["entitlement", string3123(source17.entitlement)], prepend123(["licence", string3123(source17.licence)], prepend123(["coverage", string3123(source17.coverage)], prepend123(["correctionState", string3123(source17.correction_state)], prepend123(["receipt", string3123(source17.receipt)], List$Empty$const123)))))))))));
|
|
650903
651175
|
}
|
|
650904
|
-
function calculation_json11(formula, value30, unit6,
|
|
651176
|
+
function calculation_json11(formula, value30, unit6, leaves2) {
|
|
650905
651177
|
if (value30 instanceof Ok123) {
|
|
650906
651178
|
let decimal_value2 = value30[0];
|
|
650907
|
-
return object2123(prepend123(["state", string3123("calculated")], prepend123(["formula", string3123(formula)], prepend123(["value", string3123(to_string282(decimal_value2))], prepend123(["unit", string3123(unit6)], prepend123(["leaves", object2123(
|
|
651179
|
+
return object2123(prepend123(["state", string3123("calculated")], prepend123(["formula", string3123(formula)], prepend123(["value", string3123(to_string282(decimal_value2))], prepend123(["unit", string3123(unit6)], prepend123(["leaves", object2123(leaves2)], prepend123(["rounding", string3123("half_even")], List$Empty$const123)))))));
|
|
650908
651180
|
} else {
|
|
650909
651181
|
let error = value30[0];
|
|
650910
|
-
return object2123(prepend123(["state", string3123("unperformed")], prepend123(["formula", string3123(formula)], prepend123(["reason", string3123(error_message116(error))], prepend123(["unit", string3123(unit6)], prepend123(["leaves", object2123(
|
|
651182
|
+
return object2123(prepend123(["state", string3123("unperformed")], prepend123(["formula", string3123(formula)], prepend123(["reason", string3123(error_message116(error))], prepend123(["unit", string3123(unit6)], prepend123(["leaves", object2123(leaves2)], List$Empty$const123))))));
|
|
650911
651183
|
}
|
|
650912
651184
|
}
|
|
650913
651185
|
function ratio212(numerator, denominator2, scale3) {
|
|
@@ -676379,7 +676651,7 @@ function details86(value30) {
|
|
|
676379
676651
|
return value30.details;
|
|
676380
676652
|
}
|
|
676381
676653
|
function require_unique_known_fact_names(input24, required_names12) {
|
|
676382
|
-
let
|
|
676654
|
+
let invalid2 = filter69(required_names12, (name30) => {
|
|
676383
676655
|
let matches2 = filter69(input24.facts, (fact2) => {
|
|
676384
676656
|
return fact2.name === name30;
|
|
676385
676657
|
});
|
|
@@ -676392,10 +676664,10 @@ function require_unique_known_fact_names(input24, required_names12) {
|
|
|
676392
676664
|
return true;
|
|
676393
676665
|
}
|
|
676394
676666
|
});
|
|
676395
|
-
if (
|
|
676667
|
+
if (invalid2 instanceof Empty146) {
|
|
676396
676668
|
return new Ok128(undefined);
|
|
676397
676669
|
} else {
|
|
676398
|
-
return new Error2128(new InvalidField59("facts", "requires exactly one known fact for: " + join66(
|
|
676670
|
+
return new Error2128(new InvalidField59("facts", "requires exactly one known fact for: " + join66(invalid2, ", ")));
|
|
676399
676671
|
}
|
|
676400
676672
|
}
|
|
676401
676673
|
function require_unique_known_fact(input24, name30, expected_value, expected_unit) {
|
|
@@ -680031,7 +680303,7 @@ function details87(value30) {
|
|
|
680031
680303
|
return value30.details;
|
|
680032
680304
|
}
|
|
680033
680305
|
function require_unique_known_fact_names2(input24, required_names12) {
|
|
680034
|
-
let
|
|
680306
|
+
let invalid2 = filter70(required_names12, (name30) => {
|
|
680035
680307
|
let matches2 = filter70(input24.facts, (fact2) => {
|
|
680036
680308
|
return fact2.name === name30;
|
|
680037
680309
|
});
|
|
@@ -680044,10 +680316,10 @@ function require_unique_known_fact_names2(input24, required_names12) {
|
|
|
680044
680316
|
return true;
|
|
680045
680317
|
}
|
|
680046
680318
|
});
|
|
680047
|
-
if (
|
|
680319
|
+
if (invalid2 instanceof Empty147) {
|
|
680048
680320
|
return new Ok129(undefined);
|
|
680049
680321
|
} else {
|
|
680050
|
-
return new Error2129(new InvalidField60("facts", "requires exactly one known fact for: " + join67(
|
|
680322
|
+
return new Error2129(new InvalidField60("facts", "requires exactly one known fact for: " + join67(invalid2, ", ")));
|
|
680051
680323
|
}
|
|
680052
680324
|
}
|
|
680053
680325
|
function require_unique_known_fact2(input24, name30, expected_value, expected_unit) {
|
|
@@ -686124,7 +686396,7 @@ function details88(value30) {
|
|
|
686124
686396
|
return value30.details;
|
|
686125
686397
|
}
|
|
686126
686398
|
function require_unique_known_fact_names3(input45, required_names12) {
|
|
686127
|
-
let
|
|
686399
|
+
let invalid2 = filter71(required_names12, (name30) => {
|
|
686128
686400
|
let matches2 = filter71(input45.facts, (fact2) => {
|
|
686129
686401
|
return fact2.name === name30;
|
|
686130
686402
|
});
|
|
@@ -686137,10 +686409,10 @@ function require_unique_known_fact_names3(input45, required_names12) {
|
|
|
686137
686409
|
return true;
|
|
686138
686410
|
}
|
|
686139
686411
|
});
|
|
686140
|
-
if (
|
|
686412
|
+
if (invalid2 instanceof Empty148) {
|
|
686141
686413
|
return new Ok130(undefined);
|
|
686142
686414
|
} else {
|
|
686143
|
-
return new Error2130(new InvalidField61("facts", "requires exactly one known fact for: " + join68(
|
|
686415
|
+
return new Error2130(new InvalidField61("facts", "requires exactly one known fact for: " + join68(invalid2, ", ")));
|
|
686144
686416
|
}
|
|
686145
686417
|
}
|
|
686146
686418
|
function require_unique_known_fact3(input45, name30, expected_value, expected_unit) {
|
|
@@ -689211,7 +689483,7 @@ function details89(value30) {
|
|
|
689211
689483
|
return value30.details;
|
|
689212
689484
|
}
|
|
689213
689485
|
function require_unique_known_fact_names4(input45, required_names12) {
|
|
689214
|
-
let
|
|
689486
|
+
let invalid2 = filter72(required_names12, (name30) => {
|
|
689215
689487
|
let matches2 = filter72(input45.facts, (fact2) => {
|
|
689216
689488
|
return fact2.name === name30;
|
|
689217
689489
|
});
|
|
@@ -689224,10 +689496,10 @@ function require_unique_known_fact_names4(input45, required_names12) {
|
|
|
689224
689496
|
return true;
|
|
689225
689497
|
}
|
|
689226
689498
|
});
|
|
689227
|
-
if (
|
|
689499
|
+
if (invalid2 instanceof Empty149) {
|
|
689228
689500
|
return new Ok131(undefined);
|
|
689229
689501
|
} else {
|
|
689230
|
-
return new Error2131(new InvalidField62("facts", "requires exactly one known fact for: " + join69(
|
|
689502
|
+
return new Error2131(new InvalidField62("facts", "requires exactly one known fact for: " + join69(invalid2, ", ")));
|
|
689231
689503
|
}
|
|
689232
689504
|
}
|
|
689233
689505
|
function require_unique_known_fact4(input45, name30, expected_value, expected_unit) {
|
|
@@ -692860,7 +693132,7 @@ function details90(value30) {
|
|
|
692860
693132
|
return value30.details;
|
|
692861
693133
|
}
|
|
692862
693134
|
function require_unique_known_fact_names5(input45, required_names12) {
|
|
692863
|
-
let
|
|
693135
|
+
let invalid2 = filter73(required_names12, (name30) => {
|
|
692864
693136
|
let matches2 = filter73(input45.facts, (fact2) => {
|
|
692865
693137
|
return fact2.name === name30;
|
|
692866
693138
|
});
|
|
@@ -692873,10 +693145,10 @@ function require_unique_known_fact_names5(input45, required_names12) {
|
|
|
692873
693145
|
return true;
|
|
692874
693146
|
}
|
|
692875
693147
|
});
|
|
692876
|
-
if (
|
|
693148
|
+
if (invalid2 instanceof Empty150) {
|
|
692877
693149
|
return new Ok132(undefined);
|
|
692878
693150
|
} else {
|
|
692879
|
-
return new Error2132(new InvalidField63("facts", "requires exactly one known fact for: " + join70(
|
|
693151
|
+
return new Error2132(new InvalidField63("facts", "requires exactly one known fact for: " + join70(invalid2, ", ")));
|
|
692880
693152
|
}
|
|
692881
693153
|
}
|
|
692882
693154
|
function require_unique_known_fact5(input45, name30, expected_value, expected_unit) {
|
|
@@ -699523,7 +699795,7 @@ function details91(value30) {
|
|
|
699523
699795
|
return value30.details;
|
|
699524
699796
|
}
|
|
699525
699797
|
function require_unique_known_fact_names6(input46, required_names12) {
|
|
699526
|
-
let
|
|
699798
|
+
let invalid2 = filter74(required_names12, (name30) => {
|
|
699527
699799
|
let matches2 = filter74(input46.facts, (fact2) => {
|
|
699528
699800
|
return fact2.name === name30;
|
|
699529
699801
|
});
|
|
@@ -699536,10 +699808,10 @@ function require_unique_known_fact_names6(input46, required_names12) {
|
|
|
699536
699808
|
return true;
|
|
699537
699809
|
}
|
|
699538
699810
|
});
|
|
699539
|
-
if (
|
|
699811
|
+
if (invalid2 instanceof Empty151) {
|
|
699540
699812
|
return new Ok133(undefined);
|
|
699541
699813
|
} else {
|
|
699542
|
-
return new Error2133(new InvalidField64("facts", "requires exactly one known fact for: " + join71(
|
|
699814
|
+
return new Error2133(new InvalidField64("facts", "requires exactly one known fact for: " + join71(invalid2, ", ")));
|
|
699543
699815
|
}
|
|
699544
699816
|
}
|
|
699545
699817
|
function require_unique_known_fact6(input46, name30, expected_value, expected_unit) {
|
|
@@ -705625,7 +705897,7 @@ function details92(value30) {
|
|
|
705625
705897
|
return value30.details;
|
|
705626
705898
|
}
|
|
705627
705899
|
function require_unique_known_fact_names7(input47, required_names12) {
|
|
705628
|
-
let
|
|
705900
|
+
let invalid2 = filter75(required_names12, (name30) => {
|
|
705629
705901
|
let matches2 = filter75(input47.facts, (fact2) => {
|
|
705630
705902
|
return fact2.name === name30;
|
|
705631
705903
|
});
|
|
@@ -705638,10 +705910,10 @@ function require_unique_known_fact_names7(input47, required_names12) {
|
|
|
705638
705910
|
return true;
|
|
705639
705911
|
}
|
|
705640
705912
|
});
|
|
705641
|
-
if (
|
|
705913
|
+
if (invalid2 instanceof Empty152) {
|
|
705642
705914
|
return new Ok134(undefined);
|
|
705643
705915
|
} else {
|
|
705644
|
-
return new Error2134(new InvalidField65("facts", "requires exactly one known fact for: " + join72(
|
|
705916
|
+
return new Error2134(new InvalidField65("facts", "requires exactly one known fact for: " + join72(invalid2, ", ")));
|
|
705645
705917
|
}
|
|
705646
705918
|
}
|
|
705647
705919
|
function require_unique_known_fact7(input47, name30, expected_value, expected_unit) {
|
|
@@ -710205,7 +710477,7 @@ function extension135(api) {
|
|
|
710205
710477
|
}
|
|
710206
710478
|
var trade_compliance_default = extension135;
|
|
710207
710479
|
|
|
710208
|
-
// .work/aggregate-adapters/t6-
|
|
710480
|
+
// .work/aggregate-adapters/t6-1346090-0372a083-ac5f-4223-b2c1-9b5ea2de0536.mjs
|
|
710209
710481
|
var extensions = [
|
|
710210
710482
|
["finance_setup", finance_setup_default],
|
|
710211
710483
|
["finance_track_status", finance_track_status_default],
|
|
@@ -710390,4 +710662,4 @@ export {
|
|
|
710390
710662
|
aggregateExtension as default
|
|
710391
710663
|
};
|
|
710392
710664
|
|
|
710393
|
-
//# debugId=
|
|
710665
|
+
//# debugId=930D159B9F55ECBB64756E2164756E21
|