@intx/inference 0.1.2 → 0.3.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/LICENSE +176 -0
- package/dist/actions.d.ts +16 -0
- package/dist/actions.js +200 -0
- package/dist/adapter.d.ts +40 -0
- package/dist/adapter.js +31 -0
- package/dist/assembly.d.ts +75 -0
- package/dist/assembly.js +133 -0
- package/dist/audit-collector.d.ts +10 -0
- package/dist/audit-collector.js +139 -0
- package/dist/auth.d.ts +24 -0
- package/{src/auth.ts → dist/auth.js} +13 -19
- package/dist/authz-extension.d.ts +46 -0
- package/dist/authz-extension.js +184 -0
- package/dist/correlation.d.ts +26 -0
- package/dist/correlation.js +39 -0
- package/dist/default-director.d.ts +111 -0
- package/dist/default-director.js +228 -0
- package/dist/director.d.ts +6 -0
- package/dist/director.js +56 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +83 -0
- package/dist/gates.d.ts +28 -0
- package/dist/gates.js +103 -0
- package/dist/harness.d.ts +147 -0
- package/dist/harness.js +1407 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +21 -0
- package/dist/manifest.d.ts +31 -0
- package/dist/manifest.js +44 -0
- package/dist/providers/anthropic.d.ts +37 -0
- package/dist/providers/anthropic.js +917 -0
- package/dist/providers/google-genai-files.d.ts +48 -0
- package/dist/providers/google-genai-files.js +205 -0
- package/dist/providers/google-genai.d.ts +5 -0
- package/dist/providers/google-genai.js +1205 -0
- package/dist/providers/index.d.ts +38 -0
- package/dist/providers/index.js +56 -0
- package/dist/providers/openai.d.ts +9 -0
- package/dist/providers/openai.js +903 -0
- package/dist/reactor.d.ts +50 -0
- package/dist/reactor.js +1233 -0
- package/dist/retry-policy.d.ts +31 -0
- package/{src/retry-policy.ts → dist/retry-policy.js} +41 -53
- package/dist/sse.d.ts +1 -0
- package/dist/sse.js +63 -0
- package/dist/state.d.ts +23 -0
- package/dist/state.js +100 -0
- package/dist/tool-name.d.ts +6 -0
- package/dist/tool-name.js +110 -0
- package/dist/transform.d.ts +11 -0
- package/dist/transform.js +132 -0
- package/dist/transforms/index.d.ts +2 -0
- package/dist/transforms/index.js +1 -0
- package/dist/transforms/size-cap.d.ts +12 -0
- package/dist/transforms/size-cap.js +80 -0
- package/dist/turns.d.ts +21 -0
- package/dist/turns.js +135 -0
- package/package.json +22 -6
- package/src/actions.ts +0 -245
- package/src/adapter.ts +0 -57
- package/src/assembly.test.ts +0 -728
- package/src/assembly.ts +0 -250
- package/src/audit-collector.test.ts +0 -332
- package/src/audit-collector.ts +0 -172
- package/src/auth.test.ts +0 -117
- package/src/authz-extension.test.ts +0 -269
- package/src/authz-extension.ts +0 -145
- package/src/correlation.ts +0 -61
- package/src/default-director.test.ts +0 -314
- package/src/default-director.ts +0 -344
- package/src/director.ts +0 -87
- package/src/errors.test.ts +0 -133
- package/src/errors.ts +0 -115
- package/src/gates.ts +0 -128
- package/src/harness.test.ts +0 -655
- package/src/harness.ts +0 -1571
- package/src/index.ts +0 -76
- package/src/providers/anthropic.test.ts +0 -771
- package/src/providers/anthropic.ts +0 -810
- package/src/providers/google-genai-files.ts +0 -289
- package/src/providers/google-genai.ts +0 -1518
- package/src/providers/openai.ts +0 -719
- package/src/providers/registry.ts +0 -33
- package/src/reactor.test.ts +0 -3660
- package/src/reactor.ts +0 -1058
- package/src/scheduler.test.ts +0 -41
- package/src/sse.test.ts +0 -133
- package/src/sse.ts +0 -76
- package/src/state.ts +0 -135
- package/src/transform.test.ts +0 -207
- package/src/transform.ts +0 -159
- package/src/transforms/index.ts +0 -2
- package/src/transforms/size-cap.test.ts +0 -172
- package/src/transforms/size-cap.ts +0 -110
- package/src/turns.ts +0 -54
- package/tsconfig.json +0 -4
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AdapterRegistry } from "../adapter.js";
|
|
2
|
+
import { type Dependencies } from "../harness.js";
|
|
3
|
+
import type { AdapterManifest, ModuleImporter } from "../manifest.js";
|
|
4
|
+
export { createAnthropicAdapter, AnthropicQuirks, ADAPTIVE_THINKING_MODELS, ADAPTIVE_THINKING_EFFORT, } from "./anthropic.js";
|
|
5
|
+
export { createGoogleGenAIAdapter, GoogleGenAIQuirks } from "./google-genai.js";
|
|
6
|
+
export { createOpenAIAdapter, OpenAIQuirks } from "./openai.js";
|
|
7
|
+
/**
|
|
8
|
+
* Builds a registry of the adapters this package ships with, statically linked
|
|
9
|
+
* and resolved synchronously. The per-call factory invariant (a fresh adapter
|
|
10
|
+
* minted on every `resolve`) lives in {@link createAdapterRegistry}.
|
|
11
|
+
*
|
|
12
|
+
* @returns A registry resolving the built-in providers
|
|
13
|
+
*/
|
|
14
|
+
export declare function createBuiltinRegistry(): AdapterRegistry;
|
|
15
|
+
/**
|
|
16
|
+
* Construct runtime dependencies wired to the built-in adapter registry. This
|
|
17
|
+
* is the honest zero-arg default for hosts that need the shipped provider set:
|
|
18
|
+
* it binds `globalThis.fetch` and the production scheduler via
|
|
19
|
+
* {@link createDependencies}. Hosts with custom adapters build a registry
|
|
20
|
+
* through {@link loadAdapterRegistry} and pass it to `createDependencies`.
|
|
21
|
+
*
|
|
22
|
+
* @returns Dependencies resolving the built-in providers
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDefaultDependencies(): Dependencies;
|
|
25
|
+
/**
|
|
26
|
+
* Builds a registry of the built-in adapters merged with custom adapters loaded
|
|
27
|
+
* from an operator-configured manifest. Custom adapters override built-ins
|
|
28
|
+
* sharing a provider key. With an empty manifest this returns just the
|
|
29
|
+
* built-ins. The per-call factory invariant lives in
|
|
30
|
+
* {@link createAdapterRegistry}.
|
|
31
|
+
*
|
|
32
|
+
* @param manifest - Validated custom adapter manifest entries
|
|
33
|
+
* @param opts - Optional injected module importer
|
|
34
|
+
* @returns A registry resolving built-in and custom providers
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadAdapterRegistry(manifest: AdapterManifest, opts?: {
|
|
37
|
+
import?: ModuleImporter;
|
|
38
|
+
}): Promise<AdapterRegistry>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createAdapterRegistry } from "../adapter.js";
|
|
2
|
+
import { createDependencies } from "../harness.js";
|
|
3
|
+
import { loadAdapterFactories } from "../manifest.js";
|
|
4
|
+
import { createAnthropicAdapter } from "./anthropic.js";
|
|
5
|
+
import { createGoogleGenAIAdapter } from "./google-genai.js";
|
|
6
|
+
import { createOpenAIAdapter } from "./openai.js";
|
|
7
|
+
export { createAnthropicAdapter, AnthropicQuirks, ADAPTIVE_THINKING_MODELS, ADAPTIVE_THINKING_EFFORT, } from "./anthropic.js";
|
|
8
|
+
export { createGoogleGenAIAdapter, GoogleGenAIQuirks } from "./google-genai.js";
|
|
9
|
+
export { createOpenAIAdapter, OpenAIQuirks } from "./openai.js";
|
|
10
|
+
function builtinFactories() {
|
|
11
|
+
return {
|
|
12
|
+
anthropic: createAnthropicAdapter,
|
|
13
|
+
openai: createOpenAIAdapter,
|
|
14
|
+
"openai-compatible": createOpenAIAdapter,
|
|
15
|
+
"google-genai": createGoogleGenAIAdapter,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds a registry of the adapters this package ships with, statically linked
|
|
20
|
+
* and resolved synchronously. The per-call factory invariant (a fresh adapter
|
|
21
|
+
* minted on every `resolve`) lives in {@link createAdapterRegistry}.
|
|
22
|
+
*
|
|
23
|
+
* @returns A registry resolving the built-in providers
|
|
24
|
+
*/
|
|
25
|
+
export function createBuiltinRegistry() {
|
|
26
|
+
return createAdapterRegistry(builtinFactories());
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Construct runtime dependencies wired to the built-in adapter registry. This
|
|
30
|
+
* is the honest zero-arg default for hosts that need the shipped provider set:
|
|
31
|
+
* it binds `globalThis.fetch` and the production scheduler via
|
|
32
|
+
* {@link createDependencies}. Hosts with custom adapters build a registry
|
|
33
|
+
* through {@link loadAdapterRegistry} and pass it to `createDependencies`.
|
|
34
|
+
*
|
|
35
|
+
* @returns Dependencies resolving the built-in providers
|
|
36
|
+
*/
|
|
37
|
+
export function createDefaultDependencies() {
|
|
38
|
+
return createDependencies(createBuiltinRegistry());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds a registry of the built-in adapters merged with custom adapters loaded
|
|
42
|
+
* from an operator-configured manifest. Custom adapters override built-ins
|
|
43
|
+
* sharing a provider key. With an empty manifest this returns just the
|
|
44
|
+
* built-ins. The per-call factory invariant lives in
|
|
45
|
+
* {@link createAdapterRegistry}.
|
|
46
|
+
*
|
|
47
|
+
* @param manifest - Validated custom adapter manifest entries
|
|
48
|
+
* @param opts - Optional injected module importer
|
|
49
|
+
* @returns A registry resolving built-in and custom providers
|
|
50
|
+
*/
|
|
51
|
+
export async function loadAdapterRegistry(manifest, opts) {
|
|
52
|
+
return createAdapterRegistry({
|
|
53
|
+
...builtinFactories(),
|
|
54
|
+
...(await loadAdapterFactories(manifest, opts)),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LastCycleSource } from "@intx/types/runtime";
|
|
2
|
+
import type { ProviderAdapter } from "../adapter.js";
|
|
3
|
+
export declare const OpenAIQuirks: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
4
|
+
forceAssistantReasoningContent?: boolean;
|
|
5
|
+
reasoningFieldNames?: ("reasoning" | "reasoning_content")[];
|
|
6
|
+
maxTokensField?: "max_tokens" | "max_completion_tokens";
|
|
7
|
+
}, {}>;
|
|
8
|
+
export type OpenAIQuirks = typeof OpenAIQuirks.infer;
|
|
9
|
+
export declare function createOpenAIAdapter(source: LastCycleSource, quirks?: unknown): ProviderAdapter;
|