@isaacthoman/pulpo 0.124.3 → 0.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +57 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14527,6 +14527,40 @@ function date4(params) {
|
|
|
14527
14527
|
// ../../node_modules/zod/v4/classic/external.js
|
|
14528
14528
|
config(en_default());
|
|
14529
14529
|
|
|
14530
|
+
// ../../packages/contracts/dist/response-timing.js
|
|
14531
|
+
function record2(value) {
|
|
14532
|
+
return value !== null && typeof value === "object" ? value : void 0;
|
|
14533
|
+
}
|
|
14534
|
+
function hasAssistantReplyText(output) {
|
|
14535
|
+
return Array.isArray(output) && output.some((raw) => {
|
|
14536
|
+
const item = record2(raw);
|
|
14537
|
+
if (item?.type !== "message" || item.role && item.role !== "assistant")
|
|
14538
|
+
return false;
|
|
14539
|
+
if (typeof item.content === "string")
|
|
14540
|
+
return Boolean(item.content.trim());
|
|
14541
|
+
return Array.isArray(item.content) && item.content.some((rawPart) => {
|
|
14542
|
+
const part = record2(rawPart);
|
|
14543
|
+
const text = typeof rawPart === "string" ? rawPart : part?.text ?? part?.content ?? part?.refusal;
|
|
14544
|
+
return typeof text === "string" && Boolean(text.trim());
|
|
14545
|
+
});
|
|
14546
|
+
});
|
|
14547
|
+
}
|
|
14548
|
+
function eventHasAssistantReplyText(type, payload) {
|
|
14549
|
+
const value = record2(payload);
|
|
14550
|
+
if (!value)
|
|
14551
|
+
return false;
|
|
14552
|
+
if (type === "response.output_text.delta" || type === "response.output_text.done" || type === "response.refusal.delta" || type === "response.refusal.done") {
|
|
14553
|
+
const text = value.delta ?? value.text ?? value.refusal;
|
|
14554
|
+
return typeof text === "string" && Boolean(text.trim());
|
|
14555
|
+
}
|
|
14556
|
+
if (type === "response.output_item.added" || type === "response.output_item.done")
|
|
14557
|
+
return hasAssistantReplyText([value.item]);
|
|
14558
|
+
if (type === "response.content_part.added" || type === "response.content_part.done") {
|
|
14559
|
+
return hasAssistantReplyText([{ type: "message", content: [value.part] }]);
|
|
14560
|
+
}
|
|
14561
|
+
return type.startsWith("response.") && hasAssistantReplyText(record2(value.response)?.output);
|
|
14562
|
+
}
|
|
14563
|
+
|
|
14530
14564
|
// ../../packages/contracts/dist/composer.js
|
|
14531
14565
|
var composerDraftIdSchema = external_exports.union([external_exports.literal("new"), external_exports.uuid()]);
|
|
14532
14566
|
var composerAttachmentSchema = external_exports.object({
|
|
@@ -16619,6 +16653,8 @@ var responseUsageSchema = external_exports.object({
|
|
|
16619
16653
|
totalTokens: external_exports.number().int().nonnegative()
|
|
16620
16654
|
});
|
|
16621
16655
|
var storedResponseSchema = external_exports.object({
|
|
16656
|
+
requestReceivedAt: isoDateSchema.nullable().optional(),
|
|
16657
|
+
firstReplyTextAt: isoDateSchema.nullable().optional(),
|
|
16622
16658
|
id: idSchema,
|
|
16623
16659
|
chatId: idSchema,
|
|
16624
16660
|
userId: idSchema,
|
|
@@ -16635,6 +16671,8 @@ var storedResponseSchema = external_exports.object({
|
|
|
16635
16671
|
completedAt: isoDateSchema.nullable()
|
|
16636
16672
|
});
|
|
16637
16673
|
var responseEventSchema = external_exports.object({
|
|
16674
|
+
requestReceivedAt: isoDateSchema.nullable().optional(),
|
|
16675
|
+
firstReplyTextAt: isoDateSchema.nullable().optional(),
|
|
16638
16676
|
responseId: idSchema,
|
|
16639
16677
|
sequence: external_exports.number().int().positive(),
|
|
16640
16678
|
type: external_exports.string().min(1),
|
|
@@ -16677,6 +16715,8 @@ var recallItemSchema = external_exports.object({
|
|
|
16677
16715
|
sources: external_exports.array(recallSourceSchema).max(5)
|
|
16678
16716
|
});
|
|
16679
16717
|
var responseSnapshotSchema = external_exports.object({
|
|
16718
|
+
requestReceivedAt: isoDateSchema.nullable().optional(),
|
|
16719
|
+
firstReplyTextAt: isoDateSchema.nullable().optional(),
|
|
16680
16720
|
responseId: idSchema,
|
|
16681
16721
|
status: responseStatusSchema,
|
|
16682
16722
|
sequence: external_exports.number().int().nonnegative(),
|
|
@@ -16826,12 +16866,22 @@ function applyResponseEventToSnapshot(snapshot, event) {
|
|
|
16826
16866
|
status: snapshot.status === "queued" ? "in_progress" : snapshot.status,
|
|
16827
16867
|
sequence: event.sequence,
|
|
16828
16868
|
output,
|
|
16869
|
+
requestReceivedAt: snapshot.requestReceivedAt ?? event.requestReceivedAt,
|
|
16870
|
+
firstReplyTextAt: snapshot.firstReplyTextAt ?? event.firstReplyTextAt ?? (eventHasAssistantReplyText(event.type, event.payload) ? event.emittedAt : void 0),
|
|
16829
16871
|
updatedAt: event.emittedAt
|
|
16830
16872
|
};
|
|
16831
16873
|
}
|
|
16832
16874
|
function mergeResponseSnapshots(current, incoming) {
|
|
16833
16875
|
if (incoming.sequence < current.sequence)
|
|
16834
16876
|
return current;
|
|
16877
|
+
const requestReceivedAt = current.requestReceivedAt ?? incoming.requestReceivedAt;
|
|
16878
|
+
const firstReplyTextAt = current.firstReplyTextAt ?? incoming.firstReplyTextAt;
|
|
16879
|
+
if (current.requestReceivedAt !== requestReceivedAt || current.firstReplyTextAt !== firstReplyTextAt) {
|
|
16880
|
+
current = { ...current, requestReceivedAt, firstReplyTextAt };
|
|
16881
|
+
}
|
|
16882
|
+
if (incoming.requestReceivedAt !== requestReceivedAt || incoming.firstReplyTextAt !== firstReplyTextAt) {
|
|
16883
|
+
incoming = { ...incoming, requestReceivedAt, firstReplyTextAt };
|
|
16884
|
+
}
|
|
16835
16885
|
if (incoming.sequence === current.sequence) {
|
|
16836
16886
|
const currentTerminal = current.status !== "queued" && current.status !== "in_progress";
|
|
16837
16887
|
const incomingTerminal = incoming.status !== "queued" && incoming.status !== "in_progress";
|
|
@@ -17387,6 +17437,7 @@ var managementAccountSettingsSchema = external_exports.object({
|
|
|
17387
17437
|
composerSyncEnabled: external_exports.boolean().default(true),
|
|
17388
17438
|
sendWithEnter: external_exports.boolean().default(true),
|
|
17389
17439
|
streamResponses: external_exports.boolean().default(true),
|
|
17440
|
+
showPromptSuggestions: external_exports.boolean().default(true),
|
|
17390
17441
|
showReasoning: external_exports.boolean().default(true),
|
|
17391
17442
|
showResponseCost: external_exports.boolean().default(false),
|
|
17392
17443
|
chatWidth: external_exports.enum(["full", "narrow"]).default("narrow"),
|
|
@@ -18315,7 +18366,7 @@ async function runModelTest(input) {
|
|
|
18315
18366
|
}
|
|
18316
18367
|
|
|
18317
18368
|
// src/index.ts
|
|
18318
|
-
var CLI_VERSION = true ? "0.
|
|
18369
|
+
var CLI_VERSION = true ? "0.125.0" : "0.1.0";
|
|
18319
18370
|
var CLI_BUNDLED = true;
|
|
18320
18371
|
var commandIo = /* @__PURE__ */ new WeakMap();
|
|
18321
18372
|
var commandClientFactory = /* @__PURE__ */ new WeakMap();
|
|
@@ -18384,13 +18435,13 @@ var SECRET_INPUT_KEYS = /* @__PURE__ */ new Set(["apiKey", "password", "secret",
|
|
|
18384
18435
|
function resolveEnvironmentReferences(value, path = "") {
|
|
18385
18436
|
if (Array.isArray(value)) return value.map((item, index) => resolveEnvironmentReferences(item, `${path}[${index}]`));
|
|
18386
18437
|
if (!value || typeof value !== "object") return value;
|
|
18387
|
-
const
|
|
18388
|
-
if (Object.keys(
|
|
18389
|
-
const secret = process.env[
|
|
18390
|
-
if (secret === void 0) throw new Error(`Environment variable ${
|
|
18438
|
+
const record3 = value;
|
|
18439
|
+
if (Object.keys(record3).length === 1 && typeof record3.fromEnv === "string") {
|
|
18440
|
+
const secret = process.env[record3.fromEnv];
|
|
18441
|
+
if (secret === void 0) throw new Error(`Environment variable ${record3.fromEnv} is not set`);
|
|
18391
18442
|
return secret;
|
|
18392
18443
|
}
|
|
18393
|
-
return Object.fromEntries(Object.entries(
|
|
18444
|
+
return Object.fromEntries(Object.entries(record3).map(([key, item]) => {
|
|
18394
18445
|
const itemPath = path ? `${path}.${key}` : key;
|
|
18395
18446
|
if (SECRET_INPUT_KEYS.has(key) && typeof item === "string") {
|
|
18396
18447
|
throw new Error(`${itemPath} must use { "fromEnv": "NAME" } instead of a plaintext JSON secret`);
|