Merge remote-tracking branch 'origin/main' into bigrefactor

# Conflicts:
#	package-lock.json
#	packages/agent/package.json
This commit is contained in:
Mario Zechner
2026-05-08 13:38:20 +02:00
357 changed files with 2841 additions and 2195 deletions

View File

@@ -2,6 +2,10 @@
## [Unreleased]
## [0.74.0] - 2026-05-07
## [0.73.1] - 2026-05-07
## [0.73.0] - 2026-05-04
## [0.72.1] - 2026-05-02

View File

@@ -1,18 +1,18 @@
# @mariozechner/pi-agent-core
# @earendil-works/pi-agent-core
Stateful agent with tool execution and event streaming. Built on `@mariozechner/pi-ai`.
Stateful agent with tool execution and event streaming. Built on `@earendil-works/pi-ai`.
## Installation
```bash
npm install @mariozechner/pi-agent-core
npm install @earendil-works/pi-agent-core
```
## Quick Start
```typescript
import { Agent } from "@mariozechner/pi-agent-core";
import { getModel } from "@mariozechner/pi-ai";
import { Agent } from "@earendil-works/pi-agent-core";
import { getModel } from "@earendil-works/pi-ai";
const agent = new Agent({
initialState: {
@@ -355,7 +355,7 @@ Follow-up messages are checked only when there are no more tool calls and no ste
Extend `AgentMessage` via declaration merging:
```typescript
declare module "@mariozechner/pi-agent-core" {
declare module "@earendil-works/pi-agent-core" {
interface CustomAgentMessages {
notification: { role: "notification"; text: string; timestamp: number };
}
@@ -436,7 +436,7 @@ Return `terminate: true` from `execute()` or `afterToolCall` to hint that the ag
For browser apps that proxy through a backend:
```typescript
import { Agent, streamProxy } from "@mariozechner/pi-agent-core";
import { Agent, streamProxy } from "@earendil-works/pi-agent-core";
const agent = new Agent({
streamFn: (model, context, options) =>
@@ -453,7 +453,7 @@ const agent = new Agent({
For direct control without the Agent class:
```typescript
import { agentLoop, agentLoopContinue } from "@mariozechner/pi-agent-core";
import { agentLoop, agentLoopContinue } from "@earendil-works/pi-agent-core";
const context: AgentContext = {
systemPrompt: "You are helpful.",

View File

@@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi-agent-core",
"version": "0.73.0",
"name": "@earendil-works/pi-agent-core",
"version": "0.74.0",
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
"type": "module",
"main": "./dist/index.js",
@@ -17,7 +17,7 @@
"prepublishOnly": "npm run clean && npm run build"
},
"dependencies": {
"@mariozechner/pi-ai": "^0.73.0",
"@earendil-works/pi-ai": "^0.74.0",
"ignore": "^7.0.5",
"typebox": "^1.1.24",
"yaml": "^2.8.2"
@@ -33,7 +33,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/badlogic/pi-mono.git",
"url": "git+https://github.com/earendil-works/pi-mono.git",
"directory": "packages/agent"
},
"engines": {

View File

@@ -10,7 +10,7 @@ import {
streamSimple,
type ToolResultMessage,
validateToolArguments,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import type {
AgentContext,
AgentEvent,

View File

@@ -7,7 +7,7 @@ import {
type TextContent,
type ThinkingBudgets,
type Transport,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.js";
import type {
AfterToolCallContext,

View File

@@ -1,5 +1,5 @@
import { randomUUID } from "node:crypto";
import type { AssistantMessage, ImageContent, Model } from "@mariozechner/pi-ai";
import type { AssistantMessage, ImageContent, Model } from "@earendil-works/pi-ai";
import { Agent } from "../agent.js";
import type { AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from "../types.js";
import { collectEntriesForBranchSummary, generateBranchSummary } from "./compaction/branch-summarization.js";

View File

@@ -5,8 +5,8 @@
* a summary of the branch being left so context isn't lost.
*/
import type { ImageContent, Model, TextContent } from "@mariozechner/pi-ai";
import { completeSimple } from "@mariozechner/pi-ai";
import type { ImageContent, Model, TextContent } from "@earendil-works/pi-ai";
import { completeSimple } from "@earendil-works/pi-ai";
import type { AgentMessage } from "../../types.js";
import {
convertToLlm,

View File

@@ -5,8 +5,8 @@
* and after compaction the session is reloaded.
*/
import type { AssistantMessage, ImageContent, Model, TextContent, Usage } from "@mariozechner/pi-ai";
import { completeSimple } from "@mariozechner/pi-ai";
import type { AssistantMessage, ImageContent, Model, TextContent, Usage } from "@earendil-works/pi-ai";
import { completeSimple } from "@earendil-works/pi-ai";
import type { AgentMessage, ThinkingLevel } from "../../types.js";
import {
convertToLlm,

View File

@@ -2,7 +2,7 @@
* Shared utilities for compaction and branch summarization.
*/
import type { Message } from "@mariozechner/pi-ai";
import type { Message } from "@earendil-works/pi-ai";
import type { AgentMessage } from "../../types.js";
// ============================================================================

View File

@@ -1,4 +1,4 @@
import type { ImageContent, Message, TextContent } from "@mariozechner/pi-ai";
import type { ImageContent, Message, TextContent } from "@earendil-works/pi-ai";
import type { AgentMessage } from "../types.js";
export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:

View File

@@ -1,4 +1,4 @@
import type { ImageContent, TextContent } from "@mariozechner/pi-ai";
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
import type { AgentMessage } from "../../types.js";
import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from "../messages.js";
import type {

View File

@@ -1,4 +1,4 @@
import type { ImageContent, Model, TextContent } from "@mariozechner/pi-ai";
import type { ImageContent, Model, TextContent } from "@earendil-works/pi-ai";
import type { AgentEvent, AgentMessage, AgentTool, ThinkingLevel } from "../index.js";
import type { Session } from "./session/session.js";

View File

@@ -14,7 +14,7 @@ import {
type SimpleStreamOptions,
type StopReason,
type ToolCall,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
// Create stream class matching ProxyMessageEventStream
class ProxyMessageEventStream extends EventStream<AssistantMessageEvent, AssistantMessage> {

View File

@@ -9,7 +9,7 @@ import type {
TextContent,
Tool,
ToolResultMessage,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import type { Static, TSchema } from "typebox";
/**
@@ -250,7 +250,7 @@ export interface AgentLoopConfig extends SimpleStreamOptions {
/**
* Thinking/reasoning level for models that support it.
* Note: "xhigh" is only supported by selected model families. Use model thinking-level metadata
* from @mariozechner/pi-ai to detect support for a concrete model.
* from @earendil-works/pi-ai to detect support for a concrete model.
*/
export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";

View File

@@ -5,7 +5,7 @@ import {
type Message,
type Model,
type UserMessage,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import { Type } from "typebox";
import { describe, expect, it } from "vitest";
import { agentLoop, agentLoopContinue } from "../src/agent-loop.js";

View File

@@ -1,4 +1,4 @@
import { type AssistantMessage, type AssistantMessageEvent, EventStream, getModel } from "@mariozechner/pi-ai";
import { type AssistantMessage, type AssistantMessageEvent, EventStream, getModel } from "@earendil-works/pi-ai";
import { describe, expect, it } from "vitest";
import { Agent } from "../src/index.js";

View File

@@ -9,7 +9,7 @@ import {
registerFauxProvider,
type ToolResultMessage,
type UserMessage,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import { afterEach, describe, expect, it } from "vitest";
import { Agent, type AgentEvent } from "../src/index.js";
import { calculateTool } from "./utils/calculate.js";

View File

@@ -5,7 +5,7 @@ import {
type Model,
registerFauxProvider,
type Usage,
} from "@mariozechner/pi-ai";
} from "@earendil-works/pi-ai";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
calculateContextTokens,

View File

@@ -1,4 +1,4 @@
import { getModel } from "@mariozechner/pi-ai";
import { getModel } from "@earendil-works/pi-ai";
import { describe, expect, it } from "vitest";
import { NodeExecutionEnv } from "../../src/harness/execution-env.js";
import { createAgentHarness, createSession } from "../../src/harness/factory.js";

View File

@@ -1,7 +1,7 @@
import { existsSync, mkdirSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AgentMessage } from "@mariozechner/pi-agent-core";
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import { afterEach } from "vitest";
export function createUserMessage(text: string): AgentMessage {

View File

@@ -1,6 +1,6 @@
import { homedir } from "node:os";
import { join } from "node:path";
import { getModel } from "@mariozechner/pi-ai";
import { getModel } from "@earendil-works/pi-ai";
import { InMemorySessionStorage } from "../../src/harness/session/storage/memory.js";
import {
createAgentHarness,