@c4a/server-cli 0.4.15-alpha.5 → 0.4.15-alpha.6
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 +19 -13
- package/package.json +1 -1
- package/serve.js +19 -13
- package/web/assets/ContentDetail-C0zfArPg.js +1 -0
- package/web/assets/EntityDetail-C9k4cMVL.js +1 -0
- package/web/assets/RelationDetail-BK8C5waL.js +1 -0
- package/web/assets/index-BKETuM1m.js +111 -0
- package/web/assets/index-C96WspeJ.css +1 -0
- package/web/index.html +2 -2
package/index.js
CHANGED
|
@@ -222212,20 +222212,20 @@ class GleaningExtractor {
|
|
|
222212
222212
|
// ../llm/src/prompts/docAtomAnnotation.ts
|
|
222213
222213
|
init_src();
|
|
222214
222214
|
var DOC_ATOM_DEFS = [
|
|
222215
|
-
["entities", "Named things: systems, services, modules,
|
|
222215
|
+
["entities", "Named things with independent identity — something you can ask questions about ('What does X do?', 'Who owns X?'). Examples: systems, services, modules, APIs, products. If it is a value, address, path, or configuration detail, it is an attribute of an entity, not an entity itself. (NOT people/teams — use roles for those). kind: implementation=internal systems/services, external=third-party dependencies, concept=abstract/not-yet-implemented", entityAtomSchema],
|
|
222216
222216
|
["relations", "Connections between entities", relationAtomSchema],
|
|
222217
222217
|
["behaviors", "Actions/operations: functions, API calls, user actions, workflows", behaviorAtomSchema],
|
|
222218
222218
|
["attributes", "Properties of entities", attributeAtomSchema],
|
|
222219
222219
|
["states", "Possible states of entities", stateAtomSchema],
|
|
222220
|
-
["rules", "
|
|
222220
|
+
["rules", "Conditional business/domain logic: IF condition THEN consequence (e.g., 'IF user not authenticated THEN reject request')", ruleAtomSchema],
|
|
222221
222221
|
["transitions", "State changes: from→to triggered by events or guards", transitionAtomSchema],
|
|
222222
222222
|
["events", "Occurrences that trigger behaviors", eventAtomSchema],
|
|
222223
222223
|
["decisions", "Architectural or business decisions", decisionAtomSchema],
|
|
222224
222224
|
["metrics", "Measurable targets: SLA, throughput, error_rate, with thresholds", metricAtomSchema],
|
|
222225
|
-
["roles", "Actors: human roles, teams, personas that perform behaviors", roleAtomSchema],
|
|
222226
|
-
["constraints", "
|
|
222225
|
+
["roles", "Actors: human roles, teams, personas that perform behaviors. kind: human=individual role, team=group/department, persona=user archetype. System-triggered actions use entity relations, NOT roles", roleAtomSchema],
|
|
222226
|
+
["constraints", "Declarative requirements: 'X must/should/must-not Y' (e.g., 'passwords must be >= 8 chars'). Unlike rules, constraints have no IF-THEN condition — they are unconditional mandates or restrictions", constraintAtomSchema],
|
|
222227
222227
|
["comparisons", "Side-by-side evaluations", comparisonAtomSchema],
|
|
222228
|
-
["boundaries", "
|
|
222228
|
+
["boundaries", "Explicit scope declarations: what is included vs excluded. Only extract when the text explicitly declares scope (e.g., 'this product covers X but NOT Y'). Implicit containment (A runs inside B) is expressed via entity relations, not boundaries", boundaryAtomSchema]
|
|
222229
222229
|
];
|
|
222230
222230
|
function buildAtomTypesBlock() {
|
|
222231
222231
|
return DOC_ATOM_DEFS.map(([name21, desc, schema], i) => {
|
|
@@ -222255,7 +222255,8 @@ Return a single JSON object keyed by paragraph tags. Only include paragraphs tha
|
|
|
222255
222255
|
"relations": [{ "from": "UserService", "to": "Database", "type": "DEPENDS_ON", "confidence": 0.9 }]
|
|
222256
222256
|
},
|
|
222257
222257
|
"P3": {
|
|
222258
|
-
"
|
|
222258
|
+
"constraints": [{ "description": "User must be authenticated before access", "severity": "must", "confidence": 0.9 }],
|
|
222259
|
+
"rules": [{ "description": "Reject request if user is not authenticated", "expression": "IF !user.isAuthenticated THEN reject", "confidence": 0.85 }]
|
|
222259
222260
|
}
|
|
222260
222261
|
}
|
|
222261
222262
|
|
|
@@ -222268,6 +222269,11 @@ Return a single JSON object keyed by paragraph tags. Only include paragraphs tha
|
|
|
222268
222269
|
- Every atom MUST include a "confidence" field (0.0-1.0) indicating how confident you are in the extraction. Use higher values (0.85-1.0) for explicitly stated facts and lower values (0.5-0.7) for inferred or ambiguous information.
|
|
222269
222270
|
- **Classify correctly:** People, teams, and personas → "roles" (not "entities"). Technical systems, services, modules → "entities".
|
|
222270
222271
|
- **Entity reference consistency (CRITICAL):** Every entity name referenced in relation.from, relation.to, behavior.subject, or any other cross-reference field MUST also appear in the "entities" array of the SAME paragraph (or a preceding paragraph in the same chunk). If an entity is mentioned for the first time in a relation, you MUST also extract it as an entity. This ensures no "dangling references" — every name used in relations has a corresponding entity declaration.
|
|
222272
|
+
- **Cross-atom reference consistency:** transitions[].from and transitions[].to values MUST exist in states[].values of the same entity. roles[].performs values MUST match names declared in behaviors[].name.
|
|
222273
|
+
- **Constraints vs rules distinction:** Use "constraints" for unconditional declarative mandates ('X must Y'). Use "rules" for conditional logic ('IF X THEN Y'). Do not mix them — a requirement with no condition is a constraint, a requirement triggered by a condition is a rule. Do NOT invent a rule for every constraint — only create a rule when the text explicitly states conditional logic.
|
|
222274
|
+
- **One statement, multiple atoms:** A single sentence can produce several atom types simultaneously. Do NOT force a choice — extract all that apply. Example: "system uptime must be ≥ 99.9%" → constraint (severity: must) + metric (threshold: "≥ 99.9%").
|
|
222275
|
+
- **Relation types:** Use standard relation types when possible: CONTAINS (parent→child composition), DEPENDS_ON (runtime dependency), IMPLEMENTS (code/component→spec realization), PRODUCES (process→output), TRIGGERS (event/process triggering), REFERENCES (weak cross-reference). Only invent a new type when none of these fit.
|
|
222276
|
+
- **Decisions:** Extract as "decisions" when the text records a deliberate choice between alternatives with rationale (e.g., "we chose X because Y", "after evaluating A/B/C, selected B"). Do not extract routine descriptions as decisions.
|
|
222271
222277
|
- Respond in the same language as the input text (e.g., Chinese input → Chinese descriptions, English input → English descriptions).
|
|
222272
222278
|
- JSON structure keys (tag, atom type names, field names) must always be in English.
|
|
222273
222279
|
- Be thorough: extract ALL relevant atoms from each paragraph.
|
|
@@ -222325,10 +222331,10 @@ var ENTITY_RESOLUTION_SYSTEM_PROMPT = `You are an entity resolution assistant. Y
|
|
|
222325
222331
|
- Abbreviations should be merged with their full forms (e.g. "AGW" → "API Gateway")
|
|
222326
222332
|
|
|
222327
222333
|
## Task 2: Remove Noise
|
|
222328
|
-
-
|
|
222329
|
-
-
|
|
222330
|
-
- Examples of REAL entities to KEEP: product names (TTAstra, Gulux), tools (nvm, Rush), services (Op Main 服务), platforms (AGW 平台)
|
|
222331
|
-
- When uncertain, KEEP the name — only remove if clearly
|
|
222334
|
+
- Apply the **identity test**: a real entity is something you can discuss independently ("What is X?", "How does X work?", "Who owns X?"). Names that fail this test — values, addresses, actions, generic descriptions — are noise.
|
|
222335
|
+
- Remove names that are NOT meaningful named entities: generic words, action descriptions, or things that are attributes/values rather than independent subjects
|
|
222336
|
+
- Examples of REAL entities to KEEP: product names (TTAstra, Gulux), tools (nvm, Rush), services (Op Main 服务), platforms (AGW 平台) — these all pass the identity test
|
|
222337
|
+
- When uncertain, KEEP the name — only remove if it clearly fails the identity test
|
|
222332
222338
|
|
|
222333
222339
|
## Output
|
|
222334
222340
|
Valid JSON only. No markdown fences, no explanation.`;
|
|
@@ -222571,7 +222577,7 @@ Each diagram paragraph is tagged with [P0], [P1], etc. You must classify the dia
|
|
|
222571
222577
|
Relation schema: ${relationFields2}
|
|
222572
222578
|
3. Extract action nodes as behaviors (what the process does at each step).
|
|
222573
222579
|
Behavior schema: ${behaviorFields2}
|
|
222574
|
-
4. Extract diamond/
|
|
222580
|
+
4. Extract diamond/condition nodes: if it represents a deliberate choice with rationale → "decisions"; if it represents conditional branching logic (IF-THEN) → "rules".
|
|
222575
222581
|
Decision schema: ${decisionFields}
|
|
222576
222582
|
|
|
222577
222583
|
### Sequence → entities + relations + behaviors + events
|
|
@@ -222604,9 +222610,9 @@ Each diagram paragraph is tagged with [P0], [P1], etc. You must classify the dia
|
|
|
222604
222610
|
Relation schema: ${relationFields2}
|
|
222605
222611
|
|
|
222606
222612
|
### Architecture → entities + relations + constraints
|
|
222607
|
-
1. Extract each system/service/container/component as an entity.
|
|
222613
|
+
1. Extract each system/service/container/component as an entity. Use kind to indicate origin: "implementation" for internal systems/services, "external" for third-party dependencies (databases, cloud services, external APIs).
|
|
222608
222614
|
Entity schema: ${entityFields2}
|
|
222609
|
-
2. Extract connections between components as relations.
|
|
222615
|
+
2. Extract connections between components as relations. Use standard types: CONTAINS (parent→child), DEPENDS_ON (runtime dependency), TRIGGERS (event/process triggering).
|
|
222610
222616
|
Relation schema: ${relationFields2}
|
|
222611
222617
|
3. Extract deployment constraints, technology choices.
|
|
222612
222618
|
Constraint schema: ${constraintFields2}
|
package/package.json
CHANGED
package/serve.js
CHANGED
|
@@ -196217,20 +196217,20 @@ class GleaningExtractor {
|
|
|
196217
196217
|
// ../llm/src/prompts/docAtomAnnotation.ts
|
|
196218
196218
|
init_src();
|
|
196219
196219
|
var DOC_ATOM_DEFS = [
|
|
196220
|
-
["entities", "Named things: systems, services, modules,
|
|
196220
|
+
["entities", "Named things with independent identity — something you can ask questions about ('What does X do?', 'Who owns X?'). Examples: systems, services, modules, APIs, products. If it is a value, address, path, or configuration detail, it is an attribute of an entity, not an entity itself. (NOT people/teams — use roles for those). kind: implementation=internal systems/services, external=third-party dependencies, concept=abstract/not-yet-implemented", entityAtomSchema],
|
|
196221
196221
|
["relations", "Connections between entities", relationAtomSchema],
|
|
196222
196222
|
["behaviors", "Actions/operations: functions, API calls, user actions, workflows", behaviorAtomSchema],
|
|
196223
196223
|
["attributes", "Properties of entities", attributeAtomSchema],
|
|
196224
196224
|
["states", "Possible states of entities", stateAtomSchema],
|
|
196225
|
-
["rules", "
|
|
196225
|
+
["rules", "Conditional business/domain logic: IF condition THEN consequence (e.g., 'IF user not authenticated THEN reject request')", ruleAtomSchema],
|
|
196226
196226
|
["transitions", "State changes: from→to triggered by events or guards", transitionAtomSchema],
|
|
196227
196227
|
["events", "Occurrences that trigger behaviors", eventAtomSchema],
|
|
196228
196228
|
["decisions", "Architectural or business decisions", decisionAtomSchema],
|
|
196229
196229
|
["metrics", "Measurable targets: SLA, throughput, error_rate, with thresholds", metricAtomSchema],
|
|
196230
|
-
["roles", "Actors: human roles, teams, personas that perform behaviors", roleAtomSchema],
|
|
196231
|
-
["constraints", "
|
|
196230
|
+
["roles", "Actors: human roles, teams, personas that perform behaviors. kind: human=individual role, team=group/department, persona=user archetype. System-triggered actions use entity relations, NOT roles", roleAtomSchema],
|
|
196231
|
+
["constraints", "Declarative requirements: 'X must/should/must-not Y' (e.g., 'passwords must be >= 8 chars'). Unlike rules, constraints have no IF-THEN condition — they are unconditional mandates or restrictions", constraintAtomSchema],
|
|
196232
196232
|
["comparisons", "Side-by-side evaluations", comparisonAtomSchema],
|
|
196233
|
-
["boundaries", "
|
|
196233
|
+
["boundaries", "Explicit scope declarations: what is included vs excluded. Only extract when the text explicitly declares scope (e.g., 'this product covers X but NOT Y'). Implicit containment (A runs inside B) is expressed via entity relations, not boundaries", boundaryAtomSchema]
|
|
196234
196234
|
];
|
|
196235
196235
|
function buildAtomTypesBlock() {
|
|
196236
196236
|
return DOC_ATOM_DEFS.map(([name21, desc, schema2], i) => {
|
|
@@ -196260,7 +196260,8 @@ Return a single JSON object keyed by paragraph tags. Only include paragraphs tha
|
|
|
196260
196260
|
"relations": [{ "from": "UserService", "to": "Database", "type": "DEPENDS_ON", "confidence": 0.9 }]
|
|
196261
196261
|
},
|
|
196262
196262
|
"P3": {
|
|
196263
|
-
"
|
|
196263
|
+
"constraints": [{ "description": "User must be authenticated before access", "severity": "must", "confidence": 0.9 }],
|
|
196264
|
+
"rules": [{ "description": "Reject request if user is not authenticated", "expression": "IF !user.isAuthenticated THEN reject", "confidence": 0.85 }]
|
|
196264
196265
|
}
|
|
196265
196266
|
}
|
|
196266
196267
|
|
|
@@ -196273,6 +196274,11 @@ Return a single JSON object keyed by paragraph tags. Only include paragraphs tha
|
|
|
196273
196274
|
- Every atom MUST include a "confidence" field (0.0-1.0) indicating how confident you are in the extraction. Use higher values (0.85-1.0) for explicitly stated facts and lower values (0.5-0.7) for inferred or ambiguous information.
|
|
196274
196275
|
- **Classify correctly:** People, teams, and personas → "roles" (not "entities"). Technical systems, services, modules → "entities".
|
|
196275
196276
|
- **Entity reference consistency (CRITICAL):** Every entity name referenced in relation.from, relation.to, behavior.subject, or any other cross-reference field MUST also appear in the "entities" array of the SAME paragraph (or a preceding paragraph in the same chunk). If an entity is mentioned for the first time in a relation, you MUST also extract it as an entity. This ensures no "dangling references" — every name used in relations has a corresponding entity declaration.
|
|
196277
|
+
- **Cross-atom reference consistency:** transitions[].from and transitions[].to values MUST exist in states[].values of the same entity. roles[].performs values MUST match names declared in behaviors[].name.
|
|
196278
|
+
- **Constraints vs rules distinction:** Use "constraints" for unconditional declarative mandates ('X must Y'). Use "rules" for conditional logic ('IF X THEN Y'). Do not mix them — a requirement with no condition is a constraint, a requirement triggered by a condition is a rule. Do NOT invent a rule for every constraint — only create a rule when the text explicitly states conditional logic.
|
|
196279
|
+
- **One statement, multiple atoms:** A single sentence can produce several atom types simultaneously. Do NOT force a choice — extract all that apply. Example: "system uptime must be ≥ 99.9%" → constraint (severity: must) + metric (threshold: "≥ 99.9%").
|
|
196280
|
+
- **Relation types:** Use standard relation types when possible: CONTAINS (parent→child composition), DEPENDS_ON (runtime dependency), IMPLEMENTS (code/component→spec realization), PRODUCES (process→output), TRIGGERS (event/process triggering), REFERENCES (weak cross-reference). Only invent a new type when none of these fit.
|
|
196281
|
+
- **Decisions:** Extract as "decisions" when the text records a deliberate choice between alternatives with rationale (e.g., "we chose X because Y", "after evaluating A/B/C, selected B"). Do not extract routine descriptions as decisions.
|
|
196276
196282
|
- Respond in the same language as the input text (e.g., Chinese input → Chinese descriptions, English input → English descriptions).
|
|
196277
196283
|
- JSON structure keys (tag, atom type names, field names) must always be in English.
|
|
196278
196284
|
- Be thorough: extract ALL relevant atoms from each paragraph.
|
|
@@ -196330,10 +196336,10 @@ var ENTITY_RESOLUTION_SYSTEM_PROMPT = `You are an entity resolution assistant. Y
|
|
|
196330
196336
|
- Abbreviations should be merged with their full forms (e.g. "AGW" → "API Gateway")
|
|
196331
196337
|
|
|
196332
196338
|
## Task 2: Remove Noise
|
|
196333
|
-
-
|
|
196334
|
-
-
|
|
196335
|
-
- Examples of REAL entities to KEEP: product names (TTAstra, Gulux), tools (nvm, Rush), services (Op Main 服务), platforms (AGW 平台)
|
|
196336
|
-
- When uncertain, KEEP the name — only remove if clearly
|
|
196339
|
+
- Apply the **identity test**: a real entity is something you can discuss independently ("What is X?", "How does X work?", "Who owns X?"). Names that fail this test — values, addresses, actions, generic descriptions — are noise.
|
|
196340
|
+
- Remove names that are NOT meaningful named entities: generic words, action descriptions, or things that are attributes/values rather than independent subjects
|
|
196341
|
+
- Examples of REAL entities to KEEP: product names (TTAstra, Gulux), tools (nvm, Rush), services (Op Main 服务), platforms (AGW 平台) — these all pass the identity test
|
|
196342
|
+
- When uncertain, KEEP the name — only remove if it clearly fails the identity test
|
|
196337
196343
|
|
|
196338
196344
|
## Output
|
|
196339
196345
|
Valid JSON only. No markdown fences, no explanation.`;
|
|
@@ -196576,7 +196582,7 @@ Each diagram paragraph is tagged with [P0], [P1], etc. You must classify the dia
|
|
|
196576
196582
|
Relation schema: ${relationFields2}
|
|
196577
196583
|
3. Extract action nodes as behaviors (what the process does at each step).
|
|
196578
196584
|
Behavior schema: ${behaviorFields2}
|
|
196579
|
-
4. Extract diamond/
|
|
196585
|
+
4. Extract diamond/condition nodes: if it represents a deliberate choice with rationale → "decisions"; if it represents conditional branching logic (IF-THEN) → "rules".
|
|
196580
196586
|
Decision schema: ${decisionFields}
|
|
196581
196587
|
|
|
196582
196588
|
### Sequence → entities + relations + behaviors + events
|
|
@@ -196609,9 +196615,9 @@ Each diagram paragraph is tagged with [P0], [P1], etc. You must classify the dia
|
|
|
196609
196615
|
Relation schema: ${relationFields2}
|
|
196610
196616
|
|
|
196611
196617
|
### Architecture → entities + relations + constraints
|
|
196612
|
-
1. Extract each system/service/container/component as an entity.
|
|
196618
|
+
1. Extract each system/service/container/component as an entity. Use kind to indicate origin: "implementation" for internal systems/services, "external" for third-party dependencies (databases, cloud services, external APIs).
|
|
196613
196619
|
Entity schema: ${entityFields2}
|
|
196614
|
-
2. Extract connections between components as relations.
|
|
196620
|
+
2. Extract connections between components as relations. Use standard types: CONTAINS (parent→child), DEPENDS_ON (runtime dependency), TRIGGERS (event/process triggering).
|
|
196615
196621
|
Relation schema: ${relationFields2}
|
|
196616
196622
|
3. Extract deployment constraints, technology choices.
|
|
196617
196623
|
Constraint schema: ${constraintFields2}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o,u as m,a as c,j as e,b as d,C as h}from"./index-BKETuM1m.js";const p=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],f=o("arrow-left",p);function j({icon:a,title:t,badges:s,meta:l}){const i=m(),{t:r}=c();return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"shrink-0",children:a}),e.jsx("h1",{className:"min-w-0 break-all font-mono text-xl font-bold leading-none text-c4a-text-primary",children:t}),s&&s.length>0&&e.jsx("div",{className:"flex items-center gap-1.5 ml-2",children:s.map((n,x)=>e.jsx("span",{children:n},x))})]}),e.jsxs("button",{onClick:()=>i(-1),className:"flex items-center gap-1 text-c4a-text-muted hover:text-c4a-text-primary cursor-pointer transition-colors text-xs font-mono shrink-0 ml-4",children:[e.jsx(f,{size:14}),r("common.back")]})]}),l&&l.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap items-baseline gap-4 text-xs",children:l.map(n=>e.jsxs("span",{className:"text-c4a-text-muted",children:[n.label,":",e.jsx("span",{className:"text-c4a-text-secondary",children:n.value})]},n.label))})]})}function N(){const{t:a}=c(),{hashId:t}=d();if(!t)return e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:a("common.loading")})});const s=t.length>16?t.slice(0,16)+"…":t;return e.jsxs("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:[e.jsx(j,{icon:e.jsx("span",{children:"📄"}),title:`Content: ${s}`}),e.jsx(h,{hashId:t})]})}export{N as ContentDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n,b as a,j as e,E as i}from"./index-BKETuM1m.js";function r(){const{t:s}=n(),{entityId:t}=a();return t?e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(i,{entityId:t})}):e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:s("common.loading")})})}export{r as EntityDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as n,j as e,R as l}from"./index-BKETuM1m.js";function r(){const{t:s}=a(),{relationId:t}=n();return t?e.jsx("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e.jsx(l,{relationId:t})}):e.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:e.jsx("p",{className:"text-sm text-c4a-text-muted",children:s("common.loading")})})}export{r as RelationDetail};
|