@zenera/neo 1.1.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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +178 -0
  3. package/dist/agent.d.ts +66 -0
  4. package/dist/agent.js +97 -0
  5. package/dist/architecture.d.ts +74 -0
  6. package/dist/architecture.js +105 -0
  7. package/dist/embedding.d.ts +60 -0
  8. package/dist/embedding.js +21 -0
  9. package/dist/embeddings/gemini.d.ts +24 -0
  10. package/dist/embeddings/gemini.js +71 -0
  11. package/dist/embeddings/index.d.ts +4 -0
  12. package/dist/embeddings/index.js +4 -0
  13. package/dist/embeddings/openai.d.ts +18 -0
  14. package/dist/embeddings/openai.js +27 -0
  15. package/dist/embeddings/openrouter.d.ts +21 -0
  16. package/dist/embeddings/openrouter.js +54 -0
  17. package/dist/events.d.ts +144 -0
  18. package/dist/events.js +110 -0
  19. package/dist/ids.d.ts +14 -0
  20. package/dist/ids.js +33 -0
  21. package/dist/index.d.ts +25 -0
  22. package/dist/index.js +25 -0
  23. package/dist/inspect/client.d.ts +2 -0
  24. package/dist/inspect/client.js +1326 -0
  25. package/dist/inspect/css.d.ts +2 -0
  26. package/dist/inspect/css.js +164 -0
  27. package/dist/inspect/index.d.ts +9 -0
  28. package/dist/inspect/index.js +12 -0
  29. package/dist/inspect/page.d.ts +3 -0
  30. package/dist/inspect/page.js +93 -0
  31. package/dist/inspect/report.d.ts +54 -0
  32. package/dist/inspect/report.js +62 -0
  33. package/dist/kernel.d.ts +178 -0
  34. package/dist/kernel.js +929 -0
  35. package/dist/memory-stores/factory.d.ts +15 -0
  36. package/dist/memory-stores/factory.js +29 -0
  37. package/dist/memory-stores/file.d.ts +37 -0
  38. package/dist/memory-stores/file.js +174 -0
  39. package/dist/memory-stores/in-memory.d.ts +17 -0
  40. package/dist/memory-stores/in-memory.js +80 -0
  41. package/dist/memory-stores/index.d.ts +4 -0
  42. package/dist/memory-stores/index.js +5 -0
  43. package/dist/memory.d.ts +115 -0
  44. package/dist/memory.js +213 -0
  45. package/dist/model.d.ts +25 -0
  46. package/dist/model.js +2 -0
  47. package/dist/models/anthropic.d.ts +36 -0
  48. package/dist/models/anthropic.js +293 -0
  49. package/dist/models/factory.d.ts +202 -0
  50. package/dist/models/factory.js +533 -0
  51. package/dist/models/gemini.d.ts +45 -0
  52. package/dist/models/gemini.js +368 -0
  53. package/dist/models/index.d.ts +7 -0
  54. package/dist/models/index.js +7 -0
  55. package/dist/models/openai-chat.d.ts +19 -0
  56. package/dist/models/openai-chat.js +203 -0
  57. package/dist/models/openai-responses.d.ts +31 -0
  58. package/dist/models/openai-responses.js +258 -0
  59. package/dist/models/openrouter.d.ts +44 -0
  60. package/dist/models/openrouter.js +230 -0
  61. package/dist/payload-stores/factory.d.ts +15 -0
  62. package/dist/payload-stores/factory.js +30 -0
  63. package/dist/payload-stores/file.d.ts +29 -0
  64. package/dist/payload-stores/file.js +112 -0
  65. package/dist/payload-stores/in-memory.d.ts +17 -0
  66. package/dist/payload-stores/in-memory.js +40 -0
  67. package/dist/payload-stores/index.d.ts +4 -0
  68. package/dist/payload-stores/index.js +5 -0
  69. package/dist/payload.d.ts +89 -0
  70. package/dist/payload.js +181 -0
  71. package/dist/project/config.d.ts +302 -0
  72. package/dist/project/config.js +290 -0
  73. package/dist/project/index.d.ts +4 -0
  74. package/dist/project/index.js +4 -0
  75. package/dist/project/load.d.ts +142 -0
  76. package/dist/project/load.js +430 -0
  77. package/dist/project/refs.d.ts +23 -0
  78. package/dist/project/refs.js +70 -0
  79. package/dist/prompt.d.ts +66 -0
  80. package/dist/prompt.js +62 -0
  81. package/dist/runner.d.ts +103 -0
  82. package/dist/runner.js +537 -0
  83. package/dist/services.d.ts +23 -0
  84. package/dist/services.js +44 -0
  85. package/dist/skill-providers/factory.d.ts +16 -0
  86. package/dist/skill-providers/factory.js +26 -0
  87. package/dist/skill-providers/file.d.ts +44 -0
  88. package/dist/skill-providers/file.js +209 -0
  89. package/dist/skill-providers/index.d.ts +4 -0
  90. package/dist/skill-providers/index.js +5 -0
  91. package/dist/skill-providers/static.d.ts +13 -0
  92. package/dist/skill-providers/static.js +47 -0
  93. package/dist/skills.d.ts +102 -0
  94. package/dist/skills.js +232 -0
  95. package/dist/state.d.ts +86 -0
  96. package/dist/state.js +49 -0
  97. package/dist/tools/exa.d.ts +23 -0
  98. package/dist/tools/exa.js +389 -0
  99. package/dist/tools/index.d.ts +4 -0
  100. package/dist/tools/index.js +6 -0
  101. package/dist/tools/sandbox.d.ts +172 -0
  102. package/dist/tools/sandbox.js +602 -0
  103. package/dist/tools/workspace.d.ts +53 -0
  104. package/dist/tools/workspace.js +1034 -0
  105. package/dist/trajectory.d.ts +213 -0
  106. package/dist/trajectory.js +232 -0
  107. package/dist/types.d.ts +195 -0
  108. package/dist/types.js +134 -0
  109. package/package.json +98 -0
@@ -0,0 +1,202 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { GoogleGenAI } from '@google/genai';
3
+ import type { OpenRouter } from '@openrouter/sdk';
4
+ import type OpenAI from 'openai';
5
+ import type { Embedder } from '../embedding.ts';
6
+ import { type GeminiEmbedderOptions } from '../embeddings/gemini.ts';
7
+ import { type OpenAIEmbedderOptions } from '../embeddings/openai.ts';
8
+ import { type OpenRouterEmbedderOptions } from '../embeddings/openrouter.ts';
9
+ import type { Model } from '../model.ts';
10
+ import { type AnthropicModelOptions } from './anthropic.ts';
11
+ import { type GeminiModelOptions } from './gemini.ts';
12
+ import { type OpenAIResponsesModelOptions } from './openai-responses.ts';
13
+ import { type OpenRouterModelOptions } from './openrouter.ts';
14
+ /**
15
+ * A *provider* is a connection; a *model* is a request shape. They used to be
16
+ * one type, which made "two OpenAI keys" mean repeating credentials on every
17
+ * model that used the second one — and gave every agent its own HTTP client,
18
+ * with its own connection pool and its own retry budget.
19
+ *
20
+ * Separated, credentials are declared once under a name, the client behind that
21
+ * name is built once and shared, and a model spec becomes vendor-neutral: a
22
+ * provider, an id, and knobs.
23
+ */
24
+ export type ProviderKind = 'openai' | 'google' | 'vertex' | 'anthropic' | 'openrouter' | 'openai-compatible';
25
+ export type OpenAIApi = 'chat' | 'responses';
26
+ /** The vendor client behind a provider name. */
27
+ export type ProviderClient = OpenAI | Anthropic | GoogleGenAI | OpenRouter;
28
+ /**
29
+ * How to reach a provider. Every field has an env fallback so a spec can stay
30
+ * declarative (and secret-free) in application code.
31
+ */
32
+ export interface Credentials {
33
+ /** literal key, or a `${VAR}` reference — wins over any env lookup */
34
+ apiKey?: string;
35
+ /** env var holding the key; defaults to the kind's conventional name */
36
+ apiKeyEnv?: string;
37
+ /** literal base url, or a `${VAR}` reference, for gateways and compatible endpoints */
38
+ baseURL?: string;
39
+ /** env var holding the base url; defaults to the kind's conventional name */
40
+ baseURLEnv?: string;
41
+ }
42
+ /** A named connection to a vendor. One client is built per registered name. */
43
+ export interface ProviderSpec extends Credentials {
44
+ /** which vendor this speaks; defaults to `openai` */
45
+ kind?: ProviderKind;
46
+ /**
47
+ * vertex only: GCP project id. Falls back to `GOOGLE_CLOUD_PROJECT`, then
48
+ * to the `project_id` inside the service-account key file named by
49
+ * `GOOGLE_APPLICATION_CREDENTIALS`.
50
+ */
51
+ project?: string;
52
+ /** vertex only: a region, or `global` (env: `GOOGLE_CLOUD_LOCATION`, default `global`) */
53
+ location?: string;
54
+ /**
55
+ * Returns a bearer token, once per request, so a short-lived credential can
56
+ * be refreshed without rebuilding the client. Azure AD and gateways that
57
+ * mint their own grants are the cases; Vertex is not, because the GenAI SDK
58
+ * already resolves and refreshes Application Default Credentials. Code
59
+ * only: a function is not something yaml can hold.
60
+ */
61
+ token?: () => string | Promise<string>;
62
+ /** sent on every request — gateway routing, attribution, api versions */
63
+ headers?: Record<string, string>;
64
+ timeoutMs?: number;
65
+ maxRetries?: number;
66
+ /**
67
+ * Pre-built client — bypasses credential resolution entirely. The seam for
68
+ * auth no configuration can express: Vertex service accounts, Bedrock
69
+ * signing, or a stub in tests.
70
+ */
71
+ client?: ProviderClient;
72
+ }
73
+ /**
74
+ * What to ask for, and of whom. Vendor differences live in the *provider*, so
75
+ * there is nothing here to discriminate on: the option interfaces are unioned
76
+ * and the knobs that do not apply to the chosen vendor are ignored.
77
+ *
78
+ * `Credentials` are still accepted inline, for a one-off model that does not
79
+ * warrant a declared provider. Using them opts out of the shared client.
80
+ */
81
+ export interface ModelSpec extends Credentials, OpenAIResponsesModelOptions, AnthropicModelOptions, GeminiModelOptions, OpenRouterModelOptions {
82
+ /**
83
+ * Registered provider name. The built-in providers are named after their
84
+ * kind, so `provider: 'google'` works with nothing declared. Defaults to
85
+ * the registry's default provider.
86
+ */
87
+ provider?: string;
88
+ /** which API to speak; defaults to the vendor's usual one */
89
+ api?: OpenAIApi;
90
+ model: string;
91
+ /** pre-built client — bypasses provider resolution entirely */
92
+ client?: ProviderClient;
93
+ }
94
+ /**
95
+ * Shorthand: `[provider[/api]:]model`, e.g. `gpt-4o`, `openai:gpt-4o`,
96
+ * `openai/responses:o3`, `gemini-eu:gemini-2.5-pro`.
97
+ *
98
+ * Only the *first* colon separates, so a fine-tuned id keeps its own — it just
99
+ * has to name its provider: `openai:ft:gpt-4o:acme::a1b2`. Anything the
100
+ * shorthand cannot express (keys, base urls, reasoning knobs) needs the object
101
+ * form.
102
+ */
103
+ export type ModelRef = ModelSpec | string;
104
+ /**
105
+ * The same idea one layer down: which vectoriser, and of whom.
106
+ *
107
+ * A separate type from `ModelSpec` rather than a flag on it, because the two
108
+ * share only their connection. There is no `api` field — `/v1/responses` has no
109
+ * embeddings endpoint, so naming one would be meaningless on every protocol,
110
+ * not just the three that already have a single API.
111
+ */
112
+ export interface EmbeddingSpec extends Credentials, OpenAIEmbedderOptions, GeminiEmbedderOptions, OpenRouterEmbedderOptions {
113
+ /** registered provider name; defaults to the registry's default provider */
114
+ provider?: string;
115
+ model: string;
116
+ /** pre-built client — bypasses provider resolution entirely */
117
+ client?: ProviderClient;
118
+ }
119
+ /** Shorthand: `[provider:]model`, e.g. `text-embedding-3-small`, `google:gemini-embedding-001`. */
120
+ export type EmbeddingRef = EmbeddingSpec | string;
121
+ /**
122
+ * What a ref *would* connect with. `model()` answers the same question by
123
+ * building a client — which needs the very credential a caller wanting to
124
+ * report on credentials does not have. This resolves the same precedence rules
125
+ * and stops there, so a CLI can say which model is unreachable before anything
126
+ * throws three frames deeper.
127
+ */
128
+ export interface ModelRequirement {
129
+ /** the provider name the ref resolves to, declared or built-in */
130
+ provider: string;
131
+ kind: ProviderKind;
132
+ /** env var consulted when the spec carries no `apiKey` of its own */
133
+ apiKeyEnv: string;
134
+ /** a client could be built as things stand */
135
+ satisfied: boolean;
136
+ /** the SDK authenticates without a key, so `satisfied` says little */
137
+ keyOptional: boolean;
138
+ }
139
+ export declare const providerKinds: ProviderKind[];
140
+ export declare function isProviderKind(name: string): name is ProviderKind;
141
+ /**
142
+ * Substitutes `${VAR}` references. An unset variable with no fallback is an
143
+ * error naming both the variable and where it was written, because the
144
+ * alternative is an empty api key and a 401 three layers away.
145
+ */
146
+ export declare function expandEnv(value: string, where: string): string;
147
+ /**
148
+ * Named providers, and the clients behind them.
149
+ *
150
+ * The clients are why this is an object rather than a function: one `OpenAI`
151
+ * per provider name, built on first use and shared by every model and every
152
+ * agent that names it. A registry is also the seam a host uses to point a name
153
+ * at different credentials, or at a stub — neither of which should mean
154
+ * touching a `switch`.
155
+ */
156
+ export declare class ModelRegistry {
157
+ #private;
158
+ /** Declares (or replaces) a provider. Nothing is contacted until it is used. */
159
+ provider(name: string, spec?: ProviderSpec): this;
160
+ /** Names the provider a bare model id belongs to. */
161
+ setDefault(name: string): this;
162
+ get defaultProvider(): string;
163
+ /** Declared here, or a built-in kind usable with no declaration at all. */
164
+ has(name: string): boolean;
165
+ names(): string[];
166
+ /** The shared client for a provider, built on first use. */
167
+ client(name: string): ProviderClient;
168
+ /** Turns a shorthand or a spec into a `Model`. */
169
+ model(ref: ModelRef): Model;
170
+ /**
171
+ * Turns a shorthand or a spec into an `Embedder`, over the same providers
172
+ * and the same shared clients as `model()` — an `openai` key declared once
173
+ * generates and embeds without being mentioned twice.
174
+ */
175
+ embedder(ref: EmbeddingRef): Embedder;
176
+ /**
177
+ * What a ref needs to reach its vendor, resolved but not contacted. An
178
+ * unknown provider still throws: that is a broken config, not a missing
179
+ * credential, and the two want different words.
180
+ */
181
+ requirement(ref: ModelRef | EmbeddingRef): ModelRequirement;
182
+ /** `[provider[/api]:]model` → spec. Exposed so a caller can validate a ref. */
183
+ parse(ref: string): ModelSpec;
184
+ /** A declared kind wins; otherwise a built-in name is its own kind. */
185
+ kindOf(name: string): ProviderKind;
186
+ }
187
+ /**
188
+ * The registry behind the bare `createModel`. An application that never
189
+ * declares a provider still gets shared clients through it, because the
190
+ * built-in names (`openai`, `google`, …) resolve without declaration.
191
+ */
192
+ export declare const defaultModels: ModelRegistry;
193
+ /**
194
+ * One entry point for every provider. Accepts a shorthand string or a full
195
+ * spec, so `createModel('openai/responses:o3')` and
196
+ * `createModel({ model: 'o3', api: 'responses', apiKeyEnv: 'MY_KEY' })` are
197
+ * both valid.
198
+ */
199
+ export declare function createModel(ref: ModelRef, registry?: ModelRegistry): Model;
200
+ /** `createModel`'s counterpart for vectors, over the same registry and clients. */
201
+ export declare function createEmbedder(ref: EmbeddingRef, registry?: ModelRegistry): Embedder;
202
+ //# sourceMappingURL=factory.d.ts.map