@parcha/agentrun-serve 0.1.0-beta.50 → 0.1.0-beta.52
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/CHANGELOG.md +185 -0
- package/README.md +236 -30
- package/dist/adapters.js +1 -1
- package/dist/agent-delete.d.ts +13 -2
- package/dist/agent-delete.js +14 -5
- package/dist/agents-store.d.ts +5 -1
- package/dist/agents-store.js +17 -7
- package/dist/api-only.d.ts +6 -3
- package/dist/api-only.js +8 -5
- package/dist/archil-routes.d.ts +1 -0
- package/dist/archil-routes.js +28 -2
- package/dist/capacity.d.ts +50 -0
- package/dist/capacity.js +49 -0
- package/dist/cli-learning/claude-wire.d.ts +41 -0
- package/dist/cli-learning/claude-wire.js +258 -0
- package/dist/cli-learning/cli.d.ts +11 -0
- package/dist/cli-learning/cli.js +241 -0
- package/dist/cli-learning/codex-worktree.d.ts +10 -0
- package/dist/cli-learning/codex-worktree.js +119 -0
- package/dist/cli-learning/connections.d.ts +62 -0
- package/dist/cli-learning/connections.js +87 -0
- package/dist/cli-learning/entry.d.ts +1 -0
- package/dist/cli-learning/entry.js +4 -0
- package/dist/cli-learning/evidence.d.ts +78 -0
- package/dist/cli-learning/evidence.js +492 -0
- package/dist/cli-learning/hook.d.ts +33 -0
- package/dist/cli-learning/hook.js +544 -0
- package/dist/cli-learning/install.d.ts +33 -0
- package/dist/cli-learning/install.js +335 -0
- package/dist/cli-learning/observation-proof.d.ts +14 -0
- package/dist/cli-learning/observation-proof.js +10 -0
- package/dist/cli-learning/policy.d.ts +48 -0
- package/dist/cli-learning/policy.js +363 -0
- package/dist/cli-learning/schema.d.ts +16 -0
- package/dist/cli-learning/schema.js +27 -0
- package/dist/cli-learning/state.d.ts +23 -0
- package/dist/cli-learning/state.js +61 -0
- package/dist/cli.js +24 -2
- package/dist/computer-setting.d.ts +8 -0
- package/dist/computer-setting.js +11 -0
- package/dist/computers.d.ts +6 -2
- package/dist/computers.js +2 -2
- package/dist/console/assets/index-B-D0EM3j.js +733 -0
- package/dist/console/assets/{index-D0mr9wfZ.css → index-DlQepP2J.css} +1 -1
- package/dist/console/index.html +2 -2
- package/dist/email/email-faux.d.ts +3 -1
- package/dist/email/email-faux.js +3 -2
- package/dist/email/routes.js +22 -12
- package/dist/fal-price.d.ts +76 -0
- package/dist/fal-price.js +368 -0
- package/dist/harness-install.d.ts +6 -2
- package/dist/harness-install.js +40 -8
- package/dist/harness.d.ts +1 -1
- package/dist/harness.js +2 -2
- package/dist/learn/commit.d.ts +5 -0
- package/dist/learn/commit.js +4 -1
- package/dist/learn/compile.d.ts +13 -5
- package/dist/learn/compile.js +24 -7
- package/dist/learn/delete.d.ts +12 -6
- package/dist/learn/delete.js +17 -11
- package/dist/learn/folder.d.ts +11 -0
- package/dist/learn/folder.js +20 -3
- package/dist/learn/learning-of.d.ts +8 -0
- package/dist/learn/learning-of.js +8 -0
- package/dist/learn/learning.sh +14 -1
- package/dist/learn/promote.d.ts +51 -7
- package/dist/learn/promote.js +51 -8
- package/dist/learn/secrets.js +14 -3
- package/dist/learning-reset.d.ts +18 -0
- package/dist/learning-reset.js +115 -0
- package/dist/learning-routes.d.ts +1 -1
- package/dist/learning-words.d.ts +6 -1
- package/dist/learning-words.js +6 -1
- package/dist/learning.d.ts +8 -6
- package/dist/learning.js +5 -4
- package/dist/llms.txt +1 -0
- package/dist/mcp-gateway.d.ts +39 -2
- package/dist/mcp-gateway.js +41 -10
- package/dist/mcp-pin-first.js +3 -2
- package/dist/mcp-private-hosts.d.ts +24 -3
- package/dist/mcp-private-hosts.js +53 -3
- package/dist/mcp-servers-store.d.ts +1 -0
- package/dist/mcp-servers-store.js +2 -1
- package/dist/media-duration.d.ts +2 -0
- package/dist/media-duration.js +136 -0
- package/dist/model-gateway.d.ts +2 -0
- package/dist/model-gateway.js +3 -1
- package/dist/native/runtimes.d.ts +2 -0
- package/dist/native/runtimes.js +2 -0
- package/dist/observation/learning.d.ts +32 -0
- package/dist/observation/learning.js +66 -0
- package/dist/observation/observer.d.ts +8 -1
- package/dist/observation/observer.js +89 -9
- package/dist/observation/schema.js +12 -4
- package/dist/observation/usage-identity.d.ts +9 -0
- package/dist/observation/usage-identity.js +11 -0
- package/dist/openapi.js +133 -24
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +14 -2
- package/dist/refusal-words.d.ts +0 -3
- package/dist/refusal-words.js +0 -3
- package/dist/request-metadata.d.ts +20 -0
- package/dist/request-metadata.js +24 -0
- package/dist/run-launch.d.ts +27 -4
- package/dist/run-launch.js +18 -3
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-usage.d.ts +48 -4
- package/dist/run-usage.js +156 -39
- package/dist/run-view.d.ts +2 -0
- package/dist/run-view.js +8 -7
- package/dist/runner/adapter-loop.d.ts +3 -1
- package/dist/runner/adapter-loop.js +41 -35
- package/dist/runner/adapter-run-spec.d.ts +1 -1
- package/dist/runner/adapter-run-spec.js +15 -15
- package/dist/runner/audit.d.ts +8 -3
- package/dist/runner/audit.js +21 -6
- package/dist/runner/beside.d.ts +13 -0
- package/dist/runner/beside.js +27 -8
- package/dist/runner/claim-secrets.d.ts +2 -1
- package/dist/runner/claim-secrets.js +5 -3
- package/dist/runner/cli-run-spec.d.ts +1 -1
- package/dist/runner/cli-run-spec.js +14 -13
- package/dist/runner/conformance/harness.js +4 -2
- package/dist/runner/disk-free.d.ts +44 -0
- package/dist/runner/disk-free.js +96 -0
- package/dist/runner/dispatch.js +4 -2
- package/dist/runner/feedback-round.d.ts +12 -8
- package/dist/runner/feedback-round.js +16 -30
- package/dist/runner/harness-loops.js +8 -3
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/learning-end.d.ts +2 -1
- package/dist/runner/learning-end.js +51 -22
- package/dist/runner/main.d.ts +17 -6
- package/dist/runner/main.js +187 -45
- package/dist/runner/mcp-claim.js +1 -1
- package/dist/runner/mcp-run.d.ts +9 -0
- package/dist/runner/mcp-run.js +16 -1
- package/dist/runner/model-route.js +7 -4
- package/dist/runner/presence.d.ts +11 -2
- package/dist/runner/presence.js +31 -3
- package/dist/runner/promotion.d.ts +40 -21
- package/dist/runner/promotion.js +130 -59
- package/dist/runner/run-child-host.d.ts +12 -15
- package/dist/runner/run-child-host.js +52 -112
- package/dist/runner/run-errors.js +2 -0
- package/dist/runner/runner-check.d.ts +51 -0
- package/dist/runner/runner-check.js +206 -0
- package/dist/runner/runner-metrics.d.ts +19 -0
- package/dist/runner/runner-metrics.js +49 -0
- package/dist/runner/runner.d.ts +37 -0
- package/dist/runner/runner.js +58 -6
- package/dist/runner/sdk-loop.d.ts +2 -2
- package/dist/runner/sdk-loop.js +37 -25
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/workflow-spec.js +3 -3
- package/dist/runs-over-store.d.ts +13 -3
- package/dist/runs-over-store.js +71 -16
- package/dist/sdk/check.d.ts +6 -5
- package/dist/sdk/check.js +17 -16
- package/dist/sdk/runs.d.ts +22 -2
- package/dist/sdk/runs.js +167 -82
- package/dist/server.d.ts +3 -0
- package/dist/server.js +230 -43
- package/dist/skills/agentrun-serve/SKILL.md +52 -7
- package/dist/start-switches.js +2 -0
- package/dist/stats.d.ts +4 -0
- package/dist/stats.js +1 -1
- package/dist/store/agent-body.d.ts +16 -0
- package/dist/store/agent-body.js +20 -3
- package/dist/store/dialect.d.ts +2 -0
- package/dist/store/dialect.js +1 -0
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +2 -2
- package/dist/store/journal/storage.d.ts +2 -0
- package/dist/store/journal/storage.js +2 -1
- package/dist/store/postgres/connection.d.ts +5 -2
- package/dist/store/postgres/connection.js +19 -7
- package/dist/store/postgres/dialect.js +1 -0
- package/dist/store/postgres/migrate.d.ts +30 -0
- package/dist/store/postgres/migrate.js +72 -5
- package/dist/store/postgres/migration-lint.d.ts +8 -0
- package/dist/store/postgres/migration-lint.js +119 -0
- package/dist/store/postgres/migrations/0024_runner_capacity.sql +28 -0
- package/dist/store/postgres/migrations/0025_run_attempts.sql +27 -0
- package/dist/store/postgres/migrations/0026_run_disk.sql +23 -0
- package/dist/store/postgres/store.d.ts +8 -3
- package/dist/store/postgres/store.js +31 -11
- package/dist/store/schema.d.ts +32 -2
- package/dist/store/schema.js +74 -5
- package/dist/store/sqlite/run-launch.d.ts +31 -1
- package/dist/store/sqlite/run-launch.js +111 -2
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +4 -3
- package/dist/store/sqlite/store.d.ts +17 -0
- package/dist/store/sqlite/store.js +226 -37
- package/dist/store/store-schema.d.ts +34 -0
- package/dist/store/store-schema.js +125 -0
- package/dist/store/store.d.ts +120 -5
- package/dist/store/store.js +13 -0
- package/dist/store-reads/analytics.d.ts +3 -2
- package/dist/store-reads/analytics.js +20 -8
- package/dist/store-reads/learning.d.ts +12 -8
- package/dist/store-reads/learning.js +33 -24
- package/dist/store-reads/loop.d.ts +4 -3
- package/dist/store-reads/loop.js +7 -5
- package/dist/store-view.d.ts +4 -3
- package/dist/store-view.js +11 -7
- package/dist/template-eval.js +4 -4
- package/dist/templates.d.ts +6 -2
- package/dist/templates.js +7 -5
- package/dist/timeline/labels.js +1 -1
- package/dist/tool-gate.d.ts +4 -2
- package/dist/tools.js +1 -1
- package/dist/unified-usage.d.ts +24 -0
- package/dist/unified-usage.js +400 -0
- package/dist/uploads-archil.d.ts +100 -0
- package/dist/uploads-archil.js +431 -0
- package/dist/uploads.d.ts +52 -1
- package/dist/uploads.js +186 -108
- package/dist/validate.js +5 -1
- package/dist/web-save.d.ts +3 -0
- package/dist/web-save.js +17 -2
- package/dist/workspace/archil-disk.d.ts +6 -5
- package/dist/workspace/archil-disk.js +27 -12
- package/dist/workspace/archil-exec.js +1 -1
- package/dist/workspace/archil.js +4 -3
- package/dist/workspace/revision-skills.js +24 -11
- package/dist/workspace/synced-folder.d.ts +3 -3
- package/dist/workspace/synced-folder.js +7 -6
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +52 -7
- package/dist/console/assets/index-D7G6o-1E.js +0 -720
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/** One token view over recorded runs and native observations. Requestless aggregates only establish a
|
|
2
|
+
* lower bound on overlapping usage; select coherent views instead of assuming one completely covers another. */
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { runReadState } from './store-reads/runs.js';
|
|
5
|
+
import { isShadowRun } from './learn/audit.js';
|
|
6
|
+
import { DEFAULT_HARNESS } from './harness.js';
|
|
7
|
+
import { BACKGROUND_CONTEXT } from '@earendil-works/chord/context';
|
|
8
|
+
import { journalEntries } from './runner/journal-reader.js';
|
|
9
|
+
import { REQUEST_COST, runMetricsOf } from './timeline/index.js';
|
|
10
|
+
import { usageIdentityOf } from './observation/usage-identity.js';
|
|
11
|
+
const DAY = 86_400_000, RETENTION = 90 * DAY;
|
|
12
|
+
const fields = ['input', 'output', 'cache_read', 'cache_write'];
|
|
13
|
+
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
14
|
+
const count = (value) => typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
15
|
+
const plus = (values) => { const sum = values.reduce((a, b) => a + b, 0); return Number.isSafeInteger(sum) ? sum : null; };
|
|
16
|
+
const date = (ms) => new Date(ms).toISOString().slice(0, 10);
|
|
17
|
+
const runtime = (value) => typeof value === 'string'
|
|
18
|
+
? ['codex', 'codex-cli', 'codex-sdk'].includes(value) ? 'codex'
|
|
19
|
+
: ['claude', 'claude-code', 'claude-code-cli', 'claude-agent-sdk'].includes(value) ? 'claude-code' : undefined : undefined;
|
|
20
|
+
const nativeKey = (harness, session) => harness && typeof session === 'string' && session
|
|
21
|
+
? `${harness}:${createHash('sha256').update(session).digest('hex')}` : undefined;
|
|
22
|
+
const empty = () => ({ tokens: null, input: null, output: null, cache_read: null, cache_write: null });
|
|
23
|
+
function runCounts(metrics) {
|
|
24
|
+
const result = { input: count(metrics.input), output: count(metrics.output), cache_read: count(metrics.cacheRead), cache_write: count(metrics.cacheWrite) };
|
|
25
|
+
return { ...result, tokens: fields.every(key => result[key] !== null) ? plus(fields.map(key => result[key])) : null };
|
|
26
|
+
}
|
|
27
|
+
function sourceCounts(usage) {
|
|
28
|
+
const input = count(usage.input_tokens), output = count(usage.output_tokens);
|
|
29
|
+
const read = count(usage.cache_read_tokens), write = count(usage.cache_write_tokens);
|
|
30
|
+
return { tokens: input !== null && output !== null ? plus([input, output]) : null, output,
|
|
31
|
+
input: input !== null && read !== null && write !== null && read + write <= input ? input - read - write : null,
|
|
32
|
+
cache_read: read, cache_write: write };
|
|
33
|
+
}
|
|
34
|
+
export async function unifiedUsage(store, filter = {}, now = Date.now()) {
|
|
35
|
+
const from = filter.from === undefined ? -Infinity : Date.parse(filter.from);
|
|
36
|
+
const to = filter.to === undefined ? Infinity : Date.parse(filter.to);
|
|
37
|
+
const archived = new Map();
|
|
38
|
+
const isArchived = async (agent) => {
|
|
39
|
+
if (!archived.has(agent))
|
|
40
|
+
archived.set(agent, (await store.agents.get(agent))?.archivedAt != null);
|
|
41
|
+
return archived.get(agent);
|
|
42
|
+
};
|
|
43
|
+
const runs = [];
|
|
44
|
+
const selectedNative = new Set();
|
|
45
|
+
const revisions = new Map();
|
|
46
|
+
for (const run of await store.runs.list({ purged: true, ...(filter.agent ? { agentId: filter.agent } : {}) })) {
|
|
47
|
+
if (run.archivedAt !== null || isShadowRun(run.id) || await isArchived(run.agentId))
|
|
48
|
+
continue;
|
|
49
|
+
if (!revisions.has(run.revisionId))
|
|
50
|
+
revisions.set(run.revisionId, await store.agents.revision(run.revisionId));
|
|
51
|
+
const revision = revisions.get(run.revisionId), body = object(revision?.body), metrics = object(run.metrics);
|
|
52
|
+
const cli = object(body.cli_learning), sdk = object(body.sdk), native = object(body.native);
|
|
53
|
+
const cliRuntime = cli.runtime === 'codex' ? 'codex-cli' : cli.runtime === 'claude-code' ? 'claude-code-cli' : cli.runtime;
|
|
54
|
+
let harness = metrics.cli_runtime ?? metrics.sdk_runtime ?? metrics.native_runtime ?? cliRuntime ?? sdk.runtime ?? native.runtime ?? run.importedFrom?.source ?? body.harness ?? DEFAULT_HARNESS;
|
|
55
|
+
let session = metrics.cli_session_id ?? metrics.sdk_session_id ?? metrics.native_session_id ?? run.importedFrom?.session;
|
|
56
|
+
const inRange = !(run.startedAt < from || run.startedAt >= to);
|
|
57
|
+
// A filtered observation may match a historical run's native identity, even outside this date range.
|
|
58
|
+
if (!inRange && !filter.agent)
|
|
59
|
+
continue;
|
|
60
|
+
const isCli = Boolean(metrics.cli_runtime || Object.keys(cli).length);
|
|
61
|
+
const isSdk = Boolean(isCli || metrics.sdk_runtime || Object.keys(sdk).length);
|
|
62
|
+
const metadata = run.purgedAt == null && (isCli || (inRange && isSdk))
|
|
63
|
+
? await store.runs.usageMetadata(run.id, { completion: inRange && isSdk }) : undefined;
|
|
64
|
+
let window = {};
|
|
65
|
+
if (isCli) {
|
|
66
|
+
window = object(metadata?.cli);
|
|
67
|
+
if (!session) {
|
|
68
|
+
session = window.session_id;
|
|
69
|
+
harness = window.runtime ?? harness;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const key = nativeKey(runtime(harness), session);
|
|
73
|
+
if (key)
|
|
74
|
+
selectedNative.add(key);
|
|
75
|
+
if (!inRange)
|
|
76
|
+
continue;
|
|
77
|
+
runs.push({ id: run.id, key, imported: run.importedFrom !== null,
|
|
78
|
+
opaqueImport: Boolean(metrics.remote_history_sha256 || String(session).startsWith('redacted-')),
|
|
79
|
+
purged: run.purgedAt != null, runtimeErased: run.purgedAt != null && !Object.keys(body).length,
|
|
80
|
+
nativeReflection: Boolean(window.native_grading),
|
|
81
|
+
...(key && key === nativeKey(runtime(window.runtime), window.session_id) && typeof window.turn_id === 'string' && window.turn_id
|
|
82
|
+
? { window: window.turn_id } : {}),
|
|
83
|
+
sdk: isSdk, usage: metadata?.completionUsage,
|
|
84
|
+
fact: { ...(runReadState(run, revision?.kind === 'workflow' ? 'workflow' : 'agentic') === 'running' ? empty() : runCounts(metrics)),
|
|
85
|
+
day: date(run.startedAt), harness: String(harness), runId: run.id } });
|
|
86
|
+
}
|
|
87
|
+
const connections = new Map();
|
|
88
|
+
const observed = [];
|
|
89
|
+
let sourceSelected = false;
|
|
90
|
+
for (const row of await store.settings.all({ prefix: 'observation.connector.' })) {
|
|
91
|
+
const connector = object(row.value);
|
|
92
|
+
for (const raw of Object.values(object(connector.sessions))) {
|
|
93
|
+
const session = object(raw);
|
|
94
|
+
if (typeof session.id !== 'string' || !runtime(session.harness))
|
|
95
|
+
continue;
|
|
96
|
+
const harness = runtime(session.harness);
|
|
97
|
+
// Accounting identity is independent of current learning readiness. Older persisted sessions
|
|
98
|
+
// still carry their verified identity in the association until their next ingestion migrates it.
|
|
99
|
+
const identity = usageIdentityOf(session.usage_identity) ?? usageIdentityOf(session.learning_association);
|
|
100
|
+
const key = identity ? `${harness}:${identity.native_session_hash}` : `observation:${connector.id}:${session.id}`;
|
|
101
|
+
let agent;
|
|
102
|
+
if (identity) {
|
|
103
|
+
if (!connections.has(identity.connection_id))
|
|
104
|
+
connections.set(identity.connection_id, object(await store.settings.get(`cli-learning-connection:${identity.connection_id}`)).agent_id);
|
|
105
|
+
agent = connections.get(identity.connection_id);
|
|
106
|
+
}
|
|
107
|
+
if (filter.agent && filter.agent !== session.id && filter.agent !== agent && !selectedNative.has(key))
|
|
108
|
+
continue;
|
|
109
|
+
sourceSelected = true;
|
|
110
|
+
const received = Date.parse(session.received_at), facts = [], partial = new Set();
|
|
111
|
+
let overlaps = false;
|
|
112
|
+
for (const [day, models] of Object.entries(object(session.usage_by_day))) {
|
|
113
|
+
if (!/^\d{4}-\d\d-\d\d$/.test(day))
|
|
114
|
+
continue;
|
|
115
|
+
const start = Date.parse(day), end = start + DAY;
|
|
116
|
+
if (end < now - RETENTION)
|
|
117
|
+
continue;
|
|
118
|
+
const values = Object.values(object(models)).map(value => sourceCounts(object(value)));
|
|
119
|
+
if (end <= from || start >= to)
|
|
120
|
+
continue;
|
|
121
|
+
overlaps = true;
|
|
122
|
+
if (start < from || end > to) {
|
|
123
|
+
partial.add(day);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
for (const value of values) {
|
|
127
|
+
facts.push({ ...value, day, harness });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!overlaps && !(received >= from && received < to) && filter.agent !== session.id)
|
|
131
|
+
continue;
|
|
132
|
+
observed.push({ id: session.id, key, collector: row.key, verified: !!identity, received, harness, facts, partial });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Copies of a verified session may cover disjoint days. Choose the most reported copy for each UTC day,
|
|
136
|
+
// then the freshest receipt and stable id. Same-day requestless aggregates cannot be safely added together.
|
|
137
|
+
const copies = new Map();
|
|
138
|
+
for (const session of observed) {
|
|
139
|
+
const group = copies.get(session.key) ?? [];
|
|
140
|
+
group.push(session);
|
|
141
|
+
copies.set(session.key, group);
|
|
142
|
+
}
|
|
143
|
+
const authorities = new Map();
|
|
144
|
+
const uncertainSources = new Set();
|
|
145
|
+
const better = (next, old) => !old || next.score > old.score
|
|
146
|
+
|| (next.score === old.score && (next.session.received > old.session.received
|
|
147
|
+
|| (next.session.received === old.session.received && next.session.id < old.session.id)));
|
|
148
|
+
const collectorViews = new Map();
|
|
149
|
+
for (const [key, group] of copies) {
|
|
150
|
+
const days = new Map();
|
|
151
|
+
const perCollector = new Map();
|
|
152
|
+
const partial = new Set();
|
|
153
|
+
for (const session of group) {
|
|
154
|
+
for (const day of session.partial)
|
|
155
|
+
partial.add(day);
|
|
156
|
+
const own = new Map();
|
|
157
|
+
for (const fact of session.facts) {
|
|
158
|
+
const items = own.get(fact.day) ?? [];
|
|
159
|
+
items.push(fact);
|
|
160
|
+
own.set(fact.day, items);
|
|
161
|
+
}
|
|
162
|
+
for (const [day, facts] of own) {
|
|
163
|
+
const next = { session, facts, score: facts.reduce((sum, fact) => sum + (fact.tokens ?? 0), 0) }, old = days.get(day);
|
|
164
|
+
if (old)
|
|
165
|
+
uncertainSources.add(key);
|
|
166
|
+
if (better(next, old))
|
|
167
|
+
days.set(day, next);
|
|
168
|
+
const ownDays = perCollector.get(session.collector) ?? new Map();
|
|
169
|
+
if (better(next, ownDays.get(day)))
|
|
170
|
+
ownDays.set(day, next);
|
|
171
|
+
perCollector.set(session.collector, ownDays);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
authorities.set(key, { ...group[0], facts: [...days.values()].flatMap(day => day.facts), partial });
|
|
175
|
+
for (const [collector, ownDays] of perCollector) {
|
|
176
|
+
const views = collectorViews.get(group[0].harness) ?? new Map();
|
|
177
|
+
views.set(collector, [...(views.get(collector) ?? []), ...[...ownDays.values()].flatMap(day => day.facts)]);
|
|
178
|
+
collectorViews.set(group[0].harness, views);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const facts = [], partial = new Set();
|
|
182
|
+
const knownRuns = new Set(), unknownRuns = new Set();
|
|
183
|
+
const nativeFacts = new Map(), opaqueAlternatives = new Map();
|
|
184
|
+
const otherNative = new Set([
|
|
185
|
+
...runs.filter(run => !run.imported && run.key && run.fact.tokens !== null).map(run => runtime(run.fact.harness)),
|
|
186
|
+
...[...authorities.values()].filter(source => source.facts.some(fact => fact.tokens !== null)).map(source => source.harness),
|
|
187
|
+
]);
|
|
188
|
+
const groups = new Map();
|
|
189
|
+
const alternative = (harness, fact) => {
|
|
190
|
+
const alternatives = opaqueAlternatives.get(harness) ?? [];
|
|
191
|
+
alternatives.push(fact);
|
|
192
|
+
opaqueAlternatives.set(harness, alternatives);
|
|
193
|
+
};
|
|
194
|
+
for (const run of runs) {
|
|
195
|
+
const harness = runtime(run.fact.harness);
|
|
196
|
+
if (run.purged && !run.key && run.fact.tokens !== null && (harness || (run.runtimeErased && otherNative.size))) {
|
|
197
|
+
// Purge intentionally deletes native identities and receipts. Keep its counters without recreating
|
|
198
|
+
// private provenance or pretending that an opaque native aggregate is disjoint from observed usage.
|
|
199
|
+
alternative(harness ?? '*', run.fact);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (run.imported && run.key && harness && otherNative.has(harness) && run.fact.tokens !== null) {
|
|
203
|
+
// Old local imports retain exact child counters, but not child identities. Verify the complete
|
|
204
|
+
// journal before separating the root; a missing journal or namespaced/redacted root proves no split.
|
|
205
|
+
let root;
|
|
206
|
+
if (!run.opaqueImport && !run.purged)
|
|
207
|
+
try {
|
|
208
|
+
const entries = await journalEntries(store.readJournal(run.id), BACKGROUND_CONTEXT);
|
|
209
|
+
const complete = runCounts(runMetricsOf(entries));
|
|
210
|
+
const own = runCounts(runMetricsOf(entries.filter(entry => entry.kind !== REQUEST_COST || object(entry.data).request !== 'subagent')));
|
|
211
|
+
if (complete.tokens !== null && own.tokens !== null && fields.every(field => complete[field] === run.fact[field] && own[field] <= complete[field]))
|
|
212
|
+
root = own;
|
|
213
|
+
}
|
|
214
|
+
catch { /* Retain the saved aggregate as an alternative, never guess missing provenance. */ }
|
|
215
|
+
if (!root || root.tokens !== run.fact.tokens) {
|
|
216
|
+
alternative(harness, run.fact);
|
|
217
|
+
unknownRuns.add(run.id);
|
|
218
|
+
}
|
|
219
|
+
if (!root)
|
|
220
|
+
continue;
|
|
221
|
+
run.fact = { ...run.fact, ...root };
|
|
222
|
+
}
|
|
223
|
+
if (run.key) {
|
|
224
|
+
const group = groups.get(run.key) ?? [];
|
|
225
|
+
group.push(run);
|
|
226
|
+
groups.set(run.key, group);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
facts.push(run.fact);
|
|
230
|
+
if (run.fact.tokens === null)
|
|
231
|
+
unknownRuns.add(run.id);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const recordedRuntimes = new Set([...groups.values()].flat().filter(run => run.fact.tokens !== null).map(run => runtime(run.fact.harness)));
|
|
235
|
+
for (const harness of opaqueAlternatives.keys())
|
|
236
|
+
recordedRuntimes.add(harness);
|
|
237
|
+
const unidentifiedOverlap = new Set([...authorities.values()].filter(session => !session.verified
|
|
238
|
+
&& session.facts.some(fact => fact.tokens !== null) && (recordedRuntimes.has(session.harness) || recordedRuntimes.has('*'))).map(session => session.harness));
|
|
239
|
+
let observed_sessions = 0;
|
|
240
|
+
for (const [key, session] of authorities) {
|
|
241
|
+
if (!groups.has(key))
|
|
242
|
+
groups.set(key, []);
|
|
243
|
+
for (const day of session.partial)
|
|
244
|
+
partial.add(day);
|
|
245
|
+
if (session.facts.some(fact => fact.tokens !== null))
|
|
246
|
+
observed_sessions++;
|
|
247
|
+
else
|
|
248
|
+
uncertainSources.add(key);
|
|
249
|
+
}
|
|
250
|
+
for (const [key, group] of groups) {
|
|
251
|
+
const session = authorities.get(key), sourceFacts = session?.facts ?? [];
|
|
252
|
+
const windows = new Map(), alternatives = [];
|
|
253
|
+
for (const run of group) {
|
|
254
|
+
if (run.fact.tokens === null) {
|
|
255
|
+
facts.push(run.fact);
|
|
256
|
+
unknownRuns.add(run.id);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
let fact = run.fact, window;
|
|
260
|
+
if (run.sdk && !run.purged) {
|
|
261
|
+
const usage = object(run.usage);
|
|
262
|
+
const task = runCounts({ input: usage?.input_tokens, output: usage?.output_tokens,
|
|
263
|
+
cacheRead: usage?.cache_read_tokens, cacheWrite: usage?.cache_write_tokens });
|
|
264
|
+
if (task.tokens !== null && fields.every(field => fact[field] >= task[field])) {
|
|
265
|
+
// The immutable receipt separates reflection. Current SDK reflection is an independent HTTP
|
|
266
|
+
// call; historical native graders created observable sessions without retaining their identities.
|
|
267
|
+
const remainder = Object.fromEntries(fields.map(field => [field, fact[field] - task[field]]));
|
|
268
|
+
const tokens = plus(fields.map(field => remainder[field]));
|
|
269
|
+
if (tokens !== null && tokens > 0) {
|
|
270
|
+
const harness = runtime(fact.harness);
|
|
271
|
+
const couldObserveReflection = run.nativeReflection && ([...authorities.values()].some(source => source.key !== key && source.harness === harness && source.facts.some(item => item.tokens !== null))
|
|
272
|
+
|| runs.some(other => other.id !== run.id && other.key !== key && runtime(other.fact.harness) === harness && other.fact.tokens !== null));
|
|
273
|
+
if (couldObserveReflection) {
|
|
274
|
+
alternative(harness, fact);
|
|
275
|
+
unknownRuns.add(run.id);
|
|
276
|
+
}
|
|
277
|
+
else
|
|
278
|
+
facts.push({ ...fact, ...remainder, tokens });
|
|
279
|
+
}
|
|
280
|
+
fact = { ...fact, ...task };
|
|
281
|
+
window = run.window;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (!window) {
|
|
285
|
+
alternatives.push(fact);
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
// Only a pinned CLI turn plus its immutable receipt identifies disjoint native prompt usage.
|
|
289
|
+
// SDK/import row timestamps are bookkeeping, not proof of native request boundaries.
|
|
290
|
+
const old = windows.get(window);
|
|
291
|
+
if (!old)
|
|
292
|
+
windows.set(window, { fact, runs: [run.id] });
|
|
293
|
+
else {
|
|
294
|
+
old.runs.push(run.id);
|
|
295
|
+
if (fact.tokens > old.fact.tokens || (fact.tokens === old.fact.tokens && run.id < old.fact.runId))
|
|
296
|
+
old.fact = fact;
|
|
297
|
+
for (const id of old.runs)
|
|
298
|
+
unknownRuns.add(id);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
facts.push(...sourceFacts.filter(fact => fact.tokens === null));
|
|
302
|
+
// An old disconnect may already have erased a verified identity. Do not invent it or
|
|
303
|
+
// add this observation to potentially overlapping native runs; compare collector views below.
|
|
304
|
+
if (session && !session.verified && unidentifiedOverlap.has(session.harness))
|
|
305
|
+
continue;
|
|
306
|
+
const observed = sourceFacts.filter(fact => fact.tokens !== null), captured = [...windows.values()].map(window => window.fact);
|
|
307
|
+
const score = (items) => plus(items.map(fact => fact.tokens));
|
|
308
|
+
if (observed.length && captured.length)
|
|
309
|
+
for (const window of windows.values())
|
|
310
|
+
for (const id of window.runs)
|
|
311
|
+
unknownRuns.add(id);
|
|
312
|
+
// Offline hooks can register a prompt after native execution. Server start/end timestamps cannot
|
|
313
|
+
// establish disjointness from observer UTC days. Distinct pinned turns may sum, as may distinct
|
|
314
|
+
// observer days, but those complete views remain alternatives without native request-level coverage.
|
|
315
|
+
// Preserve the selected view's entire breakdown; per-field maxima can invent a nonexistent total.
|
|
316
|
+
let selected = !observed.length || (captured.length && (score(captured) ?? Infinity) > (score(observed) ?? Infinity)) ? captured : observed;
|
|
317
|
+
if (alternatives.length && (selected.length || alternatives.length > 1))
|
|
318
|
+
for (const run of group)
|
|
319
|
+
unknownRuns.add(run.id);
|
|
320
|
+
alternatives.sort((a, b) => a.runId.localeCompare(b.runId));
|
|
321
|
+
for (const fact of alternatives)
|
|
322
|
+
if (!selected.length || fact.tokens > (score(selected) ?? Infinity))
|
|
323
|
+
selected = [fact];
|
|
324
|
+
const harness = session?.harness ?? runtime(group[0].fact.harness);
|
|
325
|
+
const cohort = nativeFacts.get(harness) ?? [];
|
|
326
|
+
cohort.push(...selected);
|
|
327
|
+
nativeFacts.set(harness, cohort);
|
|
328
|
+
}
|
|
329
|
+
for (const [harness, alternatives] of opaqueAlternatives) {
|
|
330
|
+
if (harness === '*')
|
|
331
|
+
continue;
|
|
332
|
+
// Opaque descendants, historical native reflection and purged native counters can overlap other
|
|
333
|
+
// sessions of this runtime. Compare whole views; independent managed work and HTTP reflection stay additive.
|
|
334
|
+
let selected = nativeFacts.get(harness) ?? [];
|
|
335
|
+
const ambiguous = selected.length > 0 || alternatives.length > 1;
|
|
336
|
+
alternatives.sort((a, b) => a.runId.localeCompare(b.runId));
|
|
337
|
+
for (const fact of alternatives)
|
|
338
|
+
if (!selected.length || fact.tokens > (plus(selected.map(item => item.tokens)) ?? Infinity))
|
|
339
|
+
selected = [fact];
|
|
340
|
+
nativeFacts.set(harness, selected);
|
|
341
|
+
if (ambiguous) {
|
|
342
|
+
for (const run of runs)
|
|
343
|
+
if (runtime(run.fact.harness) === harness)
|
|
344
|
+
unknownRuns.add(run.id);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
for (const harness of unidentifiedOverlap) {
|
|
348
|
+
let selected = nativeFacts.get(harness) ?? [];
|
|
349
|
+
for (const [, view] of [...(collectorViews.get(harness) ?? new Map())].sort(([a], [b]) => a.localeCompare(b))) {
|
|
350
|
+
const known = view.filter(fact => fact.tokens !== null);
|
|
351
|
+
if (known.length && (!selected.length || (plus(known.map(fact => fact.tokens)) ?? Infinity) > (plus(selected.map(fact => fact.tokens)) ?? Infinity)))
|
|
352
|
+
selected = known;
|
|
353
|
+
}
|
|
354
|
+
nativeFacts.set(harness, selected);
|
|
355
|
+
for (const session of authorities.values())
|
|
356
|
+
if (session.harness === harness && !session.verified)
|
|
357
|
+
uncertainSources.add(session.key);
|
|
358
|
+
for (const run of runs)
|
|
359
|
+
if (runtime(run.fact.harness) === harness && (run.key || run.purged))
|
|
360
|
+
unknownRuns.add(run.id);
|
|
361
|
+
}
|
|
362
|
+
const unscoped = opaqueAlternatives.get('*');
|
|
363
|
+
if (unscoped?.length) {
|
|
364
|
+
let selected = [...nativeFacts.values()].flat();
|
|
365
|
+
unscoped.sort((a, b) => a.runId.localeCompare(b.runId));
|
|
366
|
+
for (const fact of unscoped) {
|
|
367
|
+
unknownRuns.add(fact.runId);
|
|
368
|
+
if (!selected.length || fact.tokens > (plus(selected.map(item => item.tokens)) ?? Infinity))
|
|
369
|
+
selected = [fact];
|
|
370
|
+
}
|
|
371
|
+
nativeFacts.clear();
|
|
372
|
+
nativeFacts.set('*', selected);
|
|
373
|
+
}
|
|
374
|
+
facts.push(...[...nativeFacts.values()].flat());
|
|
375
|
+
for (const fact of facts)
|
|
376
|
+
if (fact.runId && fact.tokens !== null)
|
|
377
|
+
knownRuns.add(fact.runId);
|
|
378
|
+
const known = facts.filter(fact => fact.tokens !== null);
|
|
379
|
+
const unknown_sessions = uncertainSources.size;
|
|
380
|
+
const any = facts.length > 0 || unknown_sessions > 0 || unknownRuns.size > 0;
|
|
381
|
+
const totals = { tokens: known.length ? plus(known.map(fact => fact.tokens)) : any ? null : 0,
|
|
382
|
+
...Object.fromEntries(fields.map(key => [key, known.some(fact => fact[key] === null) ? null
|
|
383
|
+
: known.length ? plus(known.map(fact => fact[key])) : any ? null : 0])) };
|
|
384
|
+
const grouped = (key) => {
|
|
385
|
+
const groups = new Map();
|
|
386
|
+
for (const fact of facts) {
|
|
387
|
+
const group = groups.get(fact[key]) ?? [];
|
|
388
|
+
group.push(fact);
|
|
389
|
+
groups.set(fact[key], group);
|
|
390
|
+
}
|
|
391
|
+
return [...groups].sort(([a], [b]) => a.localeCompare(b)).map(([name, group]) => {
|
|
392
|
+
const known = group.filter(fact => fact.tokens !== null);
|
|
393
|
+
return { name, tokens: known.length ? plus(known.map(fact => fact.tokens)) : null };
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
return { ...totals, known_runs: knownRuns.size, unknown_runs: unknownRuns.size, observed_sessions, unknown_sessions, partial_days: partial.size,
|
|
397
|
+
retention_limited: sourceSelected && from < now - RETENTION,
|
|
398
|
+
by_day: grouped('day').map(({ name, tokens }) => ({ day: name, tokens })),
|
|
399
|
+
by_harness: grouped('harness').map(({ name, tokens }) => ({ harness: name, tokens })) };
|
|
400
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { KeyEnv } from "./key-meta.js";
|
|
2
|
+
import type { RunLaunch } from "./run-launch.js";
|
|
3
|
+
import type { Store } from "./store/index.js";
|
|
4
|
+
import { type Json } from "./validate.js";
|
|
5
|
+
import { type ArchilDisk, type ArchilDiskOptions } from "./workspace/archil-disk.js";
|
|
6
|
+
import { type Workspace } from "./workspace/index.js";
|
|
7
|
+
import { type FileUploadAnswer, type Received, type UploadedFile, type UploadStore } from "./uploads.js";
|
|
8
|
+
/** The folder of the uploads disk the files are kept under. */
|
|
9
|
+
export declare const UPLOADS_KEY = "files";
|
|
10
|
+
/** How many files the server copies into run folders at once, across every start: its one HTTP/2 connection to
|
|
11
|
+
* Archil's S3 host carries them all, and with 3 or more 10 MiB writes in flight Archil's gateway resets their streams
|
|
12
|
+
* (NGHTTP2_ENHANCE_YOUR_CALM), measured live. Two at a time copied 20 files of 10 MiB in 11 to 14 s. */
|
|
13
|
+
export declare const PLACE_CONCURRENCY = 2;
|
|
14
|
+
/** How long a start may spend copying its files (and making its agent's disk, when it has none) before it is refused:
|
|
15
|
+
* well inside a client's read timeout of a start (grep reads one for 90 s). */
|
|
16
|
+
export declare const PLACE_TIMEOUT_MS = 45000;
|
|
17
|
+
/** A mark younger than this keeps its file whether or not its run is in the store yet. */
|
|
18
|
+
export declare const MARK_GRACE_MS: number;
|
|
19
|
+
/** The retention of uploaded files no run names, when AGENTRUN_UPLOAD_RETENTION is not set: 7 days. */
|
|
20
|
+
export declare const DEFAULT_UPLOAD_RETENTION_MS: number;
|
|
21
|
+
export declare const UPLOAD_RETENTION_ENV = "AGENTRUN_UPLOAD_RETENTION";
|
|
22
|
+
/** How often the server sweeps the uploads disk. */
|
|
23
|
+
export declare const UPLOAD_SWEEP_EVERY_MS: number;
|
|
24
|
+
/** The uploads disk's name: agentrun-<server id>-files. No agent's disk is named so (diskNameOf: -i- or -h- before the
|
|
25
|
+
* agent's part). */
|
|
26
|
+
export declare const uploadsDiskName: (serverId: string) => string;
|
|
27
|
+
/** AGENTRUN_UPLOAD_RETENTION as milliseconds: a whole number and a unit (ms, s, m, h, d), or "off" (undefined: every file
|
|
28
|
+
* is kept). Not set: DEFAULT_UPLOAD_RETENTION_MS. Anything else throws, naming the variable. */
|
|
29
|
+
export declare function uploadRetentionMs(value: string | undefined): number | undefined;
|
|
30
|
+
/** Why `path` cannot be an upload's path on an Archil disk: not the contract's FilePathString, or a run's copy of it
|
|
31
|
+
* (agents/<agent>/runs/<run>/work/inputs/<path>, suffixes included) longer than a key Archil takes. */
|
|
32
|
+
export declare function archilPathProblem(path: string): string | undefined;
|
|
33
|
+
/** Uploads kept in a Workspace: `<file_id>/bytes`, `<file_id>/file.json` and `<file_id>/runs/<run id>` at its root (the
|
|
34
|
+
* uploads disk's files/ folder). The routes' rules are Mode 1's (uploads.ts): the same checks, words and answers. */
|
|
35
|
+
export declare class WorkspaceUploads implements UploadStore {
|
|
36
|
+
readonly workspace: Workspace;
|
|
37
|
+
private readonly commits;
|
|
38
|
+
/** `commits`: each file's commit or delete in progress, one at a time per file as Mode 1's. Shared by every store over
|
|
39
|
+
* the same uploads disk (archilUploads keeps one per disk), so two requests on one file take turns. */
|
|
40
|
+
constructor(workspace: Workspace, commits?: Map<string, Promise<unknown>>);
|
|
41
|
+
private exclusive;
|
|
42
|
+
get(id: string): Promise<UploadedFile | null>;
|
|
43
|
+
ids(): Promise<string[]>;
|
|
44
|
+
remove(id: string): Promise<void>;
|
|
45
|
+
/** A file's folder, gone whole: what a failed make leaves is never a file the API cannot list or delete. */
|
|
46
|
+
private drop;
|
|
47
|
+
take(query: URLSearchParams, requestType: string | undefined, body: AsyncIterable<Buffer>): Promise<Received>;
|
|
48
|
+
reserve(body: Json): Promise<FileUploadAnswer>;
|
|
49
|
+
receive(id: string, body: AsyncIterable<Buffer>): Promise<UploadedFile>;
|
|
50
|
+
readyFiles(ids: readonly unknown[]): Promise<UploadedFile[]>;
|
|
51
|
+
/** File `file`'s bytes. */
|
|
52
|
+
bytes(file: UploadedFile): Promise<Uint8Array>;
|
|
53
|
+
/** Marks each of `ids` as named by run `runId`, at `now`. */
|
|
54
|
+
mark(ids: readonly string[], runId: string, now?: number): Promise<void>;
|
|
55
|
+
/** Whether a run keeps file `id`: a mark of a run the store has (`hasRun`), or one younger than MARK_GRACE_MS. */
|
|
56
|
+
private named;
|
|
57
|
+
/** Deletes each file made more than `retentionMs` before `now` that no run keeps (named): the ids deleted. A file a
|
|
58
|
+
* record can't be read for (a make that failed between its bytes and its record) is deleted once its folder is that
|
|
59
|
+
* old by the id's own time (a UUIDv7's milliseconds). */
|
|
60
|
+
sweep(retentionMs: number, hasRun: (runId: string) => Promise<boolean>, now?: number): Promise<string[]>;
|
|
61
|
+
}
|
|
62
|
+
export interface ArchilUploadsOptions {
|
|
63
|
+
/** The server's store: its settings (the Archil settings, the server's id, each agent's disk) and sealed keys. */
|
|
64
|
+
readonly store: Pick<Store, "settings" | "sealedKeys">;
|
|
65
|
+
readonly sealKey: Buffer | undefined;
|
|
66
|
+
/** The server's environment: ARCHIL_API_KEY and the Archil settings there win over the saved ones. */
|
|
67
|
+
readonly env?: KeyEnv;
|
|
68
|
+
/** A test's control plane and maker of a disk's file API (server.ts archilControl). */
|
|
69
|
+
readonly control?: {
|
|
70
|
+
readonly baseUrl?: string;
|
|
71
|
+
readonly fetch?: typeof fetch;
|
|
72
|
+
readonly makeDisk?: (options: ArchilDiskOptions) => ArchilDisk;
|
|
73
|
+
};
|
|
74
|
+
/** How long a start may spend placing its files (default PLACE_TIMEOUT_MS). */
|
|
75
|
+
readonly placeTimeoutMs?: number;
|
|
76
|
+
}
|
|
77
|
+
/** What a start with files gets from placeRunFiles: its launch, saying its files are placed and naming its disk, and how
|
|
78
|
+
* to undo the placing when its row is not written. */
|
|
79
|
+
export interface Placed {
|
|
80
|
+
readonly launch: RunLaunch;
|
|
81
|
+
undo(): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
/** Whether run `runId` keeps the uploads it was started with, for retention (sweep's hasRun): the store has it and it
|
|
84
|
+
* was not deleted. A deleted run's row stays as a tombstone (purgedAt set), which keeps no upload. */
|
|
85
|
+
export declare const runKeepsUploads: (store: {
|
|
86
|
+
runs: {
|
|
87
|
+
get(runId: string): Promise<{
|
|
88
|
+
readonly purgedAt: number | null;
|
|
89
|
+
} | undefined>;
|
|
90
|
+
};
|
|
91
|
+
}) => (runId: string) => Promise<boolean>;
|
|
92
|
+
/** Mode 2's uploads for one server: the uploads store (`here`), a start's placing of its files (`place`), and the sweep.
|
|
93
|
+
* Every call reads the Archil settings first: with none (Mode 1), `here` and `place` answer undefined, and the caller
|
|
94
|
+
* uses uploads.ts. */
|
|
95
|
+
export declare function archilUploads(options: ArchilUploadsOptions): {
|
|
96
|
+
here: (make: boolean) => Promise<WorkspaceUploads | undefined>;
|
|
97
|
+
place: (runId: string, agentId: string, launch: RunLaunch) => Promise<Placed | undefined>;
|
|
98
|
+
sweep: (retentionMs: number, hasRun: (runId: string) => Promise<boolean>, now?: number) => Promise<string[]>;
|
|
99
|
+
};
|
|
100
|
+
export type ArchilUploads = ReturnType<typeof archilUploads>;
|