@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.
Files changed (97) hide show
  1. package/LICENSE +176 -0
  2. package/dist/actions.d.ts +16 -0
  3. package/dist/actions.js +200 -0
  4. package/dist/adapter.d.ts +40 -0
  5. package/dist/adapter.js +31 -0
  6. package/dist/assembly.d.ts +75 -0
  7. package/dist/assembly.js +133 -0
  8. package/dist/audit-collector.d.ts +10 -0
  9. package/dist/audit-collector.js +139 -0
  10. package/dist/auth.d.ts +24 -0
  11. package/{src/auth.ts → dist/auth.js} +13 -19
  12. package/dist/authz-extension.d.ts +46 -0
  13. package/dist/authz-extension.js +184 -0
  14. package/dist/correlation.d.ts +26 -0
  15. package/dist/correlation.js +39 -0
  16. package/dist/default-director.d.ts +111 -0
  17. package/dist/default-director.js +228 -0
  18. package/dist/director.d.ts +6 -0
  19. package/dist/director.js +56 -0
  20. package/dist/errors.d.ts +18 -0
  21. package/dist/errors.js +83 -0
  22. package/dist/gates.d.ts +28 -0
  23. package/dist/gates.js +103 -0
  24. package/dist/harness.d.ts +147 -0
  25. package/dist/harness.js +1407 -0
  26. package/dist/index.d.ts +37 -0
  27. package/dist/index.js +21 -0
  28. package/dist/manifest.d.ts +31 -0
  29. package/dist/manifest.js +44 -0
  30. package/dist/providers/anthropic.d.ts +37 -0
  31. package/dist/providers/anthropic.js +917 -0
  32. package/dist/providers/google-genai-files.d.ts +48 -0
  33. package/dist/providers/google-genai-files.js +205 -0
  34. package/dist/providers/google-genai.d.ts +5 -0
  35. package/dist/providers/google-genai.js +1205 -0
  36. package/dist/providers/index.d.ts +38 -0
  37. package/dist/providers/index.js +56 -0
  38. package/dist/providers/openai.d.ts +9 -0
  39. package/dist/providers/openai.js +903 -0
  40. package/dist/reactor.d.ts +50 -0
  41. package/dist/reactor.js +1233 -0
  42. package/dist/retry-policy.d.ts +31 -0
  43. package/{src/retry-policy.ts → dist/retry-policy.js} +41 -53
  44. package/dist/sse.d.ts +1 -0
  45. package/dist/sse.js +63 -0
  46. package/dist/state.d.ts +23 -0
  47. package/dist/state.js +100 -0
  48. package/dist/tool-name.d.ts +6 -0
  49. package/dist/tool-name.js +110 -0
  50. package/dist/transform.d.ts +11 -0
  51. package/dist/transform.js +132 -0
  52. package/dist/transforms/index.d.ts +2 -0
  53. package/dist/transforms/index.js +1 -0
  54. package/dist/transforms/size-cap.d.ts +12 -0
  55. package/dist/transforms/size-cap.js +80 -0
  56. package/dist/turns.d.ts +21 -0
  57. package/dist/turns.js +135 -0
  58. package/package.json +22 -6
  59. package/src/actions.ts +0 -245
  60. package/src/adapter.ts +0 -57
  61. package/src/assembly.test.ts +0 -728
  62. package/src/assembly.ts +0 -250
  63. package/src/audit-collector.test.ts +0 -332
  64. package/src/audit-collector.ts +0 -172
  65. package/src/auth.test.ts +0 -117
  66. package/src/authz-extension.test.ts +0 -269
  67. package/src/authz-extension.ts +0 -145
  68. package/src/correlation.ts +0 -61
  69. package/src/default-director.test.ts +0 -314
  70. package/src/default-director.ts +0 -344
  71. package/src/director.ts +0 -87
  72. package/src/errors.test.ts +0 -133
  73. package/src/errors.ts +0 -115
  74. package/src/gates.ts +0 -128
  75. package/src/harness.test.ts +0 -655
  76. package/src/harness.ts +0 -1571
  77. package/src/index.ts +0 -76
  78. package/src/providers/anthropic.test.ts +0 -771
  79. package/src/providers/anthropic.ts +0 -810
  80. package/src/providers/google-genai-files.ts +0 -289
  81. package/src/providers/google-genai.ts +0 -1518
  82. package/src/providers/openai.ts +0 -719
  83. package/src/providers/registry.ts +0 -33
  84. package/src/reactor.test.ts +0 -3660
  85. package/src/reactor.ts +0 -1058
  86. package/src/scheduler.test.ts +0 -41
  87. package/src/sse.test.ts +0 -133
  88. package/src/sse.ts +0 -76
  89. package/src/state.ts +0 -135
  90. package/src/transform.test.ts +0 -207
  91. package/src/transform.ts +0 -159
  92. package/src/transforms/index.ts +0 -2
  93. package/src/transforms/size-cap.test.ts +0 -172
  94. package/src/transforms/size-cap.ts +0 -110
  95. package/src/turns.ts +0 -54
  96. package/tsconfig.json +0 -4
  97. 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;