atris 3.71.3 → 3.72.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.
- package/atris/skills/campaigns/SKILL.md +1 -1
- package/bin/atris.js +7 -1
- package/commands/autoland.js +102 -2
- package/commands/campaign.js +86 -13
- package/commands/clean.js +60 -4
- package/commands/gm.js +1273 -7
- package/commands/member.js +28 -3
- package/commands/mission.js +72 -23
- package/commands/sync.js +2 -2
- package/commands/task.js +49 -13
- package/commands/zen.js +183 -0
- package/lib/auto-accept-certified.js +9 -4
- package/lib/campaign-cadence.js +15 -5
- package/lib/campaign-core.js +44 -17
- package/lib/campaign-loop.js +45 -14
- package/lib/campaign-reading.js +14 -1
- package/lib/campaign-rsi.js +28 -11
- package/lib/campaign-schedule.js +124 -0
- package/lib/campaign-store.js +34 -2
- package/lib/campaign-trace.js +40 -14
- package/lib/engine-resource.js +5 -1
- package/lib/gm-bet.js +2219 -0
- package/lib/gm-phone-page.js +1102 -0
- package/lib/gm-phone.js +682 -0
- package/lib/gm-season.js +1162 -0
- package/lib/gm-target.js +292 -0
- package/lib/job-code-verify.js +169 -0
- package/lib/known-commands.js +1 -1
- package/lib/member-autoland.js +105 -14
- package/lib/member-progress.js +2 -2
- package/lib/member-report.js +11 -1
- package/lib/member-self-next-job.js +6 -1
- package/lib/member-up.js +17 -8
- package/lib/merged-review-close.js +206 -0
- package/lib/mission-protected-lane.js +52 -4
- package/lib/qr.js +338 -0
- package/lib/yes-lock.js +530 -0
- package/lib/zen-apply.js +511 -0
- package/lib/zen-workspace.js +121 -0
- package/lib/zen.js +395 -0
- package/package.json +1 -1
package/lib/campaign-trace.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
const crypto = require('crypto');
|
|
10
|
-
const { compareEvents, fold,
|
|
10
|
+
const { compareEvents, fold, foldWithSummaryPrefixes } = require('./campaign-core');
|
|
11
11
|
const { judgeReading } = require('./campaign-reading');
|
|
12
12
|
|
|
13
13
|
const SCHEMA = 'atris.campaign.trace';
|
|
@@ -55,16 +55,14 @@ function foldOrder(events) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
function compactState(view, run) {
|
|
58
|
-
const missions = { proposed: 0, claimed: 0, running: 0, ended: 0, vetoed: 0, dropped: 0 };
|
|
59
|
-
for (const m of view.missions) missions[m.status] = (missions[m.status] || 0) + 1;
|
|
60
58
|
return {
|
|
61
59
|
state: view.state,
|
|
62
60
|
reading: readingOf(run).value,
|
|
63
|
-
confidence: view.
|
|
61
|
+
confidence: view.confidence,
|
|
64
62
|
judge_runs: view.judge_runs,
|
|
65
63
|
budget: view.budget,
|
|
66
|
-
missions,
|
|
67
|
-
open_asks: view.
|
|
64
|
+
missions: view.mission_counts,
|
|
65
|
+
open_asks: view.open_asks,
|
|
68
66
|
};
|
|
69
67
|
}
|
|
70
68
|
|
|
@@ -141,21 +139,49 @@ function buildTrace(events, options = {}) {
|
|
|
141
139
|
// Reuse one event traversal and retain only the compact state needed for
|
|
142
140
|
// ended missions. Reading lookup below still uses the original position.
|
|
143
141
|
const prefixStates = ended.length
|
|
144
|
-
?
|
|
145
|
-
(view) => compactState(view, null)).prefixes
|
|
142
|
+
? foldWithSummaryPrefixes(sequence, ended.map((m) => Math.max(1, m.firstPos === null ? m.endPos : m.firstPos))).prefixes
|
|
146
143
|
: new Map();
|
|
147
144
|
const lastRunBefore = (pos) => {
|
|
148
|
-
let
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
let lo = 0;
|
|
146
|
+
let hi = judgeRuns.length;
|
|
147
|
+
while (lo < hi) {
|
|
148
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
149
|
+
if (judgeRuns[mid].pos < pos) lo = mid + 1;
|
|
150
|
+
else hi = mid;
|
|
151
|
+
}
|
|
152
|
+
return judgeRuns[lo - 1] || null;
|
|
153
|
+
};
|
|
154
|
+
const firstRunAfter = (pos) => {
|
|
155
|
+
let lo = 0;
|
|
156
|
+
let hi = judgeRuns.length;
|
|
157
|
+
while (lo < hi) {
|
|
158
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
159
|
+
if (judgeRuns[mid].pos <= pos) lo = mid + 1;
|
|
160
|
+
else hi = mid;
|
|
161
|
+
}
|
|
162
|
+
return judgeRuns[lo] || null;
|
|
163
|
+
};
|
|
164
|
+
const judgeChangedBetween = (beforePos, afterPos) => {
|
|
165
|
+
let lo = 0;
|
|
166
|
+
let hi = judgeChanges.length;
|
|
167
|
+
while (lo < hi) {
|
|
168
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
169
|
+
if (judgeChanges[mid] <= beforePos) lo = mid + 1;
|
|
170
|
+
else hi = mid;
|
|
171
|
+
}
|
|
172
|
+
return lo < judgeChanges.length && judgeChanges[lo] < afterPos;
|
|
151
173
|
};
|
|
152
|
-
const firstRunAfter = (pos) => judgeRuns.find((run) => run.pos > pos) || null;
|
|
153
174
|
|
|
154
175
|
// Where the campaign finished, if it did: the first position whose prefix is done.
|
|
155
176
|
let finishPos = null;
|
|
156
177
|
if (final.state === 'done') {
|
|
157
178
|
let lo = 0;
|
|
158
179
|
let hi = sequence.length - 1;
|
|
180
|
+
for (const [count, snapshot] of prefixStates) {
|
|
181
|
+
if (snapshot.state === 'done') { hi = count - 1; break; }
|
|
182
|
+
lo = count;
|
|
183
|
+
}
|
|
184
|
+
|
|
159
185
|
while (lo < hi) {
|
|
160
186
|
const mid = Math.floor((lo + hi) / 2);
|
|
161
187
|
if (fold(sequence.slice(0, mid + 1)).state === 'done') hi = mid;
|
|
@@ -190,7 +216,7 @@ function buildTrace(events, options = {}) {
|
|
|
190
216
|
const batch = batches.get(`${before ? before.pos : -1}:${after ? after.pos : 'open'}`);
|
|
191
217
|
const size = batch.missions.length;
|
|
192
218
|
const outcome = outcomeOf(m);
|
|
193
|
-
const judgeChanged = before && after &&
|
|
219
|
+
const judgeChanged = before && after && judgeChangedBetween(before.pos, after.pos);
|
|
194
220
|
const readBefore = readingOf(before);
|
|
195
221
|
// A replacement baseline is real campaign state, but cannot score earlier
|
|
196
222
|
// work. Null also prevents a replacement pass becoming fallback RSI proof.
|
|
@@ -226,7 +252,7 @@ function buildTrace(events, options = {}) {
|
|
|
226
252
|
step: i + 1,
|
|
227
253
|
at: m.endAt,
|
|
228
254
|
batch: { index: batch.index, size },
|
|
229
|
-
state_before:
|
|
255
|
+
state_before: compactState(prefixStates.get(Math.max(1, startPos)), lastRunBefore(startPos)),
|
|
230
256
|
action,
|
|
231
257
|
outcome,
|
|
232
258
|
cost_usd: folded.cost_usd === undefined || folded.cost_usd === null ? m.endData.cost_usd : folded.cost_usd,
|
package/lib/engine-resource.js
CHANGED
|
@@ -93,7 +93,11 @@ const SYSTEM_TOOLS = {
|
|
|
93
93
|
|
|
94
94
|
function defaultRun(cmd, args) {
|
|
95
95
|
const full = SYSTEM_TOOLS[cmd];
|
|
96
|
-
|
|
96
|
+
const options = { encoding: 'utf8', timeout: 3000 };
|
|
97
|
+
// Environment listings grow with local jobs; keep a finite allowance above
|
|
98
|
+
// Node's default 1 MiB without changing the deadline or failed-read policy.
|
|
99
|
+
if (cmd === 'ps') options.maxBuffer = 8 * 1024 * 1024;
|
|
100
|
+
return spawnSync(full && fs.existsSync(full) ? full : cmd, args, options);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
function parseFreePct(text) {
|