archgraph-argo-beta 0.27.0-beta.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.
Files changed (85) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +107 -0
  3. package/argo/.env.example +170 -0
  4. package/argo/defaults/EA-model-template.qea +0 -0
  5. package/argo/defaults/design/KG/SystemArchitecture.json +128 -0
  6. package/argo/mcp-bridges/graph-mcp-stdio.js +98 -0
  7. package/argo/package.json +8 -0
  8. package/argo/plugins/argo-cost-collector.js +35 -0
  9. package/argo/plugins/argo-wakeup.js +29 -0
  10. package/argo/rules/archgraph.instructions.md +189 -0
  11. package/argo/schema/ImplementationToCodingHandoff.schema.json +252 -0
  12. package/argo/schema/ImplementationToIntentTraceProposal.schema.json +180 -0
  13. package/argo/schema/IntentToImplementationHandoff.schema.json +75 -0
  14. package/argo/schema/SystemArchitecture.schema.json +378 -0
  15. package/argo/schema/archimate3.2.md +7153 -0
  16. package/argo/schema/argob-rules.json +12229 -0
  17. package/argo/schema/argob.config.json +20 -0
  18. package/argo/scripts/ARCHITECTURE.md +58 -0
  19. package/argo/scripts/agentSearchDiagnose.js +407 -0
  20. package/argo/scripts/archimate32-rules.js +12301 -0
  21. package/argo/scripts/argo-mcp-server.js +952 -0
  22. package/argo/scripts/argo-paths.js +168 -0
  23. package/argo/scripts/argob-schema.js +574 -0
  24. package/argo/scripts/ea-qea-sync-lib.js +1014 -0
  25. package/argo/scripts/ea-qea-sync.js +110 -0
  26. package/argo/scripts/ensureArgoHarnessEnvironment.js +451 -0
  27. package/argo/scripts/external-graph-query.js +162 -0
  28. package/argo/scripts/generateArchitectureDiffPlantuml.js +466 -0
  29. package/argo/scripts/graph-rag/ARCHITECTURE.md +192 -0
  30. package/argo/scripts/graph-rag/agentCostLog.js +179 -0
  31. package/argo/scripts/graph-rag/canonicalProjectionAuthority.js +45 -0
  32. package/argo/scripts/graph-rag/defaultSemanticRetrieval.js +1244 -0
  33. package/argo/scripts/graph-rag/embeddingProviderProfile.js +89 -0
  34. package/argo/scripts/graph-rag/embeddingQualificationGate.js +59 -0
  35. package/argo/scripts/graph-rag/externalProductionConfig.js +74 -0
  36. package/argo/scripts/graph-rag/hybridRetrieval.js +114 -0
  37. package/argo/scripts/graph-rag/liveEmbeddingIndexGate.js +128 -0
  38. package/argo/scripts/graph-rag/liveEmbeddingNeo4jBoundary.js +137 -0
  39. package/argo/scripts/graph-rag/liveEmbeddingProviderClient.js +49 -0
  40. package/argo/scripts/graph-rag/liveEmbeddingProviderConfig.js +571 -0
  41. package/argo/scripts/graph-rag/mcpCrashDiagnostics.js +137 -0
  42. package/argo/scripts/graph-rag/mutationEmbeddingVectorLifecycle.js +1266 -0
  43. package/argo/scripts/graph-rag/neo4jNativeRetrieval.js +37 -0
  44. package/argo/scripts/graph-rag/productionGraphRagRuntime.js +1633 -0
  45. package/argo/scripts/graph-rag/rerankRetrieval.js +201 -0
  46. package/argo/scripts/graph-rag/semantic-persistence/ARCHITECTURE.md +51 -0
  47. package/argo/scripts/graph-rag/semantic-persistence/productionSemanticBackfill.js +342 -0
  48. package/argo/scripts/graph-rag/semantic-persistence/productionSemanticCheckpointStore.js +99 -0
  49. package/argo/scripts/graph-rag/semantic-persistence/productionSemanticNeo4jAdapter.js +186 -0
  50. package/argo/scripts/graph-rag/semantic-persistence/productionSemanticProjectionStore.js +171 -0
  51. package/argo/scripts/graph-rag/semanticAlignmentLock.js +76 -0
  52. package/argo/scripts/graph-rag/semanticAlignmentRunner.js +131 -0
  53. package/argo/scripts/graph-rag/semanticInitConfiguration.js +24 -0
  54. package/argo/scripts/graph-rag/semanticOperatorError.js +38 -0
  55. package/argo/scripts/graph-rag/semanticOperatorJourney.js +459 -0
  56. package/argo/scripts/graph-rag/semanticReadinessAttestationStore.js +398 -0
  57. package/argo/scripts/graph-rag/semanticRecordText.js +75 -0
  58. package/argo/scripts/graph-rag/systemMetadataCommandAdapter.js +269 -0
  59. package/argo/scripts/graph-semantics.js +266 -0
  60. package/argo/scripts/lossless-write-gate.js +500 -0
  61. package/argo/scripts/neo4j-system-architecture-store.js +1066 -0
  62. package/argo/scripts/repair-subdiagram-views.js +288 -0
  63. package/argo/scripts/repositoryArgoEnvironment.js +101 -0
  64. package/argo/scripts/runArchitectureTests.js +591 -0
  65. package/argo/scripts/semanticOperatorJourneyCli.js +91 -0
  66. package/argo/scripts/syncSystemArchitectureToNeo4j.js +67 -0
  67. package/argo/scripts/systemarchitecture-mcp-server.js +4508 -0
  68. package/argo/scripts/test-executors/_template.js +58 -0
  69. package/argo/scripts/test-executors/default.js +199 -0
  70. package/argo/scripts/validateStageHandoff.js +459 -0
  71. package/argo/scripts/validateSystemArchitecture.js +261 -0
  72. package/argo/scripts/validateTraceProposal.js +181 -0
  73. package/argo/scripts/validator-mcp-server.js +347 -0
  74. package/argo/skills/agent-search-diagnosis/SKILL.md +60 -0
  75. package/argo/skills/argo-init/SKILL.md +86 -0
  76. package/argo/skills/ea-human-reconcile/SKILL.md +40 -0
  77. package/bin/argo-deploy.js +12 -0
  78. package/cordis.patch.yml +6 -0
  79. package/dsh-argo-wakeup/index.js +17 -0
  80. package/dsh-argo-wakeup/package.json +1 -0
  81. package/dsh-argo-workspace/index.js +142 -0
  82. package/dsh-argo-workspace/package.json +1 -0
  83. package/install-argo.ps1 +1162 -0
  84. package/package.json +56 -0
  85. package/vendor/neo4j-driver-6.2.0.tgz +0 -0
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ // Crash diagnostics for the ARGO MCP server. A native abort (libuv assertion) or
4
+ // an uncaught error currently kills the server with no trace in the host log.
5
+ // This module:
6
+ // - persists a "phase breadcrumb" synchronously on every phase change, so the
7
+ // LAST phase before a crash is always recoverable (even for native aborts
8
+ // that never fire JS handlers);
9
+ // - appends uncaught-exception (incl. unhandled-rejection, which Node raises as
10
+ // an uncaught exception) and process-exit records to a per-workspace crash
11
+ // log.
12
+ // It uses `uncaughtExceptionMonitor` (which logs WITHOUT changing Node's default
13
+ // crash behaviour) and never logs secret values.
14
+
15
+ const fs = require('node:fs');
16
+ const path = require('node:path');
17
+
18
+ let installed = false;
19
+ let crashLogPath = null;
20
+ let phasePath = null;
21
+ let currentPhase = 'startup';
22
+ const startedAt = Date.now();
23
+
24
+ function tempPath(workspaceRoot, name) {
25
+ return path.join(workspaceRoot, '.argo', 'temp', name);
26
+ }
27
+
28
+ function crashLogFilePath() {
29
+ return crashLogPath;
30
+ }
31
+
32
+ function appendCrash(entry) {
33
+ if (!crashLogPath) {
34
+ return;
35
+ }
36
+ try {
37
+ fs.mkdirSync(path.dirname(crashLogPath), { recursive: true });
38
+ const error = entry && entry.error;
39
+ const line = JSON.stringify({
40
+ at: new Date().toISOString(),
41
+ pid: process.pid,
42
+ uptimeMs: Date.now() - startedAt,
43
+ phase: entry && entry.phase !== undefined ? entry.phase : currentPhase,
44
+ kind: entry && entry.kind,
45
+ ...(entry && entry.origin ? { origin: entry.origin } : {}),
46
+ ...(entry && entry.code !== undefined ? { code: entry.code } : {}),
47
+ ...(entry && entry.signal !== undefined ? { signal: entry.signal } : {}),
48
+ ...(entry && entry.previousPid !== undefined ? { previousPid: entry.previousPid } : {}),
49
+ ...(entry && entry.previousAt !== undefined ? { previousAt: entry.previousAt } : {}),
50
+ ...(error ? {
51
+ category: error.category,
52
+ message: String(error.message || error).slice(0, 1000),
53
+ stack: String(error.stack || '').slice(0, 4000),
54
+ } : {}),
55
+ }) + '\n';
56
+ fs.appendFileSync(crashLogPath, line, 'utf8');
57
+ } catch {
58
+ // best-effort diagnostics only; never throw from the crash path
59
+ }
60
+ }
61
+
62
+ // A native abort never fires a JS handler, so the ONLY record of the crash-time
63
+ // phase is the synchronously-written phase file. A restart would overwrite it;
64
+ // preserve the previous run's last phase into the (append-only) crash log first.
65
+ function capturePreviousRun() {
66
+ if (!phasePath || !crashLogPath) {
67
+ return;
68
+ }
69
+ try {
70
+ const previous = JSON.parse(fs.readFileSync(phasePath, 'utf8'));
71
+ if (previous && previous.pid !== undefined && previous.pid !== process.pid) {
72
+ appendCrash({
73
+ kind: 'previous-run-phase',
74
+ phase: previous.phase,
75
+ previousPid: previous.pid,
76
+ previousAt: previous.at,
77
+ });
78
+ }
79
+ } catch {
80
+ // no previous phase file
81
+ }
82
+ }
83
+
84
+ function installCrashDiagnostics(workspaceRoot) {
85
+ if (workspaceRoot) {
86
+ crashLogPath = tempPath(workspaceRoot, 'mcp-crash.log');
87
+ phasePath = tempPath(workspaceRoot, 'mcp-phase.json');
88
+ capturePreviousRun();
89
+ markPhase(currentPhase);
90
+ }
91
+ if (installed) {
92
+ return;
93
+ }
94
+ installed = true;
95
+ // Logs without altering Node's default crash behaviour (unlike a bare
96
+ // 'uncaughtException' listener, which would swallow the crash).
97
+ process.on('uncaughtExceptionMonitor', (error, origin) => {
98
+ appendCrash({ kind: 'uncaughtException', origin, error });
99
+ });
100
+ process.on('exit', (code, signal) => {
101
+ appendCrash({ kind: 'exit', code: code === undefined ? null : code, signal: signal === undefined ? null : signal });
102
+ });
103
+ }
104
+
105
+ // Synchronous breadcrumb: guarantees the last phase survives a hard abort.
106
+ function markPhase(phase) {
107
+ currentPhase = String(phase === undefined || phase === null ? '' : phase);
108
+ if (!phasePath) {
109
+ return;
110
+ }
111
+ try {
112
+ fs.mkdirSync(path.dirname(phasePath), { recursive: true });
113
+ fs.writeFileSync(phasePath, JSON.stringify({
114
+ phase: currentPhase,
115
+ at: new Date().toISOString(),
116
+ pid: process.pid,
117
+ }) + '\n', 'utf8');
118
+ } catch {
119
+ // best-effort
120
+ }
121
+ }
122
+
123
+ function readLastPhase(workspaceRoot) {
124
+ try {
125
+ const parsed = JSON.parse(fs.readFileSync(tempPath(workspaceRoot, 'mcp-phase.json'), 'utf8'));
126
+ return parsed && typeof parsed.phase === 'string' ? parsed.phase : null;
127
+ } catch {
128
+ return null;
129
+ }
130
+ }
131
+
132
+ module.exports = {
133
+ installCrashDiagnostics,
134
+ markPhase,
135
+ readLastPhase,
136
+ crashLogFilePath,
137
+ };