@h-ai/ai 1.0.0-beta.23 → 1.0.0-beta.24

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.
Files changed (41) hide show
  1. package/README.en.md +145 -141
  2. package/README.ja.md +145 -141
  3. package/README.md +143 -141
  4. package/dist/{ai-acp-types-BNeA1j0P.d.ts → ai-acp-types-B99Oa7WD.d.ts} +2242 -233
  5. package/dist/browser.d.ts +3 -1
  6. package/dist/browser.js +3 -3
  7. package/dist/{chunk-CCXG2S7O.js → chunk-3G4ZLXH4.js} +154 -9
  8. package/dist/chunk-3G4ZLXH4.js.map +1 -0
  9. package/dist/{chunk-WSH2246H.js → chunk-3R5SMLSJ.js} +3 -3
  10. package/dist/{chunk-WSH2246H.js.map → chunk-3R5SMLSJ.js.map} +1 -1
  11. package/dist/{chunk-M77C3VAP.js → chunk-NRDLMUSY.js} +4 -2
  12. package/dist/chunk-NRDLMUSY.js.map +1 -0
  13. package/dist/client/index.js +2 -2
  14. package/dist/index.d.ts +4 -2
  15. package/dist/index.js +2492 -593
  16. package/dist/index.js.map +1 -1
  17. package/models/agents/README.md +30 -18
  18. package/models/agents/build.mjs +158 -55
  19. package/models/agents/codex-acp/Dockerfile +8 -13
  20. package/models/agents/deepseek-harness/Dockerfile +8 -13
  21. package/models/agents/goose/Dockerfile +8 -13
  22. package/models/agents/goose/agent.json +1 -1
  23. package/package.json +11 -8
  24. package/tools/.dockerignore +4 -0
  25. package/tools/README.md +74 -0
  26. package/tools/archives.py +56 -0
  27. package/tools/browser/Dockerfile +19 -0
  28. package/tools/browser/operation.py +50 -0
  29. package/tools/browser/render.mjs +40 -0
  30. package/tools/documents/Dockerfile +20 -0
  31. package/tools/documents/operation.py +80 -0
  32. package/tools/ocr/Dockerfile +19 -0
  33. package/tools/ocr/operation.py +18 -0
  34. package/tools/office/Dockerfile +21 -0
  35. package/tools/office/office_job.py +65 -0
  36. package/tools/office/operation.py +43 -0
  37. package/tools/tests/image-smoke.mjs +83 -0
  38. package/tools/tests/test_hai_tool.py +82 -0
  39. package/tools/tool.py +145 -0
  40. package/dist/chunk-CCXG2S7O.js.map +0 -1
  41. package/dist/chunk-M77C3VAP.js.map +0 -1
package/README.ja.md CHANGED
@@ -49,146 +49,148 @@ direct・AsyncIterable・直接の Promise 値と記載したもの以外、出
49
49
 
50
50
  呼出し断片は本ページで初期化したサービスを使います。変数はアプリ側で用意する要求・Schema・リソース定義・設定を表します。初期化と失敗処理は各機能の例を参照し、HaiResult.success の確認と非同期処理の await を行ってください。
51
51
 
52
- | 入口 | 用途 | 入力 | 出力 | 呼出し断片 |
53
- | --------------------------------- | ------------------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
54
- | `ai.llm.chat` | 単発応答 | `ChatCompletionRequest: messages, model?, signal?, tools?` | `ChatCompletionResponse: choices, model, usage?` | `ai.llm.chat({ messages: [{ role: "user", content: "你好" }] })` |
55
- | `ai.llm.chatStream` | 増分応答 | `same ChatCompletionRequest` | `AsyncIterable<ChatCompletionChunk>; iteration may throw` | `ai.llm.chatStream({ messages })` |
56
- | `ai.llm.ask` | テキスト応答 | `question: string, AskOptions?` | `string answer` | `ai.llm.ask("解释共享状态")` |
57
- | `ai.llm.askStream` | テキストストリーム | `question: string, AskOptions?` | `AsyncIterable<string>` | `ai.llm.askStream("解释共享状态")` |
58
- | `ai.llm.generateObject` | Schema 制約付き応答 | `Zod schema, messages, model?, maxRepairs?, signal?` | `schema-inferred T` | `ai.llm.generateObject({ schema: AnswerSchema, messages })` |
59
- | `ai.llm.listModels` | モデル一覧 | `none` | `string[] model IDs` | `ai.llm.listModels()` |
60
- | `ai.llm.getHistory` | 会話履歴 | `{ objectId, sessionId }, { limit?, order? }?` | `ChatRecord[]` | `ai.llm.getHistory({ objectId: "u1", sessionId: "s1" })` |
61
- | `ai.llm.listSessions` | 主体の会話一覧 | `objectId: string` | `SessionInfo[]` | `ai.llm.listSessions("u1")` |
62
- | `ai.tools.define` | ツールを定義 | `{ name, description, parameters: Zod schema, handler, timeoutMs? }` | `direct Tool<TInput,TOutput>; no init required` | `ai.tools.define(toolDefinition)` |
63
- | `ai.tools.createRegistry` | ツール一覧を管理 | `{ authorize? }?` | `direct ToolRegistryOperations; no init required` | `ai.tools.createRegistry({ authorize })` |
64
- | `ai.stream.createProcessor` | 増分を蓄積 | `none` | `direct StreamProcessor` | `ai.stream.createProcessor()` |
65
- | `ai.stream.collect` | 対話ストリームを消費 | `AsyncIterable<ChatCompletionChunk>` | `Promise<StreamResult>; stream failure rejects` | `ai.stream.collect(ai.llm.chatStream({ messages }))` |
66
- | `ai.stream.createSSEDecoder` | 分割 SSE の復号 | `none` | `direct SSEDecoder with decode/reset` | `ai.stream.createSSEDecoder()` |
67
- | `ai.stream.encodeSSE` | SSE を符号化 | `SSEEvent: data, event?, id?, retry?` | `direct string; invalid metadata throws` | `ai.stream.encodeSSE({ data: "Hello" })` |
68
- | `ai.embedding.embed` | 埋め込み要求 | `EmbeddingRequest with input/model?` | `EmbeddingResponse` | `ai.embedding.embed({ input: "产品说明" })` |
69
- | `ai.embedding.embedText` | 一文のベクトル | `text: string` | `number[]` | `ai.embedding.embedText("产品说明")` |
70
- | `ai.embedding.embedBatch` | 複数文のベクトル | `texts: string[]` | `number[][] in input order` | `ai.embedding.embedBatch(["简介", "部署"])` |
71
- | `ai.mcp.registerTool` | ローカルツール登録 | `MCPToolDefinition, typed handler` | `void` | `ai.mcp.registerTool(mcpToolDefinition, toolHandler)` |
72
- | `ai.mcp.registerResource` | 資源登録 | `MCPResource, async content handler` | `void` | `ai.mcp.registerResource(resourceDefinition, readContent)` |
73
- | `ai.mcp.registerPrompt` | プロンプト登録 | `MCPPrompt, args => Promise<MCPPromptMessage[]>` | `void` | `ai.mcp.registerPrompt(promptDefinition, buildMessages)` |
74
- | `ai.mcp.callTool` | 登録済みツール呼出し | `name, arguments, MCPContext?` | `unknown tool result` | `ai.mcp.callTool("search", { query: "配置" })` |
75
- | `ai.mcp.readResource` | 資源読取 | `resource URI` | `MCPResourceContent with exactly text or blob` | `ai.mcp.readResource("docs://intro")` |
76
- | `ai.mcp.getPrompt` | プロンプト生成 | `name, Record<string,string> arguments` | `MCPPromptMessage[]` | `ai.mcp.getPrompt("review", { topic: "API" })` |
77
- | `ai.retrieval.addSource` | 検索元を登録 | `RetrievalSource: id, collection, optional metadata` | `void` | `ai.retrieval.addSource({ id: "docs", collection: "manual" })` |
78
- | `ai.retrieval.removeSource` | 検索元を解除 | `sourceId: string` | `void` | `ai.retrieval.removeSource("docs")` |
79
- | `ai.retrieval.listSources` | 検索元一覧 | `none` | `direct Promise<RetrievalSource[]>` | `ai.retrieval.listSources()` |
80
- | `ai.retrieval.retrieve` | 候補検索 | `RetrievalRequest: query, sources?, topK?, minScore?, enableRerank?` | `RetrievalResult` | `ai.retrieval.retrieve({ query: "部署" })` |
81
- | `ai.rag.query` | 根拠付き応答 | `query: string, RagOptions?` | `RagResult: answer, context, citations, query, model` | `ai.rag.query("如何部署?", { sources: ["docs"] })` |
82
- | `ai.rag.queryStream` | 根拠付きストリーム | `query: string, RagOptions?` | `AsyncIterable<RagStreamEvent>` | `ai.rag.queryStream("如何部署?", { sources: ["docs"] })` |
83
- | `ai.knowledge.setup` | コレクションを準備 | `KnowledgeSetupOptions?` | `void; collection ready for ingest` | `ai.knowledge.setup()` |
84
- | `ai.knowledge.ingest` | 文書を公開 | `{ documentId, content, title?, collection?, ...metadata }` | `KnowledgeIngestResult with revision/cleanupPending` | `ai.knowledge.ingest({ documentId: "intro", content: "入门正文" })` |
85
- | `ai.knowledge.ingestFile` | ファイルを取込 | `KnowledgeIngestFileInput including file bytes and document identity` | `KnowledgeIngestResult` | `ai.knowledge.ingestFile(fileInput)` |
86
- | `ai.knowledge.ingestBatch` | 一括取込 | `KnowledgeIngestInput[], onProgress?` | `KnowledgeIngestBatchResult with per-document outcomes` | `ai.knowledge.ingestBatch(documentInputs, onProgress)` |
87
- | `ai.knowledge.retrieve` | 公開版の検索 | `query: string, KnowledgeRetrieveOptions?` | `KnowledgeRetrieveResult` | `ai.knowledge.retrieve("部署说明")` |
88
- | `ai.knowledge.ask` | 知識に基づく応答 | `query: string, KnowledgeAskOptions?` | `KnowledgeAskResult` | `ai.knowledge.ask("如何恢复备份?")` |
89
- | `ai.knowledge.findByEntity` | 実体から資料検索 | `entityName: string, EntityQueryOptions?` | `EntityDocumentResult[]` | `ai.knowledge.findByEntity("订单")` |
90
- | `ai.knowledge.listEntities` | 実体一覧 | `EntityListOptions?` | `KnowledgeEntity[]` | `ai.knowledge.listEntities()` |
91
- | `ai.knowledge.listDocuments` | 文書一覧 | `KnowledgeDocumentListOptions?` | `KnowledgeDocumentInfo[]` | `ai.knowledge.listDocuments()` |
92
- | `ai.knowledge.removeDocument` | 文書の公開解除 | `documentId, KnowledgeDocumentRemoveOptions?` | `void; may fail after visibility revocation if cleanup fails` | `ai.knowledge.removeDocument("intro")` |
93
- | `ai.knowledge.repair` | 残留ベクトルの補償 | `{ collection?, offset?, limit? }` | `KnowledgeRepairResult with progress` | `ai.knowledge.repair({ offset: 0, limit: 100 })` |
94
- | `ai.knowledge.deleteCollection` | コレクションを解除 | `collection name?` | `void; cleanup tombstone remains` | `ai.knowledge.deleteCollection("retired-manual")` |
95
- | `ai.memory.scoped` | 信頼する主体を束縛 | `{ objectId: nonempty string, scope? }` | `direct ScopedMemoryOperations; invalid binding throws TypeError` | `ai.memory.scoped({ objectId: "u1", scope: { topicId: "orders" } })` |
96
- | `ai.memory.extract` | 記憶を抽出 | `ChatMessage[], { objectId, scope?, model?, signal?, ...options }` | `MemoryEntry[]` | `ai.memory.extract(messages, { objectId: "u1" })` |
97
- | `ai.memory.add` | 明示的記憶を保存 | `MemoryEntryInput: objectId, content, type, scope?` | `MemoryEntry` | `ai.memory.add({ objectId: "u1", content: "偏好中文", type: "preference" })` |
98
- | `ai.memory.get` | 所有者の記憶を読取 | `memoryId, { objectId, scope? } for untrusted IDs` | `MemoryEntry` | `ai.memory.get(memoryId, { objectId: "u1" })` |
99
- | `ai.memory.update` | 記憶を更新 | `memoryId, MemoryUpdateInput, trusted access scope` | `MemoryEntry` | `ai.memory.update(memoryId, { content: "偏好日文" }, { objectId: "u1" })` |
100
- | `ai.memory.remove` | 所有者の記憶を削除 | `memoryId, trusted access scope` | `void` | `ai.memory.remove(memoryId, { objectId: "u1" })` |
101
- | `ai.memory.recall` | 関連記憶の検索 | `query, { objectId, scope?, topK?, types?, ...options }` | `MemoryEntry[]` | `ai.memory.recall("语言偏好", { objectId: "u1" })` |
102
- | `ai.memory.injectMemories` | 会話の文脈を補足 | `ChatMessage[], { objectId, scope?, topK?, ...options }` | `ChatMessage[]` | `ai.memory.injectMemories(messages, { objectId: "u1" })` |
103
- | `ai.memory.list` | 記憶一覧 | `MemoryListOptions with objectId/scope filters` | `MemoryEntry[]; incomplete scan fails` | `ai.memory.list({ objectId: "u1" })` |
104
- | `ai.memory.listPage` | 記憶のページ表示 | `MemoryListPageOptions with objectId/pagination` | `StorePage<MemoryEntry>` | `ai.memory.listPage({ objectId: "u1", offset: 0, limit: 20 })` |
105
- | `ai.memory.clear` | 指定範囲を解除 | `nonempty MemoryClearOptions` | `void; empty filters are rejected` | `ai.memory.clear({ objectId: "u1" })` |
106
- | `ai.memory.admin.clearAll` | 信頼された管理者の全解除 | `{ confirm: true }; require host administrator authorization` | `void; destructive across subjects` | `ai.memory.admin.clearAll({ confirm: true })` |
107
- | `ai.persona.save` | ペルソナを保存 | `PersonaProfileInput: id, name, systemPrompt, objectId?, traits?` | `PersonaProfile` | `ai.persona.save(personaProfile)` |
108
- | `ai.persona.get` | ペルソナを読取 | `id, { objectId }?; omitted subject selects system profile` | `PersonaProfile` | `ai.persona.get("tutor", { objectId: "u1" })` |
109
- | `ai.persona.update` | ペルソナを更新 | `id, PersonaProfileUpdate, { objectId }?` | `PersonaProfile` | `ai.persona.update("tutor", updates, { objectId: "u1" })` |
110
- | `ai.persona.remove` | ペルソナを削除 | `id, { objectId }?` | `void` | `ai.persona.remove("tutor", { objectId: "u1" })` |
111
- | `ai.persona.list` | ペルソナ一覧 | `{ objectId }?` | `PersonaProfile[]` | `ai.persona.list({ objectId: "u1" })` |
112
- | `ai.persona.compose` | システム指示を合成 | `id, { objectId }?` | `string prompt` | `ai.persona.compose("tutor", { objectId: "u1" })` |
113
- | `ai.token.estimateText` | 文章 Token の推定 | `text: string` | `direct number; estimate, not billing usage` | `ai.token.estimateText("Hello 世界")` |
114
- | `ai.token.estimateMessages` | メッセージ Token の推定 | `ChatMessage[]` | `direct number including protocol overhead` | `ai.token.estimateMessages(messages)` |
115
- | `ai.summary.generate` | 要約本文を生成 | `ChatMessage[], SummaryOptions?` | `string` | `ai.summary.generate(messages)` |
116
- | `ai.summary.summarize` | 要約と対象情報 | `ChatMessage[], SummaryOptions?` | `{ summary, tokenCount, coveredMessages }` | `ai.summary.summarize(messages)` |
117
- | `ai.compress.tryCompress` | 予算に合わせて圧縮 | `ChatMessage[], { strategy?, maxTokens?, preserveLastN?, ...options }` | `CompressResult: messages and original/compressed token counts` | `ai.compress.tryCompress(messages, { maxTokens: 4000 })` |
118
- | `ai.context.createManager` | 複数回対話を開始 | `ContextManagerOptions with scope { objectId, sessionId }` | `ContextManager` | `ai.context.createManager({ scope: { objectId: "u1", sessionId: "s1" } })` |
119
- | `ai.context.restoreManager` | 対話を復元 | `{ objectId, sessionId }, options?` | `ContextManager` | `ai.context.restoreManager({ objectId: "u1", sessionId: "s1" })` |
120
- | `ai.context.listSessions` | 保存会話を一覧 | `objectId` | `SessionInfo[]` | `ai.context.listSessions("u1")` |
121
- | `ai.context.renameSession` | 会話名を変更 | `scope, title` | `void` | `ai.context.renameSession({ objectId: "u1", sessionId: "s1" }, "订单讨论")` |
122
- | `ai.context.removeSession` | 会話を削除 | `scope` | `void; tombstone prevents scope reuse` | `ai.context.removeSession({ objectId: "u1", sessionId: "s1" })` |
123
- | `ai.rerank.rerank` | 文書の順位付け | `RerankRequest: query, documents, model?, topN?` | `RerankResponse with model/results` | `ai.rerank.rerank({ query: "部署", documents: ["配置说明"] })` |
124
- | `ai.rerank.rerankTexts` | テキストの順位付け | `query, string[] texts, topN?` | `RerankItem[] with index/relevanceScore` | `ai.rerank.rerankTexts("部署", ["配置说明"], 1)` |
125
- | `ai.file.parse` | ファイル解析 | `FileParseRequest with content, filename, options?` | `FileParseResult; extraction is not HTML sanitization` | `ai.file.parse({ content: "<p>正文</p>", filename: "intro.html" })` |
126
- | `ai.file.parseText` | 本文抽出 | `Buffer\|string content, filename?` | `string` | `ai.file.parseText("Hello", "intro.txt")` |
127
- | `ai.reasoning.run` | 多段推論 | `query, ReasoningOptions including strategy/tools?` | `ReasoningResult` | `ai.reasoning.run("审查方案", { strategy: "cot" })` |
128
- | `ai.reasoning.runStream` | 推論過程を観察 | `query, ReasoningOptions?` | `AsyncIterable<ReasoningStreamEvent>` | `ai.reasoning.runStream("审查方案", { strategy: "react" })` |
129
- | `ai.audio.transcribe` | 音声認識 | `TranscriptionRequest: audio, language?, model?, signal?` | `TranscriptionResult: text, language?, segments?` | `ai.audio.transcribe({ audio: { data: wavBytes, format: "wav" } })` |
130
- | `ai.audio.transcribeStream` | 連続音声認識 | `TranscriptionStreamRequest: chunks or complete audio` | `AsyncIterable<TranscriptionEvent>` | `ai.audio.transcribeStream(transcriptionInput)` |
131
- | `ai.audio.synthesize` | 音声合成 | `SynthesisRequest: text, language?, model?, signal?` | `SynthesisResult: audio and duration metadata` | `ai.audio.synthesize({ text: "你好" })` |
132
- | `ai.audio.synthesizeStream` | 区間ごとの音声合成 | `SynthesisStreamRequest: text segment or async segments` | `AsyncIterable<SynthesisEvent>` | `ai.audio.synthesizeStream(synthesisInput)` |
133
- | `ai.audio.getCapabilities` | 能力を先に確認 | `{ operation: transcribe\|synthesize, model? }` | `AudioModelCapabilities` | `ai.audio.getCapabilities({ operation: "synthesize" })` |
134
- | `ai.image.generate` | 画像生成 | `{ prompt, referenceImages?, model?, size?, signal? }` | `{ images: GeneratedImage[] } with bytes/MIME` | `ai.image.generate({ prompt: "一座灯塔" })` |
135
- | `ai.a2a.registerExecutor` | 実行器の登録 | `SDK AgentExecutor` | `void` | `ai.a2a.registerExecutor(executor)` |
136
- | `ai.a2a.getAgentCard` | 標準発見文書 | `none; configured a2a card` | `A2AAgentCardDocument (A2A 1.0 ProtoJSON)` | `ai.a2a.getAgentCard()` |
137
- | `ai.a2a.handleRequest` | 認証済み要求を処理 | `unknown JSON-RPC body, trusted context.agentId?` | `direct Promise<A2AHandleResult>; JSON-RPC/SSE outcome` | `ai.a2a.handleRequest(body, { agentId: trustedAgentId })` |
138
- | `ai.a2a.listMessages` | 管理用メッセージ検索 | `A2ATaskFilter: callerId?, contextId?, since?, pagination?` | `StorePage<A2AMessageRecord>` | `ai.a2a.listMessages(messageFilter)` |
139
- | `ai.a2a.callRemoteAgent` | 許可された遠隔を呼出し | `allowlisted HTTPS URL, message, A2ACallOptions?` | `A2ACallResult` | `ai.a2a.callRemoteAgent("https://agent.example.com/a2a", "请分析订单")` |
140
- | `ai.init` | サービス準備 | `AIConfigInput?, AIInitOptions?` | `HaiResult<void>; validate dependencies before use` | `ai.init({ llm: { apiKey: process.env.HAI_AI_LLM_APIKEY } })` |
141
- | `ai.close` | サービス解放 | `none` | `Promise<void>; wait for cleanup` | `ai.close()` |
142
- | `ai.config` | 安全な設定参照 | `none` | `redacted AIConfig or null` | `ai.config` |
143
- | `ai.isInitialized` | 状態確認 | `none` | `boolean` | `ai.isInitialized` |
144
- | `ai.llm.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.llm.models.list()` |
145
- | `ai.llm.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.llm.models.get("coding")` |
146
- | `ai.llm.models.register` | DB 定義を登録 | `ModelEntry input (id/model/protocol/credentials/capabilities)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.llm.models.register(modelDefinition)` |
147
- | `ai.llm.models.update` | 版を条件に置換 | `ModelEntry input (id/model/protocol/credentials/capabilities), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.llm.models.update(modelDefinition, current.data.version)` |
148
- | `ai.llm.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.llm.models.remove("coding", current.data.version)` |
149
- | `ai.audio.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.audio.models.list()` |
150
- | `ai.audio.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.audio.models.get("speech")` |
151
- | `ai.audio.models.register` | DB 定義を登録 | `AudioModelEntry input (id/provider/model/operations)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.audio.models.register(audioModelDefinition)` |
152
- | `ai.audio.models.update` | 版を条件に置換 | `AudioModelEntry input (id/provider/model/operations), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.audio.models.update(audioModelDefinition, current.data.version)` |
153
- | `ai.audio.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.audio.models.remove("speech", current.data.version)` |
154
- | `ai.image.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.image.models.list()` |
155
- | `ai.image.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.image.models.get("poster")` |
156
- | `ai.image.models.register` | DB 定義を登録 | `ImageModelEntry input (id/provider/model)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.image.models.register(imageModelDefinition)` |
157
- | `ai.image.models.update` | 版を条件に置換 | `ImageModelEntry input (id/provider/model), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.image.models.update(imageModelDefinition, current.data.version)` |
158
- | `ai.image.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.image.models.remove("poster", current.data.version)` |
159
- | `ai.mcp.servers.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.mcp.servers.list()` |
160
- | `ai.mcp.servers.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.mcp.servers.get("tools")` |
161
- | `ai.mcp.servers.register` | DB 定義を登録 | `MCPExternalServer input (id/transport/url or command)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.mcp.servers.register(mcpServerDefinition)` |
162
- | `ai.mcp.servers.update` | 版を条件に置換 | `MCPExternalServer input (id/transport/url or command), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.mcp.servers.update(mcpServerDefinition, current.data.version)` |
163
- | `ai.mcp.servers.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.mcp.servers.remove("tools", current.data.version)` |
164
- | `ai.retrieval.sources.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.retrieval.sources.list()` |
165
- | `ai.retrieval.sources.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.retrieval.sources.get("docs")` |
166
- | `ai.retrieval.sources.register` | DB 定義を登録 | `RetrievalSource input (id/collection)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.retrieval.sources.register(sourceDefinition)` |
167
- | `ai.retrieval.sources.update` | 版を条件に置換 | `RetrievalSource input (id/collection), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.retrieval.sources.update(sourceDefinition, current.data.version)` |
168
- | `ai.retrieval.sources.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.retrieval.sources.remove("docs", current.data.version)` |
169
- | `ai.acp.agents.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.acp.agents.list()` |
170
- | `ai.acp.agents.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.acp.agents.get("coder")` |
171
- | `ai.acp.agents.register` | DB 定義を登録 | `ACPAgent input (id/mode/adapter/modelIds)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.acp.agents.register(agentDefinition)` |
172
- | `ai.acp.agents.update` | 版を条件に置換 | `ACPAgent input (id/mode/adapter/modelIds), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.acp.agents.update(agentDefinition, current.data.version)` |
173
- | `ai.acp.agents.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.acp.agents.remove("coder", current.data.version)` |
174
- | `ai.acp.workspaces.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.acp.workspaces.list()` |
175
- | `ai.acp.workspaces.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.acp.workspaces.get("project")` |
176
- | `ai.acp.workspaces.register` | DB 定義を登録 | `ACPWorkspace input (id/storage/repositories)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.acp.workspaces.register(workspaceDefinition)` |
177
- | `ai.acp.workspaces.update` | 版を条件に置換 | `ACPWorkspace input (id/storage/repositories), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.acp.workspaces.update(workspaceDefinition, current.data.version)` |
178
- | `ai.acp.workspaces.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.acp.workspaces.remove("project", current.data.version)` |
179
- | `ai.acp.agents.initialize` | エージェント事前確認 | `agentId, modelId?` | `HaiResult<{ agentId, mode, modelIds }>; no credentials` | `ai.acp.agents.initialize("coder")` |
180
- | `ai.acp.agents.check` | 実接続と握手 | `agentId, { workspaceId?, ...ACPClientOptions }` | `HaiResult<native initialize response>; owned connection is closed` | `ai.acp.agents.check("coder", { workspaceId: "project" })` |
181
- | `ai.acp.workspaces.prepare` | 作業領域を準備 | `workspaceId` | `HaiResult<main absolute path>; dirty content is retained` | `ai.acp.workspaces.prepare("project")` |
182
- | `ai.acp.workspaces.importFiles` | 制御ファイル取込 | `workspaceId, { path: relative path, content: string\|Uint8Array }[]` | `HaiResult<{ imported: string[] }>; no overwrite` | `ai.acp.workspaces.importFiles("project", [{ path: "notes.txt", content: "需求" }])` |
183
- | `ai.acp.sessions.create` | 管理会話を開始 | `ACPCreateSessionOptions: agentId/workspaceId/newWorktree?` | `HaiResult<managed session handle>` | `ai.acp.sessions.create({ agentId: "coder", workspaceId: "project", newWorktree: true })` |
184
- | `ai.acp.sessions.get` | 会話ハンドル参照 | `framework session id` | `HaiResult<managed session handle>; does not resume` | `ai.acp.sessions.get("task-1")` |
185
- | `ai.acp.sessions.list` | 管理会話一覧 | `workspaceId?` | `HaiResult<ACPSessionInfo[]>` | `ai.acp.sessions.list("project")` |
186
- | `ai.acp.sessions.resume` | ネイティブ会話再開 | `framework session id, ACPClientOptions?` | `HaiResult<managed session handle>; definition changes may reject` | `ai.acp.sessions.resume("task-1")` |
187
- | `ai.acp.sessions.close` | 所有する実行を停止 | `framework session id` | `HaiResult<void>; source and native history retained` | `ai.acp.sessions.close("task-1")` |
188
- | `ai.acp.sessions.reclaimWorktree` | 清浄な worktree を回収 | `closed framework session id; preview stopped and changes saved` | `HaiResult<void>; branch and normal files retained` | `ai.acp.sessions.reclaimWorktree("task-1")` |
189
- | `ai.acp.sessions.remove` | 会話記録を削除 | `closed or failed framework session id` | `HaiResult<void>; worktree and native history retained` | `ai.acp.sessions.remove("task-1")` |
190
- | `ai.acp.connect` | 原生転送へ接続 | `ACPTransport: stdio/http/ws, ACPClientOptions?` | `HaiResult<connection handle>` | `ai.acp.connect({ type: "http", url: "https://agent.example.com/acp" })` |
191
- | `ai.acp.close` | サブシステムを閉じる | `none; normally call ai.close()` | `Promise<void>; cleanup may throw` | `ai.acp.close()` |
52
+ | 入口 | 用途 | 入力 | 出力 | 呼出し断片 |
53
+ | --------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
54
+ | `ai.llm.chat` | 単発応答 | `ChatCompletionRequest: messages, model?, signal?, tools?` | `ChatCompletionResponse: choices, model, usage?` | `ai.llm.chat({ messages: [{ role: "user", content: "你好" }] })` |
55
+ | `ai.llm.chatStream` | 増分応答 | `same ChatCompletionRequest` | `AsyncIterable<ChatCompletionChunk>; iteration may throw` | `ai.llm.chatStream({ messages })` |
56
+ | `ai.llm.ask` | テキスト応答 | `question: string, AskOptions?` | `string answer` | `ai.llm.ask("解释共享状态")` |
57
+ | `ai.llm.askStream` | テキストストリーム | `question: string, AskOptions?` | `AsyncIterable<string>` | `ai.llm.askStream("解释共享状态")` |
58
+ | `ai.llm.generateObject` | Schema 制約付き応答 | `Zod schema, messages, model?, maxRepairs?, signal?` | `schema-inferred T` | `ai.llm.generateObject({ schema: AnswerSchema, messages })` |
59
+ | `ai.llm.listModels` | モデル一覧 | `none` | `string[] model IDs` | `ai.llm.listModels()` |
60
+ | `ai.llm.getHistory` | 会話履歴 | `{ objectId, sessionId }, { limit?, order? }?` | `ChatRecord[]` | `ai.llm.getHistory({ objectId: "u1", sessionId: "s1" })` |
61
+ | `ai.llm.listSessions` | 主体の会話一覧 | `objectId: string` | `SessionInfo[]` | `ai.llm.listSessions("u1")` |
62
+ | `ai.tools.define` | ツールを定義 | `{ name, description, parameters: Zod schema, handler, timeoutMs? }` | `direct Tool<TInput,TOutput>; no init required` | `ai.tools.define(toolDefinition)` |
63
+ | `ai.tools.createRegistry` | ツール一覧を管理 | `{ authorize? }?` | `direct ToolRegistryOperations; no init required` | `ai.tools.createRegistry({ authorize })` |
64
+ | `ai.stream.createProcessor` | 増分を蓄積 | `none` | `direct StreamProcessor` | `ai.stream.createProcessor()` |
65
+ | `ai.stream.collect` | 対話ストリームを消費 | `AsyncIterable<ChatCompletionChunk>` | `Promise<StreamResult>; stream failure rejects` | `ai.stream.collect(ai.llm.chatStream({ messages }))` |
66
+ | `ai.stream.createSSEDecoder` | 分割 SSE の復号 | `none` | `direct SSEDecoder with decode/reset` | `ai.stream.createSSEDecoder()` |
67
+ | `ai.stream.encodeSSE` | SSE を符号化 | `SSEEvent: data, event?, id?, retry?` | `direct string; invalid metadata throws` | `ai.stream.encodeSSE({ data: "Hello" })` |
68
+ | `ai.embedding.embed` | 埋め込み要求 | `EmbeddingRequest with input/model?` | `EmbeddingResponse` | `ai.embedding.embed({ input: "产品说明" })` |
69
+ | `ai.embedding.embedText` | 一文のベクトル | `text: string` | `number[]` | `ai.embedding.embedText("产品说明")` |
70
+ | `ai.embedding.embedBatch` | 複数文のベクトル | `texts: string[]` | `number[][] in input order` | `ai.embedding.embedBatch(["简介", "部署"])` |
71
+ | `ai.mcp.registerTool` | ローカルツール登録 | `MCPToolDefinition, typed handler` | `void` | `ai.mcp.registerTool(mcpToolDefinition, toolHandler)` |
72
+ | `ai.mcp.registerResource` | 資源登録 | `MCPResource, async content handler` | `void` | `ai.mcp.registerResource(resourceDefinition, readContent)` |
73
+ | `ai.mcp.registerPrompt` | プロンプト登録 | `MCPPrompt, args => Promise<MCPPromptMessage[]>` | `void` | `ai.mcp.registerPrompt(promptDefinition, buildMessages)` |
74
+ | `ai.mcp.callTool` | 登録済みツール呼出し | `name, arguments, MCPContext?` | `unknown tool result` | `ai.mcp.callTool("search", { query: "配置" })` |
75
+ | `ai.mcp.readResource` | 資源読取 | `resource URI` | `MCPResourceContent with exactly text or blob` | `ai.mcp.readResource("docs://intro")` |
76
+ | `ai.mcp.getPrompt` | プロンプト生成 | `name, Record<string,string> arguments` | `MCPPromptMessage[]` | `ai.mcp.getPrompt("review", { topic: "API" })` |
77
+ | `ai.mcp.services.invoke` | 許可されたリモートツールの呼び出し | リクエスト、認証済み主体、認可関数 | `HaiResult<CallToolResult>` | `ai.mcp.services.invoke(request, authorization)` |
78
+ | `ai.mcp.services.createBroker` | ACP セッション用ツールのエンドポイント | 固定 URL と呼び出しごとの認可関数 | `HaiResult<MCPServiceBroker>` | `ai.mcp.services.createBroker(brokerOptions)` |
79
+ | `ai.retrieval.addSource` | 検索元を登録 | `RetrievalSource: id, collection, optional metadata` | `void` | `ai.retrieval.addSource({ id: "docs", collection: "manual" })` |
80
+ | `ai.retrieval.removeSource` | 検索元を解除 | `sourceId: string` | `void` | `ai.retrieval.removeSource("docs")` |
81
+ | `ai.retrieval.listSources` | 検索元一覧 | `none` | `direct Promise<RetrievalSource[]>` | `ai.retrieval.listSources()` |
82
+ | `ai.retrieval.retrieve` | 候補検索 | `RetrievalRequest: query, sources?, topK?, minScore?, enableRerank?` | `RetrievalResult` | `ai.retrieval.retrieve({ query: "部署" })` |
83
+ | `ai.rag.query` | 根拠付き応答 | `query: string, RagOptions?` | `RagResult: answer, context, citations, query, model` | `ai.rag.query("如何部署?", { sources: ["docs"] })` |
84
+ | `ai.rag.queryStream` | 根拠付きストリーム | `query: string, RagOptions?` | `AsyncIterable<RagStreamEvent>` | `ai.rag.queryStream("如何部署?", { sources: ["docs"] })` |
85
+ | `ai.knowledge.setup` | コレクションを準備 | `KnowledgeSetupOptions?` | `void; collection ready for ingest` | `ai.knowledge.setup()` |
86
+ | `ai.knowledge.ingest` | 文書を公開 | `{ documentId, content, title?, collection?, ...metadata }` | `KnowledgeIngestResult with revision/cleanupPending` | `ai.knowledge.ingest({ documentId: "intro", content: "入门正文" })` |
87
+ | `ai.knowledge.ingestFile` | ファイルを取込 | `KnowledgeIngestFileInput including file bytes and document identity` | `KnowledgeIngestResult` | `ai.knowledge.ingestFile(fileInput)` |
88
+ | `ai.knowledge.ingestBatch` | 一括取込 | `KnowledgeIngestInput[], onProgress?` | `KnowledgeIngestBatchResult with per-document outcomes` | `ai.knowledge.ingestBatch(documentInputs, onProgress)` |
89
+ | `ai.knowledge.retrieve` | 公開版の検索 | `query: string, KnowledgeRetrieveOptions?` | `KnowledgeRetrieveResult` | `ai.knowledge.retrieve("部署说明")` |
90
+ | `ai.knowledge.ask` | 知識に基づく応答 | `query: string, KnowledgeAskOptions?` | `KnowledgeAskResult` | `ai.knowledge.ask("如何恢复备份?")` |
91
+ | `ai.knowledge.findByEntity` | 実体から資料検索 | `entityName: string, EntityQueryOptions?` | `EntityDocumentResult[]` | `ai.knowledge.findByEntity("订单")` |
92
+ | `ai.knowledge.listEntities` | 実体一覧 | `EntityListOptions?` | `KnowledgeEntity[]` | `ai.knowledge.listEntities()` |
93
+ | `ai.knowledge.listDocuments` | 文書一覧 | `KnowledgeDocumentListOptions?` | `KnowledgeDocumentInfo[]` | `ai.knowledge.listDocuments()` |
94
+ | `ai.knowledge.removeDocument` | 文書の公開解除 | `documentId, KnowledgeDocumentRemoveOptions?` | `void; may fail after visibility revocation if cleanup fails` | `ai.knowledge.removeDocument("intro")` |
95
+ | `ai.knowledge.repair` | 残留ベクトルの補償 | `{ collection?, offset?, limit? }` | `KnowledgeRepairResult with progress` | `ai.knowledge.repair({ offset: 0, limit: 100 })` |
96
+ | `ai.knowledge.deleteCollection` | コレクションを解除 | `collection name?` | `void; cleanup tombstone remains` | `ai.knowledge.deleteCollection("retired-manual")` |
97
+ | `ai.memory.scoped` | 信頼する主体を束縛 | `{ objectId: nonempty string, scope? }` | `direct ScopedMemoryOperations; invalid binding throws TypeError` | `ai.memory.scoped({ objectId: "u1", scope: { topicId: "orders" } })` |
98
+ | `ai.memory.extract` | 記憶を抽出 | `ChatMessage[], { objectId, scope?, model?, signal?, ...options }` | `MemoryEntry[]` | `ai.memory.extract(messages, { objectId: "u1" })` |
99
+ | `ai.memory.add` | 明示的記憶を保存 | `MemoryEntryInput: objectId, content, type, scope?` | `MemoryEntry` | `ai.memory.add({ objectId: "u1", content: "偏好中文", type: "preference" })` |
100
+ | `ai.memory.get` | 所有者の記憶を読取 | `memoryId, { objectId, scope? } for untrusted IDs` | `MemoryEntry` | `ai.memory.get(memoryId, { objectId: "u1" })` |
101
+ | `ai.memory.update` | 記憶を更新 | `memoryId, MemoryUpdateInput, trusted access scope` | `MemoryEntry` | `ai.memory.update(memoryId, { content: "偏好日文" }, { objectId: "u1" })` |
102
+ | `ai.memory.remove` | 所有者の記憶を削除 | `memoryId, trusted access scope` | `void` | `ai.memory.remove(memoryId, { objectId: "u1" })` |
103
+ | `ai.memory.recall` | 関連記憶の検索 | `query, { objectId, scope?, topK?, types?, ...options }` | `MemoryEntry[]` | `ai.memory.recall("语言偏好", { objectId: "u1" })` |
104
+ | `ai.memory.injectMemories` | 会話の文脈を補足 | `ChatMessage[], { objectId, scope?, topK?, ...options }` | `ChatMessage[]` | `ai.memory.injectMemories(messages, { objectId: "u1" })` |
105
+ | `ai.memory.list` | 記憶一覧 | `MemoryListOptions with objectId/scope filters` | `MemoryEntry[]; incomplete scan fails` | `ai.memory.list({ objectId: "u1" })` |
106
+ | `ai.memory.listPage` | 記憶のページ表示 | `MemoryListPageOptions with objectId/pagination` | `StorePage<MemoryEntry>` | `ai.memory.listPage({ objectId: "u1", offset: 0, limit: 20 })` |
107
+ | `ai.memory.clear` | 指定範囲を解除 | `nonempty MemoryClearOptions` | `void; empty filters are rejected` | `ai.memory.clear({ objectId: "u1" })` |
108
+ | `ai.memory.admin.clearAll` | 信頼された管理者の全解除 | `{ confirm: true }; require host administrator authorization` | `void; destructive across subjects` | `ai.memory.admin.clearAll({ confirm: true })` |
109
+ | `ai.persona.save` | ペルソナを保存 | `PersonaProfileInput: id, name, systemPrompt, objectId?, traits?` | `PersonaProfile` | `ai.persona.save(personaProfile)` |
110
+ | `ai.persona.get` | ペルソナを読取 | `id, { objectId }?; omitted subject selects system profile` | `PersonaProfile` | `ai.persona.get("tutor", { objectId: "u1" })` |
111
+ | `ai.persona.update` | ペルソナを更新 | `id, PersonaProfileUpdate, { objectId }?` | `PersonaProfile` | `ai.persona.update("tutor", updates, { objectId: "u1" })` |
112
+ | `ai.persona.remove` | ペルソナを削除 | `id, { objectId }?` | `void` | `ai.persona.remove("tutor", { objectId: "u1" })` |
113
+ | `ai.persona.list` | ペルソナ一覧 | `{ objectId }?` | `PersonaProfile[]` | `ai.persona.list({ objectId: "u1" })` |
114
+ | `ai.persona.compose` | システム指示を合成 | `id, { objectId }?` | `string prompt` | `ai.persona.compose("tutor", { objectId: "u1" })` |
115
+ | `ai.token.estimateText` | 文章 Token の推定 | `text: string` | `direct number; estimate, not billing usage` | `ai.token.estimateText("Hello 世界")` |
116
+ | `ai.token.estimateMessages` | メッセージ Token の推定 | `ChatMessage[]` | `direct number including protocol overhead` | `ai.token.estimateMessages(messages)` |
117
+ | `ai.summary.generate` | 要約本文を生成 | `ChatMessage[], SummaryOptions?` | `string` | `ai.summary.generate(messages)` |
118
+ | `ai.summary.summarize` | 要約と対象情報 | `ChatMessage[], SummaryOptions?` | `{ summary, tokenCount, coveredMessages }` | `ai.summary.summarize(messages)` |
119
+ | `ai.compress.tryCompress` | 予算に合わせて圧縮 | `ChatMessage[], { strategy?, maxTokens?, preserveLastN?, ...options }` | `CompressResult: messages and original/compressed token counts` | `ai.compress.tryCompress(messages, { maxTokens: 4000 })` |
120
+ | `ai.context.createManager` | 複数回対話を開始 | `ContextManagerOptions with scope { objectId, sessionId }` | `ContextManager` | `ai.context.createManager({ scope: { objectId: "u1", sessionId: "s1" } })` |
121
+ | `ai.context.restoreManager` | 対話を復元 | `{ objectId, sessionId }, options?` | `ContextManager` | `ai.context.restoreManager({ objectId: "u1", sessionId: "s1" })` |
122
+ | `ai.context.listSessions` | 保存会話を一覧 | `objectId` | `SessionInfo[]` | `ai.context.listSessions("u1")` |
123
+ | `ai.context.renameSession` | 会話名を変更 | `scope, title` | `void` | `ai.context.renameSession({ objectId: "u1", sessionId: "s1" }, "订单讨论")` |
124
+ | `ai.context.removeSession` | 会話を削除 | `scope` | `void; tombstone prevents scope reuse` | `ai.context.removeSession({ objectId: "u1", sessionId: "s1" })` |
125
+ | `ai.rerank.rerank` | 文書の順位付け | `RerankRequest: query, documents, model?, topN?` | `RerankResponse with model/results` | `ai.rerank.rerank({ query: "部署", documents: ["配置说明"] })` |
126
+ | `ai.rerank.rerankTexts` | テキストの順位付け | `query, string[] texts, topN?` | `RerankItem[] with index/relevanceScore` | `ai.rerank.rerankTexts("部署", ["配置说明"], 1)` |
127
+ | `ai.file.parse` | ファイル解析 | `FileParseRequest with content, filename, options?` | `FileParseResult; extraction is not HTML sanitization` | `ai.file.parse({ content: "<p>正文</p>", filename: "intro.html" })` |
128
+ | `ai.file.parseText` | 本文抽出 | `Buffer\|string content, filename?` | `string` | `ai.file.parseText("Hello", "intro.txt")` |
129
+ | `ai.reasoning.run` | 多段推論 | `query, ReasoningOptions including strategy/tools?` | `ReasoningResult` | `ai.reasoning.run("审查方案", { strategy: "cot" })` |
130
+ | `ai.reasoning.runStream` | 推論過程を観察 | `query, ReasoningOptions?` | `AsyncIterable<ReasoningStreamEvent>` | `ai.reasoning.runStream("审查方案", { strategy: "react" })` |
131
+ | `ai.audio.transcribe` | 音声認識 | `TranscriptionRequest: audio, language?, model?, signal?` | `TranscriptionResult: text, language?, segments?` | `ai.audio.transcribe({ audio: { data: wavBytes, format: "wav" } })` |
132
+ | `ai.audio.transcribeStream` | 連続音声認識 | `TranscriptionStreamRequest: chunks or complete audio` | `AsyncIterable<TranscriptionEvent>` | `ai.audio.transcribeStream(transcriptionInput)` |
133
+ | `ai.audio.synthesize` | 音声合成 | `SynthesisRequest: text, language?, model?, signal?` | `SynthesisResult: audio and duration metadata` | `ai.audio.synthesize({ text: "你好" })` |
134
+ | `ai.audio.synthesizeStream` | 区間ごとの音声合成 | `SynthesisStreamRequest: text segment or async segments` | `AsyncIterable<SynthesisEvent>` | `ai.audio.synthesizeStream(synthesisInput)` |
135
+ | `ai.audio.getCapabilities` | 能力を先に確認 | `{ operation: transcribe\|synthesize, model? }` | `AudioModelCapabilities` | `ai.audio.getCapabilities({ operation: "synthesize" })` |
136
+ | `ai.image.generate` | 画像生成 | `{ prompt, referenceImages?, model?, size?, signal? }` | `{ images: GeneratedImage[] } with bytes/MIME` | `ai.image.generate({ prompt: "一座灯塔" })` |
137
+ | `ai.a2a.registerExecutor` | 実行器の登録 | `SDK AgentExecutor` | `void` | `ai.a2a.registerExecutor(executor)` |
138
+ | `ai.a2a.getAgentCard` | 標準発見文書 | `none; configured a2a card` | `A2AAgentCardDocument (A2A 1.0 ProtoJSON)` | `ai.a2a.getAgentCard()` |
139
+ | `ai.a2a.handleRequest` | 認証済み要求を処理 | `unknown JSON-RPC body, trusted context.agentId?` | `direct Promise<A2AHandleResult>; JSON-RPC/SSE outcome` | `ai.a2a.handleRequest(body, { agentId: trustedAgentId })` |
140
+ | `ai.a2a.listMessages` | 管理用メッセージ検索 | `A2ATaskFilter: callerId?, contextId?, since?, pagination?` | `StorePage<A2AMessageRecord>` | `ai.a2a.listMessages(messageFilter)` |
141
+ | `ai.a2a.callRemoteAgent` | 許可された遠隔を呼出し | `allowlisted HTTPS URL, message, A2ACallOptions?` | `A2ACallResult` | `ai.a2a.callRemoteAgent("https://agent.example.com/a2a", "请分析订单")` |
142
+ | `ai.init` | サービス準備 | `AIConfigInput?, AIInitOptions?` | `HaiResult<void>; validate dependencies before use` | `ai.init({ llm: { apiKey: process.env.HAI_AI_LLM_APIKEY } })` |
143
+ | `ai.close` | サービス解放 | `none` | `Promise<void>; wait for cleanup` | `ai.close()` |
144
+ | `ai.config` | 安全な設定参照 | `none` | `redacted AIConfig or null` | `ai.config` |
145
+ | `ai.isInitialized` | 状態確認 | `none` | `boolean` | `ai.isInitialized` |
146
+ | `ai.llm.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.llm.models.list()` |
147
+ | `ai.llm.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.llm.models.get("coding")` |
148
+ | `ai.llm.models.register` | DB 定義を登録 | `ModelEntry input (id/model/protocol/credentials/capabilities)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.llm.models.register(modelDefinition)` |
149
+ | `ai.llm.models.update` | 版を条件に置換 | `ModelEntry input (id/model/protocol/credentials/capabilities), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.llm.models.update(modelDefinition, current.data.version)` |
150
+ | `ai.llm.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.llm.models.remove("coding", current.data.version)` |
151
+ | `ai.audio.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.audio.models.list()` |
152
+ | `ai.audio.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.audio.models.get("speech")` |
153
+ | `ai.audio.models.register` | DB 定義を登録 | `AudioModelEntry input (id/provider/model/operations)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.audio.models.register(audioModelDefinition)` |
154
+ | `ai.audio.models.update` | 版を条件に置換 | `AudioModelEntry input (id/provider/model/operations), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.audio.models.update(audioModelDefinition, current.data.version)` |
155
+ | `ai.audio.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.audio.models.remove("speech", current.data.version)` |
156
+ | `ai.image.models.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.image.models.list()` |
157
+ | `ai.image.models.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.image.models.get("poster")` |
158
+ | `ai.image.models.register` | DB 定義を登録 | `ImageModelEntry input (id/provider/model)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.image.models.register(imageModelDefinition)` |
159
+ | `ai.image.models.update` | 版を条件に置換 | `ImageModelEntry input (id/provider/model), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.image.models.update(imageModelDefinition, current.data.version)` |
160
+ | `ai.image.models.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.image.models.remove("poster", current.data.version)` |
161
+ | `ai.mcp.servers.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.mcp.servers.list()` |
162
+ | `ai.mcp.servers.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.mcp.servers.get("tools")` |
163
+ | `ai.mcp.servers.register` | DB 定義を登録 | `MCPExternalServer input (id/transport/url or command)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.mcp.servers.register(mcpServerDefinition)` |
164
+ | `ai.mcp.servers.update` | 版を条件に置換 | `MCPExternalServer input (id/transport/url or command), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.mcp.servers.update(mcpServerDefinition, current.data.version)` |
165
+ | `ai.mcp.servers.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.mcp.servers.remove("tools", current.data.version)` |
166
+ | `ai.retrieval.sources.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.retrieval.sources.list()` |
167
+ | `ai.retrieval.sources.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.retrieval.sources.get("docs")` |
168
+ | `ai.retrieval.sources.register` | DB 定義を登録 | `RetrievalSource input (id/collection)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.retrieval.sources.register(sourceDefinition)` |
169
+ | `ai.retrieval.sources.update` | 版を条件に置換 | `RetrievalSource input (id/collection), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.retrieval.sources.update(sourceDefinition, current.data.version)` |
170
+ | `ai.retrieval.sources.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.retrieval.sources.remove("docs", current.data.version)` |
171
+ | `ai.acp.agents.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.acp.agents.list()` |
172
+ | `ai.acp.agents.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.acp.agents.get("coder")` |
173
+ | `ai.acp.agents.register` | DB 定義を登録 | `ACPAgent input (id/mode/adapter/modelIds)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.acp.agents.register(agentDefinition)` |
174
+ | `ai.acp.agents.update` | 版を条件に置換 | `ACPAgent input (id/mode/adapter/modelIds), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.acp.agents.update(agentDefinition, current.data.version)` |
175
+ | `ai.acp.agents.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.acp.agents.remove("coder", current.data.version)` |
176
+ | `ai.acp.workspaces.list` | 統合した一覧 | `none` | `HaiResult<AIResourceEntry[]>; config wins, list has no database version` | `ai.acp.workspaces.list()` |
177
+ | `ai.acp.workspaces.get` | 出所と版を参照 | `id: string` | `HaiResult<AIResourceEntry> with value/source/version?` | `ai.acp.workspaces.get("project")` |
178
+ | `ai.acp.workspaces.register` | DB 定義を登録 | `ACPWorkspace input (id/storage/repositories)` | `HaiResult<AIResourceEntry>; config entries are read-only` | `ai.acp.workspaces.register(workspaceDefinition)` |
179
+ | `ai.acp.workspaces.update` | 版を条件に置換 | `ACPWorkspace input (id/storage/repositories), expectedVersion?` | `HaiResult<AIResourceEntry>; full replacement, conflict fails` | `ai.acp.workspaces.update(workspaceDefinition, current.data.version)` |
180
+ | `ai.acp.workspaces.remove` | DB 定義を削除 | `id, expectedVersion?; ACP definitions must have no session references` | `HaiResult<void>; external files/services are retained` | `ai.acp.workspaces.remove("project", current.data.version)` |
181
+ | `ai.acp.agents.initialize` | エージェント事前確認 | `agentId, modelId?` | `HaiResult<{ agentId, mode, modelIds }>; no credentials` | `ai.acp.agents.initialize("coder")` |
182
+ | `ai.acp.agents.check` | 実接続と握手 | `agentId, { workspaceId?, ...ACPClientOptions }` | `HaiResult<native initialize response>; owned connection is closed` | `ai.acp.agents.check("coder", { workspaceId: "project" })` |
183
+ | `ai.acp.workspaces.prepare` | 作業領域を準備 | `workspaceId` | `HaiResult<main absolute path>; dirty content is retained` | `ai.acp.workspaces.prepare("project")` |
184
+ | `ai.acp.workspaces.importFiles` | 制御ファイル取込 | `workspaceId, { path: relative path, content: string\|Uint8Array }[]` | `HaiResult<{ imported: string[] }>; no overwrite` | `ai.acp.workspaces.importFiles("project", [{ path: "notes.txt", content: "需求" }])` |
185
+ | `ai.acp.sessions.create` | 管理会話を開始 | `ACPCreateSessionOptions: agentId/workspaceId/newWorktree?` | `HaiResult<managed session handle>` | `ai.acp.sessions.create({ agentId: "coder", workspaceId: "project", newWorktree: true })` |
186
+ | `ai.acp.sessions.get` | 会話ハンドル参照 | `framework session id` | `HaiResult<managed session handle>; does not resume` | `ai.acp.sessions.get("task-1")` |
187
+ | `ai.acp.sessions.list` | 管理会話一覧 | `workspaceId?` | `HaiResult<ACPSessionInfo[]>` | `ai.acp.sessions.list("project")` |
188
+ | `ai.acp.sessions.resume` | ネイティブ会話再開 | `framework session id, ACPClientOptions?` | `HaiResult<managed session handle>; definition changes may reject` | `ai.acp.sessions.resume("task-1")` |
189
+ | `ai.acp.sessions.close` | 所有する実行を停止 | `framework session id` | `HaiResult<void>; source and native history retained` | `ai.acp.sessions.close("task-1")` |
190
+ | `ai.acp.sessions.reclaimWorktree` | 清浄な worktree を回収 | `closed framework session id; preview stopped and changes saved` | `HaiResult<void>; branch and normal files retained` | `ai.acp.sessions.reclaimWorktree("task-1")` |
191
+ | `ai.acp.sessions.remove` | 会話記録を削除 | `closed or failed framework session id` | `HaiResult<void>; worktree and native history retained` | `ai.acp.sessions.remove("task-1")` |
192
+ | `ai.acp.connect` | 原生転送へ接続 | `ACPTransport: stdio/http/ws, ACPClientOptions?` | `HaiResult<connection handle>` | `ai.acp.connect({ type: "http", url: "https://agent.example.com/acp" })` |
193
+ | `ai.acp.close` | サブシステムを閉じる | `none; normally call ai.close()` | `Promise<void>; cleanup may throw` | `ai.acp.close()` |
192
194
 
193
195
  - `ai.tools`:ツール定義・登録・一括実行。初期化不要。
194
196
  - `ai.stream`:ChatCompletion のストリーミング chunk 処理。初期化不要。
@@ -375,7 +377,9 @@ Goose 1.57.0 イメージは `goose serve` のネイティブ HTTP/WS `/acp` を
375
377
 
376
378
  確認済み容量、モダリティ、推論能力は `llm.models[].capabilities` に設定します。Codex は Responses を必要とし、既存 Hai 変換は逆方向ゲートウェイではありません。close 後もコード/状態を保持し、所有プロセス停止を確認後 CAS 占有を解放します。worktree はセキュリティサンドボックスではありません。
377
379
 
378
- [ACP ガイド](../cli/templates/skills/hai-ai/acp.md) と [Agent イメージ](models/agents/README.md) を参照してください。Git/Node/Python を含み Java/Rust/Go は任意、Codex イメージには codex-acp と codex の両方を含みます。エラーは `hai:ai:070`–`084`、通常 API は HaiResult、stream の失敗は例外です。
380
+ Agent イメージのビルドでは `minimal`、`documents`、`office`、`browser`、`developer` を選択できます。既定のイメージには Git、Node、ネイティブ Agent が含まれ、Codex には bubblewrap も含まれます。実行環境にはローカルのイメージ ID またはリモートのマニフェスト digest を登録します。[Agent イメージ](models/agents/README.md)
381
+
382
+ ACP は Node サービスで実行します。通常の API は HaiResult を返し、ストリームの失敗は例外になります。[ACP ガイド](../cli/templates/skills/hai-ai/acp.md)
379
383
 
380
384
  管理対象 Git でサブモジュールや Git LFS 属性を検出すると ACP_UNSUPPORTED を返し、不完全な内容を準備完了として扱いません。
381
385