osagent 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +365 -45
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -127498,7 +127498,7 @@ var require_homedir = __commonJS({
|
|
|
127498
127498
|
"use strict";
|
|
127499
127499
|
init_esbuild_shims();
|
|
127500
127500
|
var os45 = __require("os");
|
|
127501
|
-
module2.exports = os45.homedir || /* @__PURE__ */ __name(function
|
|
127501
|
+
module2.exports = os45.homedir || /* @__PURE__ */ __name(function homedir23() {
|
|
127502
127502
|
var home = process.env.HOME;
|
|
127503
127503
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
|
127504
127504
|
if (process.platform === "win32") {
|
|
@@ -127993,11 +127993,11 @@ var require_async = __commonJS({
|
|
|
127993
127993
|
var normalizeOptions = require_normalize_options();
|
|
127994
127994
|
var isCore = require_is_core_module();
|
|
127995
127995
|
var realpathFS = process.platform !== "win32" && fs99.realpath && typeof fs99.realpath.native === "function" ? fs99.realpath.native : fs99.realpath;
|
|
127996
|
-
var
|
|
127996
|
+
var homedir23 = getHomedir();
|
|
127997
127997
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
|
127998
127998
|
return [
|
|
127999
|
-
path112.join(
|
|
128000
|
-
path112.join(
|
|
127999
|
+
path112.join(homedir23, ".node_modules"),
|
|
128000
|
+
path112.join(homedir23, ".node_libraries")
|
|
128001
128001
|
];
|
|
128002
128002
|
}, "defaultPaths");
|
|
128003
128003
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile2(file, cb) {
|
|
@@ -128499,11 +128499,11 @@ var require_sync = __commonJS({
|
|
|
128499
128499
|
var nodeModulesPaths = require_node_modules_paths();
|
|
128500
128500
|
var normalizeOptions = require_normalize_options();
|
|
128501
128501
|
var realpathFS = process.platform !== "win32" && fs99.realpathSync && typeof fs99.realpathSync.native === "function" ? fs99.realpathSync.native : fs99.realpathSync;
|
|
128502
|
-
var
|
|
128502
|
+
var homedir23 = getHomedir();
|
|
128503
128503
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
|
128504
128504
|
return [
|
|
128505
|
-
path112.join(
|
|
128506
|
-
path112.join(
|
|
128505
|
+
path112.join(homedir23, ".node_modules"),
|
|
128506
|
+
path112.join(homedir23, ".node_libraries")
|
|
128507
128507
|
];
|
|
128508
128508
|
}, "defaultPaths");
|
|
128509
128509
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile2(file) {
|
|
@@ -146108,7 +146108,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
146108
146108
|
};
|
|
146109
146109
|
}
|
|
146110
146110
|
async function createContentGenerator(config, gcConfig, sessionId2, isInitialAuth) {
|
|
146111
|
-
const version2 = "0.1.
|
|
146111
|
+
const version2 = "0.1.13";
|
|
146112
146112
|
const userAgent2 = `OSAgent/${version2} (${process.platform}; ${process.arch})`;
|
|
146113
146113
|
const baseHeaders = {
|
|
146114
146114
|
"User-Agent": userAgent2
|
|
@@ -200790,8 +200790,8 @@ function many(p) {
|
|
|
200790
200790
|
function many1(p) {
|
|
200791
200791
|
return ab(p, many(p), (head, tail) => [head, ...tail]);
|
|
200792
200792
|
}
|
|
200793
|
-
function ab(pa, pb,
|
|
200794
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) =>
|
|
200793
|
+
function ab(pa, pb, join41) {
|
|
200794
|
+
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join41(ma.value, vb, data, i, j)));
|
|
200795
200795
|
}
|
|
200796
200796
|
function left(pa, pb) {
|
|
200797
200797
|
return ab(pa, pb, (va) => va);
|
|
@@ -200799,8 +200799,8 @@ function left(pa, pb) {
|
|
|
200799
200799
|
function right(pa, pb) {
|
|
200800
200800
|
return ab(pa, pb, (va, vb) => vb);
|
|
200801
200801
|
}
|
|
200802
|
-
function abc(pa, pb, pc,
|
|
200803
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) =>
|
|
200802
|
+
function abc(pa, pb, pc, join41) {
|
|
200803
|
+
return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join41(ma.value, mb.value, vc, data, i, j))));
|
|
200804
200804
|
}
|
|
200805
200805
|
function middle(pa, pb, pc) {
|
|
200806
200806
|
return abc(pa, pb, pc, (ra, rb) => rb);
|
|
@@ -261869,10 +261869,10 @@ var require_stringify2 = __commonJS({
|
|
|
261869
261869
|
replacer = null;
|
|
261870
261870
|
indent = EMPTY2;
|
|
261871
261871
|
}, "clean");
|
|
261872
|
-
var
|
|
261872
|
+
var join41 = /* @__PURE__ */ __name((one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY2, "join");
|
|
261873
261873
|
var join_content = /* @__PURE__ */ __name((inside, value, gap) => {
|
|
261874
261874
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true);
|
|
261875
|
-
return
|
|
261875
|
+
return join41(comment, inside, gap);
|
|
261876
261876
|
}, "join_content");
|
|
261877
261877
|
var array_stringify = /* @__PURE__ */ __name((value, gap) => {
|
|
261878
261878
|
const deeper_gap = gap + indent;
|
|
@@ -261883,7 +261883,7 @@ var require_stringify2 = __commonJS({
|
|
|
261883
261883
|
if (i !== 0) {
|
|
261884
261884
|
inside += COMMA;
|
|
261885
261885
|
}
|
|
261886
|
-
const before =
|
|
261886
|
+
const before = join41(
|
|
261887
261887
|
after_comma,
|
|
261888
261888
|
process_comments(value, BEFORE(i), deeper_gap),
|
|
261889
261889
|
deeper_gap
|
|
@@ -261893,7 +261893,7 @@ var require_stringify2 = __commonJS({
|
|
|
261893
261893
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
261894
261894
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
261895
261895
|
}
|
|
261896
|
-
inside +=
|
|
261896
|
+
inside += join41(
|
|
261897
261897
|
after_comma,
|
|
261898
261898
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
261899
261899
|
deeper_gap
|
|
@@ -261918,7 +261918,7 @@ var require_stringify2 = __commonJS({
|
|
|
261918
261918
|
inside += COMMA;
|
|
261919
261919
|
}
|
|
261920
261920
|
first2 = false;
|
|
261921
|
-
const before =
|
|
261921
|
+
const before = join41(
|
|
261922
261922
|
after_comma,
|
|
261923
261923
|
process_comments(value, BEFORE(key), deeper_gap),
|
|
261924
261924
|
deeper_gap
|
|
@@ -261928,7 +261928,7 @@ var require_stringify2 = __commonJS({
|
|
|
261928
261928
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
261929
261929
|
}, "iteratee");
|
|
261930
261930
|
keys.forEach(iteratee);
|
|
261931
|
-
inside +=
|
|
261931
|
+
inside += join41(
|
|
261932
261932
|
after_comma,
|
|
261933
261933
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
261934
261934
|
deeper_gap
|
|
@@ -268693,7 +268693,7 @@ var require_command_exists = __commonJS({
|
|
|
268693
268693
|
"use strict";
|
|
268694
268694
|
init_esbuild_shims();
|
|
268695
268695
|
var exec5 = __require("child_process").exec;
|
|
268696
|
-
var
|
|
268696
|
+
var execSync9 = __require("child_process").execSync;
|
|
268697
268697
|
var fs99 = __require("fs");
|
|
268698
268698
|
var path112 = __require("path");
|
|
268699
268699
|
var access6 = fs99.access;
|
|
@@ -268767,7 +268767,7 @@ var require_command_exists = __commonJS({
|
|
|
268767
268767
|
var commandExistsUnixSync = /* @__PURE__ */ __name(function(commandName, cleanedCommandName) {
|
|
268768
268768
|
if (fileNotExistsSync(commandName)) {
|
|
268769
268769
|
try {
|
|
268770
|
-
var stdout =
|
|
268770
|
+
var stdout = execSync9(
|
|
268771
268771
|
"command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }"
|
|
268772
268772
|
);
|
|
268773
268773
|
return !!stdout;
|
|
@@ -268782,7 +268782,7 @@ var require_command_exists = __commonJS({
|
|
|
268782
268782
|
return false;
|
|
268783
268783
|
}
|
|
268784
268784
|
try {
|
|
268785
|
-
var stdout =
|
|
268785
|
+
var stdout = execSync9("where " + cleanedCommandName, { stdio: [] });
|
|
268786
268786
|
return !!stdout;
|
|
268787
268787
|
} catch (error) {
|
|
268788
268788
|
return false;
|
|
@@ -283016,7 +283016,7 @@ var require_rc = __commonJS({
|
|
|
283016
283016
|
"node_modules/rc/index.js"(exports2, module2) {
|
|
283017
283017
|
init_esbuild_shims();
|
|
283018
283018
|
var cc = require_utils16();
|
|
283019
|
-
var
|
|
283019
|
+
var join41 = __require("path").join;
|
|
283020
283020
|
var deepExtend = require_deep_extend();
|
|
283021
283021
|
var etc = "/etc";
|
|
283022
283022
|
var win2 = process.platform === "win32";
|
|
@@ -283042,15 +283042,15 @@ var require_rc = __commonJS({
|
|
|
283042
283042
|
__name(addConfigFile, "addConfigFile");
|
|
283043
283043
|
if (!win2)
|
|
283044
283044
|
[
|
|
283045
|
-
|
|
283046
|
-
|
|
283045
|
+
join41(etc, name3, "config"),
|
|
283046
|
+
join41(etc, name3 + "rc")
|
|
283047
283047
|
].forEach(addConfigFile);
|
|
283048
283048
|
if (home)
|
|
283049
283049
|
[
|
|
283050
|
-
|
|
283051
|
-
|
|
283052
|
-
|
|
283053
|
-
|
|
283050
|
+
join41(home, ".config", name3, "config"),
|
|
283051
|
+
join41(home, ".config", name3),
|
|
283052
|
+
join41(home, "." + name3, "config"),
|
|
283053
|
+
join41(home, "." + name3 + "rc")
|
|
283054
283054
|
].forEach(addConfigFile);
|
|
283055
283055
|
addConfigFile(cc.find("." + name3 + "rc"));
|
|
283056
283056
|
if (env8.config) addConfigFile(env8.config);
|
|
@@ -309520,7 +309520,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
309520
309520
|
// packages/cli/src/utils/version.ts
|
|
309521
309521
|
async function getCliVersion() {
|
|
309522
309522
|
const pkgJson = await getPackageJson();
|
|
309523
|
-
return "0.1.
|
|
309523
|
+
return "0.1.13";
|
|
309524
309524
|
}
|
|
309525
309525
|
__name(getCliVersion, "getCliVersion");
|
|
309526
309526
|
|
|
@@ -313525,7 +313525,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
|
|
|
313525
313525
|
|
|
313526
313526
|
// packages/cli/src/generated/git-commit.ts
|
|
313527
313527
|
init_esbuild_shims();
|
|
313528
|
-
var GIT_COMMIT_INFO2 = "
|
|
313528
|
+
var GIT_COMMIT_INFO2 = "009b589";
|
|
313529
313529
|
|
|
313530
313530
|
// packages/cli/src/utils/systemInfo.ts
|
|
313531
313531
|
async function getNpmVersion() {
|
|
@@ -314585,6 +314585,92 @@ var corgiCommand = {
|
|
|
314585
314585
|
}, "action")
|
|
314586
314586
|
};
|
|
314587
314587
|
|
|
314588
|
+
// packages/cli/src/ui/commands/dangerouslyCommand.ts
|
|
314589
|
+
init_esbuild_shims();
|
|
314590
|
+
var dangerouslyCommand = {
|
|
314591
|
+
name: "dangerously",
|
|
314592
|
+
get description() {
|
|
314593
|
+
return t2("Toggle dangerous mode - auto-accept all tool executions without confirmation");
|
|
314594
|
+
},
|
|
314595
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314596
|
+
subCommands: [
|
|
314597
|
+
{
|
|
314598
|
+
name: "on",
|
|
314599
|
+
get description() {
|
|
314600
|
+
return t2("Enable dangerous mode - bypass all confirmations");
|
|
314601
|
+
},
|
|
314602
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314603
|
+
action: /* @__PURE__ */ __name(async (context2) => {
|
|
314604
|
+
const settings = context2.services.settings;
|
|
314605
|
+
if (settings) {
|
|
314606
|
+
settings.setValue("User" /* User */, "tools.autoAccept", true);
|
|
314607
|
+
}
|
|
314608
|
+
return {
|
|
314609
|
+
type: "message",
|
|
314610
|
+
messageType: "info",
|
|
314611
|
+
content: t2("\u26A0\uFE0F DANGEROUS MODE ENABLED\nAll tool executions will be auto-accepted without confirmation.\nUse /dangerously off to disable.")
|
|
314612
|
+
};
|
|
314613
|
+
}, "action")
|
|
314614
|
+
},
|
|
314615
|
+
{
|
|
314616
|
+
name: "off",
|
|
314617
|
+
get description() {
|
|
314618
|
+
return t2("Disable dangerous mode - require confirmations");
|
|
314619
|
+
},
|
|
314620
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314621
|
+
action: /* @__PURE__ */ __name(async (context2) => {
|
|
314622
|
+
const settings = context2.services.settings;
|
|
314623
|
+
if (settings) {
|
|
314624
|
+
settings.setValue("User" /* User */, "tools.autoAccept", false);
|
|
314625
|
+
}
|
|
314626
|
+
return {
|
|
314627
|
+
type: "message",
|
|
314628
|
+
messageType: "info",
|
|
314629
|
+
content: t2("Safe mode restored. Tool executions will require confirmation.")
|
|
314630
|
+
};
|
|
314631
|
+
}, "action")
|
|
314632
|
+
}
|
|
314633
|
+
],
|
|
314634
|
+
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
314635
|
+
const settings = context2.services.settings;
|
|
314636
|
+
const currentValue = settings?.merged.tools?.autoAccept ?? false;
|
|
314637
|
+
if (args.trim() === "") {
|
|
314638
|
+
const newValue = !currentValue;
|
|
314639
|
+
if (settings) {
|
|
314640
|
+
settings.setValue("User" /* User */, "tools.autoAccept", newValue);
|
|
314641
|
+
}
|
|
314642
|
+
if (newValue) {
|
|
314643
|
+
return {
|
|
314644
|
+
type: "message",
|
|
314645
|
+
messageType: "info",
|
|
314646
|
+
content: t2("\u26A0\uFE0F DANGEROUS MODE ENABLED\nAll tool executions will be auto-accepted without confirmation.\nUse /dangerously off to disable.")
|
|
314647
|
+
};
|
|
314648
|
+
} else {
|
|
314649
|
+
return {
|
|
314650
|
+
type: "message",
|
|
314651
|
+
messageType: "info",
|
|
314652
|
+
content: t2("Safe mode restored. Tool executions will require confirmation.")
|
|
314653
|
+
};
|
|
314654
|
+
}
|
|
314655
|
+
}
|
|
314656
|
+
return {
|
|
314657
|
+
type: "message",
|
|
314658
|
+
messageType: "info",
|
|
314659
|
+
content: t2(`Dangerous mode is currently: ${currentValue ? "ON" : "OFF"}
|
|
314660
|
+
Use /dangerously on|off to change.`)
|
|
314661
|
+
};
|
|
314662
|
+
}, "action")
|
|
314663
|
+
};
|
|
314664
|
+
var yoloCommand = {
|
|
314665
|
+
name: "yolo",
|
|
314666
|
+
get description() {
|
|
314667
|
+
return t2("Alias for /dangerously - auto-accept all tool executions");
|
|
314668
|
+
},
|
|
314669
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314670
|
+
action: dangerouslyCommand.action,
|
|
314671
|
+
subCommands: dangerouslyCommand.subCommands
|
|
314672
|
+
};
|
|
314673
|
+
|
|
314588
314674
|
// packages/cli/src/ui/commands/delegateCommand.ts
|
|
314589
314675
|
init_esbuild_shims();
|
|
314590
314676
|
var BUILTIN_AGENTS = [
|
|
@@ -314721,6 +314807,212 @@ Use the Task tool to spawn the "${agentName}" subagent with this task. The agent
|
|
|
314721
314807
|
}, "completion")
|
|
314722
314808
|
};
|
|
314723
314809
|
|
|
314810
|
+
// packages/cli/src/ui/commands/doctorCommand.ts
|
|
314811
|
+
init_esbuild_shims();
|
|
314812
|
+
import { execSync as execSync5 } from "child_process";
|
|
314813
|
+
import { existsSync as existsSync19, readdirSync as readdirSync4 } from "fs";
|
|
314814
|
+
import { homedir as homedir18 } from "os";
|
|
314815
|
+
import { join as join32 } from "path";
|
|
314816
|
+
function getCurrentVersion() {
|
|
314817
|
+
try {
|
|
314818
|
+
const pkg2 = execSync5("npm list -g osagent --json 2>/dev/null", { encoding: "utf-8" });
|
|
314819
|
+
const parsed = JSON.parse(pkg2);
|
|
314820
|
+
return parsed.dependencies?.osagent?.version || "unknown";
|
|
314821
|
+
} catch {
|
|
314822
|
+
return "unknown";
|
|
314823
|
+
}
|
|
314824
|
+
}
|
|
314825
|
+
__name(getCurrentVersion, "getCurrentVersion");
|
|
314826
|
+
function getLatestVersion() {
|
|
314827
|
+
try {
|
|
314828
|
+
const result = execSync5("npm view osagent version 2>/dev/null", { encoding: "utf-8" });
|
|
314829
|
+
return result.trim();
|
|
314830
|
+
} catch {
|
|
314831
|
+
return "unknown";
|
|
314832
|
+
}
|
|
314833
|
+
}
|
|
314834
|
+
__name(getLatestVersion, "getLatestVersion");
|
|
314835
|
+
function checkNodeVersion() {
|
|
314836
|
+
const version2 = process.version;
|
|
314837
|
+
const major2 = parseInt(version2.slice(1).split(".")[0], 10);
|
|
314838
|
+
if (major2 >= 20) {
|
|
314839
|
+
return { name: "Node.js", status: "ok", message: `${version2} (supported)` };
|
|
314840
|
+
} else if (major2 >= 18) {
|
|
314841
|
+
return { name: "Node.js", status: "warning", message: `${version2} (upgrade recommended)`, fix: "Install Node.js 20+" };
|
|
314842
|
+
}
|
|
314843
|
+
return { name: "Node.js", status: "error", message: `${version2} (unsupported)`, fix: "Install Node.js 20+" };
|
|
314844
|
+
}
|
|
314845
|
+
__name(checkNodeVersion, "checkNodeVersion");
|
|
314846
|
+
function checkCustomAgents() {
|
|
314847
|
+
const agentsDir = join32(homedir18(), ".osagent", "agents");
|
|
314848
|
+
if (existsSync19(agentsDir)) {
|
|
314849
|
+
try {
|
|
314850
|
+
const agents = readdirSync4(agentsDir).filter((f) => f.endsWith(".json") || f.endsWith(".yaml") || f.endsWith(".yml"));
|
|
314851
|
+
if (agents.length > 0) {
|
|
314852
|
+
return { name: "Custom Agents", status: "ok", message: `${agents.length} found in ~/.osagent/agents/` };
|
|
314853
|
+
}
|
|
314854
|
+
} catch {
|
|
314855
|
+
}
|
|
314856
|
+
}
|
|
314857
|
+
return { name: "Custom Agents", status: "ok", message: "None (create in ~/.osagent/agents/)" };
|
|
314858
|
+
}
|
|
314859
|
+
__name(checkCustomAgents, "checkCustomAgents");
|
|
314860
|
+
function checkCustomCommands() {
|
|
314861
|
+
const commandsDir = join32(homedir18(), ".osagent", "commands");
|
|
314862
|
+
if (existsSync19(commandsDir)) {
|
|
314863
|
+
try {
|
|
314864
|
+
const commands = readdirSync4(commandsDir).filter((f) => f.endsWith(".js") || f.endsWith(".ts"));
|
|
314865
|
+
if (commands.length > 0) {
|
|
314866
|
+
return { name: "Custom Commands", status: "ok", message: `${commands.length} found in ~/.osagent/commands/` };
|
|
314867
|
+
}
|
|
314868
|
+
} catch {
|
|
314869
|
+
}
|
|
314870
|
+
}
|
|
314871
|
+
return { name: "Custom Commands", status: "ok", message: "None (create in ~/.osagent/commands/)" };
|
|
314872
|
+
}
|
|
314873
|
+
__name(checkCustomCommands, "checkCustomCommands");
|
|
314874
|
+
function checkSettings() {
|
|
314875
|
+
const settingsPath = join32(homedir18(), ".osagent", "settings.json");
|
|
314876
|
+
if (existsSync19(settingsPath)) {
|
|
314877
|
+
return { name: "Settings", status: "ok", message: "~/.osagent/settings.json exists" };
|
|
314878
|
+
}
|
|
314879
|
+
return { name: "Settings", status: "ok", message: "Using defaults (no settings.json)" };
|
|
314880
|
+
}
|
|
314881
|
+
__name(checkSettings, "checkSettings");
|
|
314882
|
+
function checkSystemPrompt() {
|
|
314883
|
+
const promptPath = join32(homedir18(), ".osagent", "system.md");
|
|
314884
|
+
if (existsSync19(promptPath)) {
|
|
314885
|
+
return { name: "System Prompt", status: "ok", message: "~/.osagent/system.md (custom)" };
|
|
314886
|
+
}
|
|
314887
|
+
return { name: "System Prompt", status: "ok", message: "Using default" };
|
|
314888
|
+
}
|
|
314889
|
+
__name(checkSystemPrompt, "checkSystemPrompt");
|
|
314890
|
+
function formatResults(checks, currentVer, latestVer) {
|
|
314891
|
+
const lines = [];
|
|
314892
|
+
lines.push("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
|
|
314893
|
+
lines.push("\u2502 OS Agent Doctor Report \u2502");
|
|
314894
|
+
lines.push("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
|
|
314895
|
+
lines.push("");
|
|
314896
|
+
const updateAvailable = currentVer !== "unknown" && latestVer !== "unknown" && currentVer !== latestVer;
|
|
314897
|
+
lines.push(`Version: ${currentVer}${updateAvailable ? ` \u2192 ${latestVer} available` : " (latest)"}`);
|
|
314898
|
+
lines.push("");
|
|
314899
|
+
lines.push("Health Checks:");
|
|
314900
|
+
for (const check of checks) {
|
|
314901
|
+
const icon = check.status === "ok" ? "\u2713" : check.status === "warning" ? "!" : "\u2717";
|
|
314902
|
+
lines.push(` ${icon} ${check.name}: ${check.message}`);
|
|
314903
|
+
if (check.fix) {
|
|
314904
|
+
lines.push(` Fix: ${check.fix}`);
|
|
314905
|
+
}
|
|
314906
|
+
}
|
|
314907
|
+
lines.push("");
|
|
314908
|
+
lines.push("Customization Paths:");
|
|
314909
|
+
lines.push(" ~/.osagent/agents/ - Custom subagents (JSON/YAML)");
|
|
314910
|
+
lines.push(" ~/.osagent/commands/ - Custom commands (JS/TS)");
|
|
314911
|
+
lines.push(" ~/.osagent/settings.json - Configuration");
|
|
314912
|
+
lines.push(" ~/.osagent/system.md - Custom system prompt");
|
|
314913
|
+
if (updateAvailable) {
|
|
314914
|
+
lines.push("");
|
|
314915
|
+
lines.push(`Update available! Run: npm install -g osagent@latest`);
|
|
314916
|
+
}
|
|
314917
|
+
return lines.join("\n");
|
|
314918
|
+
}
|
|
314919
|
+
__name(formatResults, "formatResults");
|
|
314920
|
+
var doctorCommand = {
|
|
314921
|
+
name: "doctor",
|
|
314922
|
+
get description() {
|
|
314923
|
+
return t2("Check system health, updates, and configuration");
|
|
314924
|
+
},
|
|
314925
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314926
|
+
subCommands: [
|
|
314927
|
+
{
|
|
314928
|
+
name: "update",
|
|
314929
|
+
get description() {
|
|
314930
|
+
return t2("Update osagent to the latest version");
|
|
314931
|
+
},
|
|
314932
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314933
|
+
action: /* @__PURE__ */ __name(async () => {
|
|
314934
|
+
try {
|
|
314935
|
+
execSync5("npm install -g osagent@latest", { encoding: "utf-8", stdio: "pipe" });
|
|
314936
|
+
const newVersion = getLatestVersion();
|
|
314937
|
+
return {
|
|
314938
|
+
type: "message",
|
|
314939
|
+
messageType: "info",
|
|
314940
|
+
content: t2(`\u2713 Updated to osagent@${newVersion}
|
|
314941
|
+
Restart osagent to use the new version.`)
|
|
314942
|
+
};
|
|
314943
|
+
} catch (error) {
|
|
314944
|
+
return {
|
|
314945
|
+
type: "message",
|
|
314946
|
+
messageType: "error",
|
|
314947
|
+
content: t2(`Failed to update. Try manually: sudo npm install -g osagent@latest`)
|
|
314948
|
+
};
|
|
314949
|
+
}
|
|
314950
|
+
}, "action")
|
|
314951
|
+
},
|
|
314952
|
+
{
|
|
314953
|
+
name: "init",
|
|
314954
|
+
get description() {
|
|
314955
|
+
return t2("Initialize ~/.osagent directory structure");
|
|
314956
|
+
},
|
|
314957
|
+
kind: "built-in" /* BUILT_IN */,
|
|
314958
|
+
action: /* @__PURE__ */ __name(async () => {
|
|
314959
|
+
const { mkdirSync: mkdirSync10, writeFileSync: writeFileSync9 } = await import("fs");
|
|
314960
|
+
const baseDir = join32(homedir18(), ".osagent");
|
|
314961
|
+
const dirs = ["agents", "commands", "prompts"];
|
|
314962
|
+
try {
|
|
314963
|
+
for (const dir of dirs) {
|
|
314964
|
+
const path112 = join32(baseDir, dir);
|
|
314965
|
+
mkdirSync10(path112, { recursive: true });
|
|
314966
|
+
}
|
|
314967
|
+
const exampleAgent = {
|
|
314968
|
+
name: "example-agent",
|
|
314969
|
+
description: "An example custom agent",
|
|
314970
|
+
systemPrompt: "You are a helpful assistant specialized in...",
|
|
314971
|
+
model: "qwen3-coder:480b-cloud"
|
|
314972
|
+
};
|
|
314973
|
+
writeFileSync9(
|
|
314974
|
+
join32(baseDir, "agents", "example-agent.json"),
|
|
314975
|
+
JSON.stringify(exampleAgent, null, 2)
|
|
314976
|
+
);
|
|
314977
|
+
return {
|
|
314978
|
+
type: "message",
|
|
314979
|
+
messageType: "info",
|
|
314980
|
+
content: t2(`\u2713 Initialized ~/.osagent/ with:
|
|
314981
|
+
- agents/ (custom subagents)
|
|
314982
|
+
- commands/ (custom commands)
|
|
314983
|
+
- prompts/ (custom prompts)
|
|
314984
|
+
|
|
314985
|
+
Example agent created: ~/.osagent/agents/example-agent.json`)
|
|
314986
|
+
};
|
|
314987
|
+
} catch (error) {
|
|
314988
|
+
return {
|
|
314989
|
+
type: "message",
|
|
314990
|
+
messageType: "error",
|
|
314991
|
+
content: t2(`Failed to initialize: ${error}`)
|
|
314992
|
+
};
|
|
314993
|
+
}
|
|
314994
|
+
}, "action")
|
|
314995
|
+
}
|
|
314996
|
+
],
|
|
314997
|
+
action: /* @__PURE__ */ __name(async () => {
|
|
314998
|
+
const checks = [
|
|
314999
|
+
checkNodeVersion(),
|
|
315000
|
+
checkSettings(),
|
|
315001
|
+
checkSystemPrompt(),
|
|
315002
|
+
checkCustomAgents(),
|
|
315003
|
+
checkCustomCommands()
|
|
315004
|
+
];
|
|
315005
|
+
const currentVersion = getCurrentVersion();
|
|
315006
|
+
const latestVersion2 = getLatestVersion();
|
|
315007
|
+
const report = formatResults(checks, currentVersion, latestVersion2);
|
|
315008
|
+
return {
|
|
315009
|
+
type: "message",
|
|
315010
|
+
messageType: "info",
|
|
315011
|
+
content: report
|
|
315012
|
+
};
|
|
315013
|
+
}, "action")
|
|
315014
|
+
};
|
|
315015
|
+
|
|
314724
315016
|
// packages/cli/src/ui/commands/docsCommand.ts
|
|
314725
315017
|
init_esbuild_shims();
|
|
314726
315018
|
init_open();
|
|
@@ -316623,6 +316915,30 @@ var quitCommand = {
|
|
|
316623
316915
|
}, "action")
|
|
316624
316916
|
};
|
|
316625
316917
|
|
|
316918
|
+
// packages/cli/src/ui/commands/resetCommand.ts
|
|
316919
|
+
init_esbuild_shims();
|
|
316920
|
+
var resetCommand = {
|
|
316921
|
+
name: "reset",
|
|
316922
|
+
get description() {
|
|
316923
|
+
return t2("Reset the conversation and start fresh");
|
|
316924
|
+
},
|
|
316925
|
+
kind: "built-in" /* BUILT_IN */,
|
|
316926
|
+
action: /* @__PURE__ */ __name(async (context2, _args) => {
|
|
316927
|
+
const OSAClient2 = context2.services.config?.getOSAClient();
|
|
316928
|
+
if (OSAClient2) {
|
|
316929
|
+
context2.ui.setDebugMessage(t2("Resetting conversation..."));
|
|
316930
|
+
await OSAClient2.resetChat();
|
|
316931
|
+
}
|
|
316932
|
+
uiTelemetryService.setLastPromptTokenCount(0);
|
|
316933
|
+
context2.ui.clear();
|
|
316934
|
+
return {
|
|
316935
|
+
type: "message",
|
|
316936
|
+
messageType: "info",
|
|
316937
|
+
content: t2("Conversation reset. Ready for a fresh start.")
|
|
316938
|
+
};
|
|
316939
|
+
}, "action")
|
|
316940
|
+
};
|
|
316941
|
+
|
|
316626
316942
|
// packages/cli/src/ui/commands/restoreCommand.ts
|
|
316627
316943
|
init_esbuild_shims();
|
|
316628
316944
|
import * as fs75 from "node:fs/promises";
|
|
@@ -318118,10 +318434,10 @@ import { Writable } from "node:stream";
|
|
|
318118
318434
|
// packages/cli/src/utils/gitUtils.ts
|
|
318119
318435
|
init_esbuild_shims();
|
|
318120
318436
|
var import_undici4 = __toESM(require_undici(), 1);
|
|
318121
|
-
import { execSync as
|
|
318437
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
318122
318438
|
var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
318123
318439
|
try {
|
|
318124
|
-
const remotes = (
|
|
318440
|
+
const remotes = (execSync6("git remote -v", {
|
|
318125
318441
|
encoding: "utf-8"
|
|
318126
318442
|
}) || "").trim();
|
|
318127
318443
|
const pattern = /github\.com/;
|
|
@@ -318132,7 +318448,7 @@ var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
|
318132
318448
|
}
|
|
318133
318449
|
}, "isGitHubRepository");
|
|
318134
318450
|
var getGitRepoRoot = /* @__PURE__ */ __name(() => {
|
|
318135
|
-
const gitRepoRoot = (
|
|
318451
|
+
const gitRepoRoot = (execSync6("git rev-parse --show-toplevel", {
|
|
318136
318452
|
encoding: "utf-8"
|
|
318137
318453
|
}) || "").trim();
|
|
318138
318454
|
if (!gitRepoRoot) {
|
|
@@ -318172,7 +318488,7 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
|
|
|
318172
318488
|
}
|
|
318173
318489
|
}, "getLatestGitHubRelease");
|
|
318174
318490
|
function getGitHubRepoInfo() {
|
|
318175
|
-
const remoteUrl =
|
|
318491
|
+
const remoteUrl = execSync6("git remote get-url origin", {
|
|
318176
318492
|
encoding: "utf-8"
|
|
318177
318493
|
}).trim();
|
|
318178
318494
|
const match2 = remoteUrl.match(
|
|
@@ -318362,7 +318678,9 @@ var BuiltinCommandLoader = class {
|
|
|
318362
318678
|
openaiProfileCommand,
|
|
318363
318679
|
copyCommand,
|
|
318364
318680
|
corgiCommand,
|
|
318681
|
+
dangerouslyCommand,
|
|
318365
318682
|
delegateCommand,
|
|
318683
|
+
doctorCommand,
|
|
318366
318684
|
docsCommand,
|
|
318367
318685
|
directoryCommand,
|
|
318368
318686
|
editorCommand,
|
|
@@ -318377,6 +318695,7 @@ var BuiltinCommandLoader = class {
|
|
|
318377
318695
|
...this.config?.getFolderTrust() ? [permissionsCommand] : [],
|
|
318378
318696
|
quitCommand,
|
|
318379
318697
|
quitConfirmCommand,
|
|
318698
|
+
resetCommand,
|
|
318380
318699
|
restoreCommand(this.config),
|
|
318381
318700
|
statsCommand,
|
|
318382
318701
|
summaryCommand,
|
|
@@ -318386,6 +318705,7 @@ var BuiltinCommandLoader = class {
|
|
|
318386
318705
|
spCommand,
|
|
318387
318706
|
systemPromptCommand,
|
|
318388
318707
|
vimCommand,
|
|
318708
|
+
yoloCommand,
|
|
318389
318709
|
setupGithubCommand,
|
|
318390
318710
|
terminalSetupCommand
|
|
318391
318711
|
];
|
|
@@ -346277,7 +346597,7 @@ init_esbuild_shims();
|
|
|
346277
346597
|
// packages/cli/src/utils/cleanup.ts
|
|
346278
346598
|
init_esbuild_shims();
|
|
346279
346599
|
import { promises as fs83 } from "node:fs";
|
|
346280
|
-
import { join as
|
|
346600
|
+
import { join as join38 } from "node:path";
|
|
346281
346601
|
var cleanupFunctions = [];
|
|
346282
346602
|
function registerCleanup(fn) {
|
|
346283
346603
|
cleanupFunctions.push(fn);
|
|
@@ -346296,7 +346616,7 @@ __name(runExitCleanup, "runExitCleanup");
|
|
|
346296
346616
|
async function cleanupCheckpoints() {
|
|
346297
346617
|
const storage = new Storage(process.cwd());
|
|
346298
346618
|
const tempDir = storage.getProjectTempDir();
|
|
346299
|
-
const checkpointsDir =
|
|
346619
|
+
const checkpointsDir = join38(tempDir, "checkpoints");
|
|
346300
346620
|
try {
|
|
346301
346621
|
await fs83.rm(checkpointsDir, { recursive: true, force: true });
|
|
346302
346622
|
} catch {
|
|
@@ -361385,7 +361705,7 @@ __name(relaunchAppInChildProcess, "relaunchAppInChildProcess");
|
|
|
361385
361705
|
// packages/cli/src/utils/sandbox.ts
|
|
361386
361706
|
init_esbuild_shims();
|
|
361387
361707
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
361388
|
-
import { exec as exec4, execSync as
|
|
361708
|
+
import { exec as exec4, execSync as execSync8, spawn as spawn10 } from "node:child_process";
|
|
361389
361709
|
import os41 from "node:os";
|
|
361390
361710
|
import path109 from "node:path";
|
|
361391
361711
|
import fs95 from "node:fs";
|
|
@@ -361544,7 +361864,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361544
361864
|
"-D",
|
|
361545
361865
|
`HOME_DIR=${fs95.realpathSync(os41.homedir())}`,
|
|
361546
361866
|
"-D",
|
|
361547
|
-
`CACHE_DIR=${fs95.realpathSync(
|
|
361867
|
+
`CACHE_DIR=${fs95.realpathSync(execSync8(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`
|
|
361548
361868
|
];
|
|
361549
361869
|
const MAX_INCLUDE_DIRS = 5;
|
|
361550
361870
|
const targetDir = fs95.realpathSync(cliConfig?.getTargetDir() || "");
|
|
@@ -361662,7 +361982,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361662
361982
|
console.error(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
361663
361983
|
buildArgs += `-f ${path109.resolve(projectSandboxDockerfile2)} -i ${image2}`;
|
|
361664
361984
|
}
|
|
361665
|
-
|
|
361985
|
+
execSync8(
|
|
361666
361986
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
361667
361987
|
{
|
|
361668
361988
|
stdio: "inherit",
|
|
@@ -361771,12 +362091,12 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361771
362091
|
args.push("--env", `no_proxy=${noProxy}`);
|
|
361772
362092
|
}
|
|
361773
362093
|
if (proxy) {
|
|
361774
|
-
|
|
362094
|
+
execSync8(
|
|
361775
362095
|
`${config.command} network inspect ${SANDBOX_NETWORK_NAME} || ${config.command} network create --internal ${SANDBOX_NETWORK_NAME}`
|
|
361776
362096
|
);
|
|
361777
362097
|
args.push("--network", SANDBOX_NETWORK_NAME);
|
|
361778
362098
|
if (proxyCommand) {
|
|
361779
|
-
|
|
362099
|
+
execSync8(
|
|
361780
362100
|
`${config.command} network inspect ${SANDBOX_PROXY_NAME} || ${config.command} network create ${SANDBOX_PROXY_NAME}`
|
|
361781
362101
|
);
|
|
361782
362102
|
}
|
|
@@ -361792,7 +362112,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361792
362112
|
console.log(`ContainerName: ${containerName}`);
|
|
361793
362113
|
} else {
|
|
361794
362114
|
let index = 0;
|
|
361795
|
-
const containerNameCheck =
|
|
362115
|
+
const containerNameCheck = execSync8(
|
|
361796
362116
|
`${config.command} ps -a --format "{{.Names}}"`
|
|
361797
362117
|
).toString().trim();
|
|
361798
362118
|
while (containerNameCheck.includes(`${imageName}-${index}`)) {
|
|
@@ -361920,8 +362240,8 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361920
362240
|
userFlag = "--user root";
|
|
361921
362241
|
} else if (await shouldUseCurrentUserInSandbox()) {
|
|
361922
362242
|
args.push("--user", "root");
|
|
361923
|
-
const uid =
|
|
361924
|
-
const gid =
|
|
362243
|
+
const uid = execSync8("id -u").toString().trim();
|
|
362244
|
+
const gid = execSync8("id -g").toString().trim();
|
|
361925
362245
|
const username = "OSA";
|
|
361926
362246
|
const homeDir = getContainerPath(os41.homedir());
|
|
361927
362247
|
const setupUserCommands = [
|
|
@@ -361950,7 +362270,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361950
362270
|
});
|
|
361951
362271
|
const stopProxy = /* @__PURE__ */ __name(() => {
|
|
361952
362272
|
console.log("stopping proxy container ...");
|
|
361953
|
-
|
|
362273
|
+
execSync8(`${config.command} rm -f ${SANDBOX_PROXY_NAME}`);
|
|
361954
362274
|
}, "stopProxy");
|
|
361955
362275
|
process.on("exit", stopProxy);
|
|
361956
362276
|
process.on("SIGINT", stopProxy);
|