@c4a/core 0.4.12-alpha.2 → 0.4.12-beta.7
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/index.js +349 -34
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7000,6 +7000,7 @@ var RelationType;
|
|
|
7000
7000
|
RelationType2["Triggers"] = "TRIGGERS";
|
|
7001
7001
|
RelationType2["References"] = "REFERENCES";
|
|
7002
7002
|
RelationType2["Corresponds"] = "CORRESPONDS";
|
|
7003
|
+
RelationType2["Mentions"] = "MENTIONS";
|
|
7003
7004
|
})(RelationType ||= {});
|
|
7004
7005
|
var AtomField;
|
|
7005
7006
|
((AtomField2) => {
|
|
@@ -7017,6 +7018,7 @@ var AtomField;
|
|
|
7017
7018
|
AtomField2["Constraints"] = "constraints";
|
|
7018
7019
|
AtomField2["Comparisons"] = "comparisons";
|
|
7019
7020
|
AtomField2["Boundaries"] = "boundaries";
|
|
7021
|
+
AtomField2["Claims"] = "claims";
|
|
7020
7022
|
})(AtomField ||= {});
|
|
7021
7023
|
var Kind;
|
|
7022
7024
|
((Kind2) => {
|
|
@@ -7029,11 +7031,123 @@ var Perspective;
|
|
|
7029
7031
|
Perspective2["Business"] = "business";
|
|
7030
7032
|
Perspective2["Technical"] = "technical";
|
|
7031
7033
|
})(Perspective ||= {});
|
|
7034
|
+
// src/types/edgeSyncRules.ts
|
|
7035
|
+
var EDGE_SYNC_RULES = [
|
|
7036
|
+
{
|
|
7037
|
+
field: "container_id",
|
|
7038
|
+
sourceEntityType: "component" /* Component */,
|
|
7039
|
+
edgeType: "CONTAINS" /* Contains */,
|
|
7040
|
+
direction: "reverse",
|
|
7041
|
+
writeGraph: true
|
|
7042
|
+
},
|
|
7043
|
+
{
|
|
7044
|
+
field: "system_id",
|
|
7045
|
+
sourceEntityType: "container" /* Container */,
|
|
7046
|
+
edgeType: "CONTAINS" /* Contains */,
|
|
7047
|
+
direction: "reverse",
|
|
7048
|
+
writeGraph: true
|
|
7049
|
+
},
|
|
7050
|
+
{
|
|
7051
|
+
field: "ref_sor",
|
|
7052
|
+
sourceEntityType: "sor" /* SoR */,
|
|
7053
|
+
edgeType: "REFERENCES" /* References */,
|
|
7054
|
+
direction: "forward",
|
|
7055
|
+
writeGraph: true
|
|
7056
|
+
},
|
|
7057
|
+
{
|
|
7058
|
+
field: "product_refs",
|
|
7059
|
+
sourceEntityType: "epic" /* Epic */,
|
|
7060
|
+
edgeType: "REFERENCES" /* References */,
|
|
7061
|
+
direction: "forward",
|
|
7062
|
+
writeGraph: true
|
|
7063
|
+
},
|
|
7064
|
+
{
|
|
7065
|
+
field: "atoms.entities.ref",
|
|
7066
|
+
sourceEntityType: "any",
|
|
7067
|
+
edgeType: "MENTIONS" /* Mentions */,
|
|
7068
|
+
direction: "forward",
|
|
7069
|
+
writeGraph: true
|
|
7070
|
+
},
|
|
7071
|
+
{
|
|
7072
|
+
field: "atoms.behaviors.ref",
|
|
7073
|
+
sourceEntityType: "any",
|
|
7074
|
+
edgeType: "MENTIONS" /* Mentions */,
|
|
7075
|
+
direction: "forward",
|
|
7076
|
+
writeGraph: true
|
|
7077
|
+
},
|
|
7078
|
+
{
|
|
7079
|
+
field: "product_id",
|
|
7080
|
+
sourceEntityType: "sor" /* SoR */,
|
|
7081
|
+
edgeType: null,
|
|
7082
|
+
direction: "forward",
|
|
7083
|
+
writeGraph: false
|
|
7084
|
+
},
|
|
7085
|
+
{
|
|
7086
|
+
field: "process_id",
|
|
7087
|
+
sourceEntityType: "sor" /* SoR */,
|
|
7088
|
+
edgeType: "PRODUCES" /* Produces */,
|
|
7089
|
+
direction: "reverse",
|
|
7090
|
+
writeGraph: true
|
|
7091
|
+
}
|
|
7092
|
+
];
|
|
7093
|
+
// src/types/refPointer.ts
|
|
7094
|
+
var REF_POINTER_PATTERN = /^ref:(entity|relation|content):(.+)$/;
|
|
7095
|
+
function parseRef(pointer) {
|
|
7096
|
+
const match = REF_POINTER_PATTERN.exec(pointer);
|
|
7097
|
+
if (!match) {
|
|
7098
|
+
return null;
|
|
7099
|
+
}
|
|
7100
|
+
const [, type, id] = match;
|
|
7101
|
+
if (!id) {
|
|
7102
|
+
return null;
|
|
7103
|
+
}
|
|
7104
|
+
return { type, id };
|
|
7105
|
+
}
|
|
7106
|
+
function buildRef(type, id) {
|
|
7107
|
+
return `ref:${type}:${id}`;
|
|
7108
|
+
}
|
|
7109
|
+
function isRefPointer(value) {
|
|
7110
|
+
return typeof value === "string" && parseRef(value) !== null;
|
|
7111
|
+
}
|
|
7112
|
+
function extractAllRefs(data) {
|
|
7113
|
+
const results = [];
|
|
7114
|
+
const visit = (value, path) => {
|
|
7115
|
+
if (typeof value === "string") {
|
|
7116
|
+
if (isRefPointer(value)) {
|
|
7117
|
+
results.push({ pointer: value, fieldPath: path });
|
|
7118
|
+
}
|
|
7119
|
+
return;
|
|
7120
|
+
}
|
|
7121
|
+
if (Array.isArray(value)) {
|
|
7122
|
+
value.forEach((item, index) => {
|
|
7123
|
+
const nextPath = path ? `${path}[${index}]` : `[${index}]`;
|
|
7124
|
+
visit(item, nextPath);
|
|
7125
|
+
});
|
|
7126
|
+
return;
|
|
7127
|
+
}
|
|
7128
|
+
if (value && typeof value === "object") {
|
|
7129
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
7130
|
+
const nextPath = path ? `${path}.${key}` : key;
|
|
7131
|
+
visit(entry, nextPath);
|
|
7132
|
+
}
|
|
7133
|
+
}
|
|
7134
|
+
};
|
|
7135
|
+
visit(data, "");
|
|
7136
|
+
return results;
|
|
7137
|
+
}
|
|
7032
7138
|
// src/types/serverConfig.ts
|
|
7033
7139
|
var DEFAULT_SERVER_CONFIG = {
|
|
7034
7140
|
server: {
|
|
7035
7141
|
port: 5100,
|
|
7036
|
-
host: "
|
|
7142
|
+
host: "::"
|
|
7143
|
+
},
|
|
7144
|
+
git_hosts: [],
|
|
7145
|
+
daemon_scheduler: {
|
|
7146
|
+
enabled: true,
|
|
7147
|
+
host: "localhost",
|
|
7148
|
+
port: 5110,
|
|
7149
|
+
workspace: "./data/daemon-workspace",
|
|
7150
|
+
max_daemons: 20
|
|
7037
7151
|
},
|
|
7038
7152
|
doc_db: {
|
|
7039
7153
|
provider: "sqlite",
|
|
@@ -7041,7 +7155,7 @@ var DEFAULT_SERVER_CONFIG = {
|
|
|
7041
7155
|
path: "./data/c4a.db"
|
|
7042
7156
|
},
|
|
7043
7157
|
mongodb: {
|
|
7044
|
-
uri: "mongodb://localhost:27017/c4a",
|
|
7158
|
+
uri: "mongodb://localhost:27017/c4a?directConnection=true",
|
|
7045
7159
|
database: "c4a"
|
|
7046
7160
|
}
|
|
7047
7161
|
},
|
|
@@ -7057,6 +7171,9 @@ var DEFAULT_SERVER_CONFIG = {
|
|
|
7057
7171
|
username: "root",
|
|
7058
7172
|
password: "nebula",
|
|
7059
7173
|
space: "c4a"
|
|
7174
|
+
},
|
|
7175
|
+
duckdb: {
|
|
7176
|
+
path: "./data/c4a-graph.duckdb"
|
|
7060
7177
|
}
|
|
7061
7178
|
},
|
|
7062
7179
|
vector_db: {
|
|
@@ -11158,7 +11275,7 @@ var atomFieldSchema = exports_external.enum(Object.values(AtomField));
|
|
|
11158
11275
|
var kindSchema = exports_external.enum(Object.values(Kind));
|
|
11159
11276
|
var scopeSchema = exports_external.literal("project");
|
|
11160
11277
|
var perspectiveSchema = exports_external.enum(Object.values(Perspective));
|
|
11161
|
-
var
|
|
11278
|
+
var extractionConfidenceSchema = exports_external.object({
|
|
11162
11279
|
structural: exports_external.number().min(0).max(1),
|
|
11163
11280
|
semantic: exports_external.number().min(0).max(1)
|
|
11164
11281
|
});
|
|
@@ -11166,13 +11283,29 @@ var metadataSchema = exports_external.object({
|
|
|
11166
11283
|
created_at: exports_external.string().datetime(),
|
|
11167
11284
|
updated_at: exports_external.string().datetime(),
|
|
11168
11285
|
version_tag: exports_external.string().optional(),
|
|
11169
|
-
|
|
11286
|
+
extraction_confidence: extractionConfidenceSchema.optional(),
|
|
11287
|
+
confidence: exports_external.number().min(0).max(1).optional(),
|
|
11288
|
+
aliases: exports_external.array(exports_external.string()).optional(),
|
|
11289
|
+
rank: exports_external.number().optional(),
|
|
11290
|
+
community_id: exports_external.string().optional(),
|
|
11291
|
+
community_level: exports_external.number().optional()
|
|
11170
11292
|
});
|
|
11293
|
+
var entityRefPointerSchema = exports_external.string().regex(/^ref:entity:.+$/, "must be a ref pointer in format ref:entity:<id>");
|
|
11294
|
+
var sourceRefSpanSchema = exports_external.object({
|
|
11295
|
+
start: exports_external.number().int().min(1),
|
|
11296
|
+
end: exports_external.number().int().min(1)
|
|
11297
|
+
});
|
|
11298
|
+
var sourceRefSchema = exports_external.object({
|
|
11299
|
+
ref: exports_external.string(),
|
|
11300
|
+
span: sourceRefSpanSchema.optional()
|
|
11301
|
+
});
|
|
11302
|
+
var sourceRefsSchema = exports_external.array(sourceRefSchema).optional();
|
|
11171
11303
|
// src/schemas/atomsSchema.ts
|
|
11172
11304
|
var confidenceAtomSchema = exports_external.number().min(0).max(1).optional();
|
|
11173
11305
|
var entityAtomSchema = exports_external.object({
|
|
11174
11306
|
name: exports_external.string(),
|
|
11175
11307
|
kind: kindSchema.optional(),
|
|
11308
|
+
ref: exports_external.string().optional(),
|
|
11176
11309
|
confidence: confidenceAtomSchema
|
|
11177
11310
|
});
|
|
11178
11311
|
var relationAtomSchema = exports_external.object({
|
|
@@ -11186,6 +11319,8 @@ var behaviorAtomSchema = exports_external.object({
|
|
|
11186
11319
|
name: exports_external.string(),
|
|
11187
11320
|
signature: exports_external.string().optional(),
|
|
11188
11321
|
description: exports_external.string().optional(),
|
|
11322
|
+
performed_by: exports_external.array(exports_external.string()).optional(),
|
|
11323
|
+
ref: exports_external.string().optional(),
|
|
11189
11324
|
confidence: confidenceAtomSchema
|
|
11190
11325
|
});
|
|
11191
11326
|
var attributeAtomSchema = exports_external.object({
|
|
@@ -11226,6 +11361,7 @@ var decisionPhaseSchema = exports_external.object({
|
|
|
11226
11361
|
rationale: exports_external.string().optional()
|
|
11227
11362
|
});
|
|
11228
11363
|
var decisionAtomSchema = exports_external.object({
|
|
11364
|
+
name: exports_external.string().optional(),
|
|
11229
11365
|
description: exports_external.string(),
|
|
11230
11366
|
rationale: exports_external.string(),
|
|
11231
11367
|
alternatives: exports_external.array(exports_external.string()).optional(),
|
|
@@ -11248,9 +11384,9 @@ var metricAtomSchema = exports_external.object({
|
|
|
11248
11384
|
});
|
|
11249
11385
|
var roleAtomSchema = exports_external.object({
|
|
11250
11386
|
name: exports_external.string(),
|
|
11251
|
-
kind: exports_external.enum(["
|
|
11387
|
+
kind: exports_external.enum(["human", "team", "persona"]),
|
|
11252
11388
|
performs: exports_external.array(exports_external.string()).optional(),
|
|
11253
|
-
|
|
11389
|
+
description: exports_external.string().optional()
|
|
11254
11390
|
});
|
|
11255
11391
|
var constraintAtomSchema = exports_external.object({
|
|
11256
11392
|
description: exports_external.string(),
|
|
@@ -11281,6 +11417,16 @@ var comparisonAtomSchema = exports_external.object({
|
|
|
11281
11417
|
decision_ref: exports_external.string().optional(),
|
|
11282
11418
|
confidence: confidenceAtomSchema
|
|
11283
11419
|
});
|
|
11420
|
+
var claimAtomSchema = exports_external.object({
|
|
11421
|
+
claim_type: exports_external.string(),
|
|
11422
|
+
description: exports_external.string(),
|
|
11423
|
+
status: exports_external.enum(["active", "deprecated", "proposed"]),
|
|
11424
|
+
valid_from: exports_external.string(),
|
|
11425
|
+
valid_until: exports_external.string().optional(),
|
|
11426
|
+
session_ref: exports_external.string().optional(),
|
|
11427
|
+
changed_by: exports_external.string(),
|
|
11428
|
+
confidence: confidenceAtomSchema
|
|
11429
|
+
});
|
|
11284
11430
|
var dataAtomsSchema = exports_external.object({
|
|
11285
11431
|
entities: exports_external.array(entityAtomSchema).optional(),
|
|
11286
11432
|
relations: exports_external.array(relationAtomSchema).optional(),
|
|
@@ -11295,31 +11441,115 @@ var dataAtomsSchema = exports_external.object({
|
|
|
11295
11441
|
roles: exports_external.array(roleAtomSchema).optional(),
|
|
11296
11442
|
constraints: exports_external.array(constraintAtomSchema).optional(),
|
|
11297
11443
|
comparisons: exports_external.array(comparisonAtomSchema).optional(),
|
|
11298
|
-
boundaries: exports_external.array(boundaryAtomSchema).optional()
|
|
11444
|
+
boundaries: exports_external.array(boundaryAtomSchema).optional(),
|
|
11445
|
+
claims: exports_external.array(claimAtomSchema).optional()
|
|
11299
11446
|
}).superRefine((atoms2, ctx) => {
|
|
11300
|
-
if (!atoms2.transitions || atoms2.transitions.length === 0) {
|
|
11301
|
-
return;
|
|
11302
|
-
}
|
|
11303
11447
|
const stateValues = new Set;
|
|
11448
|
+
const stateNames = new Set;
|
|
11304
11449
|
for (const state of atoms2.states ?? []) {
|
|
11450
|
+
stateNames.add(state.name);
|
|
11305
11451
|
for (const value of state.values) {
|
|
11306
11452
|
stateValues.add(value);
|
|
11307
11453
|
}
|
|
11308
11454
|
}
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11455
|
+
const behaviorNames = new Set;
|
|
11456
|
+
for (const behavior of atoms2.behaviors ?? []) {
|
|
11457
|
+
behaviorNames.add(behavior.name);
|
|
11458
|
+
}
|
|
11459
|
+
const roleNames = new Set;
|
|
11460
|
+
for (const role of atoms2.roles ?? []) {
|
|
11461
|
+
roleNames.add(role.name);
|
|
11462
|
+
}
|
|
11463
|
+
const eventNames = new Set;
|
|
11464
|
+
for (const event of atoms2.events ?? []) {
|
|
11465
|
+
eventNames.add(event.name);
|
|
11466
|
+
}
|
|
11467
|
+
const metricNames = new Set;
|
|
11468
|
+
for (const metric of atoms2.metrics ?? []) {
|
|
11469
|
+
metricNames.add(metric.name);
|
|
11470
|
+
}
|
|
11471
|
+
if (atoms2.transitions && atoms2.transitions.length > 0) {
|
|
11472
|
+
for (const transition of atoms2.transitions) {
|
|
11473
|
+
if (!stateValues.has(transition.from)) {
|
|
11474
|
+
ctx.addIssue({
|
|
11475
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11476
|
+
path: ["transitions"],
|
|
11477
|
+
message: `transition.from references unknown state: ${transition.from}`
|
|
11478
|
+
});
|
|
11479
|
+
}
|
|
11480
|
+
if (!stateValues.has(transition.to)) {
|
|
11481
|
+
ctx.addIssue({
|
|
11482
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11483
|
+
path: ["transitions"],
|
|
11484
|
+
message: `transition.to references unknown state: ${transition.to}`
|
|
11485
|
+
});
|
|
11486
|
+
}
|
|
11487
|
+
const hasEvents = eventNames.size > 0;
|
|
11488
|
+
const hasBehaviors = behaviorNames.size > 0;
|
|
11489
|
+
if (hasEvents || hasBehaviors) {
|
|
11490
|
+
const triggerMatchesEvent = hasEvents && eventNames.has(transition.trigger);
|
|
11491
|
+
const triggerMatchesBehavior = hasBehaviors && behaviorNames.has(transition.trigger);
|
|
11492
|
+
if (!triggerMatchesEvent && !triggerMatchesBehavior) {
|
|
11493
|
+
ctx.addIssue({
|
|
11494
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11495
|
+
path: ["transitions"],
|
|
11496
|
+
message: `transition.trigger references unknown event/behavior: ${transition.trigger}`
|
|
11497
|
+
});
|
|
11498
|
+
}
|
|
11499
|
+
}
|
|
11316
11500
|
}
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11501
|
+
}
|
|
11502
|
+
if (atoms2.roles && atoms2.roles.length > 0) {
|
|
11503
|
+
for (const [index, role] of atoms2.roles.entries()) {
|
|
11504
|
+
for (const perform of role.performs ?? []) {
|
|
11505
|
+
if (!behaviorNames.has(perform)) {
|
|
11506
|
+
ctx.addIssue({
|
|
11507
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11508
|
+
path: ["roles", index, "performs"],
|
|
11509
|
+
message: `role.performs references unknown behavior: ${perform}`
|
|
11510
|
+
});
|
|
11511
|
+
}
|
|
11512
|
+
}
|
|
11513
|
+
}
|
|
11514
|
+
}
|
|
11515
|
+
if (atoms2.behaviors && atoms2.behaviors.length > 0) {
|
|
11516
|
+
for (const [index, behavior] of atoms2.behaviors.entries()) {
|
|
11517
|
+
for (const performer of behavior.performed_by ?? []) {
|
|
11518
|
+
if (!roleNames.has(performer)) {
|
|
11519
|
+
ctx.addIssue({
|
|
11520
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11521
|
+
path: ["behaviors", index, "performed_by"],
|
|
11522
|
+
message: `behavior.performed_by references unknown role: ${performer}`
|
|
11523
|
+
});
|
|
11524
|
+
}
|
|
11525
|
+
}
|
|
11526
|
+
}
|
|
11527
|
+
}
|
|
11528
|
+
if (atoms2.rules && atoms2.rules.length > 0) {
|
|
11529
|
+
const allowedDependsOn = new Set([...stateNames, ...metricNames]);
|
|
11530
|
+
for (const [index, rule] of atoms2.rules.entries()) {
|
|
11531
|
+
for (const dependency of rule.depends_on ?? []) {
|
|
11532
|
+
if (!allowedDependsOn.has(dependency)) {
|
|
11533
|
+
ctx.addIssue({
|
|
11534
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11535
|
+
path: ["rules", index, "depends_on"],
|
|
11536
|
+
message: `rule.depends_on references unknown state/metric: ${dependency}`
|
|
11537
|
+
});
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11540
|
+
}
|
|
11541
|
+
}
|
|
11542
|
+
if (atoms2.events && atoms2.events.length > 0) {
|
|
11543
|
+
for (const [index, event] of atoms2.events.entries()) {
|
|
11544
|
+
for (const behaviorName of event.trigger_for ?? []) {
|
|
11545
|
+
if (!behaviorNames.has(behaviorName)) {
|
|
11546
|
+
ctx.addIssue({
|
|
11547
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11548
|
+
path: ["events", index, "trigger_for"],
|
|
11549
|
+
message: `event.trigger_for references unknown behavior: ${behaviorName}`
|
|
11550
|
+
});
|
|
11551
|
+
}
|
|
11552
|
+
}
|
|
11323
11553
|
}
|
|
11324
11554
|
}
|
|
11325
11555
|
});
|
|
@@ -11335,7 +11565,8 @@ var atomsWhitelistByEntityType = {
|
|
|
11335
11565
|
"states" /* States */,
|
|
11336
11566
|
"rules" /* Rules */,
|
|
11337
11567
|
"transitions" /* Transitions */,
|
|
11338
|
-
"events" /* Events
|
|
11568
|
+
"events" /* Events */,
|
|
11569
|
+
"claims" /* Claims */
|
|
11339
11570
|
]),
|
|
11340
11571
|
["process" /* Process */]: new Set,
|
|
11341
11572
|
["sor" /* SoR */]: new Set([
|
|
@@ -11351,7 +11582,8 @@ var atomsWhitelistByEntityType = {
|
|
|
11351
11582
|
"metrics" /* Metrics */,
|
|
11352
11583
|
"roles" /* Roles */,
|
|
11353
11584
|
"constraints" /* Constraints */,
|
|
11354
|
-
"comparisons" /* Comparisons
|
|
11585
|
+
"comparisons" /* Comparisons */,
|
|
11586
|
+
"claims" /* Claims */
|
|
11355
11587
|
]),
|
|
11356
11588
|
["contract" /* Contract */]: new Set,
|
|
11357
11589
|
["epic" /* Epic */]: new Set([
|
|
@@ -11359,7 +11591,8 @@ var atomsWhitelistByEntityType = {
|
|
|
11359
11591
|
"metrics" /* Metrics */,
|
|
11360
11592
|
"roles" /* Roles */,
|
|
11361
11593
|
"constraints" /* Constraints */,
|
|
11362
|
-
"comparisons" /* Comparisons
|
|
11594
|
+
"comparisons" /* Comparisons */,
|
|
11595
|
+
"claims" /* Claims */
|
|
11363
11596
|
]),
|
|
11364
11597
|
["document" /* Document */]: new Set
|
|
11365
11598
|
};
|
|
@@ -11385,7 +11618,8 @@ var baseEntitySchema = exports_external.object({
|
|
|
11385
11618
|
kind: kindSchema,
|
|
11386
11619
|
scope: scopeSchema,
|
|
11387
11620
|
perspective: perspectiveSchema,
|
|
11388
|
-
metadata: metadataSchema
|
|
11621
|
+
metadata: metadataSchema,
|
|
11622
|
+
source_refs: sourceRefsSchema
|
|
11389
11623
|
});
|
|
11390
11624
|
var productDataSchema = exports_external.object({
|
|
11391
11625
|
description: exports_external.string().optional(),
|
|
@@ -11399,7 +11633,8 @@ var productEntitySchema = baseEntitySchema.extend({
|
|
|
11399
11633
|
});
|
|
11400
11634
|
var systemDataSchema = exports_external.object({
|
|
11401
11635
|
description: exports_external.string().optional(),
|
|
11402
|
-
corresponds_to: exports_external.string().optional()
|
|
11636
|
+
corresponds_to: exports_external.string().optional(),
|
|
11637
|
+
atoms: exports_external.undefined().optional()
|
|
11403
11638
|
});
|
|
11404
11639
|
var systemEntitySchema = baseEntitySchema.extend({
|
|
11405
11640
|
type: exports_external.literal("system" /* System */),
|
|
@@ -11445,9 +11680,10 @@ var sorEntitySchema = baseEntitySchema.extend({
|
|
|
11445
11680
|
data: sorDataSchema
|
|
11446
11681
|
});
|
|
11447
11682
|
var contractDataSchema = exports_external.object({
|
|
11448
|
-
format: exports_external.enum(["openapi", "asyncapi", "proto"]),
|
|
11683
|
+
format: exports_external.enum(["openapi", "asyncapi", "proto", "graphql", "custom"]),
|
|
11449
11684
|
spec: exports_external.string(),
|
|
11450
|
-
|
|
11685
|
+
version: exports_external.string().optional(),
|
|
11686
|
+
description: exports_external.string().optional()
|
|
11451
11687
|
});
|
|
11452
11688
|
var contractEntitySchema = baseEntitySchema.extend({
|
|
11453
11689
|
type: exports_external.literal("contract" /* Contract */),
|
|
@@ -11455,7 +11691,7 @@ var contractEntitySchema = baseEntitySchema.extend({
|
|
|
11455
11691
|
});
|
|
11456
11692
|
var epicDataSchema = exports_external.object({
|
|
11457
11693
|
description: exports_external.string().optional(),
|
|
11458
|
-
product_refs: exports_external.array(
|
|
11694
|
+
product_refs: exports_external.array(entityRefPointerSchema).optional(),
|
|
11459
11695
|
atoms: dataAtomsSchema.optional()
|
|
11460
11696
|
});
|
|
11461
11697
|
var epicEntitySchema = baseEntitySchema.extend({
|
|
@@ -11531,18 +11767,45 @@ var entitySchema = exports_external.discriminatedUnion("type", [
|
|
|
11531
11767
|
});
|
|
11532
11768
|
}
|
|
11533
11769
|
}
|
|
11770
|
+
if (entity2.type === "sor" /* SoR */ && entity2.data.atoms) {
|
|
11771
|
+
const { constraints, rules } = entity2.data.atoms;
|
|
11772
|
+
const hasConstraints = Array.isArray(constraints) && constraints.length > 0;
|
|
11773
|
+
const hasRules = Array.isArray(rules) && rules.length > 0;
|
|
11774
|
+
if (!hasConstraints && !hasRules) {
|
|
11775
|
+
ctx.addIssue({
|
|
11776
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11777
|
+
path: ["data", "atoms"],
|
|
11778
|
+
message: "SoR must have at least one constraint or rule"
|
|
11779
|
+
});
|
|
11780
|
+
}
|
|
11781
|
+
}
|
|
11782
|
+
if (entity2.type === "epic" /* Epic */ && entity2.data.atoms) {
|
|
11783
|
+
const { decisions } = entity2.data.atoms;
|
|
11784
|
+
const hasDecisions = Array.isArray(decisions) && decisions.length > 0;
|
|
11785
|
+
if (!hasDecisions) {
|
|
11786
|
+
ctx.addIssue({
|
|
11787
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11788
|
+
path: ["data", "atoms"],
|
|
11789
|
+
message: "Epic must have at least one decision"
|
|
11790
|
+
});
|
|
11791
|
+
}
|
|
11792
|
+
}
|
|
11534
11793
|
});
|
|
11535
11794
|
// src/schemas/relationSchema.ts
|
|
11536
11795
|
var relationDataSchema = exports_external.object({
|
|
11537
|
-
description: exports_external.string().optional()
|
|
11796
|
+
description: exports_external.string().optional(),
|
|
11797
|
+
_source: exports_external.literal("field_sync").optional()
|
|
11538
11798
|
});
|
|
11539
11799
|
var relationSchema = exports_external.object({
|
|
11540
11800
|
id: exports_external.string(),
|
|
11541
11801
|
type: relationTypeSchema,
|
|
11542
11802
|
from: exports_external.string(),
|
|
11543
11803
|
to: exports_external.string(),
|
|
11804
|
+
weight: exports_external.number().optional(),
|
|
11805
|
+
confidence: exports_external.number().min(0).max(1).optional(),
|
|
11544
11806
|
data: relationDataSchema.optional(),
|
|
11545
|
-
metadata: metadataSchema.optional()
|
|
11807
|
+
metadata: metadataSchema.optional(),
|
|
11808
|
+
source_refs: sourceRefsSchema
|
|
11546
11809
|
});
|
|
11547
11810
|
// src/errors/c4aError.ts
|
|
11548
11811
|
class C4AError extends Error {
|
|
@@ -11689,6 +11952,37 @@ var DEFAULT_CLOUD_LIBRARY_ID = "lib_cloud_default";
|
|
|
11689
11952
|
var DEFAULT_CLOUD_LIBRARY_NAME = "个人云";
|
|
11690
11953
|
var DAEMON_HEARTBEAT_INTERVAL = 30000;
|
|
11691
11954
|
var DAEMON_OFFLINE_THRESHOLD = 60000;
|
|
11955
|
+
var CLOUD_DAEMON_IDLE_TIMEOUT = 300000;
|
|
11956
|
+
// src/fileTypes.ts
|
|
11957
|
+
var INDEXABLE_CODE_EXTENSIONS = new Set([".ts", ".tsx"]);
|
|
11958
|
+
var INDEXABLE_DOC_EXTENSIONS = new Set([".md"]);
|
|
11959
|
+
var INDEXABLE_EXTENSIONS = new Set([
|
|
11960
|
+
...INDEXABLE_CODE_EXTENSIONS,
|
|
11961
|
+
...INDEXABLE_DOC_EXTENSIONS
|
|
11962
|
+
]);
|
|
11963
|
+
var UPLOAD_ALLOWED_EXTENSIONS = new Set([
|
|
11964
|
+
".md",
|
|
11965
|
+
".doc",
|
|
11966
|
+
".docx",
|
|
11967
|
+
".pdf",
|
|
11968
|
+
".ppt",
|
|
11969
|
+
".pptx",
|
|
11970
|
+
".txt"
|
|
11971
|
+
]);
|
|
11972
|
+
var TEXT_EXTENSIONS = new Set([".md", ".txt"]);
|
|
11973
|
+
var UPLOAD_MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
11974
|
+
var UPLOAD_MAX_FILES = 10;
|
|
11975
|
+
function getFileExtension(name) {
|
|
11976
|
+
const dot = name.lastIndexOf(".");
|
|
11977
|
+
return dot >= 0 ? name.slice(dot).toLowerCase() : "";
|
|
11978
|
+
}
|
|
11979
|
+
function isIndexableFile(fileName, manifestFiles) {
|
|
11980
|
+
const baseName = fileName.includes("/") ? fileName.split("/").pop() : fileName;
|
|
11981
|
+
if (manifestFiles.has(baseName.toLowerCase()))
|
|
11982
|
+
return true;
|
|
11983
|
+
const ext = getFileExtension(baseName);
|
|
11984
|
+
return INDEXABLE_EXTENSIONS.has(ext);
|
|
11985
|
+
}
|
|
11692
11986
|
// src/wsEvents.ts
|
|
11693
11987
|
var WS_SESSION_STATUS = "ws:session:status";
|
|
11694
11988
|
var WS_SESSION_PROGRESS = "ws:session:progress";
|
|
@@ -11703,6 +11997,9 @@ export {
|
|
|
11703
11997
|
transitionAtomSchema,
|
|
11704
11998
|
systemEntitySchema,
|
|
11705
11999
|
stateAtomSchema,
|
|
12000
|
+
sourceRefsSchema,
|
|
12001
|
+
sourceRefSpanSchema,
|
|
12002
|
+
sourceRefSchema,
|
|
11706
12003
|
sorEntitySchema,
|
|
11707
12004
|
sessionDecisionSchema,
|
|
11708
12005
|
serializeYaml,
|
|
@@ -11717,6 +12014,7 @@ export {
|
|
|
11717
12014
|
processEntitySchema,
|
|
11718
12015
|
perspectiveSchema,
|
|
11719
12016
|
parseYaml,
|
|
12017
|
+
parseRef,
|
|
11720
12018
|
modelingSessionDataSchema,
|
|
11721
12019
|
metricMilestoneSchema,
|
|
11722
12020
|
metricAtomSchema,
|
|
@@ -11724,13 +12022,19 @@ export {
|
|
|
11724
12022
|
mapErrorCodeToStatus,
|
|
11725
12023
|
kindSchema,
|
|
11726
12024
|
isValidManifest,
|
|
12025
|
+
isRefPointer,
|
|
11727
12026
|
isPathSafe,
|
|
12027
|
+
isIndexableFile,
|
|
12028
|
+
getFileExtension,
|
|
11728
12029
|
generateUUID,
|
|
11729
12030
|
generateId,
|
|
12031
|
+
extractionConfidenceSchema,
|
|
12032
|
+
extractAllRefs,
|
|
11730
12033
|
eventAtomSchema,
|
|
11731
12034
|
epicEntitySchema,
|
|
11732
12035
|
entityTypeSchema,
|
|
11733
12036
|
entitySchema,
|
|
12037
|
+
entityRefPointerSchema,
|
|
11734
12038
|
entityAtomSchema,
|
|
11735
12039
|
documentSchema,
|
|
11736
12040
|
documentModelingEntitySchema,
|
|
@@ -11740,14 +12044,16 @@ export {
|
|
|
11740
12044
|
decisionAtomSchema,
|
|
11741
12045
|
dataAtomsSchema,
|
|
11742
12046
|
contractEntitySchema,
|
|
12047
|
+
contractDataSchema,
|
|
11743
12048
|
contentHash,
|
|
11744
12049
|
containerEntitySchema,
|
|
11745
12050
|
constraintAtomSchema,
|
|
11746
|
-
confidenceSchema,
|
|
11747
12051
|
componentEntitySchema,
|
|
11748
12052
|
comparisonDimensionValueSchema,
|
|
11749
12053
|
comparisonDimensionSchema,
|
|
11750
12054
|
comparisonAtomSchema,
|
|
12055
|
+
claimAtomSchema,
|
|
12056
|
+
buildRef,
|
|
11751
12057
|
boundaryAtomSchema,
|
|
11752
12058
|
behaviorAtomSchema,
|
|
11753
12059
|
attributeAtomSchema,
|
|
@@ -11763,11 +12069,19 @@ export {
|
|
|
11763
12069
|
WS_DAEMON_HANDSHAKE_ACK,
|
|
11764
12070
|
WS_DAEMON_HANDSHAKE,
|
|
11765
12071
|
WS_DAEMON_CONNECTED,
|
|
12072
|
+
UPLOAD_MAX_FILE_SIZE,
|
|
12073
|
+
UPLOAD_MAX_FILES,
|
|
12074
|
+
UPLOAD_ALLOWED_EXTENSIONS,
|
|
12075
|
+
TEXT_EXTENSIONS,
|
|
11766
12076
|
RelationType,
|
|
11767
12077
|
Perspective,
|
|
11768
12078
|
Kind,
|
|
12079
|
+
INDEXABLE_EXTENSIONS,
|
|
12080
|
+
INDEXABLE_DOC_EXTENSIONS,
|
|
12081
|
+
INDEXABLE_CODE_EXTENSIONS,
|
|
11769
12082
|
ErrorCode,
|
|
11770
12083
|
EntityType,
|
|
12084
|
+
EDGE_SYNC_RULES,
|
|
11771
12085
|
DEFAULT_WORKSPACE_NAME,
|
|
11772
12086
|
DEFAULT_WORKSPACE_ID,
|
|
11773
12087
|
DEFAULT_USER_NAME,
|
|
@@ -11778,6 +12092,7 @@ export {
|
|
|
11778
12092
|
DAEMON_OFFLINE_THRESHOLD,
|
|
11779
12093
|
DAEMON_HEARTBEAT_INTERVAL,
|
|
11780
12094
|
CODE_PACKAGE_FILES,
|
|
12095
|
+
CLOUD_DAEMON_IDLE_TIMEOUT,
|
|
11781
12096
|
C4AError,
|
|
11782
12097
|
AtomField
|
|
11783
12098
|
};
|