@anhlp/alp-runtime 0.0.1-beta.4 → 0.0.1-beta.6
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/dist/acp-transport.js +5 -36
- package/dist/antigravity-transport.d.ts +17 -0
- package/dist/antigravity-transport.js +82 -58
- package/dist/assignment-results.d.ts +34 -0
- package/dist/assignment-results.js +94 -2
- package/dist/board-domain.js +2 -2
- package/dist/board.d.ts +6 -0
- package/dist/board.js +7 -0
- package/dist/catalog.d.ts +13 -0
- package/dist/catalog.js +9 -1
- package/dist/claude-transport.d.ts +7 -0
- package/dist/claude-transport.js +71 -10
- package/dist/compact.d.ts +29 -0
- package/dist/compact.js +49 -0
- package/dist/configure.d.ts +1 -1
- package/dist/configure.js +2 -2
- package/dist/contracts.d.ts +32 -3
- package/dist/index.d.ts +10 -2
- package/dist/index.js +30 -2
- package/dist/input-limits.d.ts +25 -0
- package/dist/input-limits.js +48 -0
- package/dist/language.d.ts +8 -0
- package/dist/language.js +20 -0
- package/dist/mcp-tools.d.ts +8 -0
- package/dist/mcp-tools.js +26 -0
- package/dist/model-catalog.d.ts +76 -0
- package/dist/model-catalog.js +193 -0
- package/dist/model-probes.d.ts +7 -0
- package/dist/model-probes.js +69 -0
- package/dist/providers.js +2 -0
- package/dist/resolve.d.ts +1 -0
- package/dist/resolve.js +3 -1
- package/dist/runtime.d.ts +3 -1
- package/dist/runtime.js +665 -47
- package/dist/session-config.d.ts +174 -0
- package/dist/session-config.js +9 -9
- package/dist/session-state.d.ts +23 -1
- package/dist/tools.d.ts +82 -0
- package/dist/tools.js +53 -5
- package/dist/transport.js +3 -1
- package/dist/workspace.d.ts +31 -5
- package/dist/workspace.js +92 -11
- package/package.json +3 -3
- package/src/acp-transport.ts +7 -37
- package/src/antigravity-transport.ts +95 -53
- package/src/assignment-results.ts +85 -3
- package/src/board-domain.ts +2 -2
- package/src/board.ts +7 -0
- package/src/catalog.ts +10 -1
- package/src/claude-transport.ts +79 -10
- package/src/compact.ts +62 -0
- package/src/configure.ts +3 -3
- package/src/contracts.ts +28 -2
- package/src/index.ts +10 -2
- package/src/input-limits.ts +65 -0
- package/src/language.ts +18 -0
- package/src/mcp-tools.ts +33 -0
- package/src/model-catalog.ts +166 -0
- package/src/model-probes.ts +58 -0
- package/src/providers.ts +3 -0
- package/src/resolve.ts +4 -2
- package/src/runtime.ts +718 -48
- package/src/session-config.ts +8 -8
- package/src/session-state.ts +15 -1
- package/src/tools.ts +53 -5
- package/src/transport.ts +3 -1
- package/src/workspace.ts +124 -18
package/dist/claude-transport.js
CHANGED
|
@@ -6,11 +6,20 @@ import path from "node:path";
|
|
|
6
6
|
import { optionalRead, claudeUsage } from "./runtime-context.js";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { PIN_KINDS } from "./board.js";
|
|
9
|
+
import { BOARD_KINDS_INPUT, PIN_BODY_CHARS, PIN_KINDS, PIN_PATH_CHARS, PIN_PATHS, PIN_PATHS_INPUT } from "./board.js";
|
|
10
|
+
import { RESULT_OUTCOMES } from "./assignment-results.js";
|
|
11
|
+
import { inputLimitError, POUR_VARS, VAR_NAME } from "./input-limits.js";
|
|
10
12
|
import { claudeToolDetail, resultText } from "./tool-detail.js";
|
|
11
13
|
import { CLOSE_REASONS, GATE_KINDS, TASK_STATUSES, TASK_TYPES } from "@anhlp/alp-core/tasks";
|
|
12
14
|
import { commandDecision } from "@anhlp/alp-core/permissions";
|
|
15
|
+
import { packagedInfo } from "@anhlp/alp-core/packaged";
|
|
13
16
|
var CLAUDE_SDK = ["@anthropic-ai", "claude-agent-sdk"].join("/");
|
|
17
|
+
var claudeSdk = () => packagedInfo()?.modules?.[CLAUDE_SDK]?.() ?? import(CLAUDE_SDK);
|
|
18
|
+
var bounded = (schema, limits) => z.preprocess((value, ctx) => {
|
|
19
|
+
const error = inputLimitError(value, limits);
|
|
20
|
+
if (error) ctx.addIssue({ code: "custom", message: error });
|
|
21
|
+
return value;
|
|
22
|
+
}, schema);
|
|
14
23
|
var handoffList = z.array(z.string().min(1)).max(100).optional();
|
|
15
24
|
var taskIds = z.array(z.string().min(1)).max(50).optional();
|
|
16
25
|
var taskLinks = z.object({ blockedBy: taskIds, related: taskIds, parent: z.string().min(1).optional() }).strict().optional();
|
|
@@ -45,6 +54,15 @@ var toolShapes = {
|
|
|
45
54
|
scope: z.enum(["project", "user"]),
|
|
46
55
|
lesson: z.string().min(1).max(600)
|
|
47
56
|
},
|
|
57
|
+
alp_lesson_curate: {
|
|
58
|
+
changes: z.array(z.object({
|
|
59
|
+
scope: z.enum(["project", "user"]),
|
|
60
|
+
remove: z.array(z.string().min(1).max(600)).min(1).max(50),
|
|
61
|
+
add: z.string().min(1).max(600).optional(),
|
|
62
|
+
reason: z.string().max(300).optional()
|
|
63
|
+
}).strict()).min(1).max(50),
|
|
64
|
+
requestId: z.string().min(1).max(100).optional()
|
|
65
|
+
},
|
|
48
66
|
alp_skill: {
|
|
49
67
|
name: z.string().min(1),
|
|
50
68
|
description: z.string().min(1).max(300),
|
|
@@ -90,9 +108,10 @@ var toolShapes = {
|
|
|
90
108
|
kind: z.enum(GATE_KINDS).optional(),
|
|
91
109
|
until: z.string().min(1).optional(),
|
|
92
110
|
ref: z.string().min(1).optional(),
|
|
111
|
+
options: z.array(z.string().min(1).max(200)).max(10).optional(),
|
|
93
112
|
gate: z.string().min(1).optional(),
|
|
94
113
|
formula: z.string().min(1).optional(),
|
|
95
|
-
vars: z.record(z.string(), z.string()).optional(),
|
|
114
|
+
vars: bounded(z.record(z.string().regex(VAR_NAME), z.string().max(POUR_VARS.string)), POUR_VARS).optional(),
|
|
96
115
|
summary: z.string().min(1).max(2e3).optional(),
|
|
97
116
|
unverified: z.string().min(1).max(2e3).optional(),
|
|
98
117
|
note: z.string().min(1).max(2e3).optional(),
|
|
@@ -103,17 +122,22 @@ var toolShapes = {
|
|
|
103
122
|
alp_discard: {
|
|
104
123
|
assignmentId: z.string().min(1)
|
|
105
124
|
},
|
|
125
|
+
alp_resolve: {
|
|
126
|
+
assignmentId: z.string().min(1),
|
|
127
|
+
outcome: z.enum(RESULT_OUTCOMES),
|
|
128
|
+
note: z.string().min(1).max(2e3).optional()
|
|
129
|
+
},
|
|
106
130
|
alp_cancel: {
|
|
107
131
|
assignmentId: z.string().min(1),
|
|
108
132
|
reason: z.string().optional()
|
|
109
133
|
},
|
|
110
134
|
alp_pin: {
|
|
111
135
|
kind: z.enum(PIN_KINDS),
|
|
112
|
-
body: z.string().min(1),
|
|
113
|
-
paths: z.array(z.string().min(1)).optional()
|
|
136
|
+
body: z.string().min(1).max(PIN_BODY_CHARS),
|
|
137
|
+
paths: bounded(z.array(z.string().min(1).max(PIN_PATH_CHARS)).max(PIN_PATHS), PIN_PATHS_INPUT).optional()
|
|
114
138
|
},
|
|
115
139
|
alp_board: {
|
|
116
|
-
kinds: z.array(z.enum(PIN_KINDS)).optional(),
|
|
140
|
+
kinds: bounded(z.array(z.enum(PIN_KINDS)).max(PIN_KINDS.length), BOARD_KINDS_INPUT).optional(),
|
|
117
141
|
limit: z.number().int().positive().optional()
|
|
118
142
|
},
|
|
119
143
|
alp_unpin: {
|
|
@@ -229,8 +253,18 @@ function claudePermissions(sandbox, currentSandbox, rules, ask) {
|
|
|
229
253
|
// Ask rules make Claude consult canUseTool in every mode, which asks the user.
|
|
230
254
|
...rules?.ask?.length ? { settings: { permissions: { ask: rules.ask } } } : {},
|
|
231
255
|
// The floor: Bash runs in the OS sandbox, which writes only the workspace (or nothing, read-only) and temp files, offline.
|
|
256
|
+
// Keep the SDK's restrictive host-network defaults. Broad Unix socket/localhost
|
|
257
|
+
// access lets host services act outside this floor; the SDK cannot scope local
|
|
258
|
+
// binding to a test server, and scoped Unix sockets are not portable to Linux.
|
|
232
259
|
// A command leaves it only with dangerouslyDisableSandbox, which Claude allows itself for allow rules and asks canUseTool otherwise.
|
|
233
|
-
...rules?.floor ? {
|
|
260
|
+
...rules?.floor ? {
|
|
261
|
+
sandbox: {
|
|
262
|
+
enabled: true,
|
|
263
|
+
autoAllowBashIfSandboxed: false,
|
|
264
|
+
allowUnsandboxedCommands: true,
|
|
265
|
+
...rules.floor === "read-only" && rules.floorRoot ? { filesystem: { denyWrite: [rules.floorRoot] } } : {}
|
|
266
|
+
}
|
|
267
|
+
} : {},
|
|
234
268
|
canUseTool: async (name, input, context) => {
|
|
235
269
|
const mode = currentSandbox ? currentSandbox() : sandbox;
|
|
236
270
|
const leaving = Boolean(rules?.floor) && name === "Bash" && input.dangerouslyDisableSandbox === true;
|
|
@@ -261,7 +295,7 @@ function claudePermissions(sandbox, currentSandbox, rules, ask) {
|
|
|
261
295
|
var claudeLimited = (info) => info?.status === "rejected" && info.overageStatus !== "allowed" && info.overageStatus !== "allowed_warning";
|
|
262
296
|
var BOOT_MS = 15e3;
|
|
263
297
|
async function claudeChain(sessionId, dir) {
|
|
264
|
-
const { getSessionMessages } = await
|
|
298
|
+
const { getSessionMessages } = await claudeSdk();
|
|
265
299
|
let messages = dir ? await getSessionMessages(sessionId, { dir }) : [];
|
|
266
300
|
if (!messages.length) messages = await getSessionMessages(sessionId);
|
|
267
301
|
return messages.filter((message) => (message.type === "user" || message.type === "assistant") && typeof message.uuid === "string").map((message) => {
|
|
@@ -345,10 +379,25 @@ var ClaudeTransport = class {
|
|
|
345
379
|
}
|
|
346
380
|
async initialize() {
|
|
347
381
|
}
|
|
382
|
+
/** The models Claude offers now, from a Claude process that sends no prompt and is closed after (t-e5ee). */
|
|
383
|
+
async probeModels(signal) {
|
|
384
|
+
const { query } = await claudeSdk();
|
|
385
|
+
if (signal?.aborted) throw new Error("aborted");
|
|
386
|
+
const probe = query({ prompt: new InputQueue(), options: { cwd: this.cwd, env: this.env, settingSources: [], persistSession: false, strictMcpConfig: true, mcpServers: {}, pathToClaudeCodeExecutable: this.command } });
|
|
387
|
+
const stop = () => probe.close();
|
|
388
|
+
signal?.addEventListener("abort", stop);
|
|
389
|
+
try {
|
|
390
|
+
const models = await probe.supportedModels();
|
|
391
|
+
return models.map((model) => ({ id: model.value, label: model.displayName, description: model.description, efforts: model.supportedEffortLevels ?? void 0 }));
|
|
392
|
+
} finally {
|
|
393
|
+
signal?.removeEventListener("abort", stop);
|
|
394
|
+
probe.close();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
348
397
|
/** The plan's usage windows before a session starts, from a Claude process that sends no prompt and is closed after. */
|
|
349
398
|
async probeUsage() {
|
|
350
399
|
if (this.closed) return void 0;
|
|
351
|
-
const { query } = await
|
|
400
|
+
const { query } = await claudeSdk();
|
|
352
401
|
const probe = query({ prompt: new InputQueue(), options: { cwd: this.cwd, env: this.env, settingSources: [], persistSession: false, strictMcpConfig: true, mcpServers: {}, pathToClaudeCodeExecutable: this.command } });
|
|
353
402
|
try {
|
|
354
403
|
return await probe.usage_EXPERIMENTAL_MAY_CHANGE_DO_NOT_RELY_ON_THIS_API_YET({ skipBehaviors: true });
|
|
@@ -377,7 +426,7 @@ var ClaudeTransport = class {
|
|
|
377
426
|
}
|
|
378
427
|
if (method === "thread/chain") return { entries: await claudeChain(params.threadId, params.cwd ?? this.cwd) };
|
|
379
428
|
if (method === "thread/delete") {
|
|
380
|
-
const { deleteSession } = await
|
|
429
|
+
const { deleteSession } = await claudeSdk();
|
|
381
430
|
await deleteSession(params.threadId, params.cwd ? { dir: params.cwd } : {});
|
|
382
431
|
return {};
|
|
383
432
|
}
|
|
@@ -417,6 +466,18 @@ var ClaudeTransport = class {
|
|
|
417
466
|
});
|
|
418
467
|
return method === "turn/start" ? { turn: { id: turnId } } : {};
|
|
419
468
|
}
|
|
469
|
+
if (method === "thread/compact/start") {
|
|
470
|
+
if (!this.query) throw new Error("Claude thread is not initialized");
|
|
471
|
+
if (this.activeTurn) throw new Error("A turn is running");
|
|
472
|
+
const turnId = randomUUID();
|
|
473
|
+
this.clearAssistantText();
|
|
474
|
+
this.activeTurn = turnId;
|
|
475
|
+
this.turnsStarted = true;
|
|
476
|
+
this.emit("turn/started", { threadId: this.threadId, turn: { id: turnId } });
|
|
477
|
+
const instructions = typeof params.instructions === "string" ? ` ${params.instructions.trim()}` : "";
|
|
478
|
+
this.input.push({ type: "user", message: { role: "user", content: `/compact${instructions}` }, parent_tool_use_id: null, uuid: turnId, session_id: this.threadId });
|
|
479
|
+
return {};
|
|
480
|
+
}
|
|
420
481
|
if (method === "turn/interrupt") {
|
|
421
482
|
this.streamingMessage = void 0;
|
|
422
483
|
await this.query?.interrupt();
|
|
@@ -461,7 +522,7 @@ var ClaudeTransport = class {
|
|
|
461
522
|
if (this.bootError) throw this.bootError;
|
|
462
523
|
}
|
|
463
524
|
async start(from) {
|
|
464
|
-
const { createSdkMcpServer, query, tool } = await
|
|
525
|
+
const { createSdkMcpServer, query, tool } = await claudeSdk();
|
|
465
526
|
const config = this.config;
|
|
466
527
|
const mcpServers = this.convertMcp(config.mcpServers);
|
|
467
528
|
if (config.dynamicTools.length) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main's compaction (t-0e56): at a turn boundary, once main's context fills to the
|
|
3
|
+
* threshold (or the user asks), ALP has main write a checkpoint by skill `compact`,
|
|
4
|
+
* then compacts with the runtime's own mechanism (Claude's /compact, Codex's
|
|
5
|
+
* thread/compact/start), or else starts a fresh conversation seeded with the checkpoint.
|
|
6
|
+
*/
|
|
7
|
+
export interface CompactSettings {
|
|
8
|
+
auto: boolean;
|
|
9
|
+
threshold: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const COMPACT_DEFAULTS: CompactSettings;
|
|
12
|
+
/**
|
|
13
|
+
* settings.json `compact`: { auto?: boolean, threshold?: number in (0, 1) }; anything else keeps the default.
|
|
14
|
+
* The threshold is a share of the window main works in: the agent's autocompact or context setting when
|
|
15
|
+
* set, else the model's context window, as the context advisory measures it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function compactSettings(raw: unknown): CompactSettings;
|
|
18
|
+
/** How full the context is, 0..1, from a runtime's token usage; undefined when the window is unknown. */
|
|
19
|
+
export declare function contextFill(usage: any): number | undefined;
|
|
20
|
+
/** Whether an idle root should compact now. */
|
|
21
|
+
export declare function compactDue(settings: CompactSettings, fill: number | undefined, requested: boolean): 'auto' | 'manual' | undefined;
|
|
22
|
+
/** Runtimes that compact a conversation in place. */
|
|
23
|
+
export declare const NATIVE_COMPACT: string[];
|
|
24
|
+
export declare const CHECKPOINT_MARK = "ALP compact checkpoint";
|
|
25
|
+
export declare function checkpointPrompt(trigger: 'auto' | 'manual', fill?: number): string;
|
|
26
|
+
/** What the runtime's native compaction is told to keep. */
|
|
27
|
+
export declare function compactInstructions(checkpoint: string): string;
|
|
28
|
+
/** The first prompt of a fresh conversation that replaces a full one. */
|
|
29
|
+
export declare function seedPrompt(checkpoint: string, lastUser?: string): string;
|
package/dist/compact.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// packages/runtime/src/compact.ts
|
|
2
|
+
var COMPACT_DEFAULTS = Object.freeze({ auto: true, threshold: 0.7 });
|
|
3
|
+
function compactSettings(raw) {
|
|
4
|
+
const value = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
5
|
+
const auto = typeof value.auto === "boolean" ? value.auto : COMPACT_DEFAULTS.auto;
|
|
6
|
+
const threshold = typeof value.threshold === "number" && Number.isFinite(value.threshold) && value.threshold > 0 && value.threshold < 1 ? value.threshold : COMPACT_DEFAULTS.threshold;
|
|
7
|
+
return { auto, threshold };
|
|
8
|
+
}
|
|
9
|
+
function contextFill(usage) {
|
|
10
|
+
const used = usage?.last?.totalTokens;
|
|
11
|
+
const window = usage?.modelContextWindow;
|
|
12
|
+
if (typeof used !== "number" || typeof window !== "number" || window <= 0) return void 0;
|
|
13
|
+
return used / window;
|
|
14
|
+
}
|
|
15
|
+
function compactDue(settings, fill, requested) {
|
|
16
|
+
if (requested) return "manual";
|
|
17
|
+
if (settings.auto && typeof fill === "number" && fill >= settings.threshold) return "auto";
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
var NATIVE_COMPACT = ["claude", "codex"];
|
|
21
|
+
var CHECKPOINT_MARK = "ALP compact checkpoint";
|
|
22
|
+
function checkpointPrompt(trigger, fill) {
|
|
23
|
+
const why = trigger === "manual" ? "The user asked to compact your context." : `Your context is about ${Math.round((fill ?? 0) * 100)}% full.`;
|
|
24
|
+
return `${CHECKPOINT_MARK}: ${why} ALP compacts it after this turn. Write a checkpoint now following skill compact (read its SKILL.md): check the facts with alp_task, alp_board and gh where it applies, then reply with the checkpoint alone, in its sections: skip the skill's notice to the user, ALP posts it. Do not start new work, delegate, wait or ask in this turn.`;
|
|
25
|
+
}
|
|
26
|
+
function compactInstructions(checkpoint) {
|
|
27
|
+
return `Keep this checkpoint verbatim in the summary; it is the state of the work:
|
|
28
|
+
${checkpoint}`;
|
|
29
|
+
}
|
|
30
|
+
function seedPrompt(checkpoint, lastUser) {
|
|
31
|
+
return [
|
|
32
|
+
"Your context was compacted: ALP started this conversation fresh. Your instructions are unchanged. This is the checkpoint you wrote before, by skill compact:",
|
|
33
|
+
checkpoint,
|
|
34
|
+
...lastUser ? [`The user's last message before the compaction, verbatim:
|
|
35
|
+
${lastUser}`] : [],
|
|
36
|
+
"Read alp_task and alp_board again (and gh for PR/CI) before reporting status, then carry on. If nothing waits for you, end the turn."
|
|
37
|
+
].join("\n\n");
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
CHECKPOINT_MARK,
|
|
41
|
+
COMPACT_DEFAULTS,
|
|
42
|
+
NATIVE_COMPACT,
|
|
43
|
+
checkpointPrompt,
|
|
44
|
+
compactDue,
|
|
45
|
+
compactInstructions,
|
|
46
|
+
compactSettings,
|
|
47
|
+
contextFill,
|
|
48
|
+
seedPrompt
|
|
49
|
+
};
|
package/dist/configure.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function nativeModelOf(runtime: RuntimeKind, model: string): {
|
|
|
20
20
|
runtime: string;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Whether the host offers `model` on `runtime`: ALP's catalog (
|
|
23
|
+
* Whether the host offers `model` on `runtime`: ALP's live catalog (catalog.ts entries, what library.models and
|
|
24
24
|
* catalog.get list), a model the project's settings give an agent of the team, or the model the session
|
|
25
25
|
* runs already. Never an arbitrary string.
|
|
26
26
|
*/
|
package/dist/configure.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/runtime/src/configure.ts
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import {
|
|
3
|
+
import { entries } from "./catalog.js";
|
|
4
4
|
import { profileModel } from "@anhlp/alp-core/profiles";
|
|
5
5
|
var CONFIGURABLE = /* @__PURE__ */ new Set(["codex", "claude"]);
|
|
6
6
|
var PREFIXED = /^(codex|claude|antigravity|acp)[:/](.*)$/s;
|
|
@@ -11,7 +11,7 @@ function nativeModelOf(runtime, model) {
|
|
|
11
11
|
}
|
|
12
12
|
function offered(runtime, model, mapping) {
|
|
13
13
|
if (model === mapping.model) return true;
|
|
14
|
-
if (
|
|
14
|
+
if (entries.some((entry) => entry.runtime === runtime && entry.id === model)) return true;
|
|
15
15
|
return Object.values(mapping.modelProfiles ?? {}).flat().some((profile) => profileModel(profile) === `${runtime}:${model}`);
|
|
16
16
|
}
|
|
17
17
|
function mcpOf(mapping) {
|
package/dist/contracts.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export type RuntimeOptions = {
|
|
|
43
43
|
checkInMs?: number;
|
|
44
44
|
/** How often the watchdog looks at running assignments; derived from silentForMs and checkInMs when omitted. */
|
|
45
45
|
watchMs?: number;
|
|
46
|
+
/** How often the project tasks are read for gate changes made without alpd, in ms; 0 turns the timer off. Default 5000. */
|
|
47
|
+
gateSyncMs?: number;
|
|
46
48
|
/** How long alp_ask waits for the requester before returning unanswered. */
|
|
47
49
|
askTimeoutMs?: number;
|
|
48
50
|
/** How long alp_ask waits for the user before returning unanswered. Default 30 minutes. */
|
|
@@ -110,6 +112,13 @@ export type AlpRuntime = {
|
|
|
110
112
|
registerWorkspace(directory: string): Promise<void>;
|
|
111
113
|
/** Reserves runtime admission while an external checkout mutation runs. */
|
|
112
114
|
withWorkspaceMutation<T>(directory: string, run: () => Promise<T>): Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Owner-audited adoption of a checkout that predates birth certification (t-c1ba). Under the
|
|
117
|
+
* removal guard's reservation and ownership checks, `verify` must prove the checkout's identity
|
|
118
|
+
* (it throws otherwise); only then is the canonical directory certified. Never call it without
|
|
119
|
+
* the owner's explicit confirmation of the facts `verify` checks.
|
|
120
|
+
*/
|
|
121
|
+
adoptWorkspace?(directory: string, verify: (canonical: string) => Promise<void>): Promise<void>;
|
|
113
122
|
/** Opens a root session under a client-chosen id. */
|
|
114
123
|
open(sessionId: string, spec: SessionSpec, options?: OpenOptions): Promise<SessionSnapshot>;
|
|
115
124
|
/** What a new root would run as, before it opens, and the teams it may choose (ALPD §60). */
|
|
@@ -146,12 +155,20 @@ export type AlpRuntime = {
|
|
|
146
155
|
status(sessionId: string): TreeStatus | undefined;
|
|
147
156
|
/** Questions agents asked the user that wait for an answer. */
|
|
148
157
|
questions(): UserQuestion[];
|
|
149
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* Answers or dismisses a question to the user. A gate card's answer returns a promise that
|
|
160
|
+
* settles once the decision is written, and rejects when it decides nothing: another answer is
|
|
161
|
+
* being recorded or another channel decided first (code GATE_BUSY or GATE_DECIDED), or the
|
|
162
|
+
* write failed (t-595d).
|
|
163
|
+
*/
|
|
150
164
|
answer(questionId: string, reply: {
|
|
151
165
|
text?: string;
|
|
152
166
|
dismiss?: boolean;
|
|
153
|
-
reason?: string;
|
|
154
|
-
|
|
167
|
+
reason?: string; /** Where the user answered a gate card: paseo or web. */
|
|
168
|
+
channel?: 'paseo' | 'web';
|
|
169
|
+
}): void | Promise<void>;
|
|
170
|
+
/** Mirrors the project's open human gates as cards on its main session and tells main of the user's gate decisions, at least once each (t-ccac, t-595d). */
|
|
171
|
+
syncGates?(projectRoot: string): Promise<void>;
|
|
155
172
|
/** Mails a note from the user to any live session, such as an assignment the user wants to redirect. */
|
|
156
173
|
message(sessionId: string, text: string): void;
|
|
157
174
|
/** The project board: live claims, then decisions and findings, oldest first. */
|
|
@@ -166,6 +183,14 @@ export type AlpRuntime = {
|
|
|
166
183
|
resume(input?: {
|
|
167
184
|
runtime?: RuntimeKind;
|
|
168
185
|
}): PauseState;
|
|
186
|
+
/** alpd's disk takes no writes (t-2831): pauses all of ALP and parks running assignments, unless all of ALP is paused already. */
|
|
187
|
+
holdForDisk(reason: string): PauseState;
|
|
188
|
+
/** Lifts the pause holdForDisk made, keeping usage-limit pauses; a pause the user made stays. */
|
|
189
|
+
releaseDisk(by: string): PauseState;
|
|
190
|
+
/** Whether alpd's disk pause holds ALP now. */
|
|
191
|
+
diskHeld(): boolean;
|
|
192
|
+
/** Tells every open root that disk space runs low. */
|
|
193
|
+
diskLow(free: string): void;
|
|
169
194
|
/** Current pauses and parked assignments. */
|
|
170
195
|
pauses(): PauseState;
|
|
171
196
|
/** Read-only, cached account usage for the web and desktop viewers. */
|
|
@@ -219,6 +244,10 @@ export type AlpRuntime = {
|
|
|
219
244
|
* Emits session.updated.
|
|
220
245
|
*/
|
|
221
246
|
reload?(sessionId: string): Promise<SessionSnapshot>;
|
|
247
|
+
/** Compacts a root's context at its next turn boundary, with a checkpoint main writes by skill compact (t-0e56). */
|
|
248
|
+
compact?(sessionId: string): {
|
|
249
|
+
status: 'started' | 'deferred' | 'running';
|
|
250
|
+
};
|
|
222
251
|
/**
|
|
223
252
|
* Holds the turns the runtime would start by itself on this session (mail wakes) while a lifecycle
|
|
224
253
|
* operation changes its conversation (a rewind, later a reload or live configure): mail stays queued
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ export type { BranchRequest, ConversationErrorReason, NativeBase, NativeBinding,
|
|
|
5
5
|
export type { AlpEvent, AlpError, Envelope, SessionSnapshot, TimelineItem, TurnOrigin, AssignmentSnapshot, UserQuestion, TreeStatus, SessionState } from './events.js';
|
|
6
6
|
export { resolveSession, InstructionsAdapter, skillDescription } from './resolve.js';
|
|
7
7
|
export type { SessionSpec, HostMcpServer, ResolvedSession, RuntimeKind } from './resolve.js';
|
|
8
|
-
export { DEFAULT_MODEL, DEFAULT_CLAUDE_MODEL, models, modes, thinkingOptions, thinkingOptionsFor } from './catalog.js';
|
|
8
|
+
export { DEFAULT_MODEL, DEFAULT_CLAUDE_MODEL, entries as catalogEntries, models, modes, thinkingOptions, thinkingOptionsFor } from './catalog.js';
|
|
9
|
+
export type { CatalogEntry } from './catalog.js';
|
|
10
|
+
export { ModelCatalog, mergeCatalog, liveFromContext, feedCatalog, setActiveCatalog, activeCatalog, POLICY as CATALOG_POLICY, REFRESH_MS as CATALOG_REFRESH_MS } from './model-catalog.js';
|
|
11
|
+
export type { CatalogSnapshot, CatalogRuntime, LiveModel, Probe as CatalogProbe } from './model-catalog.js';
|
|
12
|
+
export { liveProbes, codexProbe, claudeProbe, antigravityProbe, parseAgyModels } from './model-probes.js';
|
|
9
13
|
export { CodexTransport } from './transport.js';
|
|
10
14
|
export { ATTACHMENT_HEADER, ATTACHMENT_ROUTES, attachmentStageDir, createAttachmentStager, stagingExposure } from './attachments.js';
|
|
11
15
|
export type { AttachmentReader, AttachmentRoute } from './attachments.js';
|
|
@@ -17,10 +21,13 @@ export type { AntigravityProvider } from './antigravity-transport.js';
|
|
|
17
21
|
export { ClaudeTransport, claudePermissions, claudeSandboxAvailable, skillPlugin, SKILL_PLUGIN, toolShapes as claudeToolShapes } from './claude-transport.js';
|
|
18
22
|
export { MAIL_BATCH_CHARS, MAIL_BODY_CHARS, publicEvent, renderMail, takeBatch, USER } from './mailbox.js';
|
|
19
23
|
export type { MailEvent, MailKind } from './mailbox.js';
|
|
20
|
-
export { createCopy, gitEnvironment, reclaimCopies, reclaimWorktrees, removeCopy } from './workspace.js';
|
|
24
|
+
export { createCopy, gitEnvironment, reattachWorktree, reclaimCopies, reclaimWorktrees, removeCopy } from './workspace.js';
|
|
25
|
+
export type { LeftWorktree } from './workspace.js';
|
|
21
26
|
export { OWN_START, processStartedAt, sameProcessAlive } from './process-info.js';
|
|
22
27
|
export type { Worktree, WorktreeChange } from './workspace.js';
|
|
23
28
|
export { PIN_KINDS, renderBoard, renderPin } from './board.js';
|
|
29
|
+
export { inputLimitError, TOOL_INPUT, POUR_VARS } from './input-limits.js';
|
|
30
|
+
export type { InputLimits } from './input-limits.js';
|
|
24
31
|
export { CHOICES, isVietnamese, languageInstruction, words } from './language.js';
|
|
25
32
|
export type { Words } from './language.js';
|
|
26
33
|
export type { Pin, PinKind } from './board.js';
|
|
@@ -28,3 +35,4 @@ export { ProviderRegistry, createProviderRegistry } from './providers.js';
|
|
|
28
35
|
export type { ProviderContext, ProviderFactory, ProviderFactories } from './providers.js';
|
|
29
36
|
export { acpToolDetail, antigravityToolDetail, boundDetail, claudeToolDetail, clipText, codexToolCall, stripReadGutter, toolError, DETAIL_FILE_PATHS, DETAIL_TEXT_CHARS, DETAIL_WEB_RESULTS, ERROR_CHARS, TOOL_FAILED } from './tool-detail.js';
|
|
30
37
|
export type { AcpCall, ClaudeResult, CodexToolCall, ToolCallDetail } from './tool-detail.js';
|
|
38
|
+
export { checkpointPrompt, compactDue, compactSettings, contextFill, seedPrompt, COMPACT_DEFAULTS } from './compact.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { createAlpRuntime, DEFAULT_TEAM, WorkspaceMutationError } from "./runtime.js";
|
|
3
3
|
import { ConversationError } from "./contracts.js";
|
|
4
4
|
import { resolveSession, InstructionsAdapter, skillDescription } from "./resolve.js";
|
|
5
|
-
import { DEFAULT_MODEL, DEFAULT_CLAUDE_MODEL, models, modes, thinkingOptions, thinkingOptionsFor } from "./catalog.js";
|
|
5
|
+
import { DEFAULT_MODEL, DEFAULT_CLAUDE_MODEL, entries, models, modes, thinkingOptions, thinkingOptionsFor } from "./catalog.js";
|
|
6
|
+
import { ModelCatalog, mergeCatalog, liveFromContext, feedCatalog, setActiveCatalog, activeCatalog, POLICY, REFRESH_MS } from "./model-catalog.js";
|
|
7
|
+
import { liveProbes, codexProbe, claudeProbe, antigravityProbe, parseAgyModels } from "./model-probes.js";
|
|
6
8
|
import { CodexTransport } from "./transport.js";
|
|
7
9
|
import { ATTACHMENT_HEADER, ATTACHMENT_ROUTES, attachmentStageDir, createAttachmentStager, stagingExposure } from "./attachments.js";
|
|
8
10
|
import { usageAllows } from "./runtime-context.js";
|
|
@@ -10,18 +12,23 @@ import { AcpTransport, acpDecision, acpEnv, acpPermission } from "./acp-transpor
|
|
|
10
12
|
import { AntigravityTransport } from "./antigravity-transport.js";
|
|
11
13
|
import { ClaudeTransport, claudePermissions, claudeSandboxAvailable, skillPlugin, SKILL_PLUGIN, toolShapes } from "./claude-transport.js";
|
|
12
14
|
import { MAIL_BATCH_CHARS, MAIL_BODY_CHARS, publicEvent, renderMail, takeBatch, USER } from "./mailbox.js";
|
|
13
|
-
import { createCopy, gitEnvironment, reclaimCopies, reclaimWorktrees, removeCopy } from "./workspace.js";
|
|
15
|
+
import { createCopy, gitEnvironment, reattachWorktree, reclaimCopies, reclaimWorktrees, removeCopy } from "./workspace.js";
|
|
14
16
|
import { OWN_START, processStartedAt, sameProcessAlive } from "./process-info.js";
|
|
15
17
|
import { PIN_KINDS, renderBoard, renderPin } from "./board.js";
|
|
18
|
+
import { inputLimitError, TOOL_INPUT, POUR_VARS } from "./input-limits.js";
|
|
16
19
|
import { CHOICES, isVietnamese, languageInstruction, words } from "./language.js";
|
|
17
20
|
import { ProviderRegistry, createProviderRegistry } from "./providers.js";
|
|
18
21
|
import { acpToolDetail, antigravityToolDetail, boundDetail, claudeToolDetail, clipText, codexToolCall, stripReadGutter, toolError, DETAIL_FILE_PATHS, DETAIL_TEXT_CHARS, DETAIL_WEB_RESULTS, ERROR_CHARS, TOOL_FAILED } from "./tool-detail.js";
|
|
22
|
+
import { checkpointPrompt, compactDue, compactSettings, contextFill, seedPrompt, COMPACT_DEFAULTS } from "./compact.js";
|
|
19
23
|
export {
|
|
20
24
|
ATTACHMENT_HEADER,
|
|
21
25
|
ATTACHMENT_ROUTES,
|
|
22
26
|
AcpTransport,
|
|
23
27
|
AntigravityTransport,
|
|
28
|
+
POLICY as CATALOG_POLICY,
|
|
29
|
+
REFRESH_MS as CATALOG_REFRESH_MS,
|
|
24
30
|
CHOICES,
|
|
31
|
+
COMPACT_DEFAULTS,
|
|
25
32
|
ClaudeTransport,
|
|
26
33
|
CodexTransport,
|
|
27
34
|
ConversationError,
|
|
@@ -35,37 +42,56 @@ export {
|
|
|
35
42
|
InstructionsAdapter,
|
|
36
43
|
MAIL_BATCH_CHARS,
|
|
37
44
|
MAIL_BODY_CHARS,
|
|
45
|
+
ModelCatalog,
|
|
38
46
|
OWN_START,
|
|
39
47
|
PIN_KINDS,
|
|
48
|
+
POUR_VARS,
|
|
40
49
|
ProviderRegistry,
|
|
41
50
|
SKILL_PLUGIN,
|
|
42
51
|
TOOL_FAILED,
|
|
52
|
+
TOOL_INPUT,
|
|
43
53
|
USER,
|
|
44
54
|
WorkspaceMutationError,
|
|
45
55
|
acpDecision,
|
|
46
56
|
acpEnv,
|
|
47
57
|
acpPermission,
|
|
48
58
|
acpToolDetail,
|
|
59
|
+
activeCatalog,
|
|
60
|
+
antigravityProbe,
|
|
49
61
|
antigravityToolDetail,
|
|
50
62
|
attachmentStageDir,
|
|
51
63
|
boundDetail,
|
|
64
|
+
entries as catalogEntries,
|
|
65
|
+
checkpointPrompt,
|
|
52
66
|
claudePermissions,
|
|
67
|
+
claudeProbe,
|
|
53
68
|
claudeSandboxAvailable,
|
|
54
69
|
claudeToolDetail,
|
|
55
70
|
toolShapes as claudeToolShapes,
|
|
56
71
|
clipText,
|
|
72
|
+
codexProbe,
|
|
57
73
|
codexToolCall,
|
|
74
|
+
compactDue,
|
|
75
|
+
compactSettings,
|
|
76
|
+
contextFill,
|
|
58
77
|
createAlpRuntime,
|
|
59
78
|
createAttachmentStager,
|
|
60
79
|
createCopy,
|
|
61
80
|
createProviderRegistry,
|
|
81
|
+
feedCatalog,
|
|
62
82
|
gitEnvironment,
|
|
83
|
+
inputLimitError,
|
|
63
84
|
isVietnamese,
|
|
64
85
|
languageInstruction,
|
|
86
|
+
liveFromContext,
|
|
87
|
+
liveProbes,
|
|
88
|
+
mergeCatalog,
|
|
65
89
|
models,
|
|
66
90
|
modes,
|
|
91
|
+
parseAgyModels,
|
|
67
92
|
processStartedAt,
|
|
68
93
|
publicEvent,
|
|
94
|
+
reattachWorktree,
|
|
69
95
|
reclaimCopies,
|
|
70
96
|
reclaimWorktrees,
|
|
71
97
|
removeCopy,
|
|
@@ -74,6 +100,8 @@ export {
|
|
|
74
100
|
renderPin,
|
|
75
101
|
resolveSession,
|
|
76
102
|
sameProcessAlive,
|
|
103
|
+
seedPrompt,
|
|
104
|
+
setActiveCatalog,
|
|
77
105
|
skillDescription,
|
|
78
106
|
skillPlugin,
|
|
79
107
|
stagingExposure,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Size caps for values that reach ALP from a provider or an external MCP server, checked
|
|
3
|
+
* before any schema walks them. Zod before 4.6.6 walks every element of an array before it
|
|
4
|
+
* reports the array's .max(), and a record has no bound at all, so a cap stated only in a
|
|
5
|
+
* schema still costs time and memory in proportion to the input. This walk stops at the first
|
|
6
|
+
* cap the value passes, so its own cost is bounded by the caps, not by the value.
|
|
7
|
+
*/
|
|
8
|
+
export type InputLimits = {
|
|
9
|
+
/** UTF-8 bytes of the value as JSON, roughly: strings, keys and separators. */
|
|
10
|
+
bytes: number;
|
|
11
|
+
/** Array elements and object keys, counted over the whole value. */
|
|
12
|
+
items: number;
|
|
13
|
+
/** Arrays and objects inside each other; 1 admits a flat list or object of scalars. */
|
|
14
|
+
depth: number;
|
|
15
|
+
/** Characters in any one string, keys included. */
|
|
16
|
+
string: number;
|
|
17
|
+
};
|
|
18
|
+
/** The arguments of any ALP tool. The longest declared field is alp_delegate's 32,000-character task. */
|
|
19
|
+
export declare const TOOL_INPUT: InputLimits;
|
|
20
|
+
/** alp_task pour's vars: a flat object of text, one value per variable the formula declares. */
|
|
21
|
+
export declare const POUR_VARS: InputLimits;
|
|
22
|
+
/** A formula variable's name, as validateFormula admits it. */
|
|
23
|
+
export declare const VAR_NAME: RegExp;
|
|
24
|
+
/** The first cap `value` passes, as an error that names `what`, or undefined within them. */
|
|
25
|
+
export declare function inputLimitError(value: unknown, limits: InputLimits, what?: string): string | undefined;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// packages/runtime/src/input-limits.ts
|
|
2
|
+
var TOOL_INPUT = { bytes: 1024 * 1024, items: 5e3, depth: 8, string: 128 * 1024 };
|
|
3
|
+
var POUR_VARS = { bytes: 128 * 1024, items: 50, depth: 1, string: 2e3 };
|
|
4
|
+
var VAR_NAME = /^[\w-]{1,64}$/;
|
|
5
|
+
function inputLimitError(value, limits, what = "The input") {
|
|
6
|
+
let bytes = 0;
|
|
7
|
+
let items = 0;
|
|
8
|
+
const stack = [[value, 0]];
|
|
9
|
+
const tooLarge = `${what} is too large: over ${limits.bytes} bytes`;
|
|
10
|
+
const text = (string) => {
|
|
11
|
+
if (string.length > limits.string) return `${what} is too large: a text over ${limits.string} characters`;
|
|
12
|
+
bytes += Buffer.byteLength(string) + 2;
|
|
13
|
+
return bytes > limits.bytes ? tooLarge : void 0;
|
|
14
|
+
};
|
|
15
|
+
while (stack.length) {
|
|
16
|
+
const [current, depth] = stack.pop();
|
|
17
|
+
if (typeof current === "string") {
|
|
18
|
+
const error = text(current);
|
|
19
|
+
if (error) return error;
|
|
20
|
+
} else if (current !== null && typeof current === "object") {
|
|
21
|
+
if (depth >= limits.depth) return `${what} is too large: nested over ${limits.depth} levels deep`;
|
|
22
|
+
bytes += 2;
|
|
23
|
+
const list = Array.isArray(current);
|
|
24
|
+
const keys = list ? void 0 : Object.keys(current);
|
|
25
|
+
const size = list ? current.length : keys.length;
|
|
26
|
+
if (items + size > limits.items) return `${what} is too large: over ${limits.items} values`;
|
|
27
|
+
items += size;
|
|
28
|
+
for (let index = 0; index < size; index++) {
|
|
29
|
+
if (keys) {
|
|
30
|
+
const error = text(keys[index]);
|
|
31
|
+
if (error) return error;
|
|
32
|
+
}
|
|
33
|
+
bytes += 1;
|
|
34
|
+
stack.push([list ? current[index] : current[keys[index]], depth + 1]);
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
bytes += String(current).length;
|
|
38
|
+
}
|
|
39
|
+
if (bytes > limits.bytes) return tooLarge;
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
POUR_VARS,
|
|
45
|
+
TOOL_INPUT,
|
|
46
|
+
VAR_NAME,
|
|
47
|
+
inputLimitError
|
|
48
|
+
};
|
package/dist/language.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ declare const en: {
|
|
|
11
11
|
skill: (agent: string, replacing: boolean, file: string, roles: string, lessons: string[]) => string;
|
|
12
12
|
issue: (agent: string, create: boolean, issue: number | undefined, where: string) => string;
|
|
13
13
|
issueTitle: string;
|
|
14
|
+
lessonCurate: (agent: string, changes: string) => string;
|
|
15
|
+
lessonRemove: string;
|
|
16
|
+
lessonAdd: string;
|
|
17
|
+
lessonScope: (scope: string, file: string) => string;
|
|
14
18
|
issueLabels: string;
|
|
15
19
|
trust: (project: string, names: string) => string;
|
|
16
20
|
trustYes: string;
|
|
@@ -21,10 +25,14 @@ declare const en: {
|
|
|
21
25
|
permission: (agent: string, what: string, byRule: boolean, profile: string | undefined, mode: string, always: string | undefined) => string;
|
|
22
26
|
limitReached: (runtime: string, resetsAt: string | undefined, other: string | undefined, autoResume: boolean, kind: string) => string;
|
|
23
27
|
limitLifted: (runtime: string, kind: string) => string;
|
|
28
|
+
compacted: (native: boolean) => string;
|
|
29
|
+
compactFailed: (reason: string) => string;
|
|
24
30
|
usageWarning: (runtime: string, used: string, resetsAt: string | undefined) => string;
|
|
25
31
|
/** The web app's answer to a Paseo feature ALP has not got yet (ALPD §62). */
|
|
26
32
|
inDevelopment: string;
|
|
27
33
|
resumed: (what: string, by: string, parked: boolean) => string;
|
|
34
|
+
diskFull: (reason: string) => string;
|
|
35
|
+
diskLow: (free: string) => string;
|
|
28
36
|
paused: (what: string, reason: string | undefined, runtime: string | undefined, now: boolean) => string;
|
|
29
37
|
};
|
|
30
38
|
export type Words = typeof en;
|
package/dist/language.js
CHANGED
|
@@ -8,6 +8,12 @@ var en = {
|
|
|
8
8
|
${lessons.map((lesson) => `- ${lesson}`).join("\n")}` : ""),
|
|
9
9
|
issue: (agent, create, issue, where) => `${agent} wants to ${create ? `open an issue in ${where}` : `comment on issue #${issue} in ${where}`}. It is posted with your GitHub account, and anyone who can see the repository can read it.`,
|
|
10
10
|
issueTitle: "Title",
|
|
11
|
+
lessonCurate: (agent, changes) => `${agent} proposes to curate the lessons files. Approve to apply every change below at once; nothing else changes.
|
|
12
|
+
|
|
13
|
+
${changes}`,
|
|
14
|
+
lessonRemove: "Remove",
|
|
15
|
+
lessonAdd: "Add",
|
|
16
|
+
lessonScope: (scope, file) => `${scope === "user" ? "User lessons" : "Project lessons"} (${file})`,
|
|
11
17
|
issueLabels: "Labels",
|
|
12
18
|
trust: (project, names) => `This project's hooks run shell commands from ${project} on your machine: ${names}. Trust this workspace's hooks? ALP asks once: after you agree, its hooks run without asking, including hooks added or changed later.`,
|
|
13
19
|
trustYes: "Trust this workspace",
|
|
@@ -18,10 +24,14 @@ ${lessons.map((lesson) => `- ${lesson}`).join("\n")}` : ""),
|
|
|
18
24
|
permission: (agent, what, byRule, profile, mode, always) => `${agent} wants to ${what}. ` + (byRule ? `Its permission profile ${profile} asks you each time.` : `Its ${mode} mode does not allow that.`) + (always ? ` Always allow adds ${always} to profile ${profile}.` : ""),
|
|
19
25
|
limitReached: (runtime, resetsAt, other, autoResume, kind) => `${runtime} usage limit reached${resetsAt ? `; it resets ${resetsAt}` : ""}. ALP paused delegation to ${runtime} agents and parked their assignments${other ? `; ${other} agents keep working` : ""}. ${autoResume ? `ALP asks ${runtime} every minute and resumes it as soon as the limit lifts.` : `ALP asks ${runtime} every minute and tells you when the limit lifts; then run alp resume ${kind}.`}`,
|
|
20
26
|
limitLifted: (runtime, kind) => `${runtime} says its usage limit has lifted. Run alp resume ${kind} to continue its work.`,
|
|
27
|
+
compacted: (native) => `Main's context was compacted${native ? "" : " into a fresh conversation"}; it keeps its checkpoint and carries on.`,
|
|
28
|
+
compactFailed: (reason) => `Compacting main's context failed (${reason}); ALP tries again later.`,
|
|
21
29
|
usageWarning: (runtime, used, resetsAt) => `${runtime} has used ${used} of a usage window${resetsAt ? ` that resets ${resetsAt}` : ""}.`,
|
|
22
30
|
/** The web app's answer to a Paseo feature ALP has not got yet (ALPD §62). */
|
|
23
31
|
inDevelopment: "This feature is in development",
|
|
24
32
|
resumed: (what, by, parked) => `${what} resumed by ${by}.${parked ? " Parked assignments continue." : ""}`,
|
|
33
|
+
diskFull: (reason) => `Disk full: ${reason}. ALP paused its work and parked running assignments; it keeps answering. Free some space (alp doctor lists leftover worktrees); ALP checks every minute and continues by itself, or run alp resume.`,
|
|
34
|
+
diskLow: (free) => `Disk space is low: ${free} free. Free some space before it fills (alp doctor lists leftover worktrees); when it is full, ALP pauses its work.`,
|
|
25
35
|
paused: (what, reason, runtime, now) => `${what} paused by the user${reason ? `: ${reason}` : ""}. Delegation${runtime ? ` to ${runtime} agents` : ""} waits${now ? ", and running assignments park where they are" : "; running turns finish"}. alp resume continues.`
|
|
26
36
|
};
|
|
27
37
|
var viWhat = (what) => what.replace(/^run /, "ch\u1EA1y ").replace(/^change files under /, "s\u1EEDa file trong ").replace(/^change files/, "s\u1EEDa file").replace(/^use /, "d\xF9ng ");
|
|
@@ -33,6 +43,12 @@ var vi = {
|
|
|
33
43
|
${lessons.map((lesson) => `- ${lesson}`).join("\n")}` : ""),
|
|
34
44
|
issue: (agent, create, issue, where) => `${agent} mu\u1ED1n ${create ? `m\u1EDF m\u1ED9t issue trong ${where}` : `b\xECnh lu\u1EADn v\xE0o issue #${issue} trong ${where}`}. N\u1ED9i dung \u0111\u01B0\u1EE3c \u0111\u0103ng b\u1EB1ng t\xE0i kho\u1EA3n GitHub c\u1EE7a b\u1EA1n, ai xem \u0111\u01B0\u1EE3c repository \u0111\u1EC1u \u0111\u1ECDc \u0111\u01B0\u1EE3c.`,
|
|
35
45
|
issueTitle: "Ti\xEAu \u0111\u1EC1",
|
|
46
|
+
lessonCurate: (agent, changes) => `${agent} \u0111\u1EC1 xu\u1EA5t r\xE0 so\xE1t file b\xE0i h\u1ECDc. Duy\u1EC7t \u0111\u1EC3 \xE1p d\u1EE5ng c\xF9ng l\xFAc m\u1ECDi thay \u0111\u1ED5i d\u01B0\u1EDBi \u0111\xE2y; kh\xF4ng thay \u0111\u1ED5i g\xEC kh\xE1c.
|
|
47
|
+
|
|
48
|
+
${changes}`,
|
|
49
|
+
lessonRemove: "B\u1ECF",
|
|
50
|
+
lessonAdd: "Th\xEAm",
|
|
51
|
+
lessonScope: (scope, file) => `${scope === "user" ? "B\xE0i h\u1ECDc c\u1EE7a ng\u01B0\u1EDDi d\xF9ng" : "B\xE0i h\u1ECDc c\u1EE7a project"} (${file})`,
|
|
36
52
|
issueLabels: "Nh\xE3n",
|
|
37
53
|
trust: (project, names) => `C\xE1c hook c\u1EE7a project n\xE0y ch\u1EA1y l\u1EC7nh shell t\u1EEB ${project} tr\xEAn m\xE1y c\u1EE7a b\u1EA1n: ${names}. Tin c\u1EADy c\xE1c hook c\u1EE7a workspace n\xE0y? ALP ch\u1EC9 h\u1ECFi m\u1ED9t l\u1EA7n: khi b\u1EA1n \u0111\u1ED3ng \xFD, c\xE1c hook ch\u1EA1y m\xE0 kh\xF4ng h\u1ECFi l\u1EA1i, k\u1EC3 c\u1EA3 hook th\xEAm ho\u1EB7c s\u1EEDa sau n\xE0y.`,
|
|
38
54
|
trustYes: "Tin c\u1EADy workspace n\xE0y",
|
|
@@ -43,9 +59,13 @@ ${lessons.map((lesson) => `- ${lesson}`).join("\n")}` : ""),
|
|
|
43
59
|
permission: (agent, what, byRule, profile, mode, always) => `${agent} mu\u1ED1n ${viWhat(what)}. ` + (byRule ? `H\u1ED3 s\u01A1 quy\u1EC1n ${profile} c\u1EE7a n\xF3 y\xEAu c\u1EA7u h\u1ECFi b\u1EA1n m\u1ED7i l\u1EA7n.` : `Ch\u1EBF \u0111\u1ED9 ${mode} c\u1EE7a n\xF3 kh\xF4ng cho ph\xE9p vi\u1EC7c n\xE0y.`) + (always ? ` Lu\xF4n cho ph\xE9p s\u1EBD th\xEAm ${always} v\xE0o h\u1ED3 s\u01A1 ${profile}.` : ""),
|
|
44
60
|
limitReached: (runtime, resetsAt, other, autoResume, kind) => `${runtime} \u0111\xE3 h\u1EBFt h\u1EA1n m\u1EE9c s\u1EED d\u1EE5ng${resetsAt ? `; h\u1EA1n m\u1EE9c \u0111\u1EB7t l\u1EA1i l\xFAc ${resetsAt}` : ""}. ALP t\u1EA1m d\u1EEBng giao vi\u1EC7c cho c\xE1c agent ${runtime} v\xE0 t\u1EA1m gi\u1EEF vi\u1EC7c c\u1EE7a ch\xFAng${other ? `; c\xE1c agent ${other} v\u1EABn l\xE0m ti\u1EBFp` : ""}. ${autoResume ? `ALP h\u1ECFi ${runtime} m\u1ED7i ph\xFAt v\xE0 t\u1EF1 ch\u1EA1y l\u1EA1i ngay khi c\xF3 h\u1EA1n m\u1EE9c.` : `ALP h\u1ECFi ${runtime} m\u1ED7i ph\xFAt v\xE0 b\xE1o khi c\xF3 h\u1EA1n m\u1EE9c tr\u1EDF l\u1EA1i; khi \u0111\xF3 ch\u1EA1y alp resume ${kind}.`}`,
|
|
45
61
|
limitLifted: (runtime, kind) => `${runtime} b\xE1o \u0111\xE3 c\xF3 h\u1EA1n m\u1EE9c tr\u1EDF l\u1EA1i. Ch\u1EA1y alp resume ${kind} \u0111\u1EC3 l\xE0m ti\u1EBFp vi\u1EC7c c\u1EE7a n\xF3.`,
|
|
62
|
+
compacted: (native) => `Context c\u1EE7a main \u0111\xE3 \u0111\u01B0\u1EE3c compact${native ? "" : " sang m\u1ED9t cu\u1ED9c h\u1ED9i tho\u1EA1i m\u1EDBi"}; main gi\u1EEF checkpoint v\xE0 l\xE0m ti\u1EBFp.`,
|
|
63
|
+
compactFailed: (reason) => `Compact context c\u1EE7a main th\u1EA5t b\u1EA1i (${reason}); ALP s\u1EBD th\u1EED l\u1EA1i sau.`,
|
|
46
64
|
usageWarning: (runtime, used, resetsAt) => `${runtime} \u0111\xE3 d\xF9ng ${used} h\u1EA1n m\u1EE9c c\u1EE7a k\u1EF3 n\xE0y${resetsAt ? `, k\u1EF3 \u0111\u1EB7t l\u1EA1i l\xFAc ${resetsAt}` : ""}.`,
|
|
47
65
|
inDevelopment: "T\xEDnh n\u0103ng \u0111ang ph\xE1t tri\u1EC3n",
|
|
48
66
|
resumed: (what, by, parked) => `${what} \u0111\xE3 ch\u1EA1y l\u1EA1i, b\u1EDFi ${by}.${parked ? " C\xE1c vi\u1EC7c \u0111ang t\u1EA1m gi\u1EEF \u0111\u01B0\u1EE3c l\xE0m ti\u1EBFp." : ""}`,
|
|
67
|
+
diskFull: (reason) => `\u0110\u0129a \u0111\u1EA7y: ${reason === "the disk is full" ? "\u0111\u0129a h\u1EBFt dung l\u01B0\u1EE3ng" : reason === "the disk is read-only" ? "\u0111\u0129a ch\u1EC9 \u0111\u1ECDc" : reason}. ALP \u0111\xE3 t\u1EA1m d\u1EEBng c\xF4ng vi\u1EC7c v\xE0 t\u1EA1m gi\u1EEF c\xE1c vi\u1EC7c \u0111ang ch\u1EA1y; ALP v\u1EABn tr\u1EA3 l\u1EDDi. H\xE3y gi\u1EA3i ph\xF3ng dung l\u01B0\u1EE3ng (alp doctor li\u1EC7t k\xEA c\xE1c worktree c\xF2n s\xF3t); ALP ki\u1EC3m tra m\u1ED7i ph\xFAt v\xE0 t\u1EF1 l\xE0m ti\u1EBFp, ho\u1EB7c ch\u1EA1y alp resume.`,
|
|
68
|
+
diskLow: (free) => `\u0110\u0129a s\u1EAFp \u0111\u1EA7y: c\xF2n ${free} tr\u1ED1ng. H\xE3y gi\u1EA3i ph\xF3ng dung l\u01B0\u1EE3ng tr\u01B0\u1EDBc khi \u0111\u1EA7y (alp doctor li\u1EC7t k\xEA c\xE1c worktree c\xF2n s\xF3t); khi \u0111\u0129a \u0111\u1EA7y, ALP s\u1EBD t\u1EA1m d\u1EEBng c\xF4ng vi\u1EC7c.`,
|
|
49
69
|
paused: (what, reason, runtime, now) => `${what} \u0111\xE3 b\u1ECB ng\u01B0\u1EDDi d\xF9ng t\u1EA1m d\u1EEBng${reason ? `: ${reason}` : ""}. Vi\u1EC7c giao${runtime ? ` cho c\xE1c agent ${runtime}` : ""} ph\u1EA3i ch\u1EDD${now ? ", c\xE1c vi\u1EC7c \u0111ang ch\u1EA1y \u0111\u01B0\u1EE3c t\u1EA1m gi\u1EEF t\u1EA1i ch\u1ED7" : "; c\xE1c l\u01B0\u1EE3t \u0111ang ch\u1EA1y v\u1EABn ch\u1EA1y h\u1EBFt"}. Ch\u1EA1y alp resume \u0111\u1EC3 ti\u1EBFp t\u1EE5c.`
|
|
50
70
|
};
|
|
51
71
|
function words(language) {
|