@boxes-dev/dvb-runtime 1.0.1077 → 1.0.1078
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/bin/dvb.mjs +1416 -276
- package/dist/bin/dvbd.mjs +4 -4
- package/dist/product-docs/references/agent-tools.md +25 -0
- package/dist/product-docs/references/automations.md +32 -4
- package/dist/product-docs/references/cli.md +39 -0
- package/dist/product-docs/references/onbox-agent-tools.md +4 -1
- package/package.json +2 -2
package/dist/bin/dvb.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="249a0abb-e483-5aa3-b76c-e668263ae2b8")}catch(e){}}();
|
|
4
4
|
import { createRequire as __dvbCreateRequire } from "node:module";
|
|
5
5
|
import { dirname as __dvbDirname } from "node:path";
|
|
6
6
|
import { fileURLToPath as __dvbFileURLToPath } from "node:url";
|
|
@@ -21463,9 +21463,9 @@ var init_ajvProvider_97rDpkRx = __esm({
|
|
|
21463
21463
|
wsComponent.secure = void 0;
|
|
21464
21464
|
}
|
|
21465
21465
|
if (wsComponent.resourceName) {
|
|
21466
|
-
const [path106,
|
|
21466
|
+
const [path106, query2] = wsComponent.resourceName.split("?");
|
|
21467
21467
|
wsComponent.path = path106 && path106 !== "/" ? path106 : void 0;
|
|
21468
|
-
wsComponent.query =
|
|
21468
|
+
wsComponent.query = query2;
|
|
21469
21469
|
wsComponent.resourceName = void 0;
|
|
21470
21470
|
}
|
|
21471
21471
|
wsComponent.fragment = void 0;
|
|
@@ -33548,15 +33548,15 @@ function parseUrl(url3) {
|
|
|
33548
33548
|
if (!match) {
|
|
33549
33549
|
return {};
|
|
33550
33550
|
}
|
|
33551
|
-
const
|
|
33551
|
+
const query2 = match[6] || "";
|
|
33552
33552
|
const fragment = match[8] || "";
|
|
33553
33553
|
return {
|
|
33554
33554
|
host: match[4],
|
|
33555
33555
|
path: match[5],
|
|
33556
33556
|
protocol: match[2],
|
|
33557
|
-
search:
|
|
33557
|
+
search: query2,
|
|
33558
33558
|
hash: fragment,
|
|
33559
|
-
relative: match[5] +
|
|
33559
|
+
relative: match[5] + query2 + fragment
|
|
33560
33560
|
// everything minus origin
|
|
33561
33561
|
};
|
|
33562
33562
|
}
|
|
@@ -41959,11 +41959,11 @@ function _instrumentSqlInstance(sql, options, parentConnectionContext) {
|
|
|
41959
41959
|
}
|
|
41960
41960
|
const proxiedSql = new Proxy(sql, {
|
|
41961
41961
|
apply(target, thisArg, argumentsList) {
|
|
41962
|
-
const
|
|
41963
|
-
if (
|
|
41964
|
-
_wrapSingleQueryHandle(
|
|
41962
|
+
const query2 = Reflect.apply(target, thisArg, argumentsList);
|
|
41963
|
+
if (query2 && typeof query2 === "object" && "handle" in query2) {
|
|
41964
|
+
_wrapSingleQueryHandle(query2, proxiedSql, options);
|
|
41965
41965
|
}
|
|
41966
|
-
return
|
|
41966
|
+
return query2;
|
|
41967
41967
|
},
|
|
41968
41968
|
get(target, prop) {
|
|
41969
41969
|
const original = target[prop];
|
|
@@ -41990,11 +41990,11 @@ function _instrumentSqlInstance(sql, options, parentConnectionContext) {
|
|
|
41990
41990
|
}
|
|
41991
41991
|
function _wrapQueryMethod(original, target, proxiedSql, options) {
|
|
41992
41992
|
return function(...args) {
|
|
41993
|
-
const
|
|
41994
|
-
if (
|
|
41995
|
-
_wrapSingleQueryHandle(
|
|
41993
|
+
const query2 = Reflect.apply(original, target, args);
|
|
41994
|
+
if (query2 && typeof query2 === "object" && "handle" in query2) {
|
|
41995
|
+
_wrapSingleQueryHandle(query2, proxiedSql, options);
|
|
41996
41996
|
}
|
|
41997
|
-
return
|
|
41997
|
+
return query2;
|
|
41998
41998
|
};
|
|
41999
41999
|
}
|
|
42000
42000
|
function _wrapCallbackMethod(original, target, parentSqlInstance, options) {
|
|
@@ -42019,17 +42019,17 @@ function _wrapCallbackMethod(original, target, parentSqlInstance, options) {
|
|
|
42019
42019
|
return Reflect.apply(original, target, newArgs);
|
|
42020
42020
|
};
|
|
42021
42021
|
}
|
|
42022
|
-
function _wrapSingleQueryHandle(
|
|
42023
|
-
if (
|
|
42022
|
+
function _wrapSingleQueryHandle(query2, sqlInstance, options) {
|
|
42023
|
+
if (query2.handle?.__sentryWrapped) {
|
|
42024
42024
|
return;
|
|
42025
42025
|
}
|
|
42026
|
-
|
|
42027
|
-
const originalHandle =
|
|
42026
|
+
query2[QUERY_FROM_INSTRUMENTED_SQL] = true;
|
|
42027
|
+
const originalHandle = query2.handle;
|
|
42028
42028
|
const wrappedHandle = async function(...args) {
|
|
42029
42029
|
if (this.executed || !_shouldCreateSpans(options)) {
|
|
42030
42030
|
return originalHandle.apply(this, args);
|
|
42031
42031
|
}
|
|
42032
|
-
const fullQuery = _reconstructQuery(
|
|
42032
|
+
const fullQuery = _reconstructQuery(query2.strings);
|
|
42033
42033
|
const sanitizedSqlQuery = _sanitizeSqlQuery(fullQuery);
|
|
42034
42034
|
return startSpanManual(
|
|
42035
42035
|
{
|
|
@@ -42095,7 +42095,7 @@ function _wrapSingleQueryHandle(query, sqlInstance, options) {
|
|
|
42095
42095
|
);
|
|
42096
42096
|
};
|
|
42097
42097
|
wrappedHandle.__sentryWrapped = true;
|
|
42098
|
-
|
|
42098
|
+
query2.handle = wrappedHandle;
|
|
42099
42099
|
}
|
|
42100
42100
|
function _shouldCreateSpans(options) {
|
|
42101
42101
|
const hasParentSpan = getActiveSpan() !== void 0;
|
|
@@ -54067,7 +54067,7 @@ function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
|
|
|
54067
54067
|
if (attributes["sentry.http.prefetch"]) {
|
|
54068
54068
|
opParts.push("prefetch");
|
|
54069
54069
|
}
|
|
54070
|
-
const { urlPath, url: url3, query, fragment, hasRoute } = getSanitizedUrl(attributes, kind);
|
|
54070
|
+
const { urlPath, url: url3, query: query2, fragment, hasRoute } = getSanitizedUrl(attributes, kind);
|
|
54071
54071
|
if (!urlPath) {
|
|
54072
54072
|
return { ...getUserUpdatedNameAndSource(name, attributes), op: opParts.join(".") };
|
|
54073
54073
|
}
|
|
@@ -54079,8 +54079,8 @@ function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
|
|
|
54079
54079
|
if (url3) {
|
|
54080
54080
|
data.url = url3;
|
|
54081
54081
|
}
|
|
54082
|
-
if (
|
|
54083
|
-
data["http.query"] =
|
|
54082
|
+
if (query2) {
|
|
54083
|
+
data["http.query"] = query2;
|
|
54084
54084
|
}
|
|
54085
54085
|
if (fragment) {
|
|
54086
54086
|
data["http.fragment"] = fragment;
|
|
@@ -54116,21 +54116,21 @@ function getSanitizedUrl(attributes, kind) {
|
|
|
54116
54116
|
const httpRoute = attributes[import_semantic_conventions2.ATTR_HTTP_ROUTE];
|
|
54117
54117
|
const parsedUrl = typeof httpUrl3 === "string" ? parseUrl(httpUrl3) : void 0;
|
|
54118
54118
|
const url3 = parsedUrl ? getSanitizedUrlString(parsedUrl) : void 0;
|
|
54119
|
-
const
|
|
54119
|
+
const query2 = parsedUrl?.search || void 0;
|
|
54120
54120
|
const fragment = parsedUrl?.hash || void 0;
|
|
54121
54121
|
if (typeof httpRoute === "string") {
|
|
54122
|
-
return { urlPath: httpRoute, url: url3, query, fragment, hasRoute: true };
|
|
54122
|
+
return { urlPath: httpRoute, url: url3, query: query2, fragment, hasRoute: true };
|
|
54123
54123
|
}
|
|
54124
54124
|
if (kind === import_api6.SpanKind.SERVER && typeof httpTarget === "string") {
|
|
54125
|
-
return { urlPath: stripUrlQueryAndFragment(httpTarget), url: url3, query, fragment, hasRoute: false };
|
|
54125
|
+
return { urlPath: stripUrlQueryAndFragment(httpTarget), url: url3, query: query2, fragment, hasRoute: false };
|
|
54126
54126
|
}
|
|
54127
54127
|
if (parsedUrl) {
|
|
54128
|
-
return { urlPath: url3, url: url3, query, fragment, hasRoute: false };
|
|
54128
|
+
return { urlPath: url3, url: url3, query: query2, fragment, hasRoute: false };
|
|
54129
54129
|
}
|
|
54130
54130
|
if (typeof httpTarget === "string") {
|
|
54131
|
-
return { urlPath: stripUrlQueryAndFragment(httpTarget), url: url3, query, fragment, hasRoute: false };
|
|
54131
|
+
return { urlPath: stripUrlQueryAndFragment(httpTarget), url: url3, query: query2, fragment, hasRoute: false };
|
|
54132
54132
|
}
|
|
54133
|
-
return { urlPath: void 0, url: url3, query, fragment, hasRoute: false };
|
|
54133
|
+
return { urlPath: void 0, url: url3, query: query2, fragment, hasRoute: false };
|
|
54134
54134
|
}
|
|
54135
54135
|
function getUserUpdatedNameAndSource(originalName, attributes, fallbackSource = "custom") {
|
|
54136
54136
|
const source = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] || fallbackSource;
|
|
@@ -61651,12 +61651,12 @@ var init_instrumentation6 = __esm({
|
|
|
61651
61651
|
const dbStatementSerializer = typeof configDbStatementSerializer === "function" ? configDbStatementSerializer : this._defaultDbStatementSerializer.bind(this);
|
|
61652
61652
|
(0, import_instrumentation17.safeExecuteInTheMiddle)(
|
|
61653
61653
|
() => {
|
|
61654
|
-
const
|
|
61654
|
+
const query2 = dbStatementSerializer(commandObj);
|
|
61655
61655
|
if (this._dbSemconvStability & import_instrumentation17.SemconvStability.OLD) {
|
|
61656
|
-
attributes[ATTR_DB_STATEMENT] =
|
|
61656
|
+
attributes[ATTR_DB_STATEMENT] = query2;
|
|
61657
61657
|
}
|
|
61658
61658
|
if (this._dbSemconvStability & import_instrumentation17.SemconvStability.STABLE) {
|
|
61659
|
-
attributes[import_semantic_conventions7.ATTR_DB_QUERY_TEXT] =
|
|
61659
|
+
attributes[import_semantic_conventions7.ATTR_DB_QUERY_TEXT] = query2;
|
|
61660
61660
|
}
|
|
61661
61661
|
},
|
|
61662
61662
|
(err) => {
|
|
@@ -62373,22 +62373,22 @@ function getJDBCString(host, port, database) {
|
|
|
62373
62373
|
}
|
|
62374
62374
|
return jdbcString;
|
|
62375
62375
|
}
|
|
62376
|
-
function getDbQueryText(
|
|
62377
|
-
if (typeof
|
|
62378
|
-
return
|
|
62376
|
+
function getDbQueryText(query2) {
|
|
62377
|
+
if (typeof query2 === "string") {
|
|
62378
|
+
return query2;
|
|
62379
62379
|
} else {
|
|
62380
|
-
return
|
|
62380
|
+
return query2.sql;
|
|
62381
62381
|
}
|
|
62382
62382
|
}
|
|
62383
|
-
function getDbValues(
|
|
62384
|
-
if (typeof
|
|
62383
|
+
function getDbValues(query2, values) {
|
|
62384
|
+
if (typeof query2 === "string") {
|
|
62385
62385
|
return arrayStringifyHelper(values);
|
|
62386
62386
|
} else {
|
|
62387
|
-
return arrayStringifyHelper(values ||
|
|
62387
|
+
return arrayStringifyHelper(values || query2.values);
|
|
62388
62388
|
}
|
|
62389
62389
|
}
|
|
62390
|
-
function getSpanName(
|
|
62391
|
-
const rawQuery = typeof
|
|
62390
|
+
function getSpanName(query2) {
|
|
62391
|
+
const rawQuery = typeof query2 === "object" ? query2.sql : query2;
|
|
62392
62392
|
const firstSpace = rawQuery?.indexOf(" ");
|
|
62393
62393
|
if (typeof firstSpace === "number" && firstSpace !== -1) {
|
|
62394
62394
|
return rawQuery?.substring(0, firstSpace);
|
|
@@ -62592,7 +62592,7 @@ var init_instrumentation7 = __esm({
|
|
|
62592
62592
|
_patchQuery(connection) {
|
|
62593
62593
|
return (originalQuery) => {
|
|
62594
62594
|
const thisPlugin = this;
|
|
62595
|
-
return function
|
|
62595
|
+
return function query2(query2, _valuesOrCallback, _callback) {
|
|
62596
62596
|
if (!thisPlugin["_enabled"]) {
|
|
62597
62597
|
thisPlugin._unwrap(connection, "query");
|
|
62598
62598
|
return originalQuery.apply(connection, arguments);
|
|
@@ -62600,7 +62600,7 @@ var init_instrumentation7 = __esm({
|
|
|
62600
62600
|
const attributes = {};
|
|
62601
62601
|
const { host, port, database, user } = getConfig(connection.config);
|
|
62602
62602
|
const portNumber = parseInt(port, 10);
|
|
62603
|
-
const dbQueryText = getDbQueryText(
|
|
62603
|
+
const dbQueryText = getDbQueryText(query2);
|
|
62604
62604
|
if (thisPlugin._dbSemconvStability & import_instrumentation21.SemconvStability.OLD) {
|
|
62605
62605
|
attributes[ATTR_DB_SYSTEM3] = DB_SYSTEM_VALUE_MYSQL;
|
|
62606
62606
|
attributes[ATTR_DB_CONNECTION_STRING2] = getJDBCString(host, port, database);
|
|
@@ -62625,7 +62625,7 @@ var init_instrumentation7 = __esm({
|
|
|
62625
62625
|
attributes[import_semantic_conventions10.ATTR_SERVER_PORT] = portNumber;
|
|
62626
62626
|
}
|
|
62627
62627
|
}
|
|
62628
|
-
const span = thisPlugin.tracer.startSpan(getSpanName(
|
|
62628
|
+
const span = thisPlugin.tracer.startSpan(getSpanName(query2), {
|
|
62629
62629
|
kind: import_api23.SpanKind.CLIENT,
|
|
62630
62630
|
attributes
|
|
62631
62631
|
});
|
|
@@ -62636,7 +62636,7 @@ var init_instrumentation7 = __esm({
|
|
|
62636
62636
|
} else if (arguments[2]) {
|
|
62637
62637
|
values = [_valuesOrCallback];
|
|
62638
62638
|
}
|
|
62639
|
-
span.setAttribute(AttributeNames3.MYSQL_VALUES, getDbValues(
|
|
62639
|
+
span.setAttribute(AttributeNames3.MYSQL_VALUES, getDbValues(query2, values));
|
|
62640
62640
|
}
|
|
62641
62641
|
const cbIndex = Array.from(arguments).findIndex((arg2) => typeof arg2 === "function");
|
|
62642
62642
|
const parentContext = import_api23.context.active();
|
|
@@ -62732,40 +62732,40 @@ var init_semconv5 = __esm({
|
|
|
62732
62732
|
});
|
|
62733
62733
|
|
|
62734
62734
|
// ../../../../node_modules/@sentry/node/build/esm/integrations/tracing/utils/sql-common.js
|
|
62735
|
-
function hasValidSqlComment(
|
|
62736
|
-
const indexOpeningDashDashComment =
|
|
62735
|
+
function hasValidSqlComment(query2) {
|
|
62736
|
+
const indexOpeningDashDashComment = query2.indexOf("--");
|
|
62737
62737
|
if (indexOpeningDashDashComment >= 0) {
|
|
62738
62738
|
return true;
|
|
62739
62739
|
}
|
|
62740
|
-
const indexOpeningSlashComment =
|
|
62740
|
+
const indexOpeningSlashComment = query2.indexOf("/*");
|
|
62741
62741
|
if (indexOpeningSlashComment < 0) {
|
|
62742
62742
|
return false;
|
|
62743
62743
|
}
|
|
62744
|
-
const indexClosingSlashComment =
|
|
62744
|
+
const indexClosingSlashComment = query2.indexOf("*/");
|
|
62745
62745
|
return indexOpeningDashDashComment < indexClosingSlashComment;
|
|
62746
62746
|
}
|
|
62747
62747
|
function fixedEncodeURIComponent(str) {
|
|
62748
62748
|
return encodeURIComponent(str).replace(/[!'()*]/g, (c2) => `%${c2.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
62749
62749
|
}
|
|
62750
|
-
function addSqlCommenterComment(span,
|
|
62751
|
-
if (typeof
|
|
62752
|
-
return
|
|
62750
|
+
function addSqlCommenterComment(span, query2) {
|
|
62751
|
+
if (typeof query2 !== "string" || query2.length === 0) {
|
|
62752
|
+
return query2;
|
|
62753
62753
|
}
|
|
62754
|
-
if (hasValidSqlComment(
|
|
62755
|
-
return
|
|
62754
|
+
if (hasValidSqlComment(query2)) {
|
|
62755
|
+
return query2;
|
|
62756
62756
|
}
|
|
62757
62757
|
const propagator = new import_core67.W3CTraceContextPropagator();
|
|
62758
62758
|
const headers = {};
|
|
62759
62759
|
propagator.inject(import_api24.trace.setSpan(import_api24.ROOT_CONTEXT, span), headers, import_api24.defaultTextMapSetter);
|
|
62760
62760
|
const sortedKeys = Object.keys(headers).sort();
|
|
62761
62761
|
if (sortedKeys.length === 0) {
|
|
62762
|
-
return
|
|
62762
|
+
return query2;
|
|
62763
62763
|
}
|
|
62764
62764
|
const commentString = sortedKeys.map((key) => {
|
|
62765
62765
|
const encodedValue = fixedEncodeURIComponent(headers[key]);
|
|
62766
62766
|
return `${key}='${encodedValue}'`;
|
|
62767
62767
|
}).join(",");
|
|
62768
|
-
return `${
|
|
62768
|
+
return `${query2} /*${commentString}*/`;
|
|
62769
62769
|
}
|
|
62770
62770
|
var import_api24, import_core67;
|
|
62771
62771
|
var init_sql_common = __esm({
|
|
@@ -62816,8 +62816,8 @@ function getJDBCString2(host, port, database) {
|
|
|
62816
62816
|
}
|
|
62817
62817
|
return jdbcString;
|
|
62818
62818
|
}
|
|
62819
|
-
function getQueryText(
|
|
62820
|
-
const [querySql, queryValues] = typeof
|
|
62819
|
+
function getQueryText(query2, format2, values, maskStatement = false, maskStatementHook = defaultMaskingHook) {
|
|
62820
|
+
const [querySql, queryValues] = typeof query2 === "string" ? [query2, values] : [query2.sql, hasValues(query2) ? values || query2.values : values];
|
|
62821
62821
|
try {
|
|
62822
62822
|
if (maskStatement) {
|
|
62823
62823
|
return maskStatementHook(querySql);
|
|
@@ -62830,14 +62830,14 @@ function getQueryText(query, format2, values, maskStatement = false, maskStateme
|
|
|
62830
62830
|
return "Could not determine the query due to an error in masking or formatting";
|
|
62831
62831
|
}
|
|
62832
62832
|
}
|
|
62833
|
-
function defaultMaskingHook(
|
|
62834
|
-
return
|
|
62833
|
+
function defaultMaskingHook(query2) {
|
|
62834
|
+
return query2.replace(/\b\d+\b/g, "?").replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, "?");
|
|
62835
62835
|
}
|
|
62836
62836
|
function hasValues(obj) {
|
|
62837
62837
|
return "values" in obj;
|
|
62838
62838
|
}
|
|
62839
|
-
function getSpanName2(
|
|
62840
|
-
const rawQuery = typeof
|
|
62839
|
+
function getSpanName2(query2) {
|
|
62840
|
+
const rawQuery = typeof query2 === "object" ? query2.sql : query2;
|
|
62841
62841
|
const firstSpace = rawQuery?.indexOf(" ");
|
|
62842
62842
|
if (typeof firstSpace === "number" && firstSpace !== -1) {
|
|
62843
62843
|
return rawQuery?.substring(0, firstSpace);
|
|
@@ -62955,7 +62955,7 @@ var init_instrumentation8 = __esm({
|
|
|
62955
62955
|
_patchQuery(format2, isPrepared) {
|
|
62956
62956
|
return (originalQuery) => {
|
|
62957
62957
|
const thisPlugin = this;
|
|
62958
|
-
return function
|
|
62958
|
+
return function query2(query2, _valuesOrCallback, _callback) {
|
|
62959
62959
|
let values;
|
|
62960
62960
|
if (Array.isArray(_valuesOrCallback)) {
|
|
62961
62961
|
values = _valuesOrCallback;
|
|
@@ -62968,7 +62968,7 @@ var init_instrumentation8 = __esm({
|
|
|
62968
62968
|
thisPlugin._dbSemconvStability,
|
|
62969
62969
|
thisPlugin._netSemconvStability
|
|
62970
62970
|
);
|
|
62971
|
-
const dbQueryText = getQueryText(
|
|
62971
|
+
const dbQueryText = getQueryText(query2, format2, values, maskStatement, maskStatementHook);
|
|
62972
62972
|
if (thisPlugin._dbSemconvStability & import_instrumentation24.SemconvStability.OLD) {
|
|
62973
62973
|
attributes[ATTR_DB_SYSTEM4] = DB_SYSTEM_VALUE_MYSQL2;
|
|
62974
62974
|
attributes[ATTR_DB_STATEMENT4] = dbQueryText;
|
|
@@ -62977,13 +62977,13 @@ var init_instrumentation8 = __esm({
|
|
|
62977
62977
|
attributes[import_semantic_conventions12.ATTR_DB_SYSTEM_NAME] = import_semantic_conventions12.DB_SYSTEM_NAME_VALUE_MYSQL;
|
|
62978
62978
|
attributes[import_semantic_conventions12.ATTR_DB_QUERY_TEXT] = dbQueryText;
|
|
62979
62979
|
}
|
|
62980
|
-
const span = thisPlugin.tracer.startSpan(getSpanName2(
|
|
62980
|
+
const span = thisPlugin.tracer.startSpan(getSpanName2(query2), {
|
|
62981
62981
|
kind: api3.SpanKind.CLIENT,
|
|
62982
62982
|
attributes
|
|
62983
62983
|
});
|
|
62984
62984
|
if (!isPrepared && thisPlugin.getConfig().addSqlCommenterCommentToQueries) {
|
|
62985
|
-
arguments[0] =
|
|
62986
|
-
sql: addSqlCommenterComment(span,
|
|
62985
|
+
arguments[0] = query2 = typeof query2 === "string" ? addSqlCommenterComment(span, query2) : Object.assign(query2, {
|
|
62986
|
+
sql: addSqlCommenterComment(span, query2.sql)
|
|
62987
62987
|
});
|
|
62988
62988
|
}
|
|
62989
62989
|
const endSpan5 = once((err, results) => {
|
|
@@ -63012,8 +63012,8 @@ var init_instrumentation8 = __esm({
|
|
|
63012
63012
|
span.end();
|
|
63013
63013
|
});
|
|
63014
63014
|
if (arguments.length === 1) {
|
|
63015
|
-
if (typeof
|
|
63016
|
-
thisPlugin._wrap(
|
|
63015
|
+
if (typeof query2.onResult === "function") {
|
|
63016
|
+
thisPlugin._wrap(query2, "onResult", thisPlugin._patchCallbackQuery(endSpan5));
|
|
63017
63017
|
}
|
|
63018
63018
|
const streamableQuery = originalQuery.apply(this, arguments);
|
|
63019
63019
|
streamableQuery.once("error", (err) => {
|
|
@@ -64798,7 +64798,7 @@ var init_instrumentation9 = __esm({
|
|
|
64798
64798
|
const plugin = this;
|
|
64799
64799
|
return (original) => {
|
|
64800
64800
|
this._diag.debug("Patching pg.Client.prototype.query");
|
|
64801
|
-
return function
|
|
64801
|
+
return function query2(...args) {
|
|
64802
64802
|
if (shouldSkipInstrumentation(plugin.getConfig())) {
|
|
64803
64803
|
return original.apply(this, args);
|
|
64804
64804
|
}
|
|
@@ -69730,9 +69730,9 @@ var init_sentry = __esm({
|
|
|
69730
69730
|
uncaughtExceptionMonitorInstalled = false;
|
|
69731
69731
|
currentDevboxSentryUser = null;
|
|
69732
69732
|
readBuildMetadata = () => {
|
|
69733
|
-
const rawPackageVersion = "1.0.
|
|
69734
|
-
const rawGitSha = "
|
|
69735
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
69733
|
+
const rawPackageVersion = "1.0.1078";
|
|
69734
|
+
const rawGitSha = "8c516f16149b71ba8dc1fd9ba16fda4b614ce8bf";
|
|
69735
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.1078+8c516f16149b71ba8dc1fd9ba16fda4b614ce8bf";
|
|
69736
69736
|
const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
|
|
69737
69737
|
const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
|
|
69738
69738
|
const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
|
|
@@ -75116,7 +75116,7 @@ var init_packageVersion = __esm({
|
|
|
75116
75116
|
return path18.join(process.cwd(), "dvb");
|
|
75117
75117
|
};
|
|
75118
75118
|
readEmbeddedPackageVersion = () => {
|
|
75119
|
-
const raw = "1.0.
|
|
75119
|
+
const raw = "1.0.1078";
|
|
75120
75120
|
return trimVersion(raw);
|
|
75121
75121
|
};
|
|
75122
75122
|
readNearestPackageMetadata = (basePath) => {
|
|
@@ -82373,7 +82373,7 @@ var init_local_state = __esm({
|
|
|
82373
82373
|
};
|
|
82374
82374
|
} else {
|
|
82375
82375
|
const queryId = this.nextQueryId++;
|
|
82376
|
-
const
|
|
82376
|
+
const query2 = {
|
|
82377
82377
|
id: queryId,
|
|
82378
82378
|
canonicalizedUdfPath,
|
|
82379
82379
|
args,
|
|
@@ -82381,7 +82381,7 @@ var init_local_state = __esm({
|
|
|
82381
82381
|
journal,
|
|
82382
82382
|
componentPath
|
|
82383
82383
|
};
|
|
82384
|
-
this.querySet.set(queryToken,
|
|
82384
|
+
this.querySet.set(queryToken, query2);
|
|
82385
82385
|
this.queryIdToToken.set(queryId, queryToken);
|
|
82386
82386
|
const baseVersion = this.querySetVersion;
|
|
82387
82387
|
const newVersion = this.querySetVersion + 1;
|
|
@@ -82856,9 +82856,9 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82856
82856
|
this.queryResults = queryResults;
|
|
82857
82857
|
this.modifiedQueries = [];
|
|
82858
82858
|
}
|
|
82859
|
-
getQuery(
|
|
82859
|
+
getQuery(query2, ...args) {
|
|
82860
82860
|
const queryArgs = parseArgs(args[0]);
|
|
82861
|
-
const name = getFunctionName2(
|
|
82861
|
+
const name = getFunctionName2(query2);
|
|
82862
82862
|
const queryResult = this.queryResults.get(
|
|
82863
82863
|
serializePathAndArgs(name, queryArgs)
|
|
82864
82864
|
);
|
|
@@ -82867,9 +82867,9 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82867
82867
|
}
|
|
82868
82868
|
return _OptimisticLocalStoreImpl.queryValue(queryResult.result);
|
|
82869
82869
|
}
|
|
82870
|
-
getAllQueries(
|
|
82870
|
+
getAllQueries(query2) {
|
|
82871
82871
|
const queriesWithName = [];
|
|
82872
|
-
const name = getFunctionName2(
|
|
82872
|
+
const name = getFunctionName2(query2);
|
|
82873
82873
|
for (const queryResult of this.queryResults.values()) {
|
|
82874
82874
|
if (queryResult.udfPath === canonicalizeUdfPath(name)) {
|
|
82875
82875
|
queriesWithName.push({
|
|
@@ -82895,12 +82895,12 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82895
82895
|
logLines: []
|
|
82896
82896
|
};
|
|
82897
82897
|
}
|
|
82898
|
-
const
|
|
82898
|
+
const query2 = {
|
|
82899
82899
|
udfPath: name,
|
|
82900
82900
|
args: queryArgs,
|
|
82901
82901
|
result
|
|
82902
82902
|
};
|
|
82903
|
-
this.queryResults.set(queryToken,
|
|
82903
|
+
this.queryResults.set(queryToken, query2);
|
|
82904
82904
|
this.modifiedQueries.push(queryToken);
|
|
82905
82905
|
}
|
|
82906
82906
|
static queryValue(result) {
|
|
@@ -82934,9 +82934,9 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82934
82934
|
updateAndId.update(localStore);
|
|
82935
82935
|
}
|
|
82936
82936
|
const changedQueries = [];
|
|
82937
|
-
for (const [queryToken,
|
|
82937
|
+
for (const [queryToken, query2] of this.queryResults) {
|
|
82938
82938
|
const oldQuery = oldQueryResults.get(queryToken);
|
|
82939
|
-
if (oldQuery === void 0 || oldQuery.result !==
|
|
82939
|
+
if (oldQuery === void 0 || oldQuery.result !== query2.result) {
|
|
82940
82940
|
changedQueries.push(queryToken);
|
|
82941
82941
|
}
|
|
82942
82942
|
}
|
|
@@ -82958,18 +82958,18 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82958
82958
|
* @internal
|
|
82959
82959
|
*/
|
|
82960
82960
|
rawQueryResult(queryToken) {
|
|
82961
|
-
const
|
|
82962
|
-
if (
|
|
82961
|
+
const query2 = this.queryResults.get(queryToken);
|
|
82962
|
+
if (query2 === void 0) {
|
|
82963
82963
|
return void 0;
|
|
82964
82964
|
}
|
|
82965
|
-
return
|
|
82965
|
+
return query2.result;
|
|
82966
82966
|
}
|
|
82967
82967
|
queryResult(queryToken) {
|
|
82968
|
-
const
|
|
82969
|
-
if (
|
|
82968
|
+
const query2 = this.queryResults.get(queryToken);
|
|
82969
|
+
if (query2 === void 0) {
|
|
82970
82970
|
return void 0;
|
|
82971
82971
|
}
|
|
82972
|
-
const result =
|
|
82972
|
+
const result = query2.result;
|
|
82973
82973
|
if (result === void 0) {
|
|
82974
82974
|
return void 0;
|
|
82975
82975
|
} else if (result.success) {
|
|
@@ -82979,12 +82979,12 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82979
82979
|
throw forwardData(
|
|
82980
82980
|
result,
|
|
82981
82981
|
new ConvexError(
|
|
82982
|
-
createHybridErrorStacktrace("query",
|
|
82982
|
+
createHybridErrorStacktrace("query", query2.udfPath, result)
|
|
82983
82983
|
)
|
|
82984
82984
|
);
|
|
82985
82985
|
}
|
|
82986
82986
|
throw new Error(
|
|
82987
|
-
createHybridErrorStacktrace("query",
|
|
82987
|
+
createHybridErrorStacktrace("query", query2.udfPath, result)
|
|
82988
82988
|
);
|
|
82989
82989
|
}
|
|
82990
82990
|
}
|
|
@@ -82995,8 +82995,8 @@ var init_optimistic_updates_impl = __esm({
|
|
|
82995
82995
|
* @internal
|
|
82996
82996
|
*/
|
|
82997
82997
|
queryLogs(queryToken) {
|
|
82998
|
-
const
|
|
82999
|
-
return
|
|
82998
|
+
const query2 = this.queryResults.get(queryToken);
|
|
82999
|
+
return query2?.result?.logLines;
|
|
83000
83000
|
}
|
|
83001
83001
|
};
|
|
83002
83002
|
}
|
|
@@ -84634,12 +84634,12 @@ var init_client3 = __esm({
|
|
|
84634
84634
|
for (const [queryId, result] of remoteQueryResults) {
|
|
84635
84635
|
const queryToken = this.state.queryToken(queryId);
|
|
84636
84636
|
if (queryToken !== null) {
|
|
84637
|
-
const
|
|
84637
|
+
const query2 = {
|
|
84638
84638
|
result,
|
|
84639
84639
|
udfPath: this.state.queryPath(queryId),
|
|
84640
84640
|
args: this.state.queryArgs(queryId)
|
|
84641
84641
|
};
|
|
84642
|
-
queryTokenToValue.set(queryToken,
|
|
84642
|
+
queryTokenToValue.set(queryToken, query2);
|
|
84643
84643
|
}
|
|
84644
84644
|
}
|
|
84645
84645
|
const changedQueryTokens = this.optimisticQueryResults.ingestQueryResultsFromServer(
|
|
@@ -85221,10 +85221,10 @@ var init_http_client = __esm({
|
|
|
85221
85221
|
*
|
|
85222
85222
|
* @deprecated This API is experimental: it may change or disappear.
|
|
85223
85223
|
*/
|
|
85224
|
-
async consistentQuery(
|
|
85224
|
+
async consistentQuery(query2, ...args) {
|
|
85225
85225
|
const queryArgs = parseArgs(args[0]);
|
|
85226
85226
|
const timestampPromise = this.getTimestamp();
|
|
85227
|
-
return await this.queryInner(
|
|
85227
|
+
return await this.queryInner(query2, queryArgs, { timestampPromise });
|
|
85228
85228
|
}
|
|
85229
85229
|
async getTimestamp() {
|
|
85230
85230
|
if (this.encodedTsPromise) {
|
|
@@ -85257,12 +85257,12 @@ var init_http_client = __esm({
|
|
|
85257
85257
|
* the arguments will be `{}`.
|
|
85258
85258
|
* @returns A promise of the query's result.
|
|
85259
85259
|
*/
|
|
85260
|
-
async query(
|
|
85260
|
+
async query(query2, ...args) {
|
|
85261
85261
|
const queryArgs = parseArgs(args[0]);
|
|
85262
|
-
return await this.queryInner(
|
|
85262
|
+
return await this.queryInner(query2, queryArgs, {});
|
|
85263
85263
|
}
|
|
85264
|
-
async queryInner(
|
|
85265
|
-
const name = getFunctionName2(
|
|
85264
|
+
async queryInner(query2, queryArgs, options) {
|
|
85265
|
+
const name = getFunctionName2(query2);
|
|
85266
85266
|
const args = [convexToJson(queryArgs)];
|
|
85267
85267
|
const headers = {
|
|
85268
85268
|
"Content-Type": "application/json",
|
|
@@ -85312,8 +85312,8 @@ var init_http_client = __esm({
|
|
|
85312
85312
|
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
85313
85313
|
}
|
|
85314
85314
|
}
|
|
85315
|
-
async mutationInner(
|
|
85316
|
-
const name = getFunctionName2(
|
|
85315
|
+
async mutationInner(mutation2, mutationArgs) {
|
|
85316
|
+
const name = getFunctionName2(mutation2);
|
|
85317
85317
|
const body = JSON.stringify({
|
|
85318
85318
|
path: name,
|
|
85319
85319
|
format: "convex_encoded_json",
|
|
@@ -85365,9 +85365,9 @@ var init_http_client = __esm({
|
|
|
85365
85365
|
}
|
|
85366
85366
|
this.isProcessingQueue = true;
|
|
85367
85367
|
while (this.mutationQueue.length > 0) {
|
|
85368
|
-
const { mutation, args, resolve: resolve3, reject } = this.mutationQueue.shift();
|
|
85368
|
+
const { mutation: mutation2, args, resolve: resolve3, reject } = this.mutationQueue.shift();
|
|
85369
85369
|
try {
|
|
85370
|
-
const result = await this.mutationInner(
|
|
85370
|
+
const result = await this.mutationInner(mutation2, args);
|
|
85371
85371
|
resolve3(result);
|
|
85372
85372
|
} catch (error55) {
|
|
85373
85373
|
reject(error55);
|
|
@@ -85375,9 +85375,9 @@ var init_http_client = __esm({
|
|
|
85375
85375
|
}
|
|
85376
85376
|
this.isProcessingQueue = false;
|
|
85377
85377
|
}
|
|
85378
|
-
enqueueMutation(
|
|
85378
|
+
enqueueMutation(mutation2, args) {
|
|
85379
85379
|
return new Promise((resolve3, reject) => {
|
|
85380
|
-
this.mutationQueue.push({ mutation, args, resolve: resolve3, reject });
|
|
85380
|
+
this.mutationQueue.push({ mutation: mutation2, args, resolve: resolve3, reject });
|
|
85381
85381
|
void this.processMutationQueue();
|
|
85382
85382
|
});
|
|
85383
85383
|
}
|
|
@@ -85390,14 +85390,14 @@ var init_http_client = __esm({
|
|
|
85390
85390
|
* @param options - An optional object containing
|
|
85391
85391
|
* @returns A promise of the mutation's result.
|
|
85392
85392
|
*/
|
|
85393
|
-
async mutation(
|
|
85393
|
+
async mutation(mutation2, ...args) {
|
|
85394
85394
|
const [fnArgs, options] = args;
|
|
85395
85395
|
const mutationArgs = parseArgs(fnArgs);
|
|
85396
85396
|
const queued = !options?.skipQueue;
|
|
85397
85397
|
if (queued) {
|
|
85398
|
-
return await this.enqueueMutation(
|
|
85398
|
+
return await this.enqueueMutation(mutation2, mutationArgs);
|
|
85399
85399
|
} else {
|
|
85400
|
-
return await this.mutationInner(
|
|
85400
|
+
return await this.mutationInner(mutation2, mutationArgs);
|
|
85401
85401
|
}
|
|
85402
85402
|
}
|
|
85403
85403
|
/**
|
|
@@ -86015,12 +86015,12 @@ var init_simple_client = __esm({
|
|
|
86015
86015
|
*
|
|
86016
86016
|
* @return an {@link Unsubscribe} function to stop calling the onUpdate function.
|
|
86017
86017
|
*/
|
|
86018
|
-
onUpdate(
|
|
86018
|
+
onUpdate(query2, args, callback, onError) {
|
|
86019
86019
|
if (this.disabled) {
|
|
86020
86020
|
return this.createDisabledUnsubscribe();
|
|
86021
86021
|
}
|
|
86022
86022
|
const { queryToken, unsubscribe: unsubscribe4 } = this.client.subscribe(
|
|
86023
|
-
getFunctionName2(
|
|
86023
|
+
getFunctionName2(query2),
|
|
86024
86024
|
args
|
|
86025
86025
|
);
|
|
86026
86026
|
const queryInfo = {
|
|
@@ -86029,7 +86029,7 @@ var init_simple_client = __esm({
|
|
|
86029
86029
|
onError,
|
|
86030
86030
|
unsubscribe: unsubscribe4,
|
|
86031
86031
|
hasEverRun: false,
|
|
86032
|
-
query,
|
|
86032
|
+
query: query2,
|
|
86033
86033
|
args,
|
|
86034
86034
|
paginationOptions: void 0
|
|
86035
86035
|
};
|
|
@@ -86070,7 +86070,7 @@ var init_simple_client = __esm({
|
|
|
86070
86070
|
*
|
|
86071
86071
|
* @return an {@link Unsubscribe} function to stop calling the callback.
|
|
86072
86072
|
*/
|
|
86073
|
-
onPaginatedUpdate_experimental(
|
|
86073
|
+
onPaginatedUpdate_experimental(query2, args, options, callback, onError) {
|
|
86074
86074
|
if (this.disabled) {
|
|
86075
86075
|
return this.createDisabledUnsubscribe();
|
|
86076
86076
|
}
|
|
@@ -86079,7 +86079,7 @@ var init_simple_client = __esm({
|
|
|
86079
86079
|
id: -1
|
|
86080
86080
|
};
|
|
86081
86081
|
const { paginatedQueryToken, unsubscribe: unsubscribe4 } = this.paginatedClient.subscribe(
|
|
86082
|
-
getFunctionName2(
|
|
86082
|
+
getFunctionName2(query2),
|
|
86083
86083
|
args,
|
|
86084
86084
|
// Simple client doesn't use IDs, there's no expectation that these queries remain separate.
|
|
86085
86085
|
paginationOptions
|
|
@@ -86090,7 +86090,7 @@ var init_simple_client = __esm({
|
|
|
86090
86090
|
onError,
|
|
86091
86091
|
unsubscribe: unsubscribe4,
|
|
86092
86092
|
hasEverRun: false,
|
|
86093
|
-
query,
|
|
86093
|
+
query: query2,
|
|
86094
86094
|
args,
|
|
86095
86095
|
paginationOptions
|
|
86096
86096
|
};
|
|
@@ -86111,7 +86111,7 @@ var init_simple_client = __esm({
|
|
|
86111
86111
|
},
|
|
86112
86112
|
getCurrentValue: () => {
|
|
86113
86113
|
const result = this.paginatedClient.localQueryResult(
|
|
86114
|
-
getFunctionName2(
|
|
86114
|
+
getFunctionName2(query2),
|
|
86115
86115
|
args,
|
|
86116
86116
|
paginationOptions
|
|
86117
86117
|
);
|
|
@@ -86238,9 +86238,9 @@ var init_simple_client = __esm({
|
|
|
86238
86238
|
* @param options - A {@link MutationOptions} options object for the mutation.
|
|
86239
86239
|
* @returns A promise of the mutation's result.
|
|
86240
86240
|
*/
|
|
86241
|
-
async mutation(
|
|
86241
|
+
async mutation(mutation2, args, options) {
|
|
86242
86242
|
if (this.disabled) throw new Error("ConvexClient is disabled");
|
|
86243
|
-
return await this.client.mutation(getFunctionName2(
|
|
86243
|
+
return await this.client.mutation(getFunctionName2(mutation2), args, options);
|
|
86244
86244
|
}
|
|
86245
86245
|
/**
|
|
86246
86246
|
* Execute an action function.
|
|
@@ -86262,13 +86262,13 @@ var init_simple_client = __esm({
|
|
|
86262
86262
|
* @param args - An arguments object for the query.
|
|
86263
86263
|
* @returns A promise of the query's result.
|
|
86264
86264
|
*/
|
|
86265
|
-
async query(
|
|
86265
|
+
async query(query2, args) {
|
|
86266
86266
|
if (this.disabled) throw new Error("ConvexClient is disabled");
|
|
86267
|
-
const value = this.client.localQueryResult(getFunctionName2(
|
|
86267
|
+
const value = this.client.localQueryResult(getFunctionName2(query2), args);
|
|
86268
86268
|
if (value !== void 0) return Promise.resolve(value);
|
|
86269
86269
|
return new Promise((resolve3, reject) => {
|
|
86270
86270
|
const { unsubscribe: unsubscribe4 } = this.onUpdate(
|
|
86271
|
-
|
|
86271
|
+
query2,
|
|
86272
86272
|
args,
|
|
86273
86273
|
(value2) => {
|
|
86274
86274
|
unsubscribe4();
|
|
@@ -90382,7 +90382,7 @@ var init_controlPlane = __esm({
|
|
|
90382
90382
|
if (signal) {
|
|
90383
90383
|
init3.signal = signal;
|
|
90384
90384
|
}
|
|
90385
|
-
const
|
|
90385
|
+
const unavailable2 = (error55) => {
|
|
90386
90386
|
logger2.warn("control_plane_request_failed", {
|
|
90387
90387
|
requestId: requestId2,
|
|
90388
90388
|
method,
|
|
@@ -90401,7 +90401,7 @@ var init_controlPlane = __esm({
|
|
|
90401
90401
|
try {
|
|
90402
90402
|
response = await fetch(url3, init3);
|
|
90403
90403
|
} catch (error55) {
|
|
90404
|
-
throw
|
|
90404
|
+
throw unavailable2(error55);
|
|
90405
90405
|
}
|
|
90406
90406
|
logger2.info("control_plane_response", {
|
|
90407
90407
|
requestId: requestId2,
|
|
@@ -90413,7 +90413,7 @@ var init_controlPlane = __esm({
|
|
|
90413
90413
|
try {
|
|
90414
90414
|
text = await response.text();
|
|
90415
90415
|
} catch (error55) {
|
|
90416
|
-
throw
|
|
90416
|
+
throw unavailable2(error55);
|
|
90417
90417
|
}
|
|
90418
90418
|
if (!response.ok) {
|
|
90419
90419
|
const upgradeRequired = parseUpgradeRequiredResponseBody(text, {
|
|
@@ -98446,6 +98446,93 @@ var init_catalog = __esm({
|
|
|
98446
98446
|
}
|
|
98447
98447
|
]
|
|
98448
98448
|
},
|
|
98449
|
+
{
|
|
98450
|
+
name: "permissions",
|
|
98451
|
+
category: "Account",
|
|
98452
|
+
summary: "View and change what agents on your boxes can do",
|
|
98453
|
+
usage: ["dvb permissions <command>"],
|
|
98454
|
+
children: [
|
|
98455
|
+
{
|
|
98456
|
+
name: "get",
|
|
98457
|
+
summary: "Show Agent permissions for a box or project",
|
|
98458
|
+
usage: [
|
|
98459
|
+
"dvb permissions get (--box <box> | --project <project>) [--json]"
|
|
98460
|
+
],
|
|
98461
|
+
options: [
|
|
98462
|
+
flag("box", "Box alias from `dvb list`", { valueName: "box" }),
|
|
98463
|
+
flag("project", "Project name or fingerprint", {
|
|
98464
|
+
valueName: "project"
|
|
98465
|
+
}),
|
|
98466
|
+
flag("json", "Output JSON")
|
|
98467
|
+
],
|
|
98468
|
+
examples: [
|
|
98469
|
+
"dvb permissions get --box my-app-3",
|
|
98470
|
+
"dvb permissions get --project my-app"
|
|
98471
|
+
]
|
|
98472
|
+
},
|
|
98473
|
+
{
|
|
98474
|
+
name: "set",
|
|
98475
|
+
summary: "Change one Agent permission for a box or project",
|
|
98476
|
+
usage: [
|
|
98477
|
+
"dvb permissions set <permission> <value> (--box <box> | --project <project>) [--json]"
|
|
98478
|
+
],
|
|
98479
|
+
arguments: [
|
|
98480
|
+
arg("permission", "Permission name from `dvb permissions get`"),
|
|
98481
|
+
arg(
|
|
98482
|
+
"value",
|
|
98483
|
+
"on or off; folder-access takes none, move, or create; read-threads takes none, project, user, shared, or team"
|
|
98484
|
+
)
|
|
98485
|
+
],
|
|
98486
|
+
options: [
|
|
98487
|
+
flag("box", "Box alias from `dvb list`", { valueName: "box" }),
|
|
98488
|
+
flag("project", "Project name or fingerprint", {
|
|
98489
|
+
valueName: "project"
|
|
98490
|
+
}),
|
|
98491
|
+
flag("json", "Output JSON")
|
|
98492
|
+
],
|
|
98493
|
+
notes: [
|
|
98494
|
+
"--project changes the project's shared setting, which devboxes you haven't configured separately use."
|
|
98495
|
+
],
|
|
98496
|
+
examples: [
|
|
98497
|
+
"dvb permissions set message-agents on --project my-app",
|
|
98498
|
+
"dvb permissions set folder-access move --box my-app-3"
|
|
98499
|
+
]
|
|
98500
|
+
},
|
|
98501
|
+
{
|
|
98502
|
+
name: "requests",
|
|
98503
|
+
summary: "List permission requests your agents are waiting on",
|
|
98504
|
+
usage: ["dvb permissions requests [--json]"],
|
|
98505
|
+
options: [flag("json", "Output JSON")],
|
|
98506
|
+
notes: [
|
|
98507
|
+
"Agents make these requests with `dvb-onbox permissions request`. Each one expires after 10 minutes."
|
|
98508
|
+
]
|
|
98509
|
+
},
|
|
98510
|
+
{
|
|
98511
|
+
name: "allow",
|
|
98512
|
+
summary: "Allow an agent's permission request",
|
|
98513
|
+
usage: ["dvb permissions allow <request-id> [--project] [--json]"],
|
|
98514
|
+
arguments: [
|
|
98515
|
+
arg("request-id", "Request ID from `dvb permissions requests`")
|
|
98516
|
+
],
|
|
98517
|
+
options: [
|
|
98518
|
+
flag(
|
|
98519
|
+
"project",
|
|
98520
|
+
"Always allow for this project, including devboxes you haven't configured separately"
|
|
98521
|
+
),
|
|
98522
|
+
flag("json", "Output JSON")
|
|
98523
|
+
]
|
|
98524
|
+
},
|
|
98525
|
+
{
|
|
98526
|
+
name: "deny",
|
|
98527
|
+
summary: "Deny an agent's permission request",
|
|
98528
|
+
usage: ["dvb permissions deny <request-id> [--json]"],
|
|
98529
|
+
arguments: [
|
|
98530
|
+
arg("request-id", "Request ID from `dvb permissions requests`")
|
|
98531
|
+
],
|
|
98532
|
+
options: [flag("json", "Output JSON")]
|
|
98533
|
+
}
|
|
98534
|
+
]
|
|
98535
|
+
},
|
|
98449
98536
|
{
|
|
98450
98537
|
name: "logout",
|
|
98451
98538
|
category: "Account",
|
|
@@ -99010,6 +99097,22 @@ var init_catalog = __esm({
|
|
|
99010
99097
|
summary: "Inspect project agent threads",
|
|
99011
99098
|
usage: ["dvb threads <command>"],
|
|
99012
99099
|
children: [
|
|
99100
|
+
...["archive", "unarchive"].map((name) => ({
|
|
99101
|
+
name,
|
|
99102
|
+
summary: name === "archive" ? "Archive an agent thread" : "Unarchive an agent thread",
|
|
99103
|
+
usage: [`dvb threads ${name} --thread <client-thread-id> [--json]`],
|
|
99104
|
+
options: [
|
|
99105
|
+
flag("thread", "Stable client thread id", {
|
|
99106
|
+
valueName: "client-thread-id"
|
|
99107
|
+
}),
|
|
99108
|
+
flag("json", "Output the versioned JSON envelope")
|
|
99109
|
+
],
|
|
99110
|
+
notes: [
|
|
99111
|
+
"Repeating the same command is safe.",
|
|
99112
|
+
"A devbox's anchor thread cannot be archived separately.",
|
|
99113
|
+
"Restore cold threads in the desktop or mobile app before unarchiving them."
|
|
99114
|
+
]
|
|
99115
|
+
})),
|
|
99013
99116
|
{
|
|
99014
99117
|
name: "list",
|
|
99015
99118
|
summary: "List agent threads using TUI inventory semantics",
|
|
@@ -118916,21 +119019,21 @@ var require_get_request = __commonJS({
|
|
|
118916
119019
|
}
|
|
118917
119020
|
}
|
|
118918
119021
|
function transformConnectPostToGetRequest(request2, message, useBase64) {
|
|
118919
|
-
let
|
|
119022
|
+
let query2 = `?connect=v${version_js_1.protocolVersion}`;
|
|
118920
119023
|
const contentType = request2.header.get(headers_js_1.headerContentType);
|
|
118921
119024
|
if ((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(contentTypePrefix)) === 0) {
|
|
118922
|
-
|
|
119025
|
+
query2 += "&encoding=" + encodeURIComponent(contentType.slice(contentTypePrefix.length));
|
|
118923
119026
|
}
|
|
118924
119027
|
const compression = request2.header.get(headers_js_1.headerUnaryEncoding);
|
|
118925
119028
|
if (compression !== null && compression !== "identity") {
|
|
118926
|
-
|
|
119029
|
+
query2 += "&compression=" + encodeURIComponent(compression);
|
|
118927
119030
|
useBase64 = true;
|
|
118928
119031
|
}
|
|
118929
119032
|
if (useBase64) {
|
|
118930
|
-
|
|
119033
|
+
query2 += "&base64=1";
|
|
118931
119034
|
}
|
|
118932
|
-
|
|
118933
|
-
const url3 = request2.url +
|
|
119035
|
+
query2 += "&message=" + encodeMessageForUrl(message, useBase64);
|
|
119036
|
+
const url3 = request2.url + query2;
|
|
118934
119037
|
const header = new Headers(request2.header);
|
|
118935
119038
|
[
|
|
118936
119039
|
headers_js_1.headerProtocolVersion,
|
|
@@ -142589,6 +142692,136 @@ ${logs.outputTail || "(no recorded output)"}`;
|
|
|
142589
142692
|
}
|
|
142590
142693
|
});
|
|
142591
142694
|
|
|
142695
|
+
// ../../../../shared/onboxThreadReadAccess.ts
|
|
142696
|
+
var THREAD_READ_LEVELS;
|
|
142697
|
+
var init_onboxThreadReadAccess = __esm({
|
|
142698
|
+
"../../../../shared/onboxThreadReadAccess.ts"() {
|
|
142699
|
+
"use strict";
|
|
142700
|
+
THREAD_READ_LEVELS = [
|
|
142701
|
+
"none",
|
|
142702
|
+
"project",
|
|
142703
|
+
"user",
|
|
142704
|
+
"shared",
|
|
142705
|
+
"team"
|
|
142706
|
+
];
|
|
142707
|
+
}
|
|
142708
|
+
});
|
|
142709
|
+
|
|
142710
|
+
// ../../../../shared/onboxAgentPermissionRequestProtocol.ts
|
|
142711
|
+
var ONBOX_AGENT_PERMISSION_REQUEST_MAX_HTTP_BODY_BYTES, ONBOX_AGENT_PERMISSION_REQUEST_TTL_MS, ONBOX_AGENT_PERMISSIONS, ONBOX_AGENT_THREAD_GRANT_PERMISSIONS, ONBOX_AGENT_THREAD_GRANT_TTL_MS, isOnboxAgentThreadGrantPermission, isOnboxAgentPermission, REQUEST_ID_PATTERN, normalizeOnboxAgentPermissionRequestId;
|
|
142712
|
+
var init_onboxAgentPermissionRequestProtocol = __esm({
|
|
142713
|
+
"../../../../shared/onboxAgentPermissionRequestProtocol.ts"() {
|
|
142714
|
+
"use strict";
|
|
142715
|
+
ONBOX_AGENT_PERMISSION_REQUEST_MAX_HTTP_BODY_BYTES = 32 * 1024;
|
|
142716
|
+
ONBOX_AGENT_PERMISSION_REQUEST_TTL_MS = 10 * 60 * 1e3;
|
|
142717
|
+
ONBOX_AGENT_PERMISSIONS = [
|
|
142718
|
+
"read-project-threads",
|
|
142719
|
+
"read-user-threads",
|
|
142720
|
+
"read-shared-threads",
|
|
142721
|
+
"read-team-threads",
|
|
142722
|
+
"message-agents",
|
|
142723
|
+
"message-teammates-agents",
|
|
142724
|
+
"destroy-devbox",
|
|
142725
|
+
"destroy-created-devboxes",
|
|
142726
|
+
"create-devboxes-and-threads",
|
|
142727
|
+
"create-team-templates",
|
|
142728
|
+
"edit-devbox-lifecycle",
|
|
142729
|
+
"edit-template-maintenance",
|
|
142730
|
+
"update-thread-titles",
|
|
142731
|
+
"move-devboxes-to-folders",
|
|
142732
|
+
"create-devbox-folders",
|
|
142733
|
+
"edit-template-box",
|
|
142734
|
+
"edit-project-settings",
|
|
142735
|
+
"edit-team-template",
|
|
142736
|
+
"edit-personal-environment",
|
|
142737
|
+
"edit-automations"
|
|
142738
|
+
];
|
|
142739
|
+
ONBOX_AGENT_THREAD_GRANT_PERMISSIONS = [
|
|
142740
|
+
"edit-template-box",
|
|
142741
|
+
"edit-project-settings",
|
|
142742
|
+
"edit-team-template",
|
|
142743
|
+
"edit-personal-environment",
|
|
142744
|
+
"edit-automations"
|
|
142745
|
+
];
|
|
142746
|
+
ONBOX_AGENT_THREAD_GRANT_TTL_MS = 3 * 60 * 60 * 1e3;
|
|
142747
|
+
isOnboxAgentThreadGrantPermission = (permission) => ONBOX_AGENT_THREAD_GRANT_PERMISSIONS.includes(
|
|
142748
|
+
permission
|
|
142749
|
+
);
|
|
142750
|
+
isOnboxAgentPermission = (value) => ONBOX_AGENT_PERMISSIONS.includes(value);
|
|
142751
|
+
REQUEST_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
142752
|
+
normalizeOnboxAgentPermissionRequestId = (value) => {
|
|
142753
|
+
const normalized = value.trim();
|
|
142754
|
+
return REQUEST_ID_PATTERN.test(normalized) ? normalized.toLowerCase() : null;
|
|
142755
|
+
};
|
|
142756
|
+
}
|
|
142757
|
+
});
|
|
142758
|
+
|
|
142759
|
+
// ../../../../shared/onboxAgentPermissionRequestPresentation.ts
|
|
142760
|
+
var permissionQuestions, threadGrantScope, buildOnboxAgentPermissionRequestPresentation;
|
|
142761
|
+
var init_onboxAgentPermissionRequestPresentation = __esm({
|
|
142762
|
+
"../../../../shared/onboxAgentPermissionRequestPresentation.ts"() {
|
|
142763
|
+
"use strict";
|
|
142764
|
+
init_onboxAgentPermissionRequestProtocol();
|
|
142765
|
+
permissionQuestions = {
|
|
142766
|
+
"read-project-threads": "Allow agents to read other threads in this project?",
|
|
142767
|
+
"read-user-threads": "Allow agents to read threads in all your projects?",
|
|
142768
|
+
"read-shared-threads": "Allow agents to read your threads and threads shared with you?",
|
|
142769
|
+
"read-team-threads": "Allow agents to read your threads and teammates\u2019 threads you can access?",
|
|
142770
|
+
"message-agents": "Allow agents to message other agents in this project?",
|
|
142771
|
+
"message-teammates-agents": "Allow agents to message your teammates\u2019 agents?",
|
|
142772
|
+
"destroy-devbox": "Allow agents to destroy and archive this devbox?",
|
|
142773
|
+
"destroy-created-devboxes": "Allow agents to destroy and archive devboxes they create?",
|
|
142774
|
+
"create-devboxes-and-threads": "Allow agents to create devboxes and threads?",
|
|
142775
|
+
"create-team-templates": "Allow agents to create Team Templates?",
|
|
142776
|
+
"edit-devbox-lifecycle": "Allow agents to edit devbox lifecycle?",
|
|
142777
|
+
"edit-template-maintenance": "Allow agents to edit template maintenance?",
|
|
142778
|
+
"update-thread-titles": "Allow agents to update thread titles?",
|
|
142779
|
+
"move-devboxes-to-folders": "Allow agents to move devboxes to folders?",
|
|
142780
|
+
"create-devbox-folders": "Allow agents to create devbox folders?",
|
|
142781
|
+
"edit-template-box": "Allow this thread to edit the Template box?",
|
|
142782
|
+
"edit-project-settings": "Allow this thread to edit project settings?",
|
|
142783
|
+
"edit-team-template": "Allow this thread to edit the Team Template?",
|
|
142784
|
+
"edit-personal-environment": "Allow this thread to edit your environment variables?",
|
|
142785
|
+
"edit-automations": "Allow this thread to edit your automations?"
|
|
142786
|
+
};
|
|
142787
|
+
threadGrantScope = (permission, teamTemplateName) => {
|
|
142788
|
+
switch (permission) {
|
|
142789
|
+
case "edit-template-box":
|
|
142790
|
+
return "For the next 3 hours, the agent in this thread will be able to run commands on this project's Template box, change project settings and environment variables, change your account's auto-wake preference, and take snapshots that future devboxes will use. Agent permission defaults remain user-only.";
|
|
142791
|
+
case "edit-project-settings":
|
|
142792
|
+
return "For the next 3 hours, the agent in this thread will be able to change settings and your environment and member-file values in this project, plus your account's auto-wake preference. Agent permission defaults remain user-only.";
|
|
142793
|
+
case "edit-personal-environment":
|
|
142794
|
+
return "For the next 3 hours, the agent in this thread will be able to add, change, and remove your own environment variables in this project. Changes will reach all your devboxes in this project.";
|
|
142795
|
+
case "edit-automations":
|
|
142796
|
+
return "For the next 3 hours, the agent in this thread will be able to create, change, pause, run, and delete your automations in this project. Each run will start a new agent thread on a new devbox, without this conversation, and will use box-hours.";
|
|
142797
|
+
case "edit-team-template":
|
|
142798
|
+
return `For the next 3 hours, the agent in this thread will be able to edit ${teamTemplateName === null ? "your team's Team Template" : `the "${teamTemplateName}" Team Template`}, including its settings and environment variables, change settings in this project and your account's auto-wake preference, and save new versions for your team. Agent permission defaults remain user-only.`;
|
|
142799
|
+
}
|
|
142800
|
+
};
|
|
142801
|
+
buildOnboxAgentPermissionRequestPresentation = ({
|
|
142802
|
+
permission,
|
|
142803
|
+
sourceBoxKind,
|
|
142804
|
+
projectScopeAvailable,
|
|
142805
|
+
teamTemplateName
|
|
142806
|
+
}) => {
|
|
142807
|
+
const box = sourceBoxKind === "template_box" ? "Template box" : "devbox";
|
|
142808
|
+
const boxScope = permission === "message-agents" ? `Allow will let agents on this ${box} message your other agents in this project and receive their messages until you turn it off. A message will start an idle agent and wake its devbox if it's asleep.` : permission === "message-teammates-agents" ? `Allow will let agents on this ${box} message your teammates\u2019 agents until you turn it off. Your teammates\u2019 agents will also be able to message agents here once you allow their messages. An allowed message will start an idle agent and wake this ${box} if it's asleep.` : `Allow will enable this permission on this ${box} until you turn it off.`;
|
|
142809
|
+
return {
|
|
142810
|
+
question: permissionQuestions[permission],
|
|
142811
|
+
scope: isOnboxAgentThreadGrantPermission(permission) ? threadGrantScope(permission, teamTemplateName) : permission === "destroy-devbox" ? `This will allow every agent on this devbox to request its deletion after all agents finish. Files will be permanently deleted and thread history archived. You can turn this off in Agent permissions.${projectScopeAvailable ? " Project approval will extend this permission to your existing and future devboxes, except those you've configured separately. Agents will only be able to destroy their own devbox." : ""}` : permission === "destroy-created-devboxes" ? `This will allow agents on this ${box} to request deletion of devboxes they created. Each devbox will be deleted after all of its agents finish. Its files will be permanently deleted, and its thread history will be archived. You can turn this off in Agent permissions.${projectScopeAvailable ? " Project approval will also apply to your existing and future devboxes, except those you've configured separately." : ""}` : `${boxScope}${projectScopeAvailable ? " Project approval will also apply to your existing and future devboxes, except those you've configured separately." : ""}`,
|
|
142812
|
+
automationsSectionSentence: permission === "edit-automations" ? {
|
|
142813
|
+
before: "Manage these in the ",
|
|
142814
|
+
linkText: "automations",
|
|
142815
|
+
after: " section."
|
|
142816
|
+
} : null,
|
|
142817
|
+
allowLabel: isOnboxAgentThreadGrantPermission(permission) ? "Allow for 3 hours" : "Allow",
|
|
142818
|
+
declineLabel: "Deny",
|
|
142819
|
+
projectAllowLabel: "Always allow for project"
|
|
142820
|
+
};
|
|
142821
|
+
};
|
|
142822
|
+
}
|
|
142823
|
+
});
|
|
142824
|
+
|
|
142592
142825
|
// ../../../../shared/threadRuntime/threadInventory.ts
|
|
142593
142826
|
var init_threadInventory = __esm({
|
|
142594
142827
|
"../../../../shared/threadRuntime/threadInventory.ts"() {
|
|
@@ -142615,6 +142848,9 @@ var init_threadInventory = __esm({
|
|
|
142615
142848
|
init_threadListWindowData();
|
|
142616
142849
|
init_projectLifecycleMaintenance();
|
|
142617
142850
|
init_maintenanceHistory();
|
|
142851
|
+
init_onboxThreadReadAccess();
|
|
142852
|
+
init_onboxAgentPermissionRequestProtocol();
|
|
142853
|
+
init_onboxAgentPermissionRequestPresentation();
|
|
142618
142854
|
}
|
|
142619
142855
|
});
|
|
142620
142856
|
|
|
@@ -143114,11 +143350,13 @@ var init_projects2 = __esm({
|
|
|
143114
143350
|
});
|
|
143115
143351
|
|
|
143116
143352
|
// src/devbox/resourceApi/queryRefs.ts
|
|
143117
|
-
var listCliAgentToolProjectExecutionsV1, createCliAgentToolDevboxV1, getCliAgentToolDevboxOperationV1, startCliAgentToolThreadV1, setCliAgentToolThreadNotificationsMutedV1, sendCliAgentToolThreadV1, interruptCliAgentToolThreadV1, getCliAgentToolThreadContextV1, listCliAgentToolThreadEventsV1, observeCliAgentToolThreadV1, loadCliAgentToolThreadPeekV1, readCanonicalTeamThreadV1;
|
|
143353
|
+
var getCliAgentToolThreadForProject, getCliAgentToolThreadAnchor, listCliAgentToolProjectExecutionsV1, createCliAgentToolDevboxV1, getCliAgentToolDevboxOperationV1, startCliAgentToolThreadV1, setCliAgentToolThreadNotificationsMutedV1, sendCliAgentToolThreadV1, interruptCliAgentToolThreadV1, getCliAgentToolThreadContextV1, listCliAgentToolThreadEventsV1, observeCliAgentToolThreadV1, loadCliAgentToolThreadPeekV1, readCanonicalTeamThreadV1;
|
|
143118
143354
|
var init_queryRefs2 = __esm({
|
|
143119
143355
|
"src/devbox/resourceApi/queryRefs.ts"() {
|
|
143120
143356
|
"use strict";
|
|
143121
143357
|
init_server();
|
|
143358
|
+
getCliAgentToolThreadForProject = makeFunctionReference("clientThreads:getForProject");
|
|
143359
|
+
getCliAgentToolThreadAnchor = makeFunctionReference("threadPlacements:getForVisibleThread");
|
|
143122
143360
|
listCliAgentToolProjectExecutionsV1 = makeFunctionReference("cliAgentTools:listProjectExecutionsV1");
|
|
143123
143361
|
createCliAgentToolDevboxV1 = makeFunctionReference("cliAgentTools:createDevboxV1");
|
|
143124
143362
|
getCliAgentToolDevboxOperationV1 = makeFunctionReference("cliAgentTools:getDevboxOperationV1");
|
|
@@ -143865,13 +144103,13 @@ var init_nativeAgentAttachmentError = __esm({
|
|
|
143865
144103
|
"use strict";
|
|
143866
144104
|
createNativeAgentAttachmentError = ({
|
|
143867
144105
|
code: code2,
|
|
143868
|
-
boxLabel
|
|
144106
|
+
boxLabel: boxLabel2
|
|
143869
144107
|
}) => {
|
|
143870
144108
|
switch (code2) {
|
|
143871
144109
|
case "capability_unavailable":
|
|
143872
144110
|
return {
|
|
143873
144111
|
code: code2,
|
|
143874
|
-
message: `This ${
|
|
144112
|
+
message: `This ${boxLabel2} needs a boxes.dev service update before it can add this image. Wake it and retry in a moment; boxes.dev will update it automatically.`
|
|
143875
144113
|
};
|
|
143876
144114
|
case "unsupported_image":
|
|
143877
144115
|
return {
|
|
@@ -143921,12 +144159,12 @@ var init_nativeAgentAttachmentError = __esm({
|
|
|
143921
144159
|
case "remote_storage_full":
|
|
143922
144160
|
return {
|
|
143923
144161
|
code: code2,
|
|
143924
|
-
message: `This ${
|
|
144162
|
+
message: `This ${boxLabel2} doesn't have enough free storage for the image.`
|
|
143925
144163
|
};
|
|
143926
144164
|
case "transport_lost":
|
|
143927
144165
|
return {
|
|
143928
144166
|
code: code2,
|
|
143929
|
-
message: `The image upload disconnected from this ${
|
|
144167
|
+
message: `The image upload disconnected from this ${boxLabel2}. Reopen the thread and try again.`
|
|
143930
144168
|
};
|
|
143931
144169
|
case "checksum_mismatch":
|
|
143932
144170
|
return {
|
|
@@ -164226,11 +164464,11 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164226
164464
|
};
|
|
164227
164465
|
isNativeAgentImageUploadError = (error55) => error55 instanceof NativeAgentImageUploadError;
|
|
164228
164466
|
throwAttachmentError = ({
|
|
164229
|
-
boxLabel,
|
|
164467
|
+
boxLabel: boxLabel2,
|
|
164230
164468
|
code: code2
|
|
164231
164469
|
}) => {
|
|
164232
164470
|
throw new NativeAgentImageUploadError(
|
|
164233
|
-
createNativeAgentAttachmentError({ boxLabel, code: code2 })
|
|
164471
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: code2 })
|
|
164234
164472
|
);
|
|
164235
164473
|
};
|
|
164236
164474
|
mapServerErrorCode = (code2) => {
|
|
@@ -164262,9 +164500,9 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164262
164500
|
}
|
|
164263
164501
|
};
|
|
164264
164502
|
throwServerError = ({
|
|
164265
|
-
boxLabel,
|
|
164503
|
+
boxLabel: boxLabel2,
|
|
164266
164504
|
code: code2
|
|
164267
|
-
}) => throwAttachmentError({ boxLabel, code: mapServerErrorCode(code2) });
|
|
164505
|
+
}) => throwAttachmentError({ boxLabel: boxLabel2, code: mapServerErrorCode(code2) });
|
|
164268
164506
|
metadataForImages = (images) => images.map((image2) => ({
|
|
164269
164507
|
name: image2.name,
|
|
164270
164508
|
mimeType: image2.mimeType,
|
|
@@ -164287,7 +164525,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164287
164525
|
};
|
|
164288
164526
|
runUploadAttempt = async ({
|
|
164289
164527
|
alias,
|
|
164290
|
-
boxLabel,
|
|
164528
|
+
boxLabel: boxLabel2,
|
|
164291
164529
|
clientThreadId,
|
|
164292
164530
|
idempotencyKey,
|
|
164293
164531
|
images,
|
|
@@ -164315,29 +164553,29 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164315
164553
|
});
|
|
164316
164554
|
const start = parseNativeAgentImageUploadResult(startRaw);
|
|
164317
164555
|
if (!start || start.type !== "native_agent_image_batch_start_result_v1") {
|
|
164318
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164556
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164319
164557
|
}
|
|
164320
164558
|
if (start.status === "error") {
|
|
164321
|
-
return throwServerError({ boxLabel, code: start.error.code });
|
|
164559
|
+
return throwServerError({ boxLabel: boxLabel2, code: start.error.code });
|
|
164322
164560
|
}
|
|
164323
164561
|
if (start.status === "completed") {
|
|
164324
164562
|
if (!verifyCompletedImages({ completed: start.images, metadata })) {
|
|
164325
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164563
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164326
164564
|
}
|
|
164327
164565
|
return start.images;
|
|
164328
164566
|
}
|
|
164329
164567
|
if (start.images.length !== images.length) {
|
|
164330
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164568
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164331
164569
|
}
|
|
164332
164570
|
let finished = false;
|
|
164333
164571
|
const queue = new PQueue({ concurrency: 3 });
|
|
164334
164572
|
try {
|
|
164335
|
-
const
|
|
164573
|
+
const writes2 = images.map(
|
|
164336
164574
|
(image2, imageIndex) => queue.add(
|
|
164337
164575
|
async () => {
|
|
164338
164576
|
const remoteImage = start.images[imageIndex];
|
|
164339
164577
|
if (!remoteImage) {
|
|
164340
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164578
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164341
164579
|
}
|
|
164342
164580
|
let partIndex = 0;
|
|
164343
164581
|
let offsetBytes = 0;
|
|
@@ -164383,19 +164621,19 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164383
164621
|
const partResult2 = parseNativeAgentImageUploadResult(partRaw);
|
|
164384
164622
|
if (!partResult2 || partResult2.type !== "native_agent_image_part_write_result_v1") {
|
|
164385
164623
|
return throwAttachmentError({
|
|
164386
|
-
boxLabel,
|
|
164624
|
+
boxLabel: boxLabel2,
|
|
164387
164625
|
code: "protocol_error"
|
|
164388
164626
|
});
|
|
164389
164627
|
}
|
|
164390
164628
|
if (partResult2.status === "error") {
|
|
164391
164629
|
return throwServerError({
|
|
164392
|
-
boxLabel,
|
|
164630
|
+
boxLabel: boxLabel2,
|
|
164393
164631
|
code: partResult2.error.code
|
|
164394
164632
|
});
|
|
164395
164633
|
}
|
|
164396
164634
|
if (partResult2.batchId !== start.batchId || partResult2.imageId !== remoteImage.imageId || partResult2.partIndex !== partIndex || partResult2.offsetBytes !== offsetBytes || partResult2.sizeBytes !== part.byteLength) {
|
|
164397
164635
|
return throwAttachmentError({
|
|
164398
|
-
boxLabel,
|
|
164636
|
+
boxLabel: boxLabel2,
|
|
164399
164637
|
code: "protocol_error"
|
|
164400
164638
|
});
|
|
164401
164639
|
}
|
|
@@ -164406,7 +164644,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164406
164644
|
{ signal }
|
|
164407
164645
|
)
|
|
164408
164646
|
);
|
|
164409
|
-
await Promise.all(
|
|
164647
|
+
await Promise.all(writes2);
|
|
164410
164648
|
const finishRaw = await runControlRequest({
|
|
164411
164649
|
alias,
|
|
164412
164650
|
provider: "e2b",
|
|
@@ -164424,13 +164662,13 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164424
164662
|
});
|
|
164425
164663
|
const finish = parseNativeAgentImageUploadResult(finishRaw);
|
|
164426
164664
|
if (!finish || finish.type !== "native_agent_image_batch_finish_result_v1") {
|
|
164427
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164665
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164428
164666
|
}
|
|
164429
164667
|
if (finish.status === "error") {
|
|
164430
|
-
return throwServerError({ boxLabel, code: finish.error.code });
|
|
164668
|
+
return throwServerError({ boxLabel: boxLabel2, code: finish.error.code });
|
|
164431
164669
|
}
|
|
164432
164670
|
if (finish.batchId !== start.batchId || !verifyCompletedImages({ completed: finish.images, metadata })) {
|
|
164433
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164671
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164434
164672
|
}
|
|
164435
164673
|
finished = true;
|
|
164436
164674
|
return finish.images;
|
|
@@ -164462,7 +164700,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164462
164700
|
};
|
|
164463
164701
|
uploadNativeAgentImages = async ({
|
|
164464
164702
|
alias,
|
|
164465
|
-
boxLabel,
|
|
164703
|
+
boxLabel: boxLabel2,
|
|
164466
164704
|
clientThreadId,
|
|
164467
164705
|
idempotencyKey = randomUUID15(),
|
|
164468
164706
|
images,
|
|
@@ -164481,7 +164719,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164481
164719
|
try {
|
|
164482
164720
|
const result = await runUploadAttempt({
|
|
164483
164721
|
alias,
|
|
164484
|
-
boxLabel,
|
|
164722
|
+
boxLabel: boxLabel2,
|
|
164485
164723
|
clientThreadId,
|
|
164486
164724
|
idempotencyKey,
|
|
164487
164725
|
images,
|
|
@@ -164506,7 +164744,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164506
164744
|
}
|
|
164507
164745
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
164508
164746
|
return throwAttachmentError({
|
|
164509
|
-
boxLabel,
|
|
164747
|
+
boxLabel: boxLabel2,
|
|
164510
164748
|
code: "capability_unavailable"
|
|
164511
164749
|
});
|
|
164512
164750
|
}
|
|
@@ -164521,14 +164759,14 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164521
164759
|
}
|
|
164522
164760
|
if (isDirectDaemonTransportError(error55)) {
|
|
164523
164761
|
return throwAttachmentError({
|
|
164524
|
-
boxLabel,
|
|
164762
|
+
boxLabel: boxLabel2,
|
|
164525
164763
|
code: error55.transportCode === "request_timeout" ? "upload_timeout" : "transport_lost"
|
|
164526
164764
|
});
|
|
164527
164765
|
}
|
|
164528
164766
|
throw error55;
|
|
164529
164767
|
}
|
|
164530
164768
|
}
|
|
164531
|
-
return throwAttachmentError({ boxLabel, code: "transport_lost" });
|
|
164769
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "transport_lost" });
|
|
164532
164770
|
};
|
|
164533
164771
|
}
|
|
164534
164772
|
});
|
|
@@ -164544,16 +164782,16 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164544
164782
|
init_nativeAgentImageIntake();
|
|
164545
164783
|
init_nativeAgentImageUpload();
|
|
164546
164784
|
failIntake = ({
|
|
164547
|
-
boxLabel,
|
|
164785
|
+
boxLabel: boxLabel2,
|
|
164548
164786
|
code: code2
|
|
164549
164787
|
}) => {
|
|
164550
164788
|
throw new NativeAgentImageUploadError(
|
|
164551
|
-
createNativeAgentAttachmentError({ boxLabel, code: code2 })
|
|
164789
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: code2 })
|
|
164552
164790
|
);
|
|
164553
164791
|
};
|
|
164554
164792
|
transformCodexLocalImages = async ({
|
|
164555
164793
|
alias,
|
|
164556
|
-
boxLabel,
|
|
164794
|
+
boxLabel: boxLabel2,
|
|
164557
164795
|
clientThreadId,
|
|
164558
164796
|
cwd: cwd2,
|
|
164559
164797
|
data,
|
|
@@ -164573,18 +164811,18 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164573
164811
|
path: localPath
|
|
164574
164812
|
});
|
|
164575
164813
|
if (intake.kind === "not_local_image") {
|
|
164576
|
-
return failIntake({ boxLabel, code: "image_read_failed" });
|
|
164814
|
+
return failIntake({ boxLabel: boxLabel2, code: "image_read_failed" });
|
|
164577
164815
|
}
|
|
164578
164816
|
if (intake.kind === "error") {
|
|
164579
|
-
return failIntake({ boxLabel, code: intake.code });
|
|
164817
|
+
return failIntake({ boxLabel: boxLabel2, code: intake.code });
|
|
164580
164818
|
}
|
|
164581
164819
|
images.push(intake.image);
|
|
164582
164820
|
const batchError = validateNativeAgentImageBatch(images);
|
|
164583
|
-
if (batchError) return failIntake({ boxLabel, code: batchError });
|
|
164821
|
+
if (batchError) return failIntake({ boxLabel: boxLabel2, code: batchError });
|
|
164584
164822
|
}
|
|
164585
164823
|
const completed = await upload({
|
|
164586
164824
|
alias,
|
|
164587
|
-
boxLabel,
|
|
164825
|
+
boxLabel: boxLabel2,
|
|
164588
164826
|
clientThreadId,
|
|
164589
164827
|
idempotencyKey: randomUUID16(),
|
|
164590
164828
|
images,
|
|
@@ -164596,7 +164834,7 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164596
164834
|
});
|
|
164597
164835
|
} catch (error55) {
|
|
164598
164836
|
if (error55 instanceof CodexLocalImageFrameError) {
|
|
164599
|
-
return failIntake({ boxLabel, code: "protocol_error" });
|
|
164837
|
+
return failIntake({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164600
164838
|
}
|
|
164601
164839
|
throw error55;
|
|
164602
164840
|
}
|
|
@@ -164631,14 +164869,14 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164631
164869
|
randomId: () => randomUUID17().replace(/-/g, "")
|
|
164632
164870
|
};
|
|
164633
164871
|
normalizeAttachmentError = ({
|
|
164634
|
-
boxLabel,
|
|
164872
|
+
boxLabel: boxLabel2,
|
|
164635
164873
|
error: error55
|
|
164636
164874
|
}) => {
|
|
164637
164875
|
if (isNativeAgentImageUploadError(error55)) {
|
|
164638
164876
|
return error55.attachmentError;
|
|
164639
164877
|
}
|
|
164640
164878
|
return createNativeAgentAttachmentError({
|
|
164641
|
-
boxLabel,
|
|
164879
|
+
boxLabel: boxLabel2,
|
|
164642
164880
|
code: error55 instanceof CodexLocalRendererForwarderError && error55.code === "input_queue_overflow" ? "upload_queue_overflow" : "protocol_error"
|
|
164643
164881
|
});
|
|
164644
164882
|
};
|
|
@@ -164659,7 +164897,7 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164659
164897
|
waitForChildExit = waitForCodexLocalRendererExit;
|
|
164660
164898
|
runCodexRemoteRenderer = async ({
|
|
164661
164899
|
alias,
|
|
164662
|
-
boxLabel,
|
|
164900
|
+
boxLabel: boxLabel2,
|
|
164663
164901
|
primaryInstanceId,
|
|
164664
164902
|
clientThreadId,
|
|
164665
164903
|
threadId: threadId2,
|
|
@@ -164712,10 +164950,10 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164712
164950
|
const rendererCwd = process.cwd();
|
|
164713
164951
|
const forwarder = await createCodexLoopbackForwarder2({
|
|
164714
164952
|
token,
|
|
164715
|
-
attachmentBoxLabel:
|
|
164953
|
+
attachmentBoxLabel: boxLabel2,
|
|
164716
164954
|
transformRendererFrame: async ({ data, signal }) => (await transformCodexLocalImages({
|
|
164717
164955
|
alias,
|
|
164718
|
-
boxLabel,
|
|
164956
|
+
boxLabel: boxLabel2,
|
|
164719
164957
|
clientThreadId,
|
|
164720
164958
|
cwd: rendererCwd,
|
|
164721
164959
|
data,
|
|
@@ -164874,7 +165112,7 @@ var init_codexNewThreadRenderer = __esm({
|
|
|
164874
165112
|
});
|
|
164875
165113
|
runCodexNewThreadRenderer = async ({
|
|
164876
165114
|
alias,
|
|
164877
|
-
boxLabel,
|
|
165115
|
+
boxLabel: boxLabel2,
|
|
164878
165116
|
startupAttemptId,
|
|
164879
165117
|
primaryInstanceId,
|
|
164880
165118
|
targetExecutionInstanceId,
|
|
@@ -164922,10 +165160,10 @@ var init_codexNewThreadRenderer = __esm({
|
|
|
164922
165160
|
const rendererCwd = process.cwd();
|
|
164923
165161
|
const forwarder = await createCodexLoopbackForwarder2({
|
|
164924
165162
|
token,
|
|
164925
|
-
attachmentBoxLabel:
|
|
165163
|
+
attachmentBoxLabel: boxLabel2,
|
|
164926
165164
|
transformRendererFrame: async ({ data, signal }) => (await transformCodexLocalImages({
|
|
164927
165165
|
alias,
|
|
164928
|
-
boxLabel,
|
|
165166
|
+
boxLabel: boxLabel2,
|
|
164929
165167
|
clientThreadId,
|
|
164930
165168
|
cwd: rendererCwd,
|
|
164931
165169
|
data,
|
|
@@ -165606,7 +165844,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165606
165844
|
encodeClaudeRemotePath = (path106) => path106.replace(/[\s'"()\\]/gu, (character) => `\\${character}`);
|
|
165607
165845
|
createClaudeNativeImageInput = ({
|
|
165608
165846
|
alias,
|
|
165609
|
-
boxLabel,
|
|
165847
|
+
boxLabel: boxLabel2,
|
|
165610
165848
|
clientThreadId,
|
|
165611
165849
|
cwd: cwd2,
|
|
165612
165850
|
platform: platform3 = process.platform,
|
|
@@ -165625,12 +165863,12 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165625
165863
|
const batchError = validateNativeAgentImageBatch(images);
|
|
165626
165864
|
if (batchError) {
|
|
165627
165865
|
throw new NativeAgentImageUploadError(
|
|
165628
|
-
createNativeAgentAttachmentError({ boxLabel, code: batchError })
|
|
165866
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: batchError })
|
|
165629
165867
|
);
|
|
165630
165868
|
}
|
|
165631
165869
|
return await dependencies.upload({
|
|
165632
165870
|
alias,
|
|
165633
|
-
boxLabel,
|
|
165871
|
+
boxLabel: boxLabel2,
|
|
165634
165872
|
clientThreadId,
|
|
165635
165873
|
idempotencyKey: randomUUID19(),
|
|
165636
165874
|
images,
|
|
@@ -165647,7 +165885,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165647
165885
|
if (clipboard.code === "image_too_large" || clipboard.code === "invalid_image") {
|
|
165648
165886
|
throw new NativeAgentImageUploadError(
|
|
165649
165887
|
createNativeAgentAttachmentError({
|
|
165650
|
-
boxLabel,
|
|
165888
|
+
boxLabel: boxLabel2,
|
|
165651
165889
|
code: clipboard.code === "image_too_large" ? "image_too_large" : "unsupported_image"
|
|
165652
165890
|
})
|
|
165653
165891
|
);
|
|
@@ -165661,7 +165899,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165661
165899
|
if (intake.kind !== "accepted") {
|
|
165662
165900
|
throw new NativeAgentImageUploadError(
|
|
165663
165901
|
createNativeAgentAttachmentError({
|
|
165664
|
-
boxLabel,
|
|
165902
|
+
boxLabel: boxLabel2,
|
|
165665
165903
|
code: intake.kind === "error" ? intake.code : "unsupported_image"
|
|
165666
165904
|
})
|
|
165667
165905
|
);
|
|
@@ -165674,7 +165912,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165674
165912
|
if (!remote) {
|
|
165675
165913
|
throw new NativeAgentImageUploadError(
|
|
165676
165914
|
createNativeAgentAttachmentError({
|
|
165677
|
-
boxLabel,
|
|
165915
|
+
boxLabel: boxLabel2,
|
|
165678
165916
|
code: "protocol_error"
|
|
165679
165917
|
})
|
|
165680
165918
|
);
|
|
@@ -165715,7 +165953,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165715
165953
|
if (intake.kind === "error") {
|
|
165716
165954
|
throw new NativeAgentImageUploadError(
|
|
165717
165955
|
createNativeAgentAttachmentError({
|
|
165718
|
-
boxLabel,
|
|
165956
|
+
boxLabel: boxLabel2,
|
|
165719
165957
|
code: intake.code
|
|
165720
165958
|
})
|
|
165721
165959
|
);
|
|
@@ -165727,7 +165965,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165727
165965
|
if (batchError) {
|
|
165728
165966
|
throw new NativeAgentImageUploadError(
|
|
165729
165967
|
createNativeAgentAttachmentError({
|
|
165730
|
-
boxLabel,
|
|
165968
|
+
boxLabel: boxLabel2,
|
|
165731
165969
|
code: batchError
|
|
165732
165970
|
})
|
|
165733
165971
|
);
|
|
@@ -165743,7 +165981,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165743
165981
|
if (completed.length !== accepted.length) {
|
|
165744
165982
|
throw new NativeAgentImageUploadError(
|
|
165745
165983
|
createNativeAgentAttachmentError({
|
|
165746
|
-
boxLabel,
|
|
165984
|
+
boxLabel: boxLabel2,
|
|
165747
165985
|
code: "protocol_error"
|
|
165748
165986
|
})
|
|
165749
165987
|
);
|
|
@@ -165796,10 +166034,10 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165796
166034
|
};
|
|
165797
166035
|
};
|
|
165798
166036
|
mapClaudeNativeImageInputError = ({
|
|
165799
|
-
boxLabel,
|
|
166037
|
+
boxLabel: boxLabel2,
|
|
165800
166038
|
error: error55
|
|
165801
166039
|
}) => isNativeAgentImageUploadError(error55) ? error55.attachmentError : createNativeAgentAttachmentError({
|
|
165802
|
-
boxLabel,
|
|
166040
|
+
boxLabel: boxLabel2,
|
|
165803
166041
|
code: "protocol_error"
|
|
165804
166042
|
});
|
|
165805
166043
|
}
|
|
@@ -167367,7 +167605,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167367
167605
|
return sanitized || "Claude thread";
|
|
167368
167606
|
};
|
|
167369
167607
|
formatClaudeTuiSleepScreen = ({
|
|
167370
|
-
boxLabel,
|
|
167608
|
+
boxLabel: boxLabel2,
|
|
167371
167609
|
columns = DEFAULT_TERMINAL_COLUMNS,
|
|
167372
167610
|
detachLabel,
|
|
167373
167611
|
state,
|
|
@@ -167377,7 +167615,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167377
167615
|
const title = cliTruncate(sanitizeThreadTitle(threadTitle2), contentWidth, {
|
|
167378
167616
|
position: "end"
|
|
167379
167617
|
});
|
|
167380
|
-
const primaryLines = state === "sleeping" ? [`${
|
|
167618
|
+
const primaryLines = state === "sleeping" ? [`${boxLabel2} is sleeping.`, "Press any key to wake and reconnect."] : state === "waking" ? [`Waking ${boxLabel2} and reconnecting\u2026`] : state === "reconnecting" ? [`Reconnecting to ${boxLabel2}\u2026`] : ["Couldn't reconnect.", "Press any key to try again."];
|
|
167381
167619
|
return [
|
|
167382
167620
|
CLEAR_AND_HOME_SCREEN,
|
|
167383
167621
|
`${BOLD}${title}${RESET}`,
|
|
@@ -167389,7 +167627,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167389
167627
|
].join("\r\n");
|
|
167390
167628
|
};
|
|
167391
167629
|
renderClaudeTuiSleepScreen = ({
|
|
167392
|
-
boxLabel,
|
|
167630
|
+
boxLabel: boxLabel2,
|
|
167393
167631
|
state,
|
|
167394
167632
|
stderr = process.stderr,
|
|
167395
167633
|
stdout = process.stdout,
|
|
@@ -167399,7 +167637,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167399
167637
|
resetTerminalInputModes({ stderr, stdout });
|
|
167400
167638
|
stdout.write(
|
|
167401
167639
|
formatClaudeTuiSleepScreen({
|
|
167402
|
-
boxLabel,
|
|
167640
|
+
boxLabel: boxLabel2,
|
|
167403
167641
|
...stdout.columns === void 0 ? {} : { columns: stdout.columns },
|
|
167404
167642
|
detachLabel: detachControl.label,
|
|
167405
167643
|
state,
|
|
@@ -167532,7 +167770,7 @@ var init_claudeTui = __esm({
|
|
|
167532
167770
|
};
|
|
167533
167771
|
runClaudeTui = async ({
|
|
167534
167772
|
alias,
|
|
167535
|
-
boxLabel,
|
|
167773
|
+
boxLabel: boxLabel2,
|
|
167536
167774
|
backend,
|
|
167537
167775
|
clientThreadId,
|
|
167538
167776
|
threadId: threadId2,
|
|
@@ -167641,7 +167879,7 @@ var init_claudeTui = __esm({
|
|
|
167641
167879
|
const inputTransformer = createClaudeManagedCommandInput({
|
|
167642
167880
|
downstream: createClaudeNativeImageInput({
|
|
167643
167881
|
alias,
|
|
167644
|
-
boxLabel,
|
|
167882
|
+
boxLabel: boxLabel2,
|
|
167645
167883
|
clientThreadId,
|
|
167646
167884
|
cwd: process.cwd(),
|
|
167647
167885
|
resolveConnectInfo
|
|
@@ -167659,10 +167897,10 @@ var init_claudeTui = __esm({
|
|
|
167659
167897
|
isRawCtrlCChunk,
|
|
167660
167898
|
inputTransformer,
|
|
167661
167899
|
inputQueueOverflowError: createNativeAgentAttachmentError({
|
|
167662
|
-
boxLabel,
|
|
167900
|
+
boxLabel: boxLabel2,
|
|
167663
167901
|
code: "upload_queue_overflow"
|
|
167664
167902
|
}),
|
|
167665
|
-
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel, error: error55 }),
|
|
167903
|
+
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel: boxLabel2, error: error55 }),
|
|
167666
167904
|
onOpen: () => {
|
|
167667
167905
|
if (!readyReported) {
|
|
167668
167906
|
readyReported = true;
|
|
@@ -167693,7 +167931,7 @@ var init_claudeTui = __esm({
|
|
|
167693
167931
|
let screenState = "sleeping";
|
|
167694
167932
|
while (true) {
|
|
167695
167933
|
runtime.renderSleepScreen({
|
|
167696
|
-
boxLabel,
|
|
167934
|
+
boxLabel: boxLabel2,
|
|
167697
167935
|
state: screenState,
|
|
167698
167936
|
threadTitle: threadTitle2
|
|
167699
167937
|
});
|
|
@@ -167701,7 +167939,7 @@ var init_claudeTui = __esm({
|
|
|
167701
167939
|
return { kind: "detached" };
|
|
167702
167940
|
}
|
|
167703
167941
|
runtime.renderSleepScreen({
|
|
167704
|
-
boxLabel,
|
|
167942
|
+
boxLabel: boxLabel2,
|
|
167705
167943
|
state: "waking",
|
|
167706
167944
|
threadTitle: threadTitle2
|
|
167707
167945
|
});
|
|
@@ -167723,7 +167961,7 @@ var init_claudeTui = __esm({
|
|
|
167723
167961
|
}
|
|
167724
167962
|
if (running) {
|
|
167725
167963
|
runtime.renderSleepScreen({
|
|
167726
|
-
boxLabel,
|
|
167964
|
+
boxLabel: boxLabel2,
|
|
167727
167965
|
state: "reconnecting",
|
|
167728
167966
|
threadTitle: threadTitle2
|
|
167729
167967
|
});
|
|
@@ -167765,7 +168003,7 @@ var init_claudeTui = __esm({
|
|
|
167765
168003
|
};
|
|
167766
168004
|
runClaudeEmptyTui = async ({
|
|
167767
168005
|
alias,
|
|
167768
|
-
boxLabel,
|
|
168006
|
+
boxLabel: boxLabel2,
|
|
167769
168007
|
startupAttemptId,
|
|
167770
168008
|
clientThreadId,
|
|
167771
168009
|
plannedClaudeSessionId,
|
|
@@ -167838,7 +168076,7 @@ var init_claudeTui = __esm({
|
|
|
167838
168076
|
let readyPromise = null;
|
|
167839
168077
|
const inputTransformer = createClaudeNativeImageInput({
|
|
167840
168078
|
alias,
|
|
167841
|
-
boxLabel,
|
|
168079
|
+
boxLabel: boxLabel2,
|
|
167842
168080
|
clientThreadId,
|
|
167843
168081
|
cwd: process.cwd(),
|
|
167844
168082
|
resolveConnectInfo
|
|
@@ -167853,10 +168091,10 @@ var init_claudeTui = __esm({
|
|
|
167853
168091
|
isRawCtrlCChunk,
|
|
167854
168092
|
inputTransformer,
|
|
167855
168093
|
inputQueueOverflowError: createNativeAgentAttachmentError({
|
|
167856
|
-
boxLabel,
|
|
168094
|
+
boxLabel: boxLabel2,
|
|
167857
168095
|
code: "upload_queue_overflow"
|
|
167858
168096
|
}),
|
|
167859
|
-
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel, error: error55 }),
|
|
168097
|
+
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel: boxLabel2, error: error55 }),
|
|
167860
168098
|
onOpen: () => {
|
|
167861
168099
|
readyPromise = onReady();
|
|
167862
168100
|
}
|
|
@@ -168386,14 +168624,14 @@ var init_actionPresentation = __esm({
|
|
|
168386
168624
|
if (item.actions.enter.kind !== "view_only") {
|
|
168387
168625
|
throw new Error("Expected a view-only thread action.");
|
|
168388
168626
|
}
|
|
168389
|
-
const
|
|
168627
|
+
const boxLabel2 = item.actions.shell.kind === "shell" ? targetRoleLabel(item.actions.shell.targetRole) : "machine";
|
|
168390
168628
|
switch (item.actions.enter.reason) {
|
|
168391
168629
|
case "draft_thread":
|
|
168392
168630
|
return "Start this draft before opening it in a terminal.";
|
|
168393
168631
|
case "native_identity_missing":
|
|
168394
168632
|
return "This thread can't open in a terminal because it doesn't have a resumable session yet.";
|
|
168395
168633
|
case "native_path_missing":
|
|
168396
|
-
return item.target.backend === "codex" ? `This Codex thread doesn't have a saved session on this ${
|
|
168634
|
+
return item.target.backend === "codex" ? `This Codex thread doesn't have a saved session on this ${boxLabel2}.` : `This Claude thread's saved transcript isn't available on this ${boxLabel2}.`;
|
|
168397
168635
|
case "history_only":
|
|
168398
168636
|
return "This thread is history only. Its saved session is unavailable, so it can't be continued.";
|
|
168399
168637
|
case "empty_state_missing":
|
|
@@ -168404,24 +168642,24 @@ var init_actionPresentation = __esm({
|
|
|
168404
168642
|
};
|
|
168405
168643
|
formatCodexRuntimeViewOnlyReason = ({
|
|
168406
168644
|
reason,
|
|
168407
|
-
boxLabel
|
|
168645
|
+
boxLabel: boxLabel2
|
|
168408
168646
|
}) => {
|
|
168409
168647
|
switch (reason) {
|
|
168410
168648
|
case "native_thread_missing":
|
|
168411
|
-
return `This Codex thread is no longer available on this ${
|
|
168649
|
+
return `This Codex thread is no longer available on this ${boxLabel2}.`;
|
|
168412
168650
|
case "native_thread_ambiguous":
|
|
168413
|
-
return `This Codex thread has more than one saved session on this ${
|
|
168651
|
+
return `This Codex thread has more than one saved session on this ${boxLabel2}, so it wasn't opened.`;
|
|
168414
168652
|
case "native_thread_archived":
|
|
168415
168653
|
return "This Codex thread's saved session is archived and can't open in a terminal.";
|
|
168416
168654
|
case "native_path_mismatch":
|
|
168417
|
-
return `This thread's saved Codex session doesn't match the selected ${
|
|
168655
|
+
return `This thread's saved Codex session doesn't match the selected ${boxLabel2}.`;
|
|
168418
168656
|
case "managed_codex_unavailable":
|
|
168419
|
-
return `Codex isn't ready on this ${
|
|
168657
|
+
return `Codex isn't ready on this ${boxLabel2}. Wake it and try again in a moment.`;
|
|
168420
168658
|
}
|
|
168421
168659
|
};
|
|
168422
168660
|
formatCodexOutcome = ({
|
|
168423
168661
|
outcome,
|
|
168424
|
-
boxLabel
|
|
168662
|
+
boxLabel: boxLabel2
|
|
168425
168663
|
}) => {
|
|
168426
168664
|
switch (outcome.kind) {
|
|
168427
168665
|
case "renderer_exit":
|
|
@@ -168434,7 +168672,7 @@ var init_actionPresentation = __esm({
|
|
|
168434
168672
|
return {
|
|
168435
168673
|
message: formatCodexRuntimeViewOnlyReason({
|
|
168436
168674
|
reason: outcome.reason,
|
|
168437
|
-
boxLabel
|
|
168675
|
+
boxLabel: boxLabel2
|
|
168438
168676
|
}),
|
|
168439
168677
|
tone: "neutral"
|
|
168440
168678
|
};
|
|
@@ -168445,7 +168683,7 @@ var init_actionPresentation = __esm({
|
|
|
168445
168683
|
};
|
|
168446
168684
|
case "disconnected":
|
|
168447
168685
|
return {
|
|
168448
|
-
message: `Codex disconnected from this ${
|
|
168686
|
+
message: `Codex disconnected from this ${boxLabel2}. Press Enter to reconnect.`,
|
|
168449
168687
|
tone: "error"
|
|
168450
168688
|
};
|
|
168451
168689
|
case "attachment_error":
|
|
@@ -168463,13 +168701,13 @@ var init_actionPresentation = __esm({
|
|
|
168463
168701
|
case "channel_exists":
|
|
168464
168702
|
case "open_failed":
|
|
168465
168703
|
return {
|
|
168466
|
-
message: `Codex couldn't open on this ${
|
|
168704
|
+
message: `Codex couldn't open on this ${boxLabel2}. Review the latest status and try again.`,
|
|
168467
168705
|
tone: "error"
|
|
168468
168706
|
};
|
|
168469
168707
|
}
|
|
168470
168708
|
}
|
|
168471
168709
|
};
|
|
168472
|
-
formatClaudeOutcome = (outcome, backend,
|
|
168710
|
+
formatClaudeOutcome = (outcome, backend, boxLabel2) => {
|
|
168473
168711
|
switch (outcome.kind) {
|
|
168474
168712
|
case "detached":
|
|
168475
168713
|
return {
|
|
@@ -168485,12 +168723,12 @@ var init_actionPresentation = __esm({
|
|
|
168485
168723
|
switch (outcome.reason) {
|
|
168486
168724
|
case "native_thread_missing":
|
|
168487
168725
|
return {
|
|
168488
|
-
message: `This Claude thread is no longer available on this ${
|
|
168726
|
+
message: `This Claude thread is no longer available on this ${boxLabel2}.`,
|
|
168489
168727
|
tone: "neutral"
|
|
168490
168728
|
};
|
|
168491
168729
|
case "native_path_mismatch":
|
|
168492
168730
|
return {
|
|
168493
|
-
message: `This thread's saved Claude session doesn't match the selected ${
|
|
168731
|
+
message: `This thread's saved Claude session doesn't match the selected ${boxLabel2}.`,
|
|
168494
168732
|
tone: "neutral"
|
|
168495
168733
|
};
|
|
168496
168734
|
case "owner_conflict":
|
|
@@ -168535,7 +168773,7 @@ var init_actionPresentation = __esm({
|
|
|
168535
168773
|
};
|
|
168536
168774
|
case "disconnected":
|
|
168537
168775
|
return {
|
|
168538
|
-
message: `Claude disconnected from this ${
|
|
168776
|
+
message: `Claude disconnected from this ${boxLabel2}. Press Enter to reconnect.`,
|
|
168539
168777
|
tone: "error"
|
|
168540
168778
|
};
|
|
168541
168779
|
case "attachment_error":
|
|
@@ -168543,10 +168781,10 @@ var init_actionPresentation = __esm({
|
|
|
168543
168781
|
}
|
|
168544
168782
|
};
|
|
168545
168783
|
formatMissingServiceUpdate = ({
|
|
168546
|
-
boxLabel,
|
|
168784
|
+
boxLabel: boxLabel2,
|
|
168547
168785
|
subject
|
|
168548
168786
|
}) => ({
|
|
168549
|
-
message: `This ${
|
|
168787
|
+
message: `This ${boxLabel2} needs a boxes.dev service update before ${subject} can open. Wake it and retry in a moment; boxes.dev will update it automatically.`,
|
|
168550
168788
|
tone: "error"
|
|
168551
168789
|
});
|
|
168552
168790
|
}
|
|
@@ -168743,7 +168981,7 @@ var init_agentDirectResume = __esm({
|
|
|
168743
168981
|
executionInstanceId: resolvedThread.executionInstanceId
|
|
168744
168982
|
}
|
|
168745
168983
|
);
|
|
168746
|
-
const
|
|
168984
|
+
const boxLabel2 = resolvedTarget.role === "primary" ? "Template box" : "devbox";
|
|
168747
168985
|
const resolveConnectInfo = dependencies.resolveConnectInfo(getToken);
|
|
168748
168986
|
let markViewedFailed = false;
|
|
168749
168987
|
const onReady = async () => {
|
|
@@ -168766,7 +169004,7 @@ var init_agentDirectResume = __esm({
|
|
|
168766
169004
|
if (backend === "codex") {
|
|
168767
169005
|
const outcome2 = await dependencies.openCodex({
|
|
168768
169006
|
alias: resolvedTarget.alias,
|
|
168769
|
-
boxLabel,
|
|
169007
|
+
boxLabel: boxLabel2,
|
|
168770
169008
|
primaryInstanceId: project.primaryInstanceId,
|
|
168771
169009
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
168772
169010
|
threadId: resolvedThread.backendThreadId,
|
|
@@ -168778,7 +169016,7 @@ var init_agentDirectResume = __esm({
|
|
|
168778
169016
|
suspendTerminal: async (callback) => await callback()
|
|
168779
169017
|
});
|
|
168780
169018
|
reportOutcome({
|
|
168781
|
-
...formatCodexOutcome({ outcome: outcome2, boxLabel }),
|
|
169019
|
+
...formatCodexOutcome({ outcome: outcome2, boxLabel: boxLabel2 }),
|
|
168782
169020
|
markViewedFailed,
|
|
168783
169021
|
dependencies
|
|
168784
169022
|
});
|
|
@@ -168787,7 +169025,7 @@ var init_agentDirectResume = __esm({
|
|
|
168787
169025
|
let confirmation = null;
|
|
168788
169026
|
let outcome = await dependencies.openClaude({
|
|
168789
169027
|
alias: resolvedTarget.alias,
|
|
168790
|
-
boxLabel,
|
|
169028
|
+
boxLabel: boxLabel2,
|
|
168791
169029
|
backend: "claude",
|
|
168792
169030
|
primaryInstanceId: project.primaryInstanceId,
|
|
168793
169031
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
@@ -168812,7 +169050,7 @@ var init_agentDirectResume = __esm({
|
|
|
168812
169050
|
};
|
|
168813
169051
|
outcome = await dependencies.openClaude({
|
|
168814
169052
|
alias: resolvedTarget.alias,
|
|
168815
|
-
boxLabel,
|
|
169053
|
+
boxLabel: boxLabel2,
|
|
168816
169054
|
backend: "claude",
|
|
168817
169055
|
primaryInstanceId: project.primaryInstanceId,
|
|
168818
169056
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
@@ -168833,7 +169071,7 @@ var init_agentDirectResume = __esm({
|
|
|
168833
169071
|
return;
|
|
168834
169072
|
}
|
|
168835
169073
|
reportOutcome({
|
|
168836
|
-
...formatClaudeOutcome(outcome, "claude",
|
|
169074
|
+
...formatClaudeOutcome(outcome, "claude", boxLabel2),
|
|
168837
169075
|
markViewedFailed,
|
|
168838
169076
|
dependencies
|
|
168839
169077
|
});
|
|
@@ -217372,11 +217610,11 @@ var init_peekController = __esm({
|
|
|
217372
217610
|
}
|
|
217373
217611
|
assertPeekContract(binding.contractVersion);
|
|
217374
217612
|
if (binding.status !== "ready") {
|
|
217375
|
-
const
|
|
217613
|
+
const unavailable2 = phaseForUnavailableBinding(binding.status);
|
|
217376
217614
|
active.binding = null;
|
|
217377
217615
|
active.entry = null;
|
|
217378
|
-
active.phase =
|
|
217379
|
-
active.retryable =
|
|
217616
|
+
active.phase = unavailable2.phase;
|
|
217617
|
+
active.retryable = unavailable2.retryable;
|
|
217380
217618
|
active.loadingEarlier = false;
|
|
217381
217619
|
this.onChange();
|
|
217382
217620
|
return;
|
|
@@ -218074,8 +218312,8 @@ var init_composerSettingsFocus = __esm({
|
|
|
218074
218312
|
const index = (Math.max(0, currentIndex) + delta + options.length) % options.length;
|
|
218075
218313
|
return options[index].value;
|
|
218076
218314
|
};
|
|
218077
|
-
matchAgentViewComposerSettingsOption = (context34, segment,
|
|
218078
|
-
const normalized =
|
|
218315
|
+
matchAgentViewComposerSettingsOption = (context34, segment, query2) => {
|
|
218316
|
+
const normalized = query2.trim().toLocaleLowerCase();
|
|
218079
218317
|
if (normalized.length === 0) {
|
|
218080
218318
|
return null;
|
|
218081
218319
|
}
|
|
@@ -218123,8 +218361,8 @@ var init_composerSlashCommands = __esm({
|
|
|
218123
218361
|
];
|
|
218124
218362
|
};
|
|
218125
218363
|
resolveAgentViewComposerSlashTrigger = (text) => /^\/\S*$/u.test(text) ? text.slice(1) : null;
|
|
218126
|
-
matchAgentViewComposerSlashCommands = (commands,
|
|
218127
|
-
const normalized =
|
|
218364
|
+
matchAgentViewComposerSlashCommands = (commands, query2) => {
|
|
218365
|
+
const normalized = query2.trim().toLocaleLowerCase();
|
|
218128
218366
|
if (normalized.length === 0) {
|
|
218129
218367
|
return [...commands];
|
|
218130
218368
|
}
|
|
@@ -220060,13 +220298,13 @@ var init_creationComposerController = __esm({
|
|
|
220060
220298
|
* resets the selection to the first row, the way the reference menu does.
|
|
220061
220299
|
*/
|
|
220062
220300
|
presentSlashMenu(composer, text) {
|
|
220063
|
-
const
|
|
220064
|
-
if (
|
|
220301
|
+
const query2 = resolveAgentViewComposerSlashTrigger(text);
|
|
220302
|
+
if (query2 === null) {
|
|
220065
220303
|
return null;
|
|
220066
220304
|
}
|
|
220067
220305
|
const commands = matchAgentViewComposerSlashCommands(
|
|
220068
220306
|
listAgentViewComposerSlashCommands(this.settingsContext(composer)),
|
|
220069
|
-
|
|
220307
|
+
query2
|
|
220070
220308
|
);
|
|
220071
220309
|
if (commands.length === 0) {
|
|
220072
220310
|
return null;
|
|
@@ -220166,7 +220404,7 @@ var init_creationComposerController = __esm({
|
|
|
220166
220404
|
)
|
|
220167
220405
|
);
|
|
220168
220406
|
}
|
|
220169
|
-
async applySettingsQuery(
|
|
220407
|
+
async applySettingsQuery(query2) {
|
|
220170
220408
|
const composer = this.snapshot.composer;
|
|
220171
220409
|
const focus = composer?.settingsFocus;
|
|
220172
220410
|
if (!composer || !focus || !canEditAgentViewCreationComposer(composer)) {
|
|
@@ -220175,13 +220413,13 @@ var init_creationComposerController = __esm({
|
|
|
220175
220413
|
this.updateSnapshot({
|
|
220176
220414
|
composer: {
|
|
220177
220415
|
...composer,
|
|
220178
|
-
settingsFocus: { segment: focus.segment, query }
|
|
220416
|
+
settingsFocus: { segment: focus.segment, query: query2 }
|
|
220179
220417
|
}
|
|
220180
220418
|
});
|
|
220181
220419
|
const match = matchAgentViewComposerSettingsOption(
|
|
220182
220420
|
this.settingsContext(composer),
|
|
220183
220421
|
focus.segment,
|
|
220184
|
-
|
|
220422
|
+
query2
|
|
220185
220423
|
);
|
|
220186
220424
|
if (match && !match.current) {
|
|
220187
220425
|
await this.applySettingsValue(match.value);
|
|
@@ -221864,10 +222102,10 @@ var init_renameModal = __esm({
|
|
|
221864
222102
|
AGENT_VIEW_THREAD_TITLE_MAX_CODE_POINTS = 120;
|
|
221865
222103
|
createAgentViewRenameModal = ({
|
|
221866
222104
|
target,
|
|
221867
|
-
boxLabel
|
|
222105
|
+
boxLabel: boxLabel2
|
|
221868
222106
|
}) => ({
|
|
221869
222107
|
target,
|
|
221870
|
-
boxLabel,
|
|
222108
|
+
boxLabel: boxLabel2,
|
|
221871
222109
|
// An unnamed devbox starts empty so saving untouched text does not name it
|
|
221872
222110
|
// after its first thread.
|
|
221873
222111
|
editor: createAgentViewTextBuffer(
|
|
@@ -221962,8 +222200,8 @@ var init_threadActionExecutor = __esm({
|
|
|
221962
222200
|
target,
|
|
221963
222201
|
operation
|
|
221964
222202
|
}) => {
|
|
221965
|
-
const
|
|
221966
|
-
await client.mutation(
|
|
222203
|
+
const mutation2 = operation === "archive" ? target.isSecondaryDevboxThread ? archiveAgentViewSecondaryThreadMetadata : archiveAgentViewTemplateThreadMetadata : target.isSecondaryDevboxThread ? unarchiveAgentViewSecondaryThreadMetadata : unarchiveAgentViewTemplateThreadMetadata;
|
|
222204
|
+
await client.mutation(mutation2, {
|
|
221967
222205
|
instanceId: target.primaryInstanceId,
|
|
221968
222206
|
clientThreadId: target.clientThreadId
|
|
221969
222207
|
});
|
|
@@ -222225,7 +222463,7 @@ var init_metadataActionController = __esm({
|
|
|
222225
222463
|
statusTone: "neutral"
|
|
222226
222464
|
});
|
|
222227
222465
|
try {
|
|
222228
|
-
let
|
|
222466
|
+
let boxLabel2 = "Template box";
|
|
222229
222467
|
if (target.renameSubject.kind === "thread" && target.executionInstanceId !== target.primaryInstanceId) {
|
|
222230
222468
|
const resolved = await this.client.query(resolveAgentViewTargetV1, {
|
|
222231
222469
|
primaryInstanceId: target.primaryInstanceId,
|
|
@@ -222236,13 +222474,13 @@ var init_metadataActionController = __esm({
|
|
|
222236
222474
|
"Resolved machine target did not match rename target."
|
|
222237
222475
|
);
|
|
222238
222476
|
}
|
|
222239
|
-
|
|
222477
|
+
boxLabel2 = resolved.target.alias;
|
|
222240
222478
|
}
|
|
222241
222479
|
if (!this.host.isSelectionCurrent(capture)) {
|
|
222242
222480
|
return;
|
|
222243
222481
|
}
|
|
222244
222482
|
this.update({
|
|
222245
|
-
renameModal: createAgentViewRenameModal({ target, boxLabel })
|
|
222483
|
+
renameModal: createAgentViewRenameModal({ target, boxLabel: boxLabel2 })
|
|
222246
222484
|
});
|
|
222247
222485
|
} catch (error55) {
|
|
222248
222486
|
this.update({
|
|
@@ -223198,12 +223436,12 @@ var init_controller = __esm({
|
|
|
223198
223436
|
};
|
|
223199
223437
|
this.emit();
|
|
223200
223438
|
try {
|
|
223201
|
-
const
|
|
223439
|
+
const boxLabel2 = target.executionInstanceId === target.primaryInstanceId ? "Template box" : await this.resolvePreviewDevboxAlias(target);
|
|
223202
223440
|
if (this.stopped || this.snapshot.selectedKey !== target.selectedKey) {
|
|
223203
223441
|
return;
|
|
223204
223442
|
}
|
|
223205
223443
|
this.peekReturnSelectionKey = target.selectedKey;
|
|
223206
|
-
this.peekController.open({ ...target, boxLabel });
|
|
223444
|
+
this.peekController.open({ ...target, boxLabel: boxLabel2 });
|
|
223207
223445
|
} catch {
|
|
223208
223446
|
this.snapshot = {
|
|
223209
223447
|
...this.snapshot,
|
|
@@ -224083,9 +224321,9 @@ var init_controller = __esm({
|
|
|
224083
224321
|
});
|
|
224084
224322
|
} catch (error55) {
|
|
224085
224323
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
224086
|
-
const
|
|
224324
|
+
const boxLabel2 = selected.actions.shell.kind === "shell" && selected.actions.shell.targetRole === "template" ? "Template box" : "devbox";
|
|
224087
224325
|
const presentation = formatMissingServiceUpdate({
|
|
224088
|
-
boxLabel,
|
|
224326
|
+
boxLabel: boxLabel2,
|
|
224089
224327
|
subject: "Claude"
|
|
224090
224328
|
});
|
|
224091
224329
|
nextMessage = presentation.message;
|
|
@@ -224146,7 +224384,7 @@ var init_controller = __esm({
|
|
|
224146
224384
|
if (resolved.target.primaryInstanceId !== action.primaryInstanceId || resolved.target.executionInstanceId !== action.executionInstanceId || resolved.target.computeProvider !== "e2b") {
|
|
224147
224385
|
throw new Error("Resolved machine target did not match the selection.");
|
|
224148
224386
|
}
|
|
224149
|
-
const
|
|
224387
|
+
const boxLabel2 = resolved.target.role === "primary" ? "Template box" : "devbox";
|
|
224150
224388
|
logger2.info("agent_view_native_target_resolved", {
|
|
224151
224389
|
alias: resolved.target.alias,
|
|
224152
224390
|
requestType: "codex_tui_open",
|
|
@@ -224158,7 +224396,7 @@ var init_controller = __esm({
|
|
|
224158
224396
|
});
|
|
224159
224397
|
const outcome = await this.actionDependencies.openCodex?.({
|
|
224160
224398
|
alias: resolved.target.alias,
|
|
224161
|
-
boxLabel,
|
|
224399
|
+
boxLabel: boxLabel2,
|
|
224162
224400
|
primaryInstanceId: action.primaryInstanceId,
|
|
224163
224401
|
clientThreadId: action.clientThreadId,
|
|
224164
224402
|
threadId: action.backendThreadId,
|
|
@@ -224191,7 +224429,7 @@ var init_controller = __esm({
|
|
|
224191
224429
|
if (!outcome) {
|
|
224192
224430
|
throw new Error("Codex renderer action is unavailable.");
|
|
224193
224431
|
}
|
|
224194
|
-
const formatted = formatCodexOutcome({ outcome, boxLabel });
|
|
224432
|
+
const formatted = formatCodexOutcome({ outcome, boxLabel: boxLabel2 });
|
|
224195
224433
|
nextMessage = markViewedFailed ? `${formatted.message} Its unread status could not be updated.` : formatted.message;
|
|
224196
224434
|
nextTone = formatted.tone;
|
|
224197
224435
|
logger2.info("agent_view_codex_renderer_completed", {
|
|
@@ -224202,9 +224440,9 @@ var init_controller = __esm({
|
|
|
224202
224440
|
});
|
|
224203
224441
|
} catch (error55) {
|
|
224204
224442
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
224205
|
-
const
|
|
224443
|
+
const boxLabel2 = selected.actions.shell.kind === "shell" && selected.actions.shell.targetRole === "template" ? "Template box" : "devbox";
|
|
224206
224444
|
const presentation = formatMissingServiceUpdate({
|
|
224207
|
-
boxLabel,
|
|
224445
|
+
boxLabel: boxLabel2,
|
|
224208
224446
|
subject: "this thread"
|
|
224209
224447
|
});
|
|
224210
224448
|
nextMessage = presentation.message;
|
|
@@ -239792,12 +240030,12 @@ var init_gitSigning2 = __esm({
|
|
|
239792
240030
|
"Copying Git signing material requires explicit confirmation."
|
|
239793
240031
|
);
|
|
239794
240032
|
}
|
|
239795
|
-
const
|
|
240033
|
+
const unavailable2 = plan.profiles.find(
|
|
239796
240034
|
(profile) => !profile.copyAvailability.available
|
|
239797
240035
|
);
|
|
239798
|
-
if (
|
|
240036
|
+
if (unavailable2) {
|
|
239799
240037
|
throw new Error(
|
|
239800
|
-
`Git signing profile ${
|
|
240038
|
+
`Git signing profile ${unavailable2.id} cannot be copied: ${unavailable2.copyAvailability.reason}`
|
|
239801
240039
|
);
|
|
239802
240040
|
}
|
|
239803
240041
|
}
|
|
@@ -241446,10 +241684,10 @@ var init_localPrepService = __esm({
|
|
|
241446
241684
|
try {
|
|
241447
241685
|
managedTool = await databaseDumpToolResolver({ command, env: env3 });
|
|
241448
241686
|
} catch (resolverError) {
|
|
241449
|
-
const
|
|
241450
|
-
|
|
241451
|
-
|
|
241452
|
-
throw
|
|
241687
|
+
const unavailable2 = createMissingDatabaseDumpToolError(command);
|
|
241688
|
+
unavailable2.message = toErrorMessage(resolverError);
|
|
241689
|
+
unavailable2.userMessage = toErrorMessage(resolverError);
|
|
241690
|
+
throw unavailable2;
|
|
241453
241691
|
}
|
|
241454
241692
|
if (!managedTool) throw error55;
|
|
241455
241693
|
await executeDatabaseDumpCommand(managedTool.command, args, {
|
|
@@ -249938,11 +250176,11 @@ var init_controlPlane2 = __esm({
|
|
|
249938
250176
|
createAgentInitControlPlaneClient = ({
|
|
249939
250177
|
getToken
|
|
249940
250178
|
}) => {
|
|
249941
|
-
const
|
|
250179
|
+
const query2 = async (reference, request2) => await withConvexClient(
|
|
249942
250180
|
await getToken(),
|
|
249943
250181
|
async (client) => await client.query(reference, request2)
|
|
249944
250182
|
);
|
|
249945
|
-
const
|
|
250183
|
+
const mutation2 = async (reference, request2) => await withConvexClient(
|
|
249946
250184
|
await getToken(),
|
|
249947
250185
|
async (client) => await client.mutation(reference, request2)
|
|
249948
250186
|
);
|
|
@@ -249951,25 +250189,25 @@ var init_controlPlane2 = __esm({
|
|
|
249951
250189
|
async (client) => await client.action(reference, request2)
|
|
249952
250190
|
);
|
|
249953
250191
|
return {
|
|
249954
|
-
preflightDesktopInitProject: (request2) =>
|
|
249955
|
-
upsertDesktopInitRegistryStatus: (request2) =>
|
|
249956
|
-
removeDesktopInitRegistryProject: (request2) =>
|
|
250192
|
+
preflightDesktopInitProject: (request2) => query2(preflightProject, request2),
|
|
250193
|
+
upsertDesktopInitRegistryStatus: (request2) => mutation2(registryUpsert2, request2),
|
|
250194
|
+
removeDesktopInitRegistryProject: (request2) => mutation2(registryRemove, request2),
|
|
249957
250195
|
// Marks the job as agent-driven so the desktop app observes it instead
|
|
249958
250196
|
// of resuming it as its own setup.
|
|
249959
|
-
startOrResumeDesktopInitJob: (request2) =>
|
|
250197
|
+
startOrResumeDesktopInitJob: (request2) => mutation2(startOrResumeJob, { ...request2, startedBy: "agent_init" }),
|
|
249960
250198
|
createDesktopInitUploadSession: (request2) => action(createUploadSession, request2),
|
|
249961
250199
|
refreshDesktopInitMultipartUploadParts: (request2) => action(refreshMultipartUploadParts, request2),
|
|
249962
250200
|
listDesktopInitMultipartUploadedParts: (request2) => action(listMultipartUploadedParts, request2),
|
|
249963
250201
|
completeDesktopInitMultipartUpload: (request2) => action(completeMultipartUpload, request2),
|
|
249964
250202
|
abortDesktopInitMultipartUpload: (request2) => action(abortMultipartUpload, request2),
|
|
249965
|
-
commitDesktopInitUpload: (request2) =>
|
|
249966
|
-
commitDesktopInitDecryptKeyEnvelope: (request2) =>
|
|
249967
|
-
fetchDesktopInitJobProgress: (request2) =>
|
|
249968
|
-
destroyDesktopInitAndStartOver: (request2) =>
|
|
249969
|
-
retryDesktopInitRecoverableFailure: (request2) =>
|
|
249970
|
-
fetchDesktopInitMarkerRepairState: (request2) =>
|
|
249971
|
-
getGithubConnection: (request2) =>
|
|
249972
|
-
startGithubConnection: (request2) =>
|
|
250203
|
+
commitDesktopInitUpload: (request2) => mutation2(commitUpload, request2),
|
|
250204
|
+
commitDesktopInitDecryptKeyEnvelope: (request2) => mutation2(commitDecryptKeyEnvelope, request2),
|
|
250205
|
+
fetchDesktopInitJobProgress: (request2) => query2(getProgress, request2),
|
|
250206
|
+
destroyDesktopInitAndStartOver: (request2) => mutation2(destroyStartOver, request2),
|
|
250207
|
+
retryDesktopInitRecoverableFailure: (request2) => mutation2(retryRecoverableFailure, request2),
|
|
250208
|
+
fetchDesktopInitMarkerRepairState: (request2) => query2(getMarkerRepairState, request2),
|
|
250209
|
+
getGithubConnection: (request2) => query2(getGithubConnection, request2),
|
|
250210
|
+
startGithubConnection: (request2) => mutation2(startGithubConnection, request2),
|
|
249973
250211
|
listGithubRepositories: (request2) => action(listGithubRepositories, request2),
|
|
249974
250212
|
getGithubInstallTarget: async (request2) => withConvexClient(
|
|
249975
250213
|
await getToken(),
|
|
@@ -291594,6 +291832,660 @@ var init_mcp = __esm({
|
|
|
291594
291832
|
}
|
|
291595
291833
|
});
|
|
291596
291834
|
|
|
291835
|
+
// src/devbox/commands/agentPermissionSettings.ts
|
|
291836
|
+
var SWITCHES, FOLDER_ACCESS_LEVELS, AGENT_PERMISSION_SETTINGS, TEMPLATE_BOX_ONLY, agentPermissionAppliesTo, isAgentPermissionSetting, allowedAgentPermissionValues, parseAgentPermissionValue, query, mutation, reads, writes, listViewerInstances3, resolveAgentPermissionTarget, unavailable, onOff, readAgentPermissions, readRows, writeAgentPermission;
|
|
291837
|
+
var init_agentPermissionSettings = __esm({
|
|
291838
|
+
"src/devbox/commands/agentPermissionSettings.ts"() {
|
|
291839
|
+
"use strict";
|
|
291840
|
+
init_server();
|
|
291841
|
+
init_threadInventory();
|
|
291842
|
+
init_errors5();
|
|
291843
|
+
init_projects2();
|
|
291844
|
+
SWITCHES = [
|
|
291845
|
+
"create-devboxes-and-threads",
|
|
291846
|
+
"destroy-created-devboxes",
|
|
291847
|
+
"message-agents",
|
|
291848
|
+
"message-teammates-agents",
|
|
291849
|
+
"destroy-devbox",
|
|
291850
|
+
"create-team-templates",
|
|
291851
|
+
"edit-devbox-lifecycle",
|
|
291852
|
+
"edit-template-maintenance",
|
|
291853
|
+
"update-thread-titles"
|
|
291854
|
+
];
|
|
291855
|
+
FOLDER_ACCESS_LEVELS = ["none", "move", "create"];
|
|
291856
|
+
AGENT_PERMISSION_SETTINGS = [
|
|
291857
|
+
...SWITCHES,
|
|
291858
|
+
"folder-access",
|
|
291859
|
+
"read-threads"
|
|
291860
|
+
];
|
|
291861
|
+
TEMPLATE_BOX_ONLY = /* @__PURE__ */ new Set([
|
|
291862
|
+
"create-team-templates",
|
|
291863
|
+
"edit-devbox-lifecycle",
|
|
291864
|
+
"edit-template-maintenance"
|
|
291865
|
+
]);
|
|
291866
|
+
agentPermissionAppliesTo = (setting, target) => {
|
|
291867
|
+
if (target.kind === "project") return !TEMPLATE_BOX_ONLY.has(setting);
|
|
291868
|
+
if (target.boxKind === "devbox") return !TEMPLATE_BOX_ONLY.has(setting);
|
|
291869
|
+
return setting !== "destroy-devbox";
|
|
291870
|
+
};
|
|
291871
|
+
isAgentPermissionSetting = (value) => AGENT_PERMISSION_SETTINGS.includes(value);
|
|
291872
|
+
allowedAgentPermissionValues = (setting) => setting === "folder-access" ? FOLDER_ACCESS_LEVELS : setting === "read-threads" ? THREAD_READ_LEVELS : ["on", "off"];
|
|
291873
|
+
parseAgentPermissionValue = (setting, raw) => {
|
|
291874
|
+
if (!allowedAgentPermissionValues(setting).includes(raw)) return null;
|
|
291875
|
+
if (setting === "folder-access") {
|
|
291876
|
+
return { permission: setting, value: raw };
|
|
291877
|
+
}
|
|
291878
|
+
if (setting === "read-threads") {
|
|
291879
|
+
return { permission: setting, value: raw };
|
|
291880
|
+
}
|
|
291881
|
+
return { permission: setting, value: raw };
|
|
291882
|
+
};
|
|
291883
|
+
query = (name) => makeFunctionReference(name);
|
|
291884
|
+
mutation = (name) => makeFunctionReference(name);
|
|
291885
|
+
reads = {
|
|
291886
|
+
delegation: query("onboxAgentDelegation:listForViewer"),
|
|
291887
|
+
titleEditing: query(
|
|
291888
|
+
"onboxAgentThreadTitleEditing:listForViewer"
|
|
291889
|
+
),
|
|
291890
|
+
devboxDestruction: query(
|
|
291891
|
+
"onboxAgentDevboxDestruction:listForViewer"
|
|
291892
|
+
),
|
|
291893
|
+
teamTemplateCreation: query(
|
|
291894
|
+
"onboxAgentTeamTemplateCreation:listForViewer"
|
|
291895
|
+
),
|
|
291896
|
+
projectConfiguration: query("onboxAgentProjectConfigurationPermissions:listForViewer"),
|
|
291897
|
+
projectDefaults: query("onboxAgentDelegation:getNewDevboxDefaultsForViewer"),
|
|
291898
|
+
projectDevboxDestruction: query("onboxAgentDevboxDestruction:getProjectDefaultForViewer"),
|
|
291899
|
+
createdDevboxDestruction: query(
|
|
291900
|
+
"onboxAgentCreatedDevboxDestruction:getForViewer"
|
|
291901
|
+
),
|
|
291902
|
+
peerMessaging: query(
|
|
291903
|
+
"onboxAgentPeerMessaging:getForViewer"
|
|
291904
|
+
),
|
|
291905
|
+
teammateMessaging: query(
|
|
291906
|
+
"onboxAgentTeammateMessaging:getForViewer"
|
|
291907
|
+
),
|
|
291908
|
+
threadReads: query(
|
|
291909
|
+
"onboxAgentThreadReadAccess:getForViewer"
|
|
291910
|
+
)
|
|
291911
|
+
};
|
|
291912
|
+
writes = {
|
|
291913
|
+
delegation: mutation(
|
|
291914
|
+
"onboxAgentDelegation:setForViewer"
|
|
291915
|
+
),
|
|
291916
|
+
folderAccess: mutation("onboxAgentDelegation:setFolderAccessForViewer"),
|
|
291917
|
+
delegationDefault: mutation(
|
|
291918
|
+
"onboxAgentDelegation:setNewDevboxDelegationDefaultForViewer"
|
|
291919
|
+
),
|
|
291920
|
+
titleEditingDefault: mutation(
|
|
291921
|
+
"onboxAgentDelegation:setNewDevboxTitleEditingDefaultForViewer"
|
|
291922
|
+
),
|
|
291923
|
+
folderAccessDefault: mutation("onboxAgentDelegation:setNewDevboxFolderAccessDefaultForViewer"),
|
|
291924
|
+
titleEditing: mutation(
|
|
291925
|
+
"onboxAgentThreadTitleEditing:setForViewer"
|
|
291926
|
+
),
|
|
291927
|
+
devboxDestruction: mutation(
|
|
291928
|
+
"onboxAgentDevboxDestruction:setForViewer"
|
|
291929
|
+
),
|
|
291930
|
+
createdDevboxDestruction: mutation(
|
|
291931
|
+
"onboxAgentCreatedDevboxDestruction:setForViewer"
|
|
291932
|
+
),
|
|
291933
|
+
peerMessaging: mutation(
|
|
291934
|
+
"onboxAgentPeerMessaging:setForViewer"
|
|
291935
|
+
),
|
|
291936
|
+
teammateMessaging: mutation(
|
|
291937
|
+
"onboxAgentTeammateMessaging:setForViewer"
|
|
291938
|
+
),
|
|
291939
|
+
teamTemplateCreation: mutation(
|
|
291940
|
+
"onboxAgentTeamTemplateCreation:setForViewer"
|
|
291941
|
+
),
|
|
291942
|
+
projectConfiguration: mutation("onboxAgentProjectConfigurationPermissions:setForViewer"),
|
|
291943
|
+
threadReads: mutation(
|
|
291944
|
+
"onboxAgentThreadReadAccess:setForViewer"
|
|
291945
|
+
)
|
|
291946
|
+
};
|
|
291947
|
+
listViewerInstances3 = query("instances:listForViewer");
|
|
291948
|
+
resolveAgentPermissionTarget = async (client, selector) => {
|
|
291949
|
+
if ("project" in selector) {
|
|
291950
|
+
const project = await loadCliAgentToolProject(client, selector.project);
|
|
291951
|
+
return {
|
|
291952
|
+
kind: "project",
|
|
291953
|
+
primaryInstanceId: project.primaryInstanceId,
|
|
291954
|
+
name: project.projectAlias
|
|
291955
|
+
};
|
|
291956
|
+
}
|
|
291957
|
+
const instances2 = await client.query(listViewerInstances3, {
|
|
291958
|
+
includeHiddenForks: true,
|
|
291959
|
+
view: "devboxes"
|
|
291960
|
+
});
|
|
291961
|
+
const instance = instances2.find((entry) => entry.alias === selector.box) ?? instances2.find((entry) => entry.instanceId === selector.box);
|
|
291962
|
+
if (!instance) {
|
|
291963
|
+
throw new CliAgentToolError({
|
|
291964
|
+
code: "devbox_not_found",
|
|
291965
|
+
message: `No box is named ${JSON.stringify(selector.box)}. Run \`dvb list\` to see your boxes.`
|
|
291966
|
+
});
|
|
291967
|
+
}
|
|
291968
|
+
return {
|
|
291969
|
+
kind: "box",
|
|
291970
|
+
instanceId: instance.instanceId,
|
|
291971
|
+
alias: instance.alias,
|
|
291972
|
+
boxKind: instance.role === "primary" ? "template_box" : "devbox"
|
|
291973
|
+
};
|
|
291974
|
+
};
|
|
291975
|
+
unavailable = (target) => new CliAgentToolError({
|
|
291976
|
+
code: "not_found",
|
|
291977
|
+
message: target.kind === "box" ? `Agent permissions aren't available for ${target.alias}.` : `Agent permissions aren't available for project ${target.name}.`
|
|
291978
|
+
});
|
|
291979
|
+
onOff = (row) => row ? row.enabled ? "on" : "off" : null;
|
|
291980
|
+
readAgentPermissions = async (client, target) => {
|
|
291981
|
+
const rows = await readRows(client, target);
|
|
291982
|
+
if (!rows) throw unavailable(target);
|
|
291983
|
+
return rows.filter((row) => row.value !== null);
|
|
291984
|
+
};
|
|
291985
|
+
readRows = async (client, target) => {
|
|
291986
|
+
if (target.kind === "project") {
|
|
291987
|
+
const instanceId = target.primaryInstanceId;
|
|
291988
|
+
const scoped2 = { instanceId, scope: "project" };
|
|
291989
|
+
const [defaults, devboxDestruction2, created2, peer2, teammate2, threadReads2] = await Promise.all([
|
|
291990
|
+
client.query(reads.projectDefaults, { instanceId }),
|
|
291991
|
+
client.query(reads.projectDevboxDestruction, { instanceId }),
|
|
291992
|
+
client.query(reads.createdDevboxDestruction, scoped2),
|
|
291993
|
+
client.query(reads.peerMessaging, scoped2),
|
|
291994
|
+
client.query(reads.teammateMessaging, scoped2),
|
|
291995
|
+
client.query(reads.threadReads, scoped2)
|
|
291996
|
+
]);
|
|
291997
|
+
if (!defaults) return null;
|
|
291998
|
+
return [
|
|
291999
|
+
{
|
|
292000
|
+
permission: "create-devboxes-and-threads",
|
|
292001
|
+
value: defaults.delegationDefault ? "on" : "off"
|
|
292002
|
+
},
|
|
292003
|
+
{ permission: "destroy-created-devboxes", value: onOff(created2) },
|
|
292004
|
+
{ permission: "message-agents", value: onOff(peer2) },
|
|
292005
|
+
{ permission: "message-teammates-agents", value: onOff(teammate2) },
|
|
292006
|
+
{ permission: "destroy-devbox", value: onOff(devboxDestruction2) },
|
|
292007
|
+
{
|
|
292008
|
+
permission: "update-thread-titles",
|
|
292009
|
+
value: defaults.titleEditingDefault ? "on" : "off"
|
|
292010
|
+
},
|
|
292011
|
+
{ permission: "folder-access", value: defaults.folderAccessDefault },
|
|
292012
|
+
{ permission: "read-threads", value: threadReads2?.access ?? null }
|
|
292013
|
+
];
|
|
292014
|
+
}
|
|
292015
|
+
const instanceIds = { instanceIds: [target.instanceId] };
|
|
292016
|
+
const scoped = { instanceId: target.instanceId, scope: "devbox" };
|
|
292017
|
+
const isTemplateBox = target.boxKind === "template_box";
|
|
292018
|
+
const none = Promise.resolve(null);
|
|
292019
|
+
const [
|
|
292020
|
+
delegation,
|
|
292021
|
+
titleEditing,
|
|
292022
|
+
created,
|
|
292023
|
+
peer,
|
|
292024
|
+
teammate,
|
|
292025
|
+
threadReads,
|
|
292026
|
+
devboxDestruction,
|
|
292027
|
+
teamTemplateCreation,
|
|
292028
|
+
devboxLifecycle,
|
|
292029
|
+
templateMaintenance
|
|
292030
|
+
] = await Promise.all([
|
|
292031
|
+
client.query(reads.delegation, instanceIds),
|
|
292032
|
+
client.query(reads.titleEditing, instanceIds),
|
|
292033
|
+
client.query(reads.createdDevboxDestruction, scoped),
|
|
292034
|
+
client.query(reads.peerMessaging, scoped),
|
|
292035
|
+
client.query(reads.teammateMessaging, scoped),
|
|
292036
|
+
client.query(reads.threadReads, scoped),
|
|
292037
|
+
isTemplateBox ? none : client.query(reads.devboxDestruction, instanceIds),
|
|
292038
|
+
isTemplateBox ? client.query(reads.teamTemplateCreation, instanceIds) : none,
|
|
292039
|
+
isTemplateBox ? client.query(reads.projectConfiguration, {
|
|
292040
|
+
...instanceIds,
|
|
292041
|
+
permission: "devbox_lifecycle"
|
|
292042
|
+
}) : none,
|
|
292043
|
+
isTemplateBox ? client.query(reads.projectConfiguration, {
|
|
292044
|
+
...instanceIds,
|
|
292045
|
+
permission: "template_maintenance"
|
|
292046
|
+
}) : none
|
|
292047
|
+
]);
|
|
292048
|
+
const delegationRow = delegation[0];
|
|
292049
|
+
if (!delegationRow) return null;
|
|
292050
|
+
return [
|
|
292051
|
+
{
|
|
292052
|
+
permission: "create-devboxes-and-threads",
|
|
292053
|
+
value: delegationRow.enabled ? "on" : "off"
|
|
292054
|
+
},
|
|
292055
|
+
{ permission: "destroy-created-devboxes", value: onOff(created) },
|
|
292056
|
+
{ permission: "message-agents", value: onOff(peer) },
|
|
292057
|
+
{ permission: "message-teammates-agents", value: onOff(teammate) },
|
|
292058
|
+
{ permission: "destroy-devbox", value: onOff(devboxDestruction?.[0]) },
|
|
292059
|
+
{
|
|
292060
|
+
permission: "create-team-templates",
|
|
292061
|
+
value: onOff(teamTemplateCreation?.[0])
|
|
292062
|
+
},
|
|
292063
|
+
{ permission: "edit-devbox-lifecycle", value: onOff(devboxLifecycle?.[0]) },
|
|
292064
|
+
{
|
|
292065
|
+
permission: "edit-template-maintenance",
|
|
292066
|
+
value: onOff(templateMaintenance?.[0])
|
|
292067
|
+
},
|
|
292068
|
+
{ permission: "update-thread-titles", value: onOff(titleEditing[0]) },
|
|
292069
|
+
{ permission: "folder-access", value: delegationRow.folderAccess },
|
|
292070
|
+
{ permission: "read-threads", value: threadReads?.access ?? null }
|
|
292071
|
+
];
|
|
292072
|
+
};
|
|
292073
|
+
writeAgentPermission = async (client, target, permission) => {
|
|
292074
|
+
const project = target.kind === "project";
|
|
292075
|
+
const instanceId = project ? target.primaryInstanceId : target.instanceId;
|
|
292076
|
+
const scope = project ? "project" : "devbox";
|
|
292077
|
+
switch (permission.permission) {
|
|
292078
|
+
case "folder-access":
|
|
292079
|
+
await client.mutation(
|
|
292080
|
+
project ? writes.folderAccessDefault : writes.folderAccess,
|
|
292081
|
+
{ instanceId, folderAccess: permission.value }
|
|
292082
|
+
);
|
|
292083
|
+
return;
|
|
292084
|
+
case "read-threads":
|
|
292085
|
+
await client.mutation(writes.threadReads, {
|
|
292086
|
+
instanceId,
|
|
292087
|
+
scope,
|
|
292088
|
+
access: permission.value
|
|
292089
|
+
});
|
|
292090
|
+
return;
|
|
292091
|
+
}
|
|
292092
|
+
const enabled = permission.value === "on";
|
|
292093
|
+
switch (permission.permission) {
|
|
292094
|
+
case "create-devboxes-and-threads":
|
|
292095
|
+
await client.mutation(
|
|
292096
|
+
project ? writes.delegationDefault : writes.delegation,
|
|
292097
|
+
{ instanceId, enabled }
|
|
292098
|
+
);
|
|
292099
|
+
return;
|
|
292100
|
+
case "update-thread-titles":
|
|
292101
|
+
await client.mutation(
|
|
292102
|
+
project ? writes.titleEditingDefault : writes.titleEditing,
|
|
292103
|
+
{ instanceId, enabled }
|
|
292104
|
+
);
|
|
292105
|
+
return;
|
|
292106
|
+
case "destroy-devbox":
|
|
292107
|
+
await client.mutation(writes.devboxDestruction, {
|
|
292108
|
+
instanceId,
|
|
292109
|
+
scope,
|
|
292110
|
+
enabled
|
|
292111
|
+
});
|
|
292112
|
+
return;
|
|
292113
|
+
case "destroy-created-devboxes":
|
|
292114
|
+
await client.mutation(writes.createdDevboxDestruction, {
|
|
292115
|
+
instanceId,
|
|
292116
|
+
scope,
|
|
292117
|
+
enabled
|
|
292118
|
+
});
|
|
292119
|
+
return;
|
|
292120
|
+
case "message-agents":
|
|
292121
|
+
await client.mutation(writes.peerMessaging, {
|
|
292122
|
+
instanceId,
|
|
292123
|
+
scope,
|
|
292124
|
+
enabled
|
|
292125
|
+
});
|
|
292126
|
+
return;
|
|
292127
|
+
case "message-teammates-agents":
|
|
292128
|
+
await client.mutation(writes.teammateMessaging, {
|
|
292129
|
+
instanceId,
|
|
292130
|
+
scope,
|
|
292131
|
+
enabled
|
|
292132
|
+
});
|
|
292133
|
+
return;
|
|
292134
|
+
case "create-team-templates":
|
|
292135
|
+
await client.mutation(writes.teamTemplateCreation, {
|
|
292136
|
+
instanceId,
|
|
292137
|
+
enabled
|
|
292138
|
+
});
|
|
292139
|
+
return;
|
|
292140
|
+
case "edit-devbox-lifecycle":
|
|
292141
|
+
await client.mutation(writes.projectConfiguration, {
|
|
292142
|
+
instanceId,
|
|
292143
|
+
permission: "devbox_lifecycle",
|
|
292144
|
+
enabled
|
|
292145
|
+
});
|
|
292146
|
+
return;
|
|
292147
|
+
case "edit-template-maintenance":
|
|
292148
|
+
await client.mutation(writes.projectConfiguration, {
|
|
292149
|
+
instanceId,
|
|
292150
|
+
permission: "template_maintenance",
|
|
292151
|
+
enabled
|
|
292152
|
+
});
|
|
292153
|
+
return;
|
|
292154
|
+
}
|
|
292155
|
+
};
|
|
292156
|
+
}
|
|
292157
|
+
});
|
|
292158
|
+
|
|
292159
|
+
// src/devbox/commands/agentPermissions.ts
|
|
292160
|
+
var formatChoices, readTargetSelector, parseAgentPermissionsGetArgs, parseAgentPermissionsSetArgs, describeTarget, targetFlag, requireApplicable, renderAgentPermissions, renderAgentPermissionSaved, runAgentPermissionsGetWithDependencies, runAgentPermissionsSetWithDependencies, runAgentPermissionsGet, runAgentPermissionsSet;
|
|
292161
|
+
var init_agentPermissions = __esm({
|
|
292162
|
+
"src/devbox/commands/agentPermissions.ts"() {
|
|
292163
|
+
"use strict";
|
|
292164
|
+
init_args();
|
|
292165
|
+
init_errors4();
|
|
292166
|
+
init_errors5();
|
|
292167
|
+
init_agentPermissionSettings();
|
|
292168
|
+
init_resourceOutput();
|
|
292169
|
+
formatChoices = (values) => values.length === 2 ? `${values[0]} or ${values[1]}` : `${values.slice(0, -1).join(", ")}, or ${values.at(-1)}`;
|
|
292170
|
+
readTargetSelector = (commandPath, flags) => {
|
|
292171
|
+
const box = readStringFlag(flags, "box")?.trim() || null;
|
|
292172
|
+
const project = readStringFlag(flags, "project")?.trim() || null;
|
|
292173
|
+
if (box && project) {
|
|
292174
|
+
throw usageError(
|
|
292175
|
+
commandPath,
|
|
292176
|
+
"Choose either --box or --project, not both."
|
|
292177
|
+
);
|
|
292178
|
+
}
|
|
292179
|
+
if (box) return { box };
|
|
292180
|
+
if (project) return { project };
|
|
292181
|
+
throw usageError(
|
|
292182
|
+
commandPath,
|
|
292183
|
+
"Choose a target with --box <box> or --project <project>."
|
|
292184
|
+
);
|
|
292185
|
+
};
|
|
292186
|
+
parseAgentPermissionsGetArgs = (args) => {
|
|
292187
|
+
const commandPath = ["permissions", "get"];
|
|
292188
|
+
const { flags, positionals } = parseCommandArgs({
|
|
292189
|
+
args,
|
|
292190
|
+
commandPath,
|
|
292191
|
+
flagLabel: "permissions get",
|
|
292192
|
+
boolean: ["json"],
|
|
292193
|
+
string: ["box", "project"]
|
|
292194
|
+
});
|
|
292195
|
+
if (positionals.length > 0) {
|
|
292196
|
+
throw usageError(commandPath, `Unexpected argument: ${positionals[0]}`);
|
|
292197
|
+
}
|
|
292198
|
+
return {
|
|
292199
|
+
target: readTargetSelector(commandPath, flags),
|
|
292200
|
+
json: readBooleanFlag(flags, "json")
|
|
292201
|
+
};
|
|
292202
|
+
};
|
|
292203
|
+
parseAgentPermissionsSetArgs = (args) => {
|
|
292204
|
+
const commandPath = ["permissions", "set"];
|
|
292205
|
+
const { flags, positionals } = parseCommandArgs({
|
|
292206
|
+
args,
|
|
292207
|
+
commandPath,
|
|
292208
|
+
flagLabel: "permissions set",
|
|
292209
|
+
boolean: ["json"],
|
|
292210
|
+
string: ["box", "project"]
|
|
292211
|
+
});
|
|
292212
|
+
const [setting, rawValue, extra] = positionals;
|
|
292213
|
+
if (!setting || !rawValue || extra !== void 0) {
|
|
292214
|
+
throw usageError(
|
|
292215
|
+
commandPath,
|
|
292216
|
+
"Usage: dvb permissions set <permission> <value> (--box <box> | --project <project>)"
|
|
292217
|
+
);
|
|
292218
|
+
}
|
|
292219
|
+
if (!isAgentPermissionSetting(setting)) {
|
|
292220
|
+
throw usageError(
|
|
292221
|
+
commandPath,
|
|
292222
|
+
`Unknown permission: ${setting}. Choose one of: ${AGENT_PERMISSION_SETTINGS.join(", ")}.`
|
|
292223
|
+
);
|
|
292224
|
+
}
|
|
292225
|
+
const value = parseAgentPermissionValue(setting, rawValue);
|
|
292226
|
+
if (!value) {
|
|
292227
|
+
throw usageError(
|
|
292228
|
+
commandPath,
|
|
292229
|
+
`Choose ${formatChoices(allowedAgentPermissionValues(setting))} for ${setting}.`
|
|
292230
|
+
);
|
|
292231
|
+
}
|
|
292232
|
+
return {
|
|
292233
|
+
target: readTargetSelector(commandPath, flags),
|
|
292234
|
+
value,
|
|
292235
|
+
json: readBooleanFlag(flags, "json")
|
|
292236
|
+
};
|
|
292237
|
+
};
|
|
292238
|
+
describeTarget = (target) => target.kind === "project" ? `project ${target.name}` : `${target.boxKind === "template_box" ? "Template box" : "devbox"} ${target.alias}`;
|
|
292239
|
+
targetFlag = (target) => target.kind === "project" ? `--project ${target.name}` : `--box ${target.alias}`;
|
|
292240
|
+
requireApplicable = (value, target) => {
|
|
292241
|
+
if (agentPermissionAppliesTo(value.permission, target)) return;
|
|
292242
|
+
throw new CliAgentToolError({
|
|
292243
|
+
code: "invalid_request",
|
|
292244
|
+
message: value.permission === "destroy-devbox" ? "destroy-devbox isn't available on a Template box." : `${value.permission} is available only on a Template box.`
|
|
292245
|
+
});
|
|
292246
|
+
};
|
|
292247
|
+
renderAgentPermissions = (target, permissions) => {
|
|
292248
|
+
const width = Math.max(
|
|
292249
|
+
...permissions.map((entry) => entry.permission.length)
|
|
292250
|
+
);
|
|
292251
|
+
const heading = target.kind === "project" ? `Agent permissions for project ${target.name}. Devboxes you haven't configured separately use these.` : `Agent permissions on ${describeTarget(target)}:`;
|
|
292252
|
+
return [
|
|
292253
|
+
heading,
|
|
292254
|
+
"",
|
|
292255
|
+
...permissions.map(
|
|
292256
|
+
(entry) => ` ${entry.permission.padEnd(width)} ${entry.value}`
|
|
292257
|
+
),
|
|
292258
|
+
"",
|
|
292259
|
+
`Change one with \`dvb permissions set <permission> <value> ${targetFlag(target)}\`.`
|
|
292260
|
+
].join("\n");
|
|
292261
|
+
};
|
|
292262
|
+
renderAgentPermissionSaved = (target, value) => {
|
|
292263
|
+
const change = value.value === "on" || value.value === "off" ? `Turned ${value.permission} ${value.value}` : `Set ${value.permission} to ${value.value}`;
|
|
292264
|
+
return target.kind === "project" ? `${change} for ${describeTarget(target)}. Devboxes you haven't configured separately will use this setting.` : `${change} for ${describeTarget(target)}.`;
|
|
292265
|
+
};
|
|
292266
|
+
runAgentPermissionsGetWithDependencies = async (args, dependencies) => {
|
|
292267
|
+
const parsed = parseAgentPermissionsGetArgs(args);
|
|
292268
|
+
await runResourceCommand({
|
|
292269
|
+
json: parsed.json,
|
|
292270
|
+
dependencies,
|
|
292271
|
+
load: async ({ client }) => {
|
|
292272
|
+
const target = await resolveAgentPermissionTarget(client, parsed.target);
|
|
292273
|
+
const permissions = await readAgentPermissions(client, target);
|
|
292274
|
+
return { target, permissions };
|
|
292275
|
+
},
|
|
292276
|
+
render: ({ target, permissions }) => renderAgentPermissions(target, permissions)
|
|
292277
|
+
});
|
|
292278
|
+
};
|
|
292279
|
+
runAgentPermissionsSetWithDependencies = async (args, dependencies) => {
|
|
292280
|
+
const parsed = parseAgentPermissionsSetArgs(args);
|
|
292281
|
+
await runResourceCommand({
|
|
292282
|
+
json: parsed.json,
|
|
292283
|
+
dependencies,
|
|
292284
|
+
load: async ({ client }) => {
|
|
292285
|
+
const target = await resolveAgentPermissionTarget(client, parsed.target);
|
|
292286
|
+
requireApplicable(parsed.value, target);
|
|
292287
|
+
await writeAgentPermission(client, target, parsed.value);
|
|
292288
|
+
return { target, permission: parsed.value };
|
|
292289
|
+
},
|
|
292290
|
+
render: ({ target, permission }) => renderAgentPermissionSaved(target, permission)
|
|
292291
|
+
});
|
|
292292
|
+
};
|
|
292293
|
+
runAgentPermissionsGet = async (args) => await runAgentPermissionsGetWithDependencies(
|
|
292294
|
+
args,
|
|
292295
|
+
defaultResourceCommandDependencies
|
|
292296
|
+
);
|
|
292297
|
+
runAgentPermissionsSet = async (args) => await runAgentPermissionsSetWithDependencies(
|
|
292298
|
+
args,
|
|
292299
|
+
defaultResourceCommandDependencies
|
|
292300
|
+
);
|
|
292301
|
+
}
|
|
292302
|
+
});
|
|
292303
|
+
|
|
292304
|
+
// src/devbox/commands/agentPermissionRequests.ts
|
|
292305
|
+
var listPending, respond, boxLabel, describeRequest, formatExpiry, renderPendingPermissionRequests, parseAnswerArgs, findPendingRequest, requireProjectScope, requireDecisionApplied, renderPermissionAnswer, runAnswer, runAgentPermissionRequestsWithDependencies, runAgentPermissionAllowWithDependencies, runAgentPermissionDenyWithDependencies, runAgentPermissionRequests, runAgentPermissionAllow, runAgentPermissionDeny;
|
|
292306
|
+
var init_agentPermissionRequests = __esm({
|
|
292307
|
+
"src/devbox/commands/agentPermissionRequests.ts"() {
|
|
292308
|
+
"use strict";
|
|
292309
|
+
init_server();
|
|
292310
|
+
init_threadInventory();
|
|
292311
|
+
init_args();
|
|
292312
|
+
init_errors4();
|
|
292313
|
+
init_errors5();
|
|
292314
|
+
init_resourceOutput();
|
|
292315
|
+
listPending = makeFunctionReference("onboxAgentPermissionRequestList:listPendingForViewer");
|
|
292316
|
+
respond = makeFunctionReference("onboxAgentPermissionRequests:respondForViewer");
|
|
292317
|
+
boxLabel = (entry) => `${entry.sourceBoxKind === "template_box" ? "Template box" : "devbox"} ${entry.boxAlias}`;
|
|
292318
|
+
describeRequest = (entry) => {
|
|
292319
|
+
const { permission } = entry.request;
|
|
292320
|
+
if (!isOnboxAgentPermission(permission)) {
|
|
292321
|
+
return {
|
|
292322
|
+
question: `An agent is asking for the ${permission} permission.`,
|
|
292323
|
+
scope: "Run `dvb upgrade` to see what this permission will allow. You can still allow or deny it now."
|
|
292324
|
+
};
|
|
292325
|
+
}
|
|
292326
|
+
return buildOnboxAgentPermissionRequestPresentation({
|
|
292327
|
+
permission,
|
|
292328
|
+
sourceBoxKind: entry.sourceBoxKind,
|
|
292329
|
+
projectScopeAvailable: entry.request.projectScopeAvailable,
|
|
292330
|
+
teamTemplateName: entry.request.teamTemplateName
|
|
292331
|
+
});
|
|
292332
|
+
};
|
|
292333
|
+
formatExpiry = (expiresAt, now) => {
|
|
292334
|
+
const minutes = Math.max(1, Math.ceil((expiresAt - now) / 6e4));
|
|
292335
|
+
return `Expires in ${minutes} ${minutes === 1 ? "minute" : "minutes"}.`;
|
|
292336
|
+
};
|
|
292337
|
+
renderPendingPermissionRequests = (entries, now) => {
|
|
292338
|
+
if (entries.length === 0) return "No agents are waiting for permission.";
|
|
292339
|
+
const blocks = entries.map((entry) => {
|
|
292340
|
+
const { question, scope } = describeRequest(entry);
|
|
292341
|
+
const id2 = entry.request.requestId;
|
|
292342
|
+
return [
|
|
292343
|
+
question,
|
|
292344
|
+
` From ${boxLabel(entry)}, thread "${entry.threadTitle}". ${formatExpiry(entry.request.expiresAt, now)}`,
|
|
292345
|
+
` ${scope}`,
|
|
292346
|
+
` dvb permissions allow ${id2}${entry.request.projectScopeAvailable ? " [--project]" : ""}`,
|
|
292347
|
+
` dvb permissions deny ${id2}`
|
|
292348
|
+
].join("\n");
|
|
292349
|
+
});
|
|
292350
|
+
const footer = entries.some((entry) => entry.request.projectScopeAvailable) ? [
|
|
292351
|
+
"Add --project to always allow it for this project. Devboxes you haven't configured separately will also use the permission."
|
|
292352
|
+
] : [];
|
|
292353
|
+
return [
|
|
292354
|
+
entries.length === 1 ? "1 agent is waiting for permission." : `${entries.length} agents are waiting for permission.`,
|
|
292355
|
+
"",
|
|
292356
|
+
blocks.join("\n\n"),
|
|
292357
|
+
...footer.length ? ["", ...footer] : []
|
|
292358
|
+
].join("\n");
|
|
292359
|
+
};
|
|
292360
|
+
parseAnswerArgs = (command, args) => {
|
|
292361
|
+
const commandPath = ["permissions", command];
|
|
292362
|
+
const { flags, positionals } = parseCommandArgs({
|
|
292363
|
+
args,
|
|
292364
|
+
commandPath,
|
|
292365
|
+
flagLabel: `permissions ${command}`,
|
|
292366
|
+
boolean: command === "allow" ? ["json", "project"] : ["json"]
|
|
292367
|
+
});
|
|
292368
|
+
const [rawId, extra] = positionals;
|
|
292369
|
+
if (!rawId || extra !== void 0) {
|
|
292370
|
+
throw usageError(
|
|
292371
|
+
commandPath,
|
|
292372
|
+
command === "allow" ? "Usage: dvb permissions allow <request-id> [--project]" : "Usage: dvb permissions deny <request-id>"
|
|
292373
|
+
);
|
|
292374
|
+
}
|
|
292375
|
+
const requestId2 = normalizeOnboxAgentPermissionRequestId(rawId);
|
|
292376
|
+
if (!requestId2) {
|
|
292377
|
+
throw usageError(
|
|
292378
|
+
commandPath,
|
|
292379
|
+
"Use a request ID from `dvb permissions requests`."
|
|
292380
|
+
);
|
|
292381
|
+
}
|
|
292382
|
+
return {
|
|
292383
|
+
requestId: requestId2,
|
|
292384
|
+
project: command === "allow" && readBooleanFlag(flags, "project"),
|
|
292385
|
+
json: readBooleanFlag(flags, "json")
|
|
292386
|
+
};
|
|
292387
|
+
};
|
|
292388
|
+
findPendingRequest = async (client, requestId2) => {
|
|
292389
|
+
const entries = await client.query(listPending, {});
|
|
292390
|
+
const entry = entries.find(
|
|
292391
|
+
(candidate) => candidate.request.requestId === requestId2
|
|
292392
|
+
);
|
|
292393
|
+
if (!entry) {
|
|
292394
|
+
throw new CliAgentToolError({
|
|
292395
|
+
code: "not_found",
|
|
292396
|
+
message: "No agent is waiting on that request. It may have expired or already been answered. Run `dvb permissions requests` to see pending requests."
|
|
292397
|
+
});
|
|
292398
|
+
}
|
|
292399
|
+
return entry;
|
|
292400
|
+
};
|
|
292401
|
+
requireProjectScope = (entry) => {
|
|
292402
|
+
if (entry.request.projectScopeAvailable) return;
|
|
292403
|
+
const { permission } = entry.request;
|
|
292404
|
+
throw new CliAgentToolError({
|
|
292405
|
+
code: "invalid_request",
|
|
292406
|
+
message: isOnboxAgentPermission(permission) && isOnboxAgentThreadGrantPermission(permission) ? `${permission} can be allowed only for its thread, for 3 hours. Run the command without --project.` : `${permission} can't be allowed for the whole project from this request. Run the command without --project.`
|
|
292407
|
+
});
|
|
292408
|
+
};
|
|
292409
|
+
requireDecisionApplied = (decision, status) => {
|
|
292410
|
+
const applied = decision === "allow" ? "approved" : "denied";
|
|
292411
|
+
if (status === applied) return;
|
|
292412
|
+
throw new CliAgentToolError({
|
|
292413
|
+
code: "invalid_request",
|
|
292414
|
+
message: status === "expired" ? "This request expired before you answered it." : status === "approved" ? "This request was already allowed." : "This request was already denied."
|
|
292415
|
+
});
|
|
292416
|
+
};
|
|
292417
|
+
renderPermissionAnswer = ({
|
|
292418
|
+
decision,
|
|
292419
|
+
scope,
|
|
292420
|
+
entry
|
|
292421
|
+
}) => {
|
|
292422
|
+
const { permission } = entry.request;
|
|
292423
|
+
if (decision === "deny") {
|
|
292424
|
+
return `Denied ${permission} for ${boxLabel(entry)}. Agent permissions didn't change.`;
|
|
292425
|
+
}
|
|
292426
|
+
if (isOnboxAgentPermission(permission) && isOnboxAgentThreadGrantPermission(permission)) {
|
|
292427
|
+
return `Allowed ${permission} for 3 hours in thread "${entry.threadTitle}".`;
|
|
292428
|
+
}
|
|
292429
|
+
return scope === "project" ? `Allowed ${permission} for the project. It will apply to ${boxLabel(entry)} and to devboxes you haven't configured separately.` : `Allowed ${permission} on ${boxLabel(entry)}.`;
|
|
292430
|
+
};
|
|
292431
|
+
runAnswer = async (decision, args, dependencies) => {
|
|
292432
|
+
const parsed = parseAnswerArgs(decision, args);
|
|
292433
|
+
await runResourceCommand({
|
|
292434
|
+
json: parsed.json,
|
|
292435
|
+
dependencies,
|
|
292436
|
+
load: async ({ client }) => {
|
|
292437
|
+
const entry = await findPendingRequest(client, parsed.requestId);
|
|
292438
|
+
if (parsed.project) requireProjectScope(entry);
|
|
292439
|
+
const scope = parsed.project ? "project" : "devbox";
|
|
292440
|
+
const response = await client.mutation(respond, {
|
|
292441
|
+
clientThreadId: entry.clientThreadId,
|
|
292442
|
+
requestId: entry.request.requestId,
|
|
292443
|
+
decision,
|
|
292444
|
+
scope
|
|
292445
|
+
});
|
|
292446
|
+
requireDecisionApplied(decision, response.status);
|
|
292447
|
+
return { decision, scope, status: response.status, entry };
|
|
292448
|
+
},
|
|
292449
|
+
render: renderPermissionAnswer
|
|
292450
|
+
});
|
|
292451
|
+
};
|
|
292452
|
+
runAgentPermissionRequestsWithDependencies = async (args, dependencies, now = Date.now) => {
|
|
292453
|
+
const commandPath = ["permissions", "requests"];
|
|
292454
|
+
const { flags, positionals } = parseCommandArgs({
|
|
292455
|
+
args,
|
|
292456
|
+
commandPath,
|
|
292457
|
+
flagLabel: "permissions requests",
|
|
292458
|
+
boolean: ["json"]
|
|
292459
|
+
});
|
|
292460
|
+
if (positionals.length > 0) {
|
|
292461
|
+
throw usageError(commandPath, `Unexpected argument: ${positionals[0]}`);
|
|
292462
|
+
}
|
|
292463
|
+
await runResourceCommand({
|
|
292464
|
+
json: readBooleanFlag(flags, "json"),
|
|
292465
|
+
dependencies,
|
|
292466
|
+
load: async ({ client }) => ({
|
|
292467
|
+
requests: await client.query(listPending, {})
|
|
292468
|
+
}),
|
|
292469
|
+
render: ({ requests }) => renderPendingPermissionRequests(requests, now())
|
|
292470
|
+
});
|
|
292471
|
+
};
|
|
292472
|
+
runAgentPermissionAllowWithDependencies = async (args, dependencies) => await runAnswer("allow", args, dependencies);
|
|
292473
|
+
runAgentPermissionDenyWithDependencies = async (args, dependencies) => await runAnswer("deny", args, dependencies);
|
|
292474
|
+
runAgentPermissionRequests = async (args) => await runAgentPermissionRequestsWithDependencies(
|
|
292475
|
+
args,
|
|
292476
|
+
defaultResourceCommandDependencies
|
|
292477
|
+
);
|
|
292478
|
+
runAgentPermissionAllow = async (args) => await runAgentPermissionAllowWithDependencies(
|
|
292479
|
+
args,
|
|
292480
|
+
defaultResourceCommandDependencies
|
|
292481
|
+
);
|
|
292482
|
+
runAgentPermissionDeny = async (args) => await runAgentPermissionDenyWithDependencies(
|
|
292483
|
+
args,
|
|
292484
|
+
defaultResourceCommandDependencies
|
|
292485
|
+
);
|
|
292486
|
+
}
|
|
292487
|
+
});
|
|
292488
|
+
|
|
291597
292489
|
// src/devbox/commands/power.ts
|
|
291598
292490
|
var parsePowerArgs, resolveTargetInstance2, resolveRequestedTarget, requireE2bTarget, parseSleepArgs, parseWakeArgs, runSleep, runWake;
|
|
291599
292491
|
var init_power = __esm({
|
|
@@ -295527,6 +296419,244 @@ var init_whoami = __esm({
|
|
|
295527
296419
|
}
|
|
295528
296420
|
});
|
|
295529
296421
|
|
|
296422
|
+
// src/devbox/resourceApi/threadArchive.ts
|
|
296423
|
+
var normalizeArchiveError, setCliAgentToolThreadArchived;
|
|
296424
|
+
var init_threadArchive = __esm({
|
|
296425
|
+
"src/devbox/resourceApi/threadArchive.ts"() {
|
|
296426
|
+
"use strict";
|
|
296427
|
+
init_threadInventory();
|
|
296428
|
+
init_threadActionExecutor();
|
|
296429
|
+
init_directDaemonRuntime();
|
|
296430
|
+
init_devboxOperations();
|
|
296431
|
+
init_errors5();
|
|
296432
|
+
init_queryRefs2();
|
|
296433
|
+
normalizeArchiveError = (error55) => {
|
|
296434
|
+
if (error55 instanceof AgentViewThreadArchiveError) {
|
|
296435
|
+
switch (error55.code) {
|
|
296436
|
+
case "capability_unavailable":
|
|
296437
|
+
return new CliAgentToolError({
|
|
296438
|
+
code: "unsupported_capability",
|
|
296439
|
+
message: "This machine needs a boxes.dev service update before Codex threads can be archived or unarchived.",
|
|
296440
|
+
cause: error55
|
|
296441
|
+
});
|
|
296442
|
+
case "native_thread_not_found":
|
|
296443
|
+
return new CliAgentToolError({
|
|
296444
|
+
code: "thread_not_found",
|
|
296445
|
+
message: "The thread's saved Codex session could not be found.",
|
|
296446
|
+
cause: error55
|
|
296447
|
+
});
|
|
296448
|
+
case "native_thread_materializing":
|
|
296449
|
+
return new CliAgentToolError({
|
|
296450
|
+
code: "thread_busy",
|
|
296451
|
+
message: "This thread is still starting. Try again when it is ready.",
|
|
296452
|
+
retryable: true,
|
|
296453
|
+
cause: error55
|
|
296454
|
+
});
|
|
296455
|
+
case "native_thread_ambiguous":
|
|
296456
|
+
case "native_state_conflict":
|
|
296457
|
+
return new CliAgentToolError({
|
|
296458
|
+
code: "configuration_conflict",
|
|
296459
|
+
message: "The saved Codex session could not be matched to this thread. Review the thread in the desktop or mobile app.",
|
|
296460
|
+
cause: error55
|
|
296461
|
+
});
|
|
296462
|
+
case "native_operation_failed":
|
|
296463
|
+
return new CliAgentToolError({
|
|
296464
|
+
code: "command_failed",
|
|
296465
|
+
message: "The saved Codex session could not be updated. Try again.",
|
|
296466
|
+
cause: error55
|
|
296467
|
+
});
|
|
296468
|
+
}
|
|
296469
|
+
}
|
|
296470
|
+
if (isDirectDaemonTransportError(error55)) {
|
|
296471
|
+
return new CliAgentToolError({
|
|
296472
|
+
code: "daemon_unavailable",
|
|
296473
|
+
message: "Could not reach the machine's boxes.dev service. Try again.",
|
|
296474
|
+
retryable: error55.retryable,
|
|
296475
|
+
cause: error55
|
|
296476
|
+
});
|
|
296477
|
+
}
|
|
296478
|
+
return normalizeConvexResourceError(error55);
|
|
296479
|
+
};
|
|
296480
|
+
setCliAgentToolThreadArchived = async ({
|
|
296481
|
+
context: context34,
|
|
296482
|
+
clientThreadId,
|
|
296483
|
+
archived,
|
|
296484
|
+
requestId: requestId2
|
|
296485
|
+
}, setNativeArchive = setDirectDaemonCodexThreadArchivedState) => {
|
|
296486
|
+
try {
|
|
296487
|
+
const owned = await context34.client.query(getCliAgentToolThreadContextV1, {
|
|
296488
|
+
contractVersion: CLI_AGENT_TOOLS_CONTRACT_VERSION,
|
|
296489
|
+
clientThreadId,
|
|
296490
|
+
requestId: requestId2
|
|
296491
|
+
});
|
|
296492
|
+
const thread = await context34.client.query(getCliAgentToolThreadForProject, {
|
|
296493
|
+
projectAnchorId: owned.thread.primaryInstanceId,
|
|
296494
|
+
clientThreadId
|
|
296495
|
+
});
|
|
296496
|
+
if (thread === null) {
|
|
296497
|
+
throw new CliAgentToolError({
|
|
296498
|
+
code: "thread_not_found",
|
|
296499
|
+
message: "Agent thread not found."
|
|
296500
|
+
});
|
|
296501
|
+
}
|
|
296502
|
+
if (thread.archivedAt !== null === archived) {
|
|
296503
|
+
return { clientThreadId, archived, changed: false };
|
|
296504
|
+
}
|
|
296505
|
+
if (thread.backendThreadId === null || !thread.hasUserMessage) {
|
|
296506
|
+
throw new CliAgentToolError({
|
|
296507
|
+
code: "invalid_request",
|
|
296508
|
+
message: "Only threads that have started can be archived or unarchived."
|
|
296509
|
+
});
|
|
296510
|
+
}
|
|
296511
|
+
if (thread.storageState === "freezing" || thread.storageState === "restoring") {
|
|
296512
|
+
throw new CliAgentToolError({
|
|
296513
|
+
code: "operation_in_progress",
|
|
296514
|
+
message: "This thread is being saved or restored. Try again when it is ready.",
|
|
296515
|
+
retryable: true
|
|
296516
|
+
});
|
|
296517
|
+
}
|
|
296518
|
+
if (thread.storageState !== "hot" || thread.nativeBundleStatus === "missing") {
|
|
296519
|
+
throw new CliAgentToolError({
|
|
296520
|
+
code: "invalid_request",
|
|
296521
|
+
message: "Restore this thread in the desktop or mobile app before unarchiving it. Threads with history only cannot be restored."
|
|
296522
|
+
});
|
|
296523
|
+
}
|
|
296524
|
+
const executionInstanceId = thread.executionInstanceId ?? thread.primaryInstanceId;
|
|
296525
|
+
const isDevbox = executionInstanceId !== thread.primaryInstanceId;
|
|
296526
|
+
if (isDevbox) {
|
|
296527
|
+
const anchor = await context34.client.query(getCliAgentToolThreadAnchor, {
|
|
296528
|
+
instanceId: thread.primaryInstanceId,
|
|
296529
|
+
clientThreadId
|
|
296530
|
+
});
|
|
296531
|
+
if (thread.threadPlacementId !== null || anchor?.clientThreadId === clientThreadId) {
|
|
296532
|
+
throw new CliAgentToolError({
|
|
296533
|
+
code: "invalid_request",
|
|
296534
|
+
message: "A devbox's anchor thread cannot be archived separately. Keep it while the devbox is in use, or destroy and archive the devbox from the desktop app."
|
|
296535
|
+
});
|
|
296536
|
+
}
|
|
296537
|
+
if (anchor === null || anchor.executionInstanceId !== executionInstanceId) {
|
|
296538
|
+
throw new CliAgentToolError({
|
|
296539
|
+
code: "invalid_request",
|
|
296540
|
+
message: "This thread is no longer attached to an available devbox."
|
|
296541
|
+
});
|
|
296542
|
+
}
|
|
296543
|
+
}
|
|
296544
|
+
await runAgentViewArchiveAction({
|
|
296545
|
+
client: context34.client,
|
|
296546
|
+
target: {
|
|
296547
|
+
clientThreadId,
|
|
296548
|
+
primaryInstanceId: thread.primaryInstanceId,
|
|
296549
|
+
executionInstanceId,
|
|
296550
|
+
backend: thread.backend,
|
|
296551
|
+
backendThreadId: thread.backendThreadId,
|
|
296552
|
+
isArchived: thread.archivedAt !== null,
|
|
296553
|
+
storageState: thread.storageState,
|
|
296554
|
+
isSecondaryDevboxThread: isDevbox
|
|
296555
|
+
},
|
|
296556
|
+
setCodexArchivedState: async ({ target, ...args }) => await setNativeArchive({
|
|
296557
|
+
...args,
|
|
296558
|
+
alias: target.alias,
|
|
296559
|
+
provider: target.provider,
|
|
296560
|
+
targetKind: target.targetKind,
|
|
296561
|
+
resolveConnectInfo: async ({ allowWake, ...request2 }) => {
|
|
296562
|
+
return await context34.resolveDaemonConnectInfo({
|
|
296563
|
+
...request2,
|
|
296564
|
+
allowWake: allowWake ?? true
|
|
296565
|
+
});
|
|
296566
|
+
}
|
|
296567
|
+
})
|
|
296568
|
+
});
|
|
296569
|
+
return { clientThreadId, archived, changed: true };
|
|
296570
|
+
} catch (error55) {
|
|
296571
|
+
throw normalizeArchiveError(error55);
|
|
296572
|
+
}
|
|
296573
|
+
};
|
|
296574
|
+
}
|
|
296575
|
+
});
|
|
296576
|
+
|
|
296577
|
+
// src/devbox/commands/threadArchive.ts
|
|
296578
|
+
var parseThreadArchiveArgs, defaultDependencies12, runThreadArchiveWithDependencies, runThreadArchive, runThreadUnarchive;
|
|
296579
|
+
var init_threadArchive2 = __esm({
|
|
296580
|
+
"src/devbox/commands/threadArchive.ts"() {
|
|
296581
|
+
"use strict";
|
|
296582
|
+
init_errors5();
|
|
296583
|
+
init_threadArchive();
|
|
296584
|
+
init_logger3();
|
|
296585
|
+
init_resourceOutput();
|
|
296586
|
+
parseThreadArchiveArgs = (args) => {
|
|
296587
|
+
let clientThreadId = null;
|
|
296588
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
296589
|
+
const argument = args[index];
|
|
296590
|
+
if (argument === "--json") continue;
|
|
296591
|
+
if (argument !== "--thread" && !argument.startsWith("--thread=")) {
|
|
296592
|
+
throw new CliAgentToolError({
|
|
296593
|
+
code: "invalid_request",
|
|
296594
|
+
message: `Unexpected argument: ${argument}`
|
|
296595
|
+
});
|
|
296596
|
+
}
|
|
296597
|
+
if (clientThreadId !== null) {
|
|
296598
|
+
throw new CliAgentToolError({
|
|
296599
|
+
code: "invalid_request",
|
|
296600
|
+
message: "`--thread` may be supplied only once."
|
|
296601
|
+
});
|
|
296602
|
+
}
|
|
296603
|
+
const inline = argument !== "--thread";
|
|
296604
|
+
const value = (inline ? argument.slice("--thread=".length) : args[++index] ?? "").trim();
|
|
296605
|
+
if (!value || value.startsWith("--")) {
|
|
296606
|
+
throw new CliAgentToolError({
|
|
296607
|
+
code: "invalid_request",
|
|
296608
|
+
message: "`--thread` requires a value."
|
|
296609
|
+
});
|
|
296610
|
+
}
|
|
296611
|
+
clientThreadId = value;
|
|
296612
|
+
}
|
|
296613
|
+
if (clientThreadId === null) {
|
|
296614
|
+
throw new CliAgentToolError({
|
|
296615
|
+
code: "invalid_request",
|
|
296616
|
+
message: "`--thread <value>` is required."
|
|
296617
|
+
});
|
|
296618
|
+
}
|
|
296619
|
+
return { clientThreadId, json: args.includes("--json") };
|
|
296620
|
+
};
|
|
296621
|
+
defaultDependencies12 = {
|
|
296622
|
+
...defaultResourceCommandDependencies,
|
|
296623
|
+
setArchived: setCliAgentToolThreadArchived
|
|
296624
|
+
};
|
|
296625
|
+
runThreadArchiveWithDependencies = async (args, archived, dependencies) => {
|
|
296626
|
+
try {
|
|
296627
|
+
const parsed = parseThreadArchiveArgs(args);
|
|
296628
|
+
await runResourceCommand({
|
|
296629
|
+
json: parsed.json,
|
|
296630
|
+
dependencies,
|
|
296631
|
+
load: async (context34, requestId2) => {
|
|
296632
|
+
const result = await dependencies.setArchived({
|
|
296633
|
+
context: context34,
|
|
296634
|
+
clientThreadId: parsed.clientThreadId,
|
|
296635
|
+
archived,
|
|
296636
|
+
requestId: requestId2
|
|
296637
|
+
});
|
|
296638
|
+
logger2.info("cli_thread_archive_completed", {
|
|
296639
|
+
requestId: requestId2,
|
|
296640
|
+
...result,
|
|
296641
|
+
status: "ok"
|
|
296642
|
+
});
|
|
296643
|
+
return result;
|
|
296644
|
+
},
|
|
296645
|
+
render: (data) => `${data.clientThreadId} ${data.archived ? "archived" : "unarchived"}`
|
|
296646
|
+
});
|
|
296647
|
+
} catch (error55) {
|
|
296648
|
+
if (args.includes("--json")) {
|
|
296649
|
+
writeResourceCommandJsonFailure({ dependencies, error: error55 });
|
|
296650
|
+
return;
|
|
296651
|
+
}
|
|
296652
|
+
throw error55;
|
|
296653
|
+
}
|
|
296654
|
+
};
|
|
296655
|
+
runThreadArchive = async (args) => await runThreadArchiveWithDependencies(args, true, defaultDependencies12);
|
|
296656
|
+
runThreadUnarchive = async (args) => await runThreadArchiveWithDependencies(args, false, defaultDependencies12);
|
|
296657
|
+
}
|
|
296658
|
+
});
|
|
296659
|
+
|
|
295530
296660
|
// src/devbox/threadImport/selection.ts
|
|
295531
296661
|
var THREAD_IMPORT_MAX_BATCH_RAW_BYTES, DAY_MS, parseThreadImportSince, lastUpdatedMs, newestFirst, selectThreadsForImport, splitThreadImportBatches;
|
|
295532
296662
|
var init_selection = __esm({
|
|
@@ -297547,6 +298677,8 @@ var init_dispatch = __esm({
|
|
|
297547
298677
|
init_logout();
|
|
297548
298678
|
init_mount();
|
|
297549
298679
|
init_mcp();
|
|
298680
|
+
init_agentPermissions();
|
|
298681
|
+
init_agentPermissionRequests();
|
|
297550
298682
|
init_power();
|
|
297551
298683
|
init_ports3();
|
|
297552
298684
|
init_projects3();
|
|
@@ -297564,6 +298696,7 @@ var init_dispatch = __esm({
|
|
|
297564
298696
|
init_version2();
|
|
297565
298697
|
init_whoami();
|
|
297566
298698
|
init_threads2();
|
|
298699
|
+
init_threadArchive2();
|
|
297567
298700
|
init_threadsImport();
|
|
297568
298701
|
init_threadMutations();
|
|
297569
298702
|
init_threadNotifications();
|
|
@@ -297581,6 +298714,11 @@ var init_dispatch = __esm({
|
|
|
297581
298714
|
["agents", runAgents],
|
|
297582
298715
|
["mcp list", runMcpList],
|
|
297583
298716
|
["mcp authorize", runMcpAuthorize],
|
|
298717
|
+
["permissions get", runAgentPermissionsGet],
|
|
298718
|
+
["permissions set", runAgentPermissionsSet],
|
|
298719
|
+
["permissions requests", runAgentPermissionRequests],
|
|
298720
|
+
["permissions allow", runAgentPermissionAllow],
|
|
298721
|
+
["permissions deny", runAgentPermissionDeny],
|
|
297584
298722
|
["projects list", runProjects],
|
|
297585
298723
|
["projects lifecycle", runProjectLifecycle],
|
|
297586
298724
|
["projects maintenance", runProjectMaintenance],
|
|
@@ -297592,6 +298730,8 @@ var init_dispatch = __esm({
|
|
|
297592
298730
|
["devboxes wake", runDevboxWake],
|
|
297593
298731
|
["devboxes destroy", runDevboxDestroy],
|
|
297594
298732
|
["threads list", runThreads],
|
|
298733
|
+
["threads archive", runThreadArchive],
|
|
298734
|
+
["threads unarchive", runThreadUnarchive],
|
|
297595
298735
|
["threads read", runThreadRead],
|
|
297596
298736
|
["threads start", runThreadStart],
|
|
297597
298737
|
["threads send", runThreadSend],
|
|
@@ -298342,4 +299482,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
298342
299482
|
*)
|
|
298343
299483
|
*/
|
|
298344
299484
|
|
|
298345
|
-
//# debugId=
|
|
299485
|
+
//# debugId=249a0abb-e483-5aa3-b76c-e668263ae2b8
|