@letta-ai/letta-code 0.34.73-app-server.0 → 0.34.73-app-server.1
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/mcp-client.js +2 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/mcp-oauth.js +2 -2
- package/dist/mcp-oauth.js.map +1 -1
- package/dist/types/agent/message.d.ts.map +1 -1
- package/dist/types/agent/modify.d.ts.map +1 -1
- package/dist/types/agent/shared-memory-skills.d.ts.map +1 -1
- package/dist/types/backend/api/agents.d.ts +1 -0
- package/dist/types/backend/api/agents.d.ts.map +1 -1
- package/dist/types/headless-super-run-wait.d.ts.map +1 -1
- package/dist/types/helpers/usable-directory.d.ts +2 -2
- package/dist/types/helpers/usable-directory.d.ts.map +1 -1
- package/dist/types/helpers/working-directory.d.ts +1 -0
- package/dist/types/helpers/working-directory.d.ts.map +1 -1
- package/dist/types/permissions/loader.d.ts.map +1 -1
- package/dist/types/tools/impl/foreground-sleep.d.ts.map +1 -1
- package/dist/types/tools/impl/kill-bash.d.ts +1 -1
- package/dist/types/tools/impl/kill-bash.d.ts.map +1 -1
- package/dist/types/tools/impl/monitor-script.d.ts +1 -0
- package/dist/types/tools/impl/monitor-script.d.ts.map +1 -1
- package/dist/types/tools/impl/monitor.d.ts +1 -0
- package/dist/types/tools/impl/monitor.d.ts.map +1 -1
- package/dist/types/tools/impl/watch-pr-cloud.d.ts +1 -0
- package/dist/types/tools/impl/watch-pr-cloud.d.ts.map +1 -1
- package/dist/types/tools/impl/watch-pr.d.ts +1 -0
- package/dist/types/tools/impl/watch-pr.d.ts.map +1 -1
- package/dist/types/tools/manager.d.ts +3 -5
- package/dist/types/tools/manager.d.ts.map +1 -1
- package/dist/types/tools/script-tool-scope.d.ts.map +1 -1
- package/dist/types/types/background-process-protocol.d.ts +4 -0
- package/dist/types/types/background-process-protocol.d.ts.map +1 -1
- package/dist/types/types/protocol_v2.d.ts +2 -3
- package/dist/types/types/protocol_v2.d.ts.map +1 -1
- package/dist/types/websocket/listener/background-process-snapshot.d.ts +1 -0
- package/dist/types/websocket/listener/background-process-snapshot.d.ts.map +1 -1
- package/dist/types/websocket/listener/cwd.d.ts.map +1 -1
- package/dist/types/websocket/listener/protocol-outbound.d.ts.map +1 -1
- package/letta.js +871 -725
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -34
- package/scripts/source-file-size-baseline.json +3 -3
- package/scripts/unit-test-impact.test.cjs +2 -2
- package/dist/channels-public.js +0 -1969
- package/dist/channels-public.js.map +0 -20
- package/dist/channels-slack.js +0 -1784
- package/dist/channels-slack.js.map +0 -27
- package/dist/gateway-core.js +0 -3067
- package/dist/gateway-core.js.map +0 -19
- package/dist/types/channels/command-runtime-executor.d.ts +0 -125
- package/dist/types/channels/command-runtime-executor.d.ts.map +0 -1
- package/dist/types/channels/command-surface.d.ts +0 -42
- package/dist/types/channels/command-surface.d.ts.map +0 -1
- package/dist/types/channels/control-request-coordinator.d.ts +0 -42
- package/dist/types/channels/control-request-coordinator.d.ts.map +0 -1
- package/dist/types/channels/core-stream.d.ts +0 -35
- package/dist/types/channels/core-stream.d.ts.map +0 -1
- package/dist/types/channels/gateway-core.d.ts +0 -88
- package/dist/types/channels/gateway-core.d.ts.map +0 -1
- package/dist/types/channels/gateway-sources.d.ts +0 -6
- package/dist/types/channels/gateway-sources.d.ts.map +0 -1
- package/dist/types/channels/interactive.d.ts +0 -13
- package/dist/types/channels/interactive.d.ts.map +0 -1
- package/dist/types/channels/lifecycle-error.d.ts +0 -25
- package/dist/types/channels/lifecycle-error.d.ts.map +0 -1
- package/dist/types/channels/message-channel-executor.d.ts +0 -48
- package/dist/types/channels/message-channel-executor.d.ts.map +0 -1
- package/dist/types/channels/message-channel-formatting.d.ts +0 -6
- package/dist/types/channels/message-channel-formatting.d.ts.map +0 -1
- package/dist/types/channels/message-channel-idempotency.d.ts +0 -8
- package/dist/types/channels/message-channel-idempotency.d.ts.map +0 -1
- package/dist/types/channels/message-channel-tool-definition.d.ts +0 -37
- package/dist/types/channels/message-channel-tool-definition.d.ts.map +0 -1
- package/dist/types/channels/message-channel-types.d.ts +0 -46
- package/dist/types/channels/message-channel-types.d.ts.map +0 -1
- package/dist/types/channels/processor.d.ts +0 -27
- package/dist/types/channels/processor.d.ts.map +0 -1
- package/dist/types/channels/progress-builder.d.ts +0 -7
- package/dist/types/channels/progress-builder.d.ts.map +0 -1
- package/dist/types/channels/progress-formatting.d.ts +0 -27
- package/dist/types/channels/progress-formatting.d.ts.map +0 -1
- package/dist/types/channels/route-thread-key.d.ts +0 -4
- package/dist/types/channels/route-thread-key.d.ts.map +0 -1
- package/dist/types/channels/slack/attachment-primitives.d.ts +0 -55
- package/dist/types/channels/slack/attachment-primitives.d.ts.map +0 -1
- package/dist/types/channels/slack/bot-policy.d.ts +0 -25
- package/dist/types/channels/slack/bot-policy.d.ts.map +0 -1
- package/dist/types/channels/slack/ingress-policy.d.ts +0 -108
- package/dist/types/channels/slack/ingress-policy.d.ts.map +0 -1
- package/dist/types/channels/slack/internal-types.d.ts +0 -168
- package/dist/types/channels/slack/internal-types.d.ts.map +0 -1
- package/dist/types/channels/slack/message-action-contract.d.ts +0 -11
- package/dist/types/channels/slack/message-action-contract.d.ts.map +0 -1
- package/dist/types/channels/slack/model-picker-blocks.d.ts +0 -5
- package/dist/types/channels/slack/model-picker-blocks.d.ts.map +0 -1
- package/dist/types/channels/slack/presentation.d.ts +0 -18
- package/dist/types/channels/slack/presentation.d.ts.map +0 -1
- package/dist/types/channels/slack/progress.d.ts +0 -7
- package/dist/types/channels/slack/progress.d.ts.map +0 -1
- package/dist/types/channels/slack/public-utils.d.ts +0 -10
- package/dist/types/channels/slack/public-utils.d.ts.map +0 -1
- package/dist/types/channels/slack/sender.d.ts +0 -39
- package/dist/types/channels/slack/sender.d.ts.map +0 -1
- package/dist/types/channels/slack/status-controller.d.ts +0 -37
- package/dist/types/channels/slack/status-controller.d.ts.map +0 -1
- package/dist/types/channels/slack/user-mentions.d.ts +0 -10
- package/dist/types/channels/slack/user-mentions.d.ts.map +0 -1
- package/dist/types/channels/slack/utils.d.ts +0 -37
- package/dist/types/channels/slack/utils.d.ts.map +0 -1
- package/dist/types/channels/xml.d.ts +0 -6
- package/dist/types/channels/xml.d.ts.map +0 -1
- package/dist/types/channels-public.d.ts +0 -17
- package/dist/types/channels-public.d.ts.map +0 -1
- package/dist/types/channels-slack.d.ts +0 -17
- package/dist/types/channels-slack.d.ts.map +0 -1
- package/dist/types/gateway-core.d.ts +0 -12
- package/dist/types/gateway-core.d.ts.map +0 -1
package/letta.js
CHANGED
|
@@ -28622,11 +28622,16 @@ function actingUserRequestOptions(actingUserId) {
|
|
|
28622
28622
|
var ACTING_USER_ID_HEADER = "X-Letta-Acting-User-Id", ACTING_USER_ID_ENV = "LETTA_ACTING_USER_ID";
|
|
28623
28623
|
|
|
28624
28624
|
// src/helpers/usable-directory.ts
|
|
28625
|
-
import { statSync } from "node:fs";
|
|
28625
|
+
import { accessSync, constants as constants2, statSync } from "node:fs";
|
|
28626
28626
|
function readDirectoryStats(dirPath) {
|
|
28627
28627
|
return statSync(dirPath, { throwIfNoEntry: false });
|
|
28628
28628
|
}
|
|
28629
|
-
function
|
|
28629
|
+
function checkDirectoryTraversal(dirPath) {
|
|
28630
|
+
if (process.platform !== "win32") {
|
|
28631
|
+
accessSync(dirPath, constants2.X_OK);
|
|
28632
|
+
}
|
|
28633
|
+
}
|
|
28634
|
+
function getDirectoryUsability(dirPath, statDirectory = readDirectoryStats, checkTraversal = checkDirectoryTraversal) {
|
|
28630
28635
|
if (typeof dirPath !== "string" || dirPath.length === 0) {
|
|
28631
28636
|
return "missing";
|
|
28632
28637
|
}
|
|
@@ -28635,11 +28640,20 @@ function getDirectoryUsability(dirPath, statDirectory = readDirectoryStats) {
|
|
|
28635
28640
|
if (!stats) {
|
|
28636
28641
|
return "missing";
|
|
28637
28642
|
}
|
|
28638
|
-
|
|
28643
|
+
if (!stats.isDirectory()) {
|
|
28644
|
+
return "not-directory";
|
|
28645
|
+
}
|
|
28639
28646
|
} catch (error) {
|
|
28640
28647
|
const code = error?.code;
|
|
28641
28648
|
return code === "ENOENT" || code === "ENOTDIR" ? "missing" : "unknown";
|
|
28642
28649
|
}
|
|
28650
|
+
try {
|
|
28651
|
+
checkTraversal(dirPath);
|
|
28652
|
+
return "usable";
|
|
28653
|
+
} catch (error) {
|
|
28654
|
+
const code = error?.code;
|
|
28655
|
+
return code === "EACCES" || code === "EPERM" ? "inaccessible" : "unknown";
|
|
28656
|
+
}
|
|
28643
28657
|
}
|
|
28644
28658
|
function isConfirmedUnusableDirectory(dirPath, statDirectory) {
|
|
28645
28659
|
const usability = getDirectoryUsability(dirPath, statDirectory);
|
|
@@ -29903,7 +29917,7 @@ var package_default;
|
|
|
29903
29917
|
var init_package = __esm(() => {
|
|
29904
29918
|
package_default = {
|
|
29905
29919
|
name: "@letta-ai/letta-code",
|
|
29906
|
-
version: "0.34.73-app-server.
|
|
29920
|
+
version: "0.34.73-app-server.1",
|
|
29907
29921
|
lettaStartupLogProtocol: 1,
|
|
29908
29922
|
lettaConfigDirProtocol: 1,
|
|
29909
29923
|
description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
|
|
@@ -29945,12 +29959,6 @@ var init_package = __esm(() => {
|
|
|
29945
29959
|
"dist/ask-user-question.js.map",
|
|
29946
29960
|
"dist/ask-user-question.cjs",
|
|
29947
29961
|
"dist/ask-user-question.cjs.map",
|
|
29948
|
-
"dist/channels-public.js",
|
|
29949
|
-
"dist/channels-public.js.map",
|
|
29950
|
-
"dist/gateway-core.js",
|
|
29951
|
-
"dist/gateway-core.js.map",
|
|
29952
|
-
"dist/channels-slack.js",
|
|
29953
|
-
"dist/channels-slack.js.map",
|
|
29954
29962
|
"dist/channels-telegram.js",
|
|
29955
29963
|
"dist/channels-telegram.js.map",
|
|
29956
29964
|
"dist/types",
|
|
@@ -30018,24 +30026,6 @@ var init_package = __esm(() => {
|
|
|
30018
30026
|
import: "./dist/schedules.js",
|
|
30019
30027
|
default: "./dist/schedules.js"
|
|
30020
30028
|
},
|
|
30021
|
-
"./channels": {
|
|
30022
|
-
types: "./dist/types/channels-public.d.ts",
|
|
30023
|
-
browser: "./dist/channels-public.js",
|
|
30024
|
-
import: "./dist/channels-public.js",
|
|
30025
|
-
default: "./dist/channels-public.js"
|
|
30026
|
-
},
|
|
30027
|
-
"./gateway-core": {
|
|
30028
|
-
types: "./dist/types/gateway-core.d.ts",
|
|
30029
|
-
browser: "./dist/gateway-core.js",
|
|
30030
|
-
import: "./dist/gateway-core.js",
|
|
30031
|
-
default: "./dist/gateway-core.js"
|
|
30032
|
-
},
|
|
30033
|
-
"./channels/slack": {
|
|
30034
|
-
types: "./dist/types/channels-slack.d.ts",
|
|
30035
|
-
browser: "./dist/channels-slack.js",
|
|
30036
|
-
import: "./dist/channels-slack.js",
|
|
30037
|
-
default: "./dist/channels-slack.js"
|
|
30038
|
-
},
|
|
30039
30029
|
"./channels/telegram": {
|
|
30040
30030
|
types: "./dist/types/channels-telegram.d.ts",
|
|
30041
30031
|
browser: "./dist/channels-telegram.js",
|
|
@@ -30168,15 +30158,6 @@ var init_package = __esm(() => {
|
|
|
30168
30158
|
"mcp-oauth": [
|
|
30169
30159
|
"./dist/types/mcp-oauth-public.d.ts"
|
|
30170
30160
|
],
|
|
30171
|
-
channels: [
|
|
30172
|
-
"./dist/types/channels-public.d.ts"
|
|
30173
|
-
],
|
|
30174
|
-
"gateway-core": [
|
|
30175
|
-
"./dist/types/gateway-core.d.ts"
|
|
30176
|
-
],
|
|
30177
|
-
"channels/slack": [
|
|
30178
|
-
"./dist/types/channels-slack.d.ts"
|
|
30179
|
-
],
|
|
30180
30161
|
"channels/telegram": [
|
|
30181
30162
|
"./dist/types/channels-telegram.d.ts"
|
|
30182
30163
|
],
|
|
@@ -120180,7 +120161,7 @@ __export(exports_personality_default_files, {
|
|
|
120180
120161
|
});
|
|
120181
120162
|
import { execFile as execFileCb } from "node:child_process";
|
|
120182
120163
|
import {
|
|
120183
|
-
constants as
|
|
120164
|
+
constants as constants4,
|
|
120184
120165
|
copyFileSync,
|
|
120185
120166
|
existsSync as existsSync10,
|
|
120186
120167
|
mkdirSync as mkdirSync7,
|
|
@@ -120277,7 +120258,7 @@ async function seedPersonalityDefaultMemoryFiles(params) {
|
|
|
120277
120258
|
}
|
|
120278
120259
|
mkdirSync7(dirname9(absolutePath), { recursive: true });
|
|
120279
120260
|
try {
|
|
120280
|
-
copyFileSync(sourcePath, absolutePath,
|
|
120261
|
+
copyFileSync(sourcePath, absolutePath, constants4.COPYFILE_EXCL);
|
|
120281
120262
|
} catch (error3) {
|
|
120282
120263
|
if (error3 instanceof Error && "code" in error3 && error3.code === "EEXIST") {
|
|
120283
120264
|
result2.skippedPaths.push(file.path);
|
|
@@ -122958,34 +122939,14 @@ function buildModelSettings(modelHandle, updateArgs, localModelCatalog = false)
|
|
|
122958
122939
|
xaiSettings.reasoning = updateArgs.reasoning_effort === null ? null : { reasoning_effort: String(updateArgs.reasoning_effort) };
|
|
122959
122940
|
}
|
|
122960
122941
|
settings = xaiSettings;
|
|
122961
|
-
} else if (isGoogleAI) {
|
|
122962
|
-
const
|
|
122963
|
-
|
|
122964
|
-
|
|
122965
|
-
|
|
122966
|
-
|
|
122967
|
-
|
|
122968
|
-
thinking_budget: updateArgs.thinking_budget
|
|
122969
|
-
};
|
|
122970
|
-
}
|
|
122971
|
-
if (typeof updateArgs?.temperature === "number") {
|
|
122972
|
-
googleSettings.temperature = updateArgs.temperature;
|
|
122973
|
-
}
|
|
122974
|
-
settings = googleSettings;
|
|
122975
|
-
} else if (isGoogleVertex) {
|
|
122976
|
-
const googleVertexSettings = {
|
|
122977
|
-
provider_type: "google_vertex",
|
|
122978
|
-
parallel_tool_calls: true
|
|
122942
|
+
} else if (isGoogleAI || isGoogleVertex) {
|
|
122943
|
+
const thinkingConfig = typeof updateArgs?.thinking_budget === "number" ? { thinking_budget: updateArgs.thinking_budget } : typeof updateArgs?.reasoning_effort === "string" ? { thinking_level: updateArgs.reasoning_effort.toUpperCase() } : undefined;
|
|
122944
|
+
settings = {
|
|
122945
|
+
provider_type: isGoogleAI ? "google_ai" : "google_vertex",
|
|
122946
|
+
parallel_tool_calls: true,
|
|
122947
|
+
...thinkingConfig ? { thinking_config: thinkingConfig } : {},
|
|
122948
|
+
...typeof updateArgs?.temperature === "number" ? { temperature: updateArgs.temperature } : {}
|
|
122979
122949
|
};
|
|
122980
|
-
if (updateArgs?.thinking_budget !== undefined) {
|
|
122981
|
-
googleVertexSettings.thinking_config = {
|
|
122982
|
-
thinking_budget: updateArgs.thinking_budget
|
|
122983
|
-
};
|
|
122984
|
-
}
|
|
122985
|
-
if (typeof updateArgs?.temperature === "number") {
|
|
122986
|
-
googleVertexSettings.temperature = updateArgs.temperature;
|
|
122987
|
-
}
|
|
122988
|
-
settings = googleVertexSettings;
|
|
122989
122950
|
} else if (isBedrock) {
|
|
122990
122951
|
const bedrockSettings = {
|
|
122991
122952
|
provider_type: "bedrock",
|
|
@@ -142247,7 +142208,7 @@ function serializeAttribute(state2, key2, value) {
|
|
|
142247
142208
|
return "";
|
|
142248
142209
|
}
|
|
142249
142210
|
const name = stringifyEntities(info.attribute, Object.assign({}, state2.settings.characterReferences, {
|
|
142250
|
-
subset:
|
|
142211
|
+
subset: constants5.name[x2][y]
|
|
142251
142212
|
}));
|
|
142252
142213
|
if (value === true)
|
|
142253
142214
|
return name;
|
|
@@ -142259,7 +142220,7 @@ function serializeAttribute(state2, key2, value) {
|
|
|
142259
142220
|
if (state2.settings.preferUnquoted) {
|
|
142260
142221
|
result2 = stringifyEntities(value, Object.assign({}, state2.settings.characterReferences, {
|
|
142261
142222
|
attribute: true,
|
|
142262
|
-
subset:
|
|
142223
|
+
subset: constants5.unquoted[x2][y]
|
|
142263
142224
|
}));
|
|
142264
142225
|
}
|
|
142265
142226
|
if (result2 !== value) {
|
|
@@ -142267,19 +142228,19 @@ function serializeAttribute(state2, key2, value) {
|
|
|
142267
142228
|
quote = state2.alternative;
|
|
142268
142229
|
}
|
|
142269
142230
|
result2 = quote + stringifyEntities(value, Object.assign({}, state2.settings.characterReferences, {
|
|
142270
|
-
subset: (quote === "'" ?
|
|
142231
|
+
subset: (quote === "'" ? constants5.single : constants5.double)[x2][y],
|
|
142271
142232
|
attribute: true
|
|
142272
142233
|
})) + quote;
|
|
142273
142234
|
}
|
|
142274
142235
|
return name + (result2 ? "=" + result2 : result2);
|
|
142275
142236
|
}
|
|
142276
|
-
var
|
|
142237
|
+
var constants5;
|
|
142277
142238
|
var init_element = __esm(() => {
|
|
142278
142239
|
init_property_information();
|
|
142279
142240
|
init_stringify_entities();
|
|
142280
142241
|
init_closing();
|
|
142281
142242
|
init_opening();
|
|
142282
|
-
|
|
142243
|
+
constants5 = {
|
|
142283
142244
|
name: [
|
|
142284
142245
|
[`
|
|
142285
142246
|
\f\r &/=>`.split(""), `
|
|
@@ -155026,9 +154987,9 @@ import {
|
|
|
155026
154987
|
} from "node:child_process";
|
|
155027
154988
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
155028
154989
|
import {
|
|
155029
|
-
accessSync,
|
|
154990
|
+
accessSync as accessSync2,
|
|
155030
154991
|
closeSync as closeSync4,
|
|
155031
|
-
constants as
|
|
154992
|
+
constants as constants6,
|
|
155032
154993
|
linkSync,
|
|
155033
154994
|
mkdirSync as mkdirSync14,
|
|
155034
154995
|
openSync as openSync4,
|
|
@@ -155125,7 +155086,7 @@ function findInstalledPackagePath(resolvedPath) {
|
|
|
155125
155086
|
}
|
|
155126
155087
|
function canWritePath(path8) {
|
|
155127
155088
|
try {
|
|
155128
|
-
|
|
155089
|
+
accessSync2(path8, constants6.W_OK);
|
|
155129
155090
|
return true;
|
|
155130
155091
|
} catch {
|
|
155131
155092
|
return false;
|
|
@@ -194792,11 +194753,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
194792
194753
|
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
|
194793
194754
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
194794
194755
|
}
|
|
194795
|
-
optimizeNames(names,
|
|
194756
|
+
optimizeNames(names, constants7) {
|
|
194796
194757
|
if (!names[this.name.str])
|
|
194797
194758
|
return;
|
|
194798
194759
|
if (this.rhs)
|
|
194799
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
194760
|
+
this.rhs = optimizeExpr(this.rhs, names, constants7);
|
|
194800
194761
|
return this;
|
|
194801
194762
|
}
|
|
194802
194763
|
get names() {
|
|
@@ -194814,10 +194775,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
194814
194775
|
render({ _n }) {
|
|
194815
194776
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
194816
194777
|
}
|
|
194817
|
-
optimizeNames(names,
|
|
194778
|
+
optimizeNames(names, constants7) {
|
|
194818
194779
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
194819
194780
|
return;
|
|
194820
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
194781
|
+
this.rhs = optimizeExpr(this.rhs, names, constants7);
|
|
194821
194782
|
return this;
|
|
194822
194783
|
}
|
|
194823
194784
|
get names() {
|
|
@@ -194883,8 +194844,8 @@ var require_codegen = __commonJS((exports) => {
|
|
|
194883
194844
|
optimizeNodes() {
|
|
194884
194845
|
return `${this.code}` ? this : undefined;
|
|
194885
194846
|
}
|
|
194886
|
-
optimizeNames(names,
|
|
194887
|
-
this.code = optimizeExpr(this.code, names,
|
|
194847
|
+
optimizeNames(names, constants7) {
|
|
194848
|
+
this.code = optimizeExpr(this.code, names, constants7);
|
|
194888
194849
|
return this;
|
|
194889
194850
|
}
|
|
194890
194851
|
get names() {
|
|
@@ -194914,12 +194875,12 @@ var require_codegen = __commonJS((exports) => {
|
|
|
194914
194875
|
}
|
|
194915
194876
|
return nodes.length > 0 ? this : undefined;
|
|
194916
194877
|
}
|
|
194917
|
-
optimizeNames(names,
|
|
194878
|
+
optimizeNames(names, constants7) {
|
|
194918
194879
|
const { nodes } = this;
|
|
194919
194880
|
let i4 = nodes.length;
|
|
194920
194881
|
while (i4--) {
|
|
194921
194882
|
const n = nodes[i4];
|
|
194922
|
-
if (n.optimizeNames(names,
|
|
194883
|
+
if (n.optimizeNames(names, constants7))
|
|
194923
194884
|
continue;
|
|
194924
194885
|
subtractNames(names, n.names);
|
|
194925
194886
|
nodes.splice(i4, 1);
|
|
@@ -194976,12 +194937,12 @@ var require_codegen = __commonJS((exports) => {
|
|
|
194976
194937
|
return;
|
|
194977
194938
|
return this;
|
|
194978
194939
|
}
|
|
194979
|
-
optimizeNames(names,
|
|
194940
|
+
optimizeNames(names, constants7) {
|
|
194980
194941
|
var _a10;
|
|
194981
|
-
this.else = (_a10 = this.else) === null || _a10 === undefined ? undefined : _a10.optimizeNames(names,
|
|
194982
|
-
if (!(super.optimizeNames(names,
|
|
194942
|
+
this.else = (_a10 = this.else) === null || _a10 === undefined ? undefined : _a10.optimizeNames(names, constants7);
|
|
194943
|
+
if (!(super.optimizeNames(names, constants7) || this.else))
|
|
194983
194944
|
return;
|
|
194984
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
194945
|
+
this.condition = optimizeExpr(this.condition, names, constants7);
|
|
194985
194946
|
return this;
|
|
194986
194947
|
}
|
|
194987
194948
|
get names() {
|
|
@@ -195006,10 +194967,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
195006
194967
|
render(opts) {
|
|
195007
194968
|
return `for(${this.iteration})` + super.render(opts);
|
|
195008
194969
|
}
|
|
195009
|
-
optimizeNames(names,
|
|
195010
|
-
if (!super.optimizeNames(names,
|
|
194970
|
+
optimizeNames(names, constants7) {
|
|
194971
|
+
if (!super.optimizeNames(names, constants7))
|
|
195011
194972
|
return;
|
|
195012
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
194973
|
+
this.iteration = optimizeExpr(this.iteration, names, constants7);
|
|
195013
194974
|
return this;
|
|
195014
194975
|
}
|
|
195015
194976
|
get names() {
|
|
@@ -195047,10 +195008,10 @@ var require_codegen = __commonJS((exports) => {
|
|
|
195047
195008
|
render(opts) {
|
|
195048
195009
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
195049
195010
|
}
|
|
195050
|
-
optimizeNames(names,
|
|
195051
|
-
if (!super.optimizeNames(names,
|
|
195011
|
+
optimizeNames(names, constants7) {
|
|
195012
|
+
if (!super.optimizeNames(names, constants7))
|
|
195052
195013
|
return;
|
|
195053
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
195014
|
+
this.iterable = optimizeExpr(this.iterable, names, constants7);
|
|
195054
195015
|
return this;
|
|
195055
195016
|
}
|
|
195056
195017
|
get names() {
|
|
@@ -195095,11 +195056,11 @@ var require_codegen = __commonJS((exports) => {
|
|
|
195095
195056
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
195096
195057
|
return this;
|
|
195097
195058
|
}
|
|
195098
|
-
optimizeNames(names,
|
|
195059
|
+
optimizeNames(names, constants7) {
|
|
195099
195060
|
var _a10, _b;
|
|
195100
|
-
super.optimizeNames(names,
|
|
195101
|
-
(_a10 = this.catch) === null || _a10 === undefined || _a10.optimizeNames(names,
|
|
195102
|
-
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names,
|
|
195061
|
+
super.optimizeNames(names, constants7);
|
|
195062
|
+
(_a10 = this.catch) === null || _a10 === undefined || _a10.optimizeNames(names, constants7);
|
|
195063
|
+
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants7);
|
|
195103
195064
|
return this;
|
|
195104
195065
|
}
|
|
195105
195066
|
get names() {
|
|
@@ -195373,7 +195334,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
195373
195334
|
function addExprNames(names, from) {
|
|
195374
195335
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
195375
195336
|
}
|
|
195376
|
-
function optimizeExpr(expr, names,
|
|
195337
|
+
function optimizeExpr(expr, names, constants7) {
|
|
195377
195338
|
if (expr instanceof code_1.Name)
|
|
195378
195339
|
return replaceName(expr);
|
|
195379
195340
|
if (!canOptimize(expr))
|
|
@@ -195388,14 +195349,14 @@ var require_codegen = __commonJS((exports) => {
|
|
|
195388
195349
|
return items;
|
|
195389
195350
|
}, []));
|
|
195390
195351
|
function replaceName(n) {
|
|
195391
|
-
const c =
|
|
195352
|
+
const c = constants7[n.str];
|
|
195392
195353
|
if (c === undefined || names[n.str] !== 1)
|
|
195393
195354
|
return n;
|
|
195394
195355
|
delete names[n.str];
|
|
195395
195356
|
return c;
|
|
195396
195357
|
}
|
|
195397
195358
|
function canOptimize(e2) {
|
|
195398
|
-
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
195359
|
+
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants7[c.str] !== undefined);
|
|
195399
195360
|
}
|
|
195400
195361
|
}
|
|
195401
195362
|
function subtractNames(names, from) {
|
|
@@ -203029,7 +202990,7 @@ var init_mcp_client = __esm(() => {
|
|
|
203029
202990
|
init_streamableHttp();
|
|
203030
202991
|
DEFAULT_CLIENT_INFO = {
|
|
203031
202992
|
name: "letta-code",
|
|
203032
|
-
version: "0.34.73-app-server.
|
|
202993
|
+
version: "0.34.73-app-server.1"
|
|
203033
202994
|
};
|
|
203034
202995
|
});
|
|
203035
202996
|
|
|
@@ -205262,8 +205223,14 @@ var init_execution_registry = __esm(() => {
|
|
|
205262
205223
|
function belongsToRuntime(entry, runtimeScope) {
|
|
205263
205224
|
return entry.runtimeScope?.agentId === runtimeScope.agentId && entry.runtimeScope.conversationId === runtimeScope.conversationId;
|
|
205264
205225
|
}
|
|
205226
|
+
function isNonPersistentMonitor(process21) {
|
|
205227
|
+
return process21.kind === "monitor" && process21.persistent !== true;
|
|
205228
|
+
}
|
|
205229
|
+
function countNonPersistentMonitors(processes) {
|
|
205230
|
+
return processes.filter(isNonPersistentMonitor).length;
|
|
205231
|
+
}
|
|
205265
205232
|
function hasRunningBackgroundWork(agentId, conversationId) {
|
|
205266
|
-
return buildBackgroundProcessSnapshot(agentId, conversationId).some((process21) => process21.kind === "bash");
|
|
205233
|
+
return buildBackgroundProcessSnapshot(agentId, conversationId).some((process21) => process21.kind === "bash" || isNonPersistentMonitor(process21));
|
|
205267
205234
|
}
|
|
205268
205235
|
function buildBackgroundProcessSnapshot(agentId, conversationId = "default") {
|
|
205269
205236
|
if (agentId === null) {
|
|
@@ -206267,16 +206234,18 @@ function getConversationWorkingDirectory(runtime, agentId, conversationId) {
|
|
|
206267
206234
|
if (stored === undefined) {
|
|
206268
206235
|
return bootWorkingDirectory;
|
|
206269
206236
|
}
|
|
206237
|
+
if (isUsableDirectory(stored)) {
|
|
206238
|
+
return stored;
|
|
206239
|
+
}
|
|
206270
206240
|
if (isConfirmedUnusableDirectory(stored)) {
|
|
206271
206241
|
runtime.workingDirectoryByConversation.delete(scopeKey);
|
|
206272
206242
|
bumpWorkingDirectoryRevision(runtime);
|
|
206273
206243
|
persistCwdMapSync(runtime.workingDirectoryByConversation);
|
|
206274
|
-
return bootWorkingDirectory;
|
|
206275
206244
|
}
|
|
206276
|
-
return
|
|
206245
|
+
return bootWorkingDirectory;
|
|
206277
206246
|
}
|
|
206278
206247
|
function getBootWorkingDirectory(runtime) {
|
|
206279
|
-
if (
|
|
206248
|
+
if (isUsableDirectory(runtime.bootWorkingDirectory)) {
|
|
206280
206249
|
return runtime.bootWorkingDirectory;
|
|
206281
206250
|
}
|
|
206282
206251
|
const fallback = getFallbackWorkingDirectory();
|
|
@@ -207541,6 +207510,8 @@ Pass a URL ending at the PR number, such as \`https://github.com/owner/repo/pull
|
|
|
207541
207510
|
|
|
207542
207511
|
Use \`notify_on\` to limit PR notifications (for example \`["merged", "closed", "conflict"]\` or \`["checks_done"]\`); watcher errors still report. Workflow run URLs (\`https://github.com/owner/repo/actions/runs/123\`) report status changes and completion with conclusion and failed jobs/steps, including runs without a PR. Reruns remain a separate action.
|
|
207543
207512
|
|
|
207513
|
+
Write \`note\` as a note to your future self, not a script: why you are watching, what you planned, or which tracker or follow-up depends on the result. When an event arrives, the situation or people's wishes may have changed since you wrote it. Re-check current state before acting.
|
|
207514
|
+
|
|
207544
207515
|
Pass \`resume\` with a local paused monitor id to restart it; a cloud id returns status only, without replaying a PR snapshot. Cloud watches continue between sessions.
|
|
207545
207516
|
`;
|
|
207546
207517
|
var init_WatchPR = () => {};
|
|
@@ -209183,28 +209154,40 @@ var init_worktree_ownership = __esm(() => {
|
|
|
209183
209154
|
});
|
|
209184
209155
|
|
|
209185
209156
|
// src/tools/impl/foreground-sleep.ts
|
|
209186
|
-
function
|
|
209157
|
+
function runsSleep(command, shellDepth) {
|
|
209187
209158
|
const segments = splitShellSegmentsAllowCommandSubstitution(command) ?? splitShellSegments(command);
|
|
209188
209159
|
if (!segments) {
|
|
209189
209160
|
return false;
|
|
209190
209161
|
}
|
|
209191
209162
|
for (const segment of segments) {
|
|
209192
|
-
|
|
209193
|
-
|
|
209194
|
-
|
|
209195
|
-
|
|
209196
|
-
|
|
209197
|
-
|
|
209198
|
-
|
|
209199
|
-
|
|
209200
|
-
|
|
209201
|
-
|
|
209202
|
-
|
|
209163
|
+
const words2 = tokenizeShellWords(segment);
|
|
209164
|
+
const commandIndex = words2.findIndex((word) => !SHELL_KEYWORDS.has(word) && !ASSIGNMENT_PREFIX.test(word));
|
|
209165
|
+
const executable = words2[commandIndex]?.split("/").pop();
|
|
209166
|
+
if (executable === "sleep")
|
|
209167
|
+
return true;
|
|
209168
|
+
const flag = words2[commandIndex + 1];
|
|
209169
|
+
const script = words2[commandIndex + 2]?.trim();
|
|
209170
|
+
if (!script)
|
|
209171
|
+
continue;
|
|
209172
|
+
if (executable && isShellExecutor(executable) && flag && /^-[a-zA-Z]*c[a-zA-Z]*$/.test(flag) && shellDepth < 8 && !script.includes("<<") && runsSleep(script, shellDepth + 1)) {
|
|
209173
|
+
return true;
|
|
209174
|
+
}
|
|
209175
|
+
if ((executable === "python" || executable === "python3") && flag === "-c" && (PYTHON_SLEEP.test(script) || PYTHON_IMPORTED_SLEEP.test(script))) {
|
|
209176
|
+
return true;
|
|
209177
|
+
}
|
|
209178
|
+
if (executable === "node" && (flag === "-e" || flag === "--eval") && (NODE_SLEEP.test(script) || NODE_PROMISE_SLEEP.test(script))) {
|
|
209179
|
+
return true;
|
|
209180
|
+
}
|
|
209181
|
+
if (executable === "perl" && flag === "-e" && PERL_SLEEP.test(script)) {
|
|
209182
|
+
return true;
|
|
209203
209183
|
}
|
|
209204
209184
|
}
|
|
209205
209185
|
return false;
|
|
209206
209186
|
}
|
|
209207
|
-
|
|
209187
|
+
function commandRunsForegroundSleep(command) {
|
|
209188
|
+
return runsSleep(command, 0);
|
|
209189
|
+
}
|
|
209190
|
+
var FOREGROUND_SLEEP_BLOCKED_MESSAGE = "Foreground `sleep` is blocked. If you are waiting on a task you already started, its completion notification will arrive on its own; keep working or end your turn. To wait for a condition, run the command with `run_in_background` (or use the Monitor tool for repeated events). `sleep` inside `run_in_background` commands and Monitor scripts is fine.", SHELL_KEYWORDS, ASSIGNMENT_PREFIX, PYTHON_SLEEP, PYTHON_IMPORTED_SLEEP, NODE_SLEEP, NODE_PROMISE_SLEEP, PERL_SLEEP;
|
|
209208
209191
|
var init_foreground_sleep = __esm(() => {
|
|
209209
209192
|
SHELL_KEYWORDS = new Set([
|
|
209210
209193
|
"if",
|
|
@@ -209227,6 +209210,11 @@ var init_foreground_sleep = __esm(() => {
|
|
|
209227
209210
|
"time"
|
|
209228
209211
|
]);
|
|
209229
209212
|
ASSIGNMENT_PREFIX = /^[A-Za-z_][A-Za-z0-9_]*=/;
|
|
209213
|
+
PYTHON_SLEEP = /^import\s+time\s*[;\n]\s*(?:(?:while\s+(?:True|1)|for\s+\w+\s+in\s+range\(\d+\))\s*:\s*)?time\.sleep\(\s*\d*\.?\d+\s*\)\s*;?$/;
|
|
209214
|
+
PYTHON_IMPORTED_SLEEP = /^from\s+time\s+import\s+sleep\s*[;\n]\s*(?:(?:while\s+(?:True|1)|for\s+\w+\s+in\s+range\(\d+\))\s*:\s*)?sleep\(\s*\d*\.?\d+\s*\)\s*;?$/;
|
|
209215
|
+
NODE_SLEEP = /^setTimeout\(\s*\(\s*\)\s*=>\s*\{\s*\}\s*,\s*\d+\s*\)\s*;?$/;
|
|
209216
|
+
NODE_PROMISE_SLEEP = /^(?:await\s+)?new\s+Promise\(\s*(\w+)\s*=>\s*setTimeout\(\s*\1\s*,\s*\d+\s*\)\s*\)\s*;?$/;
|
|
209217
|
+
PERL_SLEEP = /^(?:sleep\s*(?:\d+|\(\s*\d+\s*\))(?:\s+while\s+1)?|while\s*\(\s*1\s*\)\s*\{\s*sleep\s+\d+\s*;?\s*\})\s*;?$/;
|
|
209230
209218
|
});
|
|
209231
209219
|
|
|
209232
209220
|
// src/tools/impl/self-matching-pgrep.ts
|
|
@@ -220656,7 +220644,7 @@ __export(exports_loader, {
|
|
|
220656
220644
|
getUserSettingsPaths: () => getUserSettingsPaths
|
|
220657
220645
|
});
|
|
220658
220646
|
import { createHash as createHash8 } from "node:crypto";
|
|
220659
|
-
import { readFileSync as readFileSync36,
|
|
220647
|
+
import { readFileSync as readFileSync36, watch } from "node:fs";
|
|
220660
220648
|
import { homedir as homedir14 } from "node:os";
|
|
220661
220649
|
import { dirname as dirname24, join as join56, resolve as resolve24 } from "node:path";
|
|
220662
220650
|
function getUserSettingsPaths(options = {}) {
|
|
@@ -220680,35 +220668,54 @@ function getPermissionSourcePaths(workingDirectory) {
|
|
|
220680
220668
|
sources.push(join56(workingDirectory, ".letta", "settings.local.json"));
|
|
220681
220669
|
return sources;
|
|
220682
220670
|
}
|
|
220683
|
-
function
|
|
220671
|
+
function readSettings(path19) {
|
|
220684
220672
|
try {
|
|
220685
|
-
|
|
220686
|
-
|
|
220687
|
-
|
|
220688
|
-
|
|
220689
|
-
|
|
220690
|
-
exists: true,
|
|
220691
|
-
mtimeMs: stat6.mtimeMs,
|
|
220692
|
-
size: stat6.size,
|
|
220693
|
-
hash: createHash8("sha256").update(readFileSync36(path19)).digest("hex")
|
|
220694
|
-
};
|
|
220695
|
-
} catch {
|
|
220696
|
-
return { exists: false };
|
|
220673
|
+
return readFileSync36(path19, "utf8");
|
|
220674
|
+
} catch (error4) {
|
|
220675
|
+
if (error4.code === "ENOENT")
|
|
220676
|
+
return;
|
|
220677
|
+
throw new Error(`Failed to read permissions in ${path19}: ${getErrorMessage2(error4)}`);
|
|
220697
220678
|
}
|
|
220698
220679
|
}
|
|
220699
|
-
function
|
|
220700
|
-
|
|
220701
|
-
|
|
220702
|
-
|
|
220680
|
+
function parseSettings(content, path19) {
|
|
220681
|
+
try {
|
|
220682
|
+
let settings;
|
|
220683
|
+
try {
|
|
220684
|
+
settings = JSON.parse(content);
|
|
220685
|
+
} catch {
|
|
220686
|
+
throw new Error("invalid JSON");
|
|
220687
|
+
}
|
|
220688
|
+
if (!isRecord2(settings)) {
|
|
220689
|
+
throw new Error("settings must be a JSON object");
|
|
220690
|
+
}
|
|
220691
|
+
if (settings.permissions !== undefined) {
|
|
220692
|
+
if (!isRecord2(settings.permissions)) {
|
|
220693
|
+
throw new Error("permissions must be an object");
|
|
220694
|
+
}
|
|
220695
|
+
const permissions = settings.permissions;
|
|
220696
|
+
for (const key2 of [
|
|
220697
|
+
"allow",
|
|
220698
|
+
"deny",
|
|
220699
|
+
"ask",
|
|
220700
|
+
"alwaysAsk",
|
|
220701
|
+
"additionalDirectories"
|
|
220702
|
+
]) {
|
|
220703
|
+
const rules = permissions[key2];
|
|
220704
|
+
if (rules !== undefined && (!Array.isArray(rules) || rules.some((rule) => typeof rule !== "string"))) {
|
|
220705
|
+
throw new Error(`permissions.${key2} must be an array of strings`);
|
|
220706
|
+
}
|
|
220707
|
+
}
|
|
220708
|
+
for (const key2 of ["mode", "defaultMode"]) {
|
|
220709
|
+
const mode = permissions[key2];
|
|
220710
|
+
if (mode !== undefined && (typeof mode !== "string" || !migratePermissionMode(mode))) {
|
|
220711
|
+
throw new Error(`permissions.${key2} must be a valid permission mode`);
|
|
220712
|
+
}
|
|
220713
|
+
}
|
|
220714
|
+
}
|
|
220715
|
+
return settings;
|
|
220716
|
+
} catch (error4) {
|
|
220717
|
+
throw new Error(`Failed to parse permissions in ${path19}: ${getErrorMessage2(error4)}`);
|
|
220703
220718
|
}
|
|
220704
|
-
return signatures;
|
|
220705
|
-
}
|
|
220706
|
-
function signaturesEqual(a2, b3) {
|
|
220707
|
-
if (!a2 || !b3)
|
|
220708
|
-
return false;
|
|
220709
|
-
if (!a2.exists || !b3.exists)
|
|
220710
|
-
return a2.exists === b3.exists;
|
|
220711
|
-
return a2.mtimeMs === b3.mtimeMs && a2.size === b3.size && a2.hash === b3.hash;
|
|
220712
220719
|
}
|
|
220713
220720
|
function cachedEntryMatchesSources(entry, sources, signatures) {
|
|
220714
220721
|
if (entry.sources.length !== sources.length) {
|
|
@@ -220720,7 +220727,7 @@ function cachedEntryMatchesSources(entry, sources, signatures) {
|
|
|
220720
220727
|
}
|
|
220721
220728
|
}
|
|
220722
220729
|
for (const source of sources) {
|
|
220723
|
-
if (
|
|
220730
|
+
if (entry.signatures.get(source) !== signatures.get(source)) {
|
|
220724
220731
|
return false;
|
|
220725
220732
|
}
|
|
220726
220733
|
}
|
|
@@ -220791,7 +220798,15 @@ function resetPermissionLoaderCacheForTests() {
|
|
|
220791
220798
|
async function loadPermissions(workingDirectory = process.cwd()) {
|
|
220792
220799
|
const normalizedWorkingDirectory = resolve24(workingDirectory);
|
|
220793
220800
|
const sources = getPermissionSourcePaths(normalizedWorkingDirectory);
|
|
220794
|
-
const
|
|
220801
|
+
const settingsFiles = new Map;
|
|
220802
|
+
const signatures = new Map;
|
|
220803
|
+
for (const source of sources) {
|
|
220804
|
+
const content = readSettings(source);
|
|
220805
|
+
if (content === undefined)
|
|
220806
|
+
continue;
|
|
220807
|
+
settingsFiles.set(source, content);
|
|
220808
|
+
signatures.set(source, createHash8("sha256").update(content).digest("hex"));
|
|
220809
|
+
}
|
|
220795
220810
|
const cacheKey = normalizedWorkingDirectory;
|
|
220796
220811
|
const cached3 = permissionCache.get(cacheKey);
|
|
220797
220812
|
if (cached3 && cachedEntryMatchesSources(cached3, sources, signatures)) {
|
|
@@ -220805,16 +220820,10 @@ async function loadPermissions(workingDirectory = process.cwd()) {
|
|
|
220805
220820
|
alwaysAsk: [],
|
|
220806
220821
|
additionalDirectories: []
|
|
220807
220822
|
};
|
|
220808
|
-
for (const settingsPath of
|
|
220809
|
-
|
|
220810
|
-
|
|
220811
|
-
|
|
220812
|
-
const settings = JSON.parse(content);
|
|
220813
|
-
if (settings.permissions) {
|
|
220814
|
-
mergePermissions(merged, settings.permissions);
|
|
220815
|
-
}
|
|
220816
|
-
}
|
|
220817
|
-
} catch (_error) {}
|
|
220823
|
+
for (const [settingsPath, content] of settingsFiles) {
|
|
220824
|
+
const settings = parseSettings(content, settingsPath);
|
|
220825
|
+
if (settings.permissions)
|
|
220826
|
+
mergePermissions(merged, settings.permissions);
|
|
220818
220827
|
}
|
|
220819
220828
|
permissionCache.set(cacheKey, {
|
|
220820
220829
|
permissions: clonePermissions(merged),
|
|
@@ -220829,11 +220838,11 @@ async function loadPermissionMode(workingDirectory = process.cwd()) {
|
|
|
220829
220838
|
return permissions.mode ?? null;
|
|
220830
220839
|
}
|
|
220831
220840
|
function mergePermissions(target, source) {
|
|
220832
|
-
|
|
220833
|
-
|
|
220834
|
-
|
|
220841
|
+
const configuredMode = source.mode ?? source.defaultMode;
|
|
220842
|
+
if (configuredMode !== undefined) {
|
|
220843
|
+
const mode = migratePermissionMode(configuredMode);
|
|
220844
|
+
if (mode)
|
|
220835
220845
|
target.mode = mode;
|
|
220836
|
-
}
|
|
220837
220846
|
}
|
|
220838
220847
|
if (source.allow) {
|
|
220839
220848
|
target.allow = mergeRuleList(target.allow, source.allow);
|
|
@@ -220880,13 +220889,8 @@ async function savePermissionRule(rule, ruleType, scope, workingDirectory = proc
|
|
|
220880
220889
|
settingsPath = join56(normalizedWorkingDirectory, ".letta", "settings.local.json");
|
|
220881
220890
|
break;
|
|
220882
220891
|
}
|
|
220883
|
-
|
|
220884
|
-
|
|
220885
|
-
if (exists(settingsPath)) {
|
|
220886
|
-
const content = await readFile(settingsPath);
|
|
220887
|
-
settings = JSON.parse(content);
|
|
220888
|
-
}
|
|
220889
|
-
} catch (_error) {}
|
|
220892
|
+
const content = readSettings(settingsPath);
|
|
220893
|
+
const settings = content === undefined ? {} : parseSettings(content, settingsPath);
|
|
220890
220894
|
if (!settings.permissions) {
|
|
220891
220895
|
settings.permissions = {};
|
|
220892
220896
|
}
|
|
@@ -222732,7 +222736,7 @@ import {
|
|
|
222732
222736
|
existsSync as existsSync41,
|
|
222733
222737
|
readdirSync as readdirSync14,
|
|
222734
222738
|
realpathSync as realpathSync8,
|
|
222735
|
-
statSync as
|
|
222739
|
+
statSync as statSync17,
|
|
222736
222740
|
watch as watch2
|
|
222737
222741
|
} from "node:fs";
|
|
222738
222742
|
import { dirname as dirname28, relative as relative6, resolve as resolve26, sep as sep7 } from "node:path";
|
|
@@ -222741,7 +222745,7 @@ function defaultWatchFunction(path19, options, listener) {
|
|
|
222741
222745
|
}
|
|
222742
222746
|
function isDirectory(path19) {
|
|
222743
222747
|
try {
|
|
222744
|
-
return
|
|
222748
|
+
return statSync17(path19).isDirectory();
|
|
222745
222749
|
} catch {
|
|
222746
222750
|
return false;
|
|
222747
222751
|
}
|
|
@@ -223183,9 +223187,10 @@ async function resolveSharedMemorySkillsContext(options) {
|
|
|
223183
223187
|
...repository
|
|
223184
223188
|
}));
|
|
223185
223189
|
} else {
|
|
223190
|
+
const { getBackend: getBackend2 } = await Promise.resolve().then(() => (init_backend2(), exports_backend));
|
|
223186
223191
|
const { isLettaCloud: isLettaCloud2 } = await Promise.resolve().then(() => (init_memory_filesystem2(), exports_memory_filesystem));
|
|
223187
223192
|
try {
|
|
223188
|
-
if (!await isLettaCloud2()) {
|
|
223193
|
+
if (!getBackend2().capabilities.remoteMemfs || !await isLettaCloud2()) {
|
|
223189
223194
|
return { skillsDirs: [], errors: [] };
|
|
223190
223195
|
}
|
|
223191
223196
|
} catch {
|
|
@@ -223751,7 +223756,7 @@ import {
|
|
|
223751
223756
|
mkdirSync as mkdirSync35,
|
|
223752
223757
|
readdirSync as readdirSync15,
|
|
223753
223758
|
readFileSync as readFileSync38,
|
|
223754
|
-
statSync as
|
|
223759
|
+
statSync as statSync18,
|
|
223755
223760
|
unlinkSync as unlinkSync13,
|
|
223756
223761
|
writeFileSync as writeFileSync29
|
|
223757
223762
|
} from "node:fs";
|
|
@@ -223854,7 +223859,7 @@ function pruneBaselineFiles(dir, nowMs) {
|
|
|
223854
223859
|
for (const name of readdirSync15(dir)) {
|
|
223855
223860
|
const path19 = join61(dir, name);
|
|
223856
223861
|
try {
|
|
223857
|
-
const { mtimeMs } =
|
|
223862
|
+
const { mtimeMs } = statSync18(path19);
|
|
223858
223863
|
if (!name.endsWith(".json") || nowMs - mtimeMs > STALE_AFTER_MS) {
|
|
223859
223864
|
if (name.endsWith(".json") || nowMs - mtimeMs > 60000) {
|
|
223860
223865
|
unlinkSync13(path19);
|
|
@@ -224093,7 +224098,8 @@ async function sendMessageStream(conversationId, messages, opts = { streamTokens
|
|
|
224093
224098
|
async function sendMessageStreamWithBackend(backend3, conversationId, messages, opts = { streamTokens: true, background: true }, requestOptions = {
|
|
224094
224099
|
maxRetries: 0
|
|
224095
224100
|
}) {
|
|
224096
|
-
const
|
|
224101
|
+
const preparationStartedAt = performance.now();
|
|
224102
|
+
const requestStartTime = isTimingsEnabled() ? preparationStartedAt : undefined;
|
|
224097
224103
|
const requestStartedAtMs = Date.now();
|
|
224098
224104
|
const canonicalMessages = normalizeOutgoingApprovalMessages(messages, opts.approvalNormalization);
|
|
224099
224105
|
const scrubbedMessages = canonicalMessages.map((message) => {
|
|
@@ -224130,6 +224136,7 @@ async function sendMessageStreamWithBackend(backend3, conversationId, messages,
|
|
|
224130
224136
|
})();
|
|
224131
224137
|
const { clientTools, contextId } = preparedToolContext;
|
|
224132
224138
|
const executionRuntimeContext = getExecutionContextById(preparedToolContext.contextId)?.runtimeContext;
|
|
224139
|
+
const skillsStartedAt = performance.now();
|
|
224133
224140
|
const {
|
|
224134
224141
|
clientSkills: discoveredClientSkills,
|
|
224135
224142
|
errors: clientSkillDiscoveryErrors
|
|
@@ -224141,6 +224148,7 @@ async function sendMessageStreamWithBackend(backend3, conversationId, messages,
|
|
|
224141
224148
|
bundledSkills: executionRuntimeContext?.bundledSkills,
|
|
224142
224149
|
cloudSkillRepositories: executionRuntimeContext?.executionSettings?.cloud_skill_repositories
|
|
224143
224150
|
});
|
|
224151
|
+
const skillsDurationMs = Math.round(performance.now() - skillsStartedAt);
|
|
224144
224152
|
const resolvedConversationId = conversationId;
|
|
224145
224153
|
const responseStateScope = buildResponseStateScope(resolvedConversationId, opts.agentId ?? null);
|
|
224146
224154
|
const skillPlan = planClientSkillsRequest(backend3, { conversationId: resolvedConversationId, agentId: opts.agentId }, discoveredClientSkills);
|
|
@@ -224207,11 +224215,13 @@ async function sendMessageStreamWithBackend(backend3, conversationId, messages,
|
|
|
224207
224215
|
return `message:parts:${content.length}`;
|
|
224208
224216
|
}).join(",");
|
|
224209
224217
|
const firstOtid = normalizedMessages[0]?.otid;
|
|
224210
|
-
|
|
224218
|
+
const dispatchStartedAt = performance.now();
|
|
224219
|
+
debugLog("send-message-stream", "request_start conversation_id=%s agent_id=%s messages=%s otid=%s stream_tokens=%s background=%s max_retries=%s preparation_ms=%d client_skills_ms=%d", resolvedConversationId, opts.agentId ?? "none", messageSummary || "(empty)", firstOtid ?? "none", opts.streamTokens ?? true, opts.background ?? true, requestOptions.maxRetries ?? "default", Math.round(dispatchStartedAt - preparationStartedAt), skillsDurationMs);
|
|
224211
224220
|
let stream11;
|
|
224212
224221
|
const abortRelay = createStreamAbortRelay(requestOptions.signal);
|
|
224213
224222
|
let cloudApiShutdownRetries = 0;
|
|
224214
224223
|
while (true) {
|
|
224224
|
+
const attemptStartedAt = performance.now();
|
|
224215
224225
|
try {
|
|
224216
224226
|
stream11 = await backend3.createConversationMessageStream(resolvedConversationId, requestBody, {
|
|
224217
224227
|
...requestOptions,
|
|
@@ -224233,7 +224243,7 @@ async function sendMessageStreamWithBackend(backend3, conversationId, messages,
|
|
|
224233
224243
|
if (isCloudApiShutdownRejection(error4) && cloudApiShutdownRetries < CLOUD_API_SHUTDOWN_MAX_RETRIES) {
|
|
224234
224244
|
cloudApiShutdownRetries += 1;
|
|
224235
224245
|
const delayMs = getCloudApiShutdownRetryDelayMs(error4);
|
|
224236
|
-
debugWarn("send-message-stream", "request_retry conversation_id=%s otid=%s reason=cloud_api_shutting_down attempt=%d delay_ms=%d", resolvedConversationId, firstOtid ?? "none", cloudApiShutdownRetries, delayMs);
|
|
224246
|
+
debugWarn("send-message-stream", "request_retry conversation_id=%s otid=%s reason=cloud_api_shutting_down attempt=%d delay_ms=%d attempt_ms=%d", resolvedConversationId, firstOtid ?? "none", cloudApiShutdownRetries, delayMs, Math.round(performance.now() - attemptStartedAt));
|
|
224237
224247
|
try {
|
|
224238
224248
|
await waitForRetryDelay(delayMs, abortRelay?.signal ?? requestOptions.signal);
|
|
224239
224249
|
} catch (abortError2) {
|
|
@@ -224253,11 +224263,11 @@ async function sendMessageStreamWithBackend(backend3, conversationId, messages,
|
|
|
224253
224263
|
httpStatus: getBusyRecoveryHttpStatus(error4)
|
|
224254
224264
|
});
|
|
224255
224265
|
}
|
|
224256
|
-
debugWarn("send-message-stream", "request_error conversation_id=%s otid=%s status=%s error=%s", resolvedConversationId, firstOtid ?? "none", error4?.status ?? "none", error4 instanceof Error ? error4.message : String(error4));
|
|
224266
|
+
debugWarn("send-message-stream", "request_error conversation_id=%s otid=%s status=%s request_ms=%d error=%s", resolvedConversationId, firstOtid ?? "none", error4?.status ?? "none", Math.round(performance.now() - dispatchStartedAt), error4 instanceof Error ? error4.message : String(error4));
|
|
224257
224267
|
throw error4;
|
|
224258
224268
|
}
|
|
224259
224269
|
}
|
|
224260
|
-
debugLog("send-message-stream", "request_ok conversation_id=%s otid=%s", resolvedConversationId, firstOtid ?? "none");
|
|
224270
|
+
debugLog("send-message-stream", "request_ok conversation_id=%s otid=%s request_ms=%d", resolvedConversationId, firstOtid ?? "none", Math.round(performance.now() - dispatchStartedAt));
|
|
224261
224271
|
stream11 = traceBusyRecoveryStream(stream11, resolvedConversationId, firstOtid, requestOptions.signal, backend3);
|
|
224262
224272
|
abortRelay?.attach(stream11);
|
|
224263
224273
|
if (requestStartTime !== undefined) {
|
|
@@ -224704,21 +224714,23 @@ async function checkToolPermission(toolName2, toolArgs, workingDirectory, permis
|
|
|
224704
224714
|
const { checkPermissionWithHooks: checkPermissionWithHooks2 } = await Promise.resolve().then(() => (init_checker(), exports_checker));
|
|
224705
224715
|
const { loadPermissions: loadPermissions2 } = await Promise.resolve().then(() => (init_loader2(), exports_loader));
|
|
224706
224716
|
const context3 = toolContextIdArg ? getExecutionContextById(toolContextIdArg) : undefined;
|
|
224707
|
-
const
|
|
224717
|
+
const cwd2 = workingDirectory ?? context3?.workingDirectory ?? process.cwd();
|
|
224708
224718
|
const effectivePermissionModeState = permissionModeStateArg ?? context3?.permissionModeState;
|
|
224709
224719
|
const effectiveAgentId = agentIdArg ?? context3?.runtimeContext.agentId ?? undefined;
|
|
224710
224720
|
const modContext = context3?.modContext ?? buildModInvocationContext({
|
|
224711
224721
|
conversationId: context3?.runtimeContext.conversationId ?? null,
|
|
224712
224722
|
permissionMode: effectivePermissionModeState?.mode ?? null,
|
|
224713
|
-
workingDirectory:
|
|
224723
|
+
workingDirectory: cwd2
|
|
224714
224724
|
});
|
|
224715
|
-
const
|
|
224725
|
+
const rules = await loadPermissions2(cwd2).catch(getErrorMessage2);
|
|
224726
|
+
if (typeof rules === "string")
|
|
224727
|
+
return { decision: "deny", reason: rules, settingsError: rules };
|
|
224716
224728
|
return runWithRuntimeContext({
|
|
224717
224729
|
...context3?.runtimeContext ?? {},
|
|
224718
224730
|
...effectiveAgentId ? { agentId: effectiveAgentId } : {},
|
|
224719
|
-
workingDirectory:
|
|
224731
|
+
workingDirectory: cwd2,
|
|
224720
224732
|
permissionMode: effectivePermissionModeState?.mode
|
|
224721
|
-
}, () => checkPermissionWithHooks2(toolName2, toolArgs,
|
|
224733
|
+
}, () => checkPermissionWithHooks2(toolName2, toolArgs, rules, cwd2, effectivePermissionModeState, effectiveAgentId, context3?.modPermissions ?? getAvailableModPermissionsRegistry(modContext), context3?.modTools ?? getAvailableModToolsRegistry(modContext), {
|
|
224722
224734
|
conversationId: context3?.runtimeContext.conversationId ?? null,
|
|
224723
224735
|
modContext,
|
|
224724
224736
|
phase: "approval",
|
|
@@ -227031,7 +227043,9 @@ async function createScriptToolScope(parentAgentId, signal) {
|
|
|
227031
227043
|
return callServerTool(parentAgentId, serverTool, toolArgs, signal);
|
|
227032
227044
|
}
|
|
227033
227045
|
const toolCallId = `script-${randomUUID35()}`;
|
|
227034
|
-
const { decision } = await manager.checkToolPermission(toolName2, toolArgs, permissionCwd, permissionModeState && { ...permissionModeState }, parentAgentId ?? undefined, toolContextId, toolCallId);
|
|
227046
|
+
const { decision, settingsError } = await manager.checkToolPermission(toolName2, toolArgs, permissionCwd, permissionModeState && { ...permissionModeState }, parentAgentId ?? undefined, toolContextId, toolCallId);
|
|
227047
|
+
if (settingsError)
|
|
227048
|
+
throw new Error(settingsError);
|
|
227035
227049
|
if (decision !== "allow") {
|
|
227036
227050
|
throw new Error(decision === "deny" ? `${toolName2} is denied by permission rules.` : `${toolName2} needs approval, which a script cannot request; call it directly or add an allow rule.`);
|
|
227037
227051
|
}
|
|
@@ -229205,6 +229219,7 @@ function buildDeviceStatus(runtime, params) {
|
|
|
229205
229219
|
})();
|
|
229206
229220
|
const systemPromptDoctorState = agentId ? getSystemPromptDoctorState(agentId) : null;
|
|
229207
229221
|
const transport3 = listener.transport ?? listener.socket;
|
|
229222
|
+
const backgroundProcesses2 = buildBackgroundProcessSnapshot(agentId, conversationId);
|
|
229208
229223
|
return {
|
|
229209
229224
|
current_connection_id: listener.connectionId,
|
|
229210
229225
|
connection_name: listener.connectionName,
|
|
@@ -229217,7 +229232,8 @@ function buildDeviceStatus(runtime, params) {
|
|
|
229217
229232
|
...buildDeviceToolsetStatus(agentId, conversationId, conversationRuntime),
|
|
229218
229233
|
current_loaded_tools: conversationRuntime?.currentLoadedTools ?? [],
|
|
229219
229234
|
current_available_skills: conversationRuntime?.currentAvailableSkills ?? [],
|
|
229220
|
-
background_processes:
|
|
229235
|
+
background_processes: backgroundProcesses2,
|
|
229236
|
+
active_non_persistent_monitor_count: countNonPersistentMonitors(backgroundProcesses2),
|
|
229221
229237
|
pending_control_requests: interruptedCacheActive ? [] : getPendingControlRequests(listener, scope),
|
|
229222
229238
|
experiments: experimentManager.list(),
|
|
229223
229239
|
memory_directory: agentId ? getScopedMemoryFilesystemRoot(agentId) : null,
|
|
@@ -232365,7 +232381,7 @@ var require_scan = __commonJS((exports, module) => {
|
|
|
232365
232381
|
|
|
232366
232382
|
// node_modules/picomatch/lib/parse.js
|
|
232367
232383
|
var require_parse3 = __commonJS((exports, module) => {
|
|
232368
|
-
var
|
|
232384
|
+
var constants7 = require_constants2();
|
|
232369
232385
|
var utils = require_utils2();
|
|
232370
232386
|
var {
|
|
232371
232387
|
MAX_LENGTH,
|
|
@@ -232373,7 +232389,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
232373
232389
|
REGEX_NON_SPECIAL_CHARS,
|
|
232374
232390
|
REGEX_SPECIAL_CHARS_BACKREF,
|
|
232375
232391
|
REPLACEMENTS
|
|
232376
|
-
} =
|
|
232392
|
+
} = constants7;
|
|
232377
232393
|
var expandRange = (args, options) => {
|
|
232378
232394
|
if (typeof options.expandRange === "function") {
|
|
232379
232395
|
return options.expandRange(...args, options);
|
|
@@ -232405,8 +232421,8 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
232405
232421
|
const tokens = [bos];
|
|
232406
232422
|
const capture = opts.capture ? "" : "?:";
|
|
232407
232423
|
const win327 = utils.isWindows(options);
|
|
232408
|
-
const PLATFORM_CHARS =
|
|
232409
|
-
const EXTGLOB_CHARS =
|
|
232424
|
+
const PLATFORM_CHARS = constants7.globChars(win327);
|
|
232425
|
+
const EXTGLOB_CHARS = constants7.extglobChars(PLATFORM_CHARS);
|
|
232410
232426
|
const {
|
|
232411
232427
|
DOT_LITERAL,
|
|
232412
232428
|
PLUS_LITERAL,
|
|
@@ -233088,7 +233104,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
233088
233104
|
NO_DOTS_SLASH,
|
|
233089
233105
|
STAR,
|
|
233090
233106
|
START_ANCHOR
|
|
233091
|
-
} =
|
|
233107
|
+
} = constants7.globChars(win327);
|
|
233092
233108
|
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
233093
233109
|
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
233094
233110
|
const capture = opts.capture ? "" : "?:";
|
|
@@ -233147,7 +233163,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
233147
233163
|
var scan = require_scan();
|
|
233148
233164
|
var parse6 = require_parse3();
|
|
233149
233165
|
var utils = require_utils2();
|
|
233150
|
-
var
|
|
233166
|
+
var constants7 = require_constants2();
|
|
233151
233167
|
var isObject5 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
233152
233168
|
var picomatch = (glob3, options, returnState = false) => {
|
|
233153
233169
|
if (Array.isArray(glob3)) {
|
|
@@ -233278,7 +233294,7 @@ var require_picomatch = __commonJS((exports, module) => {
|
|
|
233278
233294
|
return /$^/;
|
|
233279
233295
|
}
|
|
233280
233296
|
};
|
|
233281
|
-
picomatch.constants =
|
|
233297
|
+
picomatch.constants = constants7;
|
|
233282
233298
|
module.exports = picomatch;
|
|
233283
233299
|
});
|
|
233284
233300
|
|
|
@@ -234569,6 +234585,14 @@ async function startScriptMonitor(args, hooks) {
|
|
|
234569
234585
|
await releaseToolContext(toolContextId);
|
|
234570
234586
|
throw error4;
|
|
234571
234587
|
});
|
|
234588
|
+
if (args.signal?.aborted) {
|
|
234589
|
+
try {
|
|
234590
|
+
await toolScope.cleanup();
|
|
234591
|
+
} finally {
|
|
234592
|
+
await releaseToolContext(toolContextId);
|
|
234593
|
+
}
|
|
234594
|
+
args.signal.throwIfAborted();
|
|
234595
|
+
}
|
|
234572
234596
|
const taskId = args.taskId ?? getNextMonitorId();
|
|
234573
234597
|
const outputFile = createBackgroundOutputFile(taskId);
|
|
234574
234598
|
const output = hooks.createOutput(outputFile);
|
|
@@ -234649,7 +234673,6 @@ async function startScriptMonitor(args, hooks) {
|
|
|
234649
234673
|
`);
|
|
234650
234674
|
if (processState.status !== "running")
|
|
234651
234675
|
return;
|
|
234652
|
-
hooks.markFinished(taskId, processState, status, status === "completed" ? 0 : 1);
|
|
234653
234676
|
const durationMs = Date.now() - (processState.startTime?.getTime() ?? 0);
|
|
234654
234677
|
addToMessageQueue({
|
|
234655
234678
|
kind: "task_notification",
|
|
@@ -234664,6 +234687,7 @@ async function startScriptMonitor(args, hooks) {
|
|
|
234664
234687
|
...scope,
|
|
234665
234688
|
...actingUserId !== undefined ? { actingUserId } : {}
|
|
234666
234689
|
});
|
|
234690
|
+
hooks.markFinished(taskId, processState, status, status === "completed" ? 0 : 1);
|
|
234667
234691
|
};
|
|
234668
234692
|
const stopped = new Promise((_resolve, reject2) => {
|
|
234669
234693
|
controller.signal.addEventListener("abort", () => reject2(controller.signal.reason), { once: true });
|
|
@@ -235254,7 +235278,7 @@ function queueCommandCompletion(params) {
|
|
|
235254
235278
|
} = params;
|
|
235255
235279
|
if (processState.completionNotificationSuppressed)
|
|
235256
235280
|
return;
|
|
235257
|
-
const status =
|
|
235281
|
+
const status = exitCode === 0 ? "completed" : "failed";
|
|
235258
235282
|
const exitSuffix = exitCode === null ? "" : ` (exit ${exitCode})`;
|
|
235259
235283
|
const summary = status === "failed" ? `Monitor "${description}" script failed${exitSuffix}` : producedOutput ? `Monitor "${description}" stream ended` : `Monitor "${description}" ended without producing output${exitSuffix}`;
|
|
235260
235284
|
const durationMs = processState.startTime ? Math.max(0, Date.now() - processState.startTime.getTime()) : undefined;
|
|
@@ -235280,7 +235304,7 @@ function markMonitorFinished(taskId, processState, status, exitCode) {
|
|
|
235280
235304
|
persistMonitorState(processState);
|
|
235281
235305
|
cancelMonitorBackup(taskId);
|
|
235282
235306
|
scrubCompletedBackgroundOutput(processState);
|
|
235283
|
-
notifyBackgroundProcessStateChanged(processState.runtimeScope);
|
|
235307
|
+
queueMicrotask(() => notifyBackgroundProcessStateChanged(processState.runtimeScope));
|
|
235284
235308
|
scheduleBackgroundProcessCleanup(taskId);
|
|
235285
235309
|
}
|
|
235286
235310
|
function startCommandMonitor(args) {
|
|
@@ -235415,7 +235439,6 @@ function startCommandMonitor(args) {
|
|
|
235415
235439
|
`);
|
|
235416
235440
|
if (processState.status !== "running")
|
|
235417
235441
|
return;
|
|
235418
|
-
markMonitorFinished(taskId, processState, exitCode === 0 ? "completed" : "failed", exitCode);
|
|
235419
235442
|
queueCommandCompletion({
|
|
235420
235443
|
taskId,
|
|
235421
235444
|
description: args.description,
|
|
@@ -235425,6 +235448,7 @@ function startCommandMonitor(args) {
|
|
|
235425
235448
|
exitCode,
|
|
235426
235449
|
producedOutput
|
|
235427
235450
|
});
|
|
235451
|
+
markMonitorFinished(taskId, processState, exitCode === 0 ? "completed" : "failed", exitCode);
|
|
235428
235452
|
}, (error4) => {
|
|
235429
235453
|
if (backgroundProcesses.get(taskId) !== processState)
|
|
235430
235454
|
return;
|
|
@@ -235451,9 +235475,6 @@ function startCommandMonitor(args) {
|
|
|
235451
235475
|
output.append(`
|
|
235452
235476
|
[error] ${message}
|
|
235453
235477
|
`);
|
|
235454
|
-
}
|
|
235455
|
-
markMonitorFinished(taskId, processState, shellError.killed ? "expired" : "failed", null);
|
|
235456
|
-
if (!shellError.killed) {
|
|
235457
235478
|
queueCommandCompletion({
|
|
235458
235479
|
taskId,
|
|
235459
235480
|
description: args.description,
|
|
@@ -235464,6 +235485,7 @@ function startCommandMonitor(args) {
|
|
|
235464
235485
|
producedOutput
|
|
235465
235486
|
});
|
|
235466
235487
|
}
|
|
235488
|
+
markMonitorFinished(taskId, processState, shellError.killed ? "expired" : "failed", null);
|
|
235467
235489
|
});
|
|
235468
235490
|
return buildMonitorResult(taskId, args.persistent ? 0 : args.timeout_ms, args.persistent, outputFile);
|
|
235469
235491
|
}
|
|
@@ -235651,7 +235673,8 @@ async function startScriptSource(args) {
|
|
|
235651
235673
|
args: args.args,
|
|
235652
235674
|
timeout_ms: args.timeout_ms,
|
|
235653
235675
|
persistent: args.persistent,
|
|
235654
|
-
parentScope: args.parentScope
|
|
235676
|
+
parentScope: args.parentScope,
|
|
235677
|
+
signal: args.signal
|
|
235655
235678
|
}, {
|
|
235656
235679
|
createOutput: (path28) => new MonitorOutputWriter(path28),
|
|
235657
235680
|
queueEvent: queueMonitorEvent,
|
|
@@ -235742,18 +235765,31 @@ async function monitor(args) {
|
|
|
235742
235765
|
${note}`;
|
|
235743
235766
|
return result3;
|
|
235744
235767
|
}
|
|
235768
|
+
function stopMonitorOnShutdown(processState) {
|
|
235769
|
+
processState.completionNotificationSuppressed = true;
|
|
235770
|
+
processState.monitorEndStatus = isManagedCloudRuntime() ? "paused" : "stopped";
|
|
235771
|
+
processState.status = "failed";
|
|
235772
|
+
try {
|
|
235773
|
+
processState.process.kill("SIGKILL");
|
|
235774
|
+
} catch {}
|
|
235775
|
+
}
|
|
235776
|
+
function retireFiniteMonitors(ownsScope) {
|
|
235777
|
+
for (const [taskId, processState] of backgroundProcesses) {
|
|
235778
|
+
const scope = processState.runtimeScope;
|
|
235779
|
+
if (processState.kind === "monitor" && processState.status === "running" && processState.persistent !== true && scope && ownsScope(scope.agentId, scope.conversationId)) {
|
|
235780
|
+
stopMonitorOnShutdown(processState);
|
|
235781
|
+
cancelMonitorBackup(taskId);
|
|
235782
|
+
persistMonitorState(processState);
|
|
235783
|
+
scheduleBackgroundProcessCleanup(taskId);
|
|
235784
|
+
}
|
|
235785
|
+
}
|
|
235786
|
+
}
|
|
235745
235787
|
function stopMonitorsForProcessExit() {
|
|
235746
235788
|
detachMonitorBackupsForProcessExit();
|
|
235747
235789
|
for (const processState of backgroundProcesses.values()) {
|
|
235748
|
-
if (processState.kind
|
|
235749
|
-
|
|
235790
|
+
if (processState.kind === "monitor" && processState.status === "running") {
|
|
235791
|
+
stopMonitorOnShutdown(processState);
|
|
235750
235792
|
}
|
|
235751
|
-
processState.completionNotificationSuppressed = true;
|
|
235752
|
-
processState.monitorEndStatus = isManagedCloudRuntime() ? "paused" : "stopped";
|
|
235753
|
-
processState.status = "failed";
|
|
235754
|
-
try {
|
|
235755
|
-
processState.process.kill("SIGKILL");
|
|
235756
|
-
} catch {}
|
|
235757
235793
|
}
|
|
235758
235794
|
}
|
|
235759
235795
|
async function shutdownMonitors() {
|
|
@@ -236760,7 +236796,7 @@ async function waitForAcceptedSuperRun(receipt, signal, deps) {
|
|
|
236760
236796
|
idleNotified = false;
|
|
236761
236797
|
return;
|
|
236762
236798
|
}
|
|
236763
|
-
const count = status.active_bash_count ?? 0;
|
|
236799
|
+
const count = (status.active_bash_count ?? 0) + (status.active_non_persistent_monitor_count ?? 0);
|
|
236764
236800
|
if (idleNotified || status.loop_state?.status !== "WAITING_ON_INPUT" || count <= 0)
|
|
236765
236801
|
return;
|
|
236766
236802
|
const run = await deps.run(runId, readSignal);
|
|
@@ -241003,7 +241039,7 @@ class CodexAppServerClient {
|
|
|
241003
241039
|
await this.request("initialize", {
|
|
241004
241040
|
clientInfo: {
|
|
241005
241041
|
name: "letta-code",
|
|
241006
|
-
version: "0.34.73-app-server.
|
|
241042
|
+
version: "0.34.73-app-server.1"
|
|
241007
241043
|
},
|
|
241008
241044
|
capabilities: null
|
|
241009
241045
|
});
|
|
@@ -241838,11 +241874,11 @@ var init_cursor_session = __esm(() => {
|
|
|
241838
241874
|
});
|
|
241839
241875
|
|
|
241840
241876
|
// src/agent/parent-memory-note.ts
|
|
241841
|
-
import { statSync as
|
|
241877
|
+
import { statSync as statSync19 } from "node:fs";
|
|
241842
241878
|
function buildParentMemoryNote(parentAgentId) {
|
|
241843
241879
|
const directory = getScopedMemoryFilesystemRoot(parentAgentId);
|
|
241844
241880
|
try {
|
|
241845
|
-
if (!
|
|
241881
|
+
if (!statSync19(directory).isDirectory())
|
|
241846
241882
|
return;
|
|
241847
241883
|
} catch {
|
|
241848
241884
|
return;
|
|
@@ -247100,7 +247136,7 @@ var init_subagent_computer = __esm(() => {
|
|
|
247100
247136
|
});
|
|
247101
247137
|
|
|
247102
247138
|
// src/tools/impl/kill-bash.ts
|
|
247103
|
-
function killBackgroundProcess(shell_id) {
|
|
247139
|
+
function killBackgroundProcess(shell_id, onMonitorStopped) {
|
|
247104
247140
|
const proc = backgroundProcesses.get(shell_id);
|
|
247105
247141
|
const retainsEntry = proc?.kind === "monitor" || proc?.kind === "workflow" || proc?.kind === "tool";
|
|
247106
247142
|
if (!proc || retainsEntry && proc.status !== "running") {
|
|
@@ -247125,14 +247161,22 @@ function killBackgroundProcess(shell_id) {
|
|
|
247125
247161
|
} else {
|
|
247126
247162
|
backgroundProcesses.delete(shell_id);
|
|
247127
247163
|
}
|
|
247128
|
-
|
|
247129
|
-
|
|
247164
|
+
if (proc.kind !== "monitor") {
|
|
247165
|
+
notifyBackgroundProcessStateChanged(proc.runtimeScope);
|
|
247166
|
+
return true;
|
|
247167
|
+
}
|
|
247130
247168
|
} catch {
|
|
247131
247169
|
proc.monitorEndStatus = undefined;
|
|
247132
247170
|
proc.status = previousStatus;
|
|
247133
247171
|
proc.completionNotificationSuppressed = previousNotificationSuppression;
|
|
247134
247172
|
return false;
|
|
247135
247173
|
}
|
|
247174
|
+
try {
|
|
247175
|
+
onMonitorStopped?.();
|
|
247176
|
+
} finally {
|
|
247177
|
+
queueMicrotask(() => notifyBackgroundProcessStateChanged(proc.runtimeScope));
|
|
247178
|
+
}
|
|
247179
|
+
return true;
|
|
247136
247180
|
}
|
|
247137
247181
|
var init_kill_bash = __esm(() => {
|
|
247138
247182
|
init_monitor_backup();
|
|
@@ -248806,7 +248850,8 @@ var init_send_agent_message = __esm(() => {
|
|
|
248806
248850
|
});
|
|
248807
248851
|
|
|
248808
248852
|
// src/helpers/working-directory.ts
|
|
248809
|
-
import {
|
|
248853
|
+
import { constants as constants7 } from "node:fs";
|
|
248854
|
+
import { access as access2, realpath as realpath5, stat as stat12 } from "node:fs/promises";
|
|
248810
248855
|
import { homedir as homedir19 } from "node:os";
|
|
248811
248856
|
import path30 from "node:path";
|
|
248812
248857
|
function expandHome(value) {
|
|
@@ -248821,11 +248866,25 @@ function expandHome(value) {
|
|
|
248821
248866
|
async function resolveWorkingDirectory(requestedPath, currentWorkingDirectory) {
|
|
248822
248867
|
const expanded = expandHome(requestedPath);
|
|
248823
248868
|
const resolved = path30.isAbsolute(expanded) ? expanded : path30.resolve(currentWorkingDirectory, expanded);
|
|
248824
|
-
|
|
248869
|
+
return resolveTraversableDirectory(resolved);
|
|
248870
|
+
}
|
|
248871
|
+
async function resolveTraversableDirectory(resolvedPath) {
|
|
248872
|
+
const normalized = await realpath5(resolvedPath);
|
|
248825
248873
|
const stats = await stat12(normalized);
|
|
248826
248874
|
if (!stats.isDirectory()) {
|
|
248827
248875
|
throw new Error(`Not a directory: ${normalized}`);
|
|
248828
248876
|
}
|
|
248877
|
+
if (process.platform !== "win32") {
|
|
248878
|
+
try {
|
|
248879
|
+
await access2(normalized, constants7.X_OK);
|
|
248880
|
+
} catch (error4) {
|
|
248881
|
+
const code = error4?.code;
|
|
248882
|
+
if (code === "EACCES" || code === "EPERM") {
|
|
248883
|
+
throw new Error(`Permission denied: cannot traverse directory ${normalized}`, { cause: error4 });
|
|
248884
|
+
}
|
|
248885
|
+
throw error4;
|
|
248886
|
+
}
|
|
248887
|
+
}
|
|
248829
248888
|
return normalized;
|
|
248830
248889
|
}
|
|
248831
248890
|
var init_working_directory = () => {};
|
|
@@ -249361,6 +249420,51 @@ var init_view_image = __esm(() => {
|
|
|
249361
249420
|
]);
|
|
249362
249421
|
});
|
|
249363
249422
|
|
|
249423
|
+
// src/tools/schemas/WatchPR.json
|
|
249424
|
+
var WatchPR_default2;
|
|
249425
|
+
var init_WatchPR2 = __esm(() => {
|
|
249426
|
+
WatchPR_default2 = {
|
|
249427
|
+
type: "object",
|
|
249428
|
+
properties: {
|
|
249429
|
+
url: {
|
|
249430
|
+
type: "string",
|
|
249431
|
+
description: "Open github.com pull request URL ending at the PR number, for example https://github.com/owner/repo/pull/123. Remove sub-page suffixes such as /files or /commits. Also accepts https://github.com/owner/repo/actions/runs/123. Required unless `resume` is set."
|
|
249432
|
+
},
|
|
249433
|
+
notify_on: {
|
|
249434
|
+
type: "array",
|
|
249435
|
+
minItems: 1,
|
|
249436
|
+
items: {
|
|
249437
|
+
type: "string",
|
|
249438
|
+
enum: [
|
|
249439
|
+
"merged",
|
|
249440
|
+
"closed",
|
|
249441
|
+
"conflict",
|
|
249442
|
+
"checks_done",
|
|
249443
|
+
"review",
|
|
249444
|
+
"comment",
|
|
249445
|
+
"push",
|
|
249446
|
+
"state",
|
|
249447
|
+
"checks"
|
|
249448
|
+
]
|
|
249449
|
+
},
|
|
249450
|
+
description: "PR events to report; omitted reports all. checks_done reports when no checks remain pending, including pass/fail. Workflow runs always report status and completion."
|
|
249451
|
+
},
|
|
249452
|
+
note: {
|
|
249453
|
+
type: "string",
|
|
249454
|
+
maxLength: 2000,
|
|
249455
|
+
description: "Optional note to your future self, not a script: why you are watching, what you planned, or which tracker or follow-up depends on the result. Re-check current state before acting because the situation or people's wishes may have changed."
|
|
249456
|
+
},
|
|
249457
|
+
resume: {
|
|
249458
|
+
type: "string",
|
|
249459
|
+
description: "Resume a paused monitor by its saved monitor id. Omit the other arguments."
|
|
249460
|
+
}
|
|
249461
|
+
},
|
|
249462
|
+
additionalProperties: false,
|
|
249463
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
249464
|
+
required: []
|
|
249465
|
+
};
|
|
249466
|
+
});
|
|
249467
|
+
|
|
249364
249468
|
// src/tools/impl/github-pull-request-query.ts
|
|
249365
249469
|
var GITHUB_PULL_REQUEST_QUERY = `
|
|
249366
249470
|
query(
|
|
@@ -250590,6 +250694,7 @@ async function startCloudPullRequestWatch(args, deps = {}) {
|
|
|
250590
250694
|
if (typeof args.url !== "string")
|
|
250591
250695
|
throw new Error("WatchPR url is required");
|
|
250592
250696
|
const ref = parseGitHubPullRequestUrl(args.url);
|
|
250697
|
+
const note = args.note?.trim();
|
|
250593
250698
|
let created;
|
|
250594
250699
|
try {
|
|
250595
250700
|
created = await request4("POST", path32, {
|
|
@@ -250601,6 +250706,7 @@ async function startCloudPullRequestWatch(args, deps = {}) {
|
|
|
250601
250706
|
number: ref.number,
|
|
250602
250707
|
...args.notify_on && { notify_on: args.notify_on }
|
|
250603
250708
|
},
|
|
250709
|
+
...note && { note },
|
|
250604
250710
|
timeout_ms: getMonitorMaxTimeoutMs(),
|
|
250605
250711
|
...args.toolCallId && { tool_call_id: args.toolCallId }
|
|
250606
250712
|
}, actingUserRequestOptions(scope.actingUserId));
|
|
@@ -250734,6 +250840,10 @@ ${text2}`;
|
|
|
250734
250840
|
}
|
|
250735
250841
|
}
|
|
250736
250842
|
async function watch_pr(args, deps = {}) {
|
|
250843
|
+
const maxNoteLength = WatchPR_default2.properties.note.maxLength;
|
|
250844
|
+
if (args.note !== undefined && (typeof args.note !== "string" || [...args.note].length > maxNoteLength)) {
|
|
250845
|
+
throw new Error(`WatchPR note must be a string of at most ${maxNoteLength} characters.`);
|
|
250846
|
+
}
|
|
250737
250847
|
const cloud = await startCloudPullRequestWatch(args);
|
|
250738
250848
|
if (cloud)
|
|
250739
250849
|
return cloud;
|
|
@@ -250748,6 +250858,7 @@ async function watch_pr(args, deps = {}) {
|
|
|
250748
250858
|
signal: args.signal
|
|
250749
250859
|
};
|
|
250750
250860
|
}
|
|
250861
|
+
const note = typeof args.note === "string" ? args.note.trim() : "";
|
|
250751
250862
|
args.signal?.throwIfAborted();
|
|
250752
250863
|
if (typeof args.url !== "string") {
|
|
250753
250864
|
throw new Error("WatchPR url is required");
|
|
@@ -250808,6 +250919,7 @@ async function watch_pr(args, deps = {}) {
|
|
|
250808
250919
|
timeoutMs: persistent ? 0 : getMonitorMaxTimeoutMs(),
|
|
250809
250920
|
args: {
|
|
250810
250921
|
url: args.url,
|
|
250922
|
+
...note && { note },
|
|
250811
250923
|
...args.notify_on ? { notify_on: args.notify_on } : {}
|
|
250812
250924
|
},
|
|
250813
250925
|
command: ref.url,
|
|
@@ -250830,16 +250942,19 @@ ${describe2(initial2)}${changesSincePreviousWatch}
|
|
|
250830
250942
|
let processState;
|
|
250831
250943
|
const maxTimeoutMs = resumeRecord?.expires_at ? Math.max(1, Date.parse(resumeRecord.expires_at) - Date.now()) : getMonitorMaxTimeoutMs();
|
|
250832
250944
|
let timeout;
|
|
250945
|
+
const notify2 = (event) => {
|
|
250946
|
+
queueMonitorEvent({
|
|
250947
|
+
taskId,
|
|
250948
|
+
event: note ? `${event}
|
|
250949
|
+
|
|
250950
|
+
Note from when this watch was created (re-check current state before acting, as plans may have changed): ${note}` : event,
|
|
250951
|
+
scope,
|
|
250952
|
+
actingUserId,
|
|
250953
|
+
secrets: secrets2
|
|
250954
|
+
});
|
|
250955
|
+
};
|
|
250833
250956
|
const events = createMonitorEventStream({
|
|
250834
|
-
emit
|
|
250835
|
-
queueMonitorEvent({
|
|
250836
|
-
taskId,
|
|
250837
|
-
event,
|
|
250838
|
-
scope,
|
|
250839
|
-
actingUserId,
|
|
250840
|
-
secrets: secrets2
|
|
250841
|
-
});
|
|
250842
|
-
},
|
|
250957
|
+
emit: notify2,
|
|
250843
250958
|
stopSource() {
|
|
250844
250959
|
if (!processState || processState.status !== "running")
|
|
250845
250960
|
return;
|
|
@@ -250899,7 +251014,7 @@ ${describe2(initial2)}${changesSincePreviousWatch}
|
|
|
250899
251014
|
output.append(`
|
|
250900
251015
|
${event}
|
|
250901
251016
|
`);
|
|
250902
|
-
|
|
251017
|
+
notify2(event);
|
|
250903
251018
|
processState.completionNotificationSuppressed = true;
|
|
250904
251019
|
markMonitorFinished(taskId, processState, "expired", null);
|
|
250905
251020
|
processState.process.kill();
|
|
@@ -251021,6 +251136,7 @@ var init_watch_pr = __esm(() => {
|
|
|
251021
251136
|
init_monitors();
|
|
251022
251137
|
init_manager();
|
|
251023
251138
|
init_runtime_context();
|
|
251139
|
+
init_WatchPR2();
|
|
251024
251140
|
init_secret_substitution();
|
|
251025
251141
|
init_settings_path();
|
|
251026
251142
|
init_task_notifications();
|
|
@@ -253005,46 +253121,6 @@ var init_Wake2 = __esm(() => {
|
|
|
253005
253121
|
};
|
|
253006
253122
|
});
|
|
253007
253123
|
|
|
253008
|
-
// src/tools/schemas/WatchPR.json
|
|
253009
|
-
var WatchPR_default2;
|
|
253010
|
-
var init_WatchPR2 = __esm(() => {
|
|
253011
|
-
WatchPR_default2 = {
|
|
253012
|
-
type: "object",
|
|
253013
|
-
properties: {
|
|
253014
|
-
url: {
|
|
253015
|
-
type: "string",
|
|
253016
|
-
description: "Open github.com pull request URL ending at the PR number, for example https://github.com/owner/repo/pull/123. Remove sub-page suffixes such as /files or /commits. Also accepts https://github.com/owner/repo/actions/runs/123. Required unless `resume` is set."
|
|
253017
|
-
},
|
|
253018
|
-
notify_on: {
|
|
253019
|
-
type: "array",
|
|
253020
|
-
minItems: 1,
|
|
253021
|
-
items: {
|
|
253022
|
-
type: "string",
|
|
253023
|
-
enum: [
|
|
253024
|
-
"merged",
|
|
253025
|
-
"closed",
|
|
253026
|
-
"conflict",
|
|
253027
|
-
"checks_done",
|
|
253028
|
-
"review",
|
|
253029
|
-
"comment",
|
|
253030
|
-
"push",
|
|
253031
|
-
"state",
|
|
253032
|
-
"checks"
|
|
253033
|
-
]
|
|
253034
|
-
},
|
|
253035
|
-
description: "PR events to report; omitted reports all. checks_done reports when no checks remain pending, including pass/fail. Workflow runs always report status and completion."
|
|
253036
|
-
},
|
|
253037
|
-
resume: {
|
|
253038
|
-
type: "string",
|
|
253039
|
-
description: "Resume a paused monitor by its saved monitor id. Omit the other arguments."
|
|
253040
|
-
}
|
|
253041
|
-
},
|
|
253042
|
-
additionalProperties: false,
|
|
253043
|
-
$schema: "http://json-schema.org/draft-07/schema#",
|
|
253044
|
-
required: []
|
|
253045
|
-
};
|
|
253046
|
-
});
|
|
253047
|
-
|
|
253048
253124
|
// src/tools/schemas/Workflow.json
|
|
253049
253125
|
var Workflow_default2;
|
|
253050
253126
|
var init_Workflow2 = __esm(() => {
|
|
@@ -253751,7 +253827,7 @@ import {
|
|
|
253751
253827
|
readdirSync as readdirSync19,
|
|
253752
253828
|
readFileSync as readFileSync45,
|
|
253753
253829
|
rmSync as rmSync19,
|
|
253754
|
-
statSync as
|
|
253830
|
+
statSync as statSync20,
|
|
253755
253831
|
writeFileSync as writeFileSync36
|
|
253756
253832
|
} from "node:fs";
|
|
253757
253833
|
import { join as join81 } from "node:path";
|
|
@@ -254070,11 +254146,11 @@ function createRecoveryLineageSidecarAccess(params) {
|
|
|
254070
254146
|
ownerIsAlive = error4.code !== "ESRCH";
|
|
254071
254147
|
}
|
|
254072
254148
|
}
|
|
254073
|
-
const ageMs = Date.now() -
|
|
254149
|
+
const ageMs = Date.now() - statSync20(join81(params.directory, file)).mtimeMs;
|
|
254074
254150
|
if (!ownerIsCurrentWriter && (!ownerIsAlive && ageMs >= staleTemporaryAgeMs || ageMs >= maximumTemporaryAgeMs)) {
|
|
254075
254151
|
const release = acquireDurableFileLock(join81(params.directory, mainFile), { waitMs: params.lockWaitMs });
|
|
254076
254152
|
try {
|
|
254077
|
-
const currentAgeMs = Date.now() -
|
|
254153
|
+
const currentAgeMs = Date.now() - statSync20(join81(params.directory, file)).mtimeMs;
|
|
254078
254154
|
if (!ownerIsCurrentWriter && (!ownerIsAlive && currentAgeMs >= staleTemporaryAgeMs || currentAgeMs >= maximumTemporaryAgeMs)) {
|
|
254079
254155
|
rmSync19(join81(params.directory, file), { force: true });
|
|
254080
254156
|
params.syncDirectory(params.directory);
|
|
@@ -256609,7 +256685,7 @@ import {
|
|
|
256609
256685
|
mkdirSync as mkdirSync42,
|
|
256610
256686
|
openSync as openSync11,
|
|
256611
256687
|
readFileSync as readFileSync47,
|
|
256612
|
-
statSync as
|
|
256688
|
+
statSync as statSync21,
|
|
256613
256689
|
unlinkSync as unlinkSync15,
|
|
256614
256690
|
writeFileSync as writeFileSync38
|
|
256615
256691
|
} from "node:fs";
|
|
@@ -256749,7 +256825,7 @@ function validateDurableStore(value) {
|
|
|
256749
256825
|
function readDurableStore(path33) {
|
|
256750
256826
|
if (!existsSync51(path33))
|
|
256751
256827
|
return emptyDurableStore();
|
|
256752
|
-
const size2 =
|
|
256828
|
+
const size2 = statSync21(path33).size;
|
|
256753
256829
|
if (size2 > MAX_INPUT_DISPOSITION_STORE_BYTES) {
|
|
256754
256830
|
throw new Error("Accepted-input disposition store exceeds its size limit");
|
|
256755
256831
|
}
|
|
@@ -264126,6 +264202,11 @@ function installExternalToolBridge(runtime, options) {
|
|
|
264126
264202
|
}
|
|
264127
264203
|
});
|
|
264128
264204
|
}
|
|
264205
|
+
function isRemoteExternalTool(toolName2, contextId) {
|
|
264206
|
+
const context3 = contextId ? getExecutionContextById(contextId) : undefined;
|
|
264207
|
+
const external3 = context3?.externalTools.get(toolName2);
|
|
264208
|
+
return Boolean(external3 && !external3.executor && !context3?.modTools.has(toolName2));
|
|
264209
|
+
}
|
|
264129
264210
|
function registerRuntimeExternalTools(runtime, connectionId, runtimeScope, groups, toolPolicy) {
|
|
264130
264211
|
const resolvedGroups = groups ?? [];
|
|
264131
264212
|
if (resolvedGroups.some((group) => Object.hasOwn(group, "scope_id"))) {
|
|
@@ -277988,7 +278069,7 @@ ${lanes.join(`
|
|
|
277988
278069
|
return process.memoryUsage().heapUsed;
|
|
277989
278070
|
},
|
|
277990
278071
|
getFileSize(path35) {
|
|
277991
|
-
const stat13 =
|
|
278072
|
+
const stat13 = statSync22(path35);
|
|
277992
278073
|
if (stat13 == null ? undefined : stat13.isFile()) {
|
|
277993
278074
|
return stat13.size;
|
|
277994
278075
|
}
|
|
@@ -278031,7 +278112,7 @@ ${lanes.join(`
|
|
|
278031
278112
|
}
|
|
278032
278113
|
};
|
|
278033
278114
|
return nodeSystem;
|
|
278034
|
-
function
|
|
278115
|
+
function statSync22(path35) {
|
|
278035
278116
|
try {
|
|
278036
278117
|
return _fs.statSync(path35, statSyncOptions);
|
|
278037
278118
|
} catch {
|
|
@@ -278083,7 +278164,7 @@ ${lanes.join(`
|
|
|
278083
278164
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
278084
278165
|
var _a10;
|
|
278085
278166
|
if (!err) {
|
|
278086
|
-
if ((_a10 =
|
|
278167
|
+
if ((_a10 = statSync22(profilePath)) == null ? undefined : _a10.isDirectory()) {
|
|
278087
278168
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
278088
278169
|
}
|
|
278089
278170
|
try {
|
|
@@ -278192,7 +278273,7 @@ ${lanes.join(`
|
|
|
278192
278273
|
let stat13;
|
|
278193
278274
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
278194
278275
|
const name = combinePaths(path35, entry);
|
|
278195
|
-
stat13 =
|
|
278276
|
+
stat13 = statSync22(name);
|
|
278196
278277
|
if (!stat13) {
|
|
278197
278278
|
continue;
|
|
278198
278279
|
}
|
|
@@ -278216,7 +278297,7 @@ ${lanes.join(`
|
|
|
278216
278297
|
return matchFiles(path35, extensions, excludes, includes2, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath6);
|
|
278217
278298
|
}
|
|
278218
278299
|
function fileSystemEntryExists(path35, entryKind) {
|
|
278219
|
-
const stat13 =
|
|
278300
|
+
const stat13 = statSync22(path35);
|
|
278220
278301
|
if (!stat13) {
|
|
278221
278302
|
return false;
|
|
278222
278303
|
}
|
|
@@ -278250,7 +278331,7 @@ ${lanes.join(`
|
|
|
278250
278331
|
}
|
|
278251
278332
|
function getModifiedTime3(path35) {
|
|
278252
278333
|
var _a10;
|
|
278253
|
-
return (_a10 =
|
|
278334
|
+
return (_a10 = statSync22(path35)) == null ? undefined : _a10.mtime;
|
|
278254
278335
|
}
|
|
278255
278336
|
function setModifiedTime(path35, time3) {
|
|
278256
278337
|
try {
|
|
@@ -290449,15 +290530,15 @@ ${lanes.join(`
|
|
|
290449
290530
|
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
290450
290531
|
return walkAccessExpression(name.parent);
|
|
290451
290532
|
}
|
|
290452
|
-
function walkAccessExpression(
|
|
290453
|
-
if (
|
|
290454
|
-
const res = action(
|
|
290533
|
+
function walkAccessExpression(access3) {
|
|
290534
|
+
if (access3.kind === 212) {
|
|
290535
|
+
const res = action(access3.name);
|
|
290455
290536
|
if (res !== undefined) {
|
|
290456
290537
|
return res;
|
|
290457
290538
|
}
|
|
290458
|
-
} else if (
|
|
290459
|
-
if (isIdentifier2(
|
|
290460
|
-
const res = action(
|
|
290539
|
+
} else if (access3.kind === 213) {
|
|
290540
|
+
if (isIdentifier2(access3.argumentExpression) || isStringLiteralLike(access3.argumentExpression)) {
|
|
290541
|
+
const res = action(access3.argumentExpression);
|
|
290461
290542
|
if (res !== undefined) {
|
|
290462
290543
|
return res;
|
|
290463
290544
|
}
|
|
@@ -290465,11 +290546,11 @@ ${lanes.join(`
|
|
|
290465
290546
|
return;
|
|
290466
290547
|
}
|
|
290467
290548
|
}
|
|
290468
|
-
if (isAccessExpression(
|
|
290469
|
-
return walkAccessExpression(
|
|
290549
|
+
if (isAccessExpression(access3.expression)) {
|
|
290550
|
+
return walkAccessExpression(access3.expression);
|
|
290470
290551
|
}
|
|
290471
|
-
if (isIdentifier2(
|
|
290472
|
-
return action(
|
|
290552
|
+
if (isIdentifier2(access3.expression)) {
|
|
290553
|
+
return action(access3.expression);
|
|
290473
290554
|
}
|
|
290474
290555
|
return;
|
|
290475
290556
|
}
|
|
@@ -298143,12 +298224,12 @@ ${lanes.join(`
|
|
|
298143
298224
|
const propertyName = elementName.computed ? elementName.name : isIdentifier2(elementName.name) ? factory2.createStringLiteralFromNode(elementName.name) : elementName.name;
|
|
298144
298225
|
return factory2.createPropertyAssignment("has", factory2.createArrowFunction(undefined, undefined, [factory2.createParameterDeclaration(undefined, undefined, factory2.createIdentifier("obj"))], undefined, undefined, factory2.createBinaryExpression(propertyName, 103, factory2.createIdentifier("obj"))));
|
|
298145
298226
|
}
|
|
298146
|
-
function createESDecorateClassElementAccessObject(name,
|
|
298227
|
+
function createESDecorateClassElementAccessObject(name, access3) {
|
|
298147
298228
|
const properties = [];
|
|
298148
298229
|
properties.push(createESDecorateClassElementAccessHasMethod(name));
|
|
298149
|
-
if (
|
|
298230
|
+
if (access3.get)
|
|
298150
298231
|
properties.push(createESDecorateClassElementAccessGetMethod(name));
|
|
298151
|
-
if (
|
|
298232
|
+
if (access3.set)
|
|
298152
298233
|
properties.push(createESDecorateClassElementAccessSetMethod(name));
|
|
298153
298234
|
return factory2.createObjectLiteralExpression(properties);
|
|
298154
298235
|
}
|
|
@@ -319883,16 +319964,16 @@ ${lanes.join(`
|
|
|
319883
319964
|
return false;
|
|
319884
319965
|
}
|
|
319885
319966
|
function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) {
|
|
319886
|
-
const
|
|
319887
|
-
return
|
|
319967
|
+
const access3 = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, 788968, false, true);
|
|
319968
|
+
return access3.accessibility === 0;
|
|
319888
319969
|
}
|
|
319889
319970
|
function isValueSymbolAccessible(typeSymbol, enclosingDeclaration) {
|
|
319890
|
-
const
|
|
319891
|
-
return
|
|
319971
|
+
const access3 = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, 111551, false, true);
|
|
319972
|
+
return access3.accessibility === 0;
|
|
319892
319973
|
}
|
|
319893
319974
|
function isSymbolAccessibleByFlags(typeSymbol, enclosingDeclaration, flags) {
|
|
319894
|
-
const
|
|
319895
|
-
return
|
|
319975
|
+
const access3 = isSymbolAccessibleWorker(typeSymbol, enclosingDeclaration, flags, false, false);
|
|
319976
|
+
return access3.accessibility === 0;
|
|
319896
319977
|
}
|
|
319897
319978
|
function isAnySymbolAccessible(symbols, enclosingDeclaration, initialSymbol, meaning, shouldComputeAliasesToMakeVisible, allowModules) {
|
|
319898
319979
|
if (!length(symbols))
|
|
@@ -335760,19 +335841,19 @@ ${lanes.join(`
|
|
|
335760
335841
|
}
|
|
335761
335842
|
return false;
|
|
335762
335843
|
}
|
|
335763
|
-
function getAccessedPropertyName(
|
|
335764
|
-
if (isPropertyAccessExpression(
|
|
335765
|
-
return
|
|
335844
|
+
function getAccessedPropertyName(access3) {
|
|
335845
|
+
if (isPropertyAccessExpression(access3)) {
|
|
335846
|
+
return access3.name.escapedText;
|
|
335766
335847
|
}
|
|
335767
|
-
if (isElementAccessExpression(
|
|
335768
|
-
return tryGetElementAccessExpressionName(
|
|
335848
|
+
if (isElementAccessExpression(access3)) {
|
|
335849
|
+
return tryGetElementAccessExpressionName(access3);
|
|
335769
335850
|
}
|
|
335770
|
-
if (isBindingElement(
|
|
335771
|
-
const name = getDestructuringPropertyName(
|
|
335851
|
+
if (isBindingElement(access3)) {
|
|
335852
|
+
const name = getDestructuringPropertyName(access3);
|
|
335772
335853
|
return name ? escapeLeadingUnderscores(name) : undefined;
|
|
335773
335854
|
}
|
|
335774
|
-
if (isParameter(
|
|
335775
|
-
return "" +
|
|
335855
|
+
if (isParameter(access3)) {
|
|
335856
|
+
return "" + access3.parent.parameters.indexOf(access3);
|
|
335776
335857
|
}
|
|
335777
335858
|
return;
|
|
335778
335859
|
}
|
|
@@ -336826,9 +336907,9 @@ ${lanes.join(`
|
|
|
336826
336907
|
type = narrowTypeBySwitchOptionalChainContainment(type, flow2.node, (t2) => !(t2.flags & 131072 || t2.flags & 128 && t2.value === "undefined"));
|
|
336827
336908
|
}
|
|
336828
336909
|
}
|
|
336829
|
-
const
|
|
336830
|
-
if (
|
|
336831
|
-
type = narrowTypeBySwitchOnDiscriminantProperty(type,
|
|
336910
|
+
const access3 = getDiscriminantPropertyAccess(expr, type);
|
|
336911
|
+
if (access3) {
|
|
336912
|
+
type = narrowTypeBySwitchOnDiscriminantProperty(type, access3, flow2.node);
|
|
336832
336913
|
}
|
|
336833
336914
|
}
|
|
336834
336915
|
return createFlowType(type, isIncomplete(flowType));
|
|
@@ -336970,26 +337051,26 @@ ${lanes.join(`
|
|
|
336970
337051
|
}
|
|
336971
337052
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
336972
337053
|
if (declaredType.flags & 1048576 || computedType.flags & 1048576) {
|
|
336973
|
-
const
|
|
336974
|
-
if (
|
|
336975
|
-
const name = getAccessedPropertyName(
|
|
337054
|
+
const access3 = getCandidateDiscriminantPropertyAccess(expr);
|
|
337055
|
+
if (access3) {
|
|
337056
|
+
const name = getAccessedPropertyName(access3);
|
|
336976
337057
|
if (name) {
|
|
336977
337058
|
const type = declaredType.flags & 1048576 && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType;
|
|
336978
337059
|
if (isDiscriminantProperty(type, name)) {
|
|
336979
|
-
return
|
|
337060
|
+
return access3;
|
|
336980
337061
|
}
|
|
336981
337062
|
}
|
|
336982
337063
|
}
|
|
336983
337064
|
}
|
|
336984
337065
|
return;
|
|
336985
337066
|
}
|
|
336986
|
-
function narrowTypeByDiscriminant(type,
|
|
336987
|
-
const propName = getAccessedPropertyName(
|
|
337067
|
+
function narrowTypeByDiscriminant(type, access3, narrowType2) {
|
|
337068
|
+
const propName = getAccessedPropertyName(access3);
|
|
336988
337069
|
if (propName === undefined) {
|
|
336989
337070
|
return type;
|
|
336990
337071
|
}
|
|
336991
|
-
const optionalChain = isOptionalChain(
|
|
336992
|
-
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(
|
|
337072
|
+
const optionalChain = isOptionalChain(access3);
|
|
337073
|
+
const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access3)) && maybeTypeOfKind(type, 98304);
|
|
336993
337074
|
let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152) : type, propName);
|
|
336994
337075
|
if (!propType) {
|
|
336995
337076
|
return type;
|
|
@@ -337001,27 +337082,27 @@ ${lanes.join(`
|
|
|
337001
337082
|
return !(discriminantType.flags & 131072) && !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType);
|
|
337002
337083
|
});
|
|
337003
337084
|
}
|
|
337004
|
-
function narrowTypeByDiscriminantProperty(type,
|
|
337085
|
+
function narrowTypeByDiscriminantProperty(type, access3, operator, value, assumeTrue) {
|
|
337005
337086
|
if ((operator === 37 || operator === 38) && type.flags & 1048576) {
|
|
337006
337087
|
const keyPropertyName = getKeyPropertyName(type);
|
|
337007
|
-
if (keyPropertyName && keyPropertyName === getAccessedPropertyName(
|
|
337088
|
+
if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access3)) {
|
|
337008
337089
|
const candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value));
|
|
337009
337090
|
if (candidate) {
|
|
337010
337091
|
return operator === (assumeTrue ? 37 : 38) ? candidate : isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) : type;
|
|
337011
337092
|
}
|
|
337012
337093
|
}
|
|
337013
337094
|
}
|
|
337014
|
-
return narrowTypeByDiscriminant(type,
|
|
337095
|
+
return narrowTypeByDiscriminant(type, access3, (t2) => narrowTypeByEquality(t2, operator, value, assumeTrue));
|
|
337015
337096
|
}
|
|
337016
|
-
function narrowTypeBySwitchOnDiscriminantProperty(type,
|
|
337017
|
-
if (data.clauseStart < data.clauseEnd && type.flags & 1048576 && getKeyPropertyName(type) === getAccessedPropertyName(
|
|
337097
|
+
function narrowTypeBySwitchOnDiscriminantProperty(type, access3, data) {
|
|
337098
|
+
if (data.clauseStart < data.clauseEnd && type.flags & 1048576 && getKeyPropertyName(type) === getAccessedPropertyName(access3)) {
|
|
337018
337099
|
const clauseTypes = getSwitchClauseTypes(data.switchStatement).slice(data.clauseStart, data.clauseEnd);
|
|
337019
337100
|
const candidate = getUnionType(map3(clauseTypes, (t2) => getConstituentTypeForKeyType(type, t2) || unknownType));
|
|
337020
337101
|
if (candidate !== unknownType) {
|
|
337021
337102
|
return candidate;
|
|
337022
337103
|
}
|
|
337023
337104
|
}
|
|
337024
|
-
return narrowTypeByDiscriminant(type,
|
|
337105
|
+
return narrowTypeByDiscriminant(type, access3, (t2) => narrowTypeBySwitchOnDiscriminant(t2, data));
|
|
337025
337106
|
}
|
|
337026
337107
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
337027
337108
|
if (isMatchingReference(reference, expr)) {
|
|
@@ -337030,9 +337111,9 @@ ${lanes.join(`
|
|
|
337030
337111
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
337031
337112
|
type = getAdjustedTypeWithFacts(type, 2097152);
|
|
337032
337113
|
}
|
|
337033
|
-
const
|
|
337034
|
-
if (
|
|
337035
|
-
return narrowTypeByDiscriminant(type,
|
|
337114
|
+
const access3 = getDiscriminantPropertyAccess(expr, type);
|
|
337115
|
+
if (access3) {
|
|
337116
|
+
return narrowTypeByDiscriminant(type, access3, (t2) => getTypeWithFacts(t2, assumeTrue ? 4194304 : 8388608));
|
|
337036
337117
|
}
|
|
337037
337118
|
return type;
|
|
337038
337119
|
}
|
|
@@ -337442,9 +337523,9 @@ ${lanes.join(`
|
|
|
337442
337523
|
if (strictNullChecks && optionalChainContainsReference(predicateArgument, reference) && (assumeTrue && !hasTypeFacts(predicate.type, 65536) || !assumeTrue && everyType(predicate.type, isNullableType))) {
|
|
337443
337524
|
type = getAdjustedTypeWithFacts(type, 2097152);
|
|
337444
337525
|
}
|
|
337445
|
-
const
|
|
337446
|
-
if (
|
|
337447
|
-
return narrowTypeByDiscriminant(type,
|
|
337526
|
+
const access3 = getDiscriminantPropertyAccess(predicateArgument, type);
|
|
337527
|
+
if (access3) {
|
|
337528
|
+
return narrowTypeByDiscriminant(type, access3, (t2) => getNarrowedType(t2, predicate.type, assumeTrue, false));
|
|
337448
337529
|
}
|
|
337449
337530
|
}
|
|
337450
337531
|
}
|
|
@@ -337493,9 +337574,9 @@ ${lanes.join(`
|
|
|
337493
337574
|
if (isMatchingReference(reference, expr)) {
|
|
337494
337575
|
return getAdjustedTypeWithFacts(type, assumePresent ? 2097152 : 262144);
|
|
337495
337576
|
}
|
|
337496
|
-
const
|
|
337497
|
-
if (
|
|
337498
|
-
return narrowTypeByDiscriminant(type,
|
|
337577
|
+
const access3 = getDiscriminantPropertyAccess(expr, type);
|
|
337578
|
+
if (access3) {
|
|
337579
|
+
return narrowTypeByDiscriminant(type, access3, (t2) => getTypeWithFacts(t2, assumePresent ? 2097152 : 262144));
|
|
337499
337580
|
}
|
|
337500
337581
|
return type;
|
|
337501
337582
|
}
|
|
@@ -394814,13 +394895,13 @@ interface Symbol {
|
|
|
394814
394895
|
for (const element2 of toConvert.elements) {
|
|
394815
394896
|
const propertyName = element2.propertyName || element2.name;
|
|
394816
394897
|
ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element2.name, checker, sourceFile, (id) => {
|
|
394817
|
-
const
|
|
394898
|
+
const access3 = propertyName.kind === 11 ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
|
|
394818
394899
|
if (isShorthandPropertyAssignment(id.parent)) {
|
|
394819
|
-
changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text,
|
|
394900
|
+
changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access3));
|
|
394820
394901
|
} else if (isExportSpecifier(id.parent)) {
|
|
394821
394902
|
neededNamedImports.add(element2);
|
|
394822
394903
|
} else {
|
|
394823
|
-
changes.replaceNode(sourceFile, id,
|
|
394904
|
+
changes.replaceNode(sourceFile, id, access3);
|
|
394824
394905
|
}
|
|
394825
394906
|
});
|
|
394826
394907
|
}
|
|
@@ -439725,7 +439806,7 @@ import {
|
|
|
439725
439806
|
mkdirSync as mkdirSync49,
|
|
439726
439807
|
readdirSync as readdirSync23,
|
|
439727
439808
|
readFileSync as readFileSync51,
|
|
439728
|
-
statSync as
|
|
439809
|
+
statSync as statSync22,
|
|
439729
439810
|
unlinkSync as unlinkSync18,
|
|
439730
439811
|
writeFileSync as writeFileSync43
|
|
439731
439812
|
} from "node:fs";
|
|
@@ -440554,7 +440635,7 @@ async function loadLocalMods(options) {
|
|
|
440554
440635
|
recordLegacyExtensionLoadedDiagnostic(registry3, owner, source, options.onDiagnostic);
|
|
440555
440636
|
}
|
|
440556
440637
|
try {
|
|
440557
|
-
const mtimeMs =
|
|
440638
|
+
const mtimeMs = statSync22(modPath).mtimeMs;
|
|
440558
440639
|
const sourceText = readFileSync51(modPath, "utf8");
|
|
440559
440640
|
recordDeprecatedContextApiSourceDiagnostics(sourceText, (diagnostic) => {
|
|
440560
440641
|
recordModDiagnostic(registry3, {
|
|
@@ -446242,7 +446323,6 @@ async function handleApprovalStop(params) {
|
|
|
446242
446323
|
if (shouldInterrupt()) {
|
|
446243
446324
|
return interruptTermination();
|
|
446244
446325
|
}
|
|
446245
|
-
lastExecutingToolCallIds = approvedDecisions.map((decision) => decision.approval.toolCallId);
|
|
446246
446326
|
const effectBoundary = createRecoveredApprovalEffectBoundary({
|
|
446247
446327
|
decisions,
|
|
446248
446328
|
ownsClaim: () => !shouldInterrupt(),
|
|
@@ -446257,25 +446337,6 @@ async function handleApprovalStop(params) {
|
|
|
446257
446337
|
}, "before_tool_execution", () => !shouldInterrupt());
|
|
446258
446338
|
if (shouldInterrupt())
|
|
446259
446339
|
return interruptTermination();
|
|
446260
|
-
runtime.turnLifecycle.setExecutingToolCallIds(turnLease, lastExecutingToolCallIds);
|
|
446261
|
-
setTurnLoopStatus(runtime, turnLease, "EXECUTING_CLIENT_SIDE_TOOL", {
|
|
446262
|
-
agent_id: agentId,
|
|
446263
|
-
conversation_id: conversationId
|
|
446264
|
-
});
|
|
446265
|
-
emitRuntimeStateUpdates(runtime, {
|
|
446266
|
-
agent_id: agentId,
|
|
446267
|
-
conversation_id: conversationId
|
|
446268
|
-
});
|
|
446269
|
-
emitToolExecutionStartedEvents(socket, runtime, {
|
|
446270
|
-
toolCalls: approvedDecisions.map((decision) => ({
|
|
446271
|
-
toolCallId: decision.approval.toolCallId,
|
|
446272
|
-
toolName: decision.approval.toolName,
|
|
446273
|
-
toolArgs: decision.approval.toolArgs
|
|
446274
|
-
})),
|
|
446275
|
-
runId: executionRunId,
|
|
446276
|
-
agentId,
|
|
446277
|
-
conversationId
|
|
446278
|
-
});
|
|
446279
446340
|
const emitToolExecutionOutput = createToolExecutionOutputEmitter(socket, runtime, {
|
|
446280
446341
|
runId: executionRunId,
|
|
446281
446342
|
agentId,
|
|
@@ -446302,12 +446363,32 @@ async function handleApprovalStop(params) {
|
|
|
446302
446363
|
};
|
|
446303
446364
|
let executionResults;
|
|
446304
446365
|
try {
|
|
446305
|
-
if (agentId) {
|
|
446366
|
+
if (agentId && approvedDecisions.some(({ approval }) => !isRemoteExternalTool(approval.toolName, turnToolContextId))) {
|
|
446306
446367
|
await ensureSecretsHydrated(runtime.listener, agentId);
|
|
446307
446368
|
}
|
|
446308
446369
|
if (shouldInterrupt()) {
|
|
446309
446370
|
return interruptTermination();
|
|
446310
446371
|
}
|
|
446372
|
+
lastExecutingToolCallIds = approvedDecisions.map((decision) => decision.approval.toolCallId);
|
|
446373
|
+
runtime.turnLifecycle.setExecutingToolCallIds(turnLease, lastExecutingToolCallIds);
|
|
446374
|
+
setTurnLoopStatus(runtime, turnLease, "EXECUTING_CLIENT_SIDE_TOOL", {
|
|
446375
|
+
agent_id: agentId,
|
|
446376
|
+
conversation_id: conversationId
|
|
446377
|
+
});
|
|
446378
|
+
emitRuntimeStateUpdates(runtime, {
|
|
446379
|
+
agent_id: agentId,
|
|
446380
|
+
conversation_id: conversationId
|
|
446381
|
+
});
|
|
446382
|
+
emitToolExecutionStartedEvents(socket, runtime, {
|
|
446383
|
+
toolCalls: approvedDecisions.map((decision) => ({
|
|
446384
|
+
toolCallId: decision.approval.toolCallId,
|
|
446385
|
+
toolName: decision.approval.toolName,
|
|
446386
|
+
toolArgs: decision.approval.toolArgs
|
|
446387
|
+
})),
|
|
446388
|
+
runId: executionRunId,
|
|
446389
|
+
agentId,
|
|
446390
|
+
conversationId
|
|
446391
|
+
});
|
|
446311
446392
|
executionResults = await executeApprovals(decisions, params.onChunk, {
|
|
446312
446393
|
toolContextId: turnToolContextId ?? undefined,
|
|
446313
446394
|
abortSignal,
|
|
@@ -446434,6 +446515,7 @@ async function handleApprovalStop(params) {
|
|
|
446434
446515
|
agent_id: agentId,
|
|
446435
446516
|
conversation_id: conversationId
|
|
446436
446517
|
});
|
|
446518
|
+
debugLog("Listen", "approval_continuation_send conversation_id=%s", conversationId);
|
|
446437
446519
|
let sendResult;
|
|
446438
446520
|
try {
|
|
446439
446521
|
const imageFailureModesByMessageOtid = mergeImageFailureModesByMessageOtid(sendOptions.imageFailureModesByMessageOtid, nextTurnInput.imageFailureModesByMessageOtid);
|
|
@@ -446504,11 +446586,13 @@ var init_turn_approval = __esm(() => {
|
|
|
446504
446586
|
init_approval_execution();
|
|
446505
446587
|
init_diff_preview();
|
|
446506
446588
|
init_format_denial();
|
|
446589
|
+
init_debug();
|
|
446507
446590
|
init_message_image_normalization();
|
|
446508
446591
|
init_approval();
|
|
446509
446592
|
init_approval_suggestions();
|
|
446510
446593
|
init_connection();
|
|
446511
446594
|
init_continuation_input();
|
|
446595
|
+
init_external_tools();
|
|
446512
446596
|
init_interrupted_turn_read();
|
|
446513
446597
|
init_interrupted_turn_record();
|
|
446514
446598
|
init_interrupts();
|
|
@@ -448921,7 +449005,7 @@ var init_core5 = __esm(() => {
|
|
|
448921
449005
|
|
|
448922
449006
|
// node_modules/@letta-ai/trajectory/dist/adapters/deepagents/index.js
|
|
448923
449007
|
import { spawn as spawn11 } from "node:child_process";
|
|
448924
|
-
import { accessSync as
|
|
449008
|
+
import { accessSync as accessSync3, constants as constants8 } from "node:fs";
|
|
448925
449009
|
import { homedir as homedir21 } from "node:os";
|
|
448926
449010
|
import { join as join90 } from "node:path";
|
|
448927
449011
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
@@ -449117,7 +449201,7 @@ function resolveHelperPath() {
|
|
|
449117
449201
|
];
|
|
449118
449202
|
for (const candidate of candidates) {
|
|
449119
449203
|
try {
|
|
449120
|
-
|
|
449204
|
+
accessSync3(candidate, constants8.R_OK);
|
|
449121
449205
|
return candidate;
|
|
449122
449206
|
} catch {}
|
|
449123
449207
|
}
|
|
@@ -449166,7 +449250,7 @@ var init_deepagents = __esm(() => {
|
|
|
449166
449250
|
});
|
|
449167
449251
|
|
|
449168
449252
|
// node_modules/@letta-ai/trajectory/dist/adapters/listing-shared.js
|
|
449169
|
-
import { readdirSync as readdirSync24, statSync as
|
|
449253
|
+
import { readdirSync as readdirSync24, statSync as statSync23 } from "node:fs";
|
|
449170
449254
|
import { join as join91 } from "node:path";
|
|
449171
449255
|
function sortListings(items) {
|
|
449172
449256
|
return items.sort((left, right) => {
|
|
@@ -449190,7 +449274,7 @@ function safeReadDir(path41) {
|
|
|
449190
449274
|
}
|
|
449191
449275
|
function safeStat(path41) {
|
|
449192
449276
|
try {
|
|
449193
|
-
const stats =
|
|
449277
|
+
const stats = statSync23(path41);
|
|
449194
449278
|
return { mtimeMs: stats.mtimeMs, sizeBytes: stats.size };
|
|
449195
449279
|
} catch {
|
|
449196
449280
|
return;
|
|
@@ -450611,7 +450695,7 @@ __export(exports_memory_scanner, {
|
|
|
450611
450695
|
readFileContent: () => readFileContent,
|
|
450612
450696
|
getFileNodes: () => getFileNodes
|
|
450613
450697
|
});
|
|
450614
|
-
import { readdirSync as readdirSync25, readFileSync as readFileSync52, statSync as
|
|
450698
|
+
import { readdirSync as readdirSync25, readFileSync as readFileSync52, statSync as statSync24 } from "node:fs";
|
|
450615
450699
|
import { join as join101, relative as relative10 } from "node:path";
|
|
450616
450700
|
function scanMemoryFilesystem(memoryRoot) {
|
|
450617
450701
|
const nodes = [];
|
|
@@ -450629,10 +450713,10 @@ function scanMemoryFilesystem(memoryRoot) {
|
|
|
450629
450713
|
let aIsDir = false;
|
|
450630
450714
|
let bIsDir = false;
|
|
450631
450715
|
try {
|
|
450632
|
-
aIsDir =
|
|
450716
|
+
aIsDir = statSync24(aPath).isDirectory();
|
|
450633
450717
|
} catch {}
|
|
450634
450718
|
try {
|
|
450635
|
-
bIsDir =
|
|
450719
|
+
bIsDir = statSync24(bPath).isDirectory();
|
|
450636
450720
|
} catch {}
|
|
450637
450721
|
if (aIsDir !== bIsDir)
|
|
450638
450722
|
return aIsDir ? -1 : 1;
|
|
@@ -450648,7 +450732,7 @@ function scanMemoryFilesystem(memoryRoot) {
|
|
|
450648
450732
|
const fullPath = join101(dir, name);
|
|
450649
450733
|
let isDir = false;
|
|
450650
450734
|
try {
|
|
450651
|
-
isDir =
|
|
450735
|
+
isDir = statSync24(fullPath).isDirectory();
|
|
450652
450736
|
} catch {
|
|
450653
450737
|
return;
|
|
450654
450738
|
}
|
|
@@ -456246,7 +456330,6 @@ var init_connection_state_sync = __esm(() => {
|
|
|
456246
456330
|
});
|
|
456247
456331
|
|
|
456248
456332
|
// src/websocket/listener/control-inputs.ts
|
|
456249
|
-
import { realpath as realpath7, stat as stat14 } from "node:fs/promises";
|
|
456250
456333
|
import path41 from "node:path";
|
|
456251
456334
|
function trackListenerError(errorType, error4, context3) {
|
|
456252
456335
|
trackBoundaryError({
|
|
@@ -456537,11 +456620,7 @@ async function handleCwdChange(msg, socket, runtime) {
|
|
|
456537
456620
|
throw new Error("Working directory cannot be empty");
|
|
456538
456621
|
}
|
|
456539
456622
|
const resolvedPath = path41.isAbsolute(requestedPath) ? requestedPath : path41.resolve(currentWorkingDirectory, requestedPath);
|
|
456540
|
-
const normalizedPath = await
|
|
456541
|
-
const stats = await stat14(normalizedPath);
|
|
456542
|
-
if (!stats.isDirectory()) {
|
|
456543
|
-
throw new Error(`Not a directory: ${normalizedPath}`);
|
|
456544
|
-
}
|
|
456623
|
+
const normalizedPath = await resolveTraversableDirectory(resolvedPath);
|
|
456545
456624
|
setConversationWorkingDirectory(runtime.listener, agentId, conversationId, normalizedPath);
|
|
456546
456625
|
runtime.reminderState.hasSentSessionContext = false;
|
|
456547
456626
|
runtime.reminderState.pendingSessionContextReason = "cwd_changed";
|
|
@@ -456584,6 +456663,7 @@ async function handleCwdChange(msg, socket, runtime) {
|
|
|
456584
456663
|
var init_control_inputs = __esm(() => {
|
|
456585
456664
|
init_backend2();
|
|
456586
456665
|
init_constants2();
|
|
456666
|
+
init_working_directory();
|
|
456587
456667
|
init_mode();
|
|
456588
456668
|
init_telemetry();
|
|
456589
456669
|
init_error_reporting();
|
|
@@ -457277,8 +457357,8 @@ function createFileCommandSession(params) {
|
|
|
457277
457357
|
try {
|
|
457278
457358
|
let content;
|
|
457279
457359
|
if (encoding === "base64") {
|
|
457280
|
-
const { stat:
|
|
457281
|
-
const stats = await
|
|
457360
|
+
const { stat: stat14 } = await import("node:fs/promises");
|
|
457361
|
+
const stats = await stat14(parsed.path);
|
|
457282
457362
|
if (stats.size > MAX_BASE64_READ_BYTES) {
|
|
457283
457363
|
throw new Error(`File too large for base64 read (max ${Math.floor(MAX_BASE64_READ_BYTES / 1048576)}MB)`);
|
|
457284
457364
|
}
|
|
@@ -457361,7 +457441,7 @@ function createFileCommandSession(params) {
|
|
|
457361
457441
|
}
|
|
457362
457442
|
try {
|
|
457363
457443
|
const { watch: watch4 } = await import("node:fs");
|
|
457364
|
-
const { stat:
|
|
457444
|
+
const { stat: stat14 } = await import("node:fs/promises");
|
|
457365
457445
|
if (cancelledWatches.delete(parsed.path))
|
|
457366
457446
|
return;
|
|
457367
457447
|
const watcher = watch4(parsed.path, { persistent: false }, (eventType) => {
|
|
@@ -457372,7 +457452,7 @@ function createFileCommandSession(params) {
|
|
|
457372
457452
|
clearTimeout(existing2);
|
|
457373
457453
|
watchDebounceTimers.set(parsed.path, setTimeout(() => {
|
|
457374
457454
|
watchDebounceTimers.delete(parsed.path);
|
|
457375
|
-
|
|
457455
|
+
stat14(parsed.path).then((s3) => {
|
|
457376
457456
|
safeSocketSend(socket, {
|
|
457377
457457
|
type: "file_changed",
|
|
457378
457458
|
path: parsed.path,
|
|
@@ -458538,7 +458618,7 @@ var init_local_memory_context = __esm(() => {
|
|
|
458538
458618
|
});
|
|
458539
458619
|
|
|
458540
458620
|
// src/websocket/listener/commands/terminal-inspection.ts
|
|
458541
|
-
import { lstat as lstat3, realpath as
|
|
458621
|
+
import { lstat as lstat3, realpath as realpath7 } from "node:fs/promises";
|
|
458542
458622
|
import { basename as basename30, dirname as dirname39, join as join104 } from "node:path";
|
|
458543
458623
|
async function terminalSkills(runtime) {
|
|
458544
458624
|
const { availableSkills } = await buildClientSkillsPayload({
|
|
@@ -458554,13 +458634,13 @@ async function terminalSkills(runtime) {
|
|
|
458554
458634
|
function inspectSkillDirectories(availableSkills) {
|
|
458555
458635
|
return Promise.all(availableSkills.map(async (skill2) => {
|
|
458556
458636
|
const directory = basename30(skill2.path) === "SKILL.md" ? dirname39(skill2.path) : skill2.path;
|
|
458557
|
-
const path45 = await
|
|
458637
|
+
const path45 = await realpath7(directory).catch(() => directory);
|
|
458558
458638
|
const name = basename30(directory);
|
|
458559
458639
|
const link4 = join104(getGlobalSkillsDir(), name);
|
|
458560
|
-
const
|
|
458640
|
+
const stat14 = await lstat3(link4).catch(() => {
|
|
458561
458641
|
return;
|
|
458562
458642
|
});
|
|
458563
|
-
const enabled =
|
|
458643
|
+
const enabled = stat14?.isSymbolicLink() && await realpath7(link4).catch(() => {
|
|
458564
458644
|
return;
|
|
458565
458645
|
}) === path45;
|
|
458566
458646
|
return {
|
|
@@ -458569,7 +458649,7 @@ function inspectSkillDirectories(availableSkills) {
|
|
|
458569
458649
|
label: skill2.name,
|
|
458570
458650
|
description: skill2.description,
|
|
458571
458651
|
enabled: !!enabled,
|
|
458572
|
-
fixed: !!
|
|
458652
|
+
fixed: !!stat14 && !enabled
|
|
458573
458653
|
};
|
|
458574
458654
|
}));
|
|
458575
458655
|
}
|
|
@@ -459293,7 +459373,6 @@ var init_app_server_info = __esm(() => {
|
|
|
459293
459373
|
});
|
|
459294
459374
|
|
|
459295
459375
|
// src/websocket/listener/commands/boot-working-directory.ts
|
|
459296
|
-
import { realpath as realpath9, stat as stat15 } from "node:fs/promises";
|
|
459297
459376
|
import path45 from "node:path";
|
|
459298
459377
|
async function resolveDirectory(requestedPath, currentBootWorkingDirectory) {
|
|
459299
459378
|
const trimmedPath = requestedPath.trim();
|
|
@@ -459301,12 +459380,7 @@ async function resolveDirectory(requestedPath, currentBootWorkingDirectory) {
|
|
|
459301
459380
|
throw new Error("Working directory cannot be empty");
|
|
459302
459381
|
}
|
|
459303
459382
|
const resolvedPath = path45.isAbsolute(trimmedPath) ? trimmedPath : path45.resolve(currentBootWorkingDirectory, trimmedPath);
|
|
459304
|
-
|
|
459305
|
-
const stats = await stat15(normalizedPath);
|
|
459306
|
-
if (!stats.isDirectory()) {
|
|
459307
|
-
throw new Error(`Not a directory: ${normalizedPath}`);
|
|
459308
|
-
}
|
|
459309
|
-
return normalizedPath;
|
|
459383
|
+
return resolveTraversableDirectory(resolvedPath);
|
|
459310
459384
|
}
|
|
459311
459385
|
function getCwdScopeKeyFromRuntimeKey(runtimeKey) {
|
|
459312
459386
|
const marker2 = "::conversation:";
|
|
@@ -459383,6 +459457,7 @@ async function handleCwdProtocolCommand(command, context3) {
|
|
|
459383
459457
|
}, "get_cwd_map_response", "get_cwd_map");
|
|
459384
459458
|
}
|
|
459385
459459
|
var init_boot_working_directory = __esm(() => {
|
|
459460
|
+
init_working_directory();
|
|
459386
459461
|
init_settings_manager();
|
|
459387
459462
|
init_cwd();
|
|
459388
459463
|
init_protocol_outbound();
|
|
@@ -460641,7 +460716,7 @@ async function handleListMemoryCommand(parsed, socket, safeSocketSend, overrides
|
|
|
460641
460716
|
const isMemfsEnabledOnServer2 = overrides.isMemfsEnabledOnServer ?? actualIsMemfsEnabledOnServer;
|
|
460642
460717
|
const { scanMemoryFilesystem: scanMemoryFilesystem2, getFileNodes: getFileNodes2, readFileContent: readFileContent2 } = await Promise.resolve().then(() => (init_memory_scanner(), exports_memory_scanner));
|
|
460643
460718
|
const { parseFrontmatter: parseFrontmatter2 } = await Promise.resolve().then(() => exports_frontmatter);
|
|
460644
|
-
const { existsSync: existsSync63, statSync:
|
|
460719
|
+
const { existsSync: existsSync63, statSync: statSync25 } = await import("node:fs");
|
|
460645
460720
|
const { join: join105, posix: posix4 } = await import("node:path");
|
|
460646
460721
|
const memoryRoot = getMemoryFilesystemRoot2(parsed.agent_id);
|
|
460647
460722
|
let memfsInitialized = existsSync63(join105(memoryRoot, ".git"));
|
|
@@ -460738,7 +460813,7 @@ async function handleListMemoryCommand(parsed, socket, safeSocketSend, overrides
|
|
|
460738
460813
|
if (imageMimeType) {
|
|
460739
460814
|
let size2 = 0;
|
|
460740
460815
|
try {
|
|
460741
|
-
size2 =
|
|
460816
|
+
size2 = statSync25(node.fullPath).size;
|
|
460742
460817
|
} catch {}
|
|
460743
460818
|
return {
|
|
460744
460819
|
relative_path: node.relativePath,
|
|
@@ -462731,8 +462806,8 @@ async function handleSkillCommand(parsed, socket, safeSocketSend) {
|
|
|
462731
462806
|
const linkPath = join106(globalSkillsDir, linkName);
|
|
462732
462807
|
mkdirSync51(globalSkillsDir, { recursive: true });
|
|
462733
462808
|
if (existsSync64(linkPath)) {
|
|
462734
|
-
const
|
|
462735
|
-
if (
|
|
462809
|
+
const stat14 = lstatSync4(linkPath);
|
|
462810
|
+
if (stat14.isSymbolicLink()) {
|
|
462736
462811
|
if (process.platform === "win32") {
|
|
462737
462812
|
rmdirSync3(linkPath);
|
|
462738
462813
|
} else {
|
|
@@ -462781,8 +462856,8 @@ async function handleSkillCommand(parsed, socket, safeSocketSend) {
|
|
|
462781
462856
|
}, "listener_skill_send_failed", "listener_skill_command");
|
|
462782
462857
|
return true;
|
|
462783
462858
|
}
|
|
462784
|
-
const
|
|
462785
|
-
if (!
|
|
462859
|
+
const stat14 = lstatSync4(linkPath);
|
|
462860
|
+
if (!stat14.isSymbolicLink()) {
|
|
462786
462861
|
safeSocketSend(socket, {
|
|
462787
462862
|
type: "skill_disable_response",
|
|
462788
462863
|
request_id: parsed.request_id,
|
|
@@ -463783,7 +463858,20 @@ async function stopMonitor(command) {
|
|
|
463783
463858
|
}
|
|
463784
463859
|
if (process21.status !== "running")
|
|
463785
463860
|
return { ...response, success: true };
|
|
463786
|
-
|
|
463861
|
+
const stopped = killBackgroundProcess(command.process_id, () => {
|
|
463862
|
+
addToMessageQueue({
|
|
463863
|
+
kind: "task_notification",
|
|
463864
|
+
agentId: command.runtime.agent_id,
|
|
463865
|
+
conversationId: command.runtime.conversation_id,
|
|
463866
|
+
actingUserId: command.runtime.acting_user_id,
|
|
463867
|
+
text: formatMonitorEventNotification({
|
|
463868
|
+
taskId: command.process_id,
|
|
463869
|
+
description: process21.description,
|
|
463870
|
+
event: "The user cancelled this Monitor. Do not restart it unless the user asks."
|
|
463871
|
+
})
|
|
463872
|
+
});
|
|
463873
|
+
});
|
|
463874
|
+
if (!stopped)
|
|
463787
463875
|
return { ...response, error: "Monitor could not be stopped" };
|
|
463788
463876
|
let persistenceError;
|
|
463789
463877
|
try {
|
|
@@ -463791,17 +463879,6 @@ async function stopMonitor(command) {
|
|
|
463791
463879
|
} catch {
|
|
463792
463880
|
persistenceError = "Monitor stopped, but its server state could not be saved";
|
|
463793
463881
|
}
|
|
463794
|
-
addToMessageQueue({
|
|
463795
|
-
kind: "task_notification",
|
|
463796
|
-
agentId: command.runtime.agent_id,
|
|
463797
|
-
conversationId: command.runtime.conversation_id,
|
|
463798
|
-
actingUserId: command.runtime.acting_user_id,
|
|
463799
|
-
text: formatMonitorEventNotification({
|
|
463800
|
-
taskId: command.process_id,
|
|
463801
|
-
description: process21.description,
|
|
463802
|
-
event: "The user cancelled this Monitor. Do not restart it unless the user asks."
|
|
463803
|
-
})
|
|
463804
|
-
});
|
|
463805
463882
|
return {
|
|
463806
463883
|
...response,
|
|
463807
463884
|
success: !persistenceError,
|
|
@@ -466129,6 +466206,7 @@ function stopRuntime(runtime, suppressCallbacks) {
|
|
|
466129
466206
|
disposeListenerModAdapter(runtime);
|
|
466130
466207
|
rejectPendingExternalToolCalls(runtime, "Listener runtime stopped");
|
|
466131
466208
|
invalidateProcessServices(runtime);
|
|
466209
|
+
retireFiniteMonitors((agentId, conversationId) => runtime.conversationRuntimes.has(getConversationRuntimeKey(agentId, conversationId)));
|
|
466132
466210
|
for (const conversationRuntime of runtime.conversationRuntimes.values()) {
|
|
466133
466211
|
rejectPendingApprovalResolvers(conversationRuntime, "Listener runtime stopped");
|
|
466134
466212
|
clearConversationRuntimeState(conversationRuntime);
|
|
@@ -466680,6 +466758,7 @@ var init_lifecycle = __esm(() => {
|
|
|
466680
466758
|
init_scheduler();
|
|
466681
466759
|
init_runtime_context();
|
|
466682
466760
|
init_telemetry();
|
|
466761
|
+
init_monitor();
|
|
466683
466762
|
init_manager2();
|
|
466684
466763
|
init_debug();
|
|
466685
466764
|
init_startup_log_boundary();
|
|
@@ -467803,6 +467882,7 @@ function parseAppServerListenUrl(listen = DEFAULT_LISTEN_URL) {
|
|
|
467803
467882
|
return { host: normalizeListenHost(url2.hostname), port, path: path46 };
|
|
467804
467883
|
}
|
|
467805
467884
|
async function startAppServer(options = {}) {
|
|
467885
|
+
await loadPermissions();
|
|
467806
467886
|
await settingsManager.initialize();
|
|
467807
467887
|
const listen = parseAppServerListenUrl(options.listen);
|
|
467808
467888
|
const authPolicy = await policyFromSettings(options.websocketAuth);
|
|
@@ -468040,6 +468120,7 @@ async function startAppServer(options = {}) {
|
|
|
468040
468120
|
}
|
|
468041
468121
|
var DEFAULT_LISTEN_URL = "ws://127.0.0.1:0", DEFAULT_WS_PATH = "/ws", APP_SERVER_HEARTBEAT_INTERVAL_MS = 30000, APP_SERVER_PONG_TIMEOUT_MS = 90000;
|
|
468042
468122
|
var init_app_server = __esm(() => {
|
|
468123
|
+
init_loader2();
|
|
468043
468124
|
init_settings_manager();
|
|
468044
468125
|
init_telemetry();
|
|
468045
468126
|
init_manager2();
|
|
@@ -468589,17 +468670,20 @@ async function applyStartupPermissionMode(options) {
|
|
|
468589
468670
|
if (!migrated) {
|
|
468590
468671
|
return {
|
|
468591
468672
|
ok: false,
|
|
468592
|
-
|
|
468593
|
-
message: formatInvalidPermissionModeMessage(permissionModeValue)
|
|
468673
|
+
error: formatInvalidPermissionModeMessage(permissionModeValue)
|
|
468594
468674
|
};
|
|
468595
468675
|
}
|
|
468596
468676
|
permissionMode.setMode(migrated);
|
|
468597
468677
|
return { ok: true, mode: migrated, source: "cli" };
|
|
468598
468678
|
}
|
|
468599
|
-
|
|
468600
|
-
|
|
468601
|
-
|
|
468602
|
-
|
|
468679
|
+
try {
|
|
468680
|
+
const configuredMode = await loadPermissionMode(options.workingDirectory);
|
|
468681
|
+
if (configuredMode) {
|
|
468682
|
+
permissionMode.setMode(configuredMode);
|
|
468683
|
+
return { ok: true, mode: configuredMode, source: "settings" };
|
|
468684
|
+
}
|
|
468685
|
+
} catch (error4) {
|
|
468686
|
+
return { ok: false, error: getErrorMessage2(error4) };
|
|
468603
468687
|
}
|
|
468604
468688
|
return { ok: true, mode: permissionMode.getMode(), source: "default" };
|
|
468605
468689
|
}
|
|
@@ -469874,8 +469958,12 @@ async function runListenSubcommand(argv, appServer) {
|
|
|
469874
469958
|
else
|
|
469875
469959
|
console.error(...args);
|
|
469876
469960
|
};
|
|
469961
|
+
const startupPermissionMode = await applyStartupPermissionMode({});
|
|
469962
|
+
if (!startupPermissionMode.ok) {
|
|
469963
|
+
reportError(startupPermissionMode.error);
|
|
469964
|
+
return 1;
|
|
469965
|
+
}
|
|
469877
469966
|
await settingsManager.initialize();
|
|
469878
|
-
await applyStartupPermissionMode({});
|
|
469879
469967
|
telemetry.setSurface(getListenerTelemetrySurface());
|
|
469880
469968
|
telemetry.init({ handleSigint: false });
|
|
469881
469969
|
let isShuttingDown = false;
|
|
@@ -471009,7 +471097,7 @@ var init_memory_tokens = __esm(() => {
|
|
|
471009
471097
|
});
|
|
471010
471098
|
|
|
471011
471099
|
// src/cli/subcommands/memory.ts
|
|
471012
|
-
import { cpSync, existsSync as existsSync66, mkdirSync as mkdirSync53, rmSync as rmSync23, statSync as
|
|
471100
|
+
import { cpSync, existsSync as existsSync66, mkdirSync as mkdirSync53, rmSync as rmSync23, statSync as statSync25 } from "node:fs";
|
|
471013
471101
|
import { readdir as readdir13 } from "node:fs/promises";
|
|
471014
471102
|
import { dirname as dirname41, join as join109 } from "node:path";
|
|
471015
471103
|
import { parseArgs as parseArgs12 } from "node:util";
|
|
@@ -471084,8 +471172,8 @@ async function listBackups(agentId) {
|
|
|
471084
471172
|
const path47 = join109(agentRoot, entry.name);
|
|
471085
471173
|
let createdAt = null;
|
|
471086
471174
|
try {
|
|
471087
|
-
const
|
|
471088
|
-
createdAt =
|
|
471175
|
+
const stat14 = statSync25(path47);
|
|
471176
|
+
createdAt = stat14.mtime.toISOString();
|
|
471089
471177
|
} catch {
|
|
471090
471178
|
createdAt = null;
|
|
471091
471179
|
}
|
|
@@ -471211,8 +471299,8 @@ async function runMemorySubcommand(argv, deps = {}) {
|
|
|
471211
471299
|
console.error(`Backup not found: ${backupPath}`);
|
|
471212
471300
|
return 1;
|
|
471213
471301
|
}
|
|
471214
|
-
const
|
|
471215
|
-
if (!
|
|
471302
|
+
const stat14 = statSync25(backupPath);
|
|
471303
|
+
if (!stat14.isDirectory()) {
|
|
471216
471304
|
console.error(`Backup path is not a directory: ${backupPath}`);
|
|
471217
471305
|
return 1;
|
|
471218
471306
|
}
|
|
@@ -471234,8 +471322,8 @@ async function runMemorySubcommand(argv, deps = {}) {
|
|
|
471234
471322
|
return 1;
|
|
471235
471323
|
}
|
|
471236
471324
|
if (existsSync66(out)) {
|
|
471237
|
-
const
|
|
471238
|
-
if (
|
|
471325
|
+
const stat14 = statSync25(out);
|
|
471326
|
+
if (stat14.isDirectory()) {
|
|
471239
471327
|
const contents = await readdir13(out);
|
|
471240
471328
|
if (contents.length > 0) {
|
|
471241
471329
|
console.error(`Export directory not empty: ${out}`);
|
|
@@ -471282,7 +471370,7 @@ var init_memory6 = __esm(() => {
|
|
|
471282
471370
|
});
|
|
471283
471371
|
|
|
471284
471372
|
// src/backend/local/transcript-search.ts
|
|
471285
|
-
import { existsSync as existsSync67, readdirSync as readdirSync28, readFileSync as readFileSync55, statSync as
|
|
471373
|
+
import { existsSync as existsSync67, readdirSync as readdirSync28, readFileSync as readFileSync55, statSync as statSync26 } from "node:fs";
|
|
471286
471374
|
import { join as join110 } from "node:path";
|
|
471287
471375
|
function readJsonFile3(path47) {
|
|
471288
471376
|
if (!existsSync67(path47))
|
|
@@ -471621,7 +471709,7 @@ function conversationDirectories(storageDir) {
|
|
|
471621
471709
|
if (!existsSync67(conversationsDir))
|
|
471622
471710
|
return [];
|
|
471623
471711
|
try {
|
|
471624
|
-
return readdirSync28(conversationsDir).map((entry) => join110(conversationsDir, entry)).filter((entryPath) =>
|
|
471712
|
+
return readdirSync28(conversationsDir).map((entry) => join110(conversationsDir, entry)).filter((entryPath) => statSync26(entryPath).isDirectory());
|
|
471625
471713
|
} catch {
|
|
471626
471714
|
return [];
|
|
471627
471715
|
}
|
|
@@ -474280,7 +474368,7 @@ var init_sandbox_files = __esm(() => {
|
|
|
474280
474368
|
});
|
|
474281
474369
|
|
|
474282
474370
|
// src/cli/subcommands/sandbox.ts
|
|
474283
|
-
import { readFile as readFile29, stat as
|
|
474371
|
+
import { readFile as readFile29, stat as stat14, writeFile as writeFile19 } from "node:fs/promises";
|
|
474284
474372
|
import { basename as basename31, resolve as resolve40 } from "node:path";
|
|
474285
474373
|
import { parseArgs as parseArgs18 } from "node:util";
|
|
474286
474374
|
function printUsage13() {
|
|
@@ -474505,7 +474593,7 @@ async function runSandboxSubcommand(argv, deps = {}) {
|
|
|
474505
474593
|
throw new Error("Missing file path");
|
|
474506
474594
|
if (action === "upload") {
|
|
474507
474595
|
const localPath3 = resolve40(path49);
|
|
474508
|
-
const fileStat = await (deps.statLocalPath ??
|
|
474596
|
+
const fileStat = await (deps.statLocalPath ?? stat14)(localPath3);
|
|
474509
474597
|
if (!fileStat.isFile())
|
|
474510
474598
|
throw new Error(`${localPath3} is not a file`);
|
|
474511
474599
|
const data2 = await (deps.readLocalFile ?? readFile29)(localPath3);
|
|
@@ -475673,7 +475761,7 @@ import {
|
|
|
475673
475761
|
mkdtempSync as mkdtempSync6,
|
|
475674
475762
|
readFileSync as readFileSync57,
|
|
475675
475763
|
rmSync as rmSync26,
|
|
475676
|
-
statSync as
|
|
475764
|
+
statSync as statSync27,
|
|
475677
475765
|
writeFileSync as writeFileSync48
|
|
475678
475766
|
} from "node:fs";
|
|
475679
475767
|
import { mkdir as mkdir17, readdir as readdir14 } from "node:fs/promises";
|
|
@@ -476110,7 +476198,7 @@ async function installSkillDirectory(params) {
|
|
|
476110
476198
|
if (!existsSync71(skillMdPath)) {
|
|
476111
476199
|
throw new Error("No SKILL.md found in the skill directory.");
|
|
476112
476200
|
}
|
|
476113
|
-
if (!
|
|
476201
|
+
if (!statSync27(sourceDir).isDirectory()) {
|
|
476114
476202
|
throw new Error(`Skill source is not a directory: ${sourceDir}`);
|
|
476115
476203
|
}
|
|
476116
476204
|
const name = getSkillName(sourceDir);
|
|
@@ -476169,7 +476257,7 @@ async function deleteSkillDirectory(params) {
|
|
|
476169
476257
|
if (!existsSync71(targetPath)) {
|
|
476170
476258
|
throw new Error(`Skill "${name}" is not installed at ${targetPath}.`);
|
|
476171
476259
|
}
|
|
476172
|
-
if (!
|
|
476260
|
+
if (!statSync27(targetPath).isDirectory()) {
|
|
476173
476261
|
throw new Error(`Skill path is not a directory: ${targetPath}`);
|
|
476174
476262
|
}
|
|
476175
476263
|
rmSync26(targetPath, { recursive: true, force: true });
|
|
@@ -476749,10 +476837,10 @@ var init_teleport2 = __esm(() => {
|
|
|
476749
476837
|
});
|
|
476750
476838
|
|
|
476751
476839
|
// src/cli/subcommands/trajectories/readers.ts
|
|
476752
|
-
import { readdir as readdir15, readFile as readFile30, stat as
|
|
476840
|
+
import { readdir as readdir15, readFile as readFile30, stat as stat15 } from "node:fs/promises";
|
|
476753
476841
|
import { join as join114 } from "node:path";
|
|
476754
476842
|
async function loadSessionTranscript(item) {
|
|
476755
|
-
const stats = await
|
|
476843
|
+
const stats = await stat15(item.path);
|
|
476756
476844
|
if (stats.isDirectory()) {
|
|
476757
476845
|
return assembleEventDirectory(item.path);
|
|
476758
476846
|
}
|
|
@@ -476763,7 +476851,7 @@ async function loadSessionTranscript(item) {
|
|
|
476763
476851
|
}
|
|
476764
476852
|
async function assembleEventDirectory(sessionDir) {
|
|
476765
476853
|
const eventsSubdir = join114(sessionDir, "events");
|
|
476766
|
-
const eventsDir = (await
|
|
476854
|
+
const eventsDir = (await stat15(eventsSubdir).catch(() => null))?.isDirectory() ? eventsSubdir : sessionDir;
|
|
476767
476855
|
const names = (await readdir15(eventsDir, { withFileTypes: true })).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name).sort((a2, b3) => Number.parseInt(a2, 10) - Number.parseInt(b3, 10) || a2.localeCompare(b3));
|
|
476768
476856
|
if (names.length === 0) {
|
|
476769
476857
|
throw new Error(`No event files found in ${eventsDir}`);
|
|
@@ -476843,7 +476931,7 @@ import {
|
|
|
476843
476931
|
readdir as readdir16,
|
|
476844
476932
|
readFile as readFile31,
|
|
476845
476933
|
rm as rm14,
|
|
476846
|
-
stat as
|
|
476934
|
+
stat as stat16,
|
|
476847
476935
|
writeFile as writeFile20
|
|
476848
476936
|
} from "node:fs/promises";
|
|
476849
476937
|
import { basename as basename33, join as join115 } from "node:path";
|
|
@@ -476907,7 +476995,7 @@ function collectStats(records2) {
|
|
|
476907
476995
|
}
|
|
476908
476996
|
async function prepareOutDir(outDir) {
|
|
476909
476997
|
try {
|
|
476910
|
-
const existing = await
|
|
476998
|
+
const existing = await stat16(outDir);
|
|
476911
476999
|
if (!existing.isDirectory()) {
|
|
476912
477000
|
throw new Error(`--out ${outDir} exists and is not a directory`);
|
|
476913
477001
|
}
|
|
@@ -479799,29 +479887,6 @@ class ChannelGateway {
|
|
|
479799
479887
|
remainingSources
|
|
479800
479888
|
}));
|
|
479801
479889
|
}
|
|
479802
|
-
adoptQueuedDelivery(delivery) {
|
|
479803
|
-
const state2 = this.getState(delivery.runtime);
|
|
479804
|
-
const sources = uniqueLifecycleSources(delivery.sources);
|
|
479805
|
-
const pending2 = state2.pendingSourcesByClientMessageId.get(delivery.clientMessageId);
|
|
479806
|
-
if (pending2) {
|
|
479807
|
-
const matches3 = pending2.disposition === "queued" && JSON.stringify(pending2.sources) === JSON.stringify(sources);
|
|
479808
|
-
if (matches3)
|
|
479809
|
-
return;
|
|
479810
|
-
throw new Error(`Cannot adopt queued delivery ${delivery.clientMessageId}; conflicting metadata exists`);
|
|
479811
|
-
}
|
|
479812
|
-
if (state2.acceptedClientMessageIds.has(delivery.clientMessageId) || state2.active?.batchId === `channel-${delivery.clientMessageId}`) {
|
|
479813
|
-
throw new Error(`Cannot adopt queued delivery ${delivery.clientMessageId}; it is not queued`);
|
|
479814
|
-
}
|
|
479815
|
-
state2.pendingSourcesByClientMessageId.set(delivery.clientMessageId, {
|
|
479816
|
-
sources,
|
|
479817
|
-
disposition: "queued"
|
|
479818
|
-
});
|
|
479819
|
-
state2.routedSources = uniqueRoutedSources([
|
|
479820
|
-
...state2.routedSources,
|
|
479821
|
-
...delivery.sources
|
|
479822
|
-
]);
|
|
479823
|
-
this.rememberAcceptedClientMessageId(state2, delivery.clientMessageId);
|
|
479824
|
-
}
|
|
479825
479890
|
async restoreRuntime(runtime, sources) {
|
|
479826
479891
|
const state2 = this.getState(runtime);
|
|
479827
479892
|
state2.replayedControlRequestIds.clear();
|
|
@@ -479850,78 +479915,6 @@ class ChannelGateway {
|
|
|
479850
479915
|
}
|
|
479851
479916
|
return replayedRequestIds;
|
|
479852
479917
|
}
|
|
479853
|
-
async adoptActiveDelivery(delivery) {
|
|
479854
|
-
const key4 = runtimeKey(delivery.runtime);
|
|
479855
|
-
const stateExisted = this.states.has(key4);
|
|
479856
|
-
const state2 = this.getState(delivery.runtime);
|
|
479857
|
-
const batchId = `channel-${delivery.clientMessageId}`;
|
|
479858
|
-
await this.enqueueRegistration(async () => {
|
|
479859
|
-
if (state2.active) {
|
|
479860
|
-
if (state2.active.batchId !== batchId) {
|
|
479861
|
-
throw new Error(`Cannot adopt ${batchId}; ${state2.active.batchId} is already active`);
|
|
479862
|
-
}
|
|
479863
|
-
this.activateSources(state2, delivery.clientMessageId, delivery.sources);
|
|
479864
|
-
this.rememberAcceptedClientMessageId(state2, delivery.clientMessageId);
|
|
479865
|
-
return;
|
|
479866
|
-
}
|
|
479867
|
-
const previousRoutedSources = state2.routedSources;
|
|
479868
|
-
const wasAccepted = state2.acceptedClientMessageIds.has(delivery.clientMessageId);
|
|
479869
|
-
const routingSources = uniqueRoutedSources(delivery.sources);
|
|
479870
|
-
const active = {
|
|
479871
|
-
batchId,
|
|
479872
|
-
routingSources,
|
|
479873
|
-
lifecycleSources: uniqueLifecycleSources(delivery.sources),
|
|
479874
|
-
progress: createChannelTurnProgressBuilder(),
|
|
479875
|
-
richDraft: null,
|
|
479876
|
-
idempotencyScope: createMessageChannelIdempotencyScope()
|
|
479877
|
-
};
|
|
479878
|
-
state2.active = active;
|
|
479879
|
-
state2.routedSources = uniqueRoutedSources([
|
|
479880
|
-
...state2.routedSources,
|
|
479881
|
-
...delivery.sources
|
|
479882
|
-
]);
|
|
479883
|
-
this.rememberAcceptedClientMessageId(state2, delivery.clientMessageId);
|
|
479884
|
-
try {
|
|
479885
|
-
await this.performRuntimeRegistration(state2, {
|
|
479886
|
-
...delivery,
|
|
479887
|
-
content: ""
|
|
479888
|
-
});
|
|
479889
|
-
if (state2.active !== active)
|
|
479890
|
-
return;
|
|
479891
|
-
active.richDraft = this.hooks.createRichDraft?.({
|
|
479892
|
-
batchId,
|
|
479893
|
-
sources: routingSources
|
|
479894
|
-
}) ?? null;
|
|
479895
|
-
this.enqueueHook(state2, () => this.hooks.onLifecycle({
|
|
479896
|
-
type: "processing",
|
|
479897
|
-
batchId,
|
|
479898
|
-
sources: active.lifecycleSources
|
|
479899
|
-
}));
|
|
479900
|
-
} catch (error4) {
|
|
479901
|
-
active.richDraft?.dispose();
|
|
479902
|
-
if (state2.active === active)
|
|
479903
|
-
state2.active = null;
|
|
479904
|
-
state2.routedSources = previousRoutedSources;
|
|
479905
|
-
if (!wasAccepted) {
|
|
479906
|
-
state2.acceptedClientMessageIds.delete(delivery.clientMessageId);
|
|
479907
|
-
}
|
|
479908
|
-
if (!stateExisted && state2.active === null)
|
|
479909
|
-
this.states.delete(key4);
|
|
479910
|
-
throw error4;
|
|
479911
|
-
}
|
|
479912
|
-
});
|
|
479913
|
-
}
|
|
479914
|
-
releaseActiveDelivery(runtime, clientMessageId) {
|
|
479915
|
-
const key4 = runtimeKey(runtime);
|
|
479916
|
-
const state2 = this.states.get(key4);
|
|
479917
|
-
const active = state2?.active;
|
|
479918
|
-
if (!state2 || active?.batchId !== `channel-${clientMessageId}`) {
|
|
479919
|
-
return false;
|
|
479920
|
-
}
|
|
479921
|
-
active.richDraft?.dispose();
|
|
479922
|
-
this.states.delete(key4);
|
|
479923
|
-
return true;
|
|
479924
|
-
}
|
|
479925
479918
|
async registerRuntime(runtime, sources = [], defaultPermissionMode) {
|
|
479926
479919
|
const state2 = this.getState(runtime);
|
|
479927
479920
|
await this.enqueueRegistration(async () => {
|
|
@@ -479954,22 +479947,9 @@ class ChannelGateway {
|
|
|
479954
479947
|
return tool !== null;
|
|
479955
479948
|
});
|
|
479956
479949
|
}
|
|
479957
|
-
async releaseRuntimeTools(runtime, routedSources = []
|
|
479950
|
+
async releaseRuntimeTools(runtime, routedSources = []) {
|
|
479958
479951
|
await this.enqueueRegistration(async () => {
|
|
479959
|
-
|
|
479960
|
-
const state2 = this.states.get(key4);
|
|
479961
|
-
if (options.cleanupIdleRuntime) {
|
|
479962
|
-
if (routedSources.length > 0 || (state2?.routedSources.length ?? 0) > 0) {
|
|
479963
|
-
throw new Error("Cannot clean up a routed channel runtime");
|
|
479964
|
-
}
|
|
479965
|
-
if (state2?.active) {
|
|
479966
|
-
throw new Error("Cannot clean up an active channel runtime");
|
|
479967
|
-
}
|
|
479968
|
-
if ((state2?.pendingSourcesByClientMessageId.size ?? 0) > 0) {
|
|
479969
|
-
throw new Error("Cannot clean up a queued channel runtime");
|
|
479970
|
-
}
|
|
479971
|
-
this.states.delete(key4);
|
|
479972
|
-
} else if (routedSources.length > 0 || state2) {
|
|
479952
|
+
if (routedSources.length > 0 || this.states.has(runtimeKey(runtime))) {
|
|
479973
479953
|
return;
|
|
479974
479954
|
}
|
|
479975
479955
|
const response = await this.client.runtimeExternalToolsUpdate({
|
|
@@ -482499,7 +482479,7 @@ import { existsSync as existsSync310 } from "node:fs";
|
|
|
482499
482479
|
import { createRequire as createRequire22 } from "node:module";
|
|
482500
482480
|
import { dirname as dirname310, join as join510 } from "node:path";
|
|
482501
482481
|
import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
482502
|
-
import { readFile as readFile34, readdir as readdir17, stat as
|
|
482482
|
+
import { readFile as readFile34, readdir as readdir17, stat as stat17, mkdtemp as mkdtemp6, rm as rm15, mkdir as mkdir19, writeFile as writeFile21 } from "node:fs/promises";
|
|
482503
482483
|
import { tmpdir as tmpdir17 } from "node:os";
|
|
482504
482484
|
import { basename as basename35, dirname as dirname52, join as join810, relative as relative12, sep as sep10 } from "node:path";
|
|
482505
482485
|
import { execFile as execFile23 } from "node:child_process";
|
|
@@ -488280,7 +488260,7 @@ class SharedLocalAppServer {
|
|
|
488280
488260
|
}
|
|
488281
488261
|
}
|
|
488282
488262
|
async function loadSkillDirectory(dirPath) {
|
|
488283
|
-
const dirStat = await
|
|
488263
|
+
const dirStat = await stat17(dirPath).catch(() => null);
|
|
488284
488264
|
if (!dirStat?.isDirectory()) {
|
|
488285
488265
|
throw new Error(`Skill path is not a directory: ${dirPath}`);
|
|
488286
488266
|
}
|
|
@@ -497111,11 +497091,11 @@ var init_dist15 = __esm(() => {
|
|
|
497111
497091
|
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
|
497112
497092
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
497113
497093
|
}
|
|
497114
|
-
optimizeNames(names,
|
|
497094
|
+
optimizeNames(names, constants9) {
|
|
497115
497095
|
if (!names[this.name.str])
|
|
497116
497096
|
return;
|
|
497117
497097
|
if (this.rhs)
|
|
497118
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
497098
|
+
this.rhs = optimizeExpr(this.rhs, names, constants9);
|
|
497119
497099
|
return this;
|
|
497120
497100
|
}
|
|
497121
497101
|
get names() {
|
|
@@ -497133,10 +497113,10 @@ var init_dist15 = __esm(() => {
|
|
|
497133
497113
|
render({ _n }) {
|
|
497134
497114
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
497135
497115
|
}
|
|
497136
|
-
optimizeNames(names,
|
|
497116
|
+
optimizeNames(names, constants9) {
|
|
497137
497117
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
497138
497118
|
return;
|
|
497139
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
497119
|
+
this.rhs = optimizeExpr(this.rhs, names, constants9);
|
|
497140
497120
|
return this;
|
|
497141
497121
|
}
|
|
497142
497122
|
get names() {
|
|
@@ -497202,8 +497182,8 @@ var init_dist15 = __esm(() => {
|
|
|
497202
497182
|
optimizeNodes() {
|
|
497203
497183
|
return `${this.code}` ? this : undefined;
|
|
497204
497184
|
}
|
|
497205
|
-
optimizeNames(names,
|
|
497206
|
-
this.code = optimizeExpr(this.code, names,
|
|
497185
|
+
optimizeNames(names, constants9) {
|
|
497186
|
+
this.code = optimizeExpr(this.code, names, constants9);
|
|
497207
497187
|
return this;
|
|
497208
497188
|
}
|
|
497209
497189
|
get names() {
|
|
@@ -497233,12 +497213,12 @@ var init_dist15 = __esm(() => {
|
|
|
497233
497213
|
}
|
|
497234
497214
|
return nodes.length > 0 ? this : undefined;
|
|
497235
497215
|
}
|
|
497236
|
-
optimizeNames(names,
|
|
497216
|
+
optimizeNames(names, constants9) {
|
|
497237
497217
|
const { nodes } = this;
|
|
497238
497218
|
let i4 = nodes.length;
|
|
497239
497219
|
while (i4--) {
|
|
497240
497220
|
const n = nodes[i4];
|
|
497241
|
-
if (n.optimizeNames(names,
|
|
497221
|
+
if (n.optimizeNames(names, constants9))
|
|
497242
497222
|
continue;
|
|
497243
497223
|
subtractNames(names, n.names);
|
|
497244
497224
|
nodes.splice(i4, 1);
|
|
@@ -497295,12 +497275,12 @@ var init_dist15 = __esm(() => {
|
|
|
497295
497275
|
return;
|
|
497296
497276
|
return this;
|
|
497297
497277
|
}
|
|
497298
|
-
optimizeNames(names,
|
|
497278
|
+
optimizeNames(names, constants9) {
|
|
497299
497279
|
var _a22;
|
|
497300
|
-
this.else = (_a22 = this.else) === null || _a22 === undefined ? undefined : _a22.optimizeNames(names,
|
|
497301
|
-
if (!(super.optimizeNames(names,
|
|
497280
|
+
this.else = (_a22 = this.else) === null || _a22 === undefined ? undefined : _a22.optimizeNames(names, constants9);
|
|
497281
|
+
if (!(super.optimizeNames(names, constants9) || this.else))
|
|
497302
497282
|
return;
|
|
497303
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
497283
|
+
this.condition = optimizeExpr(this.condition, names, constants9);
|
|
497304
497284
|
return this;
|
|
497305
497285
|
}
|
|
497306
497286
|
get names() {
|
|
@@ -497325,10 +497305,10 @@ var init_dist15 = __esm(() => {
|
|
|
497325
497305
|
render(opts) {
|
|
497326
497306
|
return `for(${this.iteration})` + super.render(opts);
|
|
497327
497307
|
}
|
|
497328
|
-
optimizeNames(names,
|
|
497329
|
-
if (!super.optimizeNames(names,
|
|
497308
|
+
optimizeNames(names, constants9) {
|
|
497309
|
+
if (!super.optimizeNames(names, constants9))
|
|
497330
497310
|
return;
|
|
497331
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
497311
|
+
this.iteration = optimizeExpr(this.iteration, names, constants9);
|
|
497332
497312
|
return this;
|
|
497333
497313
|
}
|
|
497334
497314
|
get names() {
|
|
@@ -497366,10 +497346,10 @@ var init_dist15 = __esm(() => {
|
|
|
497366
497346
|
render(opts) {
|
|
497367
497347
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
497368
497348
|
}
|
|
497369
|
-
optimizeNames(names,
|
|
497370
|
-
if (!super.optimizeNames(names,
|
|
497349
|
+
optimizeNames(names, constants9) {
|
|
497350
|
+
if (!super.optimizeNames(names, constants9))
|
|
497371
497351
|
return;
|
|
497372
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
497352
|
+
this.iterable = optimizeExpr(this.iterable, names, constants9);
|
|
497373
497353
|
return this;
|
|
497374
497354
|
}
|
|
497375
497355
|
get names() {
|
|
@@ -497414,11 +497394,11 @@ var init_dist15 = __esm(() => {
|
|
|
497414
497394
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
497415
497395
|
return this;
|
|
497416
497396
|
}
|
|
497417
|
-
optimizeNames(names,
|
|
497397
|
+
optimizeNames(names, constants9) {
|
|
497418
497398
|
var _a22, _b;
|
|
497419
|
-
super.optimizeNames(names,
|
|
497420
|
-
(_a22 = this.catch) === null || _a22 === undefined || _a22.optimizeNames(names,
|
|
497421
|
-
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names,
|
|
497399
|
+
super.optimizeNames(names, constants9);
|
|
497400
|
+
(_a22 = this.catch) === null || _a22 === undefined || _a22.optimizeNames(names, constants9);
|
|
497401
|
+
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants9);
|
|
497422
497402
|
return this;
|
|
497423
497403
|
}
|
|
497424
497404
|
get names() {
|
|
@@ -497692,7 +497672,7 @@ var init_dist15 = __esm(() => {
|
|
|
497692
497672
|
function addExprNames(names, from) {
|
|
497693
497673
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
497694
497674
|
}
|
|
497695
|
-
function optimizeExpr(expr, names,
|
|
497675
|
+
function optimizeExpr(expr, names, constants9) {
|
|
497696
497676
|
if (expr instanceof code_1.Name)
|
|
497697
497677
|
return replaceName(expr);
|
|
497698
497678
|
if (!canOptimize(expr))
|
|
@@ -497707,14 +497687,14 @@ var init_dist15 = __esm(() => {
|
|
|
497707
497687
|
return items;
|
|
497708
497688
|
}, []));
|
|
497709
497689
|
function replaceName(n) {
|
|
497710
|
-
const c =
|
|
497690
|
+
const c = constants9[n.str];
|
|
497711
497691
|
if (c === undefined || names[n.str] !== 1)
|
|
497712
497692
|
return n;
|
|
497713
497693
|
delete names[n.str];
|
|
497714
497694
|
return c;
|
|
497715
497695
|
}
|
|
497716
497696
|
function canOptimize(e2) {
|
|
497717
|
-
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
497697
|
+
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants9[c.str] !== undefined);
|
|
497718
497698
|
}
|
|
497719
497699
|
}
|
|
497720
497700
|
function subtractNames(names, from) {
|
|
@@ -506620,11 +506600,11 @@ var init_dist15 = __esm(() => {
|
|
|
506620
506600
|
const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
|
|
506621
506601
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
506622
506602
|
}
|
|
506623
|
-
optimizeNames(names,
|
|
506603
|
+
optimizeNames(names, constants9) {
|
|
506624
506604
|
if (!names[this.name.str])
|
|
506625
506605
|
return;
|
|
506626
506606
|
if (this.rhs)
|
|
506627
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
506607
|
+
this.rhs = optimizeExpr(this.rhs, names, constants9);
|
|
506628
506608
|
return this;
|
|
506629
506609
|
}
|
|
506630
506610
|
get names() {
|
|
@@ -506642,10 +506622,10 @@ var init_dist15 = __esm(() => {
|
|
|
506642
506622
|
render({ _n }) {
|
|
506643
506623
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
506644
506624
|
}
|
|
506645
|
-
optimizeNames(names,
|
|
506625
|
+
optimizeNames(names, constants9) {
|
|
506646
506626
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
506647
506627
|
return;
|
|
506648
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
506628
|
+
this.rhs = optimizeExpr(this.rhs, names, constants9);
|
|
506649
506629
|
return this;
|
|
506650
506630
|
}
|
|
506651
506631
|
get names() {
|
|
@@ -506711,8 +506691,8 @@ var init_dist15 = __esm(() => {
|
|
|
506711
506691
|
optimizeNodes() {
|
|
506712
506692
|
return `${this.code}` ? this : undefined;
|
|
506713
506693
|
}
|
|
506714
|
-
optimizeNames(names,
|
|
506715
|
-
this.code = optimizeExpr(this.code, names,
|
|
506694
|
+
optimizeNames(names, constants9) {
|
|
506695
|
+
this.code = optimizeExpr(this.code, names, constants9);
|
|
506716
506696
|
return this;
|
|
506717
506697
|
}
|
|
506718
506698
|
get names() {
|
|
@@ -506742,12 +506722,12 @@ var init_dist15 = __esm(() => {
|
|
|
506742
506722
|
}
|
|
506743
506723
|
return nodes.length > 0 ? this : undefined;
|
|
506744
506724
|
}
|
|
506745
|
-
optimizeNames(names,
|
|
506725
|
+
optimizeNames(names, constants9) {
|
|
506746
506726
|
const { nodes } = this;
|
|
506747
506727
|
let i4 = nodes.length;
|
|
506748
506728
|
while (i4--) {
|
|
506749
506729
|
const n = nodes[i4];
|
|
506750
|
-
if (n.optimizeNames(names,
|
|
506730
|
+
if (n.optimizeNames(names, constants9))
|
|
506751
506731
|
continue;
|
|
506752
506732
|
subtractNames(names, n.names);
|
|
506753
506733
|
nodes.splice(i4, 1);
|
|
@@ -506804,12 +506784,12 @@ var init_dist15 = __esm(() => {
|
|
|
506804
506784
|
return;
|
|
506805
506785
|
return this;
|
|
506806
506786
|
}
|
|
506807
|
-
optimizeNames(names,
|
|
506787
|
+
optimizeNames(names, constants9) {
|
|
506808
506788
|
var _a32;
|
|
506809
|
-
this.else = (_a32 = this.else) === null || _a32 === undefined ? undefined : _a32.optimizeNames(names,
|
|
506810
|
-
if (!(super.optimizeNames(names,
|
|
506789
|
+
this.else = (_a32 = this.else) === null || _a32 === undefined ? undefined : _a32.optimizeNames(names, constants9);
|
|
506790
|
+
if (!(super.optimizeNames(names, constants9) || this.else))
|
|
506811
506791
|
return;
|
|
506812
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
506792
|
+
this.condition = optimizeExpr(this.condition, names, constants9);
|
|
506813
506793
|
return this;
|
|
506814
506794
|
}
|
|
506815
506795
|
get names() {
|
|
@@ -506834,10 +506814,10 @@ var init_dist15 = __esm(() => {
|
|
|
506834
506814
|
render(opts) {
|
|
506835
506815
|
return `for(${this.iteration})` + super.render(opts);
|
|
506836
506816
|
}
|
|
506837
|
-
optimizeNames(names,
|
|
506838
|
-
if (!super.optimizeNames(names,
|
|
506817
|
+
optimizeNames(names, constants9) {
|
|
506818
|
+
if (!super.optimizeNames(names, constants9))
|
|
506839
506819
|
return;
|
|
506840
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
506820
|
+
this.iteration = optimizeExpr(this.iteration, names, constants9);
|
|
506841
506821
|
return this;
|
|
506842
506822
|
}
|
|
506843
506823
|
get names() {
|
|
@@ -506875,10 +506855,10 @@ var init_dist15 = __esm(() => {
|
|
|
506875
506855
|
render(opts) {
|
|
506876
506856
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
506877
506857
|
}
|
|
506878
|
-
optimizeNames(names,
|
|
506879
|
-
if (!super.optimizeNames(names,
|
|
506858
|
+
optimizeNames(names, constants9) {
|
|
506859
|
+
if (!super.optimizeNames(names, constants9))
|
|
506880
506860
|
return;
|
|
506881
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
506861
|
+
this.iterable = optimizeExpr(this.iterable, names, constants9);
|
|
506882
506862
|
return this;
|
|
506883
506863
|
}
|
|
506884
506864
|
get names() {
|
|
@@ -506923,11 +506903,11 @@ var init_dist15 = __esm(() => {
|
|
|
506923
506903
|
(_b = this.finally) === null || _b === undefined || _b.optimizeNodes();
|
|
506924
506904
|
return this;
|
|
506925
506905
|
}
|
|
506926
|
-
optimizeNames(names,
|
|
506906
|
+
optimizeNames(names, constants9) {
|
|
506927
506907
|
var _a32, _b;
|
|
506928
|
-
super.optimizeNames(names,
|
|
506929
|
-
(_a32 = this.catch) === null || _a32 === undefined || _a32.optimizeNames(names,
|
|
506930
|
-
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names,
|
|
506908
|
+
super.optimizeNames(names, constants9);
|
|
506909
|
+
(_a32 = this.catch) === null || _a32 === undefined || _a32.optimizeNames(names, constants9);
|
|
506910
|
+
(_b = this.finally) === null || _b === undefined || _b.optimizeNames(names, constants9);
|
|
506931
506911
|
return this;
|
|
506932
506912
|
}
|
|
506933
506913
|
get names() {
|
|
@@ -507201,7 +507181,7 @@ var init_dist15 = __esm(() => {
|
|
|
507201
507181
|
function addExprNames(names, from) {
|
|
507202
507182
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
507203
507183
|
}
|
|
507204
|
-
function optimizeExpr(expr, names,
|
|
507184
|
+
function optimizeExpr(expr, names, constants9) {
|
|
507205
507185
|
if (expr instanceof code_1.Name)
|
|
507206
507186
|
return replaceName(expr);
|
|
507207
507187
|
if (!canOptimize(expr))
|
|
@@ -507216,14 +507196,14 @@ var init_dist15 = __esm(() => {
|
|
|
507216
507196
|
return items;
|
|
507217
507197
|
}, []));
|
|
507218
507198
|
function replaceName(n) {
|
|
507219
|
-
const c =
|
|
507199
|
+
const c = constants9[n.str];
|
|
507220
507200
|
if (c === undefined || names[n.str] !== 1)
|
|
507221
507201
|
return n;
|
|
507222
507202
|
delete names[n.str];
|
|
507223
507203
|
return c;
|
|
507224
507204
|
}
|
|
507225
507205
|
function canOptimize(e2) {
|
|
507226
|
-
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
507206
|
+
return e2 instanceof code_1._Code && e2._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants9[c.str] !== undefined);
|
|
507227
507207
|
}
|
|
507228
507208
|
}
|
|
507229
507209
|
function subtractNames(names, from) {
|
|
@@ -517581,6 +517561,140 @@ var init_model_selector_helpers = __esm(() => {
|
|
|
517581
517561
|
]);
|
|
517582
517562
|
});
|
|
517583
517563
|
|
|
517564
|
+
// src/cli/app/session-model-selection.ts
|
|
517565
|
+
function sessionModelVariants(entries2, model2) {
|
|
517566
|
+
const variants = entries2.filter((entry) => entry.handle === (model2.registryHandle ?? model2.handle) && entry.updateArgs?.context_window === model2.updateArgs?.context_window && (entry.updateArgs?.service_tier ?? null) === (model2.updateArgs?.service_tier ?? null));
|
|
517567
|
+
return variants.length > 0 ? variants : entries2.filter((entry) => entry.id === model2.id && entry.handle === model2.handle);
|
|
517568
|
+
}
|
|
517569
|
+
function sessionModelEffort(settings) {
|
|
517570
|
+
if (settings?.enable_reasoner === false || isRecord2(settings?.thinking) && settings.thinking.type === "disabled")
|
|
517571
|
+
return "none";
|
|
517572
|
+
const value = (isRecord2(settings?.reasoning) ? settings.reasoning.reasoning_effort : undefined) ?? settings?.reasoning_effort ?? settings?.effort ?? (isRecord2(settings?.thinking_config) && typeof settings.thinking_config.thinking_level === "string" ? settings.thinking_config.thinking_level.toLowerCase() : undefined);
|
|
517573
|
+
if (typeof value !== "string")
|
|
517574
|
+
return null;
|
|
517575
|
+
switch (value) {
|
|
517576
|
+
case "minimal":
|
|
517577
|
+
case "low":
|
|
517578
|
+
case "medium":
|
|
517579
|
+
case "high":
|
|
517580
|
+
case "xhigh":
|
|
517581
|
+
case "max":
|
|
517582
|
+
case "none":
|
|
517583
|
+
return value;
|
|
517584
|
+
default:
|
|
517585
|
+
return null;
|
|
517586
|
+
}
|
|
517587
|
+
}
|
|
517588
|
+
async function applySessionModelSelection(session3, selection, state2, management) {
|
|
517589
|
+
const target = typeof selection === "string" ? await resolveSessionModelArgument(session3, selection) : selection ?? await nextSessionModelEffort(session3, state2, management);
|
|
517590
|
+
if (!target)
|
|
517591
|
+
return;
|
|
517592
|
+
const { entry, handle: handle2 } = target;
|
|
517593
|
+
const result3 = await session3.updateModel({
|
|
517594
|
+
modelId: entry?.id,
|
|
517595
|
+
modelHandle: handle2 || undefined
|
|
517596
|
+
});
|
|
517597
|
+
const requestedEffort = sessionModelEffort(entry?.updateArgs);
|
|
517598
|
+
const effort = sessionModelEffort(result3.modelSettings);
|
|
517599
|
+
const model2 = result3.modelHandle ?? handle2;
|
|
517600
|
+
const label = modelLabelWithoutEffort(entry?.label) ?? model2;
|
|
517601
|
+
const effortMessage = effort ? ` (reasoning effort: ${effort})` : "";
|
|
517602
|
+
const warning = requestedEffort && requestedEffort !== effort ? ` The server did not confirm ${requestedEffort} reasoning effort.` : "";
|
|
517603
|
+
return {
|
|
517604
|
+
model: model2,
|
|
517605
|
+
modelEntry: requestedEffort === effort ? entry : undefined,
|
|
517606
|
+
modelEffort: effort,
|
|
517607
|
+
picker: undefined,
|
|
517608
|
+
error: undefined,
|
|
517609
|
+
commandOutput: `Model updated to ${label}${effortMessage}.${warning}`
|
|
517610
|
+
};
|
|
517611
|
+
}
|
|
517612
|
+
async function resolveSessionModelArgument(session3, argument) {
|
|
517613
|
+
const { entries: entries2 } = await session3.listModels();
|
|
517614
|
+
const entry = entries2.find((entry2) => entry2.id === argument) ?? entries2.find((entry2) => entry2.handle === argument && entry2.isDefault);
|
|
517615
|
+
if (entry)
|
|
517616
|
+
return { entry, handle: entry.handle };
|
|
517617
|
+
if (!argument.includes("/"))
|
|
517618
|
+
throw new Error(`Model not found: ${argument}`);
|
|
517619
|
+
return { handle: argument, entry: undefined };
|
|
517620
|
+
}
|
|
517621
|
+
async function loadSessionModelPicker(session3, state2, management) {
|
|
517622
|
+
const catalog2 = await session3.listModels();
|
|
517623
|
+
const modelEntry = state2.modelEntry ?? await readCurrentModelEntry(session3, catalog2, state2.model, management);
|
|
517624
|
+
return {
|
|
517625
|
+
modelEntry,
|
|
517626
|
+
modelEffort: state2.modelEffort ?? sessionModelEffort(modelEntry?.updateArgs),
|
|
517627
|
+
picker: {
|
|
517628
|
+
kind: "model",
|
|
517629
|
+
items: [],
|
|
517630
|
+
models: catalog2.entries,
|
|
517631
|
+
handles: catalog2.availableHandles,
|
|
517632
|
+
aliases: catalog2.byokProviderAliases
|
|
517633
|
+
}
|
|
517634
|
+
};
|
|
517635
|
+
}
|
|
517636
|
+
async function readCurrentModelEntry(session3, catalog2, handle2, management) {
|
|
517637
|
+
if (!management || !handle2)
|
|
517638
|
+
return;
|
|
517639
|
+
const conversationId = session3.conversationId;
|
|
517640
|
+
const agentId = session3.agentId;
|
|
517641
|
+
const conversation = conversationId && conversationId !== "default" ? await management.conversations.retrieve(conversationId).catch(() => {
|
|
517642
|
+
return;
|
|
517643
|
+
}) : undefined;
|
|
517644
|
+
const entity = conversation?.model_settings || !agentId ? conversation : await management.agents.retrieve(agentId).catch(() => {
|
|
517645
|
+
return;
|
|
517646
|
+
});
|
|
517647
|
+
if (!isRecord2(entity))
|
|
517648
|
+
return;
|
|
517649
|
+
const settings = isRecord2(entity.model_settings) ? entity.model_settings : undefined;
|
|
517650
|
+
const legacy = isRecord2(entity.llm_config) ? entity.llm_config : undefined;
|
|
517651
|
+
const contextWindow = entity.context_window_limit ?? legacy?.context_window;
|
|
517652
|
+
const serviceTier = settings?.service_tier ?? legacy?.service_tier ?? null;
|
|
517653
|
+
const effort = sessionModelEffort(settings) ?? sessionModelEffort(legacy);
|
|
517654
|
+
const registryHandle = baseHandleForByokAlias(handle2, catalog2.byokProviderAliases ?? {});
|
|
517655
|
+
const candidates = catalog2.entries.filter((entry) => (entry.handle === handle2 || entry.handle === registryHandle) && (entry.updateArgs?.service_tier ?? null) === serviceTier);
|
|
517656
|
+
const exactWindow = candidates.filter((entry) => entry.updateArgs?.context_window === contextWindow);
|
|
517657
|
+
const variants = exactWindow.length ? exactWindow : candidates;
|
|
517658
|
+
return effort && variants.find((entry) => sessionModelEffort(entry.updateArgs) === effort) || variants.find((entry) => entry.isDefault) || variants[0];
|
|
517659
|
+
}
|
|
517660
|
+
async function nextSessionModelEffort(session3, state2, management) {
|
|
517661
|
+
if (!state2.model)
|
|
517662
|
+
return;
|
|
517663
|
+
const catalog2 = await session3.listModels();
|
|
517664
|
+
const current = state2.modelEntry ?? await readCurrentModelEntry(session3, catalog2, state2.model, management);
|
|
517665
|
+
if (!current)
|
|
517666
|
+
return;
|
|
517667
|
+
const order = [
|
|
517668
|
+
null,
|
|
517669
|
+
"none",
|
|
517670
|
+
"minimal",
|
|
517671
|
+
"low",
|
|
517672
|
+
"medium",
|
|
517673
|
+
"high",
|
|
517674
|
+
"xhigh",
|
|
517675
|
+
"max"
|
|
517676
|
+
];
|
|
517677
|
+
const options = sessionModelVariants(catalog2.entries, current).sort((a2, b3) => order.indexOf(sessionModelEffort(a2.updateArgs)) - order.indexOf(sessionModelEffort(b3.updateArgs)));
|
|
517678
|
+
if (options.length < 2)
|
|
517679
|
+
return;
|
|
517680
|
+
const index = options.findIndex((option2) => option2.id === current.id);
|
|
517681
|
+
return { entry: options[(index + 1) % options.length], handle: state2.model };
|
|
517682
|
+
}
|
|
517683
|
+
function modelLabelWithoutEffort(label) {
|
|
517684
|
+
return label?.replace(/ \((?:low|medium|high|xhigh|max|minimal)\)$/i, "");
|
|
517685
|
+
}
|
|
517686
|
+
function projectSessionAgent(agent, defaultConversation, state2) {
|
|
517687
|
+
return {
|
|
517688
|
+
agentName: agent.name,
|
|
517689
|
+
...defaultConversation && state2.modelEffort === undefined ? {
|
|
517690
|
+
modelEffort: sessionModelEffort(isRecord2(agent.model_settings) ? agent.model_settings : undefined) ?? sessionModelEffort(isRecord2(agent.llm_config) ? agent.llm_config : undefined)
|
|
517691
|
+
} : {}
|
|
517692
|
+
};
|
|
517693
|
+
}
|
|
517694
|
+
var init_session_model_selection = __esm(() => {
|
|
517695
|
+
init_model_selector_helpers();
|
|
517696
|
+
});
|
|
517697
|
+
|
|
517584
517698
|
// src/cli/components/ModelSelector.tsx
|
|
517585
517699
|
function getModelCategories(_billingTier, isSelfHosted, localModelCatalog, recentModelCount) {
|
|
517586
517700
|
const showRecents = (recentModelCount ?? 0) >= 2;
|
|
@@ -517600,6 +517714,7 @@ function getModelCategories(_billingTier, isSelfHosted, localModelCatalog, recen
|
|
|
517600
517714
|
function ModelSelector({
|
|
517601
517715
|
currentModelId,
|
|
517602
517716
|
currentModelHandle,
|
|
517717
|
+
currentModelContextWindow,
|
|
517603
517718
|
currentModelServiceTier,
|
|
517604
517719
|
onSelect,
|
|
517605
517720
|
onOpenConnect,
|
|
@@ -517632,9 +517747,9 @@ function ModelSelector({
|
|
|
517632
517747
|
const isCached = false;
|
|
517633
517748
|
const isLoading = false;
|
|
517634
517749
|
const showLoginAction = false;
|
|
517635
|
-
const pickPreferredStaticModel = import_react38.useCallback((handle2,
|
|
517750
|
+
const pickPreferredStaticModel = import_react38.useCallback((handle2, variant) => {
|
|
517636
517751
|
const registryHandle = normalizeModelHandleForRegistry(handle2) ?? handle2;
|
|
517637
|
-
const staticCandidates = typedModels.filter((m4) => m4.handle ===
|
|
517752
|
+
const staticCandidates = typedModels.filter((m4) => variant ? m4.handle === handle2 && m4.updateArgs?.context_window === variant.updateArgs?.context_window && (m4.updateArgs?.service_tier ?? null) === (variant.updateArgs?.service_tier ?? null) : m4.handle === registryHandle);
|
|
517638
517753
|
return staticCandidates.find((m4) => m4.isDefault) ?? staticCandidates.find((m4) => m4.isFeatured) ?? staticCandidates.find((m4) => m4.updateArgs?.reasoning_effort === "medium") ?? staticCandidates.find((m4) => m4.updateArgs?.reasoning_effort === "high") ?? staticCandidates[0];
|
|
517639
517754
|
}, [typedModels]);
|
|
517640
517755
|
const serviceTierForModel = import_react38.useCallback((model2) => {
|
|
@@ -517713,7 +517828,7 @@ function ModelSelector({
|
|
|
517713
517828
|
if (seen.has(key4))
|
|
517714
517829
|
continue;
|
|
517715
517830
|
seen.add(key4);
|
|
517716
|
-
deduped.push(pickPreferredStaticModel(m4.handle,
|
|
517831
|
+
deduped.push(pickPreferredStaticModel(m4.handle, m4) ?? m4);
|
|
517717
517832
|
}
|
|
517718
517833
|
const featured = deduped.filter((m4) => m4.isFeatured);
|
|
517719
517834
|
const nonFeatured = deduped.filter((m4) => !m4.isFeatured);
|
|
@@ -518201,7 +518316,7 @@ function ModelSelector({
|
|
|
518201
518316
|
const isSelected = actualIndex === selectedIndex;
|
|
518202
518317
|
const modelServiceTier = serviceTierForModel(model2);
|
|
518203
518318
|
const currentServiceTier = currentModelServiceTier === CHATGPT_FAST_SERVICE_TIER ? CHATGPT_FAST_SERVICE_TIER : null;
|
|
518204
|
-
const isCurrent = (model2.id === currentModelId || model2.handle === currentModelHandle) && modelServiceTier === currentServiceTier;
|
|
518319
|
+
const isCurrent = (model2.id === currentModelId || model2.handle === currentModelHandle) && modelServiceTier === currentServiceTier && (currentModelContextWindow === undefined || model2.updateArgs?.context_window === currentModelContextWindow);
|
|
518205
518320
|
const showLock = isFreeTier && !model2.free && (category2 === "supported" || category2 === "all");
|
|
518206
518321
|
return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Box_default, {
|
|
518207
518322
|
flexDirection: "row",
|
|
@@ -518232,7 +518347,7 @@ function ModelSelector({
|
|
|
518232
518347
|
]
|
|
518233
518348
|
}, undefined, true, undefined, this)
|
|
518234
518349
|
]
|
|
518235
|
-
}, model2.id
|
|
518350
|
+
}, `${model2.id}:${model2.handle}:${model2.updateArgs?.context_window ?? ""}:${modelServiceTier ?? ""}`, true, undefined, this);
|
|
518236
518351
|
}),
|
|
518237
518352
|
showScrollDown ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text2, {
|
|
518238
518353
|
dimColor: true,
|
|
@@ -518268,73 +518383,61 @@ var init_ModelSelector = __esm(async () => {
|
|
|
518268
518383
|
});
|
|
518269
518384
|
|
|
518270
518385
|
// src/cli/app/SessionModelPicker.tsx
|
|
518271
|
-
function effort(value) {
|
|
518272
|
-
switch (value) {
|
|
518273
|
-
case "minimal":
|
|
518274
|
-
case "low":
|
|
518275
|
-
case "medium":
|
|
518276
|
-
case "high":
|
|
518277
|
-
case "xhigh":
|
|
518278
|
-
case "max":
|
|
518279
|
-
case "none":
|
|
518280
|
-
return value;
|
|
518281
|
-
default:
|
|
518282
|
-
return null;
|
|
518283
|
-
}
|
|
518284
|
-
}
|
|
518285
518386
|
function SessionModelPicker({
|
|
518286
518387
|
entries: entries2,
|
|
518287
518388
|
handles,
|
|
518288
518389
|
aliases,
|
|
518289
518390
|
currentModel,
|
|
518391
|
+
currentModelEntry,
|
|
518290
518392
|
local,
|
|
518291
518393
|
onOpenConnect,
|
|
518292
518394
|
refresh,
|
|
518293
518395
|
onSelect,
|
|
518294
518396
|
onCancel
|
|
518295
518397
|
}) {
|
|
518296
|
-
const [
|
|
518297
|
-
const
|
|
518298
|
-
|
|
518299
|
-
|
|
518300
|
-
|
|
518301
|
-
|
|
518302
|
-
|
|
518303
|
-
|
|
518304
|
-
return groups;
|
|
518305
|
-
}, [entries2]);
|
|
518306
|
-
const tiers = handle2 ? grouped.get(handle2) : undefined;
|
|
518307
|
-
if (tiers && tiers.length > 1)
|
|
518398
|
+
const [model2, setModel] = import_react39.useState();
|
|
518399
|
+
const tiers = import_react39.useMemo(() => model2 ? sessionModelVariants(entries2, model2) : [], [entries2, model2]);
|
|
518400
|
+
const options = import_react39.useMemo(() => tiers.map((entry) => ({
|
|
518401
|
+
modelId: entry.id,
|
|
518402
|
+
effort: sessionModelEffort(entry.updateArgs)
|
|
518403
|
+
})), [tiers]);
|
|
518404
|
+
if (model2 && tiers.length > 1) {
|
|
518405
|
+
const initialEntry = tiers.find((entry) => model2.handle === currentModel && entry.id === currentModelEntry?.id) ?? tiers.find((entry) => entry.id === model2.id) ?? tiers.find((entry) => entry.isDefault) ?? tiers[0];
|
|
518308
518406
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ModelReasoningSelector, {
|
|
518309
|
-
modelLabel:
|
|
518310
|
-
initialModelId:
|
|
518311
|
-
options
|
|
518312
|
-
|
|
518313
|
-
|
|
518314
|
-
|
|
518315
|
-
|
|
518316
|
-
|
|
518407
|
+
modelLabel: model2.label,
|
|
518408
|
+
initialModelId: initialEntry?.id ?? "",
|
|
518409
|
+
options,
|
|
518410
|
+
onSelect: (option2) => {
|
|
518411
|
+
const entry = tiers.find((tier) => tier.id === option2.modelId);
|
|
518412
|
+
if (entry)
|
|
518413
|
+
onSelect({ entry, handle: model2.handle });
|
|
518414
|
+
},
|
|
518415
|
+
onCancel: () => setModel(undefined)
|
|
518317
518416
|
}, undefined, false, undefined, this);
|
|
518417
|
+
}
|
|
518318
518418
|
return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ModelSelector, {
|
|
518319
518419
|
entries: entries2,
|
|
518320
518420
|
handles,
|
|
518321
518421
|
aliases,
|
|
518322
518422
|
currentModelHandle: currentModel,
|
|
518423
|
+
currentModelContextWindow: currentModelEntry?.updateArgs?.context_window,
|
|
518424
|
+
currentModelServiceTier: typeof currentModelEntry?.updateArgs?.service_tier === "string" ? currentModelEntry.updateArgs.service_tier : undefined,
|
|
518323
518425
|
localModelCatalog: local,
|
|
518324
518426
|
onOpenConnect,
|
|
518325
518427
|
refresh,
|
|
518326
518428
|
onCancel,
|
|
518327
|
-
onSelect: (
|
|
518328
|
-
const
|
|
518329
|
-
if (
|
|
518330
|
-
|
|
518429
|
+
onSelect: (model3) => {
|
|
518430
|
+
const variants = sessionModelVariants(entries2, model3);
|
|
518431
|
+
if (variants.length > 1)
|
|
518432
|
+
setModel(model3);
|
|
518331
518433
|
else
|
|
518332
|
-
onSelect(
|
|
518434
|
+
onSelect({ entry: variants[0], handle: model3.handle });
|
|
518333
518435
|
}
|
|
518334
518436
|
}, undefined, false, undefined, this);
|
|
518335
518437
|
}
|
|
518336
518438
|
var import_react39, jsx_dev_runtime23;
|
|
518337
518439
|
var init_SessionModelPicker = __esm(async () => {
|
|
518440
|
+
init_session_model_selection();
|
|
518338
518441
|
await __promiseAll([
|
|
518339
518442
|
init_ModelReasoningSelector(),
|
|
518340
518443
|
init_ModelSelector()
|
|
@@ -528396,20 +528499,20 @@ var init_dist16 = __esm(async () => {
|
|
|
528396
528499
|
});
|
|
528397
528500
|
|
|
528398
528501
|
// src/cli/components/AgentInfoBar.tsx
|
|
528399
|
-
function formatReasoningLabel(
|
|
528400
|
-
if (
|
|
528502
|
+
function formatReasoningLabel(effort) {
|
|
528503
|
+
if (effort === "none")
|
|
528401
528504
|
return null;
|
|
528402
|
-
if (
|
|
528505
|
+
if (effort === "xhigh")
|
|
528403
528506
|
return "xhigh";
|
|
528404
|
-
if (
|
|
528507
|
+
if (effort === "max")
|
|
528405
528508
|
return "max";
|
|
528406
|
-
if (
|
|
528509
|
+
if (effort === "minimal")
|
|
528407
528510
|
return "minimal";
|
|
528408
|
-
if (
|
|
528511
|
+
if (effort === "low")
|
|
528409
528512
|
return "low";
|
|
528410
|
-
if (
|
|
528513
|
+
if (effort === "medium")
|
|
528411
528514
|
return "medium";
|
|
528412
|
-
if (
|
|
528515
|
+
if (effort === "high")
|
|
528413
528516
|
return "high";
|
|
528414
528517
|
return null;
|
|
528415
528518
|
}
|
|
@@ -528668,7 +528771,7 @@ import {
|
|
|
528668
528771
|
readdirSync as readdirSync30,
|
|
528669
528772
|
renameSync as renameSync13,
|
|
528670
528773
|
rmSync as rmSync28,
|
|
528671
|
-
statSync as
|
|
528774
|
+
statSync as statSync28
|
|
528672
528775
|
} from "node:fs";
|
|
528673
528776
|
import { arch as arch3, homedir as homedir36, platform as platform10 } from "node:os";
|
|
528674
528777
|
import { basename as basename36, join as join120 } from "node:path";
|
|
@@ -528937,7 +529040,7 @@ class FileAutocompleteProvider {
|
|
|
528937
529040
|
baseDir = join120(this.basePath, displayBase);
|
|
528938
529041
|
}
|
|
528939
529042
|
try {
|
|
528940
|
-
if (!
|
|
529043
|
+
if (!statSync28(baseDir).isDirectory()) {
|
|
528941
529044
|
return null;
|
|
528942
529045
|
}
|
|
528943
529046
|
} catch {
|
|
@@ -535423,13 +535526,14 @@ function AppView({
|
|
|
535423
535526
|
handles: state2.picker.handles,
|
|
535424
535527
|
aliases: state2.picker.aliases,
|
|
535425
535528
|
currentModel: state2.model,
|
|
535529
|
+
currentModelEntry: state2.modelEntry,
|
|
535426
535530
|
local: isLocalAgentId(state2.agentId ?? ""),
|
|
535427
535531
|
refresh: () => store3.send("/model"),
|
|
535428
535532
|
onOpenConnect: () => {
|
|
535429
535533
|
store3.closePicker();
|
|
535430
535534
|
store3.send("/connect");
|
|
535431
535535
|
},
|
|
535432
|
-
onSelect: (
|
|
535536
|
+
onSelect: (selection) => void store3.selectModel(selection),
|
|
535433
535537
|
onCancel: () => store3.closePicker()
|
|
535434
535538
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime78.jsxDEV(ConversationSelector, {
|
|
535435
535539
|
reader: store3.conversations,
|
|
@@ -535509,6 +535613,22 @@ function isSessionSkillCommand(id, raw2) {
|
|
|
535509
535613
|
const name = `/${id}`;
|
|
535510
535614
|
return !terminalCommands.some((command) => command.cmd === name) && !serverCommands(raw2?.mod_commands).some((command) => command.cmd === name) && serverCommands(raw2?.current_available_skills).some((command) => command.cmd === name);
|
|
535511
535615
|
}
|
|
535616
|
+
function projectAvailableSkills(raw2, knownSkills) {
|
|
535617
|
+
return (Array.isArray(raw2) ? raw2 : []).flatMap((skill2) => {
|
|
535618
|
+
if (!isRecord2(skill2) || typeof skill2.name !== "string" || typeof skill2.path !== "string")
|
|
535619
|
+
return [];
|
|
535620
|
+
const path50 = skill2.path.replace(/[\\/]SKILL\.md$/i, "");
|
|
535621
|
+
const name = path50.split(/[\\/]/).at(-1) || skill2.name;
|
|
535622
|
+
const known = knownSkills?.find((entry) => entry.path === path50);
|
|
535623
|
+
return {
|
|
535624
|
+
path: path50,
|
|
535625
|
+
name,
|
|
535626
|
+
description: typeof skill2.description === "string" ? skill2.description : "",
|
|
535627
|
+
label: skill2.name,
|
|
535628
|
+
enabled: known?.enabled ?? skill2.source === "global"
|
|
535629
|
+
};
|
|
535630
|
+
});
|
|
535631
|
+
}
|
|
535512
535632
|
var sessionBuiltins, terminalCommands;
|
|
535513
535633
|
var init_terminal_commands = __esm(() => {
|
|
535514
535634
|
init_registry2();
|
|
@@ -535572,7 +535692,9 @@ function useTerminalInput({
|
|
|
535572
535692
|
commands: sessionCommands(state2.device?.raw),
|
|
535573
535693
|
searchFiles: (query3) => store3.searchFiles(query3)
|
|
535574
535694
|
}), [store3, state2.device]);
|
|
535575
|
-
const
|
|
535695
|
+
const modelEffort = state2.modelEffort;
|
|
535696
|
+
const currentModel = store3.modelDisplayName;
|
|
535697
|
+
const modelDisplayName = currentModel && modelEffort && modelEffort !== "none" ? `${currentModel} (${modelEffort})` : currentModel;
|
|
535576
535698
|
const context3 = import_react90.useMemo(() => buildModInvocationContext({
|
|
535577
535699
|
workingDirectory: state2.device?.workingDirectory ?? "",
|
|
535578
535700
|
agent: { id: state2.agentId, name: state2.agentName },
|
|
@@ -535600,7 +535722,9 @@ function useTerminalInput({
|
|
|
535600
535722
|
networkPhase: streaming3 ? state2.turnBytes ? "download" : "upload" : null,
|
|
535601
535723
|
thinkingMessage,
|
|
535602
535724
|
terminalWidth: width,
|
|
535603
|
-
currentModel
|
|
535725
|
+
currentModel,
|
|
535726
|
+
currentReasoningEffort: modelEffort,
|
|
535727
|
+
onCycleReasoningEffort: settingsManager.getSettings().reasoningTabCycleEnabled ? () => void store3.selectModel() : undefined,
|
|
535604
535728
|
includeSystemPromptUpgradeTip: false,
|
|
535605
535729
|
modContext: context3,
|
|
535606
535730
|
modAdapter: adapter,
|
|
@@ -535644,6 +535768,7 @@ var init_use_terminal_input = __esm(async () => {
|
|
|
535644
535768
|
init_thinking_messages();
|
|
535645
535769
|
init_use_terminal_width();
|
|
535646
535770
|
init_context2();
|
|
535771
|
+
init_settings_manager();
|
|
535647
535772
|
init_terminal_commands();
|
|
535648
535773
|
await init_build2();
|
|
535649
535774
|
import_react90 = __toESM(require_react(), 1);
|
|
@@ -535927,6 +536052,33 @@ function terminalSocket(receive) {
|
|
|
535927
536052
|
}
|
|
535928
536053
|
var init_terminal_runtime_events = () => {};
|
|
535929
536054
|
|
|
536055
|
+
// src/cli/app/history-tool-messages.ts
|
|
536056
|
+
function returnText(content) {
|
|
536057
|
+
return typeof content === "string" ? content : content.map((part) => part.type === "text" ? part.text : "").join("");
|
|
536058
|
+
}
|
|
536059
|
+
function split2(message2) {
|
|
536060
|
+
if ((message2.message_type === "approval_request_message" || message2.message_type === "tool_call_message") && Array.isArray(message2.tool_calls) && message2.tool_calls.length > 1)
|
|
536061
|
+
return message2.tool_calls.map((call) => ({
|
|
536062
|
+
...message2,
|
|
536063
|
+
tool_call: call,
|
|
536064
|
+
tool_calls: [call]
|
|
536065
|
+
}));
|
|
536066
|
+
if (message2.message_type === "tool_return_message" && message2.tool_returns && message2.tool_returns.length > 1)
|
|
536067
|
+
return message2.tool_returns.map((entry) => ({
|
|
536068
|
+
...message2,
|
|
536069
|
+
tool_call_id: entry.tool_call_id,
|
|
536070
|
+
tool_return: returnText(entry.tool_return),
|
|
536071
|
+
status: entry.status,
|
|
536072
|
+
stdout: entry.stdout,
|
|
536073
|
+
stderr: entry.stderr,
|
|
536074
|
+
tool_returns: [entry]
|
|
536075
|
+
}));
|
|
536076
|
+
return [message2];
|
|
536077
|
+
}
|
|
536078
|
+
function splitParallelToolMessages(messages) {
|
|
536079
|
+
return [...messages].flatMap(split2);
|
|
536080
|
+
}
|
|
536081
|
+
|
|
535930
536082
|
// src/cli/app/queued-draft.ts
|
|
535931
536083
|
function queuedDraft(content) {
|
|
535932
536084
|
if (typeof content === "string")
|
|
@@ -536159,6 +536311,7 @@ class TerminalSession {
|
|
|
536159
536311
|
eventSeq = new Map;
|
|
536160
536312
|
target;
|
|
536161
536313
|
session;
|
|
536314
|
+
modelUpdate;
|
|
536162
536315
|
state = {
|
|
536163
536316
|
rows: [],
|
|
536164
536317
|
notices: [],
|
|
@@ -536180,7 +536333,7 @@ class TerminalSession {
|
|
|
536180
536333
|
const model2 = this.state.model;
|
|
536181
536334
|
if (!model2)
|
|
536182
536335
|
return;
|
|
536183
|
-
return getModelDisplayName(model2) ?? this.catalog?.find((entry) => entry.handle === model2 || entry.id === model2)?.label ?? model2;
|
|
536336
|
+
return modelLabelWithoutEffort(this.state.modelEntry?.label ?? getModelDisplayName(model2) ?? this.catalog?.find((entry) => entry.handle === model2 || entry.id === model2)?.label ?? model2);
|
|
536184
536337
|
}
|
|
536185
536338
|
conversations = sessionConversations(() => {
|
|
536186
536339
|
if (!this.session)
|
|
@@ -536225,9 +536378,8 @@ class TerminalSession {
|
|
|
536225
536378
|
}
|
|
536226
536379
|
for (const [key4, message2] of existing)
|
|
536227
536380
|
this.historyMessages.set(key4, message2);
|
|
536228
|
-
const
|
|
536229
|
-
|
|
536230
|
-
});
|
|
536381
|
+
const history = splitParallelToolMessages(this.historyMessages.values());
|
|
536382
|
+
const rows = this.transcript.rebase(history, { order: "asc" });
|
|
536231
536383
|
this.project(rows, true);
|
|
536232
536384
|
}
|
|
536233
536385
|
async history(session3, before2) {
|
|
@@ -536253,7 +536405,12 @@ class TerminalSession {
|
|
|
536253
536405
|
}
|
|
536254
536406
|
async connect() {
|
|
536255
536407
|
this.close();
|
|
536256
|
-
this.update({
|
|
536408
|
+
this.update({
|
|
536409
|
+
status: "connecting",
|
|
536410
|
+
error: undefined,
|
|
536411
|
+
modelEntry: undefined,
|
|
536412
|
+
modelEffort: undefined
|
|
536413
|
+
});
|
|
536257
536414
|
const session3 = this.open((name, input, context3) => new Promise((resolve43) => {
|
|
536258
536415
|
if (session3 !== this.session)
|
|
536259
536416
|
return resolve43({ behavior: "deny", message: "Disconnected" });
|
|
@@ -536274,7 +536431,7 @@ class TerminalSession {
|
|
|
536274
536431
|
if (this.management && ready.agentId)
|
|
536275
536432
|
this.management.agents.retrieve(ready.agentId).then((agent) => {
|
|
536276
536433
|
if (this.session === session3)
|
|
536277
|
-
this.update(
|
|
536434
|
+
this.update(projectSessionAgent(agent, ready.conversationId === "default", this.state));
|
|
536278
536435
|
}).catch(() => {});
|
|
536279
536436
|
const receiveDevice = (device2) => {
|
|
536280
536437
|
if (session3 === this.session)
|
|
@@ -536428,23 +536585,26 @@ class TerminalSession {
|
|
|
536428
536585
|
closePicker() {
|
|
536429
536586
|
this.update({ picker: undefined });
|
|
536430
536587
|
}
|
|
536431
|
-
|
|
536432
|
-
|
|
536588
|
+
select(key4) {
|
|
536589
|
+
if (!this.session || !this.state.picker || this.state.picker.kind === "model")
|
|
536590
|
+
return;
|
|
536591
|
+
this.switchTarget(key4 === "default" && this.session.agentId ? this.session.agentId : key4);
|
|
536592
|
+
}
|
|
536593
|
+
async selectModel(selection) {
|
|
536433
536594
|
const session3 = this.session;
|
|
536434
|
-
if (!session3 ||
|
|
536595
|
+
if (!session3 || this.modelUpdate === session3)
|
|
536435
536596
|
return;
|
|
536436
|
-
|
|
536437
|
-
return this.switchTarget(key4 === "default" && session3.agentId ? session3.agentId : key4);
|
|
536597
|
+
this.modelUpdate = session3;
|
|
536438
536598
|
try {
|
|
536439
|
-
const
|
|
536440
|
-
if (session3 === this.session)
|
|
536441
|
-
this.update(
|
|
536442
|
-
model: model2.modelHandle ?? model2.modelId ?? key4,
|
|
536443
|
-
picker: undefined
|
|
536444
|
-
});
|
|
536599
|
+
const patch = await applySessionModelSelection(session3, selection, this.state, this.management);
|
|
536600
|
+
if (patch && session3 === this.session)
|
|
536601
|
+
this.update(patch);
|
|
536445
536602
|
} catch (error5) {
|
|
536446
536603
|
if (session3 === this.session)
|
|
536447
536604
|
this.fail(error5);
|
|
536605
|
+
} finally {
|
|
536606
|
+
if (this.modelUpdate === session3)
|
|
536607
|
+
this.modelUpdate = undefined;
|
|
536448
536608
|
}
|
|
536449
536609
|
}
|
|
536450
536610
|
deletePickerAgent = async (id) => {
|
|
@@ -536519,22 +536679,10 @@ class TerminalSession {
|
|
|
536519
536679
|
nextCursor: agents.length === 20 ? agents.at(-1)?.id ?? null : null
|
|
536520
536680
|
};
|
|
536521
536681
|
};
|
|
536522
|
-
async
|
|
536523
|
-
|
|
536524
|
-
|
|
536525
|
-
|
|
536526
|
-
this.update({
|
|
536527
|
-
picker: {
|
|
536528
|
-
kind,
|
|
536529
|
-
items: [],
|
|
536530
|
-
models: catalog2.entries,
|
|
536531
|
-
handles: catalog2.availableHandles,
|
|
536532
|
-
aliases: catalog2.byokProviderAliases
|
|
536533
|
-
}
|
|
536534
|
-
});
|
|
536535
|
-
return;
|
|
536536
|
-
}
|
|
536537
|
-
this.update({ picker: { kind, items: [] } });
|
|
536682
|
+
async openModelPicker(session3) {
|
|
536683
|
+
const patch = await loadSessionModelPicker(session3, this.state, this.management);
|
|
536684
|
+
if (session3 === this.session)
|
|
536685
|
+
this.update(patch);
|
|
536538
536686
|
}
|
|
536539
536687
|
receiveRuntimeEvent(event) {
|
|
536540
536688
|
const session3 = this.session;
|
|
@@ -536655,6 +536803,14 @@ class TerminalSession {
|
|
|
536655
536803
|
return;
|
|
536656
536804
|
const otid = crypto.randomUUID();
|
|
536657
536805
|
try {
|
|
536806
|
+
const modelCommand = /^\s*\/model(?:\s+(.+?))?\s*$/i.exec(text3);
|
|
536807
|
+
if (modelCommand) {
|
|
536808
|
+
if (modelCommand[1])
|
|
536809
|
+
await this.selectModel(modelCommand[1]);
|
|
536810
|
+
else
|
|
536811
|
+
await this.openModelPicker(session3);
|
|
536812
|
+
return;
|
|
536813
|
+
}
|
|
536658
536814
|
if (text3 === "/usage") {
|
|
536659
536815
|
this.update({
|
|
536660
536816
|
commandOutput: this.state.tokens === undefined ? "No turn usage reported by the server yet" : "Last turn: " + this.state.tokens + " tokens"
|
|
@@ -536666,22 +536822,9 @@ class TerminalSession {
|
|
|
536666
536822
|
if (session3 !== this.session)
|
|
536667
536823
|
return;
|
|
536668
536824
|
if (Array.isArray(status.raw?.supported_commands) && !status.raw.supported_commands.includes("skills")) {
|
|
536669
|
-
|
|
536670
|
-
|
|
536671
|
-
if (!isRecord2(skill2) || typeof skill2.name !== "string" || typeof skill2.path !== "string")
|
|
536672
|
-
return [];
|
|
536673
|
-
const path50 = skill2.path.replace(/[\\/]SKILL\.md$/i, "");
|
|
536674
|
-
const name = path50.split(/[\\/]/).at(-1) || skill2.name;
|
|
536675
|
-
const known = this.state.skills?.find((entry) => entry.path === path50);
|
|
536676
|
-
return {
|
|
536677
|
-
path: path50,
|
|
536678
|
-
name,
|
|
536679
|
-
description: typeof skill2.description === "string" ? skill2.description : "",
|
|
536680
|
-
label: skill2.name,
|
|
536681
|
-
enabled: known?.enabled ?? skill2.source === "global"
|
|
536682
|
-
};
|
|
536825
|
+
this.update({
|
|
536826
|
+
skills: projectAvailableSkills(status.raw.current_available_skills, this.state.skills)
|
|
536683
536827
|
});
|
|
536684
|
-
this.update({ skills });
|
|
536685
536828
|
return;
|
|
536686
536829
|
}
|
|
536687
536830
|
const result3 = await session3.sendCommand({
|
|
@@ -536750,8 +536893,10 @@ class TerminalSession {
|
|
|
536750
536893
|
});
|
|
536751
536894
|
return;
|
|
536752
536895
|
}
|
|
536753
|
-
if (text3 === "/agents" || text3 === "/resume"
|
|
536754
|
-
|
|
536896
|
+
if (text3 === "/agents" || text3 === "/resume") {
|
|
536897
|
+
this.update({
|
|
536898
|
+
picker: { kind: text3 === "/agents" ? "agents" : "resume", items: [] }
|
|
536899
|
+
});
|
|
536755
536900
|
return;
|
|
536756
536901
|
}
|
|
536757
536902
|
if (text3 === "/new" || text3 === "/clear") {
|
|
@@ -536944,6 +537089,7 @@ var init_terminal_session = __esm(() => {
|
|
|
536944
537089
|
init_model();
|
|
536945
537090
|
init_constants4();
|
|
536946
537091
|
init_queued_draft();
|
|
537092
|
+
init_session_model_selection();
|
|
536947
537093
|
init_session_subagents();
|
|
536948
537094
|
init_terminal_commands();
|
|
536949
537095
|
init_terminal_row_lifecycle();
|
|
@@ -538685,7 +538831,7 @@ async function handleHeadlessCommand(parsedArgs, model2, skillsDirectoryOverride
|
|
|
538685
538831
|
yoloMode
|
|
538686
538832
|
});
|
|
538687
538833
|
if (!startupPermissionMode.ok) {
|
|
538688
|
-
console.error(startupPermissionMode.
|
|
538834
|
+
console.error(startupPermissionMode.error);
|
|
538689
538835
|
process.exit(1);
|
|
538690
538836
|
}
|
|
538691
538837
|
if (values4.allowedTools || values4.disallowedTools || values4["disable-memory-guard"]) {
|
|
@@ -542142,20 +542288,6 @@ async function main() {
|
|
|
542142
542288
|
process.exitCode = subcommandResult;
|
|
542143
542289
|
return;
|
|
542144
542290
|
}
|
|
542145
|
-
await settingsManager.initialize();
|
|
542146
|
-
const settings = await settingsManager.getSettingsWithSecureTokens();
|
|
542147
|
-
markMilestone("SETTINGS_LOADED");
|
|
542148
|
-
if (process.env.LETTA_ENABLE_LSP) {
|
|
542149
|
-
try {
|
|
542150
|
-
const { lspManager: lspManager2 } = await Promise.resolve().then(() => (init_manager3(), exports_manager2));
|
|
542151
|
-
await lspManager2.initialize(process.cwd());
|
|
542152
|
-
} catch (error5) {
|
|
542153
|
-
trackCliBoundaryError("lsp_init_failed", error5, "tui_startup_lsp_init");
|
|
542154
|
-
console.error("[LSP] Failed to initialize:", error5);
|
|
542155
|
-
}
|
|
542156
|
-
}
|
|
542157
|
-
const { checkAndAutoUpdate: checkAndAutoUpdate2 } = await Promise.resolve().then(() => (init_auto_update(), exports_auto_update));
|
|
542158
|
-
const autoUpdatePromise = startStartupAutoUpdateCheck(checkAndAutoUpdate2);
|
|
542159
542291
|
const processedArgs = preprocessCliArgs([
|
|
542160
542292
|
process.argv[0] ?? "node",
|
|
542161
542293
|
process.argv[1] ?? "letta",
|
|
@@ -542180,6 +542312,30 @@ Note: Flags should use double dashes for full names (e.g., --yolo, not -yolo)`);
|
|
|
542180
542312
|
console.error("Run 'letta --help' for usage information.");
|
|
542181
542313
|
process.exit(1);
|
|
542182
542314
|
}
|
|
542315
|
+
if (!values4.help && !values4.version && !values4.info) {
|
|
542316
|
+
const startupPermissionMode = await applyStartupPermissionMode({
|
|
542317
|
+
permissionModeValue: values4["permission-mode"],
|
|
542318
|
+
yoloMode: values4.yolo
|
|
542319
|
+
});
|
|
542320
|
+
if (!startupPermissionMode.ok) {
|
|
542321
|
+
console.error(startupPermissionMode.error);
|
|
542322
|
+
process.exit(1);
|
|
542323
|
+
}
|
|
542324
|
+
}
|
|
542325
|
+
await settingsManager.initialize();
|
|
542326
|
+
const settings = await settingsManager.getSettingsWithSecureTokens();
|
|
542327
|
+
markMilestone("SETTINGS_LOADED");
|
|
542328
|
+
if (process.env.LETTA_ENABLE_LSP) {
|
|
542329
|
+
try {
|
|
542330
|
+
const { lspManager: lspManager2 } = await Promise.resolve().then(() => (init_manager3(), exports_manager2));
|
|
542331
|
+
await lspManager2.initialize(process.cwd());
|
|
542332
|
+
} catch (error5) {
|
|
542333
|
+
trackCliBoundaryError("lsp_init_failed", error5, "tui_startup_lsp_init");
|
|
542334
|
+
console.error("[LSP] Failed to initialize:", error5);
|
|
542335
|
+
}
|
|
542336
|
+
}
|
|
542337
|
+
const { checkAndAutoUpdate: checkAndAutoUpdate2 } = await Promise.resolve().then(() => (init_auto_update(), exports_auto_update));
|
|
542338
|
+
const autoUpdatePromise = startStartupAutoUpdateCheck(checkAndAutoUpdate2);
|
|
542183
542339
|
hideHeadlessPrompt(values4, process.stdin.isTTY, positionals);
|
|
542184
542340
|
const command = positionals[2];
|
|
542185
542341
|
if (values4.help) {
|
|
@@ -542559,16 +542715,6 @@ Error: ${message2}`);
|
|
|
542559
542715
|
cliPermissions2.setMemoryGuardDisabled(true);
|
|
542560
542716
|
}
|
|
542561
542717
|
}
|
|
542562
|
-
const permissionModeValue = typeof values4["permission-mode"] === "string" ? values4["permission-mode"] : undefined;
|
|
542563
|
-
const yoloMode = values4.yolo;
|
|
542564
|
-
const startupPermissionMode = await applyStartupPermissionMode({
|
|
542565
|
-
permissionModeValue,
|
|
542566
|
-
yoloMode
|
|
542567
|
-
});
|
|
542568
|
-
if (!startupPermissionMode.ok) {
|
|
542569
|
-
console.error(startupPermissionMode.message);
|
|
542570
|
-
process.exit(1);
|
|
542571
|
-
}
|
|
542572
542718
|
if (isHeadless) {
|
|
542573
542719
|
markMilestone("HEADLESS_MODE_START");
|
|
542574
542720
|
await loadStartupTools({
|
|
@@ -545724,4 +545870,4 @@ function registerBunOAuthFlows() {
|
|
|
545724
545870
|
registerBunOAuthFlows();
|
|
545725
545871
|
await init_src5().then(() => exports_src2);
|
|
545726
545872
|
|
|
545727
|
-
//# debugId=
|
|
545873
|
+
//# debugId=454EC66CEF75989564756E2164756E21
|