chore: upgrade pi-mono deps to 0.31.1
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Media: preserve GIF animation when uploading to Discord/other providers (skip JPEG optimization for image/gif).
|
- Media: preserve GIF animation when uploading to Discord/other providers (skip JPEG optimization for image/gif).
|
||||||
|
- Agent runtime: update pi-mono dependencies to 0.31.1 (agent-core split).
|
||||||
|
|
||||||
### Breaking
|
### Breaking
|
||||||
- Skills config schema moved under `skills.*`:
|
- Skills config schema moved under `skills.*`:
|
||||||
|
|||||||
@@ -72,9 +72,9 @@
|
|||||||
"@grammyjs/transformer-throttler": "^1.2.1",
|
"@grammyjs/transformer-throttler": "^1.2.1",
|
||||||
"@clack/prompts": "^0.11.0",
|
"@clack/prompts": "^0.11.0",
|
||||||
"@homebridge/ciao": "^1.3.4",
|
"@homebridge/ciao": "^1.3.4",
|
||||||
"@mariozechner/pi-agent-core": "^0.30.2",
|
"@mariozechner/pi-agent-core": "^0.31.1",
|
||||||
"@mariozechner/pi-ai": "^0.30.2",
|
"@mariozechner/pi-ai": "^0.31.1",
|
||||||
"@mariozechner/pi-coding-agent": "^0.30.2",
|
"@mariozechner/pi-coding-agent": "^0.31.1",
|
||||||
"@sinclair/typebox": "^0.34.45",
|
"@sinclair/typebox": "^0.34.45",
|
||||||
"@whiskeysockets/baileys": "7.0.0-rc.9",
|
"@whiskeysockets/baileys": "7.0.0-rc.9",
|
||||||
"ajv": "^8.17.1",
|
"ajv": "^8.17.1",
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@mariozechner/pi-ai": "patches/@mariozechner__pi-ai.patch",
|
"@mariozechner/pi-ai": "patches/@mariozechner__pi-ai.patch",
|
||||||
"@mariozechner/pi-coding-agent@0.30.2": "patches/@mariozechner__pi-coding-agent@0.30.2.patch"
|
"@mariozechner/pi-coding-agent@0.31.1": "patches/@mariozechner__pi-coding-agent@0.31.1.patch"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vitest": {
|
"vitest": {
|
||||||
|
|||||||
61
pnpm-lock.yaml
generated
61
pnpm-lock.yaml
generated
@@ -11,9 +11,9 @@ patchedDependencies:
|
|||||||
'@mariozechner/pi-ai':
|
'@mariozechner/pi-ai':
|
||||||
hash: bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832
|
hash: bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832
|
||||||
path: patches/@mariozechner__pi-ai.patch
|
path: patches/@mariozechner__pi-ai.patch
|
||||||
'@mariozechner/pi-coding-agent@0.30.2':
|
'@mariozechner/pi-coding-agent@0.31.1':
|
||||||
hash: d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745
|
hash: d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745
|
||||||
path: patches/@mariozechner__pi-coding-agent@0.30.2.patch
|
path: patches/@mariozechner__pi-coding-agent@0.31.1.patch
|
||||||
|
|
||||||
importers:
|
importers:
|
||||||
|
|
||||||
@@ -29,14 +29,14 @@ importers:
|
|||||||
specifier: ^1.3.4
|
specifier: ^1.3.4
|
||||||
version: 1.3.4
|
version: 1.3.4
|
||||||
'@mariozechner/pi-agent-core':
|
'@mariozechner/pi-agent-core':
|
||||||
specifier: ^0.30.2
|
specifier: ^0.31.1
|
||||||
version: 0.30.2(ws@8.18.3)(zod@4.2.1)
|
version: 0.31.1(ws@8.18.3)(zod@4.2.1)
|
||||||
'@mariozechner/pi-ai':
|
'@mariozechner/pi-ai':
|
||||||
specifier: ^0.30.2
|
specifier: ^0.31.1
|
||||||
version: 0.30.2(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
version: 0.31.1(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
||||||
'@mariozechner/pi-coding-agent':
|
'@mariozechner/pi-coding-agent':
|
||||||
specifier: ^0.30.2
|
specifier: ^0.31.1
|
||||||
version: 0.30.2(patch_hash=d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745)(ws@8.18.3)(zod@4.2.1)
|
version: 0.31.1(patch_hash=d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745)(ws@8.18.3)(zod@4.2.1)
|
||||||
'@sinclair/typebox':
|
'@sinclair/typebox':
|
||||||
specifier: 0.34.45
|
specifier: 0.34.45
|
||||||
version: 0.34.45
|
version: 0.34.45
|
||||||
@@ -738,22 +738,22 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
lit: ^3.3.1
|
lit: ^3.3.1
|
||||||
|
|
||||||
'@mariozechner/pi-agent-core@0.30.2':
|
'@mariozechner/pi-agent-core@0.31.1':
|
||||||
resolution: {integrity: sha512-N+4JpOHdBOi5qIlSGz+flfE4xl/iJTsmFyJ653CL7UZMrKUBJZARBi7OYLZ2y84buVkFJajL7T5AbzXIjclaOw==}
|
resolution: {integrity: sha512-skY2ZGrVbTkbTpdHql3mR0//BbLeqwKWQ0bnoI2H7YHbR5bTDSaYwtRtSdEgfPVgTk+WBQaZOZOv6be4qCAsww==}
|
||||||
engines: {node: '>=20.0.0'}
|
engines: {node: '>=20.0.0'}
|
||||||
|
|
||||||
'@mariozechner/pi-ai@0.30.2':
|
'@mariozechner/pi-ai@0.31.1':
|
||||||
resolution: {integrity: sha512-+8JlLRW1xMHDrgHbRxLMbJ7/LL/c2evZetKAjEEJJtOc/hbax9Dfw+7OSRiZn9oSkT0S12/qy44a76gpRpghhQ==}
|
resolution: {integrity: sha512-mqqitu/69ofLPmQEj7m04SvPQZEX+uacLHU9oQxz1c1khclsjw2S7G/v5P/3jK4hZjoZfHkPJRwPMFvEbo3wAA==}
|
||||||
engines: {node: '>=20.0.0'}
|
engines: {node: '>=20.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@mariozechner/pi-coding-agent@0.30.2':
|
'@mariozechner/pi-coding-agent@0.31.1':
|
||||||
resolution: {integrity: sha512-6p/cvWmyOcNIi8qnuok77qPeEfdIvxUWrJR1gHpKEziLJA9ZygxMcAXFBaPvM0TP5Hj3Qwhs4qIupL0ygd3wng==}
|
resolution: {integrity: sha512-S+IQMYJssNFXQcdk8iB3tY0b1Idi0gAZCdwGCkTSG+vGghO0rdo+vQ+/v5KM6BhW2XsKiYz/2XCG8237iVwINA==}
|
||||||
engines: {node: '>=20.0.0'}
|
engines: {node: '>=20.0.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
'@mariozechner/pi-tui@0.30.2':
|
'@mariozechner/pi-tui@0.31.1':
|
||||||
resolution: {integrity: sha512-UuqEgNWi6cG9hBImVytqP703J8z65B0pvlBKsnRoVljZ1U8TTyfdpd375oc8NONHtYKKmsSR4OLyG+zA56EEHw==}
|
resolution: {integrity: sha512-79hDQPAMPxKO0HKoXiFLp1HFbRDwweYL31l2wlsEzhPYgIYvx0Ii7X+KK4yMjjfDc4SjX6ZmSnJ4MUFAanuVzA==}
|
||||||
engines: {node: '>=20.0.0'}
|
engines: {node: '>=20.0.0'}
|
||||||
|
|
||||||
'@mistralai/mistralai@1.10.0':
|
'@mistralai/mistralai@1.10.0':
|
||||||
@@ -2682,10 +2682,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==}
|
resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
string-width@8.1.0:
|
|
||||||
resolution: {integrity: sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==}
|
|
||||||
engines: {node: '>=20'}
|
|
||||||
|
|
||||||
string_decoder@1.1.1:
|
string_decoder@1.1.1:
|
||||||
resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
|
resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
|
||||||
|
|
||||||
@@ -3474,10 +3470,10 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- tailwindcss
|
- tailwindcss
|
||||||
|
|
||||||
'@mariozechner/pi-agent-core@0.30.2(ws@8.18.3)(zod@4.2.1)':
|
'@mariozechner/pi-agent-core@0.31.1(ws@8.18.3)(zod@4.2.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mariozechner/pi-ai': 0.30.2(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
'@mariozechner/pi-ai': 0.31.1(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
||||||
'@mariozechner/pi-tui': 0.30.2
|
'@mariozechner/pi-tui': 0.31.1
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@modelcontextprotocol/sdk'
|
- '@modelcontextprotocol/sdk'
|
||||||
- bufferutil
|
- bufferutil
|
||||||
@@ -3486,7 +3482,7 @@ snapshots:
|
|||||||
- ws
|
- ws
|
||||||
- zod
|
- zod
|
||||||
|
|
||||||
'@mariozechner/pi-ai@0.30.2(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)':
|
'@mariozechner/pi-ai@0.31.1(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@anthropic-ai/sdk': 0.71.2(zod@4.2.1)
|
'@anthropic-ai/sdk': 0.71.2(zod@4.2.1)
|
||||||
'@google/genai': 1.34.0
|
'@google/genai': 1.34.0
|
||||||
@@ -3506,11 +3502,11 @@ snapshots:
|
|||||||
- ws
|
- ws
|
||||||
- zod
|
- zod
|
||||||
|
|
||||||
'@mariozechner/pi-coding-agent@0.30.2(patch_hash=d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745)(ws@8.18.3)(zod@4.2.1)':
|
'@mariozechner/pi-coding-agent@0.31.1(patch_hash=d0d5ffa1bfda8a0f9d14a5e73a074014346d3edbdb2ffc91444d3be5119f5745)(ws@8.18.3)(zod@4.2.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@mariozechner/pi-agent-core': 0.30.2(ws@8.18.3)(zod@4.2.1)
|
'@mariozechner/pi-agent-core': 0.31.1(ws@8.18.3)(zod@4.2.1)
|
||||||
'@mariozechner/pi-ai': 0.30.2(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
'@mariozechner/pi-ai': 0.31.1(patch_hash=bf3e904ebaad236b8c3bb48c7d1150a1463735e783acaab6d15d6cd381b43832)(ws@8.18.3)(zod@4.2.1)
|
||||||
'@mariozechner/pi-tui': 0.30.2
|
'@mariozechner/pi-tui': 0.31.1
|
||||||
chalk: 5.6.2
|
chalk: 5.6.2
|
||||||
cli-highlight: 2.1.11
|
cli-highlight: 2.1.11
|
||||||
diff: 8.0.2
|
diff: 8.0.2
|
||||||
@@ -3526,13 +3522,13 @@ snapshots:
|
|||||||
- ws
|
- ws
|
||||||
- zod
|
- zod
|
||||||
|
|
||||||
'@mariozechner/pi-tui@0.30.2':
|
'@mariozechner/pi-tui@0.31.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/mime-types': 2.1.4
|
'@types/mime-types': 2.1.4
|
||||||
chalk: 5.6.2
|
chalk: 5.6.2
|
||||||
|
get-east-asian-width: 1.4.0
|
||||||
marked: 15.0.12
|
marked: 15.0.12
|
||||||
mime-types: 3.0.2
|
mime-types: 3.0.2
|
||||||
string-width: 8.1.0
|
|
||||||
|
|
||||||
'@mistralai/mistralai@1.10.0':
|
'@mistralai/mistralai@1.10.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -5564,11 +5560,6 @@ snapshots:
|
|||||||
emoji-regex: 9.2.2
|
emoji-regex: 9.2.2
|
||||||
strip-ansi: 7.1.2
|
strip-ansi: 7.1.2
|
||||||
|
|
||||||
string-width@8.1.0:
|
|
||||||
dependencies:
|
|
||||||
get-east-asian-width: 1.4.0
|
|
||||||
strip-ansi: 7.1.2
|
|
||||||
|
|
||||||
string_decoder@1.1.1:
|
string_decoder@1.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
safe-buffer: 5.1.2
|
safe-buffer: 5.1.2
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process";
|
import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process";
|
||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-ai";
|
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||||
import { Type } from "@sinclair/typebox";
|
import { Type } from "@sinclair/typebox";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -94,7 +94,7 @@ export type BashToolDetails =
|
|||||||
|
|
||||||
export function createBashTool(
|
export function createBashTool(
|
||||||
defaults?: BashToolDefaults,
|
defaults?: BashToolDefaults,
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-ai uses a different module instance.
|
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-agent-core uses a different module instance.
|
||||||
): AgentTool<any, BashToolDetails> {
|
): AgentTool<any, BashToolDetails> {
|
||||||
const defaultBackgroundMs = clampNumber(
|
const defaultBackgroundMs = clampNumber(
|
||||||
defaults?.backgroundMs ?? readEnvInt("PI_BASH_YIELD_MS"),
|
defaults?.backgroundMs ?? readEnvInt("PI_BASH_YIELD_MS"),
|
||||||
@@ -358,7 +358,7 @@ const processSchema = Type.Object({
|
|||||||
|
|
||||||
export function createProcessTool(
|
export function createProcessTool(
|
||||||
defaults?: ProcessToolDefaults,
|
defaults?: ProcessToolDefaults,
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-ai uses a different module instance.
|
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-agent-core uses a different module instance.
|
||||||
): AgentTool<any> {
|
): AgentTool<any> {
|
||||||
if (defaults?.cleanupMs !== undefined) {
|
if (defaults?.cleanupMs !== undefined) {
|
||||||
setJobTtlMs(defaults.cleanupMs);
|
setJobTtlMs(defaults.cleanupMs);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
|
|
||||||
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-ai";
|
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||||
import { Type } from "@sinclair/typebox";
|
import { Type } from "@sinclair/typebox";
|
||||||
import {
|
import {
|
||||||
browserCloseTab,
|
browserCloseTab,
|
||||||
@@ -46,7 +46,7 @@ import { callGateway } from "../gateway/call.js";
|
|||||||
import { detectMime, imageMimeFromFormat } from "../media/mime.js";
|
import { detectMime, imageMimeFromFormat } from "../media/mime.js";
|
||||||
import { sanitizeToolResultImages } from "./tool-images.js";
|
import { sanitizeToolResultImages } from "./tool-images.js";
|
||||||
|
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-ai uses a different module instance.
|
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-agent-core uses a different module instance.
|
||||||
type AnyAgentTool = AgentTool<any, unknown>;
|
type AnyAgentTool = AgentTool<any, unknown>;
|
||||||
|
|
||||||
const DEFAULT_GATEWAY_URL = "ws://127.0.0.1:18789";
|
const DEFAULT_GATEWAY_URL = "ws://127.0.0.1:18789";
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import type { AppMessage } from "@mariozechner/pi-agent-core";
|
import type {
|
||||||
import type { AgentToolResult, AssistantMessage } from "@mariozechner/pi-ai";
|
AgentMessage,
|
||||||
|
AgentToolResult,
|
||||||
|
} from "@mariozechner/pi-agent-core";
|
||||||
|
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
||||||
|
|
||||||
import { sanitizeContentBlocksImages } from "./tool-images.js";
|
import { sanitizeContentBlocksImages } from "./tool-images.js";
|
||||||
import type { WorkspaceBootstrapFile } from "./workspace.js";
|
import type { WorkspaceBootstrapFile } from "./workspace.js";
|
||||||
@@ -36,12 +39,12 @@ export async function ensureSessionHeader(params: {
|
|||||||
type ContentBlock = AgentToolResult<unknown>["content"][number];
|
type ContentBlock = AgentToolResult<unknown>["content"][number];
|
||||||
|
|
||||||
export async function sanitizeSessionMessagesImages(
|
export async function sanitizeSessionMessagesImages(
|
||||||
messages: AppMessage[],
|
messages: AgentMessage[],
|
||||||
label: string,
|
label: string,
|
||||||
): Promise<AppMessage[]> {
|
): Promise<AgentMessage[]> {
|
||||||
// We sanitize historical session messages because Anthropic can reject a request
|
// We sanitize historical session messages because Anthropic can reject a request
|
||||||
// if the transcript contains oversized base64 images (see MAX_IMAGE_DIMENSION_PX).
|
// if the transcript contains oversized base64 images (see MAX_IMAGE_DIMENSION_PX).
|
||||||
const out: AppMessage[] = [];
|
const out: AgentMessage[] = [];
|
||||||
for (const msg of messages) {
|
for (const msg of messages) {
|
||||||
if (!msg || typeof msg !== "object") {
|
if (!msg || typeof msg !== "object") {
|
||||||
out.push(msg);
|
out.push(msg);
|
||||||
@@ -50,7 +53,7 @@ export async function sanitizeSessionMessagesImages(
|
|||||||
|
|
||||||
const role = (msg as { role?: unknown }).role;
|
const role = (msg as { role?: unknown }).role;
|
||||||
if (role === "toolResult") {
|
if (role === "toolResult") {
|
||||||
const toolMsg = msg as Extract<AppMessage, { role: "toolResult" }>;
|
const toolMsg = msg as Extract<AgentMessage, { role: "toolResult" }>;
|
||||||
const content = Array.isArray(toolMsg.content) ? toolMsg.content : [];
|
const content = Array.isArray(toolMsg.content) ? toolMsg.content : [];
|
||||||
const nextContent = (await sanitizeContentBlocksImages(
|
const nextContent = (await sanitizeContentBlocksImages(
|
||||||
content as ContentBlock[],
|
content as ContentBlock[],
|
||||||
@@ -61,7 +64,7 @@ export async function sanitizeSessionMessagesImages(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (role === "user") {
|
if (role === "user") {
|
||||||
const userMsg = msg as Extract<AppMessage, { role: "user" }>;
|
const userMsg = msg as Extract<AgentMessage, { role: "user" }>;
|
||||||
const content = userMsg.content;
|
const content = userMsg.content;
|
||||||
if (Array.isArray(content)) {
|
if (Array.isArray(content)) {
|
||||||
const nextContent = (await sanitizeContentBlocksImages(
|
const nextContent = (await sanitizeContentBlocksImages(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
|
|||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
|
||||||
import type { AppMessage, ThinkingLevel } from "@mariozechner/pi-agent-core";
|
import type { AgentMessage, ThinkingLevel } from "@mariozechner/pi-agent-core";
|
||||||
import {
|
import {
|
||||||
type Api,
|
type Api,
|
||||||
type AssistantMessage,
|
type AssistantMessage,
|
||||||
@@ -448,8 +448,7 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
model,
|
model,
|
||||||
thinkingLevel,
|
thinkingLevel,
|
||||||
systemPrompt,
|
systemPrompt,
|
||||||
// TODO(steipete): Once pi-mono publishes file-magic MIME detection in `read` image payloads,
|
// Custom tool set: extra bash/process + read image sanitization.
|
||||||
// remove `createClawdisCodingTools()` and use upstream `codingTools` again.
|
|
||||||
tools,
|
tools,
|
||||||
sessionManager,
|
sessionManager,
|
||||||
settingsManager,
|
settingsManager,
|
||||||
@@ -502,7 +501,7 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
Math.max(1, params.timeoutMs),
|
Math.max(1, params.timeoutMs),
|
||||||
);
|
);
|
||||||
|
|
||||||
let messagesSnapshot: AppMessage[] = [];
|
let messagesSnapshot: AgentMessage[] = [];
|
||||||
let sessionIdUsed = session.sessionId;
|
let sessionIdUsed = session.sessionId;
|
||||||
const onAbort = () => {
|
const onAbort = () => {
|
||||||
abortRun();
|
abortRun();
|
||||||
@@ -543,7 +542,7 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
const lastAssistant = messagesSnapshot
|
const lastAssistant = messagesSnapshot
|
||||||
.slice()
|
.slice()
|
||||||
.reverse()
|
.reverse()
|
||||||
.find((m) => (m as AppMessage)?.role === "assistant") as
|
.find((m) => (m as AgentMessage)?.role === "assistant") as
|
||||||
| AssistantMessage
|
| AssistantMessage
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AgentEvent, AppMessage } from "@mariozechner/pi-agent-core";
|
import type { AgentEvent, AgentMessage } from "@mariozechner/pi-agent-core";
|
||||||
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
import type { AssistantMessage } from "@mariozechner/pi-ai";
|
||||||
import type { AgentSession } from "@mariozechner/pi-coding-agent";
|
import type { AgentSession } from "@mariozechner/pi-coding-agent";
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ export function subscribeEmbeddedPiSession(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (evt.type === "message_update") {
|
if (evt.type === "message_update") {
|
||||||
const msg = (evt as AgentEvent & { message: AppMessage }).message;
|
const msg = (evt as AgentEvent & { message: AgentMessage }).message;
|
||||||
if (msg?.role === "assistant") {
|
if (msg?.role === "assistant") {
|
||||||
const assistantEvent = (
|
const assistantEvent = (
|
||||||
evt as AgentEvent & { assistantMessageEvent?: unknown }
|
evt as AgentEvent & { assistantMessageEvent?: unknown }
|
||||||
@@ -298,7 +298,7 @@ export function subscribeEmbeddedPiSession(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (evt.type === "message_end") {
|
if (evt.type === "message_end") {
|
||||||
const msg = (evt as AgentEvent & { message: AppMessage }).message;
|
const msg = (evt as AgentEvent & { message: AgentMessage }).message;
|
||||||
if (msg?.role === "assistant") {
|
if (msg?.role === "assistant") {
|
||||||
const cleaned = params.enforceFinalTag
|
const cleaned = params.enforceFinalTag
|
||||||
? stripThinkingSegments(
|
? stripThinkingSegments(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-ai";
|
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||||
import { codingTools, readTool } from "@mariozechner/pi-coding-agent";
|
import { codingTools, readTool } from "@mariozechner/pi-coding-agent";
|
||||||
import { Type } from "@sinclair/typebox";
|
import { Type } from "@sinclair/typebox";
|
||||||
|
|
||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
import { createClawdisTools } from "./clawdis-tools.js";
|
import { createClawdisTools } from "./clawdis-tools.js";
|
||||||
import { sanitizeToolResultImages } from "./tool-images.js";
|
import { sanitizeToolResultImages } from "./tool-images.js";
|
||||||
|
|
||||||
// TODO(steipete): Remove this wrapper once pi-mono ships file-magic MIME detection
|
// NOTE(steipete): Upstream read now does file-magic MIME detection; we keep the wrapper
|
||||||
// for `read` image payloads in `@mariozechner/pi-coding-agent` (then switch back to `codingTools` directly).
|
// to normalize payloads and sanitize oversized images before they hit providers.
|
||||||
type ToolContentBlock = AgentToolResult<unknown>["content"][number];
|
type ToolContentBlock = AgentToolResult<unknown>["content"][number];
|
||||||
type ImageContentBlock = Extract<ToolContentBlock, { type: "image" }>;
|
type ImageContentBlock = Extract<ToolContentBlock, { type: "image" }>;
|
||||||
type TextContentBlock = Extract<ToolContentBlock, { type: "text" }>;
|
type TextContentBlock = Extract<ToolContentBlock, { type: "text" }>;
|
||||||
@@ -103,7 +103,7 @@ async function normalizeReadImageResult(
|
|||||||
return { ...result, content: nextContent };
|
return { ...result, content: nextContent };
|
||||||
}
|
}
|
||||||
|
|
||||||
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-ai uses a different module instance.
|
// biome-ignore lint/suspicious/noExplicitAny: TypeBox schema type from pi-agent-core uses a different module instance.
|
||||||
type AnyAgentTool = AgentTool<any, unknown>;
|
type AnyAgentTool = AgentTool<any, unknown>;
|
||||||
|
|
||||||
function extractEnumValues(schema: unknown): unknown[] | undefined {
|
function extractEnumValues(schema: unknown): unknown[] | undefined {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AgentToolResult } from "@mariozechner/pi-ai";
|
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
|
||||||
|
|
||||||
import { getImageMetadata, resizeToJpeg } from "../media/image-ops.js";
|
import { getImageMetadata, resizeToJpeg } from "../media/image-ops.js";
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
normalizeDiscordSlug,
|
normalizeDiscordSlug,
|
||||||
resolveDiscordChannelConfig,
|
resolveDiscordChannelConfig,
|
||||||
resolveDiscordGuildEntry,
|
resolveDiscordGuildEntry,
|
||||||
resolveGroupDmAllow,
|
|
||||||
resolveDiscordReplyTarget,
|
resolveDiscordReplyTarget,
|
||||||
|
resolveGroupDmAllow,
|
||||||
} from "./monitor.js";
|
} from "./monitor.js";
|
||||||
|
|
||||||
const fakeGuild = (id: string, name: string) =>
|
const fakeGuild = (id: string, name: string) =>
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
|||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||||
import type { DiscordSlashCommandConfig, ReplyToMode } from "../config/config.js";
|
import type {
|
||||||
|
DiscordSlashCommandConfig,
|
||||||
|
ReplyToMode,
|
||||||
|
} from "../config/config.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import { resolveStorePath, updateLastRoute } from "../config/sessions.js";
|
import { resolveStorePath, updateLastRoute } from "../config/sessions.js";
|
||||||
import { danger, isVerbose, logVerbose, warn } from "../globals.js";
|
import { danger, isVerbose, logVerbose, warn } from "../globals.js";
|
||||||
|
|||||||
@@ -249,7 +249,9 @@ async function deliverReplies(params: {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const replyToId =
|
const replyToId =
|
||||||
replyToMode === "off" ? undefined : resolveTelegramReplyId(reply.replyToId);
|
replyToMode === "off"
|
||||||
|
? undefined
|
||||||
|
: resolveTelegramReplyId(reply.replyToId);
|
||||||
const mediaList = reply.mediaUrls?.length
|
const mediaList = reply.mediaUrls?.length
|
||||||
? reply.mediaUrls
|
? reply.mediaUrls
|
||||||
: reply.mediaUrl
|
: reply.mediaUrl
|
||||||
|
|||||||
Reference in New Issue
Block a user