apex-code 0.0.1-alpha.5 → 0.0.1-alpha.7
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 +45 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session.d.ts +17 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +46 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +15 -0
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions/gate.d.ts +7 -0
- package/dist/core/permissions/gate.d.ts.map +1 -1
- package/dist/core/permissions/gate.js.map +1 -1
- package/dist/core/permissions/startup.d.ts +12 -0
- package/dist/core/permissions/startup.d.ts.map +1 -1
- package/dist/core/permissions/startup.js +12 -4
- package/dist/core/permissions/startup.js.map +1 -1
- package/dist/core/sandbox/cli-launch.d.ts +43 -0
- package/dist/core/sandbox/cli-launch.d.ts.map +1 -1
- package/dist/core/sandbox/cli-launch.js +70 -3
- package/dist/core/sandbox/cli-launch.js.map +1 -1
- package/dist/core/sandbox/cli-supervisor.d.ts +2 -0
- package/dist/core/sandbox/cli-supervisor.d.ts.map +1 -1
- package/dist/core/sandbox/cli-supervisor.js +1 -0
- package/dist/core/sandbox/cli-supervisor.js.map +1 -1
- package/dist/core/skills.d.ts +19 -7
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +77 -19
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/index.d.ts +5 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +12 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/skill-search.d.ts +32 -0
- package/dist/core/tools/skill-search.d.ts.map +1 -0
- package/dist/core/tools/skill-search.js +56 -0
- package/dist/core/tools/skill-search.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +3 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +13 -0
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +19 -6
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +172 -89
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +13 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +96 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +64 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +2 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/docs/skills.md +54 -4
- package/npm-shrinkwrap.json +5 -5
- package/package.json +2 -2
|
@@ -34,12 +34,15 @@ import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
|
34
34
|
import { ModelRegistry } from "./model-registry.js";
|
|
35
35
|
import { evaluateToolCall } from "./permissions/gate.js";
|
|
36
36
|
import { createInteractiveResponder } from "./permissions/responder.js";
|
|
37
|
+
import { resolveEffectiveModeWithOrigin } from "./permissions/startup.js";
|
|
37
38
|
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
38
39
|
import { CURRENT_SESSION_VERSION, getLatestCompactionEntry, TODO_CUSTOM_ENTRY_TYPE, } from "./session-manager.js";
|
|
40
|
+
import { slugifySkillCommandName } from "./skills.js";
|
|
39
41
|
import { createSyntheticSourceInfo } from "./source-info.js";
|
|
40
42
|
import { buildSystemPrompt } from "./system-prompt.js";
|
|
41
43
|
import { createLocalBashOperations } from "./tools/bash.js";
|
|
42
44
|
import { createAllToolDefinitions } from "./tools/index.js";
|
|
45
|
+
import { createSkillSearchToolDefinition } from "./tools/skill-search.js";
|
|
43
46
|
import { createTodoWriteToolDefinition } from "./tools/todo-write.js";
|
|
44
47
|
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
|
45
48
|
import { createToolSchemaToolDefinition } from "./tools/tool-schema.js";
|
|
@@ -1052,9 +1055,16 @@ export class AgentSession {
|
|
|
1052
1055
|
if (!text.startsWith("/skill:"))
|
|
1053
1056
|
return text;
|
|
1054
1057
|
const spaceIndex = text.indexOf(" ");
|
|
1055
|
-
const
|
|
1058
|
+
const commandToken = spaceIndex === -1 ? text.slice(7) : text.slice(7, spaceIndex);
|
|
1056
1059
|
const args = spaceIndex === -1 ? "" : text.slice(spaceIndex + 1).trim();
|
|
1057
|
-
|
|
1060
|
+
// Matched against the slugged command token (SKILL.5), not the raw frontmatter
|
|
1061
|
+
// name -- identity for an already command-safe name, so an exactly-typed raw
|
|
1062
|
+
// name still matches too. A skill whose name contains a space or other
|
|
1063
|
+
// slash-command-breaking character (docs/skills.md's lenient loading allows
|
|
1064
|
+
// this) is only reachable through its slugged token.
|
|
1065
|
+
const skill = this.resourceLoader
|
|
1066
|
+
.getSkills()
|
|
1067
|
+
.skills.find((s) => slugifySkillCommandName(s.name) === commandToken);
|
|
1058
1068
|
if (!skill)
|
|
1059
1069
|
return text; // Unknown skill, pass through
|
|
1060
1070
|
try {
|
|
@@ -1287,6 +1297,33 @@ export class AgentSession {
|
|
|
1287
1297
|
source,
|
|
1288
1298
|
});
|
|
1289
1299
|
}
|
|
1300
|
+
/** True when this session runs behind a permission gate at all. */
|
|
1301
|
+
get hasPermissionGate() {
|
|
1302
|
+
return this._permissionGate !== undefined;
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* The mode in force right now, and which source won. `getMode` in the gate
|
|
1306
|
+
* config re-reads the store on every decision, so a mode written here applies
|
|
1307
|
+
* to the next tool call with no restart.
|
|
1308
|
+
*/
|
|
1309
|
+
async getPermissionMode() {
|
|
1310
|
+
if (!this._permissionGate)
|
|
1311
|
+
return undefined;
|
|
1312
|
+
const snapshot = await this._permissionGate.store.snapshot();
|
|
1313
|
+
return resolveEffectiveModeWithOrigin(this._permissionGate.flagMode, snapshot.modesBySource);
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Persist a permission mode to user scope (`~/.apex-code/agent/permissions.json`).
|
|
1317
|
+
* Returns the resolution that is actually in force afterwards, which is *not*
|
|
1318
|
+
* necessarily `mode`: `flag`, `local`, and `project` all outrank `user`, so the
|
|
1319
|
+
* caller has to be able to tell the user their choice was recorded but shadowed.
|
|
1320
|
+
*/
|
|
1321
|
+
async setPermissionMode(mode) {
|
|
1322
|
+
if (!this._permissionGate)
|
|
1323
|
+
return undefined;
|
|
1324
|
+
await this._permissionGate.store.apply({ type: "setMode", destination: "user", mode });
|
|
1325
|
+
return this.getPermissionMode();
|
|
1326
|
+
}
|
|
1290
1327
|
/**
|
|
1291
1328
|
* Set model directly.
|
|
1292
1329
|
* Validates that auth is configured, saves to session and settings.
|
|
@@ -1933,7 +1970,7 @@ export class AgentSession {
|
|
|
1933
1970
|
sourceInfo: template.sourceInfo,
|
|
1934
1971
|
}));
|
|
1935
1972
|
const skills = this._resourceLoader.getSkills().skills.map((skill) => ({
|
|
1936
|
-
name: `skill:${skill.name}`,
|
|
1973
|
+
name: `skill:${slugifySkillCommandName(skill.name)}`,
|
|
1937
1974
|
description: skill.description,
|
|
1938
1975
|
source: "skill",
|
|
1939
1976
|
sourceInfo: skill.sourceInfo,
|
|
@@ -2152,6 +2189,12 @@ export class AgentSession {
|
|
|
2152
2189
|
this.sessionManager.appendCustomEntry(TODO_CUSTOM_ENTRY_TYPE, todos);
|
|
2153
2190
|
},
|
|
2154
2191
|
});
|
|
2192
|
+
// Reads the resource loader live on every call (not a snapshot taken here), so
|
|
2193
|
+
// a project-trust change or a settings reload that alters the loaded skill set
|
|
2194
|
+
// is reflected on the next search without rebuilding the tool registry.
|
|
2195
|
+
baseToolDefinitions.skill_search = createSkillSearchToolDefinition({
|
|
2196
|
+
getSkills: () => this.resourceLoader.getSkills().skills,
|
|
2197
|
+
});
|
|
2155
2198
|
this._baseToolDefinitions = new Map(Object.entries(baseToolDefinitions).map(([name, tool]) => [name, tool]));
|
|
2156
2199
|
const extensionsResult = this._resourceLoader.getExtensions();
|
|
2157
2200
|
if (options.flagValues) {
|