iosm-cli 0.2.10 → 0.2.11
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 +34 -0
- package/README.md +11 -2
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +123 -49
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/background-processes.d.ts +31 -0
- package/dist/core/background-processes.d.ts.map +1 -0
- package/dist/core/background-processes.js +241 -0
- package/dist/core/background-processes.js.map +1 -0
- package/dist/core/bash-executor.d.ts +6 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +19 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +23 -4
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/mcp/runtime.d.ts.map +1 -1
- package/dist/core/mcp/runtime.js +2 -0
- package/dist/core/mcp/runtime.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +2 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +30 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +17 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +29 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagents.d.ts +10 -2
- package/dist/core/subagents.d.ts.map +1 -1
- package/dist/core/subagents.js +66 -17
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/system-prompt.d.ts +25 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +146 -14
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +28 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/permissions.d.ts +3 -0
- package/dist/core/tools/permissions.d.ts.map +1 -1
- package/dist/core/tools/permissions.js.map +1 -1
- package/dist/core/tools/task.d.ts +3 -1
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +48 -23
- package/dist/core/tools/task.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +93 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +252 -24
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +5 -0
- package/docs/configuration.md +57 -1
- package/docs/development-and-testing.md +3 -2
- package/docs/extensions-packages-themes.md +27 -0
- package/docs/interactive-mode.md +3 -0
- package/docs/orchestration-and-subagents.md +16 -0
- package/docs/rpc-json-sdk.md +14 -0
- package/docs/sessions-traces-export.md +7 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import type { AgentTool } from "@mariozechner/pi-agent-core";
|
|
|
2
2
|
import { type Static } from "@sinclair/typebox";
|
|
3
3
|
import { type FailureCause } from "../failure-retrospective.js";
|
|
4
4
|
import { type SharedMemoryContext } from "../shared-memory.js";
|
|
5
|
-
import type
|
|
5
|
+
import { type CustomSubagentDefinition } from "../subagents.js";
|
|
6
6
|
/**
|
|
7
7
|
* Callback type passed in from sdk.ts to avoid circular imports.
|
|
8
8
|
* Spawns a sub-session and runs it to completion, returning the final text output.
|
|
@@ -113,6 +113,8 @@ export interface TaskToolOptions {
|
|
|
113
113
|
name: string;
|
|
114
114
|
description: string;
|
|
115
115
|
}>;
|
|
116
|
+
/** Returns currently known runtime tool names (built-ins + extensions) for subagent tool normalization. */
|
|
117
|
+
getAvailableToolNames?: () => readonly string[];
|
|
116
118
|
/** Returns pending live meta updates entered during an active run. */
|
|
117
119
|
getMetaMessages?: () => readonly string[];
|
|
118
120
|
/** Active profile of the host session that is invoking the task tool (static fallback). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/core/tools/task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EAEN,KAAK,mBAAmB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/core/tools/task.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EAEN,KAAK,mBAAmB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkD,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhH;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QACP,gBAAgB,EAAE,MAAM,CA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|
import { MAX_ORCHESTRATION_AGENTS, MAX_ORCHESTRATION_PARALLEL, MAX_SUBAGENT_DELEGATE_PARALLEL, MAX_SUBAGENT_DELEGATION_DEPTH, MAX_SUBAGENT_DELEGATIONS_PER_TASK, } from "../orchestration-limits.js";
|
|
8
8
|
import { AGENT_PROFILES, isReadOnlyProfileName, isValidProfileName, } from "../agent-profiles.js";
|
|
9
9
|
import { readSharedMemory, summarizeSharedMemoryUsage, writeSharedMemory, } from "../shared-memory.js";
|
|
10
|
+
import { normalizeAndFilterToolNames, normalizeToolName } from "../subagents.js";
|
|
10
11
|
const taskSchema = Type.Object({
|
|
11
12
|
description: Type.Optional(Type.String({
|
|
12
13
|
description: "Optional short 3-5 word description of what the subagent will do. If omitted, it is derived from prompt.",
|
|
@@ -74,6 +75,31 @@ const backgroundUnsafeTools = new Set(writeCapableTools);
|
|
|
74
75
|
const writeCapableProfiles = new Set(Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].some((tool) => writeCapableTools.has(tool))));
|
|
75
76
|
const backgroundSafeProfiles = Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].every((tool) => !backgroundUnsafeTools.has(tool)));
|
|
76
77
|
const delegationTagName = "delegate_task";
|
|
78
|
+
function resolveKnownRuntimeToolNames(options) {
|
|
79
|
+
const known = new Set();
|
|
80
|
+
for (const profileTools of Object.values(toolsByProfile)) {
|
|
81
|
+
for (const tool of profileTools)
|
|
82
|
+
known.add(normalizeToolName(tool));
|
|
83
|
+
}
|
|
84
|
+
const runtimeTools = options?.getAvailableToolNames?.() ?? [];
|
|
85
|
+
for (const tool of runtimeTools) {
|
|
86
|
+
const normalized = normalizeToolName(tool);
|
|
87
|
+
if (normalized)
|
|
88
|
+
known.add(normalized);
|
|
89
|
+
}
|
|
90
|
+
return known;
|
|
91
|
+
}
|
|
92
|
+
function resolveEffectiveToolset(input) {
|
|
93
|
+
const normalizedFallback = normalizeAndFilterToolNames(input.fallbackTools, input.knownToolNames).normalized;
|
|
94
|
+
const normalizedTools = input.tools
|
|
95
|
+
? normalizeAndFilterToolNames(input.tools, input.knownToolNames).normalized
|
|
96
|
+
: normalizedFallback;
|
|
97
|
+
const normalizedDisallowed = normalizeAndFilterToolNames(input.disallowedTools, input.knownToolNames).normalized;
|
|
98
|
+
if (normalizedDisallowed.length === 0)
|
|
99
|
+
return normalizedTools;
|
|
100
|
+
const blocked = new Set(normalizedDisallowed);
|
|
101
|
+
return normalizedTools.filter((tool) => !blocked.has(tool));
|
|
102
|
+
}
|
|
77
103
|
class Semaphore {
|
|
78
104
|
constructor(limit) {
|
|
79
105
|
this.limit = limit;
|
|
@@ -1092,13 +1118,13 @@ export function createTaskTool(cwd, runner, options) {
|
|
|
1092
1118
|
throw new Error(`Invalid resolved profile "${effectiveProfileCandidate}". Valid profiles: ${Object.keys(toolsByProfile).join(", ")}.`);
|
|
1093
1119
|
}
|
|
1094
1120
|
const effectiveProfile = effectiveProfileCandidate;
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
:
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1121
|
+
const knownRuntimeToolNames = resolveKnownRuntimeToolNames(options);
|
|
1122
|
+
const tools = resolveEffectiveToolset({
|
|
1123
|
+
tools: customSubagent?.tools,
|
|
1124
|
+
disallowedTools: customSubagent?.disallowedTools,
|
|
1125
|
+
fallbackTools: toolsByProfile[effectiveProfile],
|
|
1126
|
+
knownToolNames: knownRuntimeToolNames,
|
|
1127
|
+
});
|
|
1102
1128
|
if (isReadOnlyProfileName(normalizedHostProfile) && tools.some((tool) => writeCapableTools.has(tool))) {
|
|
1103
1129
|
throw new Error(`Host profile "${normalizedHostProfile}" is read-only. Switch to full/meta/iosm to launch write-capable subtasks.`);
|
|
1104
1130
|
}
|
|
@@ -1134,9 +1160,10 @@ export function createTaskTool(cwd, runner, options) {
|
|
|
1134
1160
|
const minDelegationsPreferred = (effectiveDelegateParallelHint ?? 0) >= 2 && effectiveMaxDelegations >= 2
|
|
1135
1161
|
? Math.min(preferredDelegationFloor, effectiveMaxDelegations, effectiveDelegateParallelHint ?? preferredDelegationFloor)
|
|
1136
1162
|
: 0;
|
|
1137
|
-
const
|
|
1163
|
+
const runtimeCapabilityHints = "Runtime capability: for long-running shell commands that should not block the turn, use bash with run_in_background=true; keep foreground mode when immediate command output is required.";
|
|
1164
|
+
const baseSystemPrompt = withSubagentInstructions(`${customSubagent?.systemPrompt ??
|
|
1138
1165
|
systemPromptByProfile[effectiveProfile] ??
|
|
1139
|
-
systemPromptByProfile.full
|
|
1166
|
+
systemPromptByProfile.full}\n\n${runtimeCapabilityHints}`, customSubagent?.instructions);
|
|
1140
1167
|
const systemPrompt = withDelegationPrompt(baseSystemPrompt, effectiveDelegationDepth, effectiveMaxDelegations, minDelegationsPreferred);
|
|
1141
1168
|
const promptWithInstructions = prompt;
|
|
1142
1169
|
const effectiveModelOverride = requestedModel?.trim() || customSubagent?.model?.trim() || undefined;
|
|
@@ -1772,13 +1799,12 @@ export function createTaskTool(cwd, runner, options) {
|
|
|
1772
1799
|
const nestedProfileLabel = nestedCustomSubagent?.name
|
|
1773
1800
|
? `${nestedCustomSubagent.name}/${nestedProfile}`
|
|
1774
1801
|
: nestedProfile;
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
:
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1802
|
+
const nestedTools = resolveEffectiveToolset({
|
|
1803
|
+
tools: nestedCustomSubagent?.tools,
|
|
1804
|
+
disallowedTools: nestedCustomSubagent?.disallowedTools,
|
|
1805
|
+
fallbackTools: toolsByProfile[nestedProfile],
|
|
1806
|
+
knownToolNames: knownRuntimeToolNames,
|
|
1807
|
+
});
|
|
1782
1808
|
const nestedBaseSystemPrompt = withSubagentInstructions(nestedCustomSubagent?.systemPrompt ??
|
|
1783
1809
|
systemPromptByProfile[nestedProfile] ??
|
|
1784
1810
|
systemPromptByProfile.full, nestedCustomSubagent?.instructions);
|
|
@@ -1986,13 +2012,12 @@ export function createTaskTool(cwd, runner, options) {
|
|
|
1986
2012
|
delegateProfile: childProfileLabel,
|
|
1987
2013
|
delegateItems,
|
|
1988
2014
|
});
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
:
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
}
|
|
2015
|
+
const childTools = resolveEffectiveToolset({
|
|
2016
|
+
tools: childCustomSubagent?.tools,
|
|
2017
|
+
disallowedTools: childCustomSubagent?.disallowedTools,
|
|
2018
|
+
fallbackTools: toolsByProfile[childProfile],
|
|
2019
|
+
knownToolNames: knownRuntimeToolNames,
|
|
2020
|
+
});
|
|
1996
2021
|
const childBaseSystemPrompt = withSubagentInstructions(childCustomSubagent?.systemPrompt ??
|
|
1997
2022
|
systemPromptByProfile[childProfile] ??
|
|
1998
2023
|
systemPromptByProfile.full, childCustomSubagent?.instructions);
|