bazis 0.99.0 → 0.99.1

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.
@@ -62,6 +62,15 @@ export class AgentRuntime {
62
62
  return this.catalog.listTools();
63
63
  }
64
64
 
65
+ /**
66
+ * Checks a definition the way `run` does, without calling the model: an
67
+ * invalid field or a tool name not registered in `@Module.tools` throws
68
+ * AgentSetupError. Use it before saving a definition an operator edited.
69
+ */
70
+ check(definition: AgentDataDefinition): void {
71
+ AgentRegistry.fromDefinition(definition, this.catalog.listTools());
72
+ }
73
+
65
74
  /**
66
75
  * Runs one agent definition. An invalid definition, or a tool name that is
67
76
  * not registered in `@Module.tools`, rejects with AgentSetupError before the
@@ -59,7 +59,8 @@ export class SupportService {
59
59
  tool name that is not registered in `@Module.tools` rejects with
60
60
  `AgentSetupError` that lists the registered names. The model sees only the
61
61
  Tools the definition names. `runtime.listTools()` returns the whole catalog,
62
- for example for an agent editor.
62
+ for example for an agent editor, and `runtime.check(definition)` runs the same
63
+ check without the model — call it before saving a definition an operator edited.
63
64
 
64
65
  The definition's `instructions` are the system message, sent as written.
65
66
  `description` is for people and catalogs and is not sent to the model.
@@ -232,7 +232,7 @@ export class CodexAppServerClient implements CodexClient {
232
232
  if (method === "account/updated") this.modelCache = undefined;
233
233
  }, () => { this.clearLogin(); this.modelCache = undefined; });
234
234
  const initialized = await client.request("initialize", {
235
- clientInfo: { name: "bazis", title: "Bazis", version: "0.99.0" }, capabilities: { experimentalApi: true },
235
+ clientInfo: { name: "bazis", title: "Bazis", version: "0.99.1" }, capabilities: { experimentalApi: true },
236
236
  }, 15_000, signal);
237
237
  if (resolve(text(initialized.codexHome, 4096)) !== this.paths.home) throw new CodexError("PROTOCOL_ERROR");
238
238
  client.notify("initialized");
@@ -461,12 +461,23 @@ export function createOpenApiCodegenAnalyzer(input: OpenApiCodegenAnalyzerInput)
461
461
  };
462
462
 
463
463
  const schemaFromArrayTsType = (type: ts.Type, seen: Set<string>): OpenApiCodegenSchema => {
464
- if (checker.isTupleType(type)) {
465
- const tupleArgs = typeArgumentsOf(type);
466
- return { type: "array", items: mergeResponseSchemas(tupleArgs.map((item) => schemaFromTsType(item, seen))) ?? {} };
464
+ // A recursive alias can close its loop through an array without an object
465
+ // in between (`type Json = … | readonly Json[]`): the repeat is an untyped array.
466
+ const key = typeIdentity(type);
467
+ if (seen.has(key)) {
468
+ return { type: "array" };
469
+ }
470
+ seen.add(key);
471
+ try {
472
+ if (checker.isTupleType(type)) {
473
+ const tupleArgs = typeArgumentsOf(type);
474
+ return { type: "array", items: mergeResponseSchemas(tupleArgs.map((item) => schemaFromTsType(item, seen))) ?? {} };
475
+ }
476
+ const args = typeArgumentsOf(type);
477
+ return { type: "array", items: args[0] ? schemaFromTsType(args[0], seen) : {} };
478
+ } finally {
479
+ seen.delete(key);
467
480
  }
468
- const args = typeArgumentsOf(type);
469
- return { type: "array", items: args[0] ? schemaFromTsType(args[0], seen) : {} };
470
481
  };
471
482
 
472
483
  const schemaFromObjectTsType = (type: ts.Type, seen: Set<string>): OpenApiCodegenSchema => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bazis",
3
- "version": "0.99.0",
3
+ "version": "0.99.1",
4
4
  "description": "Modular backend framework for Bun in TypeScript: DI wired by codegen, HTTP, a PostgreSQL ORM, JWT, WebSocket, agents and a CLI.",
5
5
  "license": "MIT",
6
6
  "author": "Alexander Alenin",