@elevasis/sdk 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +2325 -124
- package/dist/index.d.ts +410 -473
- package/dist/index.js +96 -44
- package/dist/node/index.d.ts +69 -0
- package/dist/node/index.js +273 -0
- package/dist/test-utils/index.d.ts +473 -466
- package/dist/types/worker/platform.d.ts +2 -9
- package/package.json +12 -3
- package/reference/_navigation.md +23 -1
- package/reference/_reference-manifest.json +98 -0
- package/reference/claude-config/rules/agent-start-here.md +13 -0
- package/reference/claude-config/rules/organization-model.md +40 -40
- package/reference/claude-config/rules/organization-os.md +16 -16
- package/reference/claude-config/rules/vibe.md +13 -13
- package/reference/claude-config/skills/knowledge/SKILL.md +253 -0
- package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-a.md +100 -100
- package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-b.md +158 -158
- package/reference/claude-config/skills/knowledge/operations/customers.md +109 -0
- package/reference/claude-config/skills/knowledge/operations/features.md +113 -0
- package/reference/claude-config/skills/knowledge/operations/goals.md +118 -0
- package/reference/claude-config/skills/knowledge/operations/identity.md +93 -0
- package/reference/claude-config/skills/knowledge/operations/labels.md +89 -0
- package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -0
- package/reference/claude-config/skills/knowledge/operations/roles.md +99 -0
- package/reference/claude-config/skills/knowledge/operations/techStack.md +102 -0
- package/reference/claude-config/skills/run-ui/SKILL.md +73 -0
- package/reference/claude-config/skills/setup/SKILL.md +270 -270
- package/reference/claude-config/skills/tutorial/SKILL.md +249 -0
- package/reference/claude-config/skills/tutorial/progress-template.md +74 -0
- package/reference/claude-config/skills/tutorial/technical.md +1309 -0
- package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -0
- package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -0
- package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -0
- package/reference/deployment/index.mdx +5 -5
- package/reference/examples/organization-model.ts +40 -0
- package/reference/framework/index.mdx +1 -1
- package/reference/framework/tutorial-system.mdx +86 -173
- package/reference/packages/core/src/knowledge/README.md +32 -0
- package/reference/packages/ui/src/knowledge/README.md +31 -0
- package/reference/packages/ui/src/theme/presets/README.md +19 -0
- package/reference/scaffold/core/organization-model.mdx +1 -1
- package/reference/scaffold/recipes/add-a-feature.md +1 -1
- package/reference/scaffold/recipes/customize-crm-actions.md +433 -433
- package/reference/scaffold/recipes/customize-organization-model.md +3 -3
- package/reference/scaffold/recipes/extend-lead-gen.md +90 -55
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +1 -1
- package/reference/scaffold/recipes/index.md +6 -0
- package/reference/scaffold/reference/contracts.md +1265 -1154
- package/reference/scaffold/reference/feature-registry.md +2 -1
- package/reference/scaffold/ui/composition-extensibility.mdx +17 -0
- package/reference/claude-config/skills/configure/SKILL.md +0 -98
- package/reference/claude-config/skills/configure/operations/customers.md +0 -150
- package/reference/claude-config/skills/configure/operations/features.md +0 -162
- package/reference/claude-config/skills/configure/operations/goals.md +0 -147
- package/reference/claude-config/skills/configure/operations/identity.md +0 -133
- package/reference/claude-config/skills/configure/operations/labels.md +0 -128
- package/reference/claude-config/skills/configure/operations/offerings.md +0 -159
- package/reference/claude-config/skills/configure/operations/roles.md +0 -153
- package/reference/claude-config/skills/configure/operations/techStack.md +0 -139
package/dist/cli.cjs
CHANGED
|
@@ -289,8 +289,8 @@ var require_main = __commonJS({
|
|
|
289
289
|
const shortPaths = [];
|
|
290
290
|
for (const filePath of optionPaths) {
|
|
291
291
|
try {
|
|
292
|
-
const
|
|
293
|
-
shortPaths.push(
|
|
292
|
+
const relative2 = path3.relative(process.cwd(), filePath);
|
|
293
|
+
shortPaths.push(relative2);
|
|
294
294
|
} catch (e) {
|
|
295
295
|
if (debug) {
|
|
296
296
|
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
@@ -5246,7 +5246,7 @@ var require_buffer_list = __commonJS({
|
|
|
5246
5246
|
}
|
|
5247
5247
|
}, {
|
|
5248
5248
|
key: "join",
|
|
5249
|
-
value: function
|
|
5249
|
+
value: function join6(s) {
|
|
5250
5250
|
if (this.length === 0) return "";
|
|
5251
5251
|
var p = this.head;
|
|
5252
5252
|
var ret = "" + p.data;
|
|
@@ -6623,14 +6623,14 @@ var require_async_iterator = __commonJS({
|
|
|
6623
6623
|
};
|
|
6624
6624
|
}
|
|
6625
6625
|
function readAndResolve(iter) {
|
|
6626
|
-
var
|
|
6627
|
-
if (
|
|
6626
|
+
var resolve5 = iter[kLastResolve];
|
|
6627
|
+
if (resolve5 !== null) {
|
|
6628
6628
|
var data = iter[kStream].read();
|
|
6629
6629
|
if (data !== null) {
|
|
6630
6630
|
iter[kLastPromise] = null;
|
|
6631
6631
|
iter[kLastResolve] = null;
|
|
6632
6632
|
iter[kLastReject] = null;
|
|
6633
|
-
|
|
6633
|
+
resolve5(createIterResult(data, false));
|
|
6634
6634
|
}
|
|
6635
6635
|
}
|
|
6636
6636
|
}
|
|
@@ -6638,13 +6638,13 @@ var require_async_iterator = __commonJS({
|
|
|
6638
6638
|
process.nextTick(readAndResolve, iter);
|
|
6639
6639
|
}
|
|
6640
6640
|
function wrapForNext(lastPromise, iter) {
|
|
6641
|
-
return function(
|
|
6641
|
+
return function(resolve5, reject) {
|
|
6642
6642
|
lastPromise.then(function() {
|
|
6643
6643
|
if (iter[kEnded]) {
|
|
6644
|
-
|
|
6644
|
+
resolve5(createIterResult(void 0, true));
|
|
6645
6645
|
return;
|
|
6646
6646
|
}
|
|
6647
|
-
iter[kHandlePromise](
|
|
6647
|
+
iter[kHandlePromise](resolve5, reject);
|
|
6648
6648
|
}, reject);
|
|
6649
6649
|
};
|
|
6650
6650
|
}
|
|
@@ -6664,12 +6664,12 @@ var require_async_iterator = __commonJS({
|
|
|
6664
6664
|
return Promise.resolve(createIterResult(void 0, true));
|
|
6665
6665
|
}
|
|
6666
6666
|
if (this[kStream].destroyed) {
|
|
6667
|
-
return new Promise(function(
|
|
6667
|
+
return new Promise(function(resolve5, reject) {
|
|
6668
6668
|
process.nextTick(function() {
|
|
6669
6669
|
if (_this[kError]) {
|
|
6670
6670
|
reject(_this[kError]);
|
|
6671
6671
|
} else {
|
|
6672
|
-
|
|
6672
|
+
resolve5(createIterResult(void 0, true));
|
|
6673
6673
|
}
|
|
6674
6674
|
});
|
|
6675
6675
|
});
|
|
@@ -6692,13 +6692,13 @@ var require_async_iterator = __commonJS({
|
|
|
6692
6692
|
return this;
|
|
6693
6693
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
6694
6694
|
var _this2 = this;
|
|
6695
|
-
return new Promise(function(
|
|
6695
|
+
return new Promise(function(resolve5, reject) {
|
|
6696
6696
|
_this2[kStream].destroy(null, function(err) {
|
|
6697
6697
|
if (err) {
|
|
6698
6698
|
reject(err);
|
|
6699
6699
|
return;
|
|
6700
6700
|
}
|
|
6701
|
-
|
|
6701
|
+
resolve5(createIterResult(void 0, true));
|
|
6702
6702
|
});
|
|
6703
6703
|
});
|
|
6704
6704
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -6720,15 +6720,15 @@ var require_async_iterator = __commonJS({
|
|
|
6720
6720
|
value: stream._readableState.endEmitted,
|
|
6721
6721
|
writable: true
|
|
6722
6722
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
6723
|
-
value: function value(
|
|
6723
|
+
value: function value(resolve5, reject) {
|
|
6724
6724
|
var data = iterator[kStream].read();
|
|
6725
6725
|
if (data) {
|
|
6726
6726
|
iterator[kLastPromise] = null;
|
|
6727
6727
|
iterator[kLastResolve] = null;
|
|
6728
6728
|
iterator[kLastReject] = null;
|
|
6729
|
-
|
|
6729
|
+
resolve5(createIterResult(data, false));
|
|
6730
6730
|
} else {
|
|
6731
|
-
iterator[kLastResolve] =
|
|
6731
|
+
iterator[kLastResolve] = resolve5;
|
|
6732
6732
|
iterator[kLastReject] = reject;
|
|
6733
6733
|
}
|
|
6734
6734
|
},
|
|
@@ -6747,12 +6747,12 @@ var require_async_iterator = __commonJS({
|
|
|
6747
6747
|
iterator[kError] = err;
|
|
6748
6748
|
return;
|
|
6749
6749
|
}
|
|
6750
|
-
var
|
|
6751
|
-
if (
|
|
6750
|
+
var resolve5 = iterator[kLastResolve];
|
|
6751
|
+
if (resolve5 !== null) {
|
|
6752
6752
|
iterator[kLastPromise] = null;
|
|
6753
6753
|
iterator[kLastResolve] = null;
|
|
6754
6754
|
iterator[kLastReject] = null;
|
|
6755
|
-
|
|
6755
|
+
resolve5(createIterResult(void 0, true));
|
|
6756
6756
|
}
|
|
6757
6757
|
iterator[kEnded] = true;
|
|
6758
6758
|
});
|
|
@@ -6767,7 +6767,7 @@ var require_async_iterator = __commonJS({
|
|
|
6767
6767
|
var require_from = __commonJS({
|
|
6768
6768
|
"../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
|
|
6769
6769
|
"use strict";
|
|
6770
|
-
function asyncGeneratorStep(gen,
|
|
6770
|
+
function asyncGeneratorStep(gen, resolve5, reject, _next, _throw, key, arg) {
|
|
6771
6771
|
try {
|
|
6772
6772
|
var info = gen[key](arg);
|
|
6773
6773
|
var value = info.value;
|
|
@@ -6776,7 +6776,7 @@ var require_from = __commonJS({
|
|
|
6776
6776
|
return;
|
|
6777
6777
|
}
|
|
6778
6778
|
if (info.done) {
|
|
6779
|
-
|
|
6779
|
+
resolve5(value);
|
|
6780
6780
|
} else {
|
|
6781
6781
|
Promise.resolve(value).then(_next, _throw);
|
|
6782
6782
|
}
|
|
@@ -6784,13 +6784,13 @@ var require_from = __commonJS({
|
|
|
6784
6784
|
function _asyncToGenerator(fn) {
|
|
6785
6785
|
return function() {
|
|
6786
6786
|
var self2 = this, args = arguments;
|
|
6787
|
-
return new Promise(function(
|
|
6787
|
+
return new Promise(function(resolve5, reject) {
|
|
6788
6788
|
var gen = fn.apply(self2, args);
|
|
6789
6789
|
function _next(value) {
|
|
6790
|
-
asyncGeneratorStep(gen,
|
|
6790
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "next", value);
|
|
6791
6791
|
}
|
|
6792
6792
|
function _throw(err) {
|
|
6793
|
-
asyncGeneratorStep(gen,
|
|
6793
|
+
asyncGeneratorStep(gen, resolve5, reject, _next, _throw, "throw", err);
|
|
6794
6794
|
}
|
|
6795
6795
|
_next(void 0);
|
|
6796
6796
|
});
|
|
@@ -23012,8 +23012,8 @@ __export(index_exports, {
|
|
|
23012
23012
|
});
|
|
23013
23013
|
module.exports = __toCommonJS(index_exports);
|
|
23014
23014
|
var import_dotenv = __toESM(require_main(), 1);
|
|
23015
|
-
var
|
|
23016
|
-
var
|
|
23015
|
+
var import_fs4 = require("fs");
|
|
23016
|
+
var import_path4 = require("path");
|
|
23017
23017
|
|
|
23018
23018
|
// ../../node_modules/.pnpm/commander@11.1.0/node_modules/commander/esm.mjs
|
|
23019
23019
|
var import_index = __toESM(require_commander(), 1);
|
|
@@ -24039,6 +24039,7 @@ function ora(options) {
|
|
|
24039
24039
|
// src/cli/commands/deploy.ts
|
|
24040
24040
|
var import_path2 = require("path");
|
|
24041
24041
|
var import_promises = require("fs/promises");
|
|
24042
|
+
var import_fs2 = require("fs");
|
|
24042
24043
|
|
|
24043
24044
|
// ../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/external.js
|
|
24044
24045
|
var external_exports = {};
|
|
@@ -36610,6 +36611,1145 @@ var DateRangeSchema = external_exports.object({
|
|
|
36610
36611
|
endDate: external_exports.string().datetime()
|
|
36611
36612
|
});
|
|
36612
36613
|
|
|
36614
|
+
// ../core/src/organization-model/icons.ts
|
|
36615
|
+
var ORGANIZATION_MODEL_ICON_TOKENS = [
|
|
36616
|
+
"nav.dashboard",
|
|
36617
|
+
"nav.sales",
|
|
36618
|
+
"nav.crm",
|
|
36619
|
+
"nav.lead-gen",
|
|
36620
|
+
"nav.projects",
|
|
36621
|
+
"nav.operations",
|
|
36622
|
+
"nav.monitoring",
|
|
36623
|
+
"nav.knowledge",
|
|
36624
|
+
"nav.settings",
|
|
36625
|
+
"nav.admin",
|
|
36626
|
+
"nav.archive",
|
|
36627
|
+
"knowledge.playbook",
|
|
36628
|
+
"knowledge.strategy",
|
|
36629
|
+
"knowledge.reference",
|
|
36630
|
+
"feature.dashboard",
|
|
36631
|
+
"feature.sales",
|
|
36632
|
+
"feature.crm",
|
|
36633
|
+
"feature.finance",
|
|
36634
|
+
"feature.lead-gen",
|
|
36635
|
+
"feature.platform",
|
|
36636
|
+
"feature.projects",
|
|
36637
|
+
"feature.operations",
|
|
36638
|
+
"feature.knowledge",
|
|
36639
|
+
"feature.monitoring",
|
|
36640
|
+
"feature.settings",
|
|
36641
|
+
"feature.admin",
|
|
36642
|
+
"feature.archive",
|
|
36643
|
+
"feature.seo",
|
|
36644
|
+
"resource.agent",
|
|
36645
|
+
"resource.workflow",
|
|
36646
|
+
"resource.integration",
|
|
36647
|
+
"resource.database",
|
|
36648
|
+
"resource.user",
|
|
36649
|
+
"resource.team",
|
|
36650
|
+
"integration.gmail",
|
|
36651
|
+
"integration.google-sheets",
|
|
36652
|
+
"integration.attio",
|
|
36653
|
+
"surface.dashboard",
|
|
36654
|
+
"surface.overview",
|
|
36655
|
+
"surface.command-view",
|
|
36656
|
+
"surface.command-queue",
|
|
36657
|
+
"surface.pipeline",
|
|
36658
|
+
"surface.lists",
|
|
36659
|
+
"surface.resources",
|
|
36660
|
+
"surface.settings",
|
|
36661
|
+
"status.success",
|
|
36662
|
+
"status.error",
|
|
36663
|
+
"status.warning",
|
|
36664
|
+
"status.info",
|
|
36665
|
+
"status.pending",
|
|
36666
|
+
"action.approve",
|
|
36667
|
+
"action.reject",
|
|
36668
|
+
"action.retry",
|
|
36669
|
+
"action.edit",
|
|
36670
|
+
"action.view",
|
|
36671
|
+
"action.launch",
|
|
36672
|
+
"action.message",
|
|
36673
|
+
"action.escalate",
|
|
36674
|
+
"action.promote",
|
|
36675
|
+
"action.submit",
|
|
36676
|
+
"action.email"
|
|
36677
|
+
];
|
|
36678
|
+
var CustomIconTokenSchema = external_exports.string().trim().max(80).regex(/^custom\.[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "Custom icon tokens must start with custom.");
|
|
36679
|
+
var OrganizationModelBuiltinIconTokenSchema = external_exports.enum(ORGANIZATION_MODEL_ICON_TOKENS);
|
|
36680
|
+
var OrganizationModelIconTokenSchema = external_exports.union([
|
|
36681
|
+
OrganizationModelBuiltinIconTokenSchema,
|
|
36682
|
+
CustomIconTokenSchema
|
|
36683
|
+
]);
|
|
36684
|
+
|
|
36685
|
+
// ../core/src/organization-model/domains/shared.ts
|
|
36686
|
+
var ModelIdSchema = external_exports.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
|
|
36687
|
+
var LabelSchema = external_exports.string().trim().min(1).max(120);
|
|
36688
|
+
var DescriptionSchema = external_exports.string().trim().min(1).max(2e3);
|
|
36689
|
+
var ColorTokenSchema = external_exports.string().trim().min(1).max(50);
|
|
36690
|
+
var IconNameSchema = OrganizationModelIconTokenSchema;
|
|
36691
|
+
var PathSchema = external_exports.string().trim().startsWith("/").max(300);
|
|
36692
|
+
var ReferenceIdsSchema = external_exports.array(ModelIdSchema).default([]);
|
|
36693
|
+
var DisplayMetadataSchema = external_exports.object({
|
|
36694
|
+
label: LabelSchema,
|
|
36695
|
+
description: DescriptionSchema.optional(),
|
|
36696
|
+
color: ColorTokenSchema.optional(),
|
|
36697
|
+
icon: IconNameSchema.optional()
|
|
36698
|
+
});
|
|
36699
|
+
var TechStackEntrySchema = external_exports.object({
|
|
36700
|
+
/** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
|
|
36701
|
+
platform: external_exports.string().trim().min(1).max(200),
|
|
36702
|
+
/** Free-form description of what this integration is used for. */
|
|
36703
|
+
purpose: external_exports.string().trim().min(1).max(500),
|
|
36704
|
+
/**
|
|
36705
|
+
* Health of the credential backing this integration.
|
|
36706
|
+
* - configured: credential present and valid
|
|
36707
|
+
* - pending: not yet set up
|
|
36708
|
+
* - expired: credential existed but has lapsed
|
|
36709
|
+
* - missing: expected but not present
|
|
36710
|
+
*/
|
|
36711
|
+
credentialStatus: external_exports.enum(["configured", "pending", "expired", "missing"]),
|
|
36712
|
+
/**
|
|
36713
|
+
* Whether this integration is the primary system of record for its domain
|
|
36714
|
+
* (e.g. HubSpot is SoR for contacts). Defaults to false.
|
|
36715
|
+
*/
|
|
36716
|
+
isSystemOfRecord: external_exports.boolean().default(false)
|
|
36717
|
+
});
|
|
36718
|
+
var ResourceMappingSchema = DisplayMetadataSchema.extend({
|
|
36719
|
+
id: ModelIdSchema,
|
|
36720
|
+
resourceId: external_exports.string().trim().min(1).max(255),
|
|
36721
|
+
resourceType: external_exports.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
|
|
36722
|
+
featureIds: ReferenceIdsSchema,
|
|
36723
|
+
entityIds: ReferenceIdsSchema,
|
|
36724
|
+
surfaceIds: ReferenceIdsSchema,
|
|
36725
|
+
capabilityIds: ReferenceIdsSchema,
|
|
36726
|
+
/** Optional tech-stack metadata for external-SaaS integrations. */
|
|
36727
|
+
techStack: TechStackEntrySchema.optional()
|
|
36728
|
+
});
|
|
36729
|
+
|
|
36730
|
+
// ../core/src/organization-model/domains/features.ts
|
|
36731
|
+
var NodeIdPathSchema = external_exports.string().trim().min(1).max(100).regex(/^([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node IDs must be lowercase dotted paths");
|
|
36732
|
+
var NodeIdStringSchema = external_exports.string().trim().min(1).max(200).regex(/^[a-z]+:([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node references must use kind:dotted-path");
|
|
36733
|
+
var UiPositionSchema = external_exports.enum(["sidebar-primary", "sidebar-bottom"]);
|
|
36734
|
+
var FeatureSchema = external_exports.object({
|
|
36735
|
+
id: NodeIdPathSchema,
|
|
36736
|
+
label: LabelSchema,
|
|
36737
|
+
description: DescriptionSchema.optional(),
|
|
36738
|
+
enabled: external_exports.boolean().default(true),
|
|
36739
|
+
path: PathSchema.optional(),
|
|
36740
|
+
icon: IconNameSchema.optional(),
|
|
36741
|
+
color: ColorTokenSchema.optional(),
|
|
36742
|
+
uiPosition: UiPositionSchema.optional(),
|
|
36743
|
+
requiresAdmin: external_exports.boolean().optional(),
|
|
36744
|
+
devOnly: external_exports.boolean().optional()
|
|
36745
|
+
});
|
|
36746
|
+
|
|
36747
|
+
// ../core/src/organization-model/domains/branding.ts
|
|
36748
|
+
var OrganizationModelBrandingSchema = external_exports.object({
|
|
36749
|
+
organizationName: LabelSchema,
|
|
36750
|
+
productName: LabelSchema,
|
|
36751
|
+
shortName: external_exports.string().trim().min(1).max(40),
|
|
36752
|
+
description: DescriptionSchema.optional(),
|
|
36753
|
+
logos: external_exports.object({
|
|
36754
|
+
light: external_exports.string().trim().min(1).max(2048).optional(),
|
|
36755
|
+
dark: external_exports.string().trim().min(1).max(2048).optional()
|
|
36756
|
+
}).default({})
|
|
36757
|
+
});
|
|
36758
|
+
var DEFAULT_ORGANIZATION_MODEL_BRANDING = {
|
|
36759
|
+
organizationName: "Default Organization",
|
|
36760
|
+
productName: "Elevasis",
|
|
36761
|
+
shortName: "Elevasis",
|
|
36762
|
+
logos: {}
|
|
36763
|
+
};
|
|
36764
|
+
|
|
36765
|
+
// ../core/src/organization-model/domains/sales.ts
|
|
36766
|
+
var SalesStageSemanticClassSchema = external_exports.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
|
|
36767
|
+
var SalesStageSchema = DisplayMetadataSchema.extend({
|
|
36768
|
+
id: ModelIdSchema,
|
|
36769
|
+
order: external_exports.number().int().min(0),
|
|
36770
|
+
semanticClass: SalesStageSemanticClassSchema,
|
|
36771
|
+
surfaceIds: ReferenceIdsSchema,
|
|
36772
|
+
resourceIds: ReferenceIdsSchema
|
|
36773
|
+
});
|
|
36774
|
+
var SalesPipelineSchema = external_exports.object({
|
|
36775
|
+
id: ModelIdSchema,
|
|
36776
|
+
label: external_exports.string().trim().min(1).max(120),
|
|
36777
|
+
description: DescriptionSchema.optional(),
|
|
36778
|
+
entityId: ModelIdSchema,
|
|
36779
|
+
stages: external_exports.array(SalesStageSchema).min(1)
|
|
36780
|
+
});
|
|
36781
|
+
var OrganizationModelSalesSchema = external_exports.object({
|
|
36782
|
+
entityId: ModelIdSchema,
|
|
36783
|
+
defaultPipelineId: ModelIdSchema,
|
|
36784
|
+
pipelines: external_exports.array(SalesPipelineSchema).min(1)
|
|
36785
|
+
});
|
|
36786
|
+
var DEFAULT_ORGANIZATION_MODEL_SALES = {
|
|
36787
|
+
entityId: "crm.deal",
|
|
36788
|
+
defaultPipelineId: "default",
|
|
36789
|
+
pipelines: [
|
|
36790
|
+
{
|
|
36791
|
+
id: "default",
|
|
36792
|
+
label: "Default Pipeline",
|
|
36793
|
+
entityId: "crm.deal",
|
|
36794
|
+
stages: [
|
|
36795
|
+
{
|
|
36796
|
+
id: "interested",
|
|
36797
|
+
label: "Interested",
|
|
36798
|
+
color: "blue",
|
|
36799
|
+
order: 1,
|
|
36800
|
+
semanticClass: "open",
|
|
36801
|
+
surfaceIds: ["crm.pipeline"],
|
|
36802
|
+
resourceIds: []
|
|
36803
|
+
},
|
|
36804
|
+
{
|
|
36805
|
+
id: "proposal",
|
|
36806
|
+
label: "Proposal",
|
|
36807
|
+
color: "yellow",
|
|
36808
|
+
order: 2,
|
|
36809
|
+
semanticClass: "active",
|
|
36810
|
+
surfaceIds: ["crm.pipeline"],
|
|
36811
|
+
resourceIds: []
|
|
36812
|
+
},
|
|
36813
|
+
{
|
|
36814
|
+
id: "closing",
|
|
36815
|
+
label: "Closing",
|
|
36816
|
+
color: "lime",
|
|
36817
|
+
order: 3,
|
|
36818
|
+
semanticClass: "active",
|
|
36819
|
+
surfaceIds: ["crm.pipeline"],
|
|
36820
|
+
resourceIds: []
|
|
36821
|
+
},
|
|
36822
|
+
{
|
|
36823
|
+
id: "closed_won",
|
|
36824
|
+
label: "Closed Won",
|
|
36825
|
+
color: "green",
|
|
36826
|
+
order: 4,
|
|
36827
|
+
semanticClass: "closed_won",
|
|
36828
|
+
surfaceIds: ["crm.pipeline"],
|
|
36829
|
+
resourceIds: []
|
|
36830
|
+
},
|
|
36831
|
+
{
|
|
36832
|
+
id: "closed_lost",
|
|
36833
|
+
label: "Closed Lost",
|
|
36834
|
+
color: "red",
|
|
36835
|
+
order: 5,
|
|
36836
|
+
semanticClass: "closed_lost",
|
|
36837
|
+
surfaceIds: ["crm.pipeline"],
|
|
36838
|
+
resourceIds: []
|
|
36839
|
+
},
|
|
36840
|
+
{
|
|
36841
|
+
id: "nurturing",
|
|
36842
|
+
label: "Nurturing",
|
|
36843
|
+
color: "grape",
|
|
36844
|
+
order: 6,
|
|
36845
|
+
semanticClass: "nurturing",
|
|
36846
|
+
surfaceIds: ["crm.pipeline"],
|
|
36847
|
+
resourceIds: []
|
|
36848
|
+
}
|
|
36849
|
+
]
|
|
36850
|
+
}
|
|
36851
|
+
]
|
|
36852
|
+
};
|
|
36853
|
+
|
|
36854
|
+
// ../core/src/organization-model/domains/projects.ts
|
|
36855
|
+
var ProjectsDomainStateSchema = DisplayMetadataSchema.extend({
|
|
36856
|
+
id: ModelIdSchema,
|
|
36857
|
+
order: external_exports.number().int().min(0)
|
|
36858
|
+
});
|
|
36859
|
+
var OrganizationModelProjectsSchema = external_exports.object({
|
|
36860
|
+
projectEntityId: ModelIdSchema,
|
|
36861
|
+
milestoneEntityId: ModelIdSchema,
|
|
36862
|
+
taskEntityId: ModelIdSchema,
|
|
36863
|
+
projectStatuses: external_exports.array(ProjectsDomainStateSchema).min(1),
|
|
36864
|
+
milestoneStatuses: external_exports.array(ProjectsDomainStateSchema).min(1),
|
|
36865
|
+
taskStatuses: external_exports.array(ProjectsDomainStateSchema).min(1)
|
|
36866
|
+
});
|
|
36867
|
+
var DEFAULT_ORGANIZATION_MODEL_PROJECTS = {
|
|
36868
|
+
projectEntityId: "delivery.project",
|
|
36869
|
+
milestoneEntityId: "delivery.milestone",
|
|
36870
|
+
taskEntityId: "delivery.task",
|
|
36871
|
+
projectStatuses: [
|
|
36872
|
+
{ id: "active", label: "Active", order: 1 },
|
|
36873
|
+
{ id: "on_track", label: "On Track", order: 2 },
|
|
36874
|
+
{ id: "at_risk", label: "At Risk", order: 3 },
|
|
36875
|
+
{ id: "blocked", label: "Blocked", order: 4 },
|
|
36876
|
+
{ id: "paused", label: "Paused", order: 5 },
|
|
36877
|
+
{ id: "completed", label: "Completed", order: 6 }
|
|
36878
|
+
],
|
|
36879
|
+
milestoneStatuses: [
|
|
36880
|
+
{ id: "upcoming", label: "Upcoming", order: 1 },
|
|
36881
|
+
{ id: "in_progress", label: "In Progress", order: 2 },
|
|
36882
|
+
{ id: "blocked", label: "Blocked", order: 3 },
|
|
36883
|
+
{ id: "overdue", label: "Overdue", order: 4 },
|
|
36884
|
+
{ id: "completed", label: "Completed", order: 5 }
|
|
36885
|
+
],
|
|
36886
|
+
taskStatuses: [
|
|
36887
|
+
{ id: "planned", label: "Planned", order: 1 },
|
|
36888
|
+
{ id: "in_progress", label: "In Progress", order: 2 },
|
|
36889
|
+
{ id: "blocked", label: "Blocked", order: 3 },
|
|
36890
|
+
{ id: "submitted", label: "Submitted", order: 4 },
|
|
36891
|
+
{ id: "approved", label: "Approved", order: 5 },
|
|
36892
|
+
{ id: "revision_requested", label: "Revision Requested", order: 6 },
|
|
36893
|
+
{ id: "rejected", label: "Rejected", order: 7 },
|
|
36894
|
+
{ id: "cancelled", label: "Cancelled", order: 8 },
|
|
36895
|
+
{ id: "completed", label: "Completed", order: 9 }
|
|
36896
|
+
]
|
|
36897
|
+
};
|
|
36898
|
+
|
|
36899
|
+
// ../core/src/organization-model/domains/prospecting.ts
|
|
36900
|
+
var ProspectingLifecycleStageSchema = DisplayMetadataSchema.extend({
|
|
36901
|
+
id: ModelIdSchema,
|
|
36902
|
+
order: external_exports.number().int().min(0)
|
|
36903
|
+
});
|
|
36904
|
+
var ProspectingBuildTemplateStepSchema = DisplayMetadataSchema.extend({
|
|
36905
|
+
id: ModelIdSchema,
|
|
36906
|
+
primaryEntity: external_exports.enum(["company", "contact"]),
|
|
36907
|
+
outputs: external_exports.array(external_exports.enum(["company", "contact", "export"])).min(1),
|
|
36908
|
+
stageKey: ModelIdSchema,
|
|
36909
|
+
dependsOn: external_exports.array(ModelIdSchema).optional(),
|
|
36910
|
+
dependencyMode: external_exports.literal("per-record-eligibility"),
|
|
36911
|
+
capabilityKey: ModelIdSchema,
|
|
36912
|
+
defaultBatchSize: external_exports.number().int().positive(),
|
|
36913
|
+
maxBatchSize: external_exports.number().int().positive()
|
|
36914
|
+
}).refine((step) => step.defaultBatchSize <= step.maxBatchSize, {
|
|
36915
|
+
message: "defaultBatchSize must be less than or equal to maxBatchSize",
|
|
36916
|
+
path: ["defaultBatchSize"]
|
|
36917
|
+
});
|
|
36918
|
+
var ProspectingBuildTemplateSchema = DisplayMetadataSchema.extend({
|
|
36919
|
+
id: ModelIdSchema,
|
|
36920
|
+
steps: external_exports.array(ProspectingBuildTemplateStepSchema).min(1)
|
|
36921
|
+
});
|
|
36922
|
+
var OrganizationModelProspectingSchema = external_exports.object({
|
|
36923
|
+
listEntityId: ModelIdSchema,
|
|
36924
|
+
companyEntityId: ModelIdSchema,
|
|
36925
|
+
contactEntityId: ModelIdSchema,
|
|
36926
|
+
description: DescriptionSchema.optional(),
|
|
36927
|
+
companyStages: external_exports.array(ProspectingLifecycleStageSchema).min(1),
|
|
36928
|
+
contactStages: external_exports.array(ProspectingLifecycleStageSchema).min(1),
|
|
36929
|
+
defaultBuildTemplateId: ModelIdSchema,
|
|
36930
|
+
buildTemplates: external_exports.array(ProspectingBuildTemplateSchema).min(1)
|
|
36931
|
+
});
|
|
36932
|
+
var DEFAULT_ORGANIZATION_MODEL_PROSPECTING = {
|
|
36933
|
+
listEntityId: "leadgen.list",
|
|
36934
|
+
companyEntityId: "leadgen.company",
|
|
36935
|
+
contactEntityId: "leadgen.contact",
|
|
36936
|
+
companyStages: [
|
|
36937
|
+
{ id: "populated", label: "Populated", order: 1 },
|
|
36938
|
+
{ id: "extracted", label: "Extracted", order: 2 },
|
|
36939
|
+
{ id: "qualified", label: "Qualified", order: 3 }
|
|
36940
|
+
],
|
|
36941
|
+
contactStages: [
|
|
36942
|
+
{ id: "discovered", label: "Discovered", order: 1 },
|
|
36943
|
+
{ id: "verified", label: "Verified", order: 2 },
|
|
36944
|
+
{ id: "personalized", label: "Personalized", order: 3 },
|
|
36945
|
+
{ id: "uploaded", label: "Uploaded", order: 4 }
|
|
36946
|
+
],
|
|
36947
|
+
defaultBuildTemplateId: "local-services",
|
|
36948
|
+
buildTemplates: [
|
|
36949
|
+
{
|
|
36950
|
+
id: "local-services",
|
|
36951
|
+
label: "Local Services Prospecting",
|
|
36952
|
+
description: "Curated local-services list build using company sourcing, website analysis, qualification, contact discovery, verification, personalization, and review.",
|
|
36953
|
+
steps: [
|
|
36954
|
+
{
|
|
36955
|
+
id: "source-companies",
|
|
36956
|
+
label: "Source companies",
|
|
36957
|
+
primaryEntity: "company",
|
|
36958
|
+
outputs: ["company"],
|
|
36959
|
+
stageKey: "populated",
|
|
36960
|
+
dependencyMode: "per-record-eligibility",
|
|
36961
|
+
capabilityKey: "lead-gen.company.source",
|
|
36962
|
+
defaultBatchSize: 100,
|
|
36963
|
+
maxBatchSize: 250
|
|
36964
|
+
},
|
|
36965
|
+
{
|
|
36966
|
+
id: "analyze-websites",
|
|
36967
|
+
label: "Analyze websites",
|
|
36968
|
+
primaryEntity: "company",
|
|
36969
|
+
outputs: ["company"],
|
|
36970
|
+
stageKey: "extracted",
|
|
36971
|
+
dependsOn: ["source-companies"],
|
|
36972
|
+
dependencyMode: "per-record-eligibility",
|
|
36973
|
+
capabilityKey: "lead-gen.company.website-extract",
|
|
36974
|
+
defaultBatchSize: 50,
|
|
36975
|
+
maxBatchSize: 100
|
|
36976
|
+
},
|
|
36977
|
+
{
|
|
36978
|
+
id: "qualify-companies",
|
|
36979
|
+
label: "Qualify companies",
|
|
36980
|
+
primaryEntity: "company",
|
|
36981
|
+
outputs: ["company"],
|
|
36982
|
+
stageKey: "qualified",
|
|
36983
|
+
dependsOn: ["analyze-websites"],
|
|
36984
|
+
dependencyMode: "per-record-eligibility",
|
|
36985
|
+
capabilityKey: "lead-gen.company.qualify",
|
|
36986
|
+
defaultBatchSize: 100,
|
|
36987
|
+
maxBatchSize: 250
|
|
36988
|
+
},
|
|
36989
|
+
{
|
|
36990
|
+
id: "find-contacts",
|
|
36991
|
+
label: "Find contacts",
|
|
36992
|
+
primaryEntity: "contact",
|
|
36993
|
+
outputs: ["contact"],
|
|
36994
|
+
stageKey: "discovered",
|
|
36995
|
+
dependsOn: ["qualify-companies"],
|
|
36996
|
+
dependencyMode: "per-record-eligibility",
|
|
36997
|
+
capabilityKey: "lead-gen.contact.discover",
|
|
36998
|
+
defaultBatchSize: 50,
|
|
36999
|
+
maxBatchSize: 100
|
|
37000
|
+
},
|
|
37001
|
+
{
|
|
37002
|
+
id: "verify-emails",
|
|
37003
|
+
label: "Verify emails",
|
|
37004
|
+
primaryEntity: "contact",
|
|
37005
|
+
outputs: ["contact"],
|
|
37006
|
+
stageKey: "verified",
|
|
37007
|
+
dependsOn: ["find-contacts"],
|
|
37008
|
+
dependencyMode: "per-record-eligibility",
|
|
37009
|
+
capabilityKey: "lead-gen.contact.verify-email",
|
|
37010
|
+
defaultBatchSize: 100,
|
|
37011
|
+
maxBatchSize: 500
|
|
37012
|
+
},
|
|
37013
|
+
{
|
|
37014
|
+
id: "personalize",
|
|
37015
|
+
label: "Personalize",
|
|
37016
|
+
primaryEntity: "contact",
|
|
37017
|
+
outputs: ["contact"],
|
|
37018
|
+
stageKey: "personalized",
|
|
37019
|
+
dependsOn: ["verify-emails"],
|
|
37020
|
+
dependencyMode: "per-record-eligibility",
|
|
37021
|
+
capabilityKey: "lead-gen.contact.personalize",
|
|
37022
|
+
defaultBatchSize: 25,
|
|
37023
|
+
maxBatchSize: 100
|
|
37024
|
+
},
|
|
37025
|
+
{
|
|
37026
|
+
id: "review",
|
|
37027
|
+
label: "Review",
|
|
37028
|
+
primaryEntity: "contact",
|
|
37029
|
+
outputs: ["export"],
|
|
37030
|
+
stageKey: "uploaded",
|
|
37031
|
+
dependsOn: ["personalize"],
|
|
37032
|
+
dependencyMode: "per-record-eligibility",
|
|
37033
|
+
capabilityKey: "lead-gen.review.outreach-ready",
|
|
37034
|
+
defaultBatchSize: 25,
|
|
37035
|
+
maxBatchSize: 100
|
|
37036
|
+
}
|
|
37037
|
+
]
|
|
37038
|
+
},
|
|
37039
|
+
{
|
|
37040
|
+
id: "dtc-subscription-apollo-clickup",
|
|
37041
|
+
label: "DTC Subscription Apollo Export",
|
|
37042
|
+
description: "Prospecting pipeline for DTC subscription or subscription-ready brands where Apollo is the source and contact-enrichment layer, Elevasis handles company research and fit scoring, and approved leads export as an approved lead list.",
|
|
37043
|
+
steps: [
|
|
37044
|
+
{
|
|
37045
|
+
id: "import-apollo-search",
|
|
37046
|
+
label: "Import Apollo search",
|
|
37047
|
+
description: "Pull companies and seed contact data from a predefined Apollo search or list.",
|
|
37048
|
+
primaryEntity: "company",
|
|
37049
|
+
outputs: ["company", "contact"],
|
|
37050
|
+
stageKey: "populated",
|
|
37051
|
+
dependencyMode: "per-record-eligibility",
|
|
37052
|
+
capabilityKey: "lead-gen.company.apollo-import",
|
|
37053
|
+
defaultBatchSize: 250,
|
|
37054
|
+
maxBatchSize: 1e3
|
|
37055
|
+
},
|
|
37056
|
+
{
|
|
37057
|
+
id: "analyze-websites",
|
|
37058
|
+
label: "Analyze websites",
|
|
37059
|
+
description: "Extract subscription, product, retention, and tech-stack signals from each brand website.",
|
|
37060
|
+
primaryEntity: "company",
|
|
37061
|
+
outputs: ["company"],
|
|
37062
|
+
stageKey: "extracted",
|
|
37063
|
+
dependsOn: ["import-apollo-search"],
|
|
37064
|
+
dependencyMode: "per-record-eligibility",
|
|
37065
|
+
capabilityKey: "lead-gen.company.website-extract",
|
|
37066
|
+
defaultBatchSize: 50,
|
|
37067
|
+
maxBatchSize: 100
|
|
37068
|
+
},
|
|
37069
|
+
{
|
|
37070
|
+
id: "score-dtc-fit",
|
|
37071
|
+
label: "Score DTC fit",
|
|
37072
|
+
description: "Classify subscription potential, consumable-product fit, retention maturity, and disqualifiers.",
|
|
37073
|
+
primaryEntity: "company",
|
|
37074
|
+
outputs: ["company"],
|
|
37075
|
+
stageKey: "qualified",
|
|
37076
|
+
dependsOn: ["analyze-websites"],
|
|
37077
|
+
dependencyMode: "per-record-eligibility",
|
|
37078
|
+
capabilityKey: "lead-gen.company.dtc-subscription-qualify",
|
|
37079
|
+
defaultBatchSize: 100,
|
|
37080
|
+
maxBatchSize: 250
|
|
37081
|
+
},
|
|
37082
|
+
{
|
|
37083
|
+
id: "enrich-decision-makers",
|
|
37084
|
+
label: "Enrich decision-makers",
|
|
37085
|
+
description: "Use Apollo to find qualified contacts such as founders, retention leads, lifecycle leads, and marketing owners.",
|
|
37086
|
+
primaryEntity: "contact",
|
|
37087
|
+
outputs: ["contact"],
|
|
37088
|
+
stageKey: "discovered",
|
|
37089
|
+
dependsOn: ["score-dtc-fit"],
|
|
37090
|
+
dependencyMode: "per-record-eligibility",
|
|
37091
|
+
capabilityKey: "lead-gen.contact.apollo-decision-maker-enrich",
|
|
37092
|
+
defaultBatchSize: 100,
|
|
37093
|
+
maxBatchSize: 250
|
|
37094
|
+
},
|
|
37095
|
+
{
|
|
37096
|
+
id: "verify-emails",
|
|
37097
|
+
label: "Verify emails",
|
|
37098
|
+
description: "Verify deliverability before the QC and handoff step.",
|
|
37099
|
+
primaryEntity: "contact",
|
|
37100
|
+
outputs: ["contact"],
|
|
37101
|
+
stageKey: "verified",
|
|
37102
|
+
dependsOn: ["enrich-decision-makers"],
|
|
37103
|
+
dependencyMode: "per-record-eligibility",
|
|
37104
|
+
capabilityKey: "lead-gen.contact.verify-email",
|
|
37105
|
+
defaultBatchSize: 250,
|
|
37106
|
+
maxBatchSize: 500
|
|
37107
|
+
},
|
|
37108
|
+
{
|
|
37109
|
+
id: "review-and-export",
|
|
37110
|
+
label: "Review and export",
|
|
37111
|
+
description: "Operator QC approves or rejects leads, then approved records are exported as a lead list.",
|
|
37112
|
+
primaryEntity: "company",
|
|
37113
|
+
outputs: ["export"],
|
|
37114
|
+
stageKey: "uploaded",
|
|
37115
|
+
dependsOn: ["verify-emails"],
|
|
37116
|
+
dependencyMode: "per-record-eligibility",
|
|
37117
|
+
capabilityKey: "lead-gen.export.list",
|
|
37118
|
+
defaultBatchSize: 100,
|
|
37119
|
+
maxBatchSize: 250
|
|
37120
|
+
}
|
|
37121
|
+
]
|
|
37122
|
+
}
|
|
37123
|
+
]
|
|
37124
|
+
};
|
|
37125
|
+
|
|
37126
|
+
// ../core/src/organization-model/domains/navigation.ts
|
|
37127
|
+
var SurfaceTypeSchema = external_exports.enum(["page", "dashboard", "graph", "detail", "list", "settings"]);
|
|
37128
|
+
var SurfaceDefinitionSchema = external_exports.object({
|
|
37129
|
+
id: ModelIdSchema,
|
|
37130
|
+
label: LabelSchema,
|
|
37131
|
+
path: PathSchema,
|
|
37132
|
+
surfaceType: SurfaceTypeSchema,
|
|
37133
|
+
description: DescriptionSchema.optional(),
|
|
37134
|
+
enabled: external_exports.boolean().default(true),
|
|
37135
|
+
devOnly: external_exports.boolean().optional(),
|
|
37136
|
+
icon: IconNameSchema.optional(),
|
|
37137
|
+
featureId: ModelIdSchema.optional(),
|
|
37138
|
+
featureIds: ReferenceIdsSchema,
|
|
37139
|
+
entityIds: ReferenceIdsSchema,
|
|
37140
|
+
resourceIds: ReferenceIdsSchema,
|
|
37141
|
+
capabilityIds: ReferenceIdsSchema,
|
|
37142
|
+
parentId: ModelIdSchema.optional()
|
|
37143
|
+
});
|
|
37144
|
+
var NavigationGroupSchema = external_exports.object({
|
|
37145
|
+
id: ModelIdSchema,
|
|
37146
|
+
label: LabelSchema,
|
|
37147
|
+
placement: external_exports.string().trim().min(1).max(50),
|
|
37148
|
+
surfaceIds: external_exports.array(ModelIdSchema).default([])
|
|
37149
|
+
});
|
|
37150
|
+
var OrganizationModelNavigationSchema = external_exports.object({
|
|
37151
|
+
defaultSurfaceId: ModelIdSchema.optional(),
|
|
37152
|
+
surfaces: external_exports.array(SurfaceDefinitionSchema).default([]),
|
|
37153
|
+
groups: external_exports.array(NavigationGroupSchema).default([])
|
|
37154
|
+
});
|
|
37155
|
+
|
|
37156
|
+
// ../core/src/organization-model/domains/identity.ts
|
|
37157
|
+
var BusinessHoursDaySchema = external_exports.object({
|
|
37158
|
+
open: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format"),
|
|
37159
|
+
close: external_exports.string().trim().regex(/^\d{2}:\d{2}$/, "Expected HH:MM format")
|
|
37160
|
+
});
|
|
37161
|
+
var BusinessHoursSchema = external_exports.object({
|
|
37162
|
+
monday: BusinessHoursDaySchema.optional(),
|
|
37163
|
+
tuesday: BusinessHoursDaySchema.optional(),
|
|
37164
|
+
wednesday: BusinessHoursDaySchema.optional(),
|
|
37165
|
+
thursday: BusinessHoursDaySchema.optional(),
|
|
37166
|
+
friday: BusinessHoursDaySchema.optional(),
|
|
37167
|
+
saturday: BusinessHoursDaySchema.optional(),
|
|
37168
|
+
sunday: BusinessHoursDaySchema.optional()
|
|
37169
|
+
}).default({});
|
|
37170
|
+
var IdentityDomainSchema = external_exports.object({
|
|
37171
|
+
/** Why the organization exists — one or two plain-language sentences. */
|
|
37172
|
+
mission: external_exports.string().trim().max(1e3).default(""),
|
|
37173
|
+
/** Long-term direction the organization is moving toward. */
|
|
37174
|
+
vision: external_exports.string().trim().max(1e3).default(""),
|
|
37175
|
+
/** Legal registered name of the entity. */
|
|
37176
|
+
legalName: external_exports.string().trim().max(200).default(""),
|
|
37177
|
+
/**
|
|
37178
|
+
* Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
|
|
37179
|
+
* "Non-profit"). Free-form string so it covers any jurisdiction.
|
|
37180
|
+
*/
|
|
37181
|
+
entityType: external_exports.string().trim().max(100).default(""),
|
|
37182
|
+
/**
|
|
37183
|
+
* Primary jurisdiction of registration or operation
|
|
37184
|
+
* (e.g. "United States – Delaware", "Canada – Ontario").
|
|
37185
|
+
*/
|
|
37186
|
+
jurisdiction: external_exports.string().trim().max(200).default(""),
|
|
37187
|
+
/**
|
|
37188
|
+
* Industry category — broad classification (e.g. "Marketing Agency",
|
|
37189
|
+
* "Software / SaaS", "Professional Services").
|
|
37190
|
+
*/
|
|
37191
|
+
industryCategory: external_exports.string().trim().max(200).default(""),
|
|
37192
|
+
/**
|
|
37193
|
+
* Geographic focus — where the organization primarily operates or serves
|
|
37194
|
+
* (e.g. "North America", "Global", "Southeast Asia").
|
|
37195
|
+
*/
|
|
37196
|
+
geographicFocus: external_exports.string().trim().max(200).default(""),
|
|
37197
|
+
/**
|
|
37198
|
+
* IANA timezone identifier for the organization's primary operating timezone
|
|
37199
|
+
* (e.g. "America/Los_Angeles", "Europe/London", "UTC").
|
|
37200
|
+
*/
|
|
37201
|
+
timeZone: external_exports.string().trim().max(100).default("UTC"),
|
|
37202
|
+
/** Typical operating hours per day of week. Empty object means not configured. */
|
|
37203
|
+
businessHours: BusinessHoursSchema,
|
|
37204
|
+
/**
|
|
37205
|
+
* Long-form markdown capturing client context, problem narrative, and domain
|
|
37206
|
+
* background. Populated by /setup; surfaced to agents as organizational context.
|
|
37207
|
+
* Optional — many projects have no external client.
|
|
37208
|
+
*/
|
|
37209
|
+
clientBrief: external_exports.string().trim().default("")
|
|
37210
|
+
});
|
|
37211
|
+
var DEFAULT_ORGANIZATION_MODEL_IDENTITY = {
|
|
37212
|
+
mission: "",
|
|
37213
|
+
vision: "",
|
|
37214
|
+
legalName: "",
|
|
37215
|
+
entityType: "",
|
|
37216
|
+
jurisdiction: "",
|
|
37217
|
+
industryCategory: "",
|
|
37218
|
+
geographicFocus: "",
|
|
37219
|
+
timeZone: "UTC",
|
|
37220
|
+
businessHours: {},
|
|
37221
|
+
clientBrief: ""
|
|
37222
|
+
};
|
|
37223
|
+
|
|
37224
|
+
// ../core/src/organization-model/domains/customers.ts
|
|
37225
|
+
var FirmographicsSchema = external_exports.object({
|
|
37226
|
+
/** Industry vertical (e.g. "Marketing Agency", "Legal", "Real Estate"). */
|
|
37227
|
+
industry: external_exports.string().trim().max(200).optional(),
|
|
37228
|
+
/**
|
|
37229
|
+
* Company headcount band (e.g. "1–10", "11–50", "51–200", "200+").
|
|
37230
|
+
* Free-form string to accommodate any band notation.
|
|
37231
|
+
*/
|
|
37232
|
+
companySize: external_exports.string().trim().max(100).optional(),
|
|
37233
|
+
/**
|
|
37234
|
+
* Primary geographic region the segment operates in or is targeted from
|
|
37235
|
+
* (e.g. "North America", "Europe", "Global").
|
|
37236
|
+
*/
|
|
37237
|
+
region: external_exports.string().trim().max(200).optional()
|
|
37238
|
+
});
|
|
37239
|
+
var CustomerSegmentSchema = external_exports.object({
|
|
37240
|
+
/** Stable unique identifier for the segment (e.g. "segment-smb-agencies"). */
|
|
37241
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37242
|
+
/** Human-readable name shown to agents and in UI (e.g. "SMB Marketing Agencies"). */
|
|
37243
|
+
name: external_exports.string().trim().max(200).default(""),
|
|
37244
|
+
/** One or two sentences describing who this segment is. */
|
|
37245
|
+
description: external_exports.string().trim().max(2e3).default(""),
|
|
37246
|
+
/**
|
|
37247
|
+
* The primary job(s) this segment is trying to get done — the goal they hire
|
|
37248
|
+
* a product/service to accomplish. Plain-language narrative or bullet list.
|
|
37249
|
+
*/
|
|
37250
|
+
jobsToBeDone: external_exports.string().trim().max(2e3).default(""),
|
|
37251
|
+
/**
|
|
37252
|
+
* Pains — frustrations, obstacles, and risks the segment experiences
|
|
37253
|
+
* when trying to accomplish their jobs-to-be-done.
|
|
37254
|
+
*/
|
|
37255
|
+
pains: external_exports.array(external_exports.string().trim().max(500)).default([]),
|
|
37256
|
+
/**
|
|
37257
|
+
* Gains — outcomes and benefits the segment desires; positive motivators
|
|
37258
|
+
* beyond merely resolving pains.
|
|
37259
|
+
*/
|
|
37260
|
+
gains: external_exports.array(external_exports.string().trim().max(500)).default([]),
|
|
37261
|
+
/** Firmographic profile for targeting and filtering. */
|
|
37262
|
+
firmographics: FirmographicsSchema.default({}),
|
|
37263
|
+
/**
|
|
37264
|
+
* Value proposition — one or two sentences stating why this organization's
|
|
37265
|
+
* offering is uniquely suited for this segment's needs.
|
|
37266
|
+
*/
|
|
37267
|
+
valueProp: external_exports.string().trim().max(2e3).default("")
|
|
37268
|
+
});
|
|
37269
|
+
var CustomersDomainSchema = external_exports.object({
|
|
37270
|
+
segments: external_exports.array(CustomerSegmentSchema).default([])
|
|
37271
|
+
});
|
|
37272
|
+
var DEFAULT_ORGANIZATION_MODEL_CUSTOMERS = {
|
|
37273
|
+
segments: []
|
|
37274
|
+
};
|
|
37275
|
+
|
|
37276
|
+
// ../core/src/organization-model/domains/offerings.ts
|
|
37277
|
+
var PricingModelSchema = external_exports.enum(["one-time", "subscription", "usage-based", "custom"]);
|
|
37278
|
+
var ProductSchema = external_exports.object({
|
|
37279
|
+
/** Stable unique identifier for the product (e.g. "product-starter-plan"). */
|
|
37280
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37281
|
+
/** Human-readable name shown to agents and in UI (e.g. "Starter Plan"). */
|
|
37282
|
+
name: external_exports.string().trim().max(200).default(""),
|
|
37283
|
+
/** One or two sentences describing what this product/service delivers. */
|
|
37284
|
+
description: external_exports.string().trim().max(2e3).default(""),
|
|
37285
|
+
/**
|
|
37286
|
+
* How this product is priced:
|
|
37287
|
+
* - "one-time" — single purchase (setup fee, project fee)
|
|
37288
|
+
* - "subscription" — recurring (monthly/annual SaaS, retainer)
|
|
37289
|
+
* - "usage-based" — metered by consumption (API calls, seats)
|
|
37290
|
+
* - "custom" — negotiated or bespoke pricing
|
|
37291
|
+
*/
|
|
37292
|
+
pricingModel: PricingModelSchema.default("custom"),
|
|
37293
|
+
/** Base price amount (≥ 0). Currency unit defined by `currency`. */
|
|
37294
|
+
price: external_exports.number().min(0).default(0),
|
|
37295
|
+
/**
|
|
37296
|
+
* ISO 4217 currency code (e.g. "USD", "EUR", "GBP").
|
|
37297
|
+
* Free-form string to accommodate any currency; defaults to "USD".
|
|
37298
|
+
*/
|
|
37299
|
+
currency: external_exports.string().trim().max(10).default("USD"),
|
|
37300
|
+
/**
|
|
37301
|
+
* IDs of customer segments this product targets.
|
|
37302
|
+
* Each id must reference a declared `customers.segments[].id`.
|
|
37303
|
+
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
37304
|
+
*/
|
|
37305
|
+
targetSegmentIds: external_exports.array(external_exports.string().trim().min(1)).default([]),
|
|
37306
|
+
/**
|
|
37307
|
+
* Optional: ID of the platform feature responsible for delivering this product.
|
|
37308
|
+
* When present, must reference a declared `features[].id`.
|
|
37309
|
+
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
37310
|
+
*/
|
|
37311
|
+
deliveryFeatureId: external_exports.string().trim().min(1).optional()
|
|
37312
|
+
});
|
|
37313
|
+
var OfferingsDomainSchema = external_exports.object({
|
|
37314
|
+
products: external_exports.array(ProductSchema).default([])
|
|
37315
|
+
});
|
|
37316
|
+
var DEFAULT_ORGANIZATION_MODEL_OFFERINGS = {
|
|
37317
|
+
products: []
|
|
37318
|
+
};
|
|
37319
|
+
|
|
37320
|
+
// ../core/src/organization-model/domains/roles.ts
|
|
37321
|
+
var RoleSchema = external_exports.object({
|
|
37322
|
+
/** Stable unique identifier for the role (e.g. "role-ceo", "role-head-of-sales"). */
|
|
37323
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37324
|
+
/** Human-readable title shown to agents and in UI (e.g. "CEO", "Head of Sales"). */
|
|
37325
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
37326
|
+
/**
|
|
37327
|
+
* List of responsibilities this role owns — plain-language descriptions of
|
|
37328
|
+
* what the person in this role is accountable for delivering.
|
|
37329
|
+
* Defaults to empty array so minimal role definitions stay concise.
|
|
37330
|
+
*/
|
|
37331
|
+
responsibilities: external_exports.array(external_exports.string().trim().max(500)).default([]),
|
|
37332
|
+
/**
|
|
37333
|
+
* Optional: ID of another role this role reports to.
|
|
37334
|
+
* When present, must reference another `roles[].id` in the same organization.
|
|
37335
|
+
* Cross-reference enforced in `OrganizationModelSchema.superRefine()`.
|
|
37336
|
+
* Absence indicates a top-level role (no reporting line).
|
|
37337
|
+
*/
|
|
37338
|
+
reportsToId: external_exports.string().trim().min(1).max(100).optional(),
|
|
37339
|
+
/**
|
|
37340
|
+
* Optional: name or email of the person currently holding this role.
|
|
37341
|
+
* Free-form string — supports "Alice Johnson", "alice@example.com", or
|
|
37342
|
+
* any human-readable identifier. Not validated against any user registry.
|
|
37343
|
+
*/
|
|
37344
|
+
heldBy: external_exports.string().trim().max(200).optional()
|
|
37345
|
+
});
|
|
37346
|
+
var RolesDomainSchema = external_exports.object({
|
|
37347
|
+
roles: external_exports.array(RoleSchema).default([])
|
|
37348
|
+
});
|
|
37349
|
+
var DEFAULT_ORGANIZATION_MODEL_ROLES = {
|
|
37350
|
+
roles: []
|
|
37351
|
+
};
|
|
37352
|
+
|
|
37353
|
+
// ../core/src/organization-model/domains/goals.ts
|
|
37354
|
+
var KeyResultSchema = external_exports.object({
|
|
37355
|
+
/** Stable unique identifier for the measurable outcome (e.g. "kr-revenue-q1"). */
|
|
37356
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37357
|
+
/** Plain-language description of this measurable outcome (e.g. "Increase trial-to-paid conversion"). */
|
|
37358
|
+
description: external_exports.string().trim().min(1).max(500),
|
|
37359
|
+
/**
|
|
37360
|
+
* What is being measured — the metric name (e.g. "monthly revenue", "NPS score",
|
|
37361
|
+
* "trial-to-paid conversion rate"). Free-form string.
|
|
37362
|
+
*/
|
|
37363
|
+
targetMetric: external_exports.string().trim().min(1).max(200),
|
|
37364
|
+
/** Current measured value. Defaults to 0 when not yet tracked. */
|
|
37365
|
+
currentValue: external_exports.number().default(0),
|
|
37366
|
+
/**
|
|
37367
|
+
* Target value to reach for this measurable outcome to be considered achieved.
|
|
37368
|
+
* Optional — omit if the outcome is directional (e.g. "reduce churn") without
|
|
37369
|
+
* a hard numeric target.
|
|
37370
|
+
*/
|
|
37371
|
+
targetValue: external_exports.number().optional()
|
|
37372
|
+
});
|
|
37373
|
+
var ISO_DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
37374
|
+
var ObjectiveSchema = external_exports.object({
|
|
37375
|
+
/** Stable unique identifier for the goal (e.g. "goal-grow-arr-q1-2026"). */
|
|
37376
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37377
|
+
/** Plain-language description of what the organization wants to achieve. */
|
|
37378
|
+
description: external_exports.string().trim().min(1).max(1e3),
|
|
37379
|
+
/**
|
|
37380
|
+
* Start of the period this goal is active for — ISO 8601 date string (YYYY-MM-DD).
|
|
37381
|
+
* Must be strictly before `periodEnd`.
|
|
37382
|
+
*/
|
|
37383
|
+
periodStart: external_exports.string().regex(ISO_DATE_REGEX, "periodStart must be an ISO date string (YYYY-MM-DD)"),
|
|
37384
|
+
/**
|
|
37385
|
+
* End of the period this goal is active for — ISO 8601 date string (YYYY-MM-DD).
|
|
37386
|
+
* Must be strictly after `periodStart`.
|
|
37387
|
+
* Enforced via `OrganizationModelSchema.superRefine()`.
|
|
37388
|
+
*/
|
|
37389
|
+
periodEnd: external_exports.string().regex(ISO_DATE_REGEX, "periodEnd must be an ISO date string (YYYY-MM-DD)"),
|
|
37390
|
+
/**
|
|
37391
|
+
* List of measurable outcomes that define success for this goal.
|
|
37392
|
+
* Defaults to empty array so goals can be declared before outcomes are defined.
|
|
37393
|
+
*/
|
|
37394
|
+
keyResults: external_exports.array(KeyResultSchema).default([])
|
|
37395
|
+
});
|
|
37396
|
+
var GoalsDomainSchema = external_exports.object({
|
|
37397
|
+
objectives: external_exports.array(ObjectiveSchema).default([])
|
|
37398
|
+
});
|
|
37399
|
+
var DEFAULT_ORGANIZATION_MODEL_GOALS = {
|
|
37400
|
+
objectives: []
|
|
37401
|
+
};
|
|
37402
|
+
|
|
37403
|
+
// ../core/src/organization-model/domains/operations.ts
|
|
37404
|
+
var OperationSemanticClassSchema = external_exports.enum(["queue", "executions", "sessions", "notifications", "schedules"]);
|
|
37405
|
+
var OperationEntrySchema = external_exports.object({
|
|
37406
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37407
|
+
label: external_exports.string().trim().min(1).max(120),
|
|
37408
|
+
semanticClass: OperationSemanticClassSchema,
|
|
37409
|
+
/** Optional reference to the feature that owns this runtime entity. */
|
|
37410
|
+
featureId: external_exports.string().trim().min(1).max(100).optional(),
|
|
37411
|
+
/**
|
|
37412
|
+
* Optional pointer to the status semanticClass values that apply to this
|
|
37413
|
+
* entity — ties operations back to the statuses domain for vibe rendering.
|
|
37414
|
+
*/
|
|
37415
|
+
supportedStatusSemanticClass: external_exports.array(external_exports.string().trim().min(1).max(80)).optional()
|
|
37416
|
+
});
|
|
37417
|
+
var OperationsDomainSchema = external_exports.object({
|
|
37418
|
+
entries: external_exports.array(OperationEntrySchema).default([])
|
|
37419
|
+
});
|
|
37420
|
+
var DEFAULT_ORGANIZATION_MODEL_OPERATIONS = {
|
|
37421
|
+
entries: [
|
|
37422
|
+
// --- queue (HITL command queue) ---
|
|
37423
|
+
{
|
|
37424
|
+
id: "operations.queue",
|
|
37425
|
+
label: "HITL Queue",
|
|
37426
|
+
semanticClass: "queue",
|
|
37427
|
+
featureId: "operations",
|
|
37428
|
+
supportedStatusSemanticClass: ["queue"]
|
|
37429
|
+
},
|
|
37430
|
+
// --- executions (workflow / agent executions) ---
|
|
37431
|
+
{
|
|
37432
|
+
id: "operations.executions",
|
|
37433
|
+
label: "Executions",
|
|
37434
|
+
semanticClass: "executions",
|
|
37435
|
+
featureId: "operations",
|
|
37436
|
+
supportedStatusSemanticClass: ["execution"]
|
|
37437
|
+
},
|
|
37438
|
+
// --- sessions (agent conversation sessions) ---
|
|
37439
|
+
{
|
|
37440
|
+
id: "operations.sessions",
|
|
37441
|
+
label: "Sessions",
|
|
37442
|
+
semanticClass: "sessions",
|
|
37443
|
+
featureId: "operations"
|
|
37444
|
+
},
|
|
37445
|
+
// --- notifications (platform in-app notifications) ---
|
|
37446
|
+
{
|
|
37447
|
+
id: "operations.notifications",
|
|
37448
|
+
label: "Notifications",
|
|
37449
|
+
semanticClass: "notifications",
|
|
37450
|
+
featureId: "monitoring"
|
|
37451
|
+
},
|
|
37452
|
+
// --- schedules (task scheduler) ---
|
|
37453
|
+
{
|
|
37454
|
+
id: "operations.schedules",
|
|
37455
|
+
label: "Schedules",
|
|
37456
|
+
semanticClass: "schedules",
|
|
37457
|
+
featureId: "operations",
|
|
37458
|
+
supportedStatusSemanticClass: ["schedule", "schedule.run"]
|
|
37459
|
+
}
|
|
37460
|
+
]
|
|
37461
|
+
};
|
|
37462
|
+
|
|
37463
|
+
// ../core/src/organization-model/domains/statuses.ts
|
|
37464
|
+
var StatusSemanticClassSchema = external_exports.enum([
|
|
37465
|
+
"delivery.task",
|
|
37466
|
+
"delivery.project",
|
|
37467
|
+
"delivery.milestone",
|
|
37468
|
+
"queue",
|
|
37469
|
+
"execution",
|
|
37470
|
+
"schedule",
|
|
37471
|
+
"schedule.run",
|
|
37472
|
+
"request"
|
|
37473
|
+
]);
|
|
37474
|
+
var StatusEntrySchema = external_exports.object({
|
|
37475
|
+
id: external_exports.string().trim().min(1).max(100),
|
|
37476
|
+
label: external_exports.string().trim().min(1).max(120),
|
|
37477
|
+
semanticClass: StatusSemanticClassSchema,
|
|
37478
|
+
category: external_exports.string().trim().min(1).max(80).optional()
|
|
37479
|
+
});
|
|
37480
|
+
var StatusesDomainSchema = external_exports.object({
|
|
37481
|
+
entries: external_exports.array(StatusEntrySchema).default([])
|
|
37482
|
+
});
|
|
37483
|
+
var DEFAULT_ORGANIZATION_MODEL_STATUSES = {
|
|
37484
|
+
entries: [
|
|
37485
|
+
// --- delivery.task (TaskStatus — 9 values) ---
|
|
37486
|
+
{ id: "delivery.task.planned", label: "Planned", semanticClass: "delivery.task", category: "delivery" },
|
|
37487
|
+
{ id: "delivery.task.in_progress", label: "In Progress", semanticClass: "delivery.task", category: "delivery" },
|
|
37488
|
+
{ id: "delivery.task.blocked", label: "Blocked", semanticClass: "delivery.task", category: "delivery" },
|
|
37489
|
+
{ id: "delivery.task.submitted", label: "Submitted", semanticClass: "delivery.task", category: "delivery" },
|
|
37490
|
+
{ id: "delivery.task.approved", label: "Approved", semanticClass: "delivery.task", category: "delivery" },
|
|
37491
|
+
{
|
|
37492
|
+
id: "delivery.task.revision_requested",
|
|
37493
|
+
label: "Revision Requested",
|
|
37494
|
+
semanticClass: "delivery.task",
|
|
37495
|
+
category: "delivery"
|
|
37496
|
+
},
|
|
37497
|
+
{ id: "delivery.task.rejected", label: "Rejected", semanticClass: "delivery.task", category: "delivery" },
|
|
37498
|
+
{ id: "delivery.task.cancelled", label: "Cancelled", semanticClass: "delivery.task", category: "delivery" },
|
|
37499
|
+
{ id: "delivery.task.completed", label: "Completed", semanticClass: "delivery.task", category: "delivery" },
|
|
37500
|
+
// --- delivery.project (ProjectStatus — 6 values) ---
|
|
37501
|
+
{ id: "delivery.project.active", label: "Active", semanticClass: "delivery.project", category: "delivery" },
|
|
37502
|
+
{ id: "delivery.project.on_track", label: "On Track", semanticClass: "delivery.project", category: "delivery" },
|
|
37503
|
+
{ id: "delivery.project.at_risk", label: "At Risk", semanticClass: "delivery.project", category: "delivery" },
|
|
37504
|
+
{ id: "delivery.project.blocked", label: "Blocked", semanticClass: "delivery.project", category: "delivery" },
|
|
37505
|
+
{ id: "delivery.project.paused", label: "Paused", semanticClass: "delivery.project", category: "delivery" },
|
|
37506
|
+
{ id: "delivery.project.completed", label: "Completed", semanticClass: "delivery.project", category: "delivery" },
|
|
37507
|
+
// --- delivery.milestone (MilestoneStatus — 5 values) ---
|
|
37508
|
+
{
|
|
37509
|
+
id: "delivery.milestone.upcoming",
|
|
37510
|
+
label: "Upcoming",
|
|
37511
|
+
semanticClass: "delivery.milestone",
|
|
37512
|
+
category: "delivery"
|
|
37513
|
+
},
|
|
37514
|
+
{
|
|
37515
|
+
id: "delivery.milestone.in_progress",
|
|
37516
|
+
label: "In Progress",
|
|
37517
|
+
semanticClass: "delivery.milestone",
|
|
37518
|
+
category: "delivery"
|
|
37519
|
+
},
|
|
37520
|
+
{
|
|
37521
|
+
id: "delivery.milestone.blocked",
|
|
37522
|
+
label: "Blocked",
|
|
37523
|
+
semanticClass: "delivery.milestone",
|
|
37524
|
+
category: "delivery"
|
|
37525
|
+
},
|
|
37526
|
+
{ id: "delivery.milestone.overdue", label: "Overdue", semanticClass: "delivery.milestone", category: "delivery" },
|
|
37527
|
+
{
|
|
37528
|
+
id: "delivery.milestone.completed",
|
|
37529
|
+
label: "Completed",
|
|
37530
|
+
semanticClass: "delivery.milestone",
|
|
37531
|
+
category: "delivery"
|
|
37532
|
+
},
|
|
37533
|
+
// --- queue (QueueTaskStatus — 5 values, maps hitl/command-queue tasks) ---
|
|
37534
|
+
{ id: "queue.pending", label: "Pending", semanticClass: "queue", category: "queue" },
|
|
37535
|
+
{ id: "queue.processing", label: "Processing", semanticClass: "queue", category: "queue" },
|
|
37536
|
+
{ id: "queue.completed", label: "Completed", semanticClass: "queue", category: "queue" },
|
|
37537
|
+
{ id: "queue.failed", label: "Failed", semanticClass: "queue", category: "queue" },
|
|
37538
|
+
{ id: "queue.expired", label: "Expired", semanticClass: "queue", category: "queue" },
|
|
37539
|
+
// --- execution (ExecutionStatus — 5 values) ---
|
|
37540
|
+
{ id: "execution.pending", label: "Pending", semanticClass: "execution", category: "execution" },
|
|
37541
|
+
{ id: "execution.running", label: "Running", semanticClass: "execution", category: "execution" },
|
|
37542
|
+
{ id: "execution.completed", label: "Completed", semanticClass: "execution", category: "execution" },
|
|
37543
|
+
{ id: "execution.failed", label: "Failed", semanticClass: "execution", category: "execution" },
|
|
37544
|
+
{ id: "execution.warning", label: "Warning", semanticClass: "execution", category: "execution" },
|
|
37545
|
+
// --- schedule (schedule status — 4 values) ---
|
|
37546
|
+
{ id: "schedule.active", label: "Active", semanticClass: "schedule", category: "schedule" },
|
|
37547
|
+
{ id: "schedule.paused", label: "Paused", semanticClass: "schedule", category: "schedule" },
|
|
37548
|
+
{ id: "schedule.completed", label: "Completed", semanticClass: "schedule", category: "schedule" },
|
|
37549
|
+
{ id: "schedule.cancelled", label: "Cancelled", semanticClass: "schedule", category: "schedule" },
|
|
37550
|
+
// --- schedule.run (schedule run status — 4 values) ---
|
|
37551
|
+
{ id: "schedule.run.running", label: "Running", semanticClass: "schedule.run", category: "schedule" },
|
|
37552
|
+
{ id: "schedule.run.completed", label: "Completed", semanticClass: "schedule.run", category: "schedule" },
|
|
37553
|
+
{ id: "schedule.run.failed", label: "Failed", semanticClass: "schedule.run", category: "schedule" },
|
|
37554
|
+
{ id: "schedule.run.cancelled", label: "Cancelled", semanticClass: "schedule.run", category: "schedule" },
|
|
37555
|
+
// --- request (RequestStatus — 4 values, maps reported_requests) ---
|
|
37556
|
+
{ id: "request.open", label: "Open", semanticClass: "request", category: "request" },
|
|
37557
|
+
{ id: "request.investigating", label: "Investigating", semanticClass: "request", category: "request" },
|
|
37558
|
+
{ id: "request.resolved", label: "Resolved", semanticClass: "request", category: "request" },
|
|
37559
|
+
{ id: "request.wont_fix", label: "Won't Fix", semanticClass: "request", category: "request" }
|
|
37560
|
+
]
|
|
37561
|
+
};
|
|
37562
|
+
|
|
37563
|
+
// ../core/src/organization-model/domains/knowledge.ts
|
|
37564
|
+
var KnowledgeLinkSchema = external_exports.object({
|
|
37565
|
+
nodeId: NodeIdStringSchema
|
|
37566
|
+
});
|
|
37567
|
+
var OrgKnowledgeKindSchema = external_exports.enum(["playbook", "strategy", "reference"]);
|
|
37568
|
+
var OrgKnowledgeNodeSchema = external_exports.object({
|
|
37569
|
+
id: ModelIdSchema,
|
|
37570
|
+
kind: OrgKnowledgeKindSchema,
|
|
37571
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
37572
|
+
summary: external_exports.string().trim().min(1).max(1e3),
|
|
37573
|
+
icon: IconNameSchema.optional(),
|
|
37574
|
+
/** Raw MDX string. Phase 2 will introduce a structured block format. */
|
|
37575
|
+
body: external_exports.string().trim().min(1),
|
|
37576
|
+
/**
|
|
37577
|
+
* Graph links to other OM nodes this knowledge node governs.
|
|
37578
|
+
* Each link emits a `governs` edge: knowledge-node -> target node.
|
|
37579
|
+
*/
|
|
37580
|
+
links: external_exports.array(KnowledgeLinkSchema).default([]),
|
|
37581
|
+
/** Identifiers of the roles or members who own this knowledge node. */
|
|
37582
|
+
ownerIds: external_exports.array(ModelIdSchema).default([]),
|
|
37583
|
+
/** ISO date string (YYYY-MM-DD or full ISO 8601) of last meaningful update. */
|
|
37584
|
+
updatedAt: external_exports.string().trim().min(1).max(50)
|
|
37585
|
+
});
|
|
37586
|
+
var KnowledgeDomainSchema = external_exports.object({
|
|
37587
|
+
nodes: external_exports.array(OrgKnowledgeNodeSchema).default([])
|
|
37588
|
+
});
|
|
37589
|
+
|
|
37590
|
+
// ../core/src/organization-model/schema.ts
|
|
37591
|
+
var OrganizationModelSchemaBase = external_exports.object({
|
|
37592
|
+
version: external_exports.literal(1).default(1),
|
|
37593
|
+
features: external_exports.array(FeatureSchema).default([]),
|
|
37594
|
+
branding: OrganizationModelBrandingSchema,
|
|
37595
|
+
navigation: OrganizationModelNavigationSchema.default({ surfaces: [], groups: [] }),
|
|
37596
|
+
sales: OrganizationModelSalesSchema,
|
|
37597
|
+
prospecting: OrganizationModelProspectingSchema,
|
|
37598
|
+
projects: OrganizationModelProjectsSchema,
|
|
37599
|
+
identity: IdentityDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_IDENTITY),
|
|
37600
|
+
customers: CustomersDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_CUSTOMERS),
|
|
37601
|
+
offerings: OfferingsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_OFFERINGS),
|
|
37602
|
+
roles: RolesDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_ROLES),
|
|
37603
|
+
goals: GoalsDomainSchema.default(DEFAULT_ORGANIZATION_MODEL_GOALS),
|
|
37604
|
+
statuses: StatusesDomainSchema.default({ entries: [] }),
|
|
37605
|
+
operations: OperationsDomainSchema.default({ entries: [] }),
|
|
37606
|
+
knowledge: KnowledgeDomainSchema.default({ nodes: [] })
|
|
37607
|
+
});
|
|
37608
|
+
function addIssue(ctx, path3, message) {
|
|
37609
|
+
ctx.addIssue({
|
|
37610
|
+
code: external_exports.ZodIssueCode.custom,
|
|
37611
|
+
path: path3,
|
|
37612
|
+
message
|
|
37613
|
+
});
|
|
37614
|
+
}
|
|
37615
|
+
function collectIds(items, ctx, collectionPath, label) {
|
|
37616
|
+
const itemsById = /* @__PURE__ */ new Map();
|
|
37617
|
+
items.forEach((item, index) => {
|
|
37618
|
+
if (itemsById.has(item.id)) {
|
|
37619
|
+
addIssue(ctx, [...collectionPath, index, "id"], `${label} id "${item.id}" must be unique`);
|
|
37620
|
+
return;
|
|
37621
|
+
}
|
|
37622
|
+
itemsById.set(item.id, item);
|
|
37623
|
+
});
|
|
37624
|
+
return itemsById;
|
|
37625
|
+
}
|
|
37626
|
+
var LEGACY_FEATURE_ALIASES = /* @__PURE__ */ new Map([
|
|
37627
|
+
["crm", "sales.crm"],
|
|
37628
|
+
["lead-gen", "sales.lead-gen"],
|
|
37629
|
+
["submitted-requests", "monitoring.submitted-requests"]
|
|
37630
|
+
]);
|
|
37631
|
+
function hasFeature(featuresById, featureId) {
|
|
37632
|
+
return featuresById.has(featureId) || featuresById.has(LEGACY_FEATURE_ALIASES.get(featureId) ?? "");
|
|
37633
|
+
}
|
|
37634
|
+
var OrganizationModelSchema = OrganizationModelSchemaBase.superRefine((model, ctx) => {
|
|
37635
|
+
const featuresById = collectIds(model.features, ctx, ["features"], "Feature");
|
|
37636
|
+
model.features.forEach((feature, featureIndex) => {
|
|
37637
|
+
const segments = feature.id.split(".");
|
|
37638
|
+
if (segments.length > 1) {
|
|
37639
|
+
const parentId = segments.slice(0, -1).join(".");
|
|
37640
|
+
if (!featuresById.has(parentId)) {
|
|
37641
|
+
addIssue(
|
|
37642
|
+
ctx,
|
|
37643
|
+
["features", featureIndex, "id"],
|
|
37644
|
+
`Feature "${feature.id}" references unknown parent "${parentId}"`
|
|
37645
|
+
);
|
|
37646
|
+
}
|
|
37647
|
+
}
|
|
37648
|
+
const hasChildren = model.features.some(
|
|
37649
|
+
(candidate) => candidate.id.startsWith(`${feature.id}.`) && candidate.id !== feature.id
|
|
37650
|
+
);
|
|
37651
|
+
if (hasChildren && feature.enabled) {
|
|
37652
|
+
const hasEnabledDescendant = model.features.some(
|
|
37653
|
+
(candidate) => candidate.id.startsWith(`${feature.id}.`) && candidate.enabled
|
|
37654
|
+
);
|
|
37655
|
+
if (!hasEnabledDescendant) {
|
|
37656
|
+
addIssue(
|
|
37657
|
+
ctx,
|
|
37658
|
+
["features", featureIndex, "enabled"],
|
|
37659
|
+
`Feature "${feature.id}" is enabled but has no enabled descendants`
|
|
37660
|
+
);
|
|
37661
|
+
}
|
|
37662
|
+
}
|
|
37663
|
+
});
|
|
37664
|
+
const segmentsById = new Map(model.customers.segments.map((seg) => [seg.id, seg]));
|
|
37665
|
+
model.offerings.products.forEach((product, productIndex) => {
|
|
37666
|
+
product.targetSegmentIds.forEach((segmentId, segmentIndex) => {
|
|
37667
|
+
if (!segmentsById.has(segmentId)) {
|
|
37668
|
+
addIssue(
|
|
37669
|
+
ctx,
|
|
37670
|
+
["offerings", "products", productIndex, "targetSegmentIds", segmentIndex],
|
|
37671
|
+
`Product "${product.id}" references unknown customer segment "${segmentId}"`
|
|
37672
|
+
);
|
|
37673
|
+
}
|
|
37674
|
+
});
|
|
37675
|
+
if (product.deliveryFeatureId !== void 0 && !hasFeature(featuresById, product.deliveryFeatureId)) {
|
|
37676
|
+
addIssue(
|
|
37677
|
+
ctx,
|
|
37678
|
+
["offerings", "products", productIndex, "deliveryFeatureId"],
|
|
37679
|
+
`Product "${product.id}" references unknown delivery feature "${product.deliveryFeatureId}"`
|
|
37680
|
+
);
|
|
37681
|
+
}
|
|
37682
|
+
});
|
|
37683
|
+
model.goals.objectives.forEach((objective, index) => {
|
|
37684
|
+
if (objective.periodEnd <= objective.periodStart) {
|
|
37685
|
+
addIssue(
|
|
37686
|
+
ctx,
|
|
37687
|
+
["goals", "objectives", index, "periodEnd"],
|
|
37688
|
+
`Goal "${objective.id}" has periodEnd "${objective.periodEnd}" which must be strictly after periodStart "${objective.periodStart}"`
|
|
37689
|
+
);
|
|
37690
|
+
}
|
|
37691
|
+
});
|
|
37692
|
+
const rolesById = new Map(model.roles.roles.map((role) => [role.id, role]));
|
|
37693
|
+
model.roles.roles.forEach((role, roleIndex) => {
|
|
37694
|
+
if (role.reportsToId !== void 0 && !rolesById.has(role.reportsToId)) {
|
|
37695
|
+
addIssue(
|
|
37696
|
+
ctx,
|
|
37697
|
+
["roles", "roles", roleIndex, "reportsToId"],
|
|
37698
|
+
`Role "${role.id}" references unknown reportsToId "${role.reportsToId}"`
|
|
37699
|
+
);
|
|
37700
|
+
}
|
|
37701
|
+
});
|
|
37702
|
+
});
|
|
37703
|
+
|
|
37704
|
+
// ../core/src/organization-model/graph/schema.ts
|
|
37705
|
+
var OrganizationGraphNodeKindSchema = external_exports.enum([
|
|
37706
|
+
"organization",
|
|
37707
|
+
"feature",
|
|
37708
|
+
"surface",
|
|
37709
|
+
"entity",
|
|
37710
|
+
"capability",
|
|
37711
|
+
"resource",
|
|
37712
|
+
"knowledge"
|
|
37713
|
+
]);
|
|
37714
|
+
var OrganizationGraphEdgeKindSchema = external_exports.enum([
|
|
37715
|
+
"contains",
|
|
37716
|
+
"references",
|
|
37717
|
+
"exposes",
|
|
37718
|
+
"maps_to",
|
|
37719
|
+
"operates-on",
|
|
37720
|
+
"uses",
|
|
37721
|
+
"governs"
|
|
37722
|
+
]);
|
|
37723
|
+
var OrganizationGraphNodeSchema = external_exports.object({
|
|
37724
|
+
id: external_exports.string().trim().min(1).max(200),
|
|
37725
|
+
kind: OrganizationGraphNodeKindSchema,
|
|
37726
|
+
label: LabelSchema,
|
|
37727
|
+
sourceId: external_exports.string().trim().min(1).max(255).optional(),
|
|
37728
|
+
description: DescriptionSchema.optional(),
|
|
37729
|
+
icon: IconNameSchema.optional(),
|
|
37730
|
+
enabled: external_exports.boolean().optional(),
|
|
37731
|
+
featureId: external_exports.string().trim().min(1).max(100).optional(),
|
|
37732
|
+
resourceType: external_exports.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]).optional()
|
|
37733
|
+
});
|
|
37734
|
+
var OrganizationGraphEdgeSchema = external_exports.object({
|
|
37735
|
+
id: external_exports.string().trim().min(1).max(250),
|
|
37736
|
+
kind: OrganizationGraphEdgeKindSchema,
|
|
37737
|
+
sourceId: external_exports.string().trim().min(1).max(200),
|
|
37738
|
+
targetId: external_exports.string().trim().min(1).max(200),
|
|
37739
|
+
label: external_exports.string().trim().min(1).max(120).optional(),
|
|
37740
|
+
relationshipType: external_exports.enum(["triggers", "uses", "approval"]).optional()
|
|
37741
|
+
});
|
|
37742
|
+
var OrganizationGraphSchema = external_exports.object({
|
|
37743
|
+
version: external_exports.literal(1),
|
|
37744
|
+
organizationModelVersion: OrganizationModelSchema.shape.version,
|
|
37745
|
+
nodes: external_exports.array(OrganizationGraphNodeSchema),
|
|
37746
|
+
edges: external_exports.array(OrganizationGraphEdgeSchema)
|
|
37747
|
+
});
|
|
37748
|
+
var BuildOrganizationGraphInputSchema = external_exports.object({
|
|
37749
|
+
organizationModel: OrganizationModelSchema,
|
|
37750
|
+
commandViewData: external_exports.unknown().optional()
|
|
37751
|
+
});
|
|
37752
|
+
|
|
36613
37753
|
// ../core/src/platform/registry/reserved.ts
|
|
36614
37754
|
var RESERVED_RESOURCE_IDS = /* @__PURE__ */ new Set(["command-center-assistant"]);
|
|
36615
37755
|
var SYSTEM_RESOURCE_IDS = Array.from(RESERVED_RESOURCE_IDS);
|
|
@@ -39549,11 +40689,11 @@ function serializeOrganization(resources) {
|
|
|
39549
40689
|
}
|
|
39550
40690
|
function buildEdges(resources) {
|
|
39551
40691
|
const edges = [];
|
|
39552
|
-
let
|
|
40692
|
+
let edgeId2 = 0;
|
|
39553
40693
|
for (const [resourceId, declaration] of Object.entries(resources.relationships ?? {})) {
|
|
39554
40694
|
for (const agentId of declaration.triggers?.agents ?? []) {
|
|
39555
40695
|
edges.push({
|
|
39556
|
-
id: `edge-${
|
|
40696
|
+
id: `edge-${edgeId2++}`,
|
|
39557
40697
|
source: resourceId,
|
|
39558
40698
|
target: agentId,
|
|
39559
40699
|
relationship: "triggers"
|
|
@@ -39561,7 +40701,7 @@ function buildEdges(resources) {
|
|
|
39561
40701
|
}
|
|
39562
40702
|
for (const workflowId of declaration.triggers?.workflows ?? []) {
|
|
39563
40703
|
edges.push({
|
|
39564
|
-
id: `edge-${
|
|
40704
|
+
id: `edge-${edgeId2++}`,
|
|
39565
40705
|
source: resourceId,
|
|
39566
40706
|
target: workflowId,
|
|
39567
40707
|
relationship: "triggers"
|
|
@@ -39569,7 +40709,7 @@ function buildEdges(resources) {
|
|
|
39569
40709
|
}
|
|
39570
40710
|
for (const integrationId of declaration.uses?.integrations ?? []) {
|
|
39571
40711
|
edges.push({
|
|
39572
|
-
id: `edge-${
|
|
40712
|
+
id: `edge-${edgeId2++}`,
|
|
39573
40713
|
source: resourceId,
|
|
39574
40714
|
target: integrationId,
|
|
39575
40715
|
relationship: "uses"
|
|
@@ -39579,7 +40719,7 @@ function buildEdges(resources) {
|
|
|
39579
40719
|
for (const external of resources.externalResources ?? []) {
|
|
39580
40720
|
for (const workflowId of external.triggers?.workflows ?? []) {
|
|
39581
40721
|
edges.push({
|
|
39582
|
-
id: `edge-${
|
|
40722
|
+
id: `edge-${edgeId2++}`,
|
|
39583
40723
|
source: external.resourceId,
|
|
39584
40724
|
target: workflowId,
|
|
39585
40725
|
relationship: "triggers"
|
|
@@ -39587,7 +40727,7 @@ function buildEdges(resources) {
|
|
|
39587
40727
|
}
|
|
39588
40728
|
for (const agentId of external.triggers?.agents ?? []) {
|
|
39589
40729
|
edges.push({
|
|
39590
|
-
id: `edge-${
|
|
40730
|
+
id: `edge-${edgeId2++}`,
|
|
39591
40731
|
source: external.resourceId,
|
|
39592
40732
|
target: agentId,
|
|
39593
40733
|
relationship: "triggers"
|
|
@@ -39595,7 +40735,7 @@ function buildEdges(resources) {
|
|
|
39595
40735
|
}
|
|
39596
40736
|
for (const integrationId of external.uses?.integrations ?? []) {
|
|
39597
40737
|
edges.push({
|
|
39598
|
-
id: `edge-${
|
|
40738
|
+
id: `edge-${edgeId2++}`,
|
|
39599
40739
|
source: external.resourceId,
|
|
39600
40740
|
target: integrationId,
|
|
39601
40741
|
relationship: "uses"
|
|
@@ -39605,7 +40745,7 @@ function buildEdges(resources) {
|
|
|
39605
40745
|
for (const humanCheckpoint of resources.humanCheckpoints ?? []) {
|
|
39606
40746
|
for (const agentId of humanCheckpoint.requestedBy?.agents ?? []) {
|
|
39607
40747
|
edges.push({
|
|
39608
|
-
id: `edge-${
|
|
40748
|
+
id: `edge-${edgeId2++}`,
|
|
39609
40749
|
source: agentId,
|
|
39610
40750
|
target: humanCheckpoint.resourceId,
|
|
39611
40751
|
relationship: "approval"
|
|
@@ -39613,7 +40753,7 @@ function buildEdges(resources) {
|
|
|
39613
40753
|
}
|
|
39614
40754
|
for (const workflowId of humanCheckpoint.requestedBy?.workflows ?? []) {
|
|
39615
40755
|
edges.push({
|
|
39616
|
-
id: `edge-${
|
|
40756
|
+
id: `edge-${edgeId2++}`,
|
|
39617
40757
|
source: workflowId,
|
|
39618
40758
|
target: humanCheckpoint.resourceId,
|
|
39619
40759
|
relationship: "approval"
|
|
@@ -39621,7 +40761,7 @@ function buildEdges(resources) {
|
|
|
39621
40761
|
}
|
|
39622
40762
|
for (const agentId of humanCheckpoint.routesTo?.agents ?? []) {
|
|
39623
40763
|
edges.push({
|
|
39624
|
-
id: `edge-${
|
|
40764
|
+
id: `edge-${edgeId2++}`,
|
|
39625
40765
|
source: humanCheckpoint.resourceId,
|
|
39626
40766
|
target: agentId,
|
|
39627
40767
|
relationship: "triggers"
|
|
@@ -39629,7 +40769,7 @@ function buildEdges(resources) {
|
|
|
39629
40769
|
}
|
|
39630
40770
|
for (const workflowId of humanCheckpoint.routesTo?.workflows ?? []) {
|
|
39631
40771
|
edges.push({
|
|
39632
|
-
id: `edge-${
|
|
40772
|
+
id: `edge-${edgeId2++}`,
|
|
39633
40773
|
source: humanCheckpoint.resourceId,
|
|
39634
40774
|
target: workflowId,
|
|
39635
40775
|
relationship: "triggers"
|
|
@@ -40241,49 +41381,517 @@ var ResourceRegistry = class {
|
|
|
40241
41381
|
}
|
|
40242
41382
|
return cache.commandView;
|
|
40243
41383
|
}
|
|
40244
|
-
|
|
40245
|
-
|
|
40246
|
-
|
|
40247
|
-
|
|
40248
|
-
|
|
40249
|
-
|
|
40250
|
-
|
|
40251
|
-
|
|
40252
|
-
|
|
40253
|
-
|
|
40254
|
-
|
|
40255
|
-
|
|
41384
|
+
};
|
|
41385
|
+
|
|
41386
|
+
// ../core/src/organization-model/defaults.ts
|
|
41387
|
+
var DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE = {
|
|
41388
|
+
nodes: []
|
|
41389
|
+
};
|
|
41390
|
+
var DEFAULT_ORGANIZATION_MODEL = {
|
|
41391
|
+
version: 1,
|
|
41392
|
+
features: [
|
|
41393
|
+
{
|
|
41394
|
+
id: "dashboard",
|
|
41395
|
+
label: "Dashboard",
|
|
41396
|
+
enabled: true,
|
|
41397
|
+
path: "/",
|
|
41398
|
+
icon: "feature.dashboard",
|
|
41399
|
+
uiPosition: "sidebar-primary"
|
|
41400
|
+
},
|
|
41401
|
+
{
|
|
41402
|
+
id: "identity",
|
|
41403
|
+
label: "Identity",
|
|
41404
|
+
description: "Company identity, positioning, and market context",
|
|
41405
|
+
enabled: true,
|
|
41406
|
+
color: "indigo"
|
|
41407
|
+
},
|
|
41408
|
+
{
|
|
41409
|
+
id: "platform",
|
|
41410
|
+
label: "Platform",
|
|
41411
|
+
description: "Elevasis platform architecture, capabilities, and implementation patterns",
|
|
41412
|
+
enabled: true,
|
|
41413
|
+
color: "cyan",
|
|
41414
|
+
icon: "feature.platform"
|
|
41415
|
+
},
|
|
41416
|
+
{
|
|
41417
|
+
id: "finance",
|
|
41418
|
+
label: "Finance",
|
|
41419
|
+
description: "Finance operations, accounting, billing, reconciliation, and tax prep",
|
|
41420
|
+
enabled: true,
|
|
41421
|
+
color: "green",
|
|
41422
|
+
icon: "feature.finance"
|
|
41423
|
+
},
|
|
41424
|
+
{
|
|
41425
|
+
id: "sales",
|
|
41426
|
+
label: "Sales",
|
|
41427
|
+
description: "Revenue workflows and customer acquisition",
|
|
41428
|
+
enabled: true,
|
|
41429
|
+
color: "blue",
|
|
41430
|
+
icon: "feature.sales",
|
|
41431
|
+
uiPosition: "sidebar-primary"
|
|
41432
|
+
},
|
|
41433
|
+
{
|
|
41434
|
+
id: "sales.crm",
|
|
41435
|
+
label: "CRM",
|
|
41436
|
+
description: "Relationship pipeline and deal management",
|
|
41437
|
+
enabled: true,
|
|
41438
|
+
color: "blue",
|
|
41439
|
+
icon: "feature.crm",
|
|
41440
|
+
path: "/crm"
|
|
41441
|
+
},
|
|
41442
|
+
{
|
|
41443
|
+
id: "sales.lead-gen",
|
|
41444
|
+
label: "Lead Gen",
|
|
41445
|
+
description: "Prospecting, qualification, and outreach preparation",
|
|
41446
|
+
enabled: true,
|
|
41447
|
+
color: "cyan",
|
|
41448
|
+
icon: "feature.lead-gen",
|
|
41449
|
+
path: "/lead-gen"
|
|
41450
|
+
},
|
|
41451
|
+
{
|
|
41452
|
+
id: "projects",
|
|
41453
|
+
label: "Projects",
|
|
41454
|
+
description: "Projects, milestones, and client work execution",
|
|
41455
|
+
enabled: true,
|
|
41456
|
+
color: "orange",
|
|
41457
|
+
icon: "feature.projects",
|
|
41458
|
+
path: "/projects",
|
|
41459
|
+
uiPosition: "sidebar-primary"
|
|
41460
|
+
},
|
|
41461
|
+
{
|
|
41462
|
+
id: "operations",
|
|
41463
|
+
label: "Operations",
|
|
41464
|
+
description: "Operational resources, topology, and orchestration visibility",
|
|
41465
|
+
enabled: true,
|
|
41466
|
+
color: "violet",
|
|
41467
|
+
icon: "feature.operations",
|
|
41468
|
+
uiPosition: "sidebar-primary"
|
|
41469
|
+
},
|
|
41470
|
+
{
|
|
41471
|
+
id: "knowledge.command-view",
|
|
41472
|
+
label: "Command View",
|
|
41473
|
+
enabled: true,
|
|
41474
|
+
path: "/knowledge/command-view",
|
|
41475
|
+
devOnly: true
|
|
41476
|
+
},
|
|
41477
|
+
{
|
|
41478
|
+
id: "operations.overview",
|
|
41479
|
+
label: "Overview",
|
|
41480
|
+
enabled: true,
|
|
41481
|
+
path: "/operations"
|
|
41482
|
+
},
|
|
41483
|
+
{
|
|
41484
|
+
id: "operations.resources",
|
|
41485
|
+
label: "Resources",
|
|
41486
|
+
enabled: true,
|
|
41487
|
+
path: "/operations/resources"
|
|
41488
|
+
},
|
|
41489
|
+
{
|
|
41490
|
+
id: "operations.command-queue",
|
|
41491
|
+
label: "Command Queue",
|
|
41492
|
+
enabled: true,
|
|
41493
|
+
path: "/operations/command-queue"
|
|
41494
|
+
},
|
|
41495
|
+
{
|
|
41496
|
+
id: "operations.sessions",
|
|
41497
|
+
label: "Sessions",
|
|
41498
|
+
enabled: false,
|
|
41499
|
+
path: "/operations/sessions"
|
|
41500
|
+
},
|
|
41501
|
+
{
|
|
41502
|
+
id: "operations.task-scheduler",
|
|
41503
|
+
label: "Task Scheduler",
|
|
41504
|
+
enabled: true,
|
|
41505
|
+
path: "/operations/task-scheduler"
|
|
41506
|
+
},
|
|
41507
|
+
{
|
|
41508
|
+
id: "monitoring",
|
|
41509
|
+
label: "Monitoring",
|
|
41510
|
+
enabled: true,
|
|
41511
|
+
uiPosition: "sidebar-primary"
|
|
41512
|
+
},
|
|
41513
|
+
{
|
|
41514
|
+
id: "monitoring.activity-log",
|
|
41515
|
+
label: "Activity Log",
|
|
41516
|
+
enabled: true,
|
|
41517
|
+
path: "/monitoring/activity-log"
|
|
41518
|
+
},
|
|
41519
|
+
{
|
|
41520
|
+
id: "monitoring.execution-logs",
|
|
41521
|
+
label: "Execution Logs",
|
|
41522
|
+
enabled: true,
|
|
41523
|
+
path: "/monitoring/execution-logs"
|
|
41524
|
+
},
|
|
41525
|
+
{
|
|
41526
|
+
id: "monitoring.execution-health",
|
|
41527
|
+
label: "Execution Health",
|
|
41528
|
+
enabled: true,
|
|
41529
|
+
path: "/monitoring/execution-health"
|
|
41530
|
+
},
|
|
41531
|
+
{
|
|
41532
|
+
id: "monitoring.cost-analytics",
|
|
41533
|
+
label: "Cost Analytics",
|
|
41534
|
+
enabled: false,
|
|
41535
|
+
path: "/monitoring/cost-analytics"
|
|
41536
|
+
},
|
|
41537
|
+
{
|
|
41538
|
+
id: "monitoring.notifications",
|
|
41539
|
+
label: "Notifications",
|
|
41540
|
+
enabled: true,
|
|
41541
|
+
path: "/monitoring/notifications"
|
|
41542
|
+
},
|
|
41543
|
+
{
|
|
41544
|
+
id: "monitoring.submitted-requests",
|
|
41545
|
+
label: "Submitted Requests",
|
|
41546
|
+
enabled: true,
|
|
41547
|
+
path: "/monitoring/requests"
|
|
41548
|
+
},
|
|
41549
|
+
{
|
|
41550
|
+
id: "settings",
|
|
41551
|
+
label: "Settings",
|
|
41552
|
+
enabled: true,
|
|
41553
|
+
icon: "feature.settings",
|
|
41554
|
+
uiPosition: "sidebar-bottom"
|
|
41555
|
+
},
|
|
41556
|
+
{
|
|
41557
|
+
id: "settings.account",
|
|
41558
|
+
label: "Account",
|
|
41559
|
+
enabled: true,
|
|
41560
|
+
path: "/settings/account"
|
|
41561
|
+
},
|
|
41562
|
+
{
|
|
41563
|
+
id: "settings.appearance",
|
|
41564
|
+
label: "Appearance",
|
|
41565
|
+
enabled: true,
|
|
41566
|
+
path: "/settings/appearance"
|
|
41567
|
+
},
|
|
41568
|
+
{
|
|
41569
|
+
id: "settings.roles",
|
|
41570
|
+
label: "My Roles",
|
|
41571
|
+
enabled: true,
|
|
41572
|
+
path: "/settings/roles"
|
|
41573
|
+
},
|
|
41574
|
+
{
|
|
41575
|
+
id: "settings.organization",
|
|
41576
|
+
label: "Organization",
|
|
41577
|
+
enabled: true,
|
|
41578
|
+
path: "/settings/organization"
|
|
41579
|
+
},
|
|
41580
|
+
{
|
|
41581
|
+
id: "settings.credentials",
|
|
41582
|
+
label: "Credentials",
|
|
41583
|
+
enabled: true,
|
|
41584
|
+
path: "/settings/credentials"
|
|
41585
|
+
},
|
|
41586
|
+
{
|
|
41587
|
+
id: "settings.api-keys",
|
|
41588
|
+
label: "API Keys",
|
|
41589
|
+
enabled: true,
|
|
41590
|
+
path: "/settings/api-keys"
|
|
41591
|
+
},
|
|
41592
|
+
{
|
|
41593
|
+
id: "settings.webhooks",
|
|
41594
|
+
label: "Webhooks",
|
|
41595
|
+
enabled: true,
|
|
41596
|
+
path: "/settings/webhooks"
|
|
41597
|
+
},
|
|
41598
|
+
{
|
|
41599
|
+
id: "settings.deployments",
|
|
41600
|
+
label: "Deployments",
|
|
41601
|
+
enabled: true,
|
|
41602
|
+
path: "/settings/deployments"
|
|
41603
|
+
},
|
|
41604
|
+
{
|
|
41605
|
+
id: "admin",
|
|
41606
|
+
label: "Admin",
|
|
41607
|
+
enabled: true,
|
|
41608
|
+
path: "/admin",
|
|
41609
|
+
icon: "feature.admin",
|
|
41610
|
+
uiPosition: "sidebar-bottom",
|
|
41611
|
+
requiresAdmin: true
|
|
41612
|
+
},
|
|
41613
|
+
{
|
|
41614
|
+
id: "admin.system-health",
|
|
41615
|
+
label: "System Health",
|
|
41616
|
+
enabled: true,
|
|
41617
|
+
path: "/admin/system-health"
|
|
41618
|
+
},
|
|
41619
|
+
{
|
|
41620
|
+
id: "admin.organizations",
|
|
41621
|
+
label: "Organizations",
|
|
41622
|
+
enabled: true,
|
|
41623
|
+
path: "/admin/organizations"
|
|
41624
|
+
},
|
|
41625
|
+
{
|
|
41626
|
+
id: "admin.users",
|
|
41627
|
+
label: "Users",
|
|
41628
|
+
enabled: true,
|
|
41629
|
+
path: "/admin/users"
|
|
41630
|
+
},
|
|
41631
|
+
{
|
|
41632
|
+
id: "admin.design-showcase",
|
|
41633
|
+
label: "Design Showcase",
|
|
41634
|
+
enabled: true,
|
|
41635
|
+
path: "/admin/design-showcase"
|
|
41636
|
+
},
|
|
41637
|
+
{
|
|
41638
|
+
id: "admin.debug",
|
|
41639
|
+
label: "Debug",
|
|
41640
|
+
enabled: true,
|
|
41641
|
+
path: "/admin/debug"
|
|
41642
|
+
},
|
|
41643
|
+
{
|
|
41644
|
+
id: "archive",
|
|
41645
|
+
label: "Archive",
|
|
41646
|
+
enabled: true,
|
|
41647
|
+
path: "/archive",
|
|
41648
|
+
icon: "feature.archive",
|
|
41649
|
+
uiPosition: "sidebar-bottom",
|
|
41650
|
+
devOnly: true
|
|
41651
|
+
},
|
|
41652
|
+
{
|
|
41653
|
+
id: "archive.agent-chat",
|
|
41654
|
+
label: "Agent Chat",
|
|
41655
|
+
enabled: true,
|
|
41656
|
+
path: "/archive/agent-chat"
|
|
41657
|
+
},
|
|
41658
|
+
{
|
|
41659
|
+
id: "archive.execution-runner",
|
|
41660
|
+
label: "Execution Runner",
|
|
41661
|
+
enabled: true,
|
|
41662
|
+
path: "/archive/execution-runner"
|
|
41663
|
+
},
|
|
41664
|
+
{
|
|
41665
|
+
id: "seo",
|
|
41666
|
+
label: "SEO",
|
|
41667
|
+
enabled: false,
|
|
41668
|
+
path: "/seo"
|
|
41669
|
+
},
|
|
41670
|
+
{
|
|
41671
|
+
id: "knowledge",
|
|
41672
|
+
label: "Knowledge",
|
|
41673
|
+
description: "Operational knowledge, playbooks, and strategy docs",
|
|
41674
|
+
enabled: true,
|
|
41675
|
+
color: "teal",
|
|
41676
|
+
icon: "feature.knowledge",
|
|
41677
|
+
uiPosition: "sidebar-primary"
|
|
41678
|
+
},
|
|
41679
|
+
{
|
|
41680
|
+
id: "knowledge.base",
|
|
41681
|
+
label: "Knowledge Base",
|
|
41682
|
+
enabled: true,
|
|
41683
|
+
path: "/knowledge"
|
|
40256
41684
|
}
|
|
40257
|
-
|
|
40258
|
-
|
|
40259
|
-
|
|
40260
|
-
|
|
40261
|
-
|
|
40262
|
-
|
|
40263
|
-
|
|
40264
|
-
|
|
40265
|
-
|
|
40266
|
-
|
|
40267
|
-
|
|
40268
|
-
|
|
40269
|
-
|
|
40270
|
-
|
|
40271
|
-
|
|
40272
|
-
|
|
40273
|
-
|
|
40274
|
-
|
|
40275
|
-
|
|
40276
|
-
|
|
40277
|
-
|
|
40278
|
-
|
|
40279
|
-
|
|
40280
|
-
|
|
40281
|
-
|
|
40282
|
-
|
|
41685
|
+
],
|
|
41686
|
+
branding: DEFAULT_ORGANIZATION_MODEL_BRANDING,
|
|
41687
|
+
navigation: { surfaces: [], groups: [] },
|
|
41688
|
+
sales: DEFAULT_ORGANIZATION_MODEL_SALES,
|
|
41689
|
+
prospecting: DEFAULT_ORGANIZATION_MODEL_PROSPECTING,
|
|
41690
|
+
projects: DEFAULT_ORGANIZATION_MODEL_PROJECTS,
|
|
41691
|
+
identity: DEFAULT_ORGANIZATION_MODEL_IDENTITY,
|
|
41692
|
+
customers: DEFAULT_ORGANIZATION_MODEL_CUSTOMERS,
|
|
41693
|
+
offerings: DEFAULT_ORGANIZATION_MODEL_OFFERINGS,
|
|
41694
|
+
roles: DEFAULT_ORGANIZATION_MODEL_ROLES,
|
|
41695
|
+
goals: DEFAULT_ORGANIZATION_MODEL_GOALS,
|
|
41696
|
+
statuses: DEFAULT_ORGANIZATION_MODEL_STATUSES,
|
|
41697
|
+
operations: DEFAULT_ORGANIZATION_MODEL_OPERATIONS,
|
|
41698
|
+
knowledge: DEFAULT_ORGANIZATION_MODEL_KNOWLEDGE
|
|
41699
|
+
};
|
|
41700
|
+
|
|
41701
|
+
// ../core/src/organization-model/graph/build.ts
|
|
41702
|
+
function nodeId(kind, sourceId) {
|
|
41703
|
+
return kind === "organization" ? "organization-model" : `${kind}:${sourceId ?? ""}`;
|
|
41704
|
+
}
|
|
41705
|
+
function edgeId(kind, sourceId, targetId, variant) {
|
|
41706
|
+
return variant ? `edge:${kind}:${variant}:${sourceId}:${targetId}` : `edge:${kind}:${sourceId}:${targetId}`;
|
|
41707
|
+
}
|
|
41708
|
+
function pushUniqueNode(nodes, seen, node) {
|
|
41709
|
+
if (seen.has(node.id)) return;
|
|
41710
|
+
seen.add(node.id);
|
|
41711
|
+
nodes.push(node);
|
|
41712
|
+
}
|
|
41713
|
+
function pushUniqueEdge(edges, seen, edge) {
|
|
41714
|
+
if (seen.has(edge.id)) return;
|
|
41715
|
+
seen.add(edge.id);
|
|
41716
|
+
edges.push(edge);
|
|
41717
|
+
}
|
|
41718
|
+
function upsertResourceNode(nodes, seen, resourceNodesById, node) {
|
|
41719
|
+
const existing = resourceNodesById.get(node.id);
|
|
41720
|
+
if (existing) {
|
|
41721
|
+
if (!existing.label || existing.label === existing.sourceId) {
|
|
41722
|
+
existing.label = node.label;
|
|
41723
|
+
}
|
|
41724
|
+
if (!existing.description && node.description) {
|
|
41725
|
+
existing.description = node.description;
|
|
41726
|
+
}
|
|
41727
|
+
if (!existing.sourceId && node.sourceId) {
|
|
41728
|
+
existing.sourceId = node.sourceId;
|
|
41729
|
+
}
|
|
41730
|
+
if (!existing.resourceType && node.resourceType) {
|
|
41731
|
+
existing.resourceType = node.resourceType;
|
|
41732
|
+
}
|
|
41733
|
+
return existing;
|
|
41734
|
+
}
|
|
41735
|
+
resourceNodesById.set(node.id, node);
|
|
41736
|
+
pushUniqueNode(nodes, seen, node);
|
|
41737
|
+
return node;
|
|
41738
|
+
}
|
|
41739
|
+
function ensureResourceNode(nodes, seen, resourceNodesById, resourceId) {
|
|
41740
|
+
const existing = resourceNodesById.get(nodeId("resource", resourceId));
|
|
41741
|
+
if (existing) return existing;
|
|
41742
|
+
return upsertResourceNode(nodes, seen, resourceNodesById, {
|
|
41743
|
+
id: nodeId("resource", resourceId),
|
|
41744
|
+
kind: "resource",
|
|
41745
|
+
label: resourceId,
|
|
41746
|
+
sourceId: resourceId
|
|
41747
|
+
});
|
|
41748
|
+
}
|
|
41749
|
+
function normalizeCommandViewResourceType(resourceType) {
|
|
41750
|
+
return resourceType === "human" ? "human_checkpoint" : resourceType;
|
|
41751
|
+
}
|
|
41752
|
+
function collectCommandViewResources(commandViewData) {
|
|
41753
|
+
return [
|
|
41754
|
+
...commandViewData.workflows,
|
|
41755
|
+
...commandViewData.agents,
|
|
41756
|
+
...commandViewData.triggers,
|
|
41757
|
+
...commandViewData.integrations,
|
|
41758
|
+
...commandViewData.externalResources,
|
|
41759
|
+
...commandViewData.humanCheckpoints
|
|
41760
|
+
];
|
|
41761
|
+
}
|
|
41762
|
+
function pushResourceLinks(edges, edgeIds, resourceNodeId, links) {
|
|
41763
|
+
for (const link of links ?? []) {
|
|
41764
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41765
|
+
id: edgeId(link.kind, resourceNodeId, link.nodeId),
|
|
41766
|
+
kind: link.kind,
|
|
41767
|
+
sourceId: resourceNodeId,
|
|
41768
|
+
targetId: link.nodeId
|
|
40283
41769
|
});
|
|
40284
|
-
return results;
|
|
40285
41770
|
}
|
|
40286
|
-
}
|
|
41771
|
+
}
|
|
41772
|
+
function buildOrganizationGraph(input) {
|
|
41773
|
+
const parsed = BuildOrganizationGraphInputSchema.parse(input);
|
|
41774
|
+
const organizationModel = parsed.organizationModel;
|
|
41775
|
+
const commandViewData = parsed.commandViewData;
|
|
41776
|
+
const nodes = [];
|
|
41777
|
+
const edges = [];
|
|
41778
|
+
const nodeIds = /* @__PURE__ */ new Set();
|
|
41779
|
+
const edgeIds = /* @__PURE__ */ new Set();
|
|
41780
|
+
const resourceNodesById = /* @__PURE__ */ new Map();
|
|
41781
|
+
const organizationNode = {
|
|
41782
|
+
id: nodeId("organization"),
|
|
41783
|
+
kind: "organization",
|
|
41784
|
+
label: "Organization Model"
|
|
41785
|
+
};
|
|
41786
|
+
pushUniqueNode(nodes, nodeIds, organizationNode);
|
|
41787
|
+
for (const feature of [...organizationModel.features].sort((a, b) => a.id.localeCompare(b.id))) {
|
|
41788
|
+
const id = nodeId("feature", feature.id);
|
|
41789
|
+
pushUniqueNode(nodes, nodeIds, {
|
|
41790
|
+
id,
|
|
41791
|
+
kind: "feature",
|
|
41792
|
+
label: feature.label,
|
|
41793
|
+
sourceId: feature.id,
|
|
41794
|
+
description: feature.description,
|
|
41795
|
+
icon: feature.icon,
|
|
41796
|
+
enabled: feature.enabled,
|
|
41797
|
+
featureId: feature.id
|
|
41798
|
+
});
|
|
41799
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41800
|
+
id: edgeId("contains", organizationNode.id, id),
|
|
41801
|
+
kind: "contains",
|
|
41802
|
+
sourceId: organizationNode.id,
|
|
41803
|
+
targetId: id
|
|
41804
|
+
});
|
|
41805
|
+
const parentId = feature.id.includes(".") ? feature.id.slice(0, feature.id.lastIndexOf(".")) : void 0;
|
|
41806
|
+
if (parentId) {
|
|
41807
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41808
|
+
id: edgeId("contains", nodeId("feature", parentId), id),
|
|
41809
|
+
kind: "contains",
|
|
41810
|
+
sourceId: nodeId("feature", parentId),
|
|
41811
|
+
targetId: id
|
|
41812
|
+
});
|
|
41813
|
+
}
|
|
41814
|
+
}
|
|
41815
|
+
for (const node of [...organizationModel.knowledge?.nodes ?? []].sort((a, b) => a.id.localeCompare(b.id))) {
|
|
41816
|
+
const id = nodeId("knowledge", node.id);
|
|
41817
|
+
pushUniqueNode(nodes, nodeIds, {
|
|
41818
|
+
id,
|
|
41819
|
+
kind: "knowledge",
|
|
41820
|
+
label: node.title,
|
|
41821
|
+
sourceId: node.id,
|
|
41822
|
+
description: node.summary,
|
|
41823
|
+
icon: node.icon
|
|
41824
|
+
});
|
|
41825
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41826
|
+
id: edgeId("contains", organizationNode.id, id),
|
|
41827
|
+
kind: "contains",
|
|
41828
|
+
sourceId: organizationNode.id,
|
|
41829
|
+
targetId: id
|
|
41830
|
+
});
|
|
41831
|
+
for (const link of node.links) {
|
|
41832
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41833
|
+
id: edgeId("governs", id, link.nodeId),
|
|
41834
|
+
kind: "governs",
|
|
41835
|
+
sourceId: id,
|
|
41836
|
+
targetId: link.nodeId
|
|
41837
|
+
});
|
|
41838
|
+
}
|
|
41839
|
+
}
|
|
41840
|
+
if (commandViewData) {
|
|
41841
|
+
const commandViewResources = collectCommandViewResources(commandViewData).sort(
|
|
41842
|
+
(a, b) => a.resourceId.localeCompare(b.resourceId)
|
|
41843
|
+
);
|
|
41844
|
+
for (const resource of commandViewResources) {
|
|
41845
|
+
const id = nodeId("resource", resource.resourceId);
|
|
41846
|
+
const resourceNode = upsertResourceNode(nodes, nodeIds, resourceNodesById, {
|
|
41847
|
+
id,
|
|
41848
|
+
kind: "resource",
|
|
41849
|
+
label: resource.name,
|
|
41850
|
+
sourceId: resource.resourceId,
|
|
41851
|
+
description: resource.description,
|
|
41852
|
+
resourceType: normalizeCommandViewResourceType(resource.type)
|
|
41853
|
+
});
|
|
41854
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41855
|
+
id: edgeId("contains", organizationNode.id, resourceNode.id),
|
|
41856
|
+
kind: "contains",
|
|
41857
|
+
sourceId: organizationNode.id,
|
|
41858
|
+
targetId: resourceNode.id
|
|
41859
|
+
});
|
|
41860
|
+
pushResourceLinks(edges, edgeIds, resourceNode.id, resource.links);
|
|
41861
|
+
}
|
|
41862
|
+
for (const relationship of [...commandViewData.edges].sort((a, b) => a.id.localeCompare(b.id))) {
|
|
41863
|
+
const sourceNode = ensureResourceNode(nodes, nodeIds, resourceNodesById, relationship.source);
|
|
41864
|
+
const targetNode = ensureResourceNode(nodes, nodeIds, resourceNodesById, relationship.target);
|
|
41865
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41866
|
+
id: edgeId("contains", organizationNode.id, sourceNode.id),
|
|
41867
|
+
kind: "contains",
|
|
41868
|
+
sourceId: organizationNode.id,
|
|
41869
|
+
targetId: sourceNode.id
|
|
41870
|
+
});
|
|
41871
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41872
|
+
id: edgeId("contains", organizationNode.id, targetNode.id),
|
|
41873
|
+
kind: "contains",
|
|
41874
|
+
sourceId: organizationNode.id,
|
|
41875
|
+
targetId: targetNode.id
|
|
41876
|
+
});
|
|
41877
|
+
pushUniqueEdge(edges, edgeIds, {
|
|
41878
|
+
id: edgeId("references", sourceNode.id, targetNode.id, relationship.relationship),
|
|
41879
|
+
kind: "references",
|
|
41880
|
+
sourceId: sourceNode.id,
|
|
41881
|
+
targetId: targetNode.id,
|
|
41882
|
+
label: relationship.relationship,
|
|
41883
|
+
relationshipType: relationship.relationship
|
|
41884
|
+
});
|
|
41885
|
+
}
|
|
41886
|
+
}
|
|
41887
|
+
const graph = {
|
|
41888
|
+
version: 1,
|
|
41889
|
+
organizationModelVersion: organizationModel.version,
|
|
41890
|
+
nodes,
|
|
41891
|
+
edges
|
|
41892
|
+
};
|
|
41893
|
+
return OrganizationGraphSchema.parse(graph);
|
|
41894
|
+
}
|
|
40287
41895
|
|
|
40288
41896
|
// src/cli/config.ts
|
|
40289
41897
|
var import_fs = require("fs");
|
|
@@ -40481,7 +42089,7 @@ function wrapAction(commandName, fn) {
|
|
|
40481
42089
|
// package.json
|
|
40482
42090
|
var package_default = {
|
|
40483
42091
|
name: "@elevasis/sdk",
|
|
40484
|
-
version: "1.
|
|
42092
|
+
version: "1.16.0",
|
|
40485
42093
|
description: "SDK for building Elevasis organization resources",
|
|
40486
42094
|
type: "module",
|
|
40487
42095
|
bin: {
|
|
@@ -40499,6 +42107,10 @@ var package_default = {
|
|
|
40499
42107
|
"./test-utils": {
|
|
40500
42108
|
types: "./dist/test-utils/index.d.ts",
|
|
40501
42109
|
import: "./dist/test-utils/index.js"
|
|
42110
|
+
},
|
|
42111
|
+
"./node": {
|
|
42112
|
+
types: "./dist/node/index.d.ts",
|
|
42113
|
+
import: "./dist/node/index.js"
|
|
40502
42114
|
}
|
|
40503
42115
|
},
|
|
40504
42116
|
files: [
|
|
@@ -40510,10 +42122,12 @@ var package_default = {
|
|
|
40510
42122
|
"dist/types/worker/adapters/",
|
|
40511
42123
|
"dist/test-utils/index.js",
|
|
40512
42124
|
"dist/test-utils/index.d.ts",
|
|
42125
|
+
"dist/node/",
|
|
40513
42126
|
"dist/cli.cjs",
|
|
40514
42127
|
"reference/"
|
|
40515
42128
|
],
|
|
40516
42129
|
scripts: {
|
|
42130
|
+
lint: "eslint src --max-warnings 0",
|
|
40517
42131
|
build: `node -e "require('fs').rmSync('dist',{recursive:true,force:true})" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --banner:js="#!/usr/bin/env node" && node scripts/copy-reference-docs.mjs && node ../../scripts/monorepo/generate-reference-artifacts.js`,
|
|
40518
42132
|
"type-check": "tsc --noEmit",
|
|
40519
42133
|
"check-types": "pnpm type-check",
|
|
@@ -40521,13 +42135,16 @@ var package_default = {
|
|
|
40521
42135
|
"test:bundle": "pnpm test"
|
|
40522
42136
|
},
|
|
40523
42137
|
dependencies: {
|
|
40524
|
-
|
|
42138
|
+
"@mdx-js/mdx": "^3.1.1",
|
|
42139
|
+
esbuild: "^0.25.0",
|
|
42140
|
+
"remark-gfm": "^4.0.1"
|
|
40525
42141
|
},
|
|
40526
42142
|
peerDependencies: {
|
|
40527
42143
|
zod: "^4.1.0"
|
|
40528
42144
|
},
|
|
40529
42145
|
devDependencies: {
|
|
40530
42146
|
"@repo/core": "workspace:*",
|
|
42147
|
+
"@repo/eslint-config": "workspace:*",
|
|
40531
42148
|
"@repo/typescript-config": "workspace:*",
|
|
40532
42149
|
"@types/node": "^22.0.0",
|
|
40533
42150
|
chalk: "^5.3.0",
|
|
@@ -40551,6 +42168,70 @@ function getEsbuild() {
|
|
|
40551
42168
|
const consumerRequire = (0, import_module.createRequire)(resolvePackageRelative("package.json"));
|
|
40552
42169
|
return consumerRequire("esbuild");
|
|
40553
42170
|
}
|
|
42171
|
+
function resolveBareSpecifier(specifier, importer) {
|
|
42172
|
+
try {
|
|
42173
|
+
const importerRequire = (0, import_module.createRequire)(importer);
|
|
42174
|
+
return importerRequire.resolve(specifier);
|
|
42175
|
+
} catch {
|
|
42176
|
+
}
|
|
42177
|
+
const match = specifier.match(/^((?:@[^/]+\/)?[^/]+)(\/.*)?$/);
|
|
42178
|
+
if (!match) return null;
|
|
42179
|
+
const pkgName = match[1];
|
|
42180
|
+
const subpath = match[2] ? `.${match[2]}` : ".";
|
|
42181
|
+
let dir = (0, import_path2.dirname)(importer);
|
|
42182
|
+
while (true) {
|
|
42183
|
+
const candidate = (0, import_path2.resolve)(dir, "node_modules", pkgName, "package.json");
|
|
42184
|
+
if ((0, import_fs2.existsSync)(candidate)) {
|
|
42185
|
+
const pkgJson = JSON.parse((0, import_fs2.readFileSync)(candidate, "utf-8"));
|
|
42186
|
+
const exportsField = pkgJson.exports;
|
|
42187
|
+
if (!exportsField) return null;
|
|
42188
|
+
const target = pickExportsTarget(exportsField, subpath);
|
|
42189
|
+
if (target) {
|
|
42190
|
+
return (0, import_path2.resolve)((0, import_path2.dirname)(candidate), target);
|
|
42191
|
+
}
|
|
42192
|
+
return null;
|
|
42193
|
+
}
|
|
42194
|
+
const parent = (0, import_path2.dirname)(dir);
|
|
42195
|
+
if (parent === dir) return null;
|
|
42196
|
+
dir = parent;
|
|
42197
|
+
}
|
|
42198
|
+
}
|
|
42199
|
+
function pickExportsTarget(exportsField, subpath) {
|
|
42200
|
+
if (typeof exportsField === "string") {
|
|
42201
|
+
return subpath === "." ? exportsField : null;
|
|
42202
|
+
}
|
|
42203
|
+
const entry = exportsField[subpath];
|
|
42204
|
+
if (!entry) return null;
|
|
42205
|
+
if (typeof entry === "string") return entry;
|
|
42206
|
+
if (typeof entry === "object" && entry !== null) {
|
|
42207
|
+
const conditions = entry;
|
|
42208
|
+
for (const key of ["import", "default", "node", "require", "types"]) {
|
|
42209
|
+
const value = conditions[key];
|
|
42210
|
+
if (typeof value === "string") return value;
|
|
42211
|
+
if (value && typeof value === "object") {
|
|
42212
|
+
const nested = pickExportsTarget(value, ".");
|
|
42213
|
+
if (nested) return nested;
|
|
42214
|
+
}
|
|
42215
|
+
}
|
|
42216
|
+
}
|
|
42217
|
+
return null;
|
|
42218
|
+
}
|
|
42219
|
+
function createBundleWorkspaceTsPlugin() {
|
|
42220
|
+
return {
|
|
42221
|
+
name: "bundle-workspace-ts",
|
|
42222
|
+
setup(build) {
|
|
42223
|
+
build.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
42224
|
+
if (args.kind === "entry-point") return null;
|
|
42225
|
+
if (!args.importer) return null;
|
|
42226
|
+
const resolved = resolveBareSpecifier(args.path, args.importer);
|
|
42227
|
+
if (resolved && (0, import_path2.isAbsolute)(resolved) && /\.tsx?$/.test(resolved)) {
|
|
42228
|
+
return { path: resolved, external: false };
|
|
42229
|
+
}
|
|
42230
|
+
return null;
|
|
42231
|
+
});
|
|
42232
|
+
}
|
|
42233
|
+
};
|
|
42234
|
+
}
|
|
40554
42235
|
async function loadTsModule(filePath) {
|
|
40555
42236
|
const esbuild = getEsbuild();
|
|
40556
42237
|
const absPath = resolvePackageRelative(filePath);
|
|
@@ -40563,6 +42244,8 @@ async function loadTsModule(filePath) {
|
|
|
40563
42244
|
format: "esm",
|
|
40564
42245
|
outfile: tmpOut,
|
|
40565
42246
|
packages: "external",
|
|
42247
|
+
loader: { ".ts": "ts", ".tsx": "tsx" },
|
|
42248
|
+
plugins: [createBundleWorkspaceTsPlugin()],
|
|
40566
42249
|
logLevel: "silent"
|
|
40567
42250
|
});
|
|
40568
42251
|
const fileUrl = `file:///${tmpOut.replace(/\\/g, "/")}`;
|
|
@@ -40933,7 +42616,7 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
|
40933
42616
|
if (interrupted) {
|
|
40934
42617
|
return;
|
|
40935
42618
|
}
|
|
40936
|
-
await new Promise((
|
|
42619
|
+
await new Promise((resolve5) => setTimeout(resolve5, POLL_INTERVAL_MS));
|
|
40937
42620
|
if (interrupted) {
|
|
40938
42621
|
return;
|
|
40939
42622
|
}
|
|
@@ -41551,10 +43234,10 @@ Credential renamed successfully!`));
|
|
|
41551
43234
|
var import_readline = require("readline");
|
|
41552
43235
|
function confirm(message) {
|
|
41553
43236
|
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
41554
|
-
return new Promise((
|
|
43237
|
+
return new Promise((resolve5) => {
|
|
41555
43238
|
rl.question(message, (answer) => {
|
|
41556
43239
|
rl.close();
|
|
41557
|
-
|
|
43240
|
+
resolve5(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
41558
43241
|
});
|
|
41559
43242
|
});
|
|
41560
43243
|
}
|
|
@@ -42766,9 +44449,522 @@ function registerProjectCommands(program3) {
|
|
|
42766
44449
|
registerNoteDelete(program3);
|
|
42767
44450
|
}
|
|
42768
44451
|
|
|
42769
|
-
// src/
|
|
44452
|
+
// ../core/src/knowledge/queries.ts
|
|
44453
|
+
function toGraphNodeId(omNodeId) {
|
|
44454
|
+
return `knowledge:${omNodeId}`;
|
|
44455
|
+
}
|
|
44456
|
+
function buildKnowledgeSourceIdMap(graph) {
|
|
44457
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
44458
|
+
for (const node of graph.nodes) {
|
|
44459
|
+
if (node.kind === "knowledge" && node.sourceId) {
|
|
44460
|
+
map2.set(node.id, node.sourceId);
|
|
44461
|
+
}
|
|
44462
|
+
}
|
|
44463
|
+
return map2;
|
|
44464
|
+
}
|
|
44465
|
+
function byFeature(graph, featureId, knowledgeNodes) {
|
|
44466
|
+
const targetGraphNodeId = `feature:${featureId}`;
|
|
44467
|
+
const governingKnowledgeNodeIds = /* @__PURE__ */ new Set();
|
|
44468
|
+
for (const edge of graph.edges) {
|
|
44469
|
+
if (edge.kind === "governs" && edge.targetId === targetGraphNodeId && edge.sourceId.startsWith("knowledge:")) {
|
|
44470
|
+
governingKnowledgeNodeIds.add(edge.sourceId);
|
|
44471
|
+
}
|
|
44472
|
+
}
|
|
44473
|
+
const sourceIdMap = buildKnowledgeSourceIdMap(graph);
|
|
44474
|
+
const matchingOmIds = /* @__PURE__ */ new Set();
|
|
44475
|
+
for (const graphNodeId of governingKnowledgeNodeIds) {
|
|
44476
|
+
const omId = sourceIdMap.get(graphNodeId);
|
|
44477
|
+
if (omId) matchingOmIds.add(omId);
|
|
44478
|
+
}
|
|
44479
|
+
return knowledgeNodes.filter((n) => matchingOmIds.has(n.id));
|
|
44480
|
+
}
|
|
44481
|
+
function byKind(_graph, kind, knowledgeNodes) {
|
|
44482
|
+
return knowledgeNodes.filter((n) => n.kind === kind);
|
|
44483
|
+
}
|
|
44484
|
+
function byOwner(_graph, ownerId, knowledgeNodes) {
|
|
44485
|
+
return knowledgeNodes.filter((n) => n.ownerIds.includes(ownerId));
|
|
44486
|
+
}
|
|
44487
|
+
function governs(graph, nodeId2) {
|
|
44488
|
+
const graphNodeId = nodeId2.startsWith("knowledge:") ? nodeId2 : toGraphNodeId(nodeId2);
|
|
44489
|
+
const results = [];
|
|
44490
|
+
for (const edge of graph.edges) {
|
|
44491
|
+
if (edge.kind === "governs" && edge.sourceId === graphNodeId) {
|
|
44492
|
+
results.push(edge.targetId);
|
|
44493
|
+
}
|
|
44494
|
+
}
|
|
44495
|
+
return results;
|
|
44496
|
+
}
|
|
44497
|
+
function governedBy(graph, nodeId2) {
|
|
44498
|
+
const targetId = nodeId2.startsWith("feature:") || nodeId2.startsWith("knowledge:") || nodeId2.startsWith("resource:") ? nodeId2 : `feature:${nodeId2}`;
|
|
44499
|
+
const results = [];
|
|
44500
|
+
for (const edge of graph.edges) {
|
|
44501
|
+
if (edge.kind === "governs" && edge.targetId === targetId) {
|
|
44502
|
+
results.push(edge.sourceId);
|
|
44503
|
+
}
|
|
44504
|
+
}
|
|
44505
|
+
return results;
|
|
44506
|
+
}
|
|
44507
|
+
function parsePath(pathString) {
|
|
44508
|
+
if (!pathString || typeof pathString !== "string") {
|
|
44509
|
+
throw new Error("parsePath: path must be a non-empty string");
|
|
44510
|
+
}
|
|
44511
|
+
if (!pathString.startsWith("/")) {
|
|
44512
|
+
throw new Error(`parsePath: path must start with "/", got: "${pathString}"`);
|
|
44513
|
+
}
|
|
44514
|
+
const normalized = pathString.replace(/\/+$/, "");
|
|
44515
|
+
const segments = normalized.split("/").filter((s) => s.length > 0);
|
|
44516
|
+
if (segments.length === 0) {
|
|
44517
|
+
throw new Error(`parsePath: path resolves to root with no mount: "${pathString}"`);
|
|
44518
|
+
}
|
|
44519
|
+
const [first, ...rest] = segments;
|
|
44520
|
+
if (first === "by-feature") {
|
|
44521
|
+
if (rest.length === 0) {
|
|
44522
|
+
throw new Error(`parsePath: /by-feature requires a featureId argument, got: "${pathString}"`);
|
|
44523
|
+
}
|
|
44524
|
+
return { mount: "by-feature", args: [rest.join("/")] };
|
|
44525
|
+
}
|
|
44526
|
+
if (first === "by-kind") {
|
|
44527
|
+
if (rest.length === 0) {
|
|
44528
|
+
throw new Error(`parsePath: /by-kind requires a kind argument, got: "${pathString}"`);
|
|
44529
|
+
}
|
|
44530
|
+
return { mount: "by-kind", args: [rest[0]] };
|
|
44531
|
+
}
|
|
44532
|
+
if (first === "by-owner") {
|
|
44533
|
+
if (rest.length === 0) {
|
|
44534
|
+
throw new Error(`parsePath: /by-owner requires an ownerId argument, got: "${pathString}"`);
|
|
44535
|
+
}
|
|
44536
|
+
return { mount: "by-owner", args: [rest.join("/")] };
|
|
44537
|
+
}
|
|
44538
|
+
if (first === "graph") {
|
|
44539
|
+
if (rest.length < 2) {
|
|
44540
|
+
throw new Error(`parsePath: /graph requires <nodeId>/<verb> (governs|governed-by), got: "${pathString}"`);
|
|
44541
|
+
}
|
|
44542
|
+
const graphNodeId = rest.slice(0, -1).join("/");
|
|
44543
|
+
const verb = rest[rest.length - 1];
|
|
44544
|
+
if (verb !== "governs" && verb !== "governed-by") {
|
|
44545
|
+
throw new Error(
|
|
44546
|
+
`parsePath: /graph/<nodeId> verb must be "governs" or "governed-by", got: "${verb}" in "${pathString}"`
|
|
44547
|
+
);
|
|
44548
|
+
}
|
|
44549
|
+
return { mount: "graph", args: [graphNodeId, verb] };
|
|
44550
|
+
}
|
|
44551
|
+
if (segments.length === 1) {
|
|
44552
|
+
return { mount: "node", args: [first] };
|
|
44553
|
+
}
|
|
44554
|
+
throw new Error(
|
|
44555
|
+
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-feature/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>`
|
|
44556
|
+
);
|
|
44557
|
+
}
|
|
44558
|
+
|
|
44559
|
+
// ../core/src/knowledge/format.ts
|
|
44560
|
+
function formatText(results) {
|
|
44561
|
+
if (results.length === 0) {
|
|
44562
|
+
return "(no results)";
|
|
44563
|
+
}
|
|
44564
|
+
const kindWidth = Math.max(...results.map((n) => n.kind.length), 8);
|
|
44565
|
+
const idWidth = Math.max(...results.map((n) => n.id.length), 4);
|
|
44566
|
+
const header = `${"KIND".padEnd(kindWidth)} ${"ID".padEnd(idWidth)} TITLE`;
|
|
44567
|
+
const divider = "-".repeat(header.length + 20);
|
|
44568
|
+
const rows = results.map((n) => {
|
|
44569
|
+
const summary = n.summary.length > 80 ? n.summary.slice(0, 77) + "..." : n.summary;
|
|
44570
|
+
return `${n.kind.padEnd(kindWidth)} ${n.id.padEnd(idWidth)} ${n.title} \u2014 ${summary}`;
|
|
44571
|
+
});
|
|
44572
|
+
return [header, divider, ...rows].join("\n");
|
|
44573
|
+
}
|
|
44574
|
+
function formatJson(input) {
|
|
44575
|
+
const envelope = {
|
|
44576
|
+
path: input.path,
|
|
44577
|
+
mount: input.parsed.mount,
|
|
44578
|
+
args: input.parsed.args,
|
|
44579
|
+
results: input.results
|
|
44580
|
+
};
|
|
44581
|
+
return JSON.stringify(envelope, null, 2);
|
|
44582
|
+
}
|
|
44583
|
+
function formatIdsOnly(results) {
|
|
44584
|
+
if (results.length === 0) return "";
|
|
44585
|
+
const ids = results.map((r) => typeof r === "string" ? r : r.id);
|
|
44586
|
+
return ids.join("\n");
|
|
44587
|
+
}
|
|
44588
|
+
|
|
44589
|
+
// src/cli/commands/knowledge/load-org-model.ts
|
|
44590
|
+
var import_path3 = require("path");
|
|
44591
|
+
var import_fs3 = require("fs");
|
|
44592
|
+
var import_module2 = require("module");
|
|
44593
|
+
var ORG_MODEL_REL_PATH = "core/config/organization-model.ts";
|
|
44594
|
+
function getEsbuild2(startDir) {
|
|
44595
|
+
const consumerRequire = (0, import_module2.createRequire)((0, import_path3.resolve)(startDir, "package.json"));
|
|
44596
|
+
return consumerRequire("esbuild");
|
|
44597
|
+
}
|
|
44598
|
+
async function loadOrgModel(projectRoot) {
|
|
44599
|
+
const orgModelPath = (0, import_path3.resolve)(projectRoot, ORG_MODEL_REL_PATH);
|
|
44600
|
+
if (!(0, import_fs3.existsSync)(orgModelPath)) {
|
|
44601
|
+
return DEFAULT_ORGANIZATION_MODEL;
|
|
44602
|
+
}
|
|
44603
|
+
let pkgDir = projectRoot;
|
|
44604
|
+
while (!(0, import_fs3.existsSync)((0, import_path3.resolve)(pkgDir, "package.json"))) {
|
|
44605
|
+
const parent = (0, import_path3.resolve)(pkgDir, "..");
|
|
44606
|
+
if (parent === pkgDir) break;
|
|
44607
|
+
pkgDir = parent;
|
|
44608
|
+
}
|
|
44609
|
+
let esbuild;
|
|
44610
|
+
try {
|
|
44611
|
+
esbuild = getEsbuild2(pkgDir);
|
|
44612
|
+
} catch {
|
|
44613
|
+
return DEFAULT_ORGANIZATION_MODEL;
|
|
44614
|
+
}
|
|
44615
|
+
const tmpOut = (0, import_path3.resolve)(projectRoot, `.elevasis-knowledge-tmp-${Date.now()}.mjs`);
|
|
44616
|
+
try {
|
|
44617
|
+
await esbuild.build({
|
|
44618
|
+
entryPoints: [orgModelPath],
|
|
44619
|
+
bundle: true,
|
|
44620
|
+
platform: "node",
|
|
44621
|
+
format: "esm",
|
|
44622
|
+
outfile: tmpOut,
|
|
44623
|
+
packages: "external",
|
|
44624
|
+
logLevel: "silent"
|
|
44625
|
+
});
|
|
44626
|
+
const fileUrl = `file:///${tmpOut.replace(/\\/g, "/")}`;
|
|
44627
|
+
const mod = await import(fileUrl);
|
|
44628
|
+
const model = mod["organizationModel"] ?? mod["canonicalOrganizationModel"] ?? mod["default"];
|
|
44629
|
+
if (model && typeof model === "object" && "features" in model) {
|
|
44630
|
+
return model;
|
|
44631
|
+
}
|
|
44632
|
+
} catch {
|
|
44633
|
+
} finally {
|
|
44634
|
+
try {
|
|
44635
|
+
const { unlinkSync: unlinkSync3 } = await import("fs");
|
|
44636
|
+
unlinkSync3(tmpOut);
|
|
44637
|
+
} catch {
|
|
44638
|
+
}
|
|
44639
|
+
}
|
|
44640
|
+
return DEFAULT_ORGANIZATION_MODEL;
|
|
44641
|
+
}
|
|
44642
|
+
|
|
44643
|
+
// src/cli/commands/knowledge/ls.ts
|
|
44644
|
+
function registerKnowledgeLs(program3) {
|
|
44645
|
+
program3.command("knowledge:ls <path>").description(
|
|
44646
|
+
"List knowledge nodes for a Knowledge Map path\n Examples:\n elevasis-sdk knowledge:ls /by-kind/playbook\n elevasis-sdk knowledge:ls /by-feature/sales.crm\n elevasis-sdk knowledge:ls /by-owner/role.ops-lead\n elevasis-sdk knowledge:ls /graph/knowledge.outreach-playbook/governs\n elevasis-sdk knowledge:ls /graph/feature:sales.crm/governed-by"
|
|
44647
|
+
).option("--json", "Print wrapped JSON envelope { path, mount, args, results }").option("--ids-only", "Print one ID per line (for piping)").action(
|
|
44648
|
+
wrapAction("knowledge:ls", async (pathArg, options) => {
|
|
44649
|
+
let parsed;
|
|
44650
|
+
try {
|
|
44651
|
+
parsed = parsePath(pathArg);
|
|
44652
|
+
} catch (err) {
|
|
44653
|
+
process.stderr.write(`knowledge:ls: invalid path: ${err instanceof Error ? err.message : String(err)}
|
|
44654
|
+
`);
|
|
44655
|
+
process.exit(1);
|
|
44656
|
+
}
|
|
44657
|
+
const projectRoot = getProjectRoot();
|
|
44658
|
+
const model = await loadOrgModel(projectRoot);
|
|
44659
|
+
const graph = buildOrganizationGraph({ organizationModel: model });
|
|
44660
|
+
const knowledgeNodes = model.knowledge?.nodes ?? [];
|
|
44661
|
+
let results;
|
|
44662
|
+
switch (parsed.mount) {
|
|
44663
|
+
case "by-feature": {
|
|
44664
|
+
const featureId = parsed.args[0].replace(/\//g, ".");
|
|
44665
|
+
results = byFeature(graph, featureId, knowledgeNodes);
|
|
44666
|
+
break;
|
|
44667
|
+
}
|
|
44668
|
+
case "by-kind": {
|
|
44669
|
+
const kind = parsed.args[0];
|
|
44670
|
+
results = byKind(graph, kind, knowledgeNodes);
|
|
44671
|
+
break;
|
|
44672
|
+
}
|
|
44673
|
+
case "by-owner": {
|
|
44674
|
+
const ownerId = parsed.args[0];
|
|
44675
|
+
results = byOwner(graph, ownerId, knowledgeNodes);
|
|
44676
|
+
break;
|
|
44677
|
+
}
|
|
44678
|
+
case "graph": {
|
|
44679
|
+
const nodeId2 = parsed.args[0];
|
|
44680
|
+
const verb = parsed.args[1];
|
|
44681
|
+
if (verb === "governs") {
|
|
44682
|
+
results = governs(graph, nodeId2);
|
|
44683
|
+
} else {
|
|
44684
|
+
results = governedBy(graph, nodeId2);
|
|
44685
|
+
}
|
|
44686
|
+
break;
|
|
44687
|
+
}
|
|
44688
|
+
case "node": {
|
|
44689
|
+
const nodeId2 = parsed.args[0];
|
|
44690
|
+
const node = knowledgeNodes.find((n) => n.id === nodeId2);
|
|
44691
|
+
results = node ? [node] : [];
|
|
44692
|
+
break;
|
|
44693
|
+
}
|
|
44694
|
+
default: {
|
|
44695
|
+
results = [];
|
|
44696
|
+
}
|
|
44697
|
+
}
|
|
44698
|
+
if (options.json) {
|
|
44699
|
+
process.stdout.write(formatJson({ path: pathArg, parsed, results }) + "\n");
|
|
44700
|
+
} else if (options.idsOnly) {
|
|
44701
|
+
const out = formatIdsOnly(results);
|
|
44702
|
+
if (out) process.stdout.write(out + "\n");
|
|
44703
|
+
} else {
|
|
44704
|
+
process.stdout.write(formatText(results) + "\n");
|
|
44705
|
+
}
|
|
44706
|
+
})
|
|
44707
|
+
);
|
|
44708
|
+
}
|
|
44709
|
+
|
|
44710
|
+
// src/cli/commands/knowledge/cat.ts
|
|
44711
|
+
function registerKnowledgeCat(program3) {
|
|
44712
|
+
program3.command("knowledge:cat <id>").description(
|
|
44713
|
+
"Print the raw MDX body of a knowledge node\n Example: elevasis-sdk knowledge:cat knowledge.outreach-playbook\n Use --json for structured output"
|
|
44714
|
+
).option("--json", "Return structured JSON: { id, kind, title, summary, body, links, ownerIds, updatedAt }").action(
|
|
44715
|
+
wrapAction("knowledge:cat", async (id, options) => {
|
|
44716
|
+
const projectRoot = getProjectRoot();
|
|
44717
|
+
const model = await loadOrgModel(projectRoot);
|
|
44718
|
+
const knowledgeNodes = model.knowledge?.nodes ?? [];
|
|
44719
|
+
const node = knowledgeNodes.find((n) => n.id === id);
|
|
44720
|
+
if (!node) {
|
|
44721
|
+
process.stderr.write(`knowledge:cat: node not found: "${id}"
|
|
44722
|
+
`);
|
|
44723
|
+
process.exit(1);
|
|
44724
|
+
}
|
|
44725
|
+
if (options.json) {
|
|
44726
|
+
process.stdout.write(
|
|
44727
|
+
JSON.stringify(
|
|
44728
|
+
{
|
|
44729
|
+
id: node.id,
|
|
44730
|
+
kind: node.kind,
|
|
44731
|
+
title: node.title,
|
|
44732
|
+
summary: node.summary,
|
|
44733
|
+
body: node.body,
|
|
44734
|
+
links: node.links,
|
|
44735
|
+
ownerIds: node.ownerIds,
|
|
44736
|
+
updatedAt: node.updatedAt
|
|
44737
|
+
},
|
|
44738
|
+
null,
|
|
44739
|
+
2
|
|
44740
|
+
) + "\n"
|
|
44741
|
+
);
|
|
44742
|
+
} else {
|
|
44743
|
+
process.stdout.write(node.body + "\n");
|
|
44744
|
+
}
|
|
44745
|
+
})
|
|
44746
|
+
);
|
|
44747
|
+
}
|
|
44748
|
+
|
|
44749
|
+
// src/cli/commands/knowledge/graph.ts
|
|
44750
|
+
function registerKnowledgeGraph(program3) {
|
|
44751
|
+
program3.command("knowledge:graph <id>").description(
|
|
44752
|
+
"Show outgoing and incoming edges for a knowledge node\n Example: elevasis-sdk knowledge:graph knowledge.outreach-playbook\n Accepts bare OM node id or graph node id (knowledge:<id>)"
|
|
44753
|
+
).option("--json", "Print JSON: { nodeId, outgoing: string[], incoming: string[] }").option("--ids-only", "Print one edge ID per line (outgoing first, then incoming)").action(
|
|
44754
|
+
wrapAction("knowledge:graph", async (id, options) => {
|
|
44755
|
+
const projectRoot = getProjectRoot();
|
|
44756
|
+
const model = await loadOrgModel(projectRoot);
|
|
44757
|
+
const graph = buildOrganizationGraph({ organizationModel: model });
|
|
44758
|
+
const outgoing = governs(graph, id);
|
|
44759
|
+
const incoming = governedBy(graph, id);
|
|
44760
|
+
if (options.json) {
|
|
44761
|
+
process.stdout.write(
|
|
44762
|
+
JSON.stringify(
|
|
44763
|
+
{
|
|
44764
|
+
nodeId: id,
|
|
44765
|
+
outgoing,
|
|
44766
|
+
incoming
|
|
44767
|
+
},
|
|
44768
|
+
null,
|
|
44769
|
+
2
|
|
44770
|
+
) + "\n"
|
|
44771
|
+
);
|
|
44772
|
+
} else if (options.idsOnly) {
|
|
44773
|
+
const lines = [...outgoing, ...incoming];
|
|
44774
|
+
if (lines.length > 0) {
|
|
44775
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
44776
|
+
}
|
|
44777
|
+
} else {
|
|
44778
|
+
const nodeLabel = id.startsWith("knowledge:") ? id : `knowledge:${id}`;
|
|
44779
|
+
const lines = [`Graph edges for ${nodeLabel}`, ""];
|
|
44780
|
+
if (outgoing.length === 0 && incoming.length === 0) {
|
|
44781
|
+
lines.push(" (no edges)");
|
|
44782
|
+
} else {
|
|
44783
|
+
lines.push(`Outgoing (governs) \u2014 ${outgoing.length} edge${outgoing.length !== 1 ? "s" : ""}`);
|
|
44784
|
+
if (outgoing.length === 0) {
|
|
44785
|
+
lines.push(" (none)");
|
|
44786
|
+
} else {
|
|
44787
|
+
for (const t of outgoing) {
|
|
44788
|
+
lines.push(` -> ${t}`);
|
|
44789
|
+
}
|
|
44790
|
+
}
|
|
44791
|
+
lines.push("");
|
|
44792
|
+
lines.push(`Incoming (governed-by) \u2014 ${incoming.length} edge${incoming.length !== 1 ? "s" : ""}`);
|
|
44793
|
+
if (incoming.length === 0) {
|
|
44794
|
+
lines.push(" (none)");
|
|
44795
|
+
} else {
|
|
44796
|
+
for (const s of incoming) {
|
|
44797
|
+
lines.push(` <- ${s}`);
|
|
44798
|
+
}
|
|
44799
|
+
}
|
|
44800
|
+
}
|
|
44801
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
44802
|
+
}
|
|
44803
|
+
})
|
|
44804
|
+
);
|
|
44805
|
+
}
|
|
44806
|
+
|
|
44807
|
+
// src/cli/commands/knowledge/generate.ts
|
|
44808
|
+
var import_node_fs3 = require("node:fs");
|
|
44809
|
+
var import_node_path3 = require("node:path");
|
|
44810
|
+
|
|
44811
|
+
// src/knowledge-codegen.ts
|
|
42770
44812
|
var import_node_fs2 = require("node:fs");
|
|
42771
44813
|
var import_node_path2 = require("node:path");
|
|
44814
|
+
function listMdxFiles(directory) {
|
|
44815
|
+
return (0, import_node_fs2.readdirSync)(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
44816
|
+
const path3 = (0, import_node_path2.join)(directory, entry.name);
|
|
44817
|
+
if (entry.isDirectory()) return listMdxFiles(path3);
|
|
44818
|
+
return entry.isFile() && (0, import_node_path2.extname)(entry.name) === ".mdx" ? [path3] : [];
|
|
44819
|
+
});
|
|
44820
|
+
}
|
|
44821
|
+
function parseScalar(value) {
|
|
44822
|
+
const trimmed = value.trim();
|
|
44823
|
+
const quoted = trimmed.match(/^['"]([\s\S]*)['"]$/);
|
|
44824
|
+
return quoted ? quoted[1] : trimmed;
|
|
44825
|
+
}
|
|
44826
|
+
function parseFrontmatter(raw, filePath) {
|
|
44827
|
+
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
44828
|
+
if (!match) throw new Error(`[knowledge-node-codegen] Missing frontmatter in ${filePath}`);
|
|
44829
|
+
const frontmatter = {};
|
|
44830
|
+
const lines = match[1].split(/\r?\n/);
|
|
44831
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
44832
|
+
const line = lines[index];
|
|
44833
|
+
if (!line.trim()) continue;
|
|
44834
|
+
const pair = line.match(/^([A-Za-z][A-Za-z0-9]*):(?:\s*(.*))?$/);
|
|
44835
|
+
if (!pair) throw new Error(`[knowledge-node-codegen] Invalid frontmatter line in ${filePath}: ${line}`);
|
|
44836
|
+
const key = pair[1];
|
|
44837
|
+
const inlineValue = pair[2]?.trim() ?? "";
|
|
44838
|
+
if (inlineValue) {
|
|
44839
|
+
frontmatter[key] = parseScalar(inlineValue);
|
|
44840
|
+
continue;
|
|
44841
|
+
}
|
|
44842
|
+
const values = [];
|
|
44843
|
+
while (index + 1 < lines.length && /^\s+-\s+/.test(lines[index + 1])) {
|
|
44844
|
+
index += 1;
|
|
44845
|
+
values.push(parseScalar(lines[index].replace(/^\s+-\s+/, "")));
|
|
44846
|
+
}
|
|
44847
|
+
frontmatter[key] = values;
|
|
44848
|
+
}
|
|
44849
|
+
return { frontmatter, body: match[2].trim() };
|
|
44850
|
+
}
|
|
44851
|
+
function assertString(frontmatter, key, filePath) {
|
|
44852
|
+
const value = frontmatter[key];
|
|
44853
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
44854
|
+
throw new Error(`[knowledge-node-codegen] ${filePath} frontmatter requires string "${key}"`);
|
|
44855
|
+
}
|
|
44856
|
+
return value.trim();
|
|
44857
|
+
}
|
|
44858
|
+
function optionalString(frontmatter, key, filePath) {
|
|
44859
|
+
const value = frontmatter[key];
|
|
44860
|
+
if (value === void 0) return void 0;
|
|
44861
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
44862
|
+
throw new Error(`[knowledge-node-codegen] ${filePath} frontmatter "${key}" must be a nonempty string`);
|
|
44863
|
+
}
|
|
44864
|
+
return value.trim();
|
|
44865
|
+
}
|
|
44866
|
+
function assertKind(value, filePath) {
|
|
44867
|
+
if (value === "playbook" || value === "strategy" || value === "reference") return value;
|
|
44868
|
+
throw new Error(`[knowledge-node-codegen] ${filePath} has invalid kind "${value}"`);
|
|
44869
|
+
}
|
|
44870
|
+
function optionalStringArray(frontmatter, key, filePath) {
|
|
44871
|
+
const value = frontmatter[key];
|
|
44872
|
+
if (value === void 0) return [];
|
|
44873
|
+
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) {
|
|
44874
|
+
throw new Error(`[knowledge-node-codegen] ${filePath} frontmatter "${key}" must be a string array`);
|
|
44875
|
+
}
|
|
44876
|
+
return value.map((entry) => entry.trim()).filter(Boolean);
|
|
44877
|
+
}
|
|
44878
|
+
function readKnowledgeNodeMdx(filePath) {
|
|
44879
|
+
const raw = (0, import_node_fs2.readFileSync)(filePath, "utf8");
|
|
44880
|
+
const { frontmatter, body } = parseFrontmatter(raw, filePath);
|
|
44881
|
+
return {
|
|
44882
|
+
id: assertString(frontmatter, "id", filePath),
|
|
44883
|
+
kind: assertKind(assertString(frontmatter, "kind", filePath), filePath),
|
|
44884
|
+
title: assertString(frontmatter, "title", filePath),
|
|
44885
|
+
summary: assertString(frontmatter, "description", filePath),
|
|
44886
|
+
icon: optionalString(frontmatter, "icon", filePath),
|
|
44887
|
+
body,
|
|
44888
|
+
links: optionalStringArray(frontmatter, "links", filePath).map((nodeId2) => ({ nodeId: nodeId2 })),
|
|
44889
|
+
ownerIds: optionalStringArray(frontmatter, "ownerIds", filePath),
|
|
44890
|
+
updatedAt: assertString(frontmatter, "updatedAt", filePath)
|
|
44891
|
+
};
|
|
44892
|
+
}
|
|
44893
|
+
function generateKnowledgeNodesTs(options) {
|
|
44894
|
+
const exportedName = options.exportedName ?? "mdxKnowledgeNodes";
|
|
44895
|
+
const typeImport = options.typeImportPath ? [`import type { OrgKnowledgeNode } from '${options.typeImportPath}'`, ""] : [];
|
|
44896
|
+
const typeSatisfies = options.typeImportPath ? " satisfies OrgKnowledgeNode[]" : "";
|
|
44897
|
+
return [
|
|
44898
|
+
"// @generated by generate-knowledge-nodes -- DO NOT EDIT",
|
|
44899
|
+
"// Regenerate: elevasis-sdk knowledge:generate",
|
|
44900
|
+
`// Source: ${options.sourceLabel ?? "knowledge/nodes/**/*.mdx"}`,
|
|
44901
|
+
"",
|
|
44902
|
+
...typeImport,
|
|
44903
|
+
`export const ${exportedName} = ${JSON.stringify(options.nodes, null, 2)}${typeSatisfies}`,
|
|
44904
|
+
""
|
|
44905
|
+
].join("\n");
|
|
44906
|
+
}
|
|
44907
|
+
function generateKnowledgeNodes(options) {
|
|
44908
|
+
const files = listMdxFiles(options.sourceDir).sort(
|
|
44909
|
+
(a, b) => (0, import_node_path2.relative)(options.sourceDir, a).localeCompare((0, import_node_path2.relative)(options.sourceDir, b))
|
|
44910
|
+
);
|
|
44911
|
+
const nodes = files.map(readKnowledgeNodeMdx);
|
|
44912
|
+
const ids = /* @__PURE__ */ new Set();
|
|
44913
|
+
for (const node of nodes) {
|
|
44914
|
+
if (ids.has(node.id)) throw new Error(`[knowledge-node-codegen] Duplicate knowledge node id: ${node.id}`);
|
|
44915
|
+
ids.add(node.id);
|
|
44916
|
+
}
|
|
44917
|
+
(0, import_node_fs2.mkdirSync)((0, import_node_path2.dirname)(options.outputPath), { recursive: true });
|
|
44918
|
+
(0, import_node_fs2.writeFileSync)(
|
|
44919
|
+
options.outputPath,
|
|
44920
|
+
generateKnowledgeNodesTs({
|
|
44921
|
+
nodes,
|
|
44922
|
+
typeImportPath: options.typeImportPath,
|
|
44923
|
+
exportedName: options.exportedName,
|
|
44924
|
+
sourceLabel: options.sourceLabel
|
|
44925
|
+
}),
|
|
44926
|
+
"utf8"
|
|
44927
|
+
);
|
|
44928
|
+
return { nodes, outputPath: options.outputPath };
|
|
44929
|
+
}
|
|
44930
|
+
|
|
44931
|
+
// src/cli/commands/knowledge/generate.ts
|
|
44932
|
+
function registerKnowledgeGenerate(program3) {
|
|
44933
|
+
program3.command("knowledge:generate").description(
|
|
44934
|
+
"Generate OrganizationModel knowledge nodes from MDX source files\n Example: elevasis-sdk knowledge:generate"
|
|
44935
|
+
).option("--source <path>", "MDX source directory relative to project root", "core/config/knowledge/nodes").option("--output <path>", "Generated TS file relative to project root", "core/config/knowledge/_generated/nodes.ts").action(
|
|
44936
|
+
wrapAction("knowledge:generate", async (options) => {
|
|
44937
|
+
const projectRoot = getProjectRoot();
|
|
44938
|
+
const sourceDir = (0, import_node_path3.resolve)(projectRoot, options.source ?? "core/config/knowledge/nodes");
|
|
44939
|
+
const outputPath = (0, import_node_path3.resolve)(projectRoot, options.output ?? "core/config/knowledge/_generated/nodes.ts");
|
|
44940
|
+
if (!(0, import_node_fs3.existsSync)(sourceDir)) {
|
|
44941
|
+
process.stderr.write(`knowledge:generate: source directory not found: ${sourceDir}
|
|
44942
|
+
`);
|
|
44943
|
+
process.exitCode = 1;
|
|
44944
|
+
return;
|
|
44945
|
+
}
|
|
44946
|
+
const result = generateKnowledgeNodes({
|
|
44947
|
+
sourceDir,
|
|
44948
|
+
outputPath,
|
|
44949
|
+
sourceLabel: options.source ?? "core/config/knowledge/nodes"
|
|
44950
|
+
});
|
|
44951
|
+
process.stdout.write(`Generated ${result.nodes.length} knowledge node(s): ${result.outputPath}
|
|
44952
|
+
`);
|
|
44953
|
+
})
|
|
44954
|
+
);
|
|
44955
|
+
}
|
|
44956
|
+
|
|
44957
|
+
// src/cli/commands/knowledge/index.ts
|
|
44958
|
+
function registerKnowledgeCommands(program3) {
|
|
44959
|
+
registerKnowledgeGenerate(program3);
|
|
44960
|
+
registerKnowledgeLs(program3);
|
|
44961
|
+
registerKnowledgeCat(program3);
|
|
44962
|
+
registerKnowledgeGraph(program3);
|
|
44963
|
+
}
|
|
44964
|
+
|
|
44965
|
+
// src/cli/commands/request/request.ts
|
|
44966
|
+
var import_node_fs4 = require("node:fs");
|
|
44967
|
+
var import_node_path4 = require("node:path");
|
|
42772
44968
|
|
|
42773
44969
|
// ../core/src/requests/api-schemas.ts
|
|
42774
44970
|
var RequestSeverityEnum = external_exports.enum(["critical", "warning", "info"]);
|
|
@@ -42829,7 +45025,7 @@ function registerRequestCommands(program3) {
|
|
|
42829
45025
|
throw new Error("Provide --input <json> or --input-file <path>");
|
|
42830
45026
|
}
|
|
42831
45027
|
const resolvedInputFile = options.inputFile ? resolveProjectRelative(options.inputFile) : void 0;
|
|
42832
|
-
const raw = resolvedInputFile ? JSON.parse((0,
|
|
45028
|
+
const raw = resolvedInputFile ? JSON.parse((0, import_node_fs4.readFileSync)(resolvedInputFile, "utf8")) : JSON.parse(options.input);
|
|
42833
45029
|
const parsed = CreateRequestInputSchema.safeParse(raw);
|
|
42834
45030
|
if (!parsed.success) {
|
|
42835
45031
|
const issues = parsed.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
@@ -42850,10 +45046,10 @@ ${issues}`);
|
|
|
42850
45046
|
console.log(JSON.stringify(result, null, 2));
|
|
42851
45047
|
}
|
|
42852
45048
|
if (options.cleanupInput && resolvedInputFile) {
|
|
42853
|
-
const tmpDir = (0,
|
|
45049
|
+
const tmpDir = (0, import_node_path4.join)(getProjectRoot(), "tmp");
|
|
42854
45050
|
if (resolvedInputFile.startsWith(tmpDir + "/") || resolvedInputFile.startsWith(tmpDir + "\\")) {
|
|
42855
45051
|
try {
|
|
42856
|
-
(0,
|
|
45052
|
+
(0, import_node_fs4.unlinkSync)(resolvedInputFile);
|
|
42857
45053
|
} catch {
|
|
42858
45054
|
}
|
|
42859
45055
|
} else {
|
|
@@ -42869,8 +45065,8 @@ ${issues}`);
|
|
|
42869
45065
|
|
|
42870
45066
|
// src/cli/commands/ui/ui-switcher.ts
|
|
42871
45067
|
var import_node_child_process = require("node:child_process");
|
|
42872
|
-
var
|
|
42873
|
-
var
|
|
45068
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
45069
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
42874
45070
|
function run(command, args, cwd) {
|
|
42875
45071
|
(0, import_node_child_process.execFileSync)(command, args, {
|
|
42876
45072
|
cwd,
|
|
@@ -42879,10 +45075,10 @@ function run(command, args, cwd) {
|
|
|
42879
45075
|
});
|
|
42880
45076
|
}
|
|
42881
45077
|
function readJson(filePath) {
|
|
42882
|
-
return JSON.parse(
|
|
45078
|
+
return JSON.parse(import_node_fs5.default.readFileSync(filePath, "utf8"));
|
|
42883
45079
|
}
|
|
42884
45080
|
function writeJson(filePath, value) {
|
|
42885
|
-
|
|
45081
|
+
import_node_fs5.default.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
42886
45082
|
`);
|
|
42887
45083
|
}
|
|
42888
45084
|
function requireDependencies(packageJson, filePath) {
|
|
@@ -42892,8 +45088,8 @@ function requireDependencies(packageJson, filePath) {
|
|
|
42892
45088
|
return packageJson.dependencies;
|
|
42893
45089
|
}
|
|
42894
45090
|
function resolveExistingDir(label, dir) {
|
|
42895
|
-
const resolved =
|
|
42896
|
-
if (!
|
|
45091
|
+
const resolved = import_node_path5.default.resolve(dir);
|
|
45092
|
+
if (!import_node_fs5.default.existsSync(resolved) || !import_node_fs5.default.statSync(resolved).isDirectory()) {
|
|
42897
45093
|
throw new Error(`${label} not found: ${resolved}`);
|
|
42898
45094
|
}
|
|
42899
45095
|
return resolved;
|
|
@@ -42901,8 +45097,8 @@ function resolveExistingDir(label, dir) {
|
|
|
42901
45097
|
function findRepoRootFromProject(projectRoot) {
|
|
42902
45098
|
let dir = projectRoot;
|
|
42903
45099
|
while (true) {
|
|
42904
|
-
if (
|
|
42905
|
-
const parent =
|
|
45100
|
+
if (import_node_fs5.default.existsSync(import_node_path5.default.join(dir, "packages", "ui", "package.json"))) return dir;
|
|
45101
|
+
const parent = import_node_path5.default.dirname(dir);
|
|
42906
45102
|
if (parent === dir) return null;
|
|
42907
45103
|
dir = parent;
|
|
42908
45104
|
}
|
|
@@ -42915,13 +45111,13 @@ function resolveUiPackageRoot(projectRoot, explicitRoot) {
|
|
|
42915
45111
|
"Could not find packages/ui from this Elevasis project. Pass --ui-package-root <path> from a monorepo checkout."
|
|
42916
45112
|
);
|
|
42917
45113
|
}
|
|
42918
|
-
return
|
|
45114
|
+
return import_node_path5.default.join(repoRoot, "packages", "ui");
|
|
42919
45115
|
}
|
|
42920
45116
|
function removeLocalUiTarballs(templateTmpDir) {
|
|
42921
|
-
if (!
|
|
42922
|
-
for (const entry of
|
|
45117
|
+
if (!import_node_fs5.default.existsSync(templateTmpDir)) return;
|
|
45118
|
+
for (const entry of import_node_fs5.default.readdirSync(templateTmpDir)) {
|
|
42923
45119
|
if (entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz")) {
|
|
42924
|
-
|
|
45120
|
+
import_node_fs5.default.rmSync(import_node_path5.default.join(templateTmpDir, entry), { force: true });
|
|
42925
45121
|
}
|
|
42926
45122
|
}
|
|
42927
45123
|
}
|
|
@@ -42941,29 +45137,29 @@ function useLocalUi(options = {}) {
|
|
|
42941
45137
|
const projectRoot = getProjectRoot();
|
|
42942
45138
|
const repoRoot = findRepoRootFromProject(projectRoot);
|
|
42943
45139
|
const uiPackageRoot = resolveUiPackageRoot(projectRoot, options.uiPackageRoot);
|
|
42944
|
-
const commandRoot = repoRoot ??
|
|
42945
|
-
const templateUiPackageJsonPath =
|
|
42946
|
-
const templateTmpDir =
|
|
42947
|
-
const uiPackageJsonPath =
|
|
42948
|
-
const uiPackageBackupPath =
|
|
42949
|
-
if (!
|
|
45140
|
+
const commandRoot = repoRoot ?? import_node_path5.default.dirname(import_node_path5.default.dirname(uiPackageRoot));
|
|
45141
|
+
const templateUiPackageJsonPath = import_node_path5.default.join(projectRoot, "ui", "package.json");
|
|
45142
|
+
const templateTmpDir = import_node_path5.default.join(projectRoot, "tmp");
|
|
45143
|
+
const uiPackageJsonPath = import_node_path5.default.join(uiPackageRoot, "package.json");
|
|
45144
|
+
const uiPackageBackupPath = import_node_path5.default.join(uiPackageRoot, "package.json.local-pack.bak");
|
|
45145
|
+
if (!import_node_fs5.default.existsSync(templateUiPackageJsonPath)) {
|
|
42950
45146
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
42951
45147
|
}
|
|
42952
|
-
|
|
45148
|
+
import_node_fs5.default.mkdirSync(templateTmpDir, { recursive: true });
|
|
42953
45149
|
removeLocalUiTarballs(templateTmpDir);
|
|
42954
45150
|
run("pnpm", ["--filter", "@repo/ui", "build:publish"], commandRoot);
|
|
42955
45151
|
try {
|
|
42956
|
-
const raw =
|
|
42957
|
-
|
|
45152
|
+
const raw = import_node_fs5.default.readFileSync(uiPackageJsonPath, "utf8");
|
|
45153
|
+
import_node_fs5.default.writeFileSync(uiPackageBackupPath, raw);
|
|
42958
45154
|
writeJson(uiPackageJsonPath, prepareUiPackageForPack(JSON.parse(raw)));
|
|
42959
45155
|
run("pnpm", ["-C", uiPackageRoot, "pack", "--pack-destination", templateTmpDir], commandRoot);
|
|
42960
45156
|
} finally {
|
|
42961
|
-
if (
|
|
42962
|
-
|
|
42963
|
-
|
|
45157
|
+
if (import_node_fs5.default.existsSync(uiPackageBackupPath)) {
|
|
45158
|
+
import_node_fs5.default.copyFileSync(uiPackageBackupPath, uiPackageJsonPath);
|
|
45159
|
+
import_node_fs5.default.rmSync(uiPackageBackupPath, { force: true });
|
|
42964
45160
|
}
|
|
42965
45161
|
}
|
|
42966
|
-
const tarballName =
|
|
45162
|
+
const tarballName = import_node_fs5.default.readdirSync(templateTmpDir).find((entry) => entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz"));
|
|
42967
45163
|
if (!tarballName) {
|
|
42968
45164
|
throw new Error(`Failed to create local @elevasis/ui tarball in ${templateTmpDir}`);
|
|
42969
45165
|
}
|
|
@@ -42971,20 +45167,20 @@ function useLocalUi(options = {}) {
|
|
|
42971
45167
|
requireDependencies(templateUiPackageJson, templateUiPackageJsonPath)["@elevasis/ui"] = `file:../tmp/${tarballName}`;
|
|
42972
45168
|
writeJson(templateUiPackageJsonPath, templateUiPackageJson);
|
|
42973
45169
|
run("pnpm", ["-C", projectRoot, "install"], commandRoot);
|
|
42974
|
-
console.log(`${
|
|
45170
|
+
console.log(`${import_node_path5.default.basename(projectRoot)}/ui now uses local @elevasis/ui tarball: ${tarballName}`);
|
|
42975
45171
|
}
|
|
42976
45172
|
function usePublishedUi(options = {}) {
|
|
42977
45173
|
const projectRoot = getProjectRoot();
|
|
42978
45174
|
const repoRoot = findRepoRootFromProject(projectRoot);
|
|
42979
45175
|
const commandRoot = repoRoot ?? projectRoot;
|
|
42980
|
-
const templateUiPackageJsonPath =
|
|
42981
|
-
const templateTmpDir =
|
|
45176
|
+
const templateUiPackageJsonPath = import_node_path5.default.join(projectRoot, "ui", "package.json");
|
|
45177
|
+
const templateTmpDir = import_node_path5.default.join(projectRoot, "tmp");
|
|
42982
45178
|
const uiPackageRoot = options.version ? void 0 : resolveUiPackageRoot(projectRoot, options.uiPackageRoot);
|
|
42983
|
-
const uiVersion = options.version ?? readJson(
|
|
45179
|
+
const uiVersion = options.version ?? readJson(import_node_path5.default.join(uiPackageRoot, "package.json")).version;
|
|
42984
45180
|
if (!uiVersion) {
|
|
42985
45181
|
throw new Error("Could not determine @elevasis/ui version. Pass --version <version>.");
|
|
42986
45182
|
}
|
|
42987
|
-
if (!
|
|
45183
|
+
if (!import_node_fs5.default.existsSync(templateUiPackageJsonPath)) {
|
|
42988
45184
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
42989
45185
|
}
|
|
42990
45186
|
const templateUiPackageJson = readJson(templateUiPackageJsonPath);
|
|
@@ -42992,7 +45188,7 @@ function usePublishedUi(options = {}) {
|
|
|
42992
45188
|
writeJson(templateUiPackageJsonPath, templateUiPackageJson);
|
|
42993
45189
|
removeLocalUiTarballs(templateTmpDir);
|
|
42994
45190
|
run("pnpm", ["-C", projectRoot, "install"], commandRoot);
|
|
42995
|
-
console.log(`${
|
|
45191
|
+
console.log(`${import_node_path5.default.basename(projectRoot)}/ui restored to published @elevasis/ui ^${uiVersion}`);
|
|
42996
45192
|
}
|
|
42997
45193
|
|
|
42998
45194
|
// src/cli/commands/ui/ui.ts
|
|
@@ -43010,8 +45206,8 @@ function registerUiCommands(program3) {
|
|
|
43010
45206
|
}
|
|
43011
45207
|
|
|
43012
45208
|
// src/cli/commands/doctor.ts
|
|
43013
|
-
var
|
|
43014
|
-
var
|
|
45209
|
+
var import_node_fs6 = require("node:fs");
|
|
45210
|
+
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
43015
45211
|
function ok(label, detail) {
|
|
43016
45212
|
console.log(`${source_default.green("[OK]")} ${source_default.bold(label)}: ${detail}`);
|
|
43017
45213
|
}
|
|
@@ -43047,8 +45243,8 @@ function registerDoctorCommand(program3) {
|
|
|
43047
45243
|
printSummary(failCount);
|
|
43048
45244
|
process.exit(1);
|
|
43049
45245
|
}
|
|
43050
|
-
const envPath2 =
|
|
43051
|
-
const envExists = (0,
|
|
45246
|
+
const envPath2 = import_node_path6.default.join(projectRoot, ".env");
|
|
45247
|
+
const envExists = (0, import_node_fs6.existsSync)(envPath2);
|
|
43052
45248
|
if (!envExists) {
|
|
43053
45249
|
fail(".env", `Not found at ${envPath2}. Create it from .env.example and fill in ELEVASIS_PLATFORM_KEY.`);
|
|
43054
45250
|
if (isVerbose) verbose(`Checked: ${envPath2}`);
|
|
@@ -43137,7 +45333,7 @@ function printSummary(failCount) {
|
|
|
43137
45333
|
|
|
43138
45334
|
// src/cli/index.ts
|
|
43139
45335
|
var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
43140
|
-
var LOCAL_PROJECT_COMMANDS = /* @__PURE__ */ new Set(["ui:use-local", "ui:use-published"]);
|
|
45336
|
+
var LOCAL_PROJECT_COMMANDS = /* @__PURE__ */ new Set(["ui:use-local", "ui:use-published", "knowledge:generate"]);
|
|
43141
45337
|
function shouldSkipPreflight() {
|
|
43142
45338
|
const args = process.argv.slice(2);
|
|
43143
45339
|
if (args.length === 0) return true;
|
|
@@ -43159,8 +45355,8 @@ function runPreflight() {
|
|
|
43159
45355
|
process.exit(1);
|
|
43160
45356
|
}
|
|
43161
45357
|
if (isLocalProjectCommand()) return;
|
|
43162
|
-
const envPath2 = (0,
|
|
43163
|
-
if (!(0,
|
|
45358
|
+
const envPath2 = (0, import_path4.join)(projectRoot, ".env");
|
|
45359
|
+
if (!(0, import_fs4.existsSync)(envPath2)) {
|
|
43164
45360
|
process.stderr.write(source_default.red(`No \`.env\` found at \`${envPath2}\`. Set \`ELEVASIS_PLATFORM_KEY\`.
|
|
43165
45361
|
`));
|
|
43166
45362
|
process.stderr.write(
|
|
@@ -43199,6 +45395,10 @@ Commands:
|
|
|
43199
45395
|
elevasis-sdk project:list [--search <query>] List projects with optional search
|
|
43200
45396
|
elevasis-sdk project:resolve <query> Resolve a project ID from a name or UUID
|
|
43201
45397
|
elevasis-sdk project:work <query> Open a lifecycle-aware project work brief
|
|
45398
|
+
elevasis-sdk knowledge:generate Generate knowledge nodes from MDX files
|
|
45399
|
+
elevasis-sdk knowledge:ls <path> List knowledge nodes for a path
|
|
45400
|
+
elevasis-sdk knowledge:cat <id> Print raw MDX body of a knowledge node
|
|
45401
|
+
elevasis-sdk knowledge:graph <id> Show outgoing and incoming edges for a node
|
|
43202
45402
|
elevasis-sdk request:submit -f <path> Submit a structured request report
|
|
43203
45403
|
elevasis-sdk ui:use-local Use a local @elevasis/ui tarball
|
|
43204
45404
|
elevasis-sdk ui:use-published Restore published @elevasis/ui
|
|
@@ -43222,6 +45422,7 @@ registerCredsCommand(program2);
|
|
|
43222
45422
|
registerErrorCommand(program2);
|
|
43223
45423
|
registerRenameCommand(program2);
|
|
43224
45424
|
registerProjectCommands(program2);
|
|
45425
|
+
registerKnowledgeCommands(program2);
|
|
43225
45426
|
registerRequestCommands(program2);
|
|
43226
45427
|
registerUiCommands(program2);
|
|
43227
45428
|
registerDoctorCommand(program2);
|