archgraph-argo 0.26.2 → 0.27.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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "ArgoBument default schema bundle descriptor",
4
+ "description": "Descriptor for the default ARGO schema bundle (ArchiMate 3.2 + ARGO extensions). A repository may override this bundle by placing its own SystemArchitecture.schema.json (plus an optional argob.config.json / argob-rules.json) under <workspace>/.argo/schema.",
5
+ "language": "ArchiMate 3.2",
6
+ "elementTypeEnumKey": "archimateElementType",
7
+ "relationshipTypeEnumKey": "archimateRelationshipType",
8
+ "actorElementType": "Business Actor",
9
+ "guide": "archimate3.2.md",
10
+ "deliveryDependencies": {
11
+ "sourceDependsOnTarget": ["Access", "Assignment", "Specialization", "Composition", "Aggregation"],
12
+ "targetDependsOnSource": ["Serving", "Realization", "Flow", "Triggering", "Influence"]
13
+ },
14
+ "invariants": {
15
+ "statementGrammar": true,
16
+ "endpointMatrix": true,
17
+ "rootViewName": "SystemArchitecture",
18
+ "maxElementsPerView": 15
19
+ }
20
+ }
@@ -12,6 +12,13 @@ const {
12
12
  const {
13
13
  loadRepositoryArgoEnvironment,
14
14
  } = require('./repositoryArgoEnvironment.js');
15
+ const {
16
+ loadSchemaBundleAndOntology,
17
+ } = require('./argob-schema.js');
18
+ const {
19
+ externalQueryRequested,
20
+ queryExternalRead,
21
+ } = require('./external-graph-query.js');
15
22
  const {
16
23
  getWorkspaceRoot,
17
24
  hasStaticWorkspace,
@@ -132,7 +139,7 @@ const TOOLS = [
132
139
  },
133
140
  {
134
141
  name: 'previewSystemArchitectureMutation',
135
- description: 'Use before apply for complex or risky changes. Performs a dry-run of one or more mutations, runs schema, graph, view, and ArchiMate 3.2 validation, and does not write the graph.',
142
+ description: 'Use before apply for complex or risky changes. Performs a dry-run of one or more mutations, runs schema, graph, view, and modeling-language validation, and does not write the graph.',
136
143
  inputSchema: mutationInputSchema(),
137
144
  },
138
145
  {
@@ -405,6 +412,16 @@ async function callTool(name, args = {}, progressToken = null, dependencies = un
405
412
  } catch {
406
413
  // diagnostics are best-effort; never block a tool call
407
414
  }
415
+ // Cross-project read: a read tool with `projectId` is routed to the federation
416
+ // center (never silently served from the local graph).
417
+ if (externalQueryRequested(name, args)) {
418
+ const result = await queryExternalRead({
419
+ workspaceRoot: resolveWorkspaceRoot(args),
420
+ tool: name,
421
+ args,
422
+ });
423
+ return toolResult(result);
424
+ }
408
425
  if (name === 'initializeWorkspace') {
409
426
  const workspace = await initializeWorkspace(resolveWorkspaceRoot(args));
410
427
  // Deterministic argo-init harness report (Neo4j structural sync, semantic
@@ -421,6 +438,10 @@ async function callTool(name, args = {}, progressToken = null, dependencies = un
421
438
  return toolResult({
422
439
  status: report.status,
423
440
  workspaceRoot: workspace.workspaceRoot,
441
+ // The resolved modeling language for this workspace (default ArgoBument vs
442
+ // the repository's own .argo/schema bundle) so init names the active schema.
443
+ schema: workspace.schema,
444
+ schemaBundle: report.schemaBundle,
424
445
  targetEaName: workspace.targetEaName,
425
446
  createdFiles: workspace.createdFiles,
426
447
  updatedFiles: workspace.updatedFiles,
@@ -514,6 +535,22 @@ async function initializeWorkspace(workspaceRoot) {
514
535
  const graphTargetPath = path.join(workspaceRoot, ...WORKSPACE_GRAPH_PATH_SEGMENTS);
515
536
  const graphRelativePath = normalizeRelativePath(path.relative(workspaceRoot, graphTargetPath));
516
537
  if (!fs.existsSync(graphTargetPath)) {
538
+ // Only the built-in ArgoBument default schema auto-provides a graph (the
539
+ // packaged default). For any custom / replaced schema the graph is the user's
540
+ // own: never copy the packaged (mismatched) graph — fail closed if missing.
541
+ let ontology = null;
542
+ try { ontology = loadSchemaBundleAndOntology(workspaceRoot).ontology; } catch { ontology = null; }
543
+ const usesPackagedDefaultGraph = !!ontology && ontology.kind === 'default' && ontology.dialect === 'archimate-class-matrix';
544
+ if (!usesPackagedDefaultGraph) {
545
+ const label = ontology ? `${ontology.kind} / ${ontology.language}` : 'unknown';
546
+ const error = new Error(
547
+ `No default graph for the custom schema (${label}): the workspace has no ${graphRelativePath}. ` +
548
+ 'A custom schema must author its own graph; the packaged default graph is not copied because it would not match the schema. ' +
549
+ `Add ${graphRelativePath} to the workspace.`,
550
+ );
551
+ error.code = 'NO_DEFAULT_GRAPH';
552
+ throw error;
553
+ }
517
554
  const graphSourcePath = resolveGraphDefaultSourcePath();
518
555
  await fs.promises.mkdir(path.dirname(graphTargetPath), { recursive: true });
519
556
  await fs.promises.copyFile(graphSourcePath, graphTargetPath);
@@ -553,8 +590,28 @@ async function initializeWorkspace(workspaceRoot) {
553
590
  } catch (error) {
554
591
  qeaFullProjection = { status: 'failed', error: String(error && error.message ? error.message : error) };
555
592
  }
593
+ // Report which schema this workspace resolves to (default ArgoBument vs a
594
+ // repository's own .argo/schema bundle) so the caller/human can see the active
595
+ // modeling language right after init.
596
+ let schema;
597
+ try {
598
+ const { bundle, ontology } = loadSchemaBundleAndOntology(workspaceRoot);
599
+ schema = {
600
+ kind: bundle.kind,
601
+ language: ontology.language,
602
+ dialect: ontology.dialect,
603
+ dir: bundle.relativeDir,
604
+ guide: bundle.guidePath ? bundle.guidePath.relativePath : null,
605
+ actorElementType: ontology.actorElementType,
606
+ bundleValidation: ontology.bundleValidation ? ontology.bundleValidation.status : null,
607
+ };
608
+ } catch (error) {
609
+ schema = { kind: 'unknown', error: String(error && error.message ? error.message : error) };
610
+ }
611
+
556
612
  return {
557
613
  workspaceRoot,
614
+ schema,
558
615
  qeaFullProjection,
559
616
  targetEaName,
560
617
  createdFiles,
@@ -634,6 +691,14 @@ function toolResult(payload) {
634
691
  }
635
692
 
636
693
  function canonicalInitErrorResult(error) {
694
+ // Workspace-bootstrap faults (e.g. a schema with no default graph) are not
695
+ // semantic-lifecycle secrets and must surface their message to the caller.
696
+ if (error && error.code === 'NO_DEFAULT_GRAPH') {
697
+ return toolResult({
698
+ status: 'failed',
699
+ error: { category: 'WORKSPACE_INIT_FAILED', code: error.code, message: String(error.message) },
700
+ });
701
+ }
637
702
  const result = semanticOperatorErrorResult(error);
638
703
  if (error.safeSemanticLifecycleMessage !== true) return result;
639
704
  const payload = Object.freeze({
@@ -768,6 +833,7 @@ async function handleRequest(request, dependencies = undefined) {
768
833
  && params.arguments
769
834
  && Object.prototype.hasOwnProperty.call(params.arguments, 'query')
770
835
  && params.arguments.query
836
+ && !externalQueryRequested(params.name, params.arguments)
771
837
  ) {
772
838
  activeDependencies = {
773
839
  semanticOperatorJourney: