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,142 @@
1
+ // dsh-argo-workspace - single source of truth for the DSH workspace bridge.
2
+ // install-argo.ps1 copies this file verbatim into ~/.dsh/plugins, so the
3
+ // deployed plugin and this shipped bundle artifact are byte-identical.
4
+ //
5
+ // Direct MCP bridge to the argo server for DeepSeek Harness. Registers every
6
+ // argo tool as mcp__argo__* and injects the current session's workspace
7
+ // directory (SessionHeader.cwd) as the per-call `workspaceRoot` argument, so
8
+ // one dsh instance follows whichever workspace the user switched to - the
9
+ // model sees no extra parameters and no internal tool names. The argo server
10
+ // honors the injected workspaceRoot unconditionally.
11
+ //
12
+ // Zero dependencies on purpose: implements the minimal MCP stdio client
13
+ // (JSON-RPC 2.0, one JSON object per line) with Node built-ins only, so the
14
+ // plugin runs from any DSH layout without resolving @modelcontextprotocol/sdk.
15
+ import { spawn } from 'node:child_process'
16
+ import readline from 'node:readline'
17
+ import { fileURLToPath } from 'node:url'
18
+
19
+ export const name = 'dsh-argo-workspace'
20
+ export const inject = ['tools']
21
+
22
+ // 包内默认:<pkg>/argo/scripts/argo-mcp-server.js —— 随包走,跨机器可移植。
23
+ const DEFAULT_SERVER_PATH = fileURLToPath(
24
+ new URL('../argo/scripts/argo-mcp-server.js', import.meta.url),
25
+ )
26
+
27
+ /** Minimal MCP stdio client over the argo server process. */
28
+ function createArgoClient(serverPath, env, cwd) {
29
+ const child = spawn('node', [serverPath], {
30
+ stdio: ['pipe', 'pipe', 'pipe'],
31
+ env,
32
+ ...(cwd ? { cwd } : {}),
33
+ })
34
+ const pending = new Map()
35
+ let nextId = 1
36
+ readline.createInterface({ input: child.stdout }).on('line', (line) => {
37
+ let message
38
+ try { message = JSON.parse(line) } catch { return }
39
+ if (message && typeof message.id === 'number' && pending.has(message.id)) {
40
+ const { resolve, reject } = pending.get(message.id)
41
+ pending.delete(message.id)
42
+ if (message.error) reject(new Error(JSON.stringify(message.error)))
43
+ else resolve(message.result)
44
+ }
45
+ })
46
+ child.stderr.on('data', () => {}) // drain; the argo server logs to stderr
47
+ const request = (method, params) => new Promise((resolve, reject) => {
48
+ const id = nextId++
49
+ pending.set(id, { resolve, reject })
50
+ child.stdin.write(JSON.stringify({ jsonrpc: '2.0', id, method, params }) + '\n')
51
+ })
52
+ return {
53
+ request,
54
+ notify: (method, params) => {
55
+ child.stdin.write(JSON.stringify({ jsonrpc: '2.0', method, params }) + '\n')
56
+ },
57
+ close: () => child.kill(),
58
+ }
59
+ }
60
+
61
+ /** Connect, list tools, register them, and keep the client until disposal. */
62
+ export async function apply(ctx, config) {
63
+ const serverPath = config.serverPath
64
+ ?? process.env.ARGO_SERVER_PATH
65
+ ?? DEFAULT_SERVER_PATH
66
+ const workspaces = Array.isArray(config.workspaces) ? config.workspaces : []
67
+ const env = { ...process.env }
68
+ if (workspaces.length > 0) env.ARGO_WORKSPACE_ROOTS = workspaces.join(';')
69
+ const client = createArgoClient(serverPath, env, config.cwd)
70
+ ctx.effect(() => () => client.close(), 'dsh-argo-workspace.dispose()')
71
+
72
+ let tools = []
73
+ try {
74
+ await client.request('initialize', {
75
+ protocolVersion: '2024-11-05',
76
+ capabilities: {},
77
+ clientInfo: { name: 'dsh-argo-workspace', version: '0.1.0' },
78
+ })
79
+ client.notify('notifications/initialized', {})
80
+ const listed = await client.request('tools/list', {})
81
+ tools = (listed && Array.isArray(listed.tools)) ? listed.tools : []
82
+ } catch (error) {
83
+ console.warn(`[dsh-argo-workspace] failed to connect to the argo MCP server (${serverPath}): ${error && error.message ? error.message : error}`)
84
+ return
85
+ }
86
+
87
+ const disposers = []
88
+ for (const tool of tools) {
89
+ const publicName = 'mcp__argo__' + tool.name
90
+ disposers.push(ctx.tools.register({
91
+ name: publicName,
92
+ description: tool.description ?? '',
93
+ parameters: tool.inputSchema,
94
+ output: {
95
+ schema: {
96
+ type: 'object',
97
+ properties: {
98
+ content: { type: 'array', items: {} },
99
+ structuredContent: {},
100
+ },
101
+ required: ['content'],
102
+ additionalProperties: false,
103
+ },
104
+ render: (_args, value) => value.content,
105
+ },
106
+ execute: async (args, exec) => {
107
+ // SessionHeader.cwd (the durable session workspace), NOT
108
+ // requestHeader() — that returns the request EpochHeader
109
+ // (config/system/tools) which has no cwd field.
110
+ const sessionCwd = exec && exec.agent && exec.agent.session
111
+ ? exec.agent.session.header?.cwd
112
+ : undefined
113
+ const injected = { ...(args && typeof args === 'object' ? args : {}) }
114
+ if (typeof sessionCwd === 'string' && sessionCwd !== '') {
115
+ injected.workspaceRoot = sessionCwd
116
+ }
117
+ if (exec && exec.signal && exec.signal.aborted) {
118
+ throw new Error('aborted')
119
+ }
120
+ const result = await client.request('tools/call', {
121
+ name: tool.name,
122
+ arguments: injected,
123
+ })
124
+ const text = Array.isArray(result.content)
125
+ ? result.content
126
+ .map((block) => block && block.type === 'text' && typeof block.text === 'string'
127
+ ? block.text
128
+ : JSON.stringify(block))
129
+ .join('\n')
130
+ : (result.toolResult !== undefined ? JSON.stringify(result.toolResult) : '(no output)')
131
+ if (result.isError === true) throw new Error(text)
132
+ return {
133
+ content: [{ type: 'text', text }],
134
+ ...(result.structuredContent !== undefined ? { structuredContent: result.structuredContent } : {}),
135
+ }
136
+ },
137
+ }))
138
+ }
139
+ ctx.effect(() => () => {
140
+ for (const dispose of disposers) dispose()
141
+ }, 'dsh-argo-workspace.tools')
142
+ }
@@ -0,0 +1 @@
1
+ {"type":"module"}