bazis 0.98.33 → 0.99.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/cli/templates/module.ts +4 -64
- package/cli/templates/passport.ts +14 -18
- package/core/agent/AgentContextBuilder.ts +4 -98
- package/core/agent/AgentRegistry.ts +79 -473
- package/core/agent/AgentRuntime.ts +47 -19
- package/core/agent/AgentToolExecutor.ts +3 -3
- package/core/agent/README.md +89 -181
- package/core/agent/index.ts +3 -31
- package/core/agent/internal/AgentExecutionDriver.ts +37 -392
- package/core/agent/internal/AgentExecutionState.ts +1 -9
- package/core/agent/metadata.ts +8 -303
- package/core/agent/semantic.ts +0 -4
- package/core/agent/session/contracts.ts +5 -7
- package/core/agent/session/entities.ts +0 -1
- package/core/cache/COMPATIBILITY.md +4 -4
- package/core/cache/README.md +2 -2
- package/core/cache/SPEC.md +30 -48
- package/core/cache/decorators/Cacheable.ts +4 -3
- package/core/cache/decorators/CacheableRedis.ts +3 -4
- package/core/cache/di/classProviderHook.ts +31 -0
- package/core/cache/distributed/DistributedCache.ts +96 -25
- package/core/cache/distributed/IDistributedCache.ts +9 -0
- package/core/cache/distributed/codecs.ts +49 -2
- package/core/cache/distributed/index.ts +1 -1
- package/core/cache/errors/CacheError.ts +17 -2
- package/core/cache/http/outputRedisCacheMiddleware.ts +11 -2
- package/core/cache/index.ts +2 -6
- package/core/cache/services/cacheProxy.ts +6 -2
- package/core/generatedRuntime.ts +0 -31
- package/core/infra/cache/RedisDistributedCacheBackend.ts +3 -0
- package/core/infra/connectors/codex/CodexAppServerClient.ts +1 -1
- package/core/infra/connectors/llm.ts +15 -1
- package/core/infra/connectors/llmRouter.ts +4 -0
- package/core/infra/connectors/redis.ts +9 -1
- package/core/scripts/di-generate.ts +28 -42
- package/core/scripts/tool-codegen.ts +122 -0
- package/index.ts +3 -24
- package/package.json +1 -1
- package/core/agent/decorators/Agent.ts +0 -11
- package/core/agent/decorators/Prompt.ts +0 -11
- package/core/agent/decorators/Task.ts +0 -29
- package/core/agent/generated/catalog.ts +0 -26
- package/core/scripts/agent-codegen.ts +0 -1166
package/index.ts
CHANGED
|
@@ -78,60 +78,44 @@ export {
|
|
|
78
78
|
} from "./core/di";
|
|
79
79
|
export {
|
|
80
80
|
AGENT_MODEL_PROVIDER,
|
|
81
|
-
|
|
82
|
-
AgentRegistry,
|
|
81
|
+
AGENT_RUNTIME_OPTIONS,
|
|
83
82
|
AgentRuntime,
|
|
84
83
|
AgentRuntimeError,
|
|
85
84
|
AgentSemanticError,
|
|
86
85
|
AgentToolExecutionError,
|
|
87
|
-
AgentToolExecutor,
|
|
88
86
|
ApproximateAgentContextTokenEstimator,
|
|
89
87
|
DefaultAgentContextBuilder,
|
|
90
|
-
Prompt,
|
|
91
|
-
Task,
|
|
92
88
|
Tool,
|
|
93
89
|
agentClassSchema,
|
|
94
90
|
agentData,
|
|
95
|
-
agentTaskMetadataOf,
|
|
96
91
|
agentInvocation,
|
|
97
92
|
agentJsonSchema,
|
|
98
93
|
agentMessage,
|
|
99
94
|
agentModelCapabilities,
|
|
100
95
|
agentModelRequest,
|
|
101
96
|
agentModelResponse,
|
|
102
|
-
agentOutput,
|
|
103
97
|
agentOutputContract,
|
|
104
98
|
agentText,
|
|
105
99
|
agentToolCall,
|
|
106
100
|
agentToolContract,
|
|
107
101
|
agentToolResult,
|
|
108
|
-
collectAgentCatalog,
|
|
109
|
-
type AgentCatalog,
|
|
110
|
-
type AgentCatalogExtras,
|
|
111
102
|
type AgentContext,
|
|
112
103
|
type AgentContextBuildInput,
|
|
113
104
|
type AgentContextBuilder,
|
|
114
105
|
type AgentContextLimits,
|
|
115
106
|
type AgentContextTokenEstimator,
|
|
116
107
|
type AgentContextTraceEntry,
|
|
117
|
-
type
|
|
108
|
+
type AgentDataDefinition,
|
|
118
109
|
type AgentInvocation,
|
|
119
110
|
type AgentMessage,
|
|
120
|
-
type AgentMetadataIndex,
|
|
121
|
-
type AgentTaskDefinition,
|
|
122
|
-
type AgentTaskMetadata,
|
|
123
|
-
type AgentTaskOptions,
|
|
124
|
-
type TaskDecoratorOptions,
|
|
125
111
|
type AgentModelCapabilities,
|
|
126
112
|
type AgentModelRequest,
|
|
127
113
|
type AgentModelResponse,
|
|
128
|
-
type AgentOptions,
|
|
129
114
|
type AgentOutputContract,
|
|
130
115
|
type AgentRuntimeInvokeOptions,
|
|
131
116
|
type AgentRuntimeOptions,
|
|
132
117
|
type AgentRuntimeResult,
|
|
133
118
|
type AgentRuntimeStatus,
|
|
134
|
-
type AgentRuntimeTaskInvokeOptions,
|
|
135
119
|
type AgentRuntimeToolExecutionOptions,
|
|
136
120
|
type AgentToolCall,
|
|
137
121
|
type AgentExecutableTool,
|
|
@@ -175,10 +159,7 @@ export {
|
|
|
175
159
|
type AgentModelProvider,
|
|
176
160
|
type AgentModelProviderContext,
|
|
177
161
|
type JsonValue,
|
|
178
|
-
type
|
|
179
|
-
type PromptSectionKind,
|
|
180
|
-
type PromptSectionMetadata,
|
|
181
|
-
type PromptSectionOptions,
|
|
162
|
+
type ToolDefinition,
|
|
182
163
|
type ToolOptions,
|
|
183
164
|
} from "./core/agent";
|
|
184
165
|
export {
|
|
@@ -204,8 +185,6 @@ export {
|
|
|
204
185
|
export {
|
|
205
186
|
Cacheable,
|
|
206
187
|
OutputCache,
|
|
207
|
-
cachedScoped,
|
|
208
|
-
cachedSingleton,
|
|
209
188
|
memory,
|
|
210
189
|
} from "./core/cache";
|
|
211
190
|
export {
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { defineAgentMetadata, type AgentOptions } from "../metadata";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Declares an executable agent class. The class stays a regular DI service;
|
|
5
|
-
* this decorator only adds framework metadata for discovery and validation.
|
|
6
|
-
*/
|
|
7
|
-
export function Agent(options: AgentOptions = {}) {
|
|
8
|
-
return (value: abstract new (...args: never[]) => unknown, context: ClassDecoratorContext): void => {
|
|
9
|
-
defineAgentMetadata(value, context.metadata, options);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { definePromptMetadata, type PromptOptions } from "../metadata";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Declares a reusable prompt contract. Prompts are metadata classes so modules
|
|
5
|
-
* can own and version them without exposing provider-specific APIs.
|
|
6
|
-
*/
|
|
7
|
-
export function Prompt(options: PromptOptions = {}) {
|
|
8
|
-
return (value: abstract new (...args: never[]) => unknown, context: ClassDecoratorContext): void => {
|
|
9
|
-
definePromptMetadata(value, context.metadata, options);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineAgentTaskMetadata, type AgentTaskOptions } from "../metadata";
|
|
2
|
-
|
|
3
|
-
type TaskDecorator = (value: (...args: never[]) => unknown, context: ClassMethodDecoratorContext) => void;
|
|
4
|
-
|
|
5
|
-
export type TaskDecoratorOptions = string | AgentTaskOptions;
|
|
6
|
-
|
|
7
|
-
function normalizeOptions(options: TaskDecoratorOptions | undefined): AgentTaskOptions {
|
|
8
|
-
if (options === undefined) {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
if (typeof options === "string") {
|
|
12
|
-
return { name: options };
|
|
13
|
-
}
|
|
14
|
-
return options;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Declares an executable agent task on an @Agent class. This mirrors
|
|
19
|
-
* controller action decorators: the method is a business operation contract,
|
|
20
|
-
* while AgentRuntime performs the actual AI execution.
|
|
21
|
-
*/
|
|
22
|
-
export function Task(options?: TaskDecoratorOptions): TaskDecorator {
|
|
23
|
-
return (_value, context) => {
|
|
24
|
-
if (context.static || context.private) {
|
|
25
|
-
throw new Error(`@Task supports public instance methods only ("${String(context.name)}").`);
|
|
26
|
-
}
|
|
27
|
-
defineAgentTaskMetadata(context.name, context.metadata, normalizeOptions(options));
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by `bazis codegen`.
|
|
2
|
-
// Do not edit manually.
|
|
3
|
-
|
|
4
|
-
import type { Class } from "../../di";
|
|
5
|
-
import type { AgentMetadataIndex } from "../AgentRegistry";
|
|
6
|
-
import type { AgentMetadata, PromptMetadata, ToolMetadata } from "../metadata";
|
|
7
|
-
|
|
8
|
-
function readonlyMetadataMap<K, V>(entries: readonly (readonly [K, V])[]): ReadonlyMap<K, V> {
|
|
9
|
-
const lookup = new Map<K, V>(entries);
|
|
10
|
-
const facade: ReadonlyMap<K, V> = {
|
|
11
|
-
get size() { return lookup.size; }, has: (key) => lookup.has(key), get: (key) => lookup.get(key),
|
|
12
|
-
entries: () => lookup.entries(), keys: () => lookup.keys(), values: () => lookup.values(),
|
|
13
|
-
forEach: (callback, thisArg) => { for (const [key, value] of lookup) callback.call(thisArg, value, key, facade); },
|
|
14
|
-
[Symbol.iterator]: () => lookup[Symbol.iterator](),
|
|
15
|
-
};
|
|
16
|
-
return Object.freeze(facade);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const GENERATED_AGENT_METADATA: AgentMetadataIndex = Object.freeze({
|
|
20
|
-
agents: readonlyMetadataMap<Class<object>, AgentMetadata>([
|
|
21
|
-
]),
|
|
22
|
-
tools: readonlyMetadataMap<Class<object>, ToolMetadata>([
|
|
23
|
-
]),
|
|
24
|
-
prompts: readonlyMetadataMap<Class<object>, PromptMetadata>([
|
|
25
|
-
]),
|
|
26
|
-
});
|