feat(agent): capability registry, Pi AgentRuntimePort, fake model provider and redaction guard (W1-5)

- CapabilityRegistry: descriptor(id/version/schema/scope/risk/idempotent/preview/replay),
  invoke = scope limit -> input schema -> server-side authorize -> idempotency key -> handler
  -> output schema -> audit; capability id <-> tool name mapping (download.submit <-> download__submit)
- PiAgentRuntime (pi-agent-core AgentHarness 0.87.1): whitelist tools + before_tool re-check,
  redacted event stream, JSONL session at sessionDir/<runId>.jsonl, resume/abort/compact,
  tool-call/duration/token/cost budgets -> abort + run_failed(budget)
- AgentSettings -> pi-ai createProvider (anthropic / openai-compatible), compaction mapping
- FakeModelProvider + createFakeRuntime (scripted, transcript-derived, survives crash/resume)
- buildSystemPrompt, redactForModel; 27 tests incl. SIGKILL + resume

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-27 17:55:28 +08:00
1 parent 1262340856
commit 9c881e737f
24 files changed
+2419 -8

No files matched your search

+42 -1
View File
@@ -1,2 +1,43 @@
// @umt/agent 公开入口;W1 起在此导出实现
// @umt/agent 公开入口。Pi SDK 类型只出现在 src/pi/*,这里只导出本包自有接口。
export const PACKAGE_NAME = "@umt/agent";
export { CapabilityError, type CapabilityErrorCode, isCapabilityError } from "./capability/errors";
export {
CapabilityRegistry,
type CapabilityRegistryOptions,
defaultIdempotencyKey,
type RegisteredCapability,
stableStringify,
} from "./capability/registry";
export { capabilityIdToToolName, isCapabilityId, toolNameToCapabilityId } from "./capability/tool-name";
export * from "./capability/types";
export {
type CreateFakeRuntimeOptions,
createFakeRuntime,
FAKE_AGENT_SETTINGS,
FakeModelProvider,
type FakeModelProviderOptions,
type FakeScript,
type FakeStep,
type FakeToolCall,
type FakeToolResult,
} from "./pi/fake";
export {
checkToolCall,
DEFAULT_COMPACTION_INSTRUCTIONS,
PiAgentRuntime,
type PiAgentRuntimeOptions,
} from "./pi/runtime";
export { sessionPathFor } from "./pi/session";
export { isSensitiveKey, REDACTED, redactForModel, redactString, summarizeForLog } from "./redact";
export * from "./runtime/port";
export {
type AgentSettings,
AgentSettingsSchema,
type AgentThinkingLevel,
describeSettings,
type ResolvedAgentSettings,
resolveAgentSettings,
THINKING_LEVELS,
} from "./settings";
export { buildSystemPrompt, type SystemPromptInput } from "./system-prompt";