@inkeep/agents-cli 0.1.8 → 0.1.10

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/dist/index.js CHANGED
@@ -3122,7 +3122,7 @@ var require_util = __commonJS({
3122
3122
  }
3123
3123
  exports.evaluatedPropsToName = evaluatedPropsToName;
3124
3124
  function setEvaluated(gen, props, ps) {
3125
- Object.keys(ps).forEach((p3) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p3)}`, true));
3125
+ Object.keys(ps).forEach((p2) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p2)}`, true));
3126
3126
  }
3127
3127
  exports.setEvaluated = setEvaluated;
3128
3128
  var snippets = {};
@@ -3703,11 +3703,11 @@ var require_code2 = __commonJS({
3703
3703
  }
3704
3704
  exports.noPropertyInData = noPropertyInData;
3705
3705
  function allSchemaProperties(schemaMap) {
3706
- return schemaMap ? Object.keys(schemaMap).filter((p3) => p3 !== "__proto__") : [];
3706
+ return schemaMap ? Object.keys(schemaMap).filter((p2) => p2 !== "__proto__") : [];
3707
3707
  }
3708
3708
  exports.allSchemaProperties = allSchemaProperties;
3709
3709
  function schemaProperties(it, schemaMap) {
3710
- return allSchemaProperties(schemaMap).filter((p3) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p3]));
3710
+ return allSchemaProperties(schemaMap).filter((p2) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p2]));
3711
3711
  }
3712
3712
  exports.schemaProperties = schemaProperties;
3713
3713
  function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
@@ -4190,12 +4190,12 @@ var require_resolve = __commonJS({
4190
4190
  function getFullPath(resolver, id = "", normalize) {
4191
4191
  if (normalize !== false)
4192
4192
  id = normalizeId(id);
4193
- const p3 = resolver.parse(id);
4194
- return _getFullPath(resolver, p3);
4193
+ const p2 = resolver.parse(id);
4194
+ return _getFullPath(resolver, p2);
4195
4195
  }
4196
4196
  exports.getFullPath = getFullPath;
4197
- function _getFullPath(resolver, p3) {
4198
- const serialized = resolver.serialize(p3);
4197
+ function _getFullPath(resolver, p2) {
4198
+ const serialized = resolver.serialize(p2);
4199
4199
  return serialized.split("#")[0] + "#";
4200
4200
  }
4201
4201
  exports._getFullPath = _getFullPath;
@@ -4974,11 +4974,11 @@ var require_compile = __commonJS({
4974
4974
  return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
4975
4975
  }
4976
4976
  function resolveSchema(root, ref) {
4977
- const p3 = this.opts.uriResolver.parse(ref);
4978
- const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p3);
4977
+ const p2 = this.opts.uriResolver.parse(ref);
4978
+ const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p2);
4979
4979
  let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
4980
4980
  if (Object.keys(root.schema).length > 0 && refPath === baseId) {
4981
- return getJsonPointer.call(this, p3, root);
4981
+ return getJsonPointer.call(this, p2, root);
4982
4982
  }
4983
4983
  const id = (0, resolve_1.normalizeId)(refPath);
4984
4984
  const schOrRef = this.refs[id] || this.schemas[id];
@@ -4986,7 +4986,7 @@ var require_compile = __commonJS({
4986
4986
  const sch = resolveSchema.call(this, root, schOrRef);
4987
4987
  if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
4988
4988
  return;
4989
- return getJsonPointer.call(this, p3, sch);
4989
+ return getJsonPointer.call(this, p2, sch);
4990
4990
  }
4991
4991
  if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
4992
4992
  return;
@@ -5000,7 +5000,7 @@ var require_compile = __commonJS({
5000
5000
  baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
5001
5001
  return new SchemaEnv({ schema, schemaId, root, baseId });
5002
5002
  }
5003
- return getJsonPointer.call(this, p3, schOrRef);
5003
+ return getJsonPointer.call(this, p2, schOrRef);
5004
5004
  }
5005
5005
  exports.resolveSchema = resolveSchema;
5006
5006
  var PREVENT_SCOPE_CHANGE = /* @__PURE__ */ new Set([
@@ -5183,8 +5183,8 @@ var require_utils = __commonJS({
5183
5183
  }
5184
5184
  return ind;
5185
5185
  }
5186
- function removeDotSegments(path3) {
5187
- let input = path3;
5186
+ function removeDotSegments(path2) {
5187
+ let input = path2;
5188
5188
  const output = [];
5189
5189
  let nextSlash = -1;
5190
5190
  let len = 0;
@@ -5384,8 +5384,8 @@ var require_schemes = __commonJS({
5384
5384
  wsComponent.secure = void 0;
5385
5385
  }
5386
5386
  if (wsComponent.resourceName) {
5387
- const [path3, query] = wsComponent.resourceName.split("?");
5388
- wsComponent.path = path3 && path3 !== "/" ? path3 : void 0;
5387
+ const [path2, query] = wsComponent.resourceName.split("?");
5388
+ wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
5389
5389
  wsComponent.query = query;
5390
5390
  wsComponent.resourceName = void 0;
5391
5391
  }
@@ -6010,9 +6010,9 @@ var require_core = __commonJS({
6010
6010
  this.addSchema(_schema, ref, meta);
6011
6011
  }
6012
6012
  async function _loadSchema(ref) {
6013
- const p3 = this._loading[ref];
6014
- if (p3)
6015
- return p3;
6013
+ const p2 = this._loading[ref];
6014
+ if (p2)
6015
+ return p2;
6016
6016
  try {
6017
6017
  return await (this._loading[ref] = loadSchema(ref));
6018
6018
  } finally {
@@ -6189,7 +6189,7 @@ var require_core = __commonJS({
6189
6189
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
6190
6190
  if (!errors || errors.length === 0)
6191
6191
  return "No errors";
6192
- return errors.map((e2) => `${dataVar}${e2.instancePath} ${e2.message}`).reduce((text3, msg) => text3 + separator + msg);
6192
+ return errors.map((e2) => `${dataVar}${e2.instancePath} ${e2.message}`).reduce((text2, msg) => text2 + separator + msg);
6193
6193
  }
6194
6194
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
6195
6195
  const rules = this.RULES.all;
@@ -7509,12 +7509,12 @@ var require_additionalProperties = __commonJS({
7509
7509
  const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
7510
7510
  definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
7511
7511
  } else if (props.length) {
7512
- definedProp = (0, codegen_1.or)(...props.map((p3) => (0, codegen_1._)`${key} === ${p3}`));
7512
+ definedProp = (0, codegen_1.or)(...props.map((p2) => (0, codegen_1._)`${key} === ${p2}`));
7513
7513
  } else {
7514
7514
  definedProp = codegen_1.nil;
7515
7515
  }
7516
7516
  if (patProps.length) {
7517
- definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p3) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p3)}.test(${key})`));
7517
+ definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p2) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p2)}.test(${key})`));
7518
7518
  }
7519
7519
  return (0, codegen_1.not)(definedProp);
7520
7520
  }
@@ -7595,7 +7595,7 @@ var require_properties = __commonJS({
7595
7595
  if (it.opts.unevaluated && allProps.length && it.props !== true) {
7596
7596
  it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
7597
7597
  }
7598
- const properties = allProps.filter((p3) => !(0, util_1.alwaysValidSchema)(it, schema[p3]));
7598
+ const properties = allProps.filter((p2) => !(0, util_1.alwaysValidSchema)(it, schema[p2]));
7599
7599
  if (properties.length === 0)
7600
7600
  return;
7601
7601
  const valid = gen.name("valid");
@@ -7646,7 +7646,7 @@ var require_patternProperties = __commonJS({
7646
7646
  const { gen, schema, data, parentSchema, it } = cxt;
7647
7647
  const { opts } = it;
7648
7648
  const patterns = (0, code_1.allSchemaProperties)(schema);
7649
- const alwaysValidPatterns = patterns.filter((p3) => (0, util_1.alwaysValidSchema)(it, schema[p3]));
7649
+ const alwaysValidPatterns = patterns.filter((p2) => (0, util_1.alwaysValidSchema)(it, schema[p2]));
7650
7650
  if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
7651
7651
  return;
7652
7652
  }
@@ -9301,8 +9301,8 @@ var require_uri_all = __commonJS({
9301
9301
  wsComponents.secure = void 0;
9302
9302
  }
9303
9303
  if (wsComponents.resourceName) {
9304
- var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path3 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
9305
- wsComponents.path = path3 && path3 !== "/" ? path3 : void 0;
9304
+ var _wsComponents$resourc = wsComponents.resourceName.split("?"), _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2), path2 = _wsComponents$resourc2[0], query = _wsComponents$resourc2[1];
9305
+ wsComponents.path = path2 && path2 !== "/" ? path2 : void 0;
9306
9306
  wsComponents.query = query;
9307
9307
  wsComponents.resourceName = void 0;
9308
9308
  }
@@ -9642,12 +9642,12 @@ var require_util2 = __commonJS({
9642
9642
  return "'" + escapeQuotes(str) + "'";
9643
9643
  }
9644
9644
  function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
9645
- var path3 = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
9646
- return joinPaths(currentPath, path3);
9645
+ var path2 = jsonPointers ? "'/' + " + expr + (isNumber ? "" : ".replace(/~/g, '~0').replace(/\\//g, '~1')") : isNumber ? "'[' + " + expr + " + ']'" : "'[\\'' + " + expr + " + '\\']'";
9646
+ return joinPaths(currentPath, path2);
9647
9647
  }
9648
9648
  function getPath2(currentPath, prop, jsonPointers) {
9649
- var path3 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
9650
- return joinPaths(currentPath, path3);
9649
+ var path2 = jsonPointers ? toQuotedString("/" + escapeJsonPointer(prop)) : toQuotedString(getProperty(prop));
9650
+ return joinPaths(currentPath, path2);
9651
9651
  }
9652
9652
  var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
9653
9653
  var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
@@ -9841,12 +9841,12 @@ var require_resolve2 = __commonJS({
9841
9841
  return v2;
9842
9842
  }
9843
9843
  function resolveSchema(root, ref) {
9844
- var p3 = URI.parse(ref), refPath = _getFullPath(p3), baseId = getFullPath(this._getId(root.schema));
9844
+ var p2 = URI.parse(ref), refPath = _getFullPath(p2), baseId = getFullPath(this._getId(root.schema));
9845
9845
  if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
9846
9846
  var id = normalizeId(refPath);
9847
9847
  var refVal = this._refs[id];
9848
9848
  if (typeof refVal == "string") {
9849
- return resolveRecursive.call(this, root, refVal, p3);
9849
+ return resolveRecursive.call(this, root, refVal, p2);
9850
9850
  } else if (refVal instanceof SchemaObject) {
9851
9851
  if (!refVal.validate) this._compile(refVal);
9852
9852
  root = refVal;
@@ -9864,7 +9864,7 @@ var require_resolve2 = __commonJS({
9864
9864
  if (!root.schema) return;
9865
9865
  baseId = getFullPath(this._getId(root.schema));
9866
9866
  }
9867
- return getJsonPointer.call(this, p3, baseId, root.schema, root);
9867
+ return getJsonPointer.call(this, p2, baseId, root.schema, root);
9868
9868
  }
9869
9869
  function resolveRecursive(root, ref, parsedRef) {
9870
9870
  var res = resolveSchema.call(this, root, ref);
@@ -9969,11 +9969,11 @@ var require_resolve2 = __commonJS({
9969
9969
  }
9970
9970
  function getFullPath(id, normalize) {
9971
9971
  if (normalize !== false) id = normalizeId(id);
9972
- var p3 = URI.parse(id);
9973
- return _getFullPath(p3);
9972
+ var p2 = URI.parse(id);
9973
+ return _getFullPath(p2);
9974
9974
  }
9975
- function _getFullPath(p3) {
9976
- return URI.serialize(p3).split("#")[0] + "#";
9975
+ function _getFullPath(p2) {
9976
+ return URI.serialize(p2).split("#")[0] + "#";
9977
9977
  }
9978
9978
  var TRAILING_SLASH_HASH = /#\/?$/;
9979
9979
  function normalizeId(id) {
@@ -12809,8 +12809,8 @@ var require_properties2 = __commonJS({
12809
12809
  if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
12810
12810
  var $requiredHash = it.util.toHash($required);
12811
12811
  }
12812
- function notProto(p3) {
12813
- return p3 !== "__proto__";
12812
+ function notProto(p2) {
12813
+ return p2 !== "__proto__";
12814
12814
  }
12815
12815
  out += "var " + $errs + " = errors;var " + $nextValid + " = true;";
12816
12816
  if ($ownProperties) {
@@ -13731,19 +13731,19 @@ var require_async = __commonJS({
13731
13731
  callback = meta;
13732
13732
  meta = void 0;
13733
13733
  }
13734
- var p3 = loadMetaSchemaOf(schema).then(function() {
13734
+ var p2 = loadMetaSchemaOf(schema).then(function() {
13735
13735
  var schemaObj = self._addSchema(schema, void 0, meta);
13736
13736
  return schemaObj.validate || _compileAsync(schemaObj);
13737
13737
  });
13738
13738
  if (callback) {
13739
- p3.then(
13739
+ p2.then(
13740
13740
  function(v2) {
13741
13741
  callback(null, v2);
13742
13742
  },
13743
13743
  callback
13744
13744
  );
13745
13745
  }
13746
- return p3;
13746
+ return p2;
13747
13747
  function loadMetaSchemaOf(sch) {
13748
13748
  var $schema = sch.$schema;
13749
13749
  return $schema && !self.getSchema($schema) ? compileAsync.call(self, { $ref: $schema }, true) : Promise.resolve();
@@ -14634,12 +14634,12 @@ var require_ajv2 = __commonJS({
14634
14634
  options = options || {};
14635
14635
  var separator = options.separator === void 0 ? ", " : options.separator;
14636
14636
  var dataVar = options.dataVar === void 0 ? "data" : options.dataVar;
14637
- var text3 = "";
14637
+ var text2 = "";
14638
14638
  for (var i2 = 0; i2 < errors.length; i2++) {
14639
14639
  var e2 = errors[i2];
14640
- if (e2) text3 += dataVar + e2.dataPath + " " + e2.message + separator;
14640
+ if (e2) text2 += dataVar + e2.dataPath + " " + e2.message + separator;
14641
14641
  }
14642
- return text3.slice(0, -separator.length);
14642
+ return text2.slice(0, -separator.length);
14643
14643
  }
14644
14644
  function addFormat(name, format) {
14645
14645
  if (typeof format == "string") format = new RegExp(format);
@@ -14741,10 +14741,10 @@ async function chatCommandEnhanced(graphIdInput, options) {
14741
14741
  );
14742
14742
  let graphId = graphIdInput;
14743
14743
  if (!graphId) {
14744
- const spinner3 = ora5("Fetching available graphs...").start();
14744
+ const spinner2 = ora5("Fetching available graphs...").start();
14745
14745
  try {
14746
14746
  const graphs = await managementApi.listGraphs();
14747
- spinner3.stop();
14747
+ spinner2.stop();
14748
14748
  if (graphs.length === 0) {
14749
14749
  console.error(
14750
14750
  chalk7.red("No graphs available. Push a graph first with: inkeep push <graph-path>")
@@ -14768,16 +14768,16 @@ async function chatCommandEnhanced(graphIdInput, options) {
14768
14768
  ]);
14769
14769
  graphId = answer.graphId;
14770
14770
  } catch (error) {
14771
- spinner3.fail("Failed to fetch graphs");
14771
+ spinner2.fail("Failed to fetch graphs");
14772
14772
  console.error(chalk7.red("Error:"), error instanceof Error ? error.message : error);
14773
14773
  process.exit(1);
14774
14774
  }
14775
14775
  }
14776
- const spinner2 = ora5("Connecting to graph...").start();
14776
+ const spinner = ora5("Connecting to graph...").start();
14777
14777
  try {
14778
14778
  const graph = await managementApi.getGraph(graphId);
14779
14779
  if (!graph) {
14780
- spinner2.fail(`Graph "${graphId}" not found`);
14780
+ spinner.fail(`Graph "${graphId}" not found`);
14781
14781
  const graphs = await managementApi.listGraphs();
14782
14782
  if (graphs.length > 0) {
14783
14783
  console.log(chalk7.yellow("\nAvailable graphs:"));
@@ -14791,7 +14791,7 @@ async function chatCommandEnhanced(graphIdInput, options) {
14791
14791
  }
14792
14792
  process.exit(1);
14793
14793
  }
14794
- spinner2.succeed(`Connected to graph: ${chalk7.green(graph.name || graphId)}`);
14794
+ spinner.succeed(`Connected to graph: ${chalk7.green(graph.name || graphId)}`);
14795
14795
  if (graph.description) {
14796
14796
  console.log(chalk7.gray(`Description: ${graph.description}`));
14797
14797
  }
@@ -14799,7 +14799,7 @@ async function chatCommandEnhanced(graphIdInput, options) {
14799
14799
  console.log(chalk7.gray(`Default Agent: ${graph.defaultAgentId || graph.default_agent_id}`));
14800
14800
  }
14801
14801
  } catch (error) {
14802
- spinner2.fail("Failed to connect to graph");
14802
+ spinner.fail("Failed to connect to graph");
14803
14803
  console.error(chalk7.red("Error:"), error instanceof Error ? error.message : error);
14804
14804
  process.exit(1);
14805
14805
  }
@@ -15134,51 +15134,87 @@ async function configListCommand(options) {
15134
15134
  await configGetCommand(void 0, options);
15135
15135
  }
15136
15136
 
15137
- // src/commands/create.ts
15137
+ // src/commands/dev.ts
15138
15138
  init_esm_shims();
15139
- import color from "picocolors";
15140
- import * as p from "@clack/prompts";
15141
- import fs from "fs-extra";
15142
- import { exec } from "child_process";
15143
- import { promisify } from "util";
15144
- import path2 from "path";
15139
+ import { fork } from "child_process";
15140
+ import { existsSync as existsSync2 } from "fs";
15141
+ import { createRequire } from "module";
15142
+ import { dirname, join as join2 } from "path";
15143
+ import chalk2 from "chalk";
15144
+ import ora from "ora";
15145
+ var require2 = createRequire(import.meta.url);
15146
+ function resolveWebRuntime() {
15147
+ try {
15148
+ const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
15149
+ const root = dirname(pkg);
15150
+ return join2(root, ".next/standalone/agents-manage-ui");
15151
+ } catch (err) {
15152
+ throw new Error(`Could not find @inkeep/agents-manage-ui package. ${err}`);
15153
+ }
15154
+ }
15155
+ function startWebApp({ port = 3e3, host = "localhost" }) {
15156
+ const spinner = ora("Starting dashboard server...").start();
15157
+ try {
15158
+ const rt = resolveWebRuntime();
15159
+ const entry = join2(rt, "server.js");
15160
+ console.log(entry);
15161
+ if (!existsSync2(entry)) {
15162
+ spinner.fail("Dashboard server not found");
15163
+ console.error(
15164
+ chalk2.red("The dashboard server has not been built yet. Please run the following commands:")
15165
+ );
15166
+ console.error(chalk2.yellow(" cd agents-manage-ui"));
15167
+ console.error(chalk2.yellow(" pnpm build"));
15168
+ console.error(chalk2.yellow(" pnpm start"));
15169
+ process.exit(1);
15170
+ }
15171
+ spinner.succeed("Starting dashboard server...");
15172
+ const child = fork(entry, [], {
15173
+ cwd: rt,
15174
+ env: {
15175
+ ...process.env,
15176
+ NODE_ENV: "production",
15177
+ PORT: String(port),
15178
+ HOSTNAME: host
15179
+ },
15180
+ stdio: "inherit"
15181
+ });
15182
+ console.log(chalk2.green(`\u{1F680} Dashboard server started at http://${host}:${port}`));
15183
+ console.log(chalk2.gray("Press Ctrl+C to stop the server"));
15184
+ process.on("SIGINT", () => {
15185
+ console.log(chalk2.yellow("\n\u{1F6D1} Stopping dashboard server..."));
15186
+ child.kill("SIGINT");
15187
+ process.exit(0);
15188
+ });
15189
+ process.on("SIGTERM", () => {
15190
+ child.kill("SIGTERM");
15191
+ process.exit(0);
15192
+ });
15193
+ return child;
15194
+ } catch (error) {
15195
+ spinner.fail("Failed to start dashboard server");
15196
+ console.error(chalk2.red("Error:"), error instanceof Error ? error.message : "Unknown error");
15197
+ process.exit(1);
15198
+ }
15199
+ }
15200
+ async function devCommand(options) {
15201
+ const { port = 3e3, host = "localhost" } = options;
15202
+ console.log(chalk2.blue("Inkeep Dashboard Server"));
15203
+ console.log(chalk2.gray(`Starting server on ${host}:${port}`));
15204
+ console.log("");
15205
+ startWebApp({ port, host });
15206
+ }
15207
+
15208
+ // src/commands/init.ts
15209
+ init_esm_shims();
15210
+ import { existsSync as existsSync3, readdirSync, writeFileSync as writeFileSync2 } from "fs";
15211
+ import { basename, dirname as dirname2, join as join3, resolve } from "path";
15212
+ import chalk3 from "chalk";
15213
+ import inquirer2 from "inquirer";
15145
15214
 
15146
15215
  // src/utils/model-config.ts
15147
15216
  init_esm_shims();
15148
15217
  import inquirer from "inquirer";
15149
- var defaultDualModelConfigurations = {
15150
- base: {
15151
- model: "anthropic/claude-sonnet-4-20250514"
15152
- },
15153
- structuredOutput: {
15154
- model: "openai/gpt-4.1-mini-2025-04-14"
15155
- },
15156
- summarizer: {
15157
- model: "openai/gpt-4.1-nano-2025-04-14"
15158
- }
15159
- };
15160
- var defaultOpenaiModelConfigurations = {
15161
- base: {
15162
- model: "openai/gpt-5-2025-08-07"
15163
- },
15164
- structuredOutput: {
15165
- model: "openai/gpt-4.1-mini-2025-04-14"
15166
- },
15167
- summarizer: {
15168
- model: "openai/gpt-4.1-nano-2025-04-14"
15169
- }
15170
- };
15171
- var defaultAnthropicModelConfigurations = {
15172
- base: {
15173
- model: "anthropic/claude-sonnet-4-20250514"
15174
- },
15175
- structuredOutput: {
15176
- model: "anthropic/claude-sonnet-4-20250514"
15177
- },
15178
- summarizer: {
15179
- model: "anthropic/claude-sonnet-4-20250514"
15180
- }
15181
- };
15182
15218
  async function promptForModelConfiguration() {
15183
15219
  const { providers } = await inquirer.prompt([
15184
15220
  {
@@ -15266,903 +15302,7 @@ async function promptForModelConfiguration() {
15266
15302
  return { modelSettings };
15267
15303
  }
15268
15304
 
15269
- // src/commands/create.ts
15270
- var execAsync = promisify(exec);
15271
- var createAgents = async (args = {}) => {
15272
- let { tenantId, projectId, dirName, openAiKey, anthropicKey, manageApiPort, runApiPort } = args;
15273
- p.intro(color.inverse(" Create Agents Directory "));
15274
- if (!dirName) {
15275
- const dirResponse = await p.text({
15276
- message: "What do you want to name your agents directory?",
15277
- placeholder: "agents",
15278
- defaultValue: "agents",
15279
- validate: (value) => {
15280
- if (!value || value.trim() === "") {
15281
- return "Directory name is required";
15282
- }
15283
- return void 0;
15284
- }
15285
- });
15286
- if (p.isCancel(dirResponse)) {
15287
- p.cancel("Operation cancelled");
15288
- process.exit(0);
15289
- }
15290
- dirName = dirResponse;
15291
- }
15292
- if (!tenantId) {
15293
- const tenantIdResponse = await p.text({
15294
- message: "Enter your tenant ID :",
15295
- placeholder: "(default)",
15296
- defaultValue: "default"
15297
- });
15298
- if (p.isCancel(tenantIdResponse)) {
15299
- p.cancel("Operation cancelled");
15300
- process.exit(0);
15301
- }
15302
- tenantId = tenantIdResponse;
15303
- }
15304
- if (!projectId) {
15305
- const projectIdResponse = await p.text({
15306
- message: "Enter your project ID:",
15307
- placeholder: "(default)",
15308
- defaultValue: "default"
15309
- });
15310
- if (p.isCancel(projectIdResponse)) {
15311
- p.cancel("Operation cancelled");
15312
- process.exit(0);
15313
- }
15314
- projectId = projectIdResponse;
15315
- }
15316
- if (!anthropicKey && !openAiKey) {
15317
- const providerChoice = await p.select({
15318
- message: "Which AI provider(s) would you like to use?",
15319
- options: [
15320
- { value: "both", label: "Both Anthropic and OpenAI (recommended)" },
15321
- { value: "anthropic", label: "Anthropic only" },
15322
- { value: "openai", label: "OpenAI only" }
15323
- ]
15324
- });
15325
- if (p.isCancel(providerChoice)) {
15326
- p.cancel("Operation cancelled");
15327
- process.exit(0);
15328
- }
15329
- if (providerChoice === "anthropic" || providerChoice === "both") {
15330
- const anthropicKeyResponse = await p.text({
15331
- message: "Enter your Anthropic API key:",
15332
- placeholder: "sk-ant-...",
15333
- validate: (value) => {
15334
- if (!value || value.trim() === "") {
15335
- return "Anthropic API key is required";
15336
- }
15337
- return void 0;
15338
- }
15339
- });
15340
- if (p.isCancel(anthropicKeyResponse)) {
15341
- p.cancel("Operation cancelled");
15342
- process.exit(0);
15343
- }
15344
- anthropicKey = anthropicKeyResponse;
15345
- }
15346
- if (providerChoice === "openai" || providerChoice === "both") {
15347
- const openAiKeyResponse = await p.text({
15348
- message: "Enter your OpenAI API key:",
15349
- placeholder: "sk-...",
15350
- validate: (value) => {
15351
- if (!value || value.trim() === "") {
15352
- return "OpenAI API key is required";
15353
- }
15354
- return void 0;
15355
- }
15356
- });
15357
- if (p.isCancel(openAiKeyResponse)) {
15358
- p.cancel("Operation cancelled");
15359
- process.exit(0);
15360
- }
15361
- openAiKey = openAiKeyResponse;
15362
- }
15363
- } else {
15364
- if (!anthropicKey) {
15365
- const anthropicKeyResponse = await p.text({
15366
- message: "Enter your Anthropic API key (optional):",
15367
- placeholder: "sk-ant-...",
15368
- defaultValue: ""
15369
- });
15370
- if (p.isCancel(anthropicKeyResponse)) {
15371
- p.cancel("Operation cancelled");
15372
- process.exit(0);
15373
- }
15374
- anthropicKey = anthropicKeyResponse || void 0;
15375
- }
15376
- if (!openAiKey) {
15377
- const openAiKeyResponse = await p.text({
15378
- message: "Enter your OpenAI API key (optional):",
15379
- placeholder: "sk-...",
15380
- defaultValue: ""
15381
- });
15382
- if (p.isCancel(openAiKeyResponse)) {
15383
- p.cancel("Operation cancelled");
15384
- process.exit(0);
15385
- }
15386
- openAiKey = openAiKeyResponse || void 0;
15387
- }
15388
- }
15389
- let defaultModelSettings = {};
15390
- if (anthropicKey && openAiKey) {
15391
- defaultModelSettings = defaultDualModelConfigurations;
15392
- } else if (anthropicKey) {
15393
- defaultModelSettings = defaultAnthropicModelConfigurations;
15394
- } else if (openAiKey) {
15395
- defaultModelSettings = defaultOpenaiModelConfigurations;
15396
- }
15397
- const s2 = p.spinner();
15398
- s2.start("Creating directory structure...");
15399
- try {
15400
- const directoryPath = path2.resolve(process.cwd(), dirName);
15401
- if (await fs.pathExists(directoryPath)) {
15402
- s2.stop();
15403
- const overwrite = await p.confirm({
15404
- message: `Directory ${dirName} already exists. Do you want to overwrite it?`
15405
- });
15406
- if (p.isCancel(overwrite) || !overwrite) {
15407
- p.cancel("Operation cancelled");
15408
- process.exit(0);
15409
- }
15410
- s2.start("Cleaning existing directory...");
15411
- await fs.emptyDir(directoryPath);
15412
- }
15413
- await fs.ensureDir(directoryPath);
15414
- process.chdir(directoryPath);
15415
- const config = {
15416
- dirName,
15417
- tenantId,
15418
- projectId,
15419
- openAiKey,
15420
- anthropicKey,
15421
- manageApiPort: manageApiPort || "3002",
15422
- runApiPort: runApiPort || "3003",
15423
- modelSettings: defaultModelSettings
15424
- };
15425
- s2.message("Setting up workspace structure...");
15426
- await createWorkspaceStructure(projectId);
15427
- s2.message("Creating package configurations...");
15428
- await setupPackageConfigurations(dirName);
15429
- s2.message("Setting up environment files...");
15430
- await createEnvironmentFiles(config);
15431
- s2.message("Creating service files...");
15432
- await createServiceFiles(config);
15433
- s2.message("Creating documentation...");
15434
- await createDocumentation(config);
15435
- s2.message("Setting up Turbo...");
15436
- await createTurboConfig();
15437
- s2.message("Installing dependencies (this may take a while)...");
15438
- await installDependencies();
15439
- s2.message("Setting up database...");
15440
- await setupDatabase();
15441
- s2.stop();
15442
- p.note(
15443
- `${color.green("\u2713")} Project created at: ${color.cyan(directoryPath)}
15444
-
15445
- ${color.yellow("Next steps:")}
15446
- cd ${dirName}
15447
- pnpm run dev (for APIs only)
15448
- inkeep dev (for APIs + Manage UI)
15449
-
15450
- ${color.yellow("Available services:")}
15451
- \u2022 Manage API: http://localhost:${manageApiPort || "3002"}
15452
- \u2022 Run API: http://localhost:${runApiPort || "3003"}
15453
- \u2022 Manage UI: Available with 'inkeep dev'
15454
-
15455
- ${color.yellow("Configuration:")}
15456
- \u2022 Edit .env for environment variables
15457
- \u2022 Edit src/${projectId}/weather.graph.ts for agent definitions
15458
- \u2022 Use 'inkeep push' to deploy agents to the platform
15459
- \u2022 Use 'inkeep chat' to test your agents locally
15460
- `,
15461
- "Ready to go!"
15462
- );
15463
- } catch (error) {
15464
- s2.stop();
15465
- p.cancel(
15466
- `Error creating directory: ${error instanceof Error ? error.message : "Unknown error"}`
15467
- );
15468
- process.exit(1);
15469
- }
15470
- };
15471
- async function createWorkspaceStructure(projectId) {
15472
- await fs.ensureDir(`src/${projectId}`);
15473
- await fs.ensureDir("apps/manage-api/src");
15474
- await fs.ensureDir("apps/run-api/src");
15475
- await fs.ensureDir("apps/shared");
15476
- }
15477
- async function setupPackageConfigurations(dirName) {
15478
- const rootPackageJson = {
15479
- name: dirName,
15480
- version: "0.1.0",
15481
- description: "An Inkeep Agent Framework directory",
15482
- private: true,
15483
- type: "module",
15484
- scripts: {
15485
- dev: "turbo dev",
15486
- "db:push": "drizzle-kit push"
15487
- },
15488
- dependencies: {},
15489
- devDependencies: {
15490
- "@biomejs/biome": "^1.8.0",
15491
- "@inkeep/agents-cli": "^0.1.1",
15492
- "drizzle-kit": "^0.31.4",
15493
- tsx: "^4.19.0",
15494
- turbo: "^2.5.5"
15495
- },
15496
- engines: {
15497
- node: ">=22.x"
15498
- },
15499
- packageManager: "pnpm@10.10.0"
15500
- };
15501
- await fs.writeJson("package.json", rootPackageJson, { spaces: 2 });
15502
- const pnpmWorkspace = `packages:
15503
- - "apps/*"
15504
- `;
15505
- await fs.writeFile("pnpm-workspace.yaml", pnpmWorkspace);
15506
- rootPackageJson.dependencies = {
15507
- "@inkeep/agents-core": "^0.1.0",
15508
- "@inkeep/agents-sdk": "^0.1.0",
15509
- zod: "^4.1.5"
15510
- };
15511
- await fs.writeJson("package.json", rootPackageJson, { spaces: 2 });
15512
- const manageApiPackageJson = {
15513
- name: `@${dirName}/manage-api`,
15514
- version: "0.1.0",
15515
- description: "Manage API for agents",
15516
- type: "module",
15517
- scripts: {
15518
- build: "tsc",
15519
- dev: "tsx watch src/index.ts",
15520
- start: "node dist/index.js"
15521
- },
15522
- dependencies: {
15523
- "@inkeep/agents-manage-api": "^0.1.1",
15524
- "@inkeep/agents-core": "^0.1.0",
15525
- "@hono/node-server": "^1.14.3"
15526
- },
15527
- devDependencies: {
15528
- "@types/node": "^20.12.0",
15529
- tsx: "^4.19.0",
15530
- typescript: "^5.4.0"
15531
- },
15532
- engines: {
15533
- node: ">=22.x"
15534
- }
15535
- };
15536
- await fs.writeJson("apps/manage-api/package.json", manageApiPackageJson, { spaces: 2 });
15537
- const runApiPackageJson = {
15538
- name: `@${dirName}/run-api`,
15539
- version: "0.1.0",
15540
- description: "Run API for agents",
15541
- type: "module",
15542
- scripts: {
15543
- dev: "tsx watch src/index.ts",
15544
- start: "node dist/index.js"
15545
- },
15546
- dependencies: {
15547
- "@inkeep/agents-run-api": "^0.1.1",
15548
- "@inkeep/agents-core": "^0.1.0",
15549
- "@hono/node-server": "^1.14.3"
15550
- },
15551
- devDependencies: {
15552
- "@types/node": "^20.12.0",
15553
- tsx: "^4.19.0",
15554
- typescript: "^5.4.0"
15555
- },
15556
- engines: {
15557
- node: ">=22.x"
15558
- }
15559
- };
15560
- await fs.writeJson("apps/run-api/package.json", runApiPackageJson, { spaces: 2 });
15561
- const apiTsConfig = {
15562
- compilerOptions: {
15563
- target: "ES2022",
15564
- module: "ESNext",
15565
- moduleResolution: "bundler",
15566
- strict: true,
15567
- esModuleInterop: true,
15568
- skipLibCheck: true,
15569
- forceConsistentCasingInFileNames: true,
15570
- declaration: true,
15571
- outDir: "./dist",
15572
- rootDir: "..",
15573
- allowImportingTsExtensions: false,
15574
- resolveJsonModule: true,
15575
- isolatedModules: true,
15576
- noEmit: false
15577
- },
15578
- include: ["src/**/*", "../shared/**/*"],
15579
- exclude: ["node_modules", "dist", "**/*.test.ts"]
15580
- };
15581
- await fs.writeJson("apps/manage-api/tsconfig.json", apiTsConfig, { spaces: 2 });
15582
- await fs.writeJson("apps/run-api/tsconfig.json", apiTsConfig, { spaces: 2 });
15583
- }
15584
- async function createEnvironmentFiles(config) {
15585
- const envContent = `# Environment
15586
- ENVIRONMENT=development
15587
-
15588
- # Database
15589
- DB_FILE_NAME=file:./local.db
15590
-
15591
- # AI Provider Keys
15592
- ANTHROPIC_API_KEY=${config.anthropicKey || "your-anthropic-key-here"}
15593
- OPENAI_API_KEY=${config.openAiKey || "your-openai-key-here"}
15594
-
15595
- # Logging
15596
- LOG_LEVEL=debug
15597
-
15598
- # Service Ports
15599
- MANAGE_API_PORT=${config.manageApiPort}
15600
- RUN_API_PORT=${config.runApiPort}
15601
-
15602
- # UI Configuration (for dashboard)
15603
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
15604
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
15605
- `;
15606
- await fs.writeFile(".env", envContent);
15607
- const envExample = envContent.replace(/=.+$/gm, "=");
15608
- await fs.writeFile(".env.example", envExample);
15609
- const runApiEnvContent = `# Environment
15610
- ENVIRONMENT=development
15611
-
15612
- # Database (relative path from API directory)
15613
- DB_FILE_NAME=file:../../local.db
15614
-
15615
- # AI Provider Keys
15616
- ANTHROPIC_API_KEY=${config.anthropicKey || "your-anthropic-key-here"}
15617
- OPENAI_API_KEY=${config.openAiKey || "your-openai-key-here"}
15618
-
15619
- AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
15620
- `;
15621
- const manageApiEnvContent = `# Environment
15622
- ENVIRONMENT=development
15623
-
15624
- # Database (relative path from API directory)
15625
- DB_FILE_NAME=file:../../local.db
15626
-
15627
- AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
15628
- `;
15629
- await fs.writeFile("apps/manage-api/.env", manageApiEnvContent);
15630
- await fs.writeFile("apps/run-api/.env", runApiEnvContent);
15631
- const gitignore = `# Dependencies
15632
- node_modules/
15633
- .pnpm-store/
15634
-
15635
- # Environment variables
15636
- .env
15637
- .env.local
15638
- .env.development.local
15639
- .env.test.local
15640
- .env.production.local
15641
-
15642
- # Build outputs
15643
- dist/
15644
- build/
15645
- .next/
15646
- .turbo/
15647
-
15648
- # Logs
15649
- *.log
15650
- logs/
15651
-
15652
- # Database
15653
- *.db
15654
- *.sqlite
15655
- *.sqlite3
15656
-
15657
- # IDE
15658
- .vscode/
15659
- .idea/
15660
- *.swp
15661
- *.swo
15662
-
15663
- # OS
15664
- .DS_Store
15665
- Thumbs.db
15666
-
15667
- # Coverage
15668
- coverage/
15669
- .nyc_output/
15670
-
15671
- # Temporary files
15672
- *.tmp
15673
- *.temp
15674
- .cache/
15675
-
15676
- # Runtime data
15677
- pids/
15678
- *.pid
15679
- *.seed
15680
- *.pid.lock
15681
- `;
15682
- await fs.writeFile(".gitignore", gitignore);
15683
- const biomeConfig = {
15684
- linter: {
15685
- enabled: true,
15686
- rules: {
15687
- recommended: true
15688
- }
15689
- },
15690
- formatter: {
15691
- enabled: true,
15692
- indentStyle: "space",
15693
- indentWidth: 2
15694
- },
15695
- organizeImports: {
15696
- enabled: true
15697
- },
15698
- javascript: {
15699
- formatter: {
15700
- semicolons: "always",
15701
- quoteStyle: "single"
15702
- }
15703
- }
15704
- };
15705
- await fs.writeJson("biome.json", biomeConfig, { spaces: 2 });
15706
- }
15707
- async function createServiceFiles(config) {
15708
- const agentsGraph = `import { agent, agentGraph, mcpTool } from '@inkeep/agents-sdk';
15709
-
15710
- // MCP Tools
15711
- const forecastWeatherTool = mcpTool({
15712
- id: 'fUI2riwrBVJ6MepT8rjx0',
15713
- name: 'Forecast weather',
15714
- serverUrl: 'https://weather-forecast-mcp.vercel.app/mcp',
15715
- });
15716
-
15717
- const geocodeAddressTool = mcpTool({
15718
- id: 'fdxgfv9HL7SXlfynPx8hf',
15719
- name: 'Geocode address',
15720
- serverUrl: 'https://geocoder-mcp.vercel.app/mcp',
15721
- });
15722
-
15723
- // Agents
15724
- const weatherAssistant = agent({
15725
- id: 'weather-assistant',
15726
- name: 'Weather assistant',
15727
- description: 'Responsible for routing between the geocoder agent and weather forecast agent',
15728
- prompt:
15729
- 'You are a helpful assistant. When the user asks about the weather in a given location, first ask the geocoder agent for the coordinates, and then pass those coordinates to the weather forecast agent to get the weather forecast',
15730
- canDelegateTo: () => [weatherForecaster, geocoderAgent],
15731
- });
15732
-
15733
- const weatherForecaster = agent({
15734
- id: 'weather-forecaster',
15735
- name: 'Weather forecaster',
15736
- description:
15737
- 'This agent is responsible for taking in coordinates and returning the forecast for the weather at that location',
15738
- prompt:
15739
- 'You are a helpful assistant responsible for taking in coordinates and returning the forecast for that location using your forecasting tool',
15740
- canUse: () => [forecastWeatherTool],
15741
- });
15742
-
15743
- const geocoderAgent = agent({
15744
- id: 'geocoder-agent',
15745
- name: 'Geocoder agent',
15746
- description: 'Responsible for converting location or address into coordinates',
15747
- prompt:
15748
- 'You are a helpful assistant responsible for converting location or address into coordinates using your geocode tool',
15749
- canUse: () => [geocodeAddressTool],
15750
- });
15751
-
15752
- // Agent Graph
15753
- export const weatherGraph = agentGraph({
15754
- id: 'weather-graph',
15755
- name: 'Weather graph',
15756
- defaultAgent: weatherAssistant,
15757
- agents: () => [weatherAssistant, weatherForecaster, geocoderAgent],
15758
- });`;
15759
- await fs.writeFile(`src/${config.projectId}/weather.graph.ts`, agentsGraph);
15760
- const inkeepConfig = `import { defineConfig } from '@inkeep/agents-cli/config';
15761
-
15762
- const config = defineConfig({
15763
- tenantId: "${config.tenantId}",
15764
- projectId: "${config.projectId}",
15765
- agentsManageApiUrl: \`http://localhost:\${process.env.MANAGE_API_PORT || '3002'}\`,
15766
- agentsRunApiUrl: \`http://localhost:\${process.env.RUN_API_PORT || '3003'}\`,
15767
- modelSettings: ${JSON.stringify(config.modelSettings, null, 2)},
15768
- });
15769
-
15770
- export default config;`;
15771
- await fs.writeFile(`src/${config.projectId}/inkeep.config.ts`, inkeepConfig);
15772
- const projectEnvContent = `# Environment
15773
- ENVIRONMENT=development
15774
-
15775
- # Database (relative path from project directory)
15776
- DB_FILE_NAME=file:../../local.db
15777
-
15778
- # UI Configuration (for dashboard)
15779
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
15780
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
15781
-
15782
- `;
15783
- await fs.writeFile(`src/${config.projectId}/.env`, projectEnvContent);
15784
- const credentialStoresFile = `import {
15785
- InMemoryCredentialStore,
15786
- createNangoCredentialStore,
15787
- createKeyChainStore,
15788
- } from '@inkeep/agents-core';
15789
-
15790
- // Shared credential stores configuration for all services
15791
- export const credentialStores = [
15792
- new InMemoryCredentialStore('memory-default'),
15793
- ...(process.env.NANGO_SECRET_KEY
15794
- ? [
15795
- createNangoCredentialStore('nango-default', {
15796
- apiUrl: process.env.NANGO_HOST || 'https://api.nango.dev',
15797
- secretKey: process.env.NANGO_SECRET_KEY,
15798
- }),
15799
- ]
15800
- : []),
15801
- createKeyChainStore('keychain-default'),
15802
- ];
15803
- `;
15804
- await fs.writeFile("apps/shared/credential-stores.ts", credentialStoresFile);
15805
- const manageApiIndex = `import { serve } from '@hono/node-server';
15806
- import { createManagementApp } from '@inkeep/agents-manage-api';
15807
- import { getLogger } from '@inkeep/agents-core';
15808
- import { credentialStores } from '../../shared/credential-stores.js';
15809
-
15810
- const logger = getLogger('management-api');
15811
-
15812
- // Create the Hono app
15813
- const app = createManagementApp({
15814
- serverConfig: {
15815
- port: Number(process.env.MANAGE_API_PORT) || 3002,
15816
- serverOptions: {
15817
- requestTimeout: 60000,
15818
- keepAliveTimeout: 60000,
15819
- keepAlive: true,
15820
- },
15821
- },
15822
- credentialStores,
15823
- });
15824
-
15825
- const port = Number(process.env.MANAGE_API_PORT) || 3002;
15826
-
15827
- // Start the server using @hono/node-server
15828
- serve(
15829
- {
15830
- fetch: app.fetch,
15831
- port,
15832
- },
15833
- (info) => {
15834
- logger.info({}, \`\u{1F4DD} Management API running on http://localhost:\${info.port}\`);
15835
- logger.info({}, \`\u{1F4DD} OpenAPI documentation available at http://localhost:\${info.port}/openapi.json\`);
15836
- }
15837
- );`;
15838
- await fs.writeFile("apps/manage-api/src/index.ts", manageApiIndex);
15839
- const runApiIndex = `import { serve } from '@hono/node-server';
15840
- import { createExecutionApp } from '@inkeep/agents-run-api';
15841
- import { credentialStores } from '../../shared/credential-stores.js';
15842
- import { getLogger } from '@inkeep/agents-core';
15843
-
15844
- const logger = getLogger('execution-api');
15845
-
15846
-
15847
- // Create the Hono app
15848
- const app = createExecutionApp({
15849
- serverConfig: {
15850
- port: Number(process.env.RUN_API_PORT) || 3003,
15851
- serverOptions: {
15852
- requestTimeout: 120000,
15853
- keepAliveTimeout: 60000,
15854
- keepAlive: true,
15855
- },
15856
- },
15857
- credentialStores,
15858
- });
15859
-
15860
- const port = Number(process.env.RUN_API_PORT) || 3003;
15861
-
15862
- // Start the server using @hono/node-server
15863
- serve(
15864
- {
15865
- fetch: app.fetch,
15866
- port,
15867
- },
15868
- (info) => {
15869
- logger.info({}, \`\u{1F4DD} Run API running on http://localhost:\${info.port}\`);
15870
- logger.info({}, \`\u{1F4DD} OpenAPI documentation available at http://localhost:\${info.port}/openapi.json\`);
15871
- }
15872
- );`;
15873
- await fs.writeFile("apps/run-api/src/index.ts", runApiIndex);
15874
- const drizzleConfig = `import { defineConfig } from 'drizzle-kit';
15875
-
15876
- export default defineConfig({
15877
- schema: 'node_modules/@inkeep/agents-core/dist/db/schema.js',
15878
- dialect: 'sqlite',
15879
- dbCredentials: {
15880
- url: process.env.DB_FILE_NAME || 'file:./local.db'
15881
- },
15882
- });`;
15883
- await fs.writeFile("drizzle.config.ts", drizzleConfig);
15884
- }
15885
- async function createTurboConfig() {
15886
- const turboConfig = {
15887
- $schema: "https://turbo.build/schema.json",
15888
- ui: "tui",
15889
- globalDependencies: ["**/.env", "**/.env.local", "**/.env.*"],
15890
- globalEnv: [
15891
- "NODE_ENV",
15892
- "CI",
15893
- "ANTHROPIC_API_KEY",
15894
- "OPENAI_API_KEY",
15895
- "ENVIRONMENT",
15896
- "DB_FILE_NAME",
15897
- "MANAGE_API_PORT",
15898
- "RUN_API_PORT",
15899
- "LOG_LEVEL",
15900
- "NANGO_SECRET_KEY"
15901
- ],
15902
- tasks: {
15903
- build: {
15904
- dependsOn: ["^build"],
15905
- inputs: ["$TURBO_DEFAULT$", ".env*"],
15906
- outputs: ["dist/**", "build/**", ".next/**", "!.next/cache/**"]
15907
- },
15908
- dev: {
15909
- cache: false,
15910
- persistent: true
15911
- },
15912
- start: {
15913
- dependsOn: ["build"],
15914
- cache: false
15915
- },
15916
- "db:push": {
15917
- cache: false,
15918
- inputs: ["drizzle.config.ts", "src/data/db/schema.ts"]
15919
- }
15920
- }
15921
- };
15922
- await fs.writeJson("turbo.json", turboConfig, { spaces: 2 });
15923
- }
15924
- async function createDocumentation(config) {
15925
- const readme = `# ${config.dirName}
15926
-
15927
- An Inkeep Agent Framework project with multi-service architecture.
15928
-
15929
- ## Architecture
15930
-
15931
- This project follows a workspace structure with the following services:
15932
-
15933
- - **Agents Manage API** (Port 3002): Agent configuration and managemen
15934
- - Handles entity management and configuration endpoints.
15935
- - **Agents Run API** (Port 3003): Agent execution and chat processing
15936
- - Handles agent communication. You can interact with your agents either over MCP from an MCP client or through our React UI components library
15937
- - **Agents Manage UI** (Port 3000): Web interface available via \`inkeep dev\`
15938
- - The agent framework visual builder. From the builder you can create, manage and visualize all your graphs.
15939
-
15940
- ## Quick Start
15941
- 1. **Install the Inkeep CLI:**
15942
- \`\`\`bash
15943
- pnpm install -g @inkeep/agents-cli
15944
- \`\`\`
15945
-
15946
- 1. **Start services:**
15947
- \`\`\`bash
15948
- # Start Agents Manage API and Agents Run API
15949
- pnpm dev
15950
-
15951
- # Start the Dashboard
15952
- inkeep dev
15953
- \`\`\`
15954
-
15955
- 3. **Deploy your first agent graph:**
15956
- \`\`\`bash
15957
- # Navigate to your project's graph directory
15958
- cd src/${config.projectId}/
15959
-
15960
- # Push the weather graph to create it
15961
- inkeep push weather.graph.ts
15962
- \`\`\`
15963
- - Follow the prompts to create the project and graph
15964
- - Click on the "View graph in UI:" link to see the graph in the management dashboard
15965
-
15966
- ## Project Structure
15967
-
15968
- \`\`\`
15969
- ${config.dirName}/
15970
- \u251C\u2500\u2500 src/
15971
- \u2502 \u251C\u2500\u2500 /${config.projectId} # Agent configurations
15972
- \u251C\u2500\u2500 apps/
15973
- \u2502 \u251C\u2500\u2500 manage-api/ # Agents Manage API service
15974
- \u2502 \u251C\u2500\u2500 run-api/ # Agents Run API service
15975
- \u2502 \u2514\u2500\u2500 shared/ # Shared code between API services
15976
- \u2502 \u2514\u2500\u2500 credential-stores.ts # Shared credential store configuration
15977
- \u251C\u2500\u2500 turbo.json # Turbo configuration
15978
- \u251C\u2500\u2500 pnpm-workspace.yaml # pnpm workspace configuration
15979
- \u2514\u2500\u2500 package.json # Root package configuration
15980
- \`\`\`
15981
-
15982
- ## Configuration
15983
-
15984
- ### Environment Variables
15985
-
15986
- Environment variables are defined in the following places:
15987
-
15988
- - \`apps/manage-api/.env\`: Agents Manage API environment variables
15989
- - \`apps/run-api/.env\`: Agents Run API environment variables
15990
- - \`src/${config.projectId}/.env\`: Inkeep CLI environment variables
15991
- - \`.env\`: Root environment variables
15992
-
15993
- To change the API keys used by your agents modify \`apps/run-api/.env\`. You are required to define at least one LLM provider key.
15994
-
15995
- \`\`\`bash
15996
- # AI Provider Keys
15997
- ANTHROPIC_API_KEY=your-anthropic-key-here
15998
- OPENAI_API_KEY=your-openai-key-here
15999
- \`\`\`
16000
-
16001
- To change the ports used by your services modify \`apps/manage-api/.env\` and \`apps/run-api/.env\` respectively:
16002
-
16003
- \`\`\`bash
16004
- # Service port for apps/run-api
16005
- RUN_API_PORT=3003
16006
-
16007
- # Service port for apps/manage-api
16008
- MANAGE_API_PORT=3002
16009
- \`\`\`
16010
-
16011
- After changing the API Service ports make sure that you modify the dashboard API urls from whichever directory you are running \`inkeep dev\`:
16012
-
16013
- \`\`\`bash
16014
- # UI Configuration (for dashboard)
16015
- NEXT_PUBLIC_INKEEP_AGENTS_MANAGE_API_URL=http://localhost:${config.manageApiPort}
16016
- NEXT_PUBLIC_INKEEP_AGENTS_RUN_API_URL=http://localhost:${config.runApiPort}
16017
- \`\`\`
16018
-
16019
- ### Agent Configuration
16020
-
16021
- Your graphs are defined in \`src/${config.projectId}/weather.graph.ts\`. The default setup includes:
16022
-
16023
- - **Weather Graph**: A graph that can forecast the weather in a given location.
16024
-
16025
- Your inkeep configuration is defined in \`src/${config.projectId}/inkeep.config.ts\`. The inkeep configuration is used to configure defaults for the inkeep CLI. The configuration includes:
16026
-
16027
- - \`tenantId\`: The tenant ID
16028
- - \`projectId\`: The project ID
16029
- - \`agentsManageApiUrl\`: The Manage API URL
16030
- - \`agentsRunApiUrl\`: The Run API URL
16031
-
16032
-
16033
- ## Development
16034
-
16035
- ### Updating Your Agents
16036
-
16037
- 1. Edit \`src/${config.projectId}/weather.graph.ts\`
16038
- 2. Push the graph to the platform to update: \`inkeep pus weather.graph.ts\`
16039
-
16040
- ### API Documentation
16041
-
16042
- Once services are running, view the OpenAPI documentation:
16043
-
16044
- - Manage API: http://localhost:${config.manageApiPort}/docs
16045
- - Run API: http://localhost:${config.runApiPort}/docs
16046
-
16047
- ## Learn More
16048
-
16049
- - [Inkeep Documentation](https://docs.inkeep.com)
16050
-
16051
- ## Troubleshooting
16052
-
16053
- ## Inkeep CLI commands
16054
-
16055
- - Ensure you are runnning commands from \`cd src/${config.projectId}\`.
16056
- - Validate the \`inkeep.config.ts\` file has the correct api urls.
16057
- - Validate that the \`.env\` file in \`src/${config.projectId}\` has the correct \`DB_FILE_NAME\`.
16058
-
16059
- ### Services won't start
16060
-
16061
- 1. Ensure all dependencies are installed: \`pnpm install\`
16062
- 2. Check that ports 3000-3003 are available
16063
-
16064
- ### Agents won't respond
16065
-
16066
- 1. Ensure that the Agents Run API is running and includes a valid Anthropic or OpenAI API key in its .env file
16067
- `;
16068
- await fs.writeFile("README.md", readme);
16069
- }
16070
- async function installDependencies() {
16071
- await execAsync("pnpm install");
16072
- }
16073
- async function setupDatabase() {
16074
- try {
16075
- await execAsync("pnpm db:push");
16076
- } catch (error) {
16077
- throw new Error(
16078
- `Failed to setup database: ${error instanceof Error ? error.message : "Unknown error"}`
16079
- );
16080
- }
16081
- }
16082
- async function createCommand(dirName, options) {
16083
- await createAgents({
16084
- dirName,
16085
- ...options
16086
- });
16087
- }
16088
-
16089
- // src/commands/dev.ts
16090
- init_esm_shims();
16091
- import { fork } from "child_process";
16092
- import { existsSync as existsSync2 } from "fs";
16093
- import { createRequire } from "module";
16094
- import { dirname, join as join2 } from "path";
16095
- import chalk2 from "chalk";
16096
- import ora from "ora";
16097
- var require2 = createRequire(import.meta.url);
16098
- function resolveWebRuntime() {
16099
- try {
16100
- const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
16101
- const root = dirname(pkg);
16102
- return join2(root, ".next/standalone/agents-manage-ui");
16103
- } catch (err) {
16104
- throw new Error(`Could not find @inkeep/agents-manage-ui package. ${err}`);
16105
- }
16106
- }
16107
- function startWebApp({ port = 3e3, host = "localhost" }) {
16108
- const spinner2 = ora("Starting dashboard server...").start();
16109
- try {
16110
- const rt = resolveWebRuntime();
16111
- const entry = join2(rt, "server.js");
16112
- console.log(entry);
16113
- if (!existsSync2(entry)) {
16114
- spinner2.fail("Dashboard server not found");
16115
- console.error(
16116
- chalk2.red("The dashboard server has not been built yet. Please run the following commands:")
16117
- );
16118
- console.error(chalk2.yellow(" cd agents-manage-ui"));
16119
- console.error(chalk2.yellow(" pnpm build"));
16120
- console.error(chalk2.yellow(" pnpm start"));
16121
- process.exit(1);
16122
- }
16123
- spinner2.succeed("Starting dashboard server...");
16124
- const child = fork(entry, [], {
16125
- cwd: rt,
16126
- env: {
16127
- ...process.env,
16128
- NODE_ENV: "production",
16129
- PORT: String(port),
16130
- HOSTNAME: host
16131
- },
16132
- stdio: "inherit"
16133
- });
16134
- console.log(chalk2.green(`\u{1F680} Dashboard server started at http://${host}:${port}`));
16135
- console.log(chalk2.gray("Press Ctrl+C to stop the server"));
16136
- process.on("SIGINT", () => {
16137
- console.log(chalk2.yellow("\n\u{1F6D1} Stopping dashboard server..."));
16138
- child.kill("SIGINT");
16139
- process.exit(0);
16140
- });
16141
- process.on("SIGTERM", () => {
16142
- child.kill("SIGTERM");
16143
- process.exit(0);
16144
- });
16145
- return child;
16146
- } catch (error) {
16147
- spinner2.fail("Failed to start dashboard server");
16148
- console.error(chalk2.red("Error:"), error instanceof Error ? error.message : "Unknown error");
16149
- process.exit(1);
16150
- }
16151
- }
16152
- async function devCommand(options) {
16153
- const { port = 3e3, host = "localhost" } = options;
16154
- console.log(chalk2.blue("Inkeep Dashboard Server"));
16155
- console.log(chalk2.gray(`Starting server on ${host}:${port}`));
16156
- console.log("");
16157
- startWebApp({ port, host });
16158
- }
16159
-
16160
15305
  // src/commands/init.ts
16161
- init_esm_shims();
16162
- import { existsSync as existsSync3, readdirSync, writeFileSync as writeFileSync2 } from "fs";
16163
- import { basename, dirname as dirname2, join as join3, resolve } from "path";
16164
- import chalk3 from "chalk";
16165
- import inquirer2 from "inquirer";
16166
15306
  function findProjectRoot(startPath) {
16167
15307
  let currentPath = resolve(startPath);
16168
15308
  const root = dirname2(currentPath);
@@ -16339,10 +15479,10 @@ async function listGraphsCommand(options) {
16339
15479
  options.configFilePath,
16340
15480
  config.tenantId
16341
15481
  );
16342
- const spinner2 = ora2("Fetching graphs...").start();
15482
+ const spinner = ora2("Fetching graphs...").start();
16343
15483
  try {
16344
15484
  const graphs = await api.listGraphs();
16345
- spinner2.succeed(`Found ${graphs.length} graph(s)`);
15485
+ spinner.succeed(`Found ${graphs.length} graph(s)`);
16346
15486
  if (graphs.length === 0) {
16347
15487
  console.log(chalk4.gray("No graphs found. Push a graph with: inkeep push <graph-path>"));
16348
15488
  return;
@@ -16371,7 +15511,7 @@ async function listGraphsCommand(options) {
16371
15511
  console.log(`
16372
15512
  ${table.toString()}`);
16373
15513
  } catch (error) {
16374
- spinner2.fail("Failed to fetch graphs");
15514
+ spinner.fail("Failed to fetch graphs");
16375
15515
  console.error(chalk4.red("Error:"), error instanceof Error ? error.message : error);
16376
15516
  process.exit(1);
16377
15517
  }
@@ -16414,16 +15554,16 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16414
15554
  }
16415
15555
  return value;
16416
15556
  }
16417
- function shouldIgnorePath(path3) {
15557
+ function shouldIgnorePath(path2) {
16418
15558
  return ignorePaths.some((ignorePath) => {
16419
15559
  if (ignorePath.endsWith("*")) {
16420
- return path3.startsWith(ignorePath.slice(0, -1));
15560
+ return path2.startsWith(ignorePath.slice(0, -1));
16421
15561
  }
16422
- return path3 === ignorePath;
15562
+ return path2 === ignorePath;
16423
15563
  });
16424
15564
  }
16425
- function compareValues(value1, value2, path3 = "") {
16426
- if (shouldIgnorePath(path3)) {
15565
+ function compareValues(value1, value2, path2 = "") {
15566
+ if (shouldIgnorePath(path2)) {
16427
15567
  return true;
16428
15568
  }
16429
15569
  if (value1 === null || value1 === void 0) {
@@ -16431,7 +15571,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16431
15571
  return true;
16432
15572
  }
16433
15573
  differences.push({
16434
- path: path3,
15574
+ path: path2,
16435
15575
  type: "different",
16436
15576
  value1,
16437
15577
  value2,
@@ -16441,7 +15581,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16441
15581
  }
16442
15582
  if (value2 === null || value2 === void 0) {
16443
15583
  differences.push({
16444
- path: path3,
15584
+ path: path2,
16445
15585
  type: "different",
16446
15586
  value1,
16447
15587
  value2,
@@ -16451,7 +15591,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16451
15591
  }
16452
15592
  if (typeof value1 !== typeof value2) {
16453
15593
  differences.push({
16454
- path: path3,
15594
+ path: path2,
16455
15595
  type: "type_mismatch",
16456
15596
  value1,
16457
15597
  value2,
@@ -16464,7 +15604,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16464
15604
  const normalized2 = normalizeValue(value2);
16465
15605
  if (normalized1 !== normalized2) {
16466
15606
  differences.push({
16467
- path: path3,
15607
+ path: path2,
16468
15608
  type: "different",
16469
15609
  value1,
16470
15610
  value2,
@@ -16477,7 +15617,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16477
15617
  if (Array.isArray(value1) && Array.isArray(value2)) {
16478
15618
  if (value1.length !== value2.length) {
16479
15619
  differences.push({
16480
- path: path3,
15620
+ path: path2,
16481
15621
  type: "different",
16482
15622
  value1: value1.length,
16483
15623
  value2: value2.length,
@@ -16493,11 +15633,11 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16493
15633
  (a, b2) => JSON.stringify(a).localeCompare(JSON.stringify(b2))
16494
15634
  );
16495
15635
  for (let i2 = 0; i2 < sorted1.length; i2++) {
16496
- compareValues(sorted1[i2], sorted2[i2], `${path3}[${i2}]`);
15636
+ compareValues(sorted1[i2], sorted2[i2], `${path2}[${i2}]`);
16497
15637
  }
16498
15638
  } else {
16499
15639
  for (let i2 = 0; i2 < value1.length; i2++) {
16500
- compareValues(value1[i2], value2[i2], `${path3}[${i2}]`);
15640
+ compareValues(value1[i2], value2[i2], `${path2}[${i2}]`);
16501
15641
  }
16502
15642
  }
16503
15643
  return true;
@@ -16508,7 +15648,7 @@ function compareJsonObjects(obj1, obj2, options = {}) {
16508
15648
  const allKeys = /* @__PURE__ */ new Set([...keys1, ...keys2]);
16509
15649
  stats.totalKeys += allKeys.size;
16510
15650
  for (const key of allKeys) {
16511
- const currentPath = path3 ? `${path3}.${key}` : key;
15651
+ const currentPath = path2 ? `${path2}.${key}` : key;
16512
15652
  if (!keys1.includes(key)) {
16513
15653
  differences.push({
16514
15654
  path: currentPath,
@@ -16614,11 +15754,11 @@ function parseModelString(modelString) {
16614
15754
  };
16615
15755
  }
16616
15756
  async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath, modelSettings, retryContext) {
16617
- const fs2 = await import("fs");
15757
+ const fs = await import("fs");
16618
15758
  let existingContent = "";
16619
15759
  let fileExists = false;
16620
15760
  try {
16621
- existingContent = fs2.readFileSync(outputFilePath, "utf-8");
15761
+ existingContent = fs.readFileSync(outputFilePath, "utf-8");
16622
15762
  fileExists = true;
16623
15763
  } catch {
16624
15764
  fileExists = false;
@@ -16626,7 +15766,7 @@ async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath,
16626
15766
  const model = createModel(modelSettings);
16627
15767
  const prompt = createPrompt(graphData, graphId, existingContent, fileExists, retryContext);
16628
15768
  try {
16629
- const { text: text3 } = await generateText({
15769
+ const { text: text2 } = await generateText({
16630
15770
  model,
16631
15771
  prompt,
16632
15772
  temperature: 0.1,
@@ -16634,7 +15774,7 @@ async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath,
16634
15774
  maxOutputTokens: 16e3
16635
15775
  // Increased to handle large TypeScript files
16636
15776
  });
16637
- fs2.writeFileSync(outputFilePath, text3, "utf-8");
15777
+ fs.writeFileSync(outputFilePath, text2, "utf-8");
16638
15778
  console.log(`\u2705 Successfully generated TypeScript file: ${outputFilePath}`);
16639
15779
  } catch (error) {
16640
15780
  console.error("\u274C Error generating TypeScript file with LLM:", error);
@@ -16796,7 +15936,7 @@ async function convertTypeScriptToJson(graphPath) {
16796
15936
  return await graph.toFullGraphDefinition();
16797
15937
  }
16798
15938
  async function pullCommand(graphId, options) {
16799
- const spinner2 = ora3("Loading configuration...").start();
15939
+ const spinner = ora3("Loading configuration...").start();
16800
15940
  try {
16801
15941
  let config;
16802
15942
  try {
@@ -16806,7 +15946,7 @@ async function pullCommand(graphId, options) {
16806
15946
  options.configFilePath
16807
15947
  );
16808
15948
  } catch (error) {
16809
- spinner2.fail("Configuration validation failed");
15949
+ spinner.fail("Configuration validation failed");
16810
15950
  console.error(chalk5.red(error.message));
16811
15951
  process.exit(1);
16812
15952
  }
@@ -16816,7 +15956,7 @@ async function pullCommand(graphId, options) {
16816
15956
  graphId,
16817
15957
  !!options.json
16818
15958
  );
16819
- spinner2.text = "Fetching graph from API...";
15959
+ spinner.text = "Fetching graph from API...";
16820
15960
  const response = await fetch(
16821
15961
  `${config.agentsManageApiUrl}/tenants/${config.tenantId}/crud/projects/${config.projectId}/graph/${graphId}`,
16822
15962
  {
@@ -16828,18 +15968,18 @@ async function pullCommand(graphId, options) {
16828
15968
  );
16829
15969
  if (!response.ok) {
16830
15970
  if (response.status === 404) {
16831
- spinner2.fail(`Graph with ID "${graphId}" not found`);
15971
+ spinner.fail(`Graph with ID "${graphId}" not found`);
16832
15972
  process.exit(1);
16833
15973
  }
16834
- spinner2.fail(`Failed to fetch graph: ${response.statusText}`);
15974
+ spinner.fail(`Failed to fetch graph: ${response.statusText}`);
16835
15975
  process.exit(1);
16836
15976
  }
16837
15977
  const responseData = await response.json();
16838
15978
  const graphData = responseData.data;
16839
15979
  if (options.json) {
16840
- spinner2.text = "Writing JSON file...";
15980
+ spinner.text = "Writing JSON file...";
16841
15981
  writeFileSync3(outputFilePath, JSON.stringify(graphData, null, 2), "utf-8");
16842
- spinner2.succeed(`Graph "${graphData.name}" pulled successfully`);
15982
+ spinner.succeed(`Graph "${graphData.name}" pulled successfully`);
16843
15983
  console.log(
16844
15984
  chalk5.green(`\u2705 JSON file ${isExistingFile ? "updated" : "created"}: ${outputFilePath}`)
16845
15985
  );
@@ -16854,9 +15994,9 @@ async function pullCommand(graphId, options) {
16854
15994
  const shouldValidate = isExistingFile;
16855
15995
  while (attempt <= maxRetries && (!shouldValidate || !validationPassed)) {
16856
15996
  if (attempt > 1) {
16857
- spinner2.text = `Regenerating TypeScript file (attempt ${attempt}/${maxRetries})...`;
15997
+ spinner.text = `Regenerating TypeScript file (attempt ${attempt}/${maxRetries})...`;
16858
15998
  } else {
16859
- spinner2.text = isExistingFile ? "Merging into existing TypeScript file with LLM..." : "Generating TypeScript file with LLM...";
15999
+ spinner.text = isExistingFile ? "Merging into existing TypeScript file with LLM..." : "Generating TypeScript file with LLM...";
16860
16000
  }
16861
16001
  const pullModel = config.modelSettings?.base || {
16862
16002
  model: "anthropic/claude-sonnet-4-20250514"
@@ -16867,7 +16007,7 @@ async function pullCommand(graphId, options) {
16867
16007
  previousDifferences: attempt > 1 ? previousDifferences : void 0
16868
16008
  });
16869
16009
  if (shouldValidate) {
16870
- spinner2.text = "Validating generated TypeScript file...";
16010
+ spinner.text = "Validating generated TypeScript file...";
16871
16011
  try {
16872
16012
  const convertedResult = await convertTypeScriptToJson(outputFilePath);
16873
16013
  const comparison = compareJsonObjects(graphData, convertedResult, {
@@ -16878,14 +16018,14 @@ async function pullCommand(graphId, options) {
16878
16018
  });
16879
16019
  if (comparison.isEqual) {
16880
16020
  validationPassed = true;
16881
- spinner2.succeed("TypeScript file validation passed");
16021
+ spinner.succeed("TypeScript file validation passed");
16882
16022
  console.log(chalk5.green("\u2705 Generated TypeScript file matches original graph data"));
16883
16023
  } else {
16884
16024
  previousDifferences = comparison.differences.map(
16885
16025
  (diff) => `${diff.path}: ${diff.description}`
16886
16026
  );
16887
16027
  if (attempt < maxRetries) {
16888
- spinner2.warn(`Validation failed (attempt ${attempt}/${maxRetries}), retrying...`);
16028
+ spinner.warn(`Validation failed (attempt ${attempt}/${maxRetries}), retrying...`);
16889
16029
  console.log(
16890
16030
  chalk5.yellow(
16891
16031
  "\u26A0\uFE0F Generated TypeScript file has differences from original graph data:"
@@ -16894,7 +16034,7 @@ async function pullCommand(graphId, options) {
16894
16034
  console.log(chalk5.gray(getDifferenceSummary(comparison)));
16895
16035
  console.log(chalk5.gray("\n\u{1F504} Retrying with improved prompt..."));
16896
16036
  } else {
16897
- spinner2.fail("TypeScript file validation failed after all retries");
16037
+ spinner.fail("TypeScript file validation failed after all retries");
16898
16038
  console.log(
16899
16039
  chalk5.red("\u274C Generated TypeScript file has differences from original:")
16900
16040
  );
@@ -16909,7 +16049,7 @@ async function pullCommand(graphId, options) {
16909
16049
  } catch (validationError) {
16910
16050
  previousDifferences = [`Validation error: ${validationError.message}`];
16911
16051
  if (attempt < maxRetries) {
16912
- spinner2.warn(`Validation failed (attempt ${attempt}/${maxRetries}), retrying...`);
16052
+ spinner.warn(`Validation failed (attempt ${attempt}/${maxRetries}), retrying...`);
16913
16053
  console.log(
16914
16054
  chalk5.yellow(
16915
16055
  "\u26A0\uFE0F Could not validate generated TypeScript file against original graph data:"
@@ -16923,7 +16063,7 @@ async function pullCommand(graphId, options) {
16923
16063
  );
16924
16064
  console.log(chalk5.gray("\n\u{1F504} Retrying with improved prompt..."));
16925
16065
  } else {
16926
- spinner2.fail("TypeScript file validation failed after all retries");
16066
+ spinner.fail("TypeScript file validation failed after all retries");
16927
16067
  console.log(
16928
16068
  chalk5.red(
16929
16069
  "\u274C Could not validate generated TypeScript file against original graph data:"
@@ -16947,7 +16087,7 @@ async function pullCommand(graphId, options) {
16947
16087
  }
16948
16088
  attempt++;
16949
16089
  }
16950
- spinner2.succeed(`Graph "${graphData.name}" pulled successfully`);
16090
+ spinner.succeed(`Graph "${graphData.name}" pulled successfully`);
16951
16091
  console.log(
16952
16092
  chalk5.green(
16953
16093
  `\u2705 TypeScript file ${isExistingFile ? "updated" : "created"}: ${outputFilePath}`
@@ -16959,7 +16099,7 @@ async function pullCommand(graphId, options) {
16959
16099
  console.log(chalk5.gray(` \u2022 Version control: git add ${outputFilePath}`));
16960
16100
  }
16961
16101
  } catch (error) {
16962
- spinner2.fail("Failed to pull graph");
16102
+ spinner.fail("Failed to pull graph");
16963
16103
  console.error(chalk5.red("Error:"), error.message);
16964
16104
  if (error.stack && process.env.DEBUG) {
16965
16105
  console.error(chalk5.gray(error.stack));
@@ -16981,7 +16121,7 @@ init_esm_shims();
16981
16121
 
16982
16122
  // ../packages/agents-core/src/context/ContextConfig.ts
16983
16123
  init_esm_shims();
16984
- import { z as z3 } from "zod/v4";
16124
+ import { z as z3 } from "zod";
16985
16125
 
16986
16126
  // ../packages/agents-core/src/utils/logger.ts
16987
16127
  init_esm_shims();
@@ -17057,12 +16197,12 @@ init_esm_shims();
17057
16197
  init_esm_shims();
17058
16198
  function __rest(s2, e2) {
17059
16199
  var t2 = {};
17060
- for (var p3 in s2) if (Object.prototype.hasOwnProperty.call(s2, p3) && e2.indexOf(p3) < 0)
17061
- t2[p3] = s2[p3];
16200
+ for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
16201
+ t2[p2] = s2[p2];
17062
16202
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
17063
- for (var i2 = 0, p3 = Object.getOwnPropertySymbols(s2); i2 < p3.length; i2++) {
17064
- if (e2.indexOf(p3[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p3[i2]))
17065
- t2[p3[i2]] = s2[p3[i2]];
16203
+ for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
16204
+ if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
16205
+ t2[p2[i2]] = s2[p2[i2]];
17066
16206
  }
17067
16207
  return t2;
17068
16208
  }
@@ -17139,9 +16279,9 @@ var $ZodRegistry = class {
17139
16279
  return this;
17140
16280
  }
17141
16281
  get(schema) {
17142
- const p3 = schema._zod.parent;
17143
- if (p3) {
17144
- const pm = { ...this.get(p3) ?? {} };
16282
+ const p2 = schema._zod.parent;
16283
+ if (p2) {
16284
+ const pm = { ...this.get(p2) ?? {} };
17145
16285
  delete pm.id;
17146
16286
  return { ...pm, ...this._map.get(schema) };
17147
16287
  }
@@ -17591,9 +16731,9 @@ var HonoRequest = class {
17591
16731
  routeIndex = 0;
17592
16732
  path;
17593
16733
  bodyCache = {};
17594
- constructor(request, path3 = "/", matchResult = [[]]) {
16734
+ constructor(request, path2 = "/", matchResult = [[]]) {
17595
16735
  this.raw = request;
17596
- this.path = path3;
16736
+ this.path = path2;
17597
16737
  this.#matchResult = matchResult;
17598
16738
  this.#validatedData = {};
17599
16739
  }
@@ -17656,7 +16796,7 @@ var HonoRequest = class {
17656
16796
  return bodyCache[key] = raw[key]();
17657
16797
  };
17658
16798
  json() {
17659
- return this.#cachedBody("text").then((text3) => JSON.parse(text3));
16799
+ return this.#cachedBody("text").then((text2) => JSON.parse(text2));
17660
16800
  }
17661
16801
  text() {
17662
16802
  return this.#cachedBody("text");
@@ -18055,41 +17195,41 @@ import {
18055
17195
  integer,
18056
17196
  primaryKey,
18057
17197
  sqliteTable,
18058
- text as text2,
17198
+ text,
18059
17199
  unique
18060
17200
  } from "drizzle-orm/sqlite-core";
18061
17201
  var projects = sqliteTable(
18062
17202
  "projects",
18063
17203
  {
18064
- tenantId: text2("tenant_id").notNull(),
18065
- id: text2("id").notNull(),
17204
+ tenantId: text("tenant_id").notNull(),
17205
+ id: text("id").notNull(),
18066
17206
  // This IS the project ID
18067
- name: text2("name").notNull(),
18068
- description: text2("description").notNull(),
17207
+ name: text("name").notNull(),
17208
+ description: text("description").notNull(),
18069
17209
  // Project-level default model settings that can be inherited by graphs and agents
18070
- models: text2("models", { mode: "json" }).$type(),
17210
+ models: text("models", { mode: "json" }).$type(),
18071
17211
  // Project-level stopWhen configuration that can be inherited by graphs and agents
18072
- stopWhen: text2("stop_when", { mode: "json" }).$type(),
18073
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18074
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17212
+ stopWhen: text("stop_when", { mode: "json" }).$type(),
17213
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17214
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18075
17215
  },
18076
17216
  (table) => [primaryKey({ columns: [table.tenantId, table.id] })]
18077
17217
  );
18078
17218
  var contextConfigs = sqliteTable(
18079
17219
  "context_configs",
18080
17220
  {
18081
- tenantId: text2("tenant_id").notNull(),
18082
- projectId: text2("project_id").notNull(),
18083
- id: text2("id").notNull(),
18084
- name: text2("name").notNull(),
18085
- description: text2("description").notNull(),
17221
+ tenantId: text("tenant_id").notNull(),
17222
+ projectId: text("project_id").notNull(),
17223
+ id: text("id").notNull(),
17224
+ name: text("name").notNull(),
17225
+ description: text("description").notNull(),
18086
17226
  // Developer-defined Zod schema for validating incoming request context
18087
17227
  requestContextSchema: blob("request_context_schema", { mode: "json" }).$type(),
18088
17228
  // Stores serialized Zod schema
18089
17229
  // Object mapping template keys to fetch definitions that use request context data
18090
17230
  contextVariables: blob("context_variables", { mode: "json" }).$type(),
18091
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18092
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17231
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17232
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18093
17233
  },
18094
17234
  (table) => [
18095
17235
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18103,27 +17243,27 @@ var contextConfigs = sqliteTable(
18103
17243
  var contextCache = sqliteTable(
18104
17244
  "context_cache",
18105
17245
  {
18106
- tenantId: text2("tenant_id").notNull(),
18107
- projectId: text2("project_id").notNull(),
18108
- id: text2("id").notNull(),
17246
+ tenantId: text("tenant_id").notNull(),
17247
+ projectId: text("project_id").notNull(),
17248
+ id: text("id").notNull(),
18109
17249
  // Always scoped to conversation for complete data isolation
18110
- conversationId: text2("conversation_id").notNull(),
17250
+ conversationId: text("conversation_id").notNull(),
18111
17251
  // Reference to the context config and specific fetch definition
18112
- contextConfigId: text2("context_config_id").notNull(),
18113
- contextVariableKey: text2("context_variable_key").notNull(),
17252
+ contextConfigId: text("context_config_id").notNull(),
17253
+ contextVariableKey: text("context_variable_key").notNull(),
18114
17254
  // Key from contextVariables object
18115
17255
  // The actual cached context data
18116
17256
  value: blob("value", { mode: "json" }).$type().notNull(),
18117
17257
  // Request hash for cache invalidation based on context changes
18118
- requestHash: text2("request_hash"),
17258
+ requestHash: text("request_hash"),
18119
17259
  // Hash of request context that triggered this cache
18120
17260
  // Metadata for monitoring and debugging
18121
- fetchedAt: text2("fetched_at").notNull(),
18122
- fetchSource: text2("fetch_source"),
17261
+ fetchedAt: text("fetched_at").notNull(),
17262
+ fetchSource: text("fetch_source"),
18123
17263
  // URL or source identifier
18124
17264
  fetchDurationMs: integer("fetch_duration_ms"),
18125
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18126
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17265
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17266
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18127
17267
  },
18128
17268
  (table) => [
18129
17269
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18142,20 +17282,20 @@ var contextCache = sqliteTable(
18142
17282
  var agents = sqliteTable(
18143
17283
  "agents",
18144
17284
  {
18145
- tenantId: text2("tenant_id").notNull(),
18146
- projectId: text2("project_id").notNull(),
18147
- id: text2("id").notNull(),
18148
- name: text2("name").notNull(),
18149
- description: text2("description").notNull(),
18150
- prompt: text2("prompt").notNull(),
18151
- conversationHistoryConfig: text2("conversation_history_config", {
17285
+ tenantId: text("tenant_id").notNull(),
17286
+ projectId: text("project_id").notNull(),
17287
+ id: text("id").notNull(),
17288
+ name: text("name").notNull(),
17289
+ description: text("description").notNull(),
17290
+ prompt: text("prompt").notNull(),
17291
+ conversationHistoryConfig: text("conversation_history_config", {
18152
17292
  mode: "json"
18153
17293
  }).$type(),
18154
- models: text2("models", { mode: "json" }).$type(),
17294
+ models: text("models", { mode: "json" }).$type(),
18155
17295
  // Agent-level stopWhen configuration (inherited from project)
18156
- stopWhen: text2("stop_when", { mode: "json" }).$type(),
18157
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18158
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17296
+ stopWhen: text("stop_when", { mode: "json" }).$type(),
17297
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17298
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18159
17299
  },
18160
17300
  (table) => [
18161
17301
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18169,19 +17309,19 @@ var agents = sqliteTable(
18169
17309
  var agentRelations = sqliteTable(
18170
17310
  "agent_relations",
18171
17311
  {
18172
- tenantId: text2("tenant_id").notNull(),
18173
- projectId: text2("project_id").notNull(),
18174
- id: text2("id").notNull(),
18175
- graphId: text2("graph_id").notNull(),
18176
- sourceAgentId: text2("source_agent_id").notNull(),
17312
+ tenantId: text("tenant_id").notNull(),
17313
+ projectId: text("project_id").notNull(),
17314
+ id: text("id").notNull(),
17315
+ graphId: text("graph_id").notNull(),
17316
+ sourceAgentId: text("source_agent_id").notNull(),
18177
17317
  // For internal relationships
18178
- targetAgentId: text2("target_agent_id"),
17318
+ targetAgentId: text("target_agent_id"),
18179
17319
  // For external relationships
18180
- externalAgentId: text2("external_agent_id"),
18181
- relationType: text2("relation_type"),
17320
+ externalAgentId: text("external_agent_id"),
17321
+ relationType: text("relation_type"),
18182
17322
  // 'transfer' | 'delegate'
18183
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18184
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17323
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17324
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18185
17325
  },
18186
17326
  (table) => [
18187
17327
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18195,17 +17335,17 @@ var agentRelations = sqliteTable(
18195
17335
  var externalAgents = sqliteTable(
18196
17336
  "external_agents",
18197
17337
  {
18198
- tenantId: text2("tenant_id").notNull(),
18199
- projectId: text2("project_id").notNull(),
18200
- id: text2("id").notNull(),
18201
- name: text2("name").notNull(),
18202
- description: text2("description").notNull(),
18203
- baseUrl: text2("base_url").notNull(),
17338
+ tenantId: text("tenant_id").notNull(),
17339
+ projectId: text("project_id").notNull(),
17340
+ id: text("id").notNull(),
17341
+ name: text("name").notNull(),
17342
+ description: text("description").notNull(),
17343
+ baseUrl: text("base_url").notNull(),
18204
17344
  // A2A endpoint URL
18205
- credentialReferenceId: text2("credential_reference_id"),
17345
+ credentialReferenceId: text("credential_reference_id"),
18206
17346
  headers: blob("headers", { mode: "json" }).$type(),
18207
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18208
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17347
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17348
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18209
17349
  },
18210
17350
  (table) => [
18211
17351
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18228,24 +17368,24 @@ var externalAgents = sqliteTable(
18228
17368
  var agentGraph = sqliteTable(
18229
17369
  "agent_graph",
18230
17370
  {
18231
- tenantId: text2("tenant_id").notNull(),
18232
- projectId: text2("project_id").notNull(),
18233
- id: text2("id").notNull(),
18234
- name: text2("name").notNull(),
18235
- description: text2("description"),
18236
- defaultAgentId: text2("default_agent_id").notNull(),
17371
+ tenantId: text("tenant_id").notNull(),
17372
+ projectId: text("project_id").notNull(),
17373
+ id: text("id").notNull(),
17374
+ name: text("name").notNull(),
17375
+ description: text("description"),
17376
+ defaultAgentId: text("default_agent_id").notNull(),
18237
17377
  // Reference to shared context configuration for all agents in this graph
18238
- contextConfigId: text2("context_config_id"),
17378
+ contextConfigId: text("context_config_id"),
18239
17379
  // Graph-level model settingsuration that can be inherited by agents
18240
- models: text2("models", { mode: "json" }).$type(),
17380
+ models: text("models", { mode: "json" }).$type(),
18241
17381
  // Status updates configuration for intelligent progress summaries
18242
- statusUpdates: text2("status_updates", { mode: "json" }).$type(),
17382
+ statusUpdates: text("status_updates", { mode: "json" }).$type(),
18243
17383
  // Graph-level prompt that can be used as additional context for agents
18244
- graphPrompt: text2("graph_prompt"),
17384
+ graphPrompt: text("graph_prompt"),
18245
17385
  // Graph-level stopWhen configuration that can be inherited by agents
18246
- stopWhen: text2("stop_when", { mode: "json" }).$type(),
18247
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18248
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17386
+ stopWhen: text("stop_when", { mode: "json" }).$type(),
17387
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17388
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18249
17389
  },
18250
17390
  (table) => [
18251
17391
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18259,15 +17399,15 @@ var agentGraph = sqliteTable(
18259
17399
  var tasks = sqliteTable(
18260
17400
  "tasks",
18261
17401
  {
18262
- tenantId: text2("tenant_id").notNull(),
18263
- projectId: text2("project_id").notNull(),
18264
- id: text2("id").notNull(),
18265
- contextId: text2("context_id").notNull(),
18266
- status: text2("status").notNull(),
17402
+ tenantId: text("tenant_id").notNull(),
17403
+ projectId: text("project_id").notNull(),
17404
+ id: text("id").notNull(),
17405
+ contextId: text("context_id").notNull(),
17406
+ status: text("status").notNull(),
18267
17407
  metadata: blob("metadata", { mode: "json" }).$type(),
18268
- agentId: text2("agent_id").notNull(),
18269
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18270
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17408
+ agentId: text("agent_id").notNull(),
17409
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17410
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18271
17411
  },
18272
17412
  (table) => [
18273
17413
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18281,15 +17421,15 @@ var tasks = sqliteTable(
18281
17421
  var taskRelations = sqliteTable(
18282
17422
  "task_relations",
18283
17423
  {
18284
- tenantId: text2("tenant_id").notNull(),
18285
- projectId: text2("project_id").notNull(),
18286
- id: text2("id").notNull(),
18287
- parentTaskId: text2("parent_task_id").notNull(),
18288
- childTaskId: text2("child_task_id").notNull(),
18289
- relationType: text2("relation_type").default("parent_child"),
17424
+ tenantId: text("tenant_id").notNull(),
17425
+ projectId: text("project_id").notNull(),
17426
+ id: text("id").notNull(),
17427
+ parentTaskId: text("parent_task_id").notNull(),
17428
+ childTaskId: text("child_task_id").notNull(),
17429
+ relationType: text("relation_type").default("parent_child"),
18290
17430
  // Could be extended for other relation types
18291
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18292
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17431
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17432
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18293
17433
  },
18294
17434
  (table) => [
18295
17435
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18303,14 +17443,14 @@ var taskRelations = sqliteTable(
18303
17443
  var dataComponents = sqliteTable(
18304
17444
  "data_components",
18305
17445
  {
18306
- tenantId: text2("tenant_id").notNull(),
18307
- projectId: text2("project_id").notNull(),
18308
- id: text2("id").notNull(),
18309
- name: text2("name").notNull(),
18310
- description: text2("description").notNull(),
17446
+ tenantId: text("tenant_id").notNull(),
17447
+ projectId: text("project_id").notNull(),
17448
+ id: text("id").notNull(),
17449
+ name: text("name").notNull(),
17450
+ description: text("description").notNull(),
18311
17451
  props: blob("props", { mode: "json" }).$type(),
18312
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18313
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17452
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17453
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18314
17454
  },
18315
17455
  (table) => [
18316
17456
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18324,12 +17464,12 @@ var dataComponents = sqliteTable(
18324
17464
  var agentDataComponents = sqliteTable(
18325
17465
  "agent_data_components",
18326
17466
  {
18327
- tenantId: text2("tenant_id").notNull(),
18328
- projectId: text2("project_id").notNull(),
18329
- id: text2("id").notNull(),
18330
- agentId: text2("agent_id").notNull(),
18331
- dataComponentId: text2("data_component_id").notNull(),
18332
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17467
+ tenantId: text("tenant_id").notNull(),
17468
+ projectId: text("project_id").notNull(),
17469
+ id: text("id").notNull(),
17470
+ agentId: text("agent_id").notNull(),
17471
+ dataComponentId: text("data_component_id").notNull(),
17472
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18333
17473
  },
18334
17474
  (table) => [
18335
17475
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18356,15 +17496,15 @@ var agentDataComponents = sqliteTable(
18356
17496
  var artifactComponents = sqliteTable(
18357
17497
  "artifact_components",
18358
17498
  {
18359
- tenantId: text2("tenant_id").notNull(),
18360
- projectId: text2("project_id").notNull(),
18361
- id: text2("id").notNull(),
18362
- name: text2("name").notNull(),
18363
- description: text2("description").notNull(),
17499
+ tenantId: text("tenant_id").notNull(),
17500
+ projectId: text("project_id").notNull(),
17501
+ id: text("id").notNull(),
17502
+ name: text("name").notNull(),
17503
+ description: text("description").notNull(),
18364
17504
  summaryProps: blob("summary_props", { mode: "json" }).$type(),
18365
17505
  fullProps: blob("full_props", { mode: "json" }).$type(),
18366
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18367
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17506
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17507
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18368
17508
  },
18369
17509
  (table) => [
18370
17510
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18378,12 +17518,12 @@ var artifactComponents = sqliteTable(
18378
17518
  var agentArtifactComponents = sqliteTable(
18379
17519
  "agent_artifact_components",
18380
17520
  {
18381
- tenantId: text2("tenant_id").notNull(),
18382
- projectId: text2("project_id").notNull(),
18383
- id: text2("id").notNull(),
18384
- agentId: text2("agent_id").notNull(),
18385
- artifactComponentId: text2("artifact_component_id").notNull(),
18386
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17521
+ tenantId: text("tenant_id").notNull(),
17522
+ projectId: text("project_id").notNull(),
17523
+ id: text("id").notNull(),
17524
+ agentId: text("agent_id").notNull(),
17525
+ artifactComponentId: text("artifact_component_id").notNull(),
17526
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18387
17527
  },
18388
17528
  (table) => [
18389
17529
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18414,27 +17554,27 @@ var agentArtifactComponents = sqliteTable(
18414
17554
  var tools = sqliteTable(
18415
17555
  "tools",
18416
17556
  {
18417
- tenantId: text2("tenant_id").notNull(),
18418
- projectId: text2("project_id").notNull(),
18419
- id: text2("id").notNull(),
18420
- name: text2("name").notNull(),
17557
+ tenantId: text("tenant_id").notNull(),
17558
+ projectId: text("project_id").notNull(),
17559
+ id: text("id").notNull(),
17560
+ name: text("name").notNull(),
18421
17561
  // Enhanced MCP configuration
18422
17562
  config: blob("config", { mode: "json" }).$type().notNull(),
18423
- credentialReferenceId: text2("credential_reference_id"),
17563
+ credentialReferenceId: text("credential_reference_id"),
18424
17564
  headers: blob("headers", { mode: "json" }).$type(),
18425
17565
  // Image URL for custom tool icon (supports regular URLs and base64 encoded images)
18426
- imageUrl: text2("image_url"),
17566
+ imageUrl: text("image_url"),
18427
17567
  // Server capabilities and status
18428
17568
  capabilities: blob("capabilities", { mode: "json" }).$type(),
18429
17569
  // Connection health and monitoring
18430
- status: text2("status").notNull().default("unknown"),
18431
- lastHealthCheck: text2("last_health_check"),
18432
- lastError: text2("last_error"),
17570
+ status: text("status").notNull().default("unknown"),
17571
+ lastHealthCheck: text("last_health_check"),
17572
+ lastError: text("last_error"),
18433
17573
  // Tool discovery cache
18434
17574
  availableTools: blob("available_tools", { mode: "json" }).$type(),
18435
- lastToolsSync: text2("last_tools_sync"),
18436
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18437
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17575
+ lastToolsSync: text("last_tools_sync"),
17576
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17577
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18438
17578
  },
18439
17579
  (table) => [
18440
17580
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18448,14 +17588,14 @@ var tools = sqliteTable(
18448
17588
  var agentToolRelations = sqliteTable(
18449
17589
  "agent_tool_relations",
18450
17590
  {
18451
- tenantId: text2("tenant_id").notNull(),
18452
- projectId: text2("project_id").notNull(),
18453
- id: text2("id").notNull(),
18454
- agentId: text2("agent_id").notNull(),
18455
- toolId: text2("tool_id").notNull(),
17591
+ tenantId: text("tenant_id").notNull(),
17592
+ projectId: text("project_id").notNull(),
17593
+ id: text("id").notNull(),
17594
+ agentId: text("agent_id").notNull(),
17595
+ toolId: text("tool_id").notNull(),
18456
17596
  selectedTools: blob("selected_tools", { mode: "json" }).$type(),
18457
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18458
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17597
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17598
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18459
17599
  },
18460
17600
  (table) => [
18461
17601
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18482,16 +17622,16 @@ var agentToolRelations = sqliteTable(
18482
17622
  var conversations = sqliteTable(
18483
17623
  "conversations",
18484
17624
  {
18485
- tenantId: text2("tenant_id").notNull(),
18486
- projectId: text2("project_id").notNull(),
18487
- id: text2("id").notNull(),
18488
- userId: text2("user_id"),
18489
- activeAgentId: text2("active_agent_id").notNull(),
18490
- title: text2("title"),
18491
- lastContextResolution: text2("last_context_resolution"),
17625
+ tenantId: text("tenant_id").notNull(),
17626
+ projectId: text("project_id").notNull(),
17627
+ id: text("id").notNull(),
17628
+ userId: text("user_id"),
17629
+ activeAgentId: text("active_agent_id").notNull(),
17630
+ title: text("title"),
17631
+ lastContextResolution: text("last_context_resolution"),
18492
17632
  metadata: blob("metadata", { mode: "json" }).$type(),
18493
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18494
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17633
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17634
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18495
17635
  },
18496
17636
  (table) => [
18497
17637
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18505,45 +17645,45 @@ var conversations = sqliteTable(
18505
17645
  var messages = sqliteTable(
18506
17646
  "messages",
18507
17647
  {
18508
- tenantId: text2("tenant_id").notNull(),
18509
- projectId: text2("project_id").notNull(),
18510
- id: text2("id").notNull(),
18511
- conversationId: text2("conversation_id").notNull(),
17648
+ tenantId: text("tenant_id").notNull(),
17649
+ projectId: text("project_id").notNull(),
17650
+ id: text("id").notNull(),
17651
+ conversationId: text("conversation_id").notNull(),
18512
17652
  // Role mapping: user, agent, system (unified for both formats)
18513
- role: text2("role").notNull(),
17653
+ role: text("role").notNull(),
18514
17654
  // 'user' | 'agent' | 'system'
18515
17655
  // Agent sender/recipient tracking (nullable - only populated when relevant)
18516
- fromAgentId: text2("from_agent_id"),
17656
+ fromAgentId: text("from_agent_id"),
18517
17657
  // Populated when message is from an agent
18518
- toAgentId: text2("to_agent_id"),
17658
+ toAgentId: text("to_agent_id"),
18519
17659
  // Populated when message is directed to a specific agent (e.g., transfers/delegations)
18520
17660
  // External agent sender tracking
18521
- fromExternalAgentId: text2("from_external_agent_id"),
17661
+ fromExternalAgentId: text("from_external_agent_id"),
18522
17662
  // Populated when message is directed from an external agent
18523
17663
  // External agent recipient tracking
18524
- toExternalAgentId: text2("to_external_agent_id"),
17664
+ toExternalAgentId: text("to_external_agent_id"),
18525
17665
  // Populated when message is directed to an external agent
18526
17666
  // Message content stored as JSON to support both formats
18527
17667
  content: blob("content", { mode: "json" }).$type().notNull(),
18528
17668
  // Message classification and filtering
18529
- visibility: text2("visibility").notNull().default("user-facing"),
17669
+ visibility: text("visibility").notNull().default("user-facing"),
18530
17670
  // 'user-facing' | 'internal' | 'system' | 'external'
18531
- messageType: text2("message_type").notNull().default("chat"),
17671
+ messageType: text("message_type").notNull().default("chat"),
18532
17672
  // 'chat' | 'a2a-request' | 'a2a-response' | 'task-update' | 'tool-call'
18533
17673
  // Legacy agent association (consider deprecating in favor of fromAgentId/toAgentId)
18534
- agentId: text2("agent_id"),
18535
- taskId: text2("task_id"),
18536
- parentMessageId: text2("parent_message_id"),
17674
+ agentId: text("agent_id"),
17675
+ taskId: text("task_id"),
17676
+ parentMessageId: text("parent_message_id"),
18537
17677
  // Remove self-reference constraint here
18538
17678
  // A2A specific fields
18539
- a2aTaskId: text2("a2a_task_id"),
17679
+ a2aTaskId: text("a2a_task_id"),
18540
17680
  // Links to A2A task when relevant
18541
- a2aSessionId: text2("a2a_session_id"),
17681
+ a2aSessionId: text("a2a_session_id"),
18542
17682
  // A2A session identifier
18543
17683
  // Metadata for extensions
18544
17684
  metadata: blob("metadata", { mode: "json" }).$type(),
18545
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18546
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17685
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17686
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18547
17687
  },
18548
17688
  (table) => [
18549
17689
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18558,27 +17698,27 @@ var ledgerArtifacts = sqliteTable(
18558
17698
  "ledger_artifacts",
18559
17699
  {
18560
17700
  // Primary identifier (maps to `artifactId`)
18561
- tenantId: text2("tenant_id").notNull(),
18562
- projectId: text2("project_id").notNull(),
18563
- id: text2("id").notNull(),
17701
+ tenantId: text("tenant_id").notNull(),
17702
+ projectId: text("project_id").notNull(),
17703
+ id: text("id").notNull(),
18564
17704
  // Links
18565
- taskId: text2("task_id"),
18566
- contextId: text2("context_id").notNull(),
17705
+ taskId: text("task_id"),
17706
+ contextId: text("context_id").notNull(),
18567
17707
  // Core Artifact fields
18568
- type: text2("type").notNull().default("source"),
18569
- name: text2("name"),
18570
- description: text2("description"),
17708
+ type: text("type").notNull().default("source"),
17709
+ name: text("name"),
17710
+ description: text("description"),
18571
17711
  parts: blob("parts", { mode: "json" }).$type(),
18572
17712
  metadata: blob("metadata", { mode: "json" }).$type(),
18573
17713
  // Extra ledger information (not part of the Artifact spec – kept optional)
18574
- summary: text2("summary"),
17714
+ summary: text("summary"),
18575
17715
  mime: blob("mime", { mode: "json" }).$type(),
18576
- visibility: text2("visibility").default("context"),
17716
+ visibility: text("visibility").default("context"),
18577
17717
  allowedAgents: blob("allowed_agents", { mode: "json" }).$type(),
18578
- derivedFrom: text2("derived_from"),
17718
+ derivedFrom: text("derived_from"),
18579
17719
  // Timestamps
18580
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18581
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17720
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17721
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18582
17722
  },
18583
17723
  (table) => [
18584
17724
  primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
@@ -18592,20 +17732,20 @@ var ledgerArtifacts = sqliteTable(
18592
17732
  var apiKeys = sqliteTable(
18593
17733
  "api_keys",
18594
17734
  {
18595
- id: text2("id").primaryKey(),
18596
- tenantId: text2("tenant_id").notNull(),
18597
- projectId: text2("project_id").notNull(),
18598
- graphId: text2("graph_id").notNull(),
18599
- publicId: text2("public_id").notNull().unique(),
17735
+ id: text("id").primaryKey(),
17736
+ tenantId: text("tenant_id").notNull(),
17737
+ projectId: text("project_id").notNull(),
17738
+ graphId: text("graph_id").notNull(),
17739
+ publicId: text("public_id").notNull().unique(),
18600
17740
  // Public ID for O(1) lookup (e.g., "abc123def456")
18601
- keyHash: text2("key_hash").notNull(),
17741
+ keyHash: text("key_hash").notNull(),
18602
17742
  // Hashed API key (never store plaintext)
18603
- keyPrefix: text2("key_prefix").notNull(),
17743
+ keyPrefix: text("key_prefix").notNull(),
18604
17744
  // First 8 chars for identification (e.g., "sk_live_abc...")
18605
- lastUsedAt: text2("last_used_at"),
18606
- expiresAt: text2("expires_at"),
18607
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18608
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17745
+ lastUsedAt: text("last_used_at"),
17746
+ expiresAt: text("expires_at"),
17747
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17748
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18609
17749
  },
18610
17750
  (t2) => [
18611
17751
  foreignKey({
@@ -18626,16 +17766,16 @@ var apiKeys = sqliteTable(
18626
17766
  var credentialReferences = sqliteTable(
18627
17767
  "credential_references",
18628
17768
  {
18629
- tenantId: text2("tenant_id").notNull(),
18630
- projectId: text2("project_id").notNull(),
18631
- id: text2("id").notNull(),
18632
- type: text2("type").notNull(),
17769
+ tenantId: text("tenant_id").notNull(),
17770
+ projectId: text("project_id").notNull(),
17771
+ id: text("id").notNull(),
17772
+ type: text("type").notNull(),
18633
17773
  // Implementation type: 'keychain', 'nango', 'memory', etc.
18634
- credentialStoreId: text2("credential_store_id").notNull(),
17774
+ credentialStoreId: text("credential_store_id").notNull(),
18635
17775
  // Maps to framework.getCredentialStore(id)
18636
17776
  retrievalParams: blob("retrieval_params", { mode: "json" }).$type(),
18637
- createdAt: text2("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
18638
- updatedAt: text2("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
17777
+ createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
17778
+ updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
18639
17779
  },
18640
17780
  (t2) => [
18641
17781
  primaryKey({ columns: [t2.tenantId, t2.projectId, t2.id] }),
@@ -19635,8 +18775,8 @@ import { and as and6, count as count6, desc as desc6, eq as eq6 } from "drizzle-
19635
18775
  // ../packages/agents-core/src/utils/apiKeys.ts
19636
18776
  init_esm_shims();
19637
18777
  import { randomBytes, scrypt, timingSafeEqual } from "crypto";
19638
- import { promisify as promisify2 } from "util";
19639
- var scryptAsync = promisify2(scrypt);
18778
+ import { promisify } from "util";
18779
+ var scryptAsync = promisify(scrypt);
19640
18780
  var logger3 = getLogger("api-key");
19641
18781
  var PUBLIC_ID_LENGTH = 12;
19642
18782
  var PUBLIC_ID_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-";
@@ -21959,7 +21099,7 @@ function d(...e2) {
21959
21099
  return c(e2, s).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o(e3, t2, r2)), selections: n2 };
21960
21100
  }, getSelectionKeys: () => c(e2, s), matcherType: "or" }) });
21961
21101
  }
21962
- function p2(e2) {
21102
+ function p(e2) {
21963
21103
  return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
21964
21104
  }
21965
21105
  function y(...e2) {
@@ -21980,37 +21120,37 @@ function b(t2) {
21980
21120
  function w(t2) {
21981
21121
  return "bigint" == typeof t2;
21982
21122
  }
21983
- var S = u(p2(function(t2) {
21123
+ var S = u(p(function(t2) {
21984
21124
  return true;
21985
21125
  }));
21986
21126
  var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
21987
- return j(m(t2, (n2 = e2, p2((t3) => b(t3) && t3.startsWith(n2)))));
21127
+ return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
21988
21128
  var n2;
21989
21129
  }, endsWith: (e2) => {
21990
- return j(m(t2, (n2 = e2, p2((t3) => b(t3) && t3.endsWith(n2)))));
21130
+ return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
21991
21131
  var n2;
21992
- }, minLength: (e2) => j(m(t2, ((t3) => p2((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p2((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p2((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
21993
- return j(m(t2, (n2 = e2, p2((t3) => b(t3) && t3.includes(n2)))));
21132
+ }, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
21133
+ return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.includes(n2)))));
21994
21134
  var n2;
21995
21135
  }, regex: (e2) => {
21996
- return j(m(t2, (n2 = e2, p2((t3) => b(t3) && Boolean(t3.match(n2))))));
21136
+ return j(m(t2, (n2 = e2, p((t3) => b(t3) && Boolean(t3.match(n2))))));
21997
21137
  var n2;
21998
21138
  } });
21999
- var K = j(p2(b));
22000
- var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p2((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p2((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p2((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p2((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p2((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p2((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p2((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p2((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p2((t3) => v(t3) && t3 < 0))) });
22001
- var E = x(p2(v));
22002
- var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p2((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p2((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p2((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p2((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p2((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p2((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p2((t3) => w(t3) && t3 < 0))) });
22003
- var P = A(p2(w));
22004
- var T = u(p2(function(t2) {
21139
+ var K = j(p(b));
21140
+ var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) });
21141
+ var E = x(p(v));
21142
+ var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) });
21143
+ var P = A(p(w));
21144
+ var T = u(p(function(t2) {
22005
21145
  return "boolean" == typeof t2;
22006
21146
  }));
22007
- var B = u(p2(function(t2) {
21147
+ var B = u(p(function(t2) {
22008
21148
  return "symbol" == typeof t2;
22009
21149
  }));
22010
- var _ = u(p2(function(t2) {
21150
+ var _ = u(p(function(t2) {
22011
21151
  return null == t2;
22012
21152
  }));
22013
- var k = u(p2(function(t2) {
21153
+ var k = u(p(function(t2) {
22014
21154
  return null != t2;
22015
21155
  }));
22016
21156
 
@@ -22160,19 +21300,19 @@ function buildGraphViewUrl(manageUiUrl, tenantId, projectId, graphId) {
22160
21300
 
22161
21301
  // src/commands/push.ts
22162
21302
  async function pushCommand(graphPath, options) {
22163
- const spinner2 = ora4("Loading graph configuration...").start();
21303
+ const spinner = ora4("Loading graph configuration...").start();
22164
21304
  try {
22165
21305
  const absolutePath = resolve4(process.cwd(), graphPath);
22166
21306
  if (!existsSync6(absolutePath)) {
22167
- spinner2.fail("Graph file not found");
21307
+ spinner.fail("Graph file not found");
22168
21308
  console.error(chalk6.red(`File not found: ${absolutePath}`));
22169
21309
  process.exit(1);
22170
21310
  }
22171
21311
  if (options.env) {
22172
21312
  process.env.INKEEP_ENV = options.env;
22173
- spinner2.text = `Setting environment to '${options.env}'...`;
21313
+ spinner.text = `Setting environment to '${options.env}'...`;
22174
21314
  }
22175
- spinner2.text = "Loading graph module...";
21315
+ spinner.text = "Loading graph module...";
22176
21316
  const module = await importWithTypeScriptSupport(absolutePath);
22177
21317
  const exports = Object.keys(module);
22178
21318
  const graphExports = exports.filter((key) => {
@@ -22180,19 +21320,19 @@ async function pushCommand(graphPath, options) {
22180
21320
  return value && typeof value === "object" && typeof value.init === "function" && typeof value.getId === "function" && typeof value.getName === "function" && typeof value.getAgents === "function";
22181
21321
  });
22182
21322
  if (graphExports.length === 0) {
22183
- spinner2.fail("No AgentGraph exported from configuration file");
21323
+ spinner.fail("No AgentGraph exported from configuration file");
22184
21324
  console.error(chalk6.red("Configuration file must export at least one AgentGraph instance"));
22185
21325
  process.exit(1);
22186
21326
  }
22187
21327
  if (graphExports.length > 1) {
22188
- spinner2.fail("Multiple AgentGraphs exported from configuration file");
21328
+ spinner.fail("Multiple AgentGraphs exported from configuration file");
22189
21329
  console.error(chalk6.red("Configuration file must export exactly one AgentGraph instance"));
22190
21330
  console.error(chalk6.yellow("Found exports:"), graphExports.join(", "));
22191
21331
  process.exit(1);
22192
21332
  }
22193
21333
  const graphKey = graphExports[0];
22194
21334
  const graph = module[graphKey];
22195
- spinner2.text = "Loading configuration...";
21335
+ spinner.text = "Loading configuration...";
22196
21336
  let config;
22197
21337
  try {
22198
21338
  config = await validateConfiguration(
@@ -22203,11 +21343,11 @@ async function pushCommand(graphPath, options) {
22203
21343
  options.configFilePath
22204
21344
  );
22205
21345
  } catch (error) {
22206
- spinner2.fail("Configuration validation failed");
21346
+ spinner.fail("Configuration validation failed");
22207
21347
  console.error(chalk6.red(error.message));
22208
21348
  process.exit(1);
22209
21349
  }
22210
- spinner2.succeed("Configuration loaded");
21350
+ spinner.succeed("Configuration loaded");
22211
21351
  console.log(chalk6.gray("Configuration sources:"));
22212
21352
  console.log(chalk6.gray(` \u2022 Tenant ID: ${config.sources.tenantId}`));
22213
21353
  console.log(chalk6.gray(` \u2022 Project ID: ${config.sources.projectId}`));
@@ -22215,12 +21355,12 @@ async function pushCommand(graphPath, options) {
22215
21355
  const tenantId = config.tenantId;
22216
21356
  const projectId = config.projectId;
22217
21357
  const agentsManageApiUrl = config.agentsManageApiUrl;
22218
- spinner2.text = "Validating project...";
21358
+ spinner.text = "Validating project...";
22219
21359
  let dbUrl = process.env.DB_FILE_NAME || "local.db";
22220
21360
  if (dbUrl !== ":memory:" && !dbUrl.startsWith("file:") && !dbUrl.startsWith("libsql:") && !dbUrl.startsWith("http")) {
22221
21361
  const absolutePath2 = resolve4(process.cwd(), dbUrl);
22222
21362
  if (!existsSync6(absolutePath2)) {
22223
- spinner2.fail(`Database file not found: ${absolutePath2}`);
21363
+ spinner.fail(`Database file not found: ${absolutePath2}`);
22224
21364
  console.error(
22225
21365
  chalk6.red(
22226
21366
  "Please ensure the database file exists or set DB_FILE_NAME environment variable"
@@ -22235,8 +21375,8 @@ async function pushCommand(graphPath, options) {
22235
21375
  scopes: { tenantId, projectId }
22236
21376
  });
22237
21377
  if (!existingProject) {
22238
- spinner2.warn(`Project "${projectId}" does not exist`);
22239
- spinner2.stop();
21378
+ spinner.warn(`Project "${projectId}" does not exist`);
21379
+ spinner.stop();
22240
21380
  const { shouldCreate } = await inquirer3.prompt([
22241
21381
  {
22242
21382
  type: "confirm",
@@ -22271,7 +21411,7 @@ async function pushCommand(graphPath, options) {
22271
21411
  ]);
22272
21412
  let models = config.modelSettings;
22273
21413
  if (!models || !models.base) {
22274
- spinner2.stop();
21414
+ spinner.stop();
22275
21415
  console.log(chalk6.cyan("\nNow let's configure the AI models for this project."));
22276
21416
  console.log(chalk6.gray("Models are required for agents to function properly.\n"));
22277
21417
  const { modelSettings } = await promptForModelConfiguration();
@@ -22279,7 +21419,7 @@ async function pushCommand(graphPath, options) {
22279
21419
  } else {
22280
21420
  console.log(chalk6.gray("\nUsing model settings from config file."));
22281
21421
  }
22282
- spinner2.start("Creating project with configured models...");
21422
+ spinner.start("Creating project with configured models...");
22283
21423
  try {
22284
21424
  await createProject(dbClient)({
22285
21425
  id: projectId,
@@ -22289,14 +21429,14 @@ async function pushCommand(graphPath, options) {
22289
21429
  models
22290
21430
  // Pass models directly when creating the project
22291
21431
  });
22292
- spinner2.succeed(`Project "${projectName}" created successfully with model configuration`);
21432
+ spinner.succeed(`Project "${projectName}" created successfully with model configuration`);
22293
21433
  } catch (error) {
22294
- spinner2.fail("Failed to create project");
21434
+ spinner.fail("Failed to create project");
22295
21435
  console.error(chalk6.red("Error:"), error.message);
22296
21436
  process.exit(1);
22297
21437
  }
22298
21438
  } else {
22299
- spinner2.succeed(`Project "${existingProject.name || projectId}" validated`);
21439
+ spinner.succeed(`Project "${existingProject.name || projectId}" validated`);
22300
21440
  }
22301
21441
  await ManagementApiClient.create(
22302
21442
  config.agentsManageApiUrl,
@@ -22306,12 +21446,12 @@ async function pushCommand(graphPath, options) {
22306
21446
  if (typeof graph.setConfig === "function") {
22307
21447
  graph.setConfig(tenantId, projectId, agentsManageApiUrl);
22308
21448
  }
22309
- spinner2.start("Initializing graph...");
21449
+ spinner.start("Initializing graph...");
22310
21450
  await graph.init();
22311
21451
  const graphId = graph.getId();
22312
21452
  const graphName = graph.getName();
22313
21453
  const stats = graph.getStats();
22314
- spinner2.succeed(`Graph "${graphName}" (${graphId}) pushed successfully`);
21454
+ spinner.succeed(`Graph "${graphName}" (${graphId}) pushed successfully`);
22315
21455
  const agents2 = graph.getAgents();
22316
21456
  const warnings = [];
22317
21457
  for (const agent of agents2) {
@@ -22368,7 +21508,7 @@ async function pushCommand(graphPath, options) {
22368
21508
  console.log(chalk6.gray(` \u2022 Get graph details: inkeep get-graph ${graphId}`));
22369
21509
  process.exit(0);
22370
21510
  } catch (error) {
22371
- spinner2.fail("Failed to push graph");
21511
+ spinner.fail("Failed to push graph");
22372
21512
  console.error(chalk6.red("Error:"), error.message);
22373
21513
  if (error.stack && process.env.DEBUG) {
22374
21514
  console.error(chalk6.gray(error.stack));
@@ -22384,11 +21524,8 @@ var packageJsonPath = join6(__dirname2, "..", "package.json");
22384
21524
  var packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
22385
21525
  var program = new Command();
22386
21526
  program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
22387
- program.command("create [directory]").description("Create a new Inkeep Agent Framework Starter Directory").option("--tenant-id <tenant-id>", "Tenant ID").option("--project-id <project-id>", "Project ID").option("--openai-key <openai-key>", "OpenAI API key").option("--anthropic-key <anthropic-key>", "Anthropic API key").option("--manage-api-port <port>", "Manage API port", "3002").option("--run-api-port <port>", "Run API port", "3003").action(async (directory, options) => {
22388
- await createCommand(directory, options);
22389
- });
22390
- program.command("init [path]").description("Initialize a new Inkeep configuration file").option("--no-interactive", "Skip interactive path selection").action(async (path3, options) => {
22391
- await initCommand({ path: path3, ...options });
21527
+ program.command("init [path]").description("Initialize a new Inkeep configuration file").option("--no-interactive", "Skip interactive path selection").action(async (path2, options) => {
21528
+ await initCommand({ path: path2, ...options });
22392
21529
  });
22393
21530
  var configCommand = program.command("config").description("Manage Inkeep configuration");
22394
21531
  configCommand.command("get [key]").description("Get configuration value(s)").option("--config-file-path <path>", "Path to configuration file").action(async (key, options) => {