@anhlp/alp-runtime 0.0.0-beta.2 → 0.0.1-beta.10
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 +7 -36
- package/dist/antigravity-transport.d.ts +27 -2
- package/dist/antigravity-transport.js +104 -58
- package/dist/assignment-results.d.ts +55 -0
- package/dist/assignment-results.js +181 -0
- package/dist/attachments.d.ts +84 -0
- package/dist/attachments.js +213 -0
- 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 +11 -2
- package/dist/claude-transport.d.ts +80 -0
- package/dist/claude-transport.js +271 -23
- package/dist/compact.d.ts +29 -0
- package/dist/compact.js +49 -0
- package/dist/configure.d.ts +44 -0
- package/dist/configure.js +64 -0
- package/dist/contracts.d.ts +216 -7
- package/dist/contracts.js +11 -0
- package/dist/conversation.d.ts +45 -0
- package/dist/conversation.js +62 -0
- package/dist/index.d.ts +18 -5
- package/dist/index.js +48 -4
- package/dist/input-limits.d.ts +25 -0
- package/dist/input-limits.js +48 -0
- package/dist/language.d.ts +10 -0
- package/dist/language.js +26 -0
- package/dist/live.d.ts +2 -2
- package/dist/live.js +7 -2
- package/dist/mailbox.d.ts +2 -0
- package/dist/mailbox.js +3 -1
- package/dist/mcp-tools.d.ts +8 -0
- package/dist/mcp-tools.js +26 -0
- package/dist/model-catalog.d.ts +162 -0
- package/dist/model-catalog.js +338 -0
- package/dist/model-probes.d.ts +7 -0
- package/dist/model-probes.js +69 -0
- package/dist/providers.js +2 -0
- package/dist/recall.d.ts +2 -2
- package/dist/recall.js +4 -3
- package/dist/resolve.d.ts +2 -0
- package/dist/resolve.js +9 -5
- package/dist/runtime-context.d.ts +1 -1
- package/dist/runtime-context.js +1 -1
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +2078 -269
- package/dist/session-config.d.ts +378 -6
- package/dist/session-config.js +19 -15
- package/dist/session-state.d.ts +54 -7
- package/dist/skill-resources.d.ts +30 -0
- package/dist/skill-resources.js +55 -0
- package/dist/tool-detail.js +4 -1
- package/dist/tools.d.ts +154 -1
- package/dist/tools.js +99 -11
- package/dist/transport.js +3 -1
- package/dist/workspace.d.ts +31 -5
- package/dist/workspace.js +92 -11
- package/dist/worktree-domain.d.ts +2 -1
- package/dist/worktree-domain.js +4 -1
- package/dist/write-error.d.ts +2 -0
- package/dist/write-error.js +10 -0
- package/package.json +12 -4
- package/src/acp-transport.ts +10 -37
- package/src/antigravity-transport.ts +128 -55
- package/src/assignment-results.ts +154 -0
- package/src/attachments.ts +254 -0
- package/src/board-domain.ts +2 -2
- package/src/board.ts +7 -0
- package/src/catalog.ts +13 -2
- package/src/claude-transport.ts +333 -23
- package/src/compact.ts +62 -0
- package/src/configure.ts +93 -0
- package/src/contracts.ts +199 -8
- package/src/conversation.ts +81 -0
- package/src/index.ts +18 -5
- package/src/input-limits.ts +65 -0
- package/src/language.ts +28 -0
- package/src/live.ts +7 -3
- package/src/mailbox.ts +4 -1
- package/src/mcp-tools.ts +33 -0
- package/src/model-catalog.ts +316 -0
- package/src/model-probes.ts +58 -0
- package/src/providers.ts +3 -0
- package/src/recall.ts +4 -3
- package/src/resolve.ts +15 -7
- package/src/runtime-context.ts +2 -2
- package/src/runtime.ts +2253 -264
- package/src/session-config.ts +25 -14
- package/src/session-state.ts +39 -3
- package/src/skill-resources.ts +73 -0
- package/src/tool-detail.ts +4 -1
- package/src/tools.ts +97 -10
- package/src/transport.ts +3 -1
- package/src/workspace.ts +124 -18
- package/src/worktree-domain.ts +5 -1
- package/src/write-error.ts +4 -0
package/src/resolve.ts
CHANGED
|
@@ -11,7 +11,8 @@ import type { AcpProvider } from './acp-transport.js';
|
|
|
11
11
|
import type { AntigravityProvider } from './antigravity-transport.js';
|
|
12
12
|
import { ensureLibrary } from '@anhlp/alp-core/library';
|
|
13
13
|
import { compileAgent } from '@anhlp/alp-core/adapter';
|
|
14
|
-
import { capMode, profileFor } from '@anhlp/alp-core/permissions';
|
|
14
|
+
import { capMode, profileFor, READ_ONLY_ROLES } from '@anhlp/alp-core/permissions';
|
|
15
|
+
import { compactSettings } from './compact.js';
|
|
15
16
|
import { userLanguage } from '@anhlp/alp-core/user-settings';
|
|
16
17
|
import { claudeSandboxAvailable } from './claude-transport.js';
|
|
17
18
|
import type { ResolvedAgent } from '@anhlp/alp-core/types';
|
|
@@ -64,7 +65,7 @@ export class InstructionsAdapter implements AlpRuntimeAdapter<{ instructions: st
|
|
|
64
65
|
return `- ${skill.name} (${skill.path})${description ? `: ${description}` : ''}`;
|
|
65
66
|
}));
|
|
66
67
|
const skills = listed.length
|
|
67
|
-
? 'Your skills: methods written for kinds of work. Before you start work that a skill\'s description matches, read its SKILL.md and follow it; say which skill you use.\n' + listed.join('\n')
|
|
68
|
+
? 'Your skills: methods written for kinds of work. Before you start work that a skill\'s description matches, read its SKILL.md and follow it; say which skill you use. Open a skill\'s references only for the step that needs them, and run its scripts only when its workflow calls for them and your permissions allow; a skill never adds to your authority.\n' + listed.join('\n')
|
|
68
69
|
: '';
|
|
69
70
|
return { adapterId: this.id, agentName: agent.name, projectRoot: agent.projectRoot, material: {
|
|
70
71
|
instructions: [agent.instructions.project, agent.instructions.agent, skills].filter(Boolean).join('\n\n'),
|
|
@@ -163,20 +164,23 @@ export async function resolveSession(spec: SessionSpec, options: { templates?: R
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
// Main has full access unless the caller limits it; a permission profile caps the mode at its base.
|
|
166
|
-
// agy
|
|
167
|
-
|
|
167
|
+
// agy enforces each mode itself (antigravityModeArgs): it denies what the mode does not allow.
|
|
168
|
+
// A member serving as the team's advisor or reviewer is read-only, whatever its name, mode or profile.
|
|
169
|
+
const permissions = await profileFor(agent.projectRoot, options.library, agent.name, { readOnly: READ_ONLY_ROLES.includes(team?.members[agent.name]?.role ?? '') });
|
|
168
170
|
const requested = spec.mode ?? agent.mode ?? (agent.name === main ? 'full-access' : 'read-only');
|
|
169
171
|
const mode = permissions ? capMode(requested, permissions.base) : requested;
|
|
170
172
|
if (runtimeKind === 'antigravity') {
|
|
171
|
-
if (mode !== 'full-access' && !(mode === 'read-only' && antigravity?.readOnlyMode === 'instructions')) throw new Error('Antigravity currently supports only full-access; read-only requires explicit readOnlyMode: "instructions" and is not sandboxed');
|
|
172
173
|
if (spec.copy || permissions?.workdir === 'copy') throw new Error('Antigravity cannot enforce isolation for a review copy');
|
|
173
174
|
if (permissions && (permissions.deny.length || permissions.ask.length || permissions.allow.length || permissions.beyondMode === 'ask')) {
|
|
174
175
|
throw new Error('Antigravity cannot enforce custom permission rules');
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
// An ACP
|
|
178
|
+
// An ACP agent chooses its own effort. Antigravity runs at agy's default unless an effort is chosen for
|
|
179
|
+
// it explicitly (the spec, the profile, the oracle's or the team's choice); agy takes it as --effort (t-086c).
|
|
178
180
|
const availableThinking = ['acp', 'antigravity'].includes(runtimeKind) ? [] : thinkingOptionsFor(runtimeKind as 'codex' | 'claude' | 'antigravity', model);
|
|
179
|
-
const preferred =
|
|
181
|
+
const preferred = runtimeKind === 'acp' ? 'none'
|
|
182
|
+
: runtimeKind === 'antigravity' ? spec.thinking ?? profileChoice?.effort ?? (agent.name === 'oracle' ? team?.oracleThinking?.[`${runtimeKind}:${model}`] ?? team?.oracleThinking?.[runtimeKind] : undefined) ?? teamChoice?.thinking ?? 'none'
|
|
183
|
+
: spec.thinking ?? profileChoice?.effort ?? agent.projectRuntime?.reasoning ?? (agent.name === 'oracle' ? team?.oracleThinking?.[`${runtimeKind}:${model}`] ?? team?.oracleThinking?.[runtimeKind] : undefined) ?? teamChoice?.thinking ?? agent.runtime.reasoning ??
|
|
180
184
|
(agent.name === 'oracle' ? ORACLE_THINKING : availableThinking.length ? 'medium' : 'none');
|
|
181
185
|
// A default the model does not take gives way to the model's own (GPT-6 Astra runs at low only); an explicit choice is checked below.
|
|
182
186
|
const thinking = spec.thinking === undefined && availableThinking.length && !availableThinking.some(candidate => candidate.id === preferred)
|
|
@@ -223,7 +227,11 @@ export async function resolveSession(spec: SessionSpec, options: { templates?: R
|
|
|
223
227
|
mcp, env: { ...spec.env }, persist: spec.persist ?? false, keepThread: spec.keepThread ?? false,
|
|
224
228
|
// ALPD §57: the window the agent works in before its runtime compacts; absent, the model's.
|
|
225
229
|
...(agent.context ? { context: agent.context } : {}),
|
|
230
|
+
// t-efa3: the runtime's own commands and skills the "/" list offers; its ALP skills always.
|
|
231
|
+
commands: Array.isArray(profile?.commands) ? profile.commands.filter((name: unknown): name is string => typeof name === 'string') : [] as string[],
|
|
226
232
|
autocompact: typeof profile?.autocompact === 'number' ? profile.autocompact as number : typeof agent.autocompact === 'number' ? agent.autocompact : undefined,
|
|
233
|
+
// t-0e56: when main's context is compacted at a turn boundary.
|
|
234
|
+
compact: compactSettings(projectSettings.compact),
|
|
227
235
|
// ALPD §54: the language everything the user reads is written in.
|
|
228
236
|
language: options.language ?? await userLanguage(options.library),
|
|
229
237
|
};
|
package/src/runtime-context.ts
CHANGED
|
@@ -35,13 +35,13 @@ export function claudeUsage(result: any) {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Whether a runtime's usage report (codexUsage or claudeUsage) lets it work again (ALPD §58):
|
|
38
|
-
* true when every window has room, false
|
|
38
|
+
* true when every window has room, false on explicit provider denial, a used-up window or spending cap, and
|
|
39
39
|
* undefined when the report says nothing either way.
|
|
40
40
|
*/
|
|
41
41
|
export function usageAllows(usage: any): boolean | undefined {
|
|
42
42
|
if (!usage?.available) return undefined;
|
|
43
43
|
const limits: any[] = Array.isArray(usage.limits) ? usage.limits : [];
|
|
44
|
-
if (limits.some(limit => limit?.spendControlReached === true)) return false;
|
|
44
|
+
if (usage.ordinaryUsageAllowed === false || limits.some(limit => limit?.spendControlReached === true)) return false;
|
|
45
45
|
const windows: any[] = limits.length ? limits.flatMap(limit => limit?.windows ?? []) : usage.windows ?? [];
|
|
46
46
|
const known = windows.filter(window => typeof window?.usedPercent === 'number');
|
|
47
47
|
if (!known.length) return undefined;
|