@x-otto/cli 0.0.1-alpha.0
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.
- package/README.md +120 -0
- package/bin/otto.js +61 -0
- package/dist/auth-command-CXAB3_hs.js +11 -0
- package/dist/auth-command-CXAB3_hs.js.map +1 -0
- package/dist/build-id-BX4QHzM0.js +3 -0
- package/dist/build-id-BX4QHzM0.js.map +1 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/otto-plugin.json +8 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/plugin-dist/meta.json +1 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/plugin-dist/plugin.cjs +60023 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/plugin.ts +64 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/anthropic-messages.ts +916 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/anthropic-usage.ts +81 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/openai-completions.ts +158 -0
- package/dist/bundled-extensions/plugin-otto-wire-protocols/src/openai-responses.ts +575 -0
- package/dist/bundled-extensions/plugin-skill-inductor/otto-plugin.json +8 -0
- package/dist/bundled-extensions/plugin-skill-inductor/plugin-dist/meta.json +1 -0
- package/dist/bundled-extensions/plugin-skill-inductor/plugin-dist/plugin.cjs +52781 -0
- package/dist/bundled-extensions/plugin-skill-inductor/plugin.ts +77 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/candidate-detector.ts +210 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/candidate-digest.ts +146 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/candidate-store.ts +87 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/episode-store.ts +122 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/episode.ts +125 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/extraction-prompt.ts +97 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/inductor-service.ts +183 -0
- package/dist/bundled-extensions/plugin-skill-inductor/src/similarity.ts +58 -0
- package/dist/command-dispatcher-BgStVcCF.js +13 -0
- package/dist/command-dispatcher-BgStVcCF.js.map +1 -0
- package/dist/config-migration-DatflIxs.js +21 -0
- package/dist/config-migration-DatflIxs.js.map +1 -0
- package/dist/daemon-COESl-zU.js +21 -0
- package/dist/daemon-COESl-zU.js.map +1 -0
- package/dist/daemon-base-YOWgYYN7.js +3 -0
- package/dist/daemon-base-YOWgYYN7.js.map +1 -0
- package/dist/debug-CiosFwme.js +34 -0
- package/dist/debug-CiosFwme.js.map +1 -0
- package/dist/discover-with-bundled-CznLjkkw.js +3 -0
- package/dist/discover-with-bundled-CznLjkkw.js.map +1 -0
- package/dist/doctor-C84-hhEr.js +30 -0
- package/dist/doctor-C84-hhEr.js.map +1 -0
- package/dist/doctor-attach-_zeIJewx.js +42 -0
- package/dist/doctor-attach-_zeIJewx.js.map +1 -0
- package/dist/doctor-cdp-K_mIFRfA.js +5 -0
- package/dist/doctor-cdp-K_mIFRfA.js.map +1 -0
- package/dist/doctor-heap-Rr2nNvcw.js +11 -0
- package/dist/doctor-heap-Rr2nNvcw.js.map +1 -0
- package/dist/doctor-ps-OL3FGQYu.js +8 -0
- package/dist/doctor-ps-OL3FGQYu.js.map +1 -0
- package/dist/extension-Bhzoel6s.js +169 -0
- package/dist/extension-Bhzoel6s.js.map +1 -0
- package/dist/extension-plugin-CnF6O_zK.js +7 -0
- package/dist/extension-plugin-CnF6O_zK.js.map +1 -0
- package/dist/extension-plugin-DWcakwRx.js +2 -0
- package/dist/extension-v-liRnUX.js +2 -0
- package/dist/feedback-BES_6ebi.js +21 -0
- package/dist/feedback-BES_6ebi.js.map +1 -0
- package/dist/feedback-BRbLUn9u.js +2 -0
- package/dist/feishu-setup-D6vnuNLw.js +6 -0
- package/dist/feishu-setup-D6vnuNLw.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/install-DlVJRHRT.js +11 -0
- package/dist/install-DlVJRHRT.js.map +1 -0
- package/dist/install-WCcQ9k9M.js +2 -0
- package/dist/mcp-DbTYT7hB.js +12 -0
- package/dist/mcp-DbTYT7hB.js.map +1 -0
- package/dist/migrate-boDXhEyV.js +14 -0
- package/dist/migrate-boDXhEyV.js.map +1 -0
- package/dist/model-auth-C27iG6Jq.js +3 -0
- package/dist/model-auth-C27iG6Jq.js.map +1 -0
- package/dist/model-auth-C4bsWvvn.js +2 -0
- package/dist/observe-CVg-MRM2.js +32 -0
- package/dist/observe-CVg-MRM2.js.map +1 -0
- package/dist/parse-cli-tFDOeVU1.js +3 -0
- package/dist/parse-cli-tFDOeVU1.js.map +1 -0
- package/dist/persistenced-CCwHu1Ww.js +36 -0
- package/dist/persistenced-CCwHu1Ww.js.map +1 -0
- package/dist/proxy-BvdBsB1O.js +2 -0
- package/dist/proxy-evg7ZvoD.js +3 -0
- package/dist/proxy-evg7ZvoD.js.map +1 -0
- package/dist/ps-DKrluEuy.js +9 -0
- package/dist/ps-DKrluEuy.js.map +1 -0
- package/dist/registry-B3nfN62q.js +2 -0
- package/dist/registry-D0NONjLv.js +6 -0
- package/dist/registry-D0NONjLv.js.map +1 -0
- package/dist/remote-persistence-server-B_hONoVR.js +35 -0
- package/dist/remote-persistence-server-B_hONoVR.js.map +1 -0
- package/dist/run-attach-Ci5jYyCa.js +3 -0
- package/dist/run-attach-Ci5jYyCa.js.map +1 -0
- package/dist/serve-pVR6UIT9.js +21 -0
- package/dist/serve-pVR6UIT9.js.map +1 -0
- package/dist/service-client-BLNeugM9.js +3 -0
- package/dist/service-client-BLNeugM9.js.map +1 -0
- package/dist/time-travel-ZozuPPI-.js +21 -0
- package/dist/time-travel-ZozuPPI-.js.map +1 -0
- package/dist/version-C0qM-qJM.js +3 -0
- package/dist/version-C0qM-qJM.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* plugin.ts —— otto-wire-protocols 代码式插件入口(RFC-148 M2)。
|
|
3
|
+
*
|
|
4
|
+
* 首方协议插件:注册 anthropic-messages/openai-responses/openai-completions 三个标准
|
|
5
|
+
* wire 协议实现,供任意声明式/代码式 provider 插件经 `wireApi` 引用(惰性查表,
|
|
6
|
+
* `provider-loader.ts` buildFactory,RFC-148 D3)。取代 M1 的 `wire-protocol-shim.ts`
|
|
7
|
+
* 缝合层(M1 时三协议仍留在 @x-otto/provider,本次 M2 完成物理迁出)。
|
|
8
|
+
*
|
|
9
|
+
* Adapter 职责(R8):`WireProtocolFactoryInput` 统一 `resolveAuth` 单槽,桥接到三个
|
|
10
|
+
* `createXxxProvider` 各自不同形状的 Options(`resolveKey` vs `resolveAuth`)——逻辑
|
|
11
|
+
* 逐字节从 `wire-protocol-shim.ts` 迁移,行为零变化。
|
|
12
|
+
*/
|
|
13
|
+
import { definePlugin } from '@x-otto/plugin'
|
|
14
|
+
import { createAnthropicProvider } from './src/anthropic-messages'
|
|
15
|
+
import { createOpenAIResponsesProvider } from './src/openai-responses'
|
|
16
|
+
import { createOpenAICompletionsProvider } from './src/openai-completions'
|
|
17
|
+
import type { WireProtocolFactoryInput } from '@x-otto/provider'
|
|
18
|
+
|
|
19
|
+
function adaptToOpenAICompletions(input: WireProtocolFactoryInput) {
|
|
20
|
+
return createOpenAICompletionsProvider({
|
|
21
|
+
resolveKey: () => input.resolveAuth().then((a) => a?.token),
|
|
22
|
+
headers: input.headers,
|
|
23
|
+
tokenDerivedHeaders: input.tokenDerivedHeaders,
|
|
24
|
+
logger: input.logger,
|
|
25
|
+
// RFC-270 D2/D3:拦截器与鉴权覆盖逃生口此前只有 anthropic adapter 透传。
|
|
26
|
+
customizeRequest: input.customizeRequest,
|
|
27
|
+
allowAuthHeaderOverride: input.allowAuthHeaderOverride,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function adaptToOpenAIResponses(input: WireProtocolFactoryInput) {
|
|
32
|
+
return createOpenAIResponsesProvider({
|
|
33
|
+
resolveKey: () => input.resolveAuth().then((a) => a?.token),
|
|
34
|
+
resolveBaseUrl: input.resolveBaseUrl,
|
|
35
|
+
tokenDerivedHeaders: input.tokenDerivedHeaders,
|
|
36
|
+
headers: input.headers,
|
|
37
|
+
logger: input.logger,
|
|
38
|
+
// RFC-270 D2/D3:同上——adapter 是三协议共用的收口点,新增入参必须三处齐改。
|
|
39
|
+
customizeRequest: input.customizeRequest,
|
|
40
|
+
allowAuthHeaderOverride: input.allowAuthHeaderOverride,
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function adaptToAnthropicMessages(input: WireProtocolFactoryInput) {
|
|
45
|
+
return createAnthropicProvider({
|
|
46
|
+
resolveAuth: () => input.resolveAuth(),
|
|
47
|
+
resolveBaseUrl: input.resolveBaseUrl,
|
|
48
|
+
customizeRequest: input.customizeRequest,
|
|
49
|
+
logger: input.logger,
|
|
50
|
+
// RFC-270 缺陷 1(P0):此前这两行缺失——另两个 adapter 都透传了 headers,唯独本
|
|
51
|
+
// adapter 漏了,声明式 provider 给 anthropic-messages 写的 headers 被静默丢弃。
|
|
52
|
+
headers: input.headers,
|
|
53
|
+
tokenDerivedHeaders: input.tokenDerivedHeaders,
|
|
54
|
+
allowAuthHeaderOverride: input.allowAuthHeaderOverride,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default definePlugin(() => ({
|
|
59
|
+
wireProtocols: {
|
|
60
|
+
'openai-completions': { create: adaptToOpenAICompletions, meta: { reportsCacheTokens: true } },
|
|
61
|
+
'openai-responses': { create: adaptToOpenAIResponses, meta: { reportsCacheTokens: true } },
|
|
62
|
+
'anthropic-messages': { create: adaptToAnthropicMessages, meta: { reportsCacheTokens: true } },
|
|
63
|
+
},
|
|
64
|
+
}))
|