osagent 0.1.12 → 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 +252 -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() {
|
|
@@ -314807,6 +314807,212 @@ Use the Task tool to spawn the "${agentName}" subagent with this task. The agent
|
|
|
314807
314807
|
}, "completion")
|
|
314808
314808
|
};
|
|
314809
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
|
+
|
|
314810
315016
|
// packages/cli/src/ui/commands/docsCommand.ts
|
|
314811
315017
|
init_esbuild_shims();
|
|
314812
315018
|
init_open();
|
|
@@ -318228,10 +318434,10 @@ import { Writable } from "node:stream";
|
|
|
318228
318434
|
// packages/cli/src/utils/gitUtils.ts
|
|
318229
318435
|
init_esbuild_shims();
|
|
318230
318436
|
var import_undici4 = __toESM(require_undici(), 1);
|
|
318231
|
-
import { execSync as
|
|
318437
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
318232
318438
|
var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
318233
318439
|
try {
|
|
318234
|
-
const remotes = (
|
|
318440
|
+
const remotes = (execSync6("git remote -v", {
|
|
318235
318441
|
encoding: "utf-8"
|
|
318236
318442
|
}) || "").trim();
|
|
318237
318443
|
const pattern = /github\.com/;
|
|
@@ -318242,7 +318448,7 @@ var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
|
318242
318448
|
}
|
|
318243
318449
|
}, "isGitHubRepository");
|
|
318244
318450
|
var getGitRepoRoot = /* @__PURE__ */ __name(() => {
|
|
318245
|
-
const gitRepoRoot = (
|
|
318451
|
+
const gitRepoRoot = (execSync6("git rev-parse --show-toplevel", {
|
|
318246
318452
|
encoding: "utf-8"
|
|
318247
318453
|
}) || "").trim();
|
|
318248
318454
|
if (!gitRepoRoot) {
|
|
@@ -318282,7 +318488,7 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
|
|
|
318282
318488
|
}
|
|
318283
318489
|
}, "getLatestGitHubRelease");
|
|
318284
318490
|
function getGitHubRepoInfo() {
|
|
318285
|
-
const remoteUrl =
|
|
318491
|
+
const remoteUrl = execSync6("git remote get-url origin", {
|
|
318286
318492
|
encoding: "utf-8"
|
|
318287
318493
|
}).trim();
|
|
318288
318494
|
const match2 = remoteUrl.match(
|
|
@@ -318474,6 +318680,7 @@ var BuiltinCommandLoader = class {
|
|
|
318474
318680
|
corgiCommand,
|
|
318475
318681
|
dangerouslyCommand,
|
|
318476
318682
|
delegateCommand,
|
|
318683
|
+
doctorCommand,
|
|
318477
318684
|
docsCommand,
|
|
318478
318685
|
directoryCommand,
|
|
318479
318686
|
editorCommand,
|
|
@@ -346390,7 +346597,7 @@ init_esbuild_shims();
|
|
|
346390
346597
|
// packages/cli/src/utils/cleanup.ts
|
|
346391
346598
|
init_esbuild_shims();
|
|
346392
346599
|
import { promises as fs83 } from "node:fs";
|
|
346393
|
-
import { join as
|
|
346600
|
+
import { join as join38 } from "node:path";
|
|
346394
346601
|
var cleanupFunctions = [];
|
|
346395
346602
|
function registerCleanup(fn) {
|
|
346396
346603
|
cleanupFunctions.push(fn);
|
|
@@ -346409,7 +346616,7 @@ __name(runExitCleanup, "runExitCleanup");
|
|
|
346409
346616
|
async function cleanupCheckpoints() {
|
|
346410
346617
|
const storage = new Storage(process.cwd());
|
|
346411
346618
|
const tempDir = storage.getProjectTempDir();
|
|
346412
|
-
const checkpointsDir =
|
|
346619
|
+
const checkpointsDir = join38(tempDir, "checkpoints");
|
|
346413
346620
|
try {
|
|
346414
346621
|
await fs83.rm(checkpointsDir, { recursive: true, force: true });
|
|
346415
346622
|
} catch {
|
|
@@ -361498,7 +361705,7 @@ __name(relaunchAppInChildProcess, "relaunchAppInChildProcess");
|
|
|
361498
361705
|
// packages/cli/src/utils/sandbox.ts
|
|
361499
361706
|
init_esbuild_shims();
|
|
361500
361707
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
361501
|
-
import { exec as exec4, execSync as
|
|
361708
|
+
import { exec as exec4, execSync as execSync8, spawn as spawn10 } from "node:child_process";
|
|
361502
361709
|
import os41 from "node:os";
|
|
361503
361710
|
import path109 from "node:path";
|
|
361504
361711
|
import fs95 from "node:fs";
|
|
@@ -361657,7 +361864,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361657
361864
|
"-D",
|
|
361658
361865
|
`HOME_DIR=${fs95.realpathSync(os41.homedir())}`,
|
|
361659
361866
|
"-D",
|
|
361660
|
-
`CACHE_DIR=${fs95.realpathSync(
|
|
361867
|
+
`CACHE_DIR=${fs95.realpathSync(execSync8(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`
|
|
361661
361868
|
];
|
|
361662
361869
|
const MAX_INCLUDE_DIRS = 5;
|
|
361663
361870
|
const targetDir = fs95.realpathSync(cliConfig?.getTargetDir() || "");
|
|
@@ -361775,7 +361982,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361775
361982
|
console.error(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
361776
361983
|
buildArgs += `-f ${path109.resolve(projectSandboxDockerfile2)} -i ${image2}`;
|
|
361777
361984
|
}
|
|
361778
|
-
|
|
361985
|
+
execSync8(
|
|
361779
361986
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
361780
361987
|
{
|
|
361781
361988
|
stdio: "inherit",
|
|
@@ -361884,12 +362091,12 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361884
362091
|
args.push("--env", `no_proxy=${noProxy}`);
|
|
361885
362092
|
}
|
|
361886
362093
|
if (proxy) {
|
|
361887
|
-
|
|
362094
|
+
execSync8(
|
|
361888
362095
|
`${config.command} network inspect ${SANDBOX_NETWORK_NAME} || ${config.command} network create --internal ${SANDBOX_NETWORK_NAME}`
|
|
361889
362096
|
);
|
|
361890
362097
|
args.push("--network", SANDBOX_NETWORK_NAME);
|
|
361891
362098
|
if (proxyCommand) {
|
|
361892
|
-
|
|
362099
|
+
execSync8(
|
|
361893
362100
|
`${config.command} network inspect ${SANDBOX_PROXY_NAME} || ${config.command} network create ${SANDBOX_PROXY_NAME}`
|
|
361894
362101
|
);
|
|
361895
362102
|
}
|
|
@@ -361905,7 +362112,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
361905
362112
|
console.log(`ContainerName: ${containerName}`);
|
|
361906
362113
|
} else {
|
|
361907
362114
|
let index = 0;
|
|
361908
|
-
const containerNameCheck =
|
|
362115
|
+
const containerNameCheck = execSync8(
|
|
361909
362116
|
`${config.command} ps -a --format "{{.Names}}"`
|
|
361910
362117
|
).toString().trim();
|
|
361911
362118
|
while (containerNameCheck.includes(`${imageName}-${index}`)) {
|
|
@@ -362033,8 +362240,8 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
362033
362240
|
userFlag = "--user root";
|
|
362034
362241
|
} else if (await shouldUseCurrentUserInSandbox()) {
|
|
362035
362242
|
args.push("--user", "root");
|
|
362036
|
-
const uid =
|
|
362037
|
-
const gid =
|
|
362243
|
+
const uid = execSync8("id -u").toString().trim();
|
|
362244
|
+
const gid = execSync8("id -g").toString().trim();
|
|
362038
362245
|
const username = "OSA";
|
|
362039
362246
|
const homeDir = getContainerPath(os41.homedir());
|
|
362040
362247
|
const setupUserCommands = [
|
|
@@ -362063,7 +362270,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
362063
362270
|
});
|
|
362064
362271
|
const stopProxy = /* @__PURE__ */ __name(() => {
|
|
362065
362272
|
console.log("stopping proxy container ...");
|
|
362066
|
-
|
|
362273
|
+
execSync8(`${config.command} rm -f ${SANDBOX_PROXY_NAME}`);
|
|
362067
362274
|
}, "stopProxy");
|
|
362068
362275
|
process.on("exit", stopProxy);
|
|
362069
362276
|
process.on("SIGINT", stopProxy);
|