plugin-agent-orchestrator 1.2.2 → 1.2.3
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/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/adm-zip/package.json +1 -1
- package/dist/node_modules/ajv/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/plugin.js +3 -1
- package/dist/server/utils/normalize-hierarchy-invocation-index.js +55 -0
- package/package.json +2 -2
- package/src/server/__tests__/hierarchy-invocation-journal.integration.test.ts +65 -1
- package/src/server/__tests__/normalize-hierarchy-invocation-index.test.ts +72 -0
- package/src/server/plugin.ts +3 -1
- package/src/server/utils/normalize-hierarchy-invocation-index.ts +27 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"acorn","description":"ECMAScript parser","homepage":"https://github.com/acornjs/acorn","main":"dist/acorn.js","types":"dist/acorn.d.ts","module":"dist/acorn.mjs","exports":{".":[{"import":"./dist/acorn.mjs","require":"./dist/acorn.js","default":"./dist/acorn.js"},"./dist/acorn.js"],"./package.json":"./package.json"},"version":"8.11.2","engines":{"node":">=0.4.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"license":"MIT","scripts":{"prepare":"cd ..; npm run build:main"},"bin":{"acorn":"./bin/acorn"},"_lastModified":"2026-11-
|
|
1
|
+
{"name":"acorn","description":"ECMAScript parser","homepage":"https://github.com/acornjs/acorn","main":"dist/acorn.js","types":"dist/acorn.d.ts","module":"dist/acorn.mjs","exports":{".":[{"import":"./dist/acorn.mjs","require":"./dist/acorn.js","default":"./dist/acorn.js"},"./dist/acorn.js"],"./package.json":"./package.json"},"version":"8.11.2","engines":{"node":">=0.4.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"license":"MIT","scripts":{"prepare":"cd ..; npm run build:main"},"bin":{"acorn":"./bin/acorn"},"_lastModified":"2026-11-21T09:53:43.775Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"acorn-walk","description":"ECMAScript (ESTree) AST walker","homepage":"https://github.com/acornjs/acorn","main":"dist/walk.js","types":"dist/walk.d.ts","module":"dist/walk.mjs","exports":{".":[{"import":"./dist/walk.mjs","require":"./dist/walk.js","default":"./dist/walk.js"},"./dist/walk.js"],"./package.json":"./package.json"},"version":"8.3.4","engines":{"node":">=0.4.0"},"dependencies":{"acorn":"^8.11.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"scripts":{"prepare":"cd ..; npm run build:walk"},"license":"MIT","_lastModified":"2026-11-
|
|
1
|
+
{"name":"acorn-walk","description":"ECMAScript (ESTree) AST walker","homepage":"https://github.com/acornjs/acorn","main":"dist/walk.js","types":"dist/walk.d.ts","module":"dist/walk.mjs","exports":{".":[{"import":"./dist/walk.mjs","require":"./dist/walk.js","default":"./dist/walk.js"},"./dist/walk.js"],"./package.json":"./package.json"},"version":"8.3.4","engines":{"node":">=0.4.0"},"dependencies":{"acorn":"^8.11.0"},"maintainers":[{"name":"Marijn Haverbeke","email":"marijnh@gmail.com","web":"https://marijnhaverbeke.nl"},{"name":"Ingvar Stepanyan","email":"me@rreverser.com","web":"https://rreverser.com/"},{"name":"Adrian Heine","web":"http://adrianheine.de"}],"repository":{"type":"git","url":"https://github.com/acornjs/acorn.git"},"scripts":{"prepare":"cd ..; npm run build:walk"},"license":"MIT","_lastModified":"2026-11-21T09:53:43.940Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"adm-zip","version":"0.5.17","description":"Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk","scripts":{"test":"mocha -R spec","test:format":"npm run format:prettier:raw -- --check","format":"npm run format:prettier","format:prettier":"npm run format:prettier:raw -- --write","format:prettier:raw":"prettier \"**/*.{js,yml,json}\""},"keywords":["zip","methods","archive","unzip"],"homepage":"https://github.com/cthackers/adm-zip","author":"Nasca Iacob <sy@another-d-mention.ro> (https://github.com/cthackers)","bugs":{"email":"sy@another-d-mention.ro","url":"https://github.com/cthackers/adm-zip/issues"},"license":"MIT","files":["adm-zip.js","headers","methods","util","zipEntry.js","zipFile.js","LICENSE"],"main":"adm-zip.js","repository":{"type":"git","url":"https://github.com/cthackers/adm-zip.git"},"engines":{"node":">=12.0"},"overrides":{"mocha":{"chokidar":"^4.0.3"}},"devDependencies":{"chai":"^6.2.2","iconv-lite":"^0.7.2","mocha":"12.0.0-beta-10","prettier":"^3.8.1","rimraf":"^3.0.2"},"_lastModified":"2026-11-
|
|
1
|
+
{"name":"adm-zip","version":"0.5.17","description":"Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk","scripts":{"test":"mocha -R spec","test:format":"npm run format:prettier:raw -- --check","format":"npm run format:prettier","format:prettier":"npm run format:prettier:raw -- --write","format:prettier:raw":"prettier \"**/*.{js,yml,json}\""},"keywords":["zip","methods","archive","unzip"],"homepage":"https://github.com/cthackers/adm-zip","author":"Nasca Iacob <sy@another-d-mention.ro> (https://github.com/cthackers)","bugs":{"email":"sy@another-d-mention.ro","url":"https://github.com/cthackers/adm-zip/issues"},"license":"MIT","files":["adm-zip.js","headers","methods","util","zipEntry.js","zipFile.js","LICENSE"],"main":"adm-zip.js","repository":{"type":"git","url":"https://github.com/cthackers/adm-zip.git"},"engines":{"node":">=12.0"},"overrides":{"mocha":{"chokidar":"^4.0.3"}},"devDependencies":{"chai":"^6.2.2","iconv-lite":"^0.7.2","mocha":"12.0.0-beta-10","prettier":"^3.8.1","rimraf":"^3.0.2"},"_lastModified":"2026-11-21T09:53:43.327Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ajv","version":"6.12.6","description":"Another JSON Schema Validator","main":"lib/ajv.js","typings":"lib/ajv.d.ts","files":["lib/","dist/","scripts/","LICENSE",".tonic_example.js"],"scripts":{"eslint":"eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite","jshint":"jshint lib/{compile/,}*.js","lint":"npm run jshint && npm run eslint","test-spec":"mocha spec/{**/,}*.spec.js -R spec","test-fast":"AJV_FAST_TEST=true npm run test-spec","test-debug":"npm run test-spec -- --inspect-brk","test-cov":"nyc npm run test-spec","test-ts":"tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts","bundle":"del-cli dist && node ./scripts/bundle.js . Ajv pure_getters","bundle-beautify":"node ./scripts/bundle.js js-beautify","build":"del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js","test-karma":"karma start","test-browser":"del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma","test-all":"npm run test-cov && if-node-version 10 npm run test-browser","test":"npm run lint && npm run build && npm run test-all","prepublish":"npm run build && npm run bundle","watch":"watch \"npm run build\" ./lib/dot"},"nyc":{"exclude":["**/spec/**","node_modules"],"reporter":["lcov","text-summary"]},"repository":{"type":"git","url":"https://github.com/ajv-validator/ajv.git"},"keywords":["JSON","schema","validator","validation","jsonschema","json-schema","json-schema-validator","json-schema-validation"],"author":"Evgeny Poberezkin","license":"MIT","bugs":{"url":"https://github.com/ajv-validator/ajv/issues"},"homepage":"https://github.com/ajv-validator/ajv","tonicExampleFilename":".tonic_example.js","dependencies":{"fast-deep-equal":"^3.1.1","fast-json-stable-stringify":"^2.0.0","json-schema-traverse":"^0.4.1","uri-js":"^4.2.2"},"devDependencies":{"ajv-async":"^1.0.0","bluebird":"^3.5.3","brfs":"^2.0.0","browserify":"^16.2.0","chai":"^4.0.1","coveralls":"^3.0.1","del-cli":"^3.0.0","dot":"^1.0.3","eslint":"^7.3.1","gh-pages-generator":"^0.2.3","glob":"^7.0.0","if-node-version":"^1.0.0","js-beautify":"^1.7.3","jshint":"^2.10.2","json-schema-test":"^2.0.0","karma":"^5.0.0","karma-chrome-launcher":"^3.0.0","karma-mocha":"^2.0.0","karma-sauce-launcher":"^4.1.3","mocha":"^8.0.1","nyc":"^15.0.0","pre-commit":"^1.1.1","require-globify":"^1.3.0","typescript":"^3.9.5","uglify-js":"^3.6.9","watch":"^1.0.0"},"collective":{"type":"opencollective","url":"https://opencollective.com/ajv"},"funding":{"type":"github","url":"https://github.com/sponsors/epoberezkin"},"_lastModified":"2026-11-
|
|
1
|
+
{"name":"ajv","version":"6.12.6","description":"Another JSON Schema Validator","main":"lib/ajv.js","typings":"lib/ajv.d.ts","files":["lib/","dist/","scripts/","LICENSE",".tonic_example.js"],"scripts":{"eslint":"eslint lib/{compile/,}*.js spec/{**/,}*.js scripts --ignore-pattern spec/JSON-Schema-Test-Suite","jshint":"jshint lib/{compile/,}*.js","lint":"npm run jshint && npm run eslint","test-spec":"mocha spec/{**/,}*.spec.js -R spec","test-fast":"AJV_FAST_TEST=true npm run test-spec","test-debug":"npm run test-spec -- --inspect-brk","test-cov":"nyc npm run test-spec","test-ts":"tsc --target ES5 --noImplicitAny --noEmit spec/typescript/index.ts","bundle":"del-cli dist && node ./scripts/bundle.js . Ajv pure_getters","bundle-beautify":"node ./scripts/bundle.js js-beautify","build":"del-cli lib/dotjs/*.js \"!lib/dotjs/index.js\" && node scripts/compile-dots.js","test-karma":"karma start","test-browser":"del-cli .browser && npm run bundle && scripts/prepare-tests && npm run test-karma","test-all":"npm run test-cov && if-node-version 10 npm run test-browser","test":"npm run lint && npm run build && npm run test-all","prepublish":"npm run build && npm run bundle","watch":"watch \"npm run build\" ./lib/dot"},"nyc":{"exclude":["**/spec/**","node_modules"],"reporter":["lcov","text-summary"]},"repository":{"type":"git","url":"https://github.com/ajv-validator/ajv.git"},"keywords":["JSON","schema","validator","validation","jsonschema","json-schema","json-schema-validator","json-schema-validation"],"author":"Evgeny Poberezkin","license":"MIT","bugs":{"url":"https://github.com/ajv-validator/ajv/issues"},"homepage":"https://github.com/ajv-validator/ajv","tonicExampleFilename":".tonic_example.js","dependencies":{"fast-deep-equal":"^3.1.1","fast-json-stable-stringify":"^2.0.0","json-schema-traverse":"^0.4.1","uri-js":"^4.2.2"},"devDependencies":{"ajv-async":"^1.0.0","bluebird":"^3.5.3","brfs":"^2.0.0","browserify":"^16.2.0","chai":"^4.0.1","coveralls":"^3.0.1","del-cli":"^3.0.0","dot":"^1.0.3","eslint":"^7.3.1","gh-pages-generator":"^0.2.3","glob":"^7.0.0","if-node-version":"^1.0.0","js-beautify":"^1.7.3","jshint":"^2.10.2","json-schema-test":"^2.0.0","karma":"^5.0.0","karma-chrome-launcher":"^3.0.0","karma-mocha":"^2.0.0","karma-sauce-launcher":"^4.1.3","mocha":"^8.0.1","nyc":"^15.0.0","pre-commit":"^1.1.1","require-globify":"^1.3.0","typescript":"^3.9.5","uglify-js":"^3.6.9","watch":"^1.0.0"},"collective":{"type":"opencollective","url":"https://opencollective.com/ajv"},"funding":{"type":"github","url":"https://github.com/sponsors/epoberezkin"},"_lastModified":"2026-11-21T09:53:42.942Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"zod","version":"3.25.76","type":"module","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts"],"funding":"https://github.com/sponsors/colinhacks","homepage":"https://zod.dev","keywords":["typescript","schema","validation","type","inference"],"license":"MIT","sideEffects":false,"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"sourceDialects":["@zod/source"]},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","bump:beta":"pnpm version \"v$(pnpm pkg get version | jq -r)-beta.$(date +%Y%m%dT%H%M%S)\"","pub:beta":"pnpm bump:beta && pnpm publish --tag next --publish-branch v4 --no-git-checks --dry-run"},"_lastModified":"2026-11-
|
|
1
|
+
{"name":"zod","version":"3.25.76","type":"module","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts"],"funding":"https://github.com/sponsors/colinhacks","homepage":"https://zod.dev","keywords":["typescript","schema","validation","type","inference"],"license":"MIT","sideEffects":false,"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"sourceDialects":["@zod/source"]},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","bump:beta":"pnpm version \"v$(pnpm pkg get version | jq -r)-beta.$(date +%Y%m%dT%H%M%S)\"","pub:beta":"pnpm bump:beta && pnpm publish --tag next --publish-branch v4 --no-git-checks --dry-run"},"_lastModified":"2026-11-21T09:53:41.997Z"}
|
package/dist/server/plugin.js
CHANGED
|
@@ -83,6 +83,7 @@ var import_RoutingBindingRepository = require("./services/RoutingBindingReposito
|
|
|
83
83
|
var import_HierarchyEnrollmentGuard = require("./services/HierarchyEnrollmentGuard");
|
|
84
84
|
var import_HierarchyRequestCancellation = require("./services/HierarchyRequestCancellation");
|
|
85
85
|
var import_ParallelInterruptActionsPatch = require("./services/ParallelInterruptActionsPatch");
|
|
86
|
+
var import_normalize_hierarchy_invocation_index = require("./utils/normalize-hierarchy-invocation-index");
|
|
86
87
|
function normalizeOptionalString(value) {
|
|
87
88
|
return typeof value === "string" ? value.trim() : "";
|
|
88
89
|
}
|
|
@@ -220,7 +221,7 @@ class PluginAgentOrchestratorServer extends import_server.Plugin {
|
|
|
220
221
|
}
|
|
221
222
|
async beforeLoad() {
|
|
222
223
|
this.db.registerRepositories({ RoutingBindingRepository: import_RoutingBindingRepository.RoutingBindingRepository });
|
|
223
|
-
this.db.import({ directory: import_path.default.resolve(__dirname, "collections") });
|
|
224
|
+
await this.db.import({ directory: import_path.default.resolve(__dirname, "collections") });
|
|
224
225
|
this.db.addMigrations({
|
|
225
226
|
namespace: this.name,
|
|
226
227
|
directory: import_path.default.resolve(__dirname, "migrations"),
|
|
@@ -229,6 +230,7 @@ class PluginAgentOrchestratorServer extends import_server.Plugin {
|
|
|
229
230
|
}
|
|
230
231
|
async load() {
|
|
231
232
|
var _a, _b, _c, _d;
|
|
233
|
+
(0, import_normalize_hierarchy_invocation_index.normalizeHierarchyInvocationIndex)(this.db);
|
|
232
234
|
await this.skillHub.load();
|
|
233
235
|
this.app.acl.registerSnippet({
|
|
234
236
|
name: `pm.${this.name}`,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var normalize_hierarchy_invocation_index_exports = {};
|
|
28
|
+
__export(normalize_hierarchy_invocation_index_exports, {
|
|
29
|
+
normalizeHierarchyInvocationIndex: () => normalizeHierarchyInvocationIndex
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(normalize_hierarchy_invocation_index_exports);
|
|
32
|
+
function normalizeHierarchyInvocationIndex(database) {
|
|
33
|
+
var _a;
|
|
34
|
+
if (!database.inDialect("postgres")) return;
|
|
35
|
+
const collection = database.getCollection("agentHierarchyInvocations");
|
|
36
|
+
const parentSessionField = collection.underscored ? "parent_session_id" : "parentSessionId";
|
|
37
|
+
const parentToolCallField = collection.underscored ? "parent_tool_call_id" : "parentToolCallId";
|
|
38
|
+
const index = (_a = collection.model.options.indexes) == null ? void 0 : _a.find(
|
|
39
|
+
(item) => {
|
|
40
|
+
var _a2;
|
|
41
|
+
return item.unique && ((_a2 = item.fields) == null ? void 0 : _a2.length) === 2 && item.fields[0] === parentSessionField && item.fields[1] === parentToolCallField;
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
if (!(index == null ? void 0 : index.name) || Buffer.byteLength(index.name, "utf8") <= 63) return;
|
|
45
|
+
let name = "";
|
|
46
|
+
for (const character of index.name) {
|
|
47
|
+
if (Buffer.byteLength(name + character, "utf8") > 63) break;
|
|
48
|
+
name += character;
|
|
49
|
+
}
|
|
50
|
+
index.name = name;
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
normalizeHierarchyInvocationIndex
|
|
55
|
+
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "代理协调器",
|
|
5
5
|
"displayName.vi-VN": "Điều phối Agent",
|
|
6
6
|
"description": "Native AI Employee sub-agent monitoring, policy, and memory context layer for NocoBase plugin-ai.",
|
|
7
|
-
"version": "1.2.
|
|
7
|
+
"version": "1.2.3",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"keywords": [
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"url": "git+https://github.com/OrgGem/nocobase-beta.git",
|
|
59
59
|
"directory": "packages/plugins/plugin-agent-orchestrator"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "168268aa4657eefd6c5632f6b5e5f51c2881df91",
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public",
|
|
64
64
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createMockServer, type MockServer } from '@nocobase/test';
|
|
11
|
+
import { QueryTypes } from 'sequelize';
|
|
11
12
|
import { beforeAll, afterAll, describe, expect, it } from 'vitest';
|
|
12
13
|
import { PluginAgentOrchestratorServer } from '../plugin';
|
|
13
14
|
import {
|
|
@@ -17,6 +18,22 @@ import {
|
|
|
17
18
|
} from '../services/HierarchyInvocationJournal';
|
|
18
19
|
|
|
19
20
|
const suffix = `${process.pid}-${Date.now()}`;
|
|
21
|
+
const pluginOptions = {
|
|
22
|
+
name: 'plugin-agent-orchestrator',
|
|
23
|
+
packageName: 'plugin-agent-orchestrator',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type DatabaseIndex = {
|
|
27
|
+
name?: string;
|
|
28
|
+
unique?: boolean;
|
|
29
|
+
fields?: Array<string | { attribute?: string; name?: string }>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function indexFieldNames(index: DatabaseIndex) {
|
|
33
|
+
return (index.fields || [])
|
|
34
|
+
.map((field) => (typeof field === 'string' ? field : field.attribute || field.name || ''))
|
|
35
|
+
.join(',');
|
|
36
|
+
}
|
|
20
37
|
|
|
21
38
|
function invocation(overrides: Partial<ReserveHierarchyInvocation> = {}): ReserveHierarchyInvocation {
|
|
22
39
|
return {
|
|
@@ -54,7 +71,7 @@ describe('hierarchy invocation journal persistence', () => {
|
|
|
54
71
|
|
|
55
72
|
beforeAll(async () => {
|
|
56
73
|
app = await createMockServer({
|
|
57
|
-
plugins: ['nocobase', PluginAgentOrchestratorServer],
|
|
74
|
+
plugins: ['nocobase', [PluginAgentOrchestratorServer, pluginOptions]],
|
|
58
75
|
name: `hierarchy-invocation-journal-${suffix}`,
|
|
59
76
|
skipSupervisor: true,
|
|
60
77
|
});
|
|
@@ -65,6 +82,53 @@ describe('hierarchy invocation journal persistence', () => {
|
|
|
65
82
|
await app?.destroy();
|
|
66
83
|
});
|
|
67
84
|
|
|
85
|
+
it('keeps the persisted hierarchy unique index stable through repeated model syncs', async () => {
|
|
86
|
+
const collection = app.db.getCollection('agentHierarchyInvocations');
|
|
87
|
+
const fieldNames = collection.underscored
|
|
88
|
+
? 'parent_session_id,parent_tool_call_id'
|
|
89
|
+
: 'parentSessionId,parentToolCallId';
|
|
90
|
+
const configuredIndex = collection.model.options.indexes?.find(
|
|
91
|
+
(index) => index.unique && indexFieldNames(index as DatabaseIndex) === fieldNames,
|
|
92
|
+
);
|
|
93
|
+
const readIndexOid = async () => {
|
|
94
|
+
const rows = await app.db.sequelize.query<{ index_oid: string }>(
|
|
95
|
+
`SELECT c.oid::text AS index_oid
|
|
96
|
+
FROM pg_class AS c
|
|
97
|
+
JOIN pg_namespace AS n ON n.oid = c.relnamespace
|
|
98
|
+
JOIN pg_index AS i ON i.indexrelid = c.oid
|
|
99
|
+
WHERE n.nspname = ? AND c.relname = ?`,
|
|
100
|
+
{
|
|
101
|
+
replacements: [collection.collectionSchema() || 'public', configuredIndex?.name],
|
|
102
|
+
type: QueryTypes.SELECT,
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
return rows[0]?.index_oid;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
expect(configuredIndex).toBeTruthy();
|
|
109
|
+
let initialIndexOid: string | undefined;
|
|
110
|
+
if (app.db.inDialect('postgres')) {
|
|
111
|
+
expect(Buffer.byteLength(configuredIndex?.name || '', 'utf8')).toBeLessThanOrEqual(63);
|
|
112
|
+
initialIndexOid = await readIndexOid();
|
|
113
|
+
expect(initialIndexOid).toBeTruthy();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await collection.sync();
|
|
117
|
+
await collection.sync();
|
|
118
|
+
|
|
119
|
+
if (app.db.inDialect('postgres')) {
|
|
120
|
+
expect(await readIndexOid()).toBe(initialIndexOid);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const indexes = (await app.db.sequelize
|
|
124
|
+
.getQueryInterface()
|
|
125
|
+
.showIndex(collection.getTableNameWithSchema())) as DatabaseIndex[];
|
|
126
|
+
const matchingIndexes = indexes.filter((index) => index.unique && indexFieldNames(index) === fieldNames);
|
|
127
|
+
|
|
128
|
+
expect(matchingIndexes).toHaveLength(1);
|
|
129
|
+
expect(matchingIndexes[0].name).toBe(configuredIndex?.name);
|
|
130
|
+
});
|
|
131
|
+
|
|
68
132
|
it('reserves one owner-scoped idempotency key and rejects conflicting reuse', async () => {
|
|
69
133
|
const input = invocation();
|
|
70
134
|
const first = await journal.reserve(input);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
import type { Database } from '@nocobase/database';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { normalizeHierarchyInvocationIndex } from '../utils/normalize-hierarchy-invocation-index';
|
|
6
|
+
|
|
7
|
+
type TestIndex = {
|
|
8
|
+
name: string;
|
|
9
|
+
unique: boolean;
|
|
10
|
+
fields: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type TestCollection = {
|
|
14
|
+
underscored: boolean;
|
|
15
|
+
model: {
|
|
16
|
+
options: { indexes: TestIndex[] };
|
|
17
|
+
_indexes: TestIndex[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function createDatabase(collection: TestCollection, dialect = 'postgres') {
|
|
22
|
+
return {
|
|
23
|
+
inDialect: (value: string) => value === dialect,
|
|
24
|
+
getCollection: () => collection,
|
|
25
|
+
} as unknown as Database;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function createCollection(name: string, fields: string[], underscored = false): TestCollection {
|
|
29
|
+
const index = { name, unique: true, fields };
|
|
30
|
+
return {
|
|
31
|
+
underscored,
|
|
32
|
+
model: {
|
|
33
|
+
options: { indexes: [index] },
|
|
34
|
+
_indexes: [index],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
describe('hierarchy invocation PostgreSQL index naming', () => {
|
|
40
|
+
it('keeps the stored 63-byte name on both Sequelize index lists', () => {
|
|
41
|
+
const fullName = 'agent_hierarchy_invocations_parent_session_id_parent_tool_call_id';
|
|
42
|
+
const collection = createCollection(fullName, ['parentSessionId', 'parentToolCallId']);
|
|
43
|
+
|
|
44
|
+
normalizeHierarchyInvocationIndex(createDatabase(collection));
|
|
45
|
+
|
|
46
|
+
const storedName = fullName.slice(0, 63);
|
|
47
|
+
expect(Buffer.byteLength(storedName, 'utf8')).toBe(63);
|
|
48
|
+
expect(collection.model.options.indexes[0].name).toBe(storedName);
|
|
49
|
+
expect(collection.model._indexes[0].name).toBe(storedName);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('recognizes underscored fields and preserves a table prefix within the PostgreSQL limit', () => {
|
|
53
|
+
const fullName = 'tenant_123456_agent_hierarchy_invocations_parent_session_id_parent_tool_call_id';
|
|
54
|
+
const collection = createCollection(fullName, ['parent_session_id', 'parent_tool_call_id'], true);
|
|
55
|
+
|
|
56
|
+
normalizeHierarchyInvocationIndex(createDatabase(collection));
|
|
57
|
+
|
|
58
|
+
const storedName = collection.model.options.indexes[0].name;
|
|
59
|
+
expect(storedName).toBe(fullName.slice(0, 63));
|
|
60
|
+
expect(storedName.startsWith('tenant_123456_')).toBe(true);
|
|
61
|
+
expect(Buffer.byteLength(storedName, 'utf8')).toBe(63);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('leaves other database dialects unchanged', () => {
|
|
65
|
+
const fullName = 'agent_hierarchy_invocations_parent_session_id_parent_tool_call_id';
|
|
66
|
+
const collection = createCollection(fullName, ['parentSessionId', 'parentToolCallId']);
|
|
67
|
+
|
|
68
|
+
normalizeHierarchyInvocationIndex(createDatabase(collection, 'sqlite'));
|
|
69
|
+
|
|
70
|
+
expect(collection.model.options.indexes[0].name).toBe(fullName);
|
|
71
|
+
});
|
|
72
|
+
});
|
package/src/server/plugin.ts
CHANGED
|
@@ -44,6 +44,7 @@ import { initializeRoutingGraphLock, RoutingBindingRepository } from './services
|
|
|
44
44
|
import { guardHierarchyEnrollment, guardManagedChildActions } from './services/HierarchyEnrollmentGuard';
|
|
45
45
|
import { HierarchyRequestCancellation } from './services/HierarchyRequestCancellation';
|
|
46
46
|
import { installParallelInterruptActionsPatch } from './services/ParallelInterruptActionsPatch';
|
|
47
|
+
import { normalizeHierarchyInvocationIndex } from './utils/normalize-hierarchy-invocation-index';
|
|
47
48
|
|
|
48
49
|
function normalizeOptionalString(value: unknown) {
|
|
49
50
|
return typeof value === 'string' ? value.trim() : '';
|
|
@@ -202,7 +203,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
|
|
|
202
203
|
async beforeLoad() {
|
|
203
204
|
this.db.registerRepositories({ RoutingBindingRepository });
|
|
204
205
|
// Import collection definitions
|
|
205
|
-
this.db.import({ directory: path.resolve(__dirname, 'collections') });
|
|
206
|
+
await this.db.import({ directory: path.resolve(__dirname, 'collections') });
|
|
206
207
|
|
|
207
208
|
this.db.addMigrations({
|
|
208
209
|
namespace: this.name,
|
|
@@ -212,6 +213,7 @@ export class PluginAgentOrchestratorServer extends Plugin {
|
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
async load() {
|
|
216
|
+
normalizeHierarchyInvocationIndex(this.db);
|
|
215
217
|
await this.skillHub.load();
|
|
216
218
|
|
|
217
219
|
// --- ACL ---
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
import type { Database } from '@nocobase/database';
|
|
4
|
+
|
|
5
|
+
export function normalizeHierarchyInvocationIndex(database: Database) {
|
|
6
|
+
if (!database.inDialect('postgres')) return;
|
|
7
|
+
|
|
8
|
+
const collection = database.getCollection('agentHierarchyInvocations');
|
|
9
|
+
const parentSessionField = collection.underscored ? 'parent_session_id' : 'parentSessionId';
|
|
10
|
+
const parentToolCallField = collection.underscored ? 'parent_tool_call_id' : 'parentToolCallId';
|
|
11
|
+
const index = collection.model.options.indexes?.find(
|
|
12
|
+
(item) =>
|
|
13
|
+
item.unique &&
|
|
14
|
+
item.fields?.length === 2 &&
|
|
15
|
+
item.fields[0] === parentSessionField &&
|
|
16
|
+
item.fields[1] === parentToolCallField,
|
|
17
|
+
);
|
|
18
|
+
if (!index?.name || Buffer.byteLength(index.name, 'utf8') <= 63) return;
|
|
19
|
+
|
|
20
|
+
// Sequelize 6 reuses these index option objects during sync. Match PostgreSQL's stored name, including the table prefix.
|
|
21
|
+
let name = '';
|
|
22
|
+
for (const character of index.name) {
|
|
23
|
+
if (Buffer.byteLength(name + character, 'utf8') > 63) break;
|
|
24
|
+
name += character;
|
|
25
|
+
}
|
|
26
|
+
index.name = name;
|
|
27
|
+
}
|