@lqc123qwe/car-runtime 1.9.0 → 1.11.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 +17 -1
- package/dist/SHA256SUMS +1 -0
- package/dist/authz/authz.d.ts +46 -0
- package/dist/authz/authz.js +76 -0
- package/dist/car-runtime-1.11.0.tgz +0 -0
- package/dist/car-runtime-1.11.0.tgz.sig.bundle +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +825 -0
- package/dist/dx/doctor.d.ts +62 -0
- package/dist/dx/doctor.js +127 -0
- package/dist/governance/dump.d.ts +47 -0
- package/dist/governance/dump.js +17 -0
- package/dist/host/facade.d.ts +13 -0
- package/dist/host/facade.js +154 -0
- package/dist/host/hostGateway.d.ts +117 -0
- package/dist/host/hostGateway.js +65 -0
- package/dist/host/mappings.d.ts +27 -0
- package/dist/host/mappings.js +52 -0
- package/dist/host/stdio.d.ts +14 -0
- package/dist/host/stdio.js +83 -0
- package/dist/kernel/context.d.ts +76 -0
- package/dist/kernel/context.js +203 -0
- package/dist/kernel/events.d.ts +37 -0
- package/dist/kernel/events.js +82 -0
- package/dist/load/config.d.ts +79 -0
- package/dist/load/config.js +285 -0
- package/dist/load/loader.d.ts +72 -0
- package/dist/load/loader.js +162 -0
- package/dist/load/registry.d.ts +44 -0
- package/dist/load/registry.js +58 -0
- package/dist/load/report.d.ts +98 -0
- package/dist/load/report.js +301 -0
- package/dist/load/sigGate.d.ts +22 -0
- package/dist/load/sigGate.js +68 -0
- package/dist/load/sign.d.ts +25 -0
- package/dist/load/sign.js +47 -0
- package/dist/load/verifier.d.ts +35 -0
- package/dist/load/verifier.js +56 -0
- package/dist/loop/goal.d.ts +31 -0
- package/dist/loop/goal.js +34 -0
- package/dist/loop/recover.d.ts +17 -0
- package/dist/loop/recover.js +39 -0
- package/dist/loop/stop.d.ts +82 -0
- package/dist/loop/stop.js +184 -0
- package/dist/mcp/gateway.d.ts +96 -0
- package/dist/mcp/gateway.js +69 -0
- package/dist/mcp/httpClient.d.ts +27 -0
- package/dist/mcp/httpClient.js +196 -0
- package/dist/mcp/stdioClient.d.ts +8 -0
- package/dist/mcp/stdioClient.js +73 -0
- package/dist/ptc/budget.d.ts +21 -0
- package/dist/ptc/budget.js +36 -0
- package/dist/ptc/erasable.d.ts +14 -0
- package/dist/ptc/erasable.js +27 -0
- package/dist/ptc/runCode.d.ts +65 -0
- package/dist/ptc/runCode.js +140 -0
- package/dist/ptc/schemaRender.d.ts +15 -0
- package/dist/ptc/schemaRender.js +90 -0
- package/dist/ptc/sdk.d.ts +27 -0
- package/dist/ptc/sdk.js +23 -0
- package/dist/ptc/worker-entry.d.ts +1 -0
- package/dist/ptc/worker-entry.js +71 -0
- package/dist/release-audit.jsonl +4 -0
- package/dist/runtime-core/chatStep.d.ts +43 -0
- package/dist/runtime-core/chatStep.js +121 -0
- package/dist/runtime-core/credentials.d.ts +49 -0
- package/dist/runtime-core/credentials.js +118 -0
- package/dist/runtime-core/errors.d.ts +30 -0
- package/dist/runtime-core/errors.js +36 -0
- package/dist/runtime-core/llm.d.ts +76 -0
- package/dist/runtime-core/llm.js +638 -0
- package/dist/runtime-core/redaction.d.ts +39 -0
- package/dist/runtime-core/redaction.js +79 -0
- package/dist/runtime-core/telemetry.d.ts +88 -0
- package/dist/runtime-core/telemetry.js +332 -0
- package/dist/runtime-core/tools.d.ts +15 -0
- package/dist/runtime-core/tools.js +12 -0
- package/dist/runtime-core/trace.d.ts +55 -0
- package/dist/runtime-core/trace.js +137 -0
- package/dist/runtime-core/types.d.ts +104 -0
- package/dist/runtime-core/types.js +13 -0
- package/dist/sandbox/sandbox.d.ts +68 -0
- package/dist/sandbox/sandbox.js +153 -0
- package/dist/sbom.json +263 -0
- package/dist/seam.d.ts +24 -0
- package/dist/seam.js +23 -0
- package/dist/security/secrets-baseline.d.ts +43 -0
- package/dist/security/secrets-baseline.js +176 -0
- package/dist/security/secrets.d.ts +45 -0
- package/dist/security/secrets.js +138 -0
- package/dist/session/export.d.ts +55 -0
- package/dist/session/export.js +81 -0
- package/dist/session/fork.d.ts +51 -0
- package/dist/session/fork.js +63 -0
- package/dist/session/format.d.ts +21 -0
- package/dist/session/format.js +49 -0
- package/dist/session/indexStore.d.ts +44 -0
- package/dist/session/indexStore.js +265 -0
- package/dist/session/log.d.ts +79 -0
- package/dist/session/log.js +157 -0
- package/dist/session/store.d.ts +9 -0
- package/dist/session/store.js +37 -0
- package/dist/telemetry/metrics.d.ts +25 -0
- package/dist/telemetry/metrics.js +26 -0
- package/package.json +17 -1
- package/src/authz/authz.ts +12 -0
- package/src/loop/stop.ts +43 -10
- package/src/runtime-core/chatStep.ts +22 -2
- package/src/runtime-core/llm.ts +96 -13
- package/src/runtime-core/types.ts +22 -1
- package/src/seam.ts +24 -0
- package/src/session/log.ts +1 -1
- package/.gitattributes +0 -11
- package/.github/workflows/ci.yml +0 -293
- package/.github/workflows/release.yml +0 -54
- package/adr/ADR-001.md +0 -4
- package/adr/ADR-002.md +0 -5
- package/adr/ADR-003.md +0 -35
- package/adr/host-onboarding.md +0 -68
- package/adr/mlps-audit-checklist.md +0 -41
- package/adr/win32-spike.md +0 -45
- package/docs/plugin-authoring.md +0 -82
- package/native/landlock-run/Makefile +0 -19
- package/native/landlock-run/landlock-run.c +0 -162
- package/scripts/contract-check.ts +0 -56
- package/scripts/invariant-n1.ts +0 -96
- package/scripts/package-check.ts +0 -29
- package/scripts/ptc-baseline/run-baseline.ts +0 -118
- package/scripts/release-artifacts.ts +0 -111
- package/scripts/release-pipeline.ts +0 -245
- package/scripts/secrets-baseline.ts +0 -33
- package/scripts/secrets-scan.ts +0 -56
- package/scripts/win32-ffi-debug.ts +0 -143
- package/scripts/win32-koffi-spike.ts +0 -537
- package/test/contract/eventmap.golden.json +0 -7
- package/test/fixtures/hello-plugin.ts +0 -5
- package/test/kernel.spec.ts +0 -136
- package/test/registry-e2e/run-e2e.ts +0 -213
- package/test/s11.spec.ts +0 -129
- package/test/s12.spec.ts +0 -135
- package/test/s13.spec.ts +0 -117
- package/test/s14.spec.ts +0 -117
- package/test/s15.spec.ts +0 -80
- package/test/s16.spec.ts +0 -133
- package/test/s17.spec.ts +0 -102
- package/test/s18.spec.ts +0 -81
- package/test/s19.spec.ts +0 -138
- package/test/s2.spec.ts +0 -245
- package/test/s20.spec.ts +0 -241
- package/test/s21.spec.ts +0 -231
- package/test/s22-m7-store-format.spec.ts +0 -135
- package/test/s23-m7-export-index.spec.ts +0 -189
- package/test/s24-signature-gate.spec.ts +0 -185
- package/test/s25-m8-runtime-core.spec.ts +0 -600
- package/test/s26-signature-closeout.spec.ts +0 -349
- package/test/s27-host-load-wiring.spec.ts +0 -134
- package/test/s28-session-index-followup.spec.ts +0 -236
- package/test/s29-otel-producer.spec.ts +0 -252
- package/test/s3.spec.ts +0 -179
- package/test/s30-release-artifacts.spec.ts +0 -127
- package/test/s31-real-model-wiring.spec.ts +0 -329
- package/test/s32-telemetry-mcp-ptc.spec.ts +0 -218
- package/test/s33-anthropic-adapter.spec.ts +0 -354
- package/test/s34-mcp-remote-transport.spec.ts +0 -250
- package/test/s35-config-ts-zod.spec.ts +0 -145
- package/test/s36-host-tool-surface.spec.ts +0 -250
- package/test/s37-projection-dedupe.spec.ts +0 -161
- package/test/s38-config-jiti.spec.ts +0 -116
- package/test/s39-otlp-span-semantics.spec.ts +0 -100
- package/test/s4.spec.ts +0 -169
- package/test/s40-metrics-cumulative.spec.ts +0 -67
- package/test/s41-mcp-serve-turn-span.spec.ts +0 -148
- package/test/s42-traceparent-propagation.spec.ts +0 -415
- package/test/s43-remote-http-traceparent.spec.ts +0 -262
- package/test/s5.spec.ts +0 -95
- package/test/s6.spec.ts +0 -169
- package/test/s7.spec.ts +0 -136
- package/test/s7b-baseline.spec.ts +0 -20
- package/test/s9.spec.ts +0 -89
- package/test/sandbox-escape/j17-orchestrate.sh +0 -30
- package/test/sandbox-escape/run-matrix.sh +0 -98
- package/tsconfig.json +0 -18
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { CredentialService } from './credentials.ts';
|
|
2
|
+
import type { Disposable, LlmAdapter, LlmChunk, LlmRequest } from './types.ts';
|
|
3
|
+
import type { PluginContext } from '../kernel/context.ts';
|
|
4
|
+
export declare class AdapterRegistry {
|
|
5
|
+
#private;
|
|
6
|
+
/** 注册(幂等语义:同 id 重复注册显式报错——冲突链定位风格) */
|
|
7
|
+
register(adapter: LlmAdapter, opts?: {
|
|
8
|
+
default?: boolean;
|
|
9
|
+
}): Disposable;
|
|
10
|
+
/** 解析:显式 id > 默认适配器;无可用适配器显式报错(禁静默降级) */
|
|
11
|
+
get(id?: string): LlmAdapter;
|
|
12
|
+
list(): Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
isDefault: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/** 首个 finishReason 定格;适配器后续给出不同值 = 契约违规显式抛错(不改写不吞没) */
|
|
18
|
+
export declare function withFinishReasonGuard(stream: AsyncIterable<LlmChunk>): AsyncIterable<LlmChunk>;
|
|
19
|
+
export declare class RuntimeCore {
|
|
20
|
+
#private;
|
|
21
|
+
readonly registry: AdapterRegistry;
|
|
22
|
+
readonly credentials: CredentialService;
|
|
23
|
+
constructor(credentials?: CredentialService);
|
|
24
|
+
/** 绑定插件作用域:服务注册 + 适配器注册进入 Effect 可逆通道(宿主传 Context——根作用域 effect 同纪律) */
|
|
25
|
+
bindContext(ctx: Pick<PluginContext, 'provide' | 'effect'>): void;
|
|
26
|
+
/** §3.2.M8.2:registerLlmAdapter(adapter): Disposable——Effect 可逆(卸载回卷后可重注册) */
|
|
27
|
+
registerLlmAdapter(adapter: LlmAdapter, opts?: {
|
|
28
|
+
default?: boolean;
|
|
29
|
+
}): Disposable;
|
|
30
|
+
/** §3.2.M8.2:chat(req): AsyncIterable<LlmChunk>——统一入口 + finishReason 守卫 */
|
|
31
|
+
chat(req: LlmRequest): AsyncIterable<LlmChunk>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* D-12a TLS 强制门(openai-compat / anthropic 共用,口径不变):https 直接通过;
|
|
35
|
+
* http 仅豁免 loopback——本地模型服务(Ollama 等)与本地 E2E;非回环地址维持 TLS 强制
|
|
36
|
+
* (§3.2.M8.4)。豁免集显式列举,不扩大到局域网。
|
|
37
|
+
*/
|
|
38
|
+
export declare function assertTlsOrLoopback(baseUrl: string): void;
|
|
39
|
+
export interface OpenAICompatOptions {
|
|
40
|
+
id?: string;
|
|
41
|
+
baseUrl: string;
|
|
42
|
+
/** 凭据服务与 provider 名(Bearer token 来源) */
|
|
43
|
+
credentials?: CredentialService;
|
|
44
|
+
provider?: string;
|
|
45
|
+
fetchImpl?: typeof fetch;
|
|
46
|
+
/** §3.5.4 基线:总 120s / 首字节 30s / 2 次退避 1s-2s(测试可注入缩短) */
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
firstByteMs?: number;
|
|
49
|
+
retries?: number;
|
|
50
|
+
backoffMs?: number[];
|
|
51
|
+
/** 测试注入睡眠(退避可观测;缺省真实定时器) */
|
|
52
|
+
sleep?: (ms: number) => Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export declare function createOpenAICompatAdapter(opts: OpenAICompatOptions): LlmAdapter & {
|
|
55
|
+
id: string;
|
|
56
|
+
};
|
|
57
|
+
export interface AnthropicAdapterOptions {
|
|
58
|
+
id?: string;
|
|
59
|
+
/** API 源(如 https://api.anthropic.com;请求路径 = {baseUrl}/v1/messages,与官方 SDK base_url 同约定) */
|
|
60
|
+
baseUrl: string;
|
|
61
|
+
/** 凭据服务与 provider 名(x-api-key 来源;provider 缺省 'anthropic' → ANTHROPIC_API_KEY) */
|
|
62
|
+
credentials?: CredentialService;
|
|
63
|
+
provider?: string;
|
|
64
|
+
fetchImpl?: typeof fetch;
|
|
65
|
+
/** §3.5.4 基线:总 120s / 首字节 30s / 2 次退避 1s-2s(与 openai-compat 同款) */
|
|
66
|
+
timeoutMs?: number;
|
|
67
|
+
firstByteMs?: number;
|
|
68
|
+
retries?: number;
|
|
69
|
+
backoffMs?: number[];
|
|
70
|
+
sleep?: (ms: number) => Promise<void>;
|
|
71
|
+
/** D-20:Anthropic API max_tokens 必填——req.maxTokens 缺席时取此缺省(provider 差异登记,缺省 4096) */
|
|
72
|
+
defaultMaxTokens?: number;
|
|
73
|
+
}
|
|
74
|
+
export declare function createAnthropicAdapter(opts: AnthropicAdapterOptions): LlmAdapter & {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|