progmune-runtime 2.0.4 → 2.1.1
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/.mcp.json +11 -0
- package/.progmune_allowlist +50 -0
- package/.test_report/test_report.md +87 -0
- package/Dockerfile +2 -10
- package/FAQ.md +167 -0
- package/README.md +108 -54
- package/demo-project/auth.ts +55 -0
- package/demo-project/tsconfig.json +8 -0
- package/dist/ab-stats.js +11 -0
- package/dist/acl-breakdown.js +13 -0
- package/dist/action-runtime.js +1 -0
- package/dist/all-sessions.js +11 -0
- package/dist/antibody-stats.js +11 -0
- package/dist/audit.js +222 -0
- package/dist/benchmark-count.js +7 -0
- package/dist/benchmark-full.js +17 -0
- package/dist/benchmark-pass-rate.js +54 -0
- package/dist/benchmark-report.js +67 -0
- package/dist/benchmark-save.js +62 -0
- package/dist/benchmark-status.js +15 -0
- package/dist/branch-ledger.js +393 -0
- package/dist/branch-tree-count.js +14 -0
- package/dist/check.js +506 -0
- package/dist/common-fixpath.js +12 -0
- package/dist/constraint-types.js +12 -0
- package/dist/deterministic-replay.js +283 -0
- package/dist/emitter.js +143 -12
- package/dist/exec-metrics.js +11 -0
- package/dist/execute.js +251 -0
- package/dist/extract-ir.js +592 -5
- package/dist/failure-collector.js +163 -0
- package/dist/failure-corpus.js +507 -35
- package/dist/failure-report.js +11 -0
- package/dist/failures.js +11 -0
- package/dist/fast-path-hits.js +13 -0
- package/dist/feedback.js +10 -3
- package/dist/file-lock.js +82 -0
- package/dist/find-session.js +10 -0
- package/dist/fingerprint-list.js +15 -0
- package/dist/gen-history-log.js +13 -0
- package/dist/generate.js +2 -1
- package/dist/generate_500.js +4 -2
- package/dist/genome.js +11 -0
- package/dist/heatmap-data.js +11 -0
- package/dist/heatmap.js +11 -0
- package/dist/immune-reporter.js +34 -22
- package/dist/ir-utils.js +18 -0
- package/dist/learned.js +11 -0
- package/dist/ledger-registry.js +252 -0
- package/dist/llm.js +46 -2
- package/dist/load-benchmarks.js +47 -0
- package/dist/main.js +2 -1
- package/dist/mcp-server.mjs +445 -43
- package/dist/memory-layer.js +54 -13
- package/dist/metrics.js +11 -0
- package/dist/obs-web.js +561 -0
- package/dist/p0_ssg_demo.js +255 -40
- package/dist/planner.js +996 -80
- package/dist/protocol-registry.js +112 -0
- package/dist/recent-session.js +12 -0
- package/dist/repair-proposal.js +363 -0
- package/dist/runtime-invariants.js +170 -0
- package/dist/runtime-types.js +117 -0
- package/dist/runtime.js +1 -0
- package/dist/search-planner.js +39 -9
- package/dist/semantic-snapshot.js +157 -0
- package/dist/semantic-trace.js +1497 -0
- package/dist/semantic-validator.js +3 -2
- package/dist/semantic_guard_test.js +2 -1
- package/dist/session-utils.js +19 -0
- package/dist/sessions.js +11 -0
- package/dist/ssg-validator.js +666 -20
- package/dist/svl-distribution.js +11 -0
- package/dist/terminal-status.js +11 -0
- package/dist/test_failure_corpus.js +3 -1
- package/dist/token-savings.js +11 -0
- package/dist/total-repairs.js +12 -0
- package/dist/unresolved-count.js +12 -0
- package/dist/utils.js +2 -0
- package/dist/valid-fingerprints.js +13 -0
- package/dist/validator.js +118 -60
- package/dist/verify-fps.js +11 -0
- package/dist/verify-ledgers.js +11 -0
- package/docs/whitepaper-style.css +77 -0
- package/docs/whitepaper-v2.1.md +609 -0
- package/docs/whitepaper-v2.2.md +1064 -0
- package/docs/whitepaper-v2.2.pdf +0 -0
- package/fly.toml +1 -1
- package/package.json +13 -4
- package/protocols.json +131 -11
- package/public/dashboard.html +119 -0
- package/server/hub.js +84 -12
- package/test/replay-golden/sess_1780063202050_mgeld.json +9 -0
- package/test/replay-golden/sess_1780064032560_gocld.json +354 -0
- package/test/replay-golden/sess_1780064413331_s2709.json +606 -0
- package/test/replay-golden/sess_1780064792710_y3avo.json +614 -0
- package/test/replay-golden.ts +84 -0
- package/test_benchmark.js +165 -0
- package/test_comprehensive.mjs +638 -0
- package/test_concurrency.js +129 -0
- package/test_ir_robustness.js +85 -0
- package/test_semantic_contracts.js +269 -0
- package/test_ssg_stress.js +156 -0
- package/test_svl3.js +58 -0
- package/tsconfig.json +1 -1
- package/.env.example +0 -3
- package/.progmune_memory/episodic.json +0 -186
- package/.progmune_memory/fingerprints.json +0 -7
- package/.progmune_memory/opt_in.json +0 -4
- package/immune_hub_data/2026-05-14.json +0 -50
package/test_svl3.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
|
|
3
|
+
// 确保 ir.json 存在
|
|
4
|
+
const ir = [
|
|
5
|
+
{ name: 'cache_get', params: [{ name: 'key', type: 'str' }], returnType: 'any', file: 'auth.py' },
|
|
6
|
+
];
|
|
7
|
+
fs.writeFileSync('ir.json', JSON.stringify(ir, null, 2));
|
|
8
|
+
|
|
9
|
+
// 内联 checkVariableFlow 逻辑
|
|
10
|
+
function checkVariableFlow(actions) {
|
|
11
|
+
const errors = [];
|
|
12
|
+
const declared = new Map();
|
|
13
|
+
|
|
14
|
+
const isLiteral = (val) => {
|
|
15
|
+
if (typeof val !== 'string') return true;
|
|
16
|
+
if (/^["'`]/.test(val) || /["'`]$/.test(val)) return true;
|
|
17
|
+
if (/^\d+$/.test(val)) return true;
|
|
18
|
+
if (val === 'true' || val === 'false' || val === 'null' || val === 'undefined') return true;
|
|
19
|
+
if (/\s/.test(val) || /[^\w]/.test(val)) return true;
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const processAction = (action) => {
|
|
24
|
+
console.log('处理动作:', JSON.stringify(action));
|
|
25
|
+
if (action.kind === 'call') {
|
|
26
|
+
for (const arg of (action.args || [])) {
|
|
27
|
+
const val = arg.value;
|
|
28
|
+
console.log(' 参数值:', val, '类型:', typeof val, 'isLiteral:', isLiteral(val), '是否为标识符:', /^[a-zA-Z_]\w*$/.test(val));
|
|
29
|
+
if (typeof val === 'string' && !isLiteral(val)) {
|
|
30
|
+
if (/^[a-zA-Z_]\w*$/.test(val) && !declared.has(val)) {
|
|
31
|
+
const errMsg = "变量 '" + val + "' 未声明就使用";
|
|
32
|
+
errors.push(errMsg);
|
|
33
|
+
console.log(' -> 检测到错误:', errMsg);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (action.assignTo) {
|
|
38
|
+
declared.set(action.assignTo, 'any');
|
|
39
|
+
console.log(' 声明变量:', action.assignTo);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
for (const action of actions) processAction(action);
|
|
45
|
+
return errors;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const actions = [
|
|
49
|
+
{
|
|
50
|
+
kind: 'call',
|
|
51
|
+
function: 'cache_get',
|
|
52
|
+
args: [{ name: 'key', type: 'str', value: 'myCacheKey' }]
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const errors = checkVariableFlow(actions);
|
|
57
|
+
console.log('\n最终错误列表:', JSON.stringify(errors));
|
|
58
|
+
console.log(errors.length > 0 ? '✅ SVL-3 生效了!' : '❌ SVL-3 仍未生效');
|
package/tsconfig.json
CHANGED
package/.env.example
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"intent": "生成一个JWT令牌",
|
|
4
|
-
"actions": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "assign",
|
|
7
|
-
"target": "payload",
|
|
8
|
-
"value": "user:123"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"kind": "call",
|
|
12
|
-
"function": "generate_jwt",
|
|
13
|
-
"args": [
|
|
14
|
-
{
|
|
15
|
-
"name": "payload",
|
|
16
|
-
"type": "UserPayload",
|
|
17
|
-
"value": "payload"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"assignTo": "token"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"kind": "return",
|
|
24
|
-
"value": "token"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"success": true,
|
|
28
|
-
"id": "ep_1778775611414",
|
|
29
|
-
"timestamp": "2026-05-14T16:20:11.414Z"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"intent": "生成一个JWT令牌",
|
|
33
|
-
"actions": [],
|
|
34
|
-
"success": false,
|
|
35
|
-
"id": "ep_1778775591074",
|
|
36
|
-
"timestamp": "2026-05-14T16:19:51.074Z"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"intent": "生成一个JWT令牌",
|
|
40
|
-
"actions": [
|
|
41
|
-
{
|
|
42
|
-
"kind": "assign",
|
|
43
|
-
"target": "payload",
|
|
44
|
-
"value": "user:123"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"kind": "call",
|
|
48
|
-
"function": "generate_jwt",
|
|
49
|
-
"args": [
|
|
50
|
-
{
|
|
51
|
-
"name": "payload",
|
|
52
|
-
"type": "UserPayload",
|
|
53
|
-
"value": "payload"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"assignTo": "token"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"kind": "return",
|
|
60
|
-
"value": "token"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
"success": true,
|
|
64
|
-
"id": "ep_1778775315729",
|
|
65
|
-
"timestamp": "2026-05-14T16:15:15.729Z"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"intent": "生成一个JWT令牌",
|
|
69
|
-
"actions": [
|
|
70
|
-
{
|
|
71
|
-
"kind": "assign",
|
|
72
|
-
"target": "payload",
|
|
73
|
-
"value": "user:123"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"kind": "call",
|
|
77
|
-
"function": "generate_jwt",
|
|
78
|
-
"args": [
|
|
79
|
-
{
|
|
80
|
-
"name": "payload",
|
|
81
|
-
"type": "UserPayload",
|
|
82
|
-
"value": "payload"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
"assignTo": "token"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"kind": "return",
|
|
89
|
-
"value": "token"
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"success": true,
|
|
93
|
-
"id": "ep_1778775173516",
|
|
94
|
-
"timestamp": "2026-05-14T16:12:53.516Z"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"intent": "创建一个带令牌的会话",
|
|
98
|
-
"actions": [
|
|
99
|
-
{
|
|
100
|
-
"kind": "assign",
|
|
101
|
-
"target": "user_payload",
|
|
102
|
-
"value": "user:123"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"kind": "call",
|
|
106
|
-
"function": "query_data",
|
|
107
|
-
"args": [
|
|
108
|
-
{
|
|
109
|
-
"name": "key",
|
|
110
|
-
"type": "str",
|
|
111
|
-
"value": "user_payload"
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
"assignTo": "user_data"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"kind": "assign",
|
|
118
|
-
"target": "plain_password",
|
|
119
|
-
"value": "password123"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"kind": "call",
|
|
123
|
-
"function": "verify_password",
|
|
124
|
-
"args": [
|
|
125
|
-
{
|
|
126
|
-
"name": "plain",
|
|
127
|
-
"type": "str",
|
|
128
|
-
"value": "plain_password"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"name": "hash",
|
|
132
|
-
"type": "PasswordHash",
|
|
133
|
-
"value": "user_data"
|
|
134
|
-
}
|
|
135
|
-
],
|
|
136
|
-
"assignTo": "password_valid"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"kind": "call",
|
|
140
|
-
"function": "generate_jwt",
|
|
141
|
-
"args": [
|
|
142
|
-
{
|
|
143
|
-
"name": "payload",
|
|
144
|
-
"type": "UserPayload",
|
|
145
|
-
"value": "user_payload"
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
"assignTo": "token"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"kind": "call",
|
|
152
|
-
"function": "create_session",
|
|
153
|
-
"args": [
|
|
154
|
-
{
|
|
155
|
-
"name": "user",
|
|
156
|
-
"type": "UserPayload",
|
|
157
|
-
"value": "user_payload"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "token",
|
|
161
|
-
"type": "Token",
|
|
162
|
-
"value": "token"
|
|
163
|
-
}
|
|
164
|
-
],
|
|
165
|
-
"assignTo": "session"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"kind": "return",
|
|
169
|
-
"value": "session"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"kind": "return",
|
|
173
|
-
"value": "error"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"kind": "if",
|
|
177
|
-
"condition": "password_valid",
|
|
178
|
-
"thenActions": [],
|
|
179
|
-
"elseActions": []
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
"success": true,
|
|
183
|
-
"id": "ep_1778775082912",
|
|
184
|
-
"timestamp": "2026-05-14T16:11:22.919Z"
|
|
185
|
-
}
|
|
186
|
-
]
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"instance_id": "1009ae6be3d4526c",
|
|
4
|
-
"timestamp": "2026-05-13T18:53:16.840Z",
|
|
5
|
-
"violatedSVL": "SVL-4",
|
|
6
|
-
"constraintType": "protocol",
|
|
7
|
-
"functionSequence": [
|
|
8
|
-
"generate_jwt"
|
|
9
|
-
],
|
|
10
|
-
"preState": [
|
|
11
|
-
"UNAUTHENTICATED"
|
|
12
|
-
],
|
|
13
|
-
"count": 1
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"instance_id": "1009ae6be3d4526c",
|
|
17
|
-
"timestamp": "2026-05-13T21:24:45.973Z",
|
|
18
|
-
"violatedSVL": "SVL-4",
|
|
19
|
-
"constraintType": "protocol",
|
|
20
|
-
"functionSequence": [
|
|
21
|
-
"generate_jwt",
|
|
22
|
-
"create_session"
|
|
23
|
-
],
|
|
24
|
-
"count": 1
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"instance_id": "1009ae6be3d4526c",
|
|
28
|
-
"timestamp": "2026-05-13T21:24:47.155Z",
|
|
29
|
-
"violatedSVL": "SVL-4",
|
|
30
|
-
"constraintType": "protocol",
|
|
31
|
-
"functionSequence": [
|
|
32
|
-
"query_data",
|
|
33
|
-
"generate_jwt",
|
|
34
|
-
"create_session"
|
|
35
|
-
],
|
|
36
|
-
"count": 1
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"instance_id": "1009ae6be3d4526c",
|
|
40
|
-
"timestamp": "2026-05-13T21:24:48.290Z",
|
|
41
|
-
"violatedSVL": "SVL-4",
|
|
42
|
-
"constraintType": "protocol",
|
|
43
|
-
"functionSequence": [
|
|
44
|
-
"query_data",
|
|
45
|
-
"generate_jwt",
|
|
46
|
-
"create_session"
|
|
47
|
-
],
|
|
48
|
-
"count": 1
|
|
49
|
-
}
|
|
50
|
-
]
|