@atlasharness/atlascode 0.1.55 → 0.1.56
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/cli.js +103 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -28065,6 +28065,10 @@ async function executeToolUse(tu, assistantMsg, deps) {
|
|
|
28065
28065
|
toolUseResult = errorText;
|
|
28066
28066
|
}
|
|
28067
28067
|
const postOutcome = await deps.hooks?.postToolUse?.(tool, callInput, block, tu.id);
|
|
28068
|
+
if (postOutcome?.updatedToolOutput !== undefined) {
|
|
28069
|
+
block = { ...block, content: postOutcome.updatedToolOutput };
|
|
28070
|
+
toolUseResult = postOutcome.updatedToolOutput;
|
|
28071
|
+
}
|
|
28068
28072
|
return { block, isError, toolUseResult };
|
|
28069
28073
|
}
|
|
28070
28074
|
var init_toolExecution = () => {};
|
|
@@ -28154,7 +28158,9 @@ var init_hookEvents = __esm(() => {
|
|
|
28154
28158
|
"WorktreeRemove",
|
|
28155
28159
|
"InstructionsLoaded",
|
|
28156
28160
|
"CwdChanged",
|
|
28157
|
-
"FileChanged"
|
|
28161
|
+
"FileChanged",
|
|
28162
|
+
"PreModelSwitch",
|
|
28163
|
+
"PostModelSwitch"
|
|
28158
28164
|
];
|
|
28159
28165
|
});
|
|
28160
28166
|
|
|
@@ -28298,6 +28304,10 @@ async function getMatchingHooks(hookEvent, hookInput) {
|
|
|
28298
28304
|
case "FileChanged":
|
|
28299
28305
|
matchQuery = basenameOf(hookInput.file_path);
|
|
28300
28306
|
break;
|
|
28307
|
+
case "PreModelSwitch":
|
|
28308
|
+
case "PostModelSwitch":
|
|
28309
|
+
matchQuery = hookInput.new_model;
|
|
28310
|
+
break;
|
|
28301
28311
|
default:
|
|
28302
28312
|
break;
|
|
28303
28313
|
}
|
|
@@ -28403,6 +28413,10 @@ function interpretHookOutput(p) {
|
|
|
28403
28413
|
result.updatedInput = specific.updatedInput;
|
|
28404
28414
|
if (json.updatedInput)
|
|
28405
28415
|
result.updatedInput = json.updatedInput;
|
|
28416
|
+
if (specific?.updatedToolOutput)
|
|
28417
|
+
result.updatedToolOutput = specific.updatedToolOutput;
|
|
28418
|
+
if (json.updatedToolOutput)
|
|
28419
|
+
result.updatedToolOutput = json.updatedToolOutput;
|
|
28406
28420
|
if (json.suppressOutput)
|
|
28407
28421
|
result.output = "";
|
|
28408
28422
|
if (json.systemMessage)
|
|
@@ -28430,6 +28444,8 @@ ${r.additionalContext}` : r.additionalContext;
|
|
|
28430
28444
|
}
|
|
28431
28445
|
if (r.updatedInput)
|
|
28432
28446
|
acc.updatedInput = r.updatedInput;
|
|
28447
|
+
if (r.updatedToolOutput)
|
|
28448
|
+
acc.updatedToolOutput = r.updatedToolOutput;
|
|
28433
28449
|
if (r.permissionBehavior) {
|
|
28434
28450
|
if (!acc.permissionBehavior || PERMISSION_RANK[r.permissionBehavior] > PERMISSION_RANK[acc.permissionBehavior]) {
|
|
28435
28451
|
acc.permissionBehavior = r.permissionBehavior;
|
|
@@ -81751,7 +81767,8 @@ function createToolHooks(opts = {}) {
|
|
|
81751
81767
|
postToolUse: async (tool, input, block, toolUseId) => {
|
|
81752
81768
|
const r = await runPostToolUseHooks(tool.name, input, block, toolUseId, { ...base, toolUseID: toolUseId });
|
|
81753
81769
|
const outcome = {
|
|
81754
|
-
additionalContext: r.additionalContext
|
|
81770
|
+
additionalContext: r.additionalContext,
|
|
81771
|
+
updatedToolOutput: r.updatedToolOutput
|
|
81755
81772
|
};
|
|
81756
81773
|
return outcome;
|
|
81757
81774
|
}
|
|
@@ -165482,7 +165499,7 @@ var init_addDirPluginSettings = __esm(() => {
|
|
|
165482
165499
|
});
|
|
165483
165500
|
|
|
165484
165501
|
// src/tui/entrypoints/sdk/coreSchemas.ts
|
|
165485
|
-
var ModelUsageSchema, OutputFormatTypeSchema, BaseOutputFormatSchema, JsonSchemaOutputFormatSchema, OutputFormatSchema, ApiKeySourceSchema, ConfigScopeSchema2, SdkBetaSchema, ThinkingAdaptiveSchema, ThinkingEnabledSchema, ThinkingDisabledSchema, ThinkingConfigSchema, McpStdioServerConfigSchema2, McpSSEServerConfigSchema2, McpHttpServerConfigSchema, McpSdkServerConfigSchema, McpServerConfigForProcessTransportSchema, McpClaudeAIProxyServerConfigSchema, McpServerStatusConfigSchema, McpServerStatusSchema, McpSetServersResultSchema, PermissionUpdateDestinationSchema, PermissionBehaviorSchema, PreToolUsePermissionDecisionSchema, PermissionRuleValueSchema, PermissionUpdateSchema, PermissionDecisionClassificationSchema, PermissionResultSchema, PermissionModeSchema2, HOOK_EVENTS2, HookEventSchema, BaseHookInputSchema, PreToolUseHookInputSchema, PermissionRequestHookInputSchema, PostToolUseHookInputSchema, PostToolUseFailureHookInputSchema, PermissionDeniedHookInputSchema, NotificationHookInputSchema, UserPromptSubmitHookInputSchema, SessionStartHookInputSchema, SetupHookInputSchema, StopHookInputSchema, StopFailureHookInputSchema, SubagentStartHookInputSchema, SubagentStopHookInputSchema, PreCompactHookInputSchema, PostCompactHookInputSchema, TeammateIdleHookInputSchema, TaskCreatedHookInputSchema, TaskCompletedHookInputSchema, ElicitationHookInputSchema, ElicitationResultHookInputSchema, CONFIG_CHANGE_SOURCES, ConfigChangeHookInputSchema, INSTRUCTIONS_LOAD_REASONS, INSTRUCTIONS_MEMORY_TYPES, InstructionsLoadedHookInputSchema, WorktreeCreateHookInputSchema, WorktreeRemoveHookInputSchema, CwdChangedHookInputSchema, FileChangedHookInputSchema, EXIT_REASONS, ExitReasonSchema, SessionEndHookInputSchema, HookInputSchema, AsyncHookJSONOutputSchema, PreToolUseHookSpecificOutputSchema, UserPromptSubmitHookSpecificOutputSchema, SessionStartHookSpecificOutputSchema, SetupHookSpecificOutputSchema, SubagentStartHookSpecificOutputSchema, PostToolUseHookSpecificOutputSchema, PostToolUseFailureHookSpecificOutputSchema, PermissionDeniedHookSpecificOutputSchema, NotificationHookSpecificOutputSchema, PermissionRequestHookSpecificOutputSchema, CwdChangedHookSpecificOutputSchema, FileChangedHookSpecificOutputSchema, SyncHookJSONOutputSchema, ElicitationHookSpecificOutputSchema, ElicitationResultHookSpecificOutputSchema, WorktreeCreateHookSpecificOutputSchema, HookJSONOutputSchema, PromptRequestOptionSchema, PromptRequestSchema, PromptResponseSchema, SlashCommandSchema, AgentInfoSchema, ModelInfoSchema, AccountInfoSchema, AgentMcpServerSpecSchema, AgentDefinitionSchema, SettingSourceSchema, SdkPluginConfigSchema, RewindFilesResultSchema, APIUserMessagePlaceholder, APIAssistantMessagePlaceholder, RawMessageStreamEventPlaceholder, UUIDPlaceholder, NonNullableUsagePlaceholder, SDKAssistantMessageErrorSchema, SDKStatusSchema, SDKUserMessageContentSchema, SDKUserMessageSchema, SDKUserMessageReplaySchema, SDKRateLimitInfoSchema, SDKAssistantMessageSchema, SDKRateLimitEventSchema, SDKStreamlinedTextMessageSchema, SDKStreamlinedToolUseSummaryMessageSchema, SDKPermissionDenialSchema, SDKResultSuccessSchema, SDKResultErrorSchema, SDKResultMessageSchema, SDKSystemMessageSchema, SDKPartialAssistantMessageSchema, SDKCompactBoundaryMessageSchema, SDKStatusMessageSchema, SDKPostTurnSummaryMessageSchema, SDKAPIRetryMessageSchema, SDKLocalCommandOutputMessageSchema, SDKHookStartedMessageSchema, SDKHookProgressMessageSchema, SDKHookResponseMessageSchema, SDKToolProgressMessageSchema, SDKAuthStatusMessageSchema, SDKFilesPersistedEventSchema, SDKTaskNotificationMessageSchema, SDKTaskStartedMessageSchema, SDKSessionStateChangedMessageSchema, SDKTaskProgressMessageSchema, SDKToolUseSummaryMessageSchema, SDKElicitationCompleteMessageSchema, SDKPromptSuggestionMessageSchema, SDKSessionInfoSchema, SDKMessageSchema, FastModeStateSchema;
|
|
165502
|
+
var ModelUsageSchema, OutputFormatTypeSchema, BaseOutputFormatSchema, JsonSchemaOutputFormatSchema, OutputFormatSchema, ApiKeySourceSchema, ConfigScopeSchema2, SdkBetaSchema, ThinkingAdaptiveSchema, ThinkingEnabledSchema, ThinkingDisabledSchema, ThinkingConfigSchema, McpStdioServerConfigSchema2, McpSSEServerConfigSchema2, McpHttpServerConfigSchema, McpSdkServerConfigSchema, McpServerConfigForProcessTransportSchema, McpClaudeAIProxyServerConfigSchema, McpServerStatusConfigSchema, McpServerStatusSchema, McpSetServersResultSchema, PermissionUpdateDestinationSchema, PermissionBehaviorSchema, PreToolUsePermissionDecisionSchema, PermissionRuleValueSchema, PermissionUpdateSchema, PermissionDecisionClassificationSchema, PermissionResultSchema, PermissionModeSchema2, HOOK_EVENTS2, HookEventSchema, BaseHookInputSchema, PreToolUseHookInputSchema, PermissionRequestHookInputSchema, PostToolUseHookInputSchema, PostToolUseFailureHookInputSchema, PermissionDeniedHookInputSchema, NotificationHookInputSchema, UserPromptSubmitHookInputSchema, SessionStartHookInputSchema, PreModelSwitchHookInputSchema, PostModelSwitchHookInputSchema, SetupHookInputSchema, StopHookInputSchema, StopFailureHookInputSchema, SubagentStartHookInputSchema, SubagentStopHookInputSchema, PreCompactHookInputSchema, PostCompactHookInputSchema, TeammateIdleHookInputSchema, TaskCreatedHookInputSchema, TaskCompletedHookInputSchema, ElicitationHookInputSchema, ElicitationResultHookInputSchema, CONFIG_CHANGE_SOURCES, ConfigChangeHookInputSchema, INSTRUCTIONS_LOAD_REASONS, INSTRUCTIONS_MEMORY_TYPES, InstructionsLoadedHookInputSchema, WorktreeCreateHookInputSchema, WorktreeRemoveHookInputSchema, CwdChangedHookInputSchema, FileChangedHookInputSchema, EXIT_REASONS, ExitReasonSchema, SessionEndHookInputSchema, HookInputSchema, AsyncHookJSONOutputSchema, PreToolUseHookSpecificOutputSchema, UserPromptSubmitHookSpecificOutputSchema, SessionStartHookSpecificOutputSchema, SetupHookSpecificOutputSchema, SubagentStartHookSpecificOutputSchema, PostToolUseHookSpecificOutputSchema, PostToolUseFailureHookSpecificOutputSchema, PermissionDeniedHookSpecificOutputSchema, NotificationHookSpecificOutputSchema, PermissionRequestHookSpecificOutputSchema, CwdChangedHookSpecificOutputSchema, FileChangedHookSpecificOutputSchema, SyncHookJSONOutputSchema, ElicitationHookSpecificOutputSchema, ElicitationResultHookSpecificOutputSchema, WorktreeCreateHookSpecificOutputSchema, HookJSONOutputSchema, PromptRequestOptionSchema, PromptRequestSchema, PromptResponseSchema, SlashCommandSchema, AgentInfoSchema, ModelInfoSchema, AccountInfoSchema, AgentMcpServerSpecSchema, AgentDefinitionSchema, SettingSourceSchema, SdkPluginConfigSchema, RewindFilesResultSchema, APIUserMessagePlaceholder, APIAssistantMessagePlaceholder, RawMessageStreamEventPlaceholder, UUIDPlaceholder, NonNullableUsagePlaceholder, SDKAssistantMessageErrorSchema, SDKStatusSchema, SDKUserMessageContentSchema, SDKUserMessageSchema, SDKUserMessageReplaySchema, SDKRateLimitInfoSchema, SDKAssistantMessageSchema, SDKRateLimitEventSchema, SDKStreamlinedTextMessageSchema, SDKStreamlinedToolUseSummaryMessageSchema, SDKPermissionDenialSchema, SDKResultSuccessSchema, SDKResultErrorSchema, SDKResultMessageSchema, SDKSystemMessageSchema, SDKPartialAssistantMessageSchema, SDKCompactBoundaryMessageSchema, SDKStatusMessageSchema, SDKPostTurnSummaryMessageSchema, SDKAPIRetryMessageSchema, SDKLocalCommandOutputMessageSchema, SDKHookStartedMessageSchema, SDKHookProgressMessageSchema, SDKHookResponseMessageSchema, SDKToolProgressMessageSchema, SDKAuthStatusMessageSchema, SDKFilesPersistedEventSchema, SDKTaskNotificationMessageSchema, SDKTaskStartedMessageSchema, SDKSessionStateChangedMessageSchema, SDKTaskProgressMessageSchema, SDKToolUseSummaryMessageSchema, SDKElicitationCompleteMessageSchema, SDKPromptSuggestionMessageSchema, SDKSessionInfoSchema, SDKMessageSchema, FastModeStateSchema;
|
|
165486
165503
|
var init_coreSchemas = __esm(() => {
|
|
165487
165504
|
init_v4();
|
|
165488
165505
|
ModelUsageSchema = lazySchema2(() => object({
|
|
@@ -165677,7 +165694,9 @@ var init_coreSchemas = __esm(() => {
|
|
|
165677
165694
|
"WorktreeRemove",
|
|
165678
165695
|
"InstructionsLoaded",
|
|
165679
165696
|
"CwdChanged",
|
|
165680
|
-
"FileChanged"
|
|
165697
|
+
"FileChanged",
|
|
165698
|
+
"PreModelSwitch",
|
|
165699
|
+
"PostModelSwitch"
|
|
165681
165700
|
];
|
|
165682
165701
|
HookEventSchema = lazySchema2(() => _enum(HOOK_EVENTS2));
|
|
165683
165702
|
BaseHookInputSchema = lazySchema2(() => object({
|
|
@@ -165738,6 +165757,18 @@ var init_coreSchemas = __esm(() => {
|
|
|
165738
165757
|
agent_type: string2().optional(),
|
|
165739
165758
|
model: string2().optional()
|
|
165740
165759
|
})));
|
|
165760
|
+
PreModelSwitchHookInputSchema = lazySchema2(() => BaseHookInputSchema().and(object({
|
|
165761
|
+
hook_event_name: literal("PreModelSwitch"),
|
|
165762
|
+
old_model: string2().optional(),
|
|
165763
|
+
new_model: string2(),
|
|
165764
|
+
source: string2()
|
|
165765
|
+
})));
|
|
165766
|
+
PostModelSwitchHookInputSchema = lazySchema2(() => BaseHookInputSchema().and(object({
|
|
165767
|
+
hook_event_name: literal("PostModelSwitch"),
|
|
165768
|
+
old_model: string2().optional(),
|
|
165769
|
+
new_model: string2(),
|
|
165770
|
+
source: string2()
|
|
165771
|
+
})));
|
|
165741
165772
|
SetupHookInputSchema = lazySchema2(() => BaseHookInputSchema().and(object({
|
|
165742
165773
|
hook_event_name: literal("Setup"),
|
|
165743
165774
|
trigger: _enum(["init", "maintenance"])
|
|
@@ -412597,6 +412628,31 @@ function shouldInferenceConfigCommandBeImmediate() {
|
|
|
412597
412628
|
return true;
|
|
412598
412629
|
}
|
|
412599
412630
|
|
|
412631
|
+
// src/tui/utils/modelSwitchHooks.ts
|
|
412632
|
+
function firePreModelSwitch(oldModel, newModel, source) {
|
|
412633
|
+
(async () => {
|
|
412634
|
+
try {
|
|
412635
|
+
for await (const _hookResult of executePreModelSwitchHooks(oldModel, newModel, source, undefined, MODEL_SWITCH_HOOK_TIMEOUT_MS)) {}
|
|
412636
|
+
} catch (e) {
|
|
412637
|
+
logForDebugging3(`PreModelSwitch hook execution failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
412638
|
+
}
|
|
412639
|
+
})();
|
|
412640
|
+
}
|
|
412641
|
+
function firePostModelSwitch(oldModel, newModel, source) {
|
|
412642
|
+
(async () => {
|
|
412643
|
+
try {
|
|
412644
|
+
for await (const _hookResult of executePostModelSwitchHooks(oldModel, newModel, source, undefined, MODEL_SWITCH_HOOK_TIMEOUT_MS)) {}
|
|
412645
|
+
} catch (e) {
|
|
412646
|
+
logForDebugging3(`PostModelSwitch hook execution failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
412647
|
+
}
|
|
412648
|
+
})();
|
|
412649
|
+
}
|
|
412650
|
+
var MODEL_SWITCH_HOOK_TIMEOUT_MS = 15000;
|
|
412651
|
+
var init_modelSwitchHooks = __esm(() => {
|
|
412652
|
+
init_debug();
|
|
412653
|
+
init_hooks7();
|
|
412654
|
+
});
|
|
412655
|
+
|
|
412600
412656
|
// src/tui/commands/model/model.tsx
|
|
412601
412657
|
var exports_model = {};
|
|
412602
412658
|
__export(exports_model, {
|
|
@@ -412628,6 +412684,8 @@ function ModelPickerWrapper(t0) {
|
|
|
412628
412684
|
let t2;
|
|
412629
412685
|
if ($[4] !== mainLoopModel || $[5] !== onDone || $[6] !== setAppState) {
|
|
412630
412686
|
t2 = function handleSelect(model, effort) {
|
|
412687
|
+
const newModel = model !== null ? model : getDefaultMainLoopModel();
|
|
412688
|
+
firePreModelSwitch(mainLoopModel ?? undefined, newModel, "picker");
|
|
412631
412689
|
setAppState((prev) => ({
|
|
412632
412690
|
...prev,
|
|
412633
412691
|
mainLoopModel: model,
|
|
@@ -412637,6 +412695,7 @@ function ModelPickerWrapper(t0) {
|
|
|
412637
412695
|
effortExplicit: false
|
|
412638
412696
|
} : {}
|
|
412639
412697
|
}));
|
|
412698
|
+
firePostModelSwitch(mainLoopModel ?? undefined, newModel, "picker");
|
|
412640
412699
|
let message = `Set model to ${source_default.bold(renderModelLabel(model))}`;
|
|
412641
412700
|
if (effort !== undefined) {
|
|
412642
412701
|
message = message + ` with ${source_default.bold(effort)} effort`;
|
|
@@ -412727,6 +412786,8 @@ function SetModelAndClose({
|
|
|
412727
412786
|
}
|
|
412728
412787
|
}
|
|
412729
412788
|
function setModel(modelValue) {
|
|
412789
|
+
const newModel = modelValue !== null ? modelValue : getDefaultMainLoopModel();
|
|
412790
|
+
firePreModelSwitch(undefined, newModel, "command");
|
|
412730
412791
|
setAppState((prev) => ({
|
|
412731
412792
|
...prev,
|
|
412732
412793
|
mainLoopModel: modelValue,
|
|
@@ -412736,6 +412797,7 @@ function SetModelAndClose({
|
|
|
412736
412797
|
effortExplicit: false
|
|
412737
412798
|
} : {}
|
|
412738
412799
|
}));
|
|
412800
|
+
firePostModelSwitch(undefined, newModel, "command");
|
|
412739
412801
|
let message = `Set model to ${source_default.bold(renderModelLabel(modelValue))}`;
|
|
412740
412802
|
onDone(message);
|
|
412741
412803
|
}
|
|
@@ -412809,6 +412871,7 @@ var init_model2 = __esm(() => {
|
|
|
412809
412871
|
init_model();
|
|
412810
412872
|
init_modelAllowlist();
|
|
412811
412873
|
init_validateModel();
|
|
412874
|
+
init_modelSwitchHooks();
|
|
412812
412875
|
import_compiler_runtime237 = __toESM(require_compiler_runtime(), 1);
|
|
412813
412876
|
React90 = __toESM(require_react(), 1);
|
|
412814
412877
|
jsx_dev_runtime306 = __toESM(require_jsx_dev_runtime(), 1);
|
|
@@ -427413,6 +427476,10 @@ async function getMatchingHooks2(appState, sessionId, hookEvent, hookInput, tool
|
|
|
427413
427476
|
case "FileChanged":
|
|
427414
427477
|
matchQuery = basename49(hookInput.file_path);
|
|
427415
427478
|
break;
|
|
427479
|
+
case "PreModelSwitch":
|
|
427480
|
+
case "PostModelSwitch":
|
|
427481
|
+
matchQuery = hookInput.new_model;
|
|
427482
|
+
break;
|
|
427416
427483
|
default:
|
|
427417
427484
|
break;
|
|
427418
427485
|
}
|
|
@@ -428553,6 +428620,38 @@ async function* executeSessionStartHooks(source, sessionId, agentType, model, si
|
|
|
428553
428620
|
forceSyncExecution
|
|
428554
428621
|
});
|
|
428555
428622
|
}
|
|
428623
|
+
async function* executePreModelSwitchHooks(oldModel, newModel, source, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
428624
|
+
const hookInput = {
|
|
428625
|
+
...createBaseHookInput2(undefined),
|
|
428626
|
+
hook_event_name: "PreModelSwitch",
|
|
428627
|
+
old_model: oldModel,
|
|
428628
|
+
new_model: newModel,
|
|
428629
|
+
source
|
|
428630
|
+
};
|
|
428631
|
+
yield* executeHooks({
|
|
428632
|
+
hookInput,
|
|
428633
|
+
toolUseID: randomUUID43(),
|
|
428634
|
+
matchQuery: newModel,
|
|
428635
|
+
signal,
|
|
428636
|
+
timeoutMs
|
|
428637
|
+
});
|
|
428638
|
+
}
|
|
428639
|
+
async function* executePostModelSwitchHooks(oldModel, newModel, source, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS) {
|
|
428640
|
+
const hookInput = {
|
|
428641
|
+
...createBaseHookInput2(undefined),
|
|
428642
|
+
hook_event_name: "PostModelSwitch",
|
|
428643
|
+
old_model: oldModel,
|
|
428644
|
+
new_model: newModel,
|
|
428645
|
+
source
|
|
428646
|
+
};
|
|
428647
|
+
yield* executeHooks({
|
|
428648
|
+
hookInput,
|
|
428649
|
+
toolUseID: randomUUID43(),
|
|
428650
|
+
matchQuery: newModel,
|
|
428651
|
+
signal,
|
|
428652
|
+
timeoutMs
|
|
428653
|
+
});
|
|
428654
|
+
}
|
|
428556
428655
|
async function* executeSetupHooks(trigger, signal, timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, forceSyncExecution) {
|
|
428557
428656
|
const hookInput = {
|
|
428558
428657
|
...createBaseHookInput2(undefined),
|
package/package.json
CHANGED