iosm-cli 0.2.3 → 0.2.5
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 +56 -0
- package/README.md +43 -10
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-profiles.d.ts +2 -1
- package/dist/core/agent-profiles.d.ts.map +1 -1
- package/dist/core/agent-profiles.js +18 -5
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-session.d.ts +7 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +64 -15
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/agent-teams.d.ts.map +1 -1
- package/dist/core/agent-teams.js +90 -19
- package/dist/core/agent-teams.js.map +1 -1
- package/dist/core/extensions/types.d.ts +1 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +6 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +9 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/orchestration-limits.d.ts +6 -0
- package/dist/core/orchestration-limits.d.ts.map +1 -0
- package/dist/core/orchestration-limits.js +6 -0
- package/dist/core/orchestration-limits.js.map +1 -0
- package/dist/core/parallel-task-agent.d.ts +23 -1
- package/dist/core/parallel-task-agent.d.ts.map +1 -1
- package/dist/core/parallel-task-agent.js +110 -20
- package/dist/core/parallel-task-agent.js.map +1 -1
- package/dist/core/sdk.d.ts +6 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +34 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/shared-memory.d.ts +2 -2
- package/dist/core/shared-memory.d.ts.map +1 -1
- package/dist/core/shared-memory.js +220 -91
- package/dist/core/shared-memory.js.map +1 -1
- package/dist/core/singular.d.ts.map +1 -1
- package/dist/core/singular.js +3 -1
- package/dist/core/singular.js.map +1 -1
- package/dist/core/subagents.d.ts +1 -1
- package/dist/core/subagents.d.ts.map +1 -1
- package/dist/core/subagents.js +32 -10
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/swarm/planner.d.ts.map +1 -1
- package/dist/core/swarm/planner.js +200 -12
- package/dist/core/swarm/planner.js.map +1 -1
- package/dist/core/swarm/scheduler.d.ts +2 -0
- package/dist/core/swarm/scheduler.d.ts.map +1 -1
- package/dist/core/swarm/scheduler.js +87 -6
- package/dist/core/swarm/scheduler.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +1 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/ast-grep.d.ts.map +1 -1
- package/dist/core/tools/ast-grep.js +2 -0
- package/dist/core/tools/ast-grep.js.map +1 -1
- package/dist/core/tools/edit.d.ts +8 -4
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +18 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +9 -7
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/shared-memory.d.ts.map +1 -1
- package/dist/core/tools/shared-memory.js +34 -6
- package/dist/core/tools/shared-memory.js.map +1 -1
- package/dist/core/tools/task.d.ts +10 -3
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +830 -184
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/todo.d.ts +10 -10
- package/dist/core/tools/todo.d.ts.map +1 -1
- package/dist/core/tools/todo.js +135 -17
- package/dist/core/tools/todo.js.map +1 -1
- package/dist/core/tools/yq.d.ts.map +1 -1
- package/dist/core/tools/yq.js +2 -0
- package/dist/core/tools/yq.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +10 -9
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +22 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +957 -75
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/cli-reference.md +8 -0
- package/docs/configuration.md +5 -1
- package/docs/interactive-mode.md +7 -1
- package/docs/orchestration-and-subagents.md +5 -0
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ import { expandPromptTemplate } from "./prompt-templates.js";
|
|
|
31
31
|
import { getLatestCompactionEntry } from "./session-manager.js";
|
|
32
32
|
import { BUILTIN_SLASH_COMMANDS } from "./slash-commands.js";
|
|
33
33
|
import { buildSystemPrompt } from "./system-prompt.js";
|
|
34
|
+
import { isReadOnlyProfileName } from "./agent-profiles.js";
|
|
34
35
|
import { applyPostToolUseHooks, applyPreToolUseHooks, applyStopHooks, applyUserPromptSubmitHooks, emptyHooksConfig, } from "./hooks.js";
|
|
35
36
|
import { extractTaskPlanFromAssistantMessage, formatTaskPlanMessageContent, taskPlanSignature, TASK_PLAN_CUSTOM_TYPE, } from "./task-plan.js";
|
|
36
37
|
import { createAllTools } from "./tools/index.js";
|
|
@@ -59,8 +60,8 @@ function parseOrchestrateBlock(text) {
|
|
|
59
60
|
const attrs = match[1] ?? "";
|
|
60
61
|
const body = (match[2] ?? "").trim();
|
|
61
62
|
const readAttr = (name) => {
|
|
62
|
-
const attrMatch = attrs.match(new RegExp(`${name}
|
|
63
|
-
return attrMatch?.[1]?.trim();
|
|
63
|
+
const attrMatch = attrs.match(new RegExp(`${name}\\s*=\\s*(?:"([^"]+)"|'([^']+)')`, "i"));
|
|
64
|
+
return (attrMatch?.[1] ?? attrMatch?.[2])?.trim();
|
|
64
65
|
};
|
|
65
66
|
const mode = readAttr("mode");
|
|
66
67
|
const agentsRaw = readAttr("agents");
|
|
@@ -115,6 +116,32 @@ function buildSubagentOrchestrationDirective(text) {
|
|
|
115
116
|
}
|
|
116
117
|
return undefined;
|
|
117
118
|
}
|
|
119
|
+
function buildMetaProfileOrchestrationDirective(text) {
|
|
120
|
+
if (parseOrchestrateBlock(text)) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return [
|
|
124
|
+
"[META_ORCHESTRATION_DIRECTIVE]",
|
|
125
|
+
"Session profile is meta. The main/root agent remains the orchestrator for this request.",
|
|
126
|
+
"First classify the user request.",
|
|
127
|
+
"If the request is conversational or non-repository (for example: quick Q&A, opinion, preference, explanation, rewrite, translation, casual chat), DO NOT orchestrate and DO NOT call `task`.",
|
|
128
|
+
"For non-repository requests, answer directly as a normal chat assistant in the user's language.",
|
|
129
|
+
"For non-repository requests, do not run tools, do not inspect repository files, and do not perform reconnaissance unless the user explicitly asks for it.",
|
|
130
|
+
"Do not output internal reasoning, classification notes, or status preambles (for example: 'The user is asking...' or 'Let me analyze...'). Return only the final user-facing answer.",
|
|
131
|
+
"Only apply the orchestration rules below when the request is actionable repository work (requires reading/modifying/running/verifying workspace code or project artifacts).",
|
|
132
|
+
"For actionable repository work, keep recon bounded and read-only, just enough to identify the workstreams.",
|
|
133
|
+
"The main emphasis of meta mode is parallelism through top-level agents and nested delegates.",
|
|
134
|
+
"For any non-trivial work, the main/root agent MUST orchestrate with multiple top-level `task` calls in the parent turn when independent streams exist.",
|
|
135
|
+
"For any child workstream that still contains multiple independent slices, require nested delegation rather than letting one child do everything alone.",
|
|
136
|
+
"Do NOT collapse the whole task into one root implementation subagent.",
|
|
137
|
+
"Do NOT hand the entire job to a single write-capable specialist such as iosm_change_executor when the work can be partitioned.",
|
|
138
|
+
"Use specialist/custom agents as focused workstreams within a broader execution graph, not as the sole executor for the entire non-trivial task.",
|
|
139
|
+
"If you need clarification first, ask it concisely; once clarified, continue with orchestration.",
|
|
140
|
+
"If the user specified agent/delegate counts or parallelism constraints, treat them as hard execution requirements.",
|
|
141
|
+
"For non-trivial work where implementation, tests, verification, docs, or risk analysis can be separated, prefer 3 or more focused task calls rather than 1, and prefer additional delegate fan-out inside those tasks when it shortens the critical path safely.",
|
|
142
|
+
"If you truly cannot split the work into multiple top-level tasks or nested delegates, include one line: DELEGATION_IMPOSSIBLE: <precise reason>.",
|
|
143
|
+
].join("\n");
|
|
144
|
+
}
|
|
118
145
|
// ============================================================================
|
|
119
146
|
// Constants
|
|
120
147
|
// ============================================================================
|
|
@@ -196,6 +223,7 @@ export class AgentSession {
|
|
|
196
223
|
this._baseToolsOverride = config.baseToolsOverride;
|
|
197
224
|
this._systemPromptSuffix = config.systemPromptSuffix || undefined;
|
|
198
225
|
this._iosmAutopilotEnabled = config.iosmAutopilotEnabled !== false;
|
|
226
|
+
this._profileName = config.profileName?.trim().toLowerCase() || undefined;
|
|
199
227
|
this._toolPermissionHandler = config.toolPermissionHandler;
|
|
200
228
|
this._hooksConfig = this._resourceLoader.getHooks?.() ?? emptyHooksConfig();
|
|
201
229
|
this._refreshSessionTracePath("session_start");
|
|
@@ -211,6 +239,10 @@ export class AgentSession {
|
|
|
211
239
|
get modelRegistry() {
|
|
212
240
|
return this._modelRegistry;
|
|
213
241
|
}
|
|
242
|
+
/** Active profile name for runtime orchestration policies. */
|
|
243
|
+
get profileName() {
|
|
244
|
+
return this._profileName;
|
|
245
|
+
}
|
|
214
246
|
// =========================================================================
|
|
215
247
|
// Event Subscription
|
|
216
248
|
// =========================================================================
|
|
@@ -762,6 +794,16 @@ export class AgentSession {
|
|
|
762
794
|
current: enabled,
|
|
763
795
|
});
|
|
764
796
|
}
|
|
797
|
+
setProfileName(profileName) {
|
|
798
|
+
const previous = this._profileName;
|
|
799
|
+
const normalized = profileName?.trim().toLowerCase();
|
|
800
|
+
this._profileName = normalized && normalized.length > 0 ? normalized : undefined;
|
|
801
|
+
this._emitConfigChange({
|
|
802
|
+
key: "profile_name",
|
|
803
|
+
previous,
|
|
804
|
+
current: this._profileName,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
765
807
|
setToolPermissionHandler(handler) {
|
|
766
808
|
this._toolPermissionHandler = handler;
|
|
767
809
|
this._buildRuntime({
|
|
@@ -964,14 +1006,30 @@ export class AgentSession {
|
|
|
964
1006
|
}
|
|
965
1007
|
const orchestrationDirective = options?.skipOrchestrationDirective
|
|
966
1008
|
? undefined
|
|
967
|
-
: buildSubagentOrchestrationDirective(expandedText)
|
|
1009
|
+
: buildSubagentOrchestrationDirective(expandedText) ??
|
|
1010
|
+
(this._profileName === "meta" ? buildMetaProfileOrchestrationDirective(expandedText) : undefined);
|
|
968
1011
|
const promptText = orchestrationDirective ? `${expandedText}\n\n${orchestrationDirective}` : expandedText;
|
|
1012
|
+
const orchestrationDisplayText = orchestrationDirective
|
|
1013
|
+
? deriveOrchestrationDisplayText(expandedText) ?? expandedText
|
|
1014
|
+
: undefined;
|
|
969
1015
|
this._appendSessionTrace({
|
|
970
1016
|
type: "prompt_expanded",
|
|
971
1017
|
text: promptText,
|
|
972
1018
|
imageCount: currentImages?.length ?? 0,
|
|
973
1019
|
orchestrationInjected: orchestrationDirective !== undefined,
|
|
974
1020
|
});
|
|
1021
|
+
if (orchestrationDirective) {
|
|
1022
|
+
this._appendCustomMessageLocally({
|
|
1023
|
+
customType: INTERNAL_UI_META_CUSTOM_TYPE,
|
|
1024
|
+
content: "",
|
|
1025
|
+
display: false,
|
|
1026
|
+
details: {
|
|
1027
|
+
kind: "orchestration_context",
|
|
1028
|
+
rawPrompt: promptText,
|
|
1029
|
+
displayText: orchestrationDisplayText,
|
|
1030
|
+
},
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
975
1033
|
// If streaming, queue via steer(), followUp(), or meta() based on option
|
|
976
1034
|
if (this.isStreaming) {
|
|
977
1035
|
if (!options?.streamingBehavior) {
|
|
@@ -997,18 +1055,6 @@ export class AgentSession {
|
|
|
997
1055
|
});
|
|
998
1056
|
return;
|
|
999
1057
|
}
|
|
1000
|
-
if (orchestrationDirective) {
|
|
1001
|
-
this._appendCustomMessageLocally({
|
|
1002
|
-
customType: INTERNAL_UI_META_CUSTOM_TYPE,
|
|
1003
|
-
content: "",
|
|
1004
|
-
display: false,
|
|
1005
|
-
details: {
|
|
1006
|
-
kind: "orchestration_context",
|
|
1007
|
-
rawPrompt: promptText,
|
|
1008
|
-
displayText: deriveOrchestrationDisplayText(expandedText),
|
|
1009
|
-
},
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
1058
|
// Flush any pending bash messages before the new prompt
|
|
1013
1059
|
this._flushPendingBashMessages();
|
|
1014
1060
|
// Validate model
|
|
@@ -2517,6 +2563,9 @@ export class AgentSession {
|
|
|
2517
2563
|
* @param options.operations Custom BashOperations for remote execution
|
|
2518
2564
|
*/
|
|
2519
2565
|
async executeBash(command, onChunk, options) {
|
|
2566
|
+
if (isReadOnlyProfileName(this._profileName)) {
|
|
2567
|
+
throw new Error(`Bash execution is disabled in ${this._profileName} profile. Switch to full/meta/iosm for command execution.`);
|
|
2568
|
+
}
|
|
2520
2569
|
this._appendSessionTrace({
|
|
2521
2570
|
type: "bash_start",
|
|
2522
2571
|
command,
|