chore(vendor): import pi 1.3.0

Imported as a linear vendor commit so forge rebases do not replay the upstream root tree.

git-subtree-dir: third_party/pi

git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
2026-10-15 17:58:48 -04:00
parent 719370c8f7
commit 6081e3e325
1743 changed files with 205460 additions and 131705 deletions

View File

@@ -1,23 +1,7 @@
import { Client } from "@earendil-works/pi-client";
import { createHost, memoryLinkPair, replicatedState } from "@earendil-works/chord";
import { createAssistantMessageEventStream, Type } from "@earendil-works/pi-ai";
import { complete, getModel, getProviders, streamSimple } from "@earendil-works/pi-ai/compat";
import {
Agent,
bashExecutionToText,
convertToLlm,
createCustomMessage,
FileError,
formatPromptTemplateInvocation,
formatSkillInvocation,
formatSkillsForSystemPrompt,
getOrThrow,
ok,
parseCommandArgs,
streamProxy,
toError,
truncateHead,
} from "@earendil-works/pi-agent-core";
import { decodeCbor, encodeCbor, PROTOCOL_VERSION } from "@earendil-works/pi-protocol";
import { Agent, streamProxy } from "@earendil-works/pi-agent-core";
// Keep this entry browser-safe. It is bundled by scripts/check-browser-smoke.mjs
// to catch accidental Node-only runtime imports in browser-facing package exports.
@@ -27,10 +11,6 @@ const stream = createAssistantMessageEventStream();
const agent = new Agent({ initialState: { model }, streamFn: streamSimple });
agent.steer({ role: "user", content: [{ type: "text", text: "queued" }], timestamp: 0 });
const result = getOrThrow(ok({ value: 1 }));
const customMessage = createCustomMessage("note", "hello", true, undefined, "2026-01-01T00:00:00.000Z");
const llmMessages = convertToLlm([customMessage]);
const skill = { name: "browser-safe", description: "Smoke test", content: "Use browser APIs.", filePath: "/skills/browser-safe/SKILL.md" };
console.log(
model.id,
@@ -39,25 +19,8 @@ console.log(
schema.type,
typeof stream.push,
agent.hasQueuedMessages(),
result.value,
llmMessages.length,
bashExecutionToText({
role: "bashExecution",
command: "echo ok",
output: "ok",
exitCode: 0,
cancelled: false,
truncated: false,
timestamp: 0,
}),
formatSkillsForSystemPrompt([skill]).length,
formatSkillInvocation(skill).length,
formatPromptTemplateInvocation({ name: "example", content: "$1 $@" }, parseCommandArgs('one "two three"')),
truncateHead("a\nb", { maxLines: 1 }).content,
new FileError("not_found", "missing").code,
toError("boom").message,
typeof streamProxy,
typeof Client,
PROTOCOL_VERSION,
decodeCbor(encodeCbor({ browser: true })),
typeof createHost,
typeof memoryLinkPair,
replicatedState({ browser: true }).value.browser,
);