@boxes-dev/dvb-runtime 1.0.1076 → 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/agent-init-guides/git-signing.md +10 -3
- package/dist/bin/dvb.mjs +1997 -488
- 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 +48 -0
- package/dist/product-docs/references/desktop-workbench.md +21 -12
- package/dist/product-docs/references/files-git-and-review.md +96 -32
- package/dist/product-docs/references/fork-workflows.md +5 -2
- package/dist/product-docs/references/getting-started.md +3 -1
- package/dist/product-docs/references/index.md +1 -1
- package/dist/product-docs/references/linear.md +3 -3
- package/dist/product-docs/references/mobile.md +14 -10
- package/dist/product-docs/references/onbox-agent-tools.md +119 -11
- package/dist/product-docs/references/project-setup.md +24 -14
- package/dist/product-docs/references/security-and-data.md +1 -1
- package/dist/product-docs/references/slack.md +23 -22
- package/dist/product-docs/references/tailscale.md +2 -2
- package/dist/product-docs/references/team-template.md +33 -17
- package/dist/product-docs/references/template-box-environment.md +1 -1
- package/dist/product-docs/references/threads-and-agents.md +2 -2
- package/dist/product-docs/references/troubleshooting.md +3 -3
- 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";
|
|
@@ -2301,7 +2301,7 @@ var require_websocket = __commonJS({
|
|
|
2301
2301
|
var http11 = __require("http");
|
|
2302
2302
|
var net6 = __require("net");
|
|
2303
2303
|
var tls2 = __require("tls");
|
|
2304
|
-
var { randomBytes: randomBytes15, createHash:
|
|
2304
|
+
var { randomBytes: randomBytes15, createHash: createHash29 } = __require("crypto");
|
|
2305
2305
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
2306
2306
|
var { URL: URL3 } = __require("url");
|
|
2307
2307
|
var PerMessageDeflate3 = require_permessage_deflate();
|
|
@@ -2969,7 +2969,7 @@ var require_websocket = __commonJS({
|
|
|
2969
2969
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
2970
2970
|
return;
|
|
2971
2971
|
}
|
|
2972
|
-
const digest =
|
|
2972
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
2973
2973
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
2974
2974
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
2975
2975
|
return;
|
|
@@ -3338,7 +3338,7 @@ var require_websocket_server = __commonJS({
|
|
|
3338
3338
|
var EventEmitter6 = __require("events");
|
|
3339
3339
|
var http11 = __require("http");
|
|
3340
3340
|
var { Duplex } = __require("stream");
|
|
3341
|
-
var { createHash:
|
|
3341
|
+
var { createHash: createHash29 } = __require("crypto");
|
|
3342
3342
|
var extension3 = require_extension();
|
|
3343
3343
|
var PerMessageDeflate3 = require_permessage_deflate();
|
|
3344
3344
|
var subprotocol3 = require_subprotocol();
|
|
@@ -3645,7 +3645,7 @@ var require_websocket_server = __commonJS({
|
|
|
3645
3645
|
);
|
|
3646
3646
|
}
|
|
3647
3647
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
3648
|
-
const digest =
|
|
3648
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
3649
3649
|
const headers = [
|
|
3650
3650
|
"HTTP/1.1 101 Switching Protocols",
|
|
3651
3651
|
"Upgrade: websocket",
|
|
@@ -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;
|
|
@@ -31770,9 +31770,9 @@ function spanTimeInputToSeconds(input) {
|
|
|
31770
31770
|
}
|
|
31771
31771
|
return timestampInSeconds();
|
|
31772
31772
|
}
|
|
31773
|
-
function ensureTimestampInSeconds(
|
|
31774
|
-
const isMs =
|
|
31775
|
-
return isMs ?
|
|
31773
|
+
function ensureTimestampInSeconds(timestamp2) {
|
|
31774
|
+
const isMs = timestamp2 > 9999999999;
|
|
31775
|
+
return isMs ? timestamp2 / 1e3 : timestamp2;
|
|
31776
31776
|
}
|
|
31777
31777
|
function spanToJSON(span) {
|
|
31778
31778
|
if (spanIsSentrySpan(span)) {
|
|
@@ -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
|
}
|
|
@@ -34676,10 +34676,10 @@ function _INTERNAL_captureLog(beforeLog, currentScope = getCurrentScope(), captu
|
|
|
34676
34676
|
return;
|
|
34677
34677
|
}
|
|
34678
34678
|
const { level, message, attributes: logAttributes = {}, severityNumber } = log3;
|
|
34679
|
-
const
|
|
34680
|
-
const sequenceAttr = getSequenceAttribute(
|
|
34679
|
+
const timestamp2 = timestampInSeconds();
|
|
34680
|
+
const sequenceAttr = getSequenceAttribute(timestamp2);
|
|
34681
34681
|
const serializedLog = {
|
|
34682
|
-
timestamp,
|
|
34682
|
+
timestamp: timestamp2,
|
|
34683
34683
|
level,
|
|
34684
34684
|
body: _removeLoneSurrogates(String(message)),
|
|
34685
34685
|
trace_id: traceContext?.trace_id,
|
|
@@ -35090,11 +35090,11 @@ var init_base = __esm({
|
|
|
35090
35090
|
});
|
|
35091
35091
|
|
|
35092
35092
|
// ../../../../node_modules/@sentry/core/build/esm/utils/clientreport.js
|
|
35093
|
-
function createClientReportEnvelope(discarded_events, dsn,
|
|
35093
|
+
function createClientReportEnvelope(discarded_events, dsn, timestamp2) {
|
|
35094
35094
|
const clientReportItem = [
|
|
35095
35095
|
{ type: "client_report" },
|
|
35096
35096
|
{
|
|
35097
|
-
timestamp:
|
|
35097
|
+
timestamp: timestamp2 || dateTimestampInSeconds(),
|
|
35098
35098
|
discarded_events
|
|
35099
35099
|
}
|
|
35100
35100
|
];
|
|
@@ -36614,8 +36614,8 @@ function addBreadcrumb(breadcrumb, hint) {
|
|
|
36614
36614
|
if (!client) return;
|
|
36615
36615
|
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();
|
|
36616
36616
|
if (maxBreadcrumbs <= 0) return;
|
|
36617
|
-
const
|
|
36618
|
-
const mergedBreadcrumb = { timestamp, ...breadcrumb };
|
|
36617
|
+
const timestamp2 = dateTimestampInSeconds();
|
|
36618
|
+
const mergedBreadcrumb = { timestamp: timestamp2, ...breadcrumb };
|
|
36619
36619
|
const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb;
|
|
36620
36620
|
if (finalBreadcrumb === null) return;
|
|
36621
36621
|
if (client.emit) {
|
|
@@ -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;
|
|
@@ -42696,8 +42696,8 @@ function recordRequestSession(client, {
|
|
|
42696
42696
|
unregisterClientFlushHook();
|
|
42697
42697
|
clientToRequestSessionAggregatesMap.delete(client);
|
|
42698
42698
|
const aggregatePayload = Object.entries(newClientAggregate).map(
|
|
42699
|
-
([
|
|
42700
|
-
started:
|
|
42699
|
+
([timestamp2, value]) => ({
|
|
42700
|
+
started: timestamp2,
|
|
42701
42701
|
exited: value.exited,
|
|
42702
42702
|
errored: value.errored,
|
|
42703
42703
|
crashed: value.crashed
|
|
@@ -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;
|
|
@@ -54382,9 +54382,9 @@ function getSpanOptions(options) {
|
|
|
54382
54382
|
startTime: fixedStartTime
|
|
54383
54383
|
};
|
|
54384
54384
|
}
|
|
54385
|
-
function ensureTimestampInMilliseconds(
|
|
54386
|
-
const isMs =
|
|
54387
|
-
return isMs ?
|
|
54385
|
+
function ensureTimestampInMilliseconds(timestamp2) {
|
|
54386
|
+
const isMs = timestamp2 < 9999999999;
|
|
54387
|
+
return isMs ? timestamp2 * 1e3 : timestamp2;
|
|
54388
54388
|
}
|
|
54389
54389
|
function patchSpanEnd(span) {
|
|
54390
54390
|
const originalEnd = span.end.bind(span);
|
|
@@ -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) => {
|
|
@@ -80585,7 +80585,7 @@ var require_websocket2 = __commonJS({
|
|
|
80585
80585
|
var http11 = __require("http");
|
|
80586
80586
|
var net6 = __require("net");
|
|
80587
80587
|
var tls2 = __require("tls");
|
|
80588
|
-
var { randomBytes: randomBytes15, createHash:
|
|
80588
|
+
var { randomBytes: randomBytes15, createHash: createHash29 } = __require("crypto");
|
|
80589
80589
|
var { Duplex, Readable: Readable3 } = __require("stream");
|
|
80590
80590
|
var { URL: URL3 } = __require("url");
|
|
80591
80591
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
@@ -81253,7 +81253,7 @@ var require_websocket2 = __commonJS({
|
|
|
81253
81253
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
81254
81254
|
return;
|
|
81255
81255
|
}
|
|
81256
|
-
const digest =
|
|
81256
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
81257
81257
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
81258
81258
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
81259
81259
|
return;
|
|
@@ -81622,7 +81622,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
81622
81622
|
var EventEmitter6 = __require("events");
|
|
81623
81623
|
var http11 = __require("http");
|
|
81624
81624
|
var { Duplex } = __require("stream");
|
|
81625
|
-
var { createHash:
|
|
81625
|
+
var { createHash: createHash29 } = __require("crypto");
|
|
81626
81626
|
var extension3 = require_extension2();
|
|
81627
81627
|
var PerMessageDeflate3 = require_permessage_deflate2();
|
|
81628
81628
|
var subprotocol3 = require_subprotocol2();
|
|
@@ -81929,7 +81929,7 @@ var require_websocket_server2 = __commonJS({
|
|
|
81929
81929
|
);
|
|
81930
81930
|
}
|
|
81931
81931
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
81932
|
-
const digest =
|
|
81932
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
81933
81933
|
const headers = [
|
|
81934
81934
|
"HTTP/1.1 101 Switching Protocols",
|
|
81935
81935
|
"Upgrade: websocket",
|
|
@@ -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",
|
|
@@ -85274,14 +85274,14 @@ var init_http_client = __esm({
|
|
|
85274
85274
|
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
85275
85275
|
}
|
|
85276
85276
|
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
85277
|
-
const
|
|
85277
|
+
const timestamp2 = options.timestampPromise ? await options.timestampPromise : void 0;
|
|
85278
85278
|
const body = JSON.stringify({
|
|
85279
85279
|
path: name,
|
|
85280
85280
|
format: "convex_encoded_json",
|
|
85281
85281
|
args,
|
|
85282
|
-
...
|
|
85282
|
+
...timestamp2 ? { ts: timestamp2 } : {}
|
|
85283
85283
|
});
|
|
85284
|
-
const endpoint =
|
|
85284
|
+
const endpoint = timestamp2 ? `${this.address}/api/query_at_ts` : `${this.address}/api/query`;
|
|
85285
85285
|
const response = await localFetch(endpoint, {
|
|
85286
85286
|
...this.fetchOptions,
|
|
85287
85287
|
body,
|
|
@@ -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();
|
|
@@ -88827,7 +88827,7 @@ var init_simple_client_node = __esm({
|
|
|
88827
88827
|
var http11 = __require2("http");
|
|
88828
88828
|
var net6 = __require2("net");
|
|
88829
88829
|
var tls2 = __require2("tls");
|
|
88830
|
-
var { randomBytes: randomBytes15, createHash:
|
|
88830
|
+
var { randomBytes: randomBytes15, createHash: createHash29 } = __require2("crypto");
|
|
88831
88831
|
var { Duplex, Readable: Readable3 } = __require2("stream");
|
|
88832
88832
|
var { URL: URL3 } = __require2("url");
|
|
88833
88833
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
@@ -89484,7 +89484,7 @@ var init_simple_client_node = __esm({
|
|
|
89484
89484
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
89485
89485
|
return;
|
|
89486
89486
|
}
|
|
89487
|
-
const digest =
|
|
89487
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
89488
89488
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
89489
89489
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
89490
89490
|
return;
|
|
@@ -89749,7 +89749,7 @@ var init_simple_client_node = __esm({
|
|
|
89749
89749
|
var EventEmitter6 = __require2("events");
|
|
89750
89750
|
var http11 = __require2("http");
|
|
89751
89751
|
var { Duplex } = __require2("stream");
|
|
89752
|
-
var { createHash:
|
|
89752
|
+
var { createHash: createHash29 } = __require2("crypto");
|
|
89753
89753
|
var extension3 = require_extension3();
|
|
89754
89754
|
var PerMessageDeflate3 = require_permessage_deflate3();
|
|
89755
89755
|
var subprotocol3 = require_subprotocol3();
|
|
@@ -90044,7 +90044,7 @@ var init_simple_client_node = __esm({
|
|
|
90044
90044
|
);
|
|
90045
90045
|
}
|
|
90046
90046
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
90047
|
-
const digest =
|
|
90047
|
+
const digest = createHash29("sha1").update(key + GUID).digest("base64");
|
|
90048
90048
|
const headers = [
|
|
90049
90049
|
"HTTP/1.1 101 Switching Protocols",
|
|
90050
90050
|
"Upgrade: websocket",
|
|
@@ -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",
|
|
@@ -98681,13 +98768,42 @@ var init_catalog = __esm({
|
|
|
98681
98768
|
},
|
|
98682
98769
|
{
|
|
98683
98770
|
name: "maintenance",
|
|
98684
|
-
summary: "Inspect
|
|
98771
|
+
summary: "Inspect Template maintenance, run history, and output",
|
|
98685
98772
|
usage: ["dvb projects maintenance <command>"],
|
|
98686
98773
|
notes: [
|
|
98687
98774
|
"Author the maintenance script and GitHub watches together.",
|
|
98688
98775
|
"Use boxes.dev managed environment files for credentials instead of putting secrets in scripts."
|
|
98689
98776
|
],
|
|
98690
98777
|
children: [
|
|
98778
|
+
{
|
|
98779
|
+
name: "runs",
|
|
98780
|
+
summary: "Show active and recent maintenance runs",
|
|
98781
|
+
usage: [
|
|
98782
|
+
"dvb projects maintenance runs [--project <project>] [--json]"
|
|
98783
|
+
],
|
|
98784
|
+
options: [
|
|
98785
|
+
flag("project", "Project name or fingerprint", {
|
|
98786
|
+
valueName: "project"
|
|
98787
|
+
}),
|
|
98788
|
+
flag("json", "Output the versioned JSON envelope")
|
|
98789
|
+
]
|
|
98790
|
+
},
|
|
98791
|
+
{
|
|
98792
|
+
name: "logs",
|
|
98793
|
+
summary: "Show a maintenance run's recorded stdout/stderr tail",
|
|
98794
|
+
usage: [
|
|
98795
|
+
"dvb projects maintenance logs --run <run-id> [--project <project>] [--json]"
|
|
98796
|
+
],
|
|
98797
|
+
options: [
|
|
98798
|
+
flag("run", "Recorded run ID from maintenance runs", {
|
|
98799
|
+
valueName: "run-id"
|
|
98800
|
+
}),
|
|
98801
|
+
flag("project", "Project name or fingerprint", {
|
|
98802
|
+
valueName: "project"
|
|
98803
|
+
}),
|
|
98804
|
+
flag("json", "Output the versioned JSON envelope")
|
|
98805
|
+
]
|
|
98806
|
+
},
|
|
98691
98807
|
{
|
|
98692
98808
|
name: "get",
|
|
98693
98809
|
summary: "Show the maintenance script and GitHub watches",
|
|
@@ -98981,6 +99097,22 @@ var init_catalog = __esm({
|
|
|
98981
99097
|
summary: "Inspect project agent threads",
|
|
98982
99098
|
usage: ["dvb threads <command>"],
|
|
98983
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
|
+
})),
|
|
98984
99116
|
{
|
|
98985
99117
|
name: "list",
|
|
98986
99118
|
summary: "List agent threads using TUI inventory semantics",
|
|
@@ -100037,9 +100169,9 @@ var init_completions = __esm({
|
|
|
100037
100169
|
}
|
|
100038
100170
|
return true;
|
|
100039
100171
|
};
|
|
100040
|
-
isStale = (
|
|
100041
|
-
if (!
|
|
100042
|
-
const parsed = Date.parse(
|
|
100172
|
+
isStale = (timestamp2, ttlMs) => {
|
|
100173
|
+
if (!timestamp2) return true;
|
|
100174
|
+
const parsed = Date.parse(timestamp2);
|
|
100043
100175
|
if (!Number.isFinite(parsed)) return true;
|
|
100044
100176
|
return Date.now() - parsed > ttlMs;
|
|
100045
100177
|
};
|
|
@@ -106366,9 +106498,9 @@ var init_listFormatting = __esm({
|
|
|
106366
106498
|
return parsed.getTime();
|
|
106367
106499
|
};
|
|
106368
106500
|
formatRelativeTime = (value, now = Date.now()) => {
|
|
106369
|
-
const
|
|
106370
|
-
if (
|
|
106371
|
-
const deltaMs = now -
|
|
106501
|
+
const timestamp2 = parseIsoTimestamp(value);
|
|
106502
|
+
if (timestamp2 === null) return { text: "-", isNow: false };
|
|
106503
|
+
const deltaMs = now - timestamp2;
|
|
106372
106504
|
if (deltaMs <= 6e4) return { text: "now", isNow: true };
|
|
106373
106505
|
const minutes = Math.floor(deltaMs / 6e4);
|
|
106374
106506
|
if (minutes < 60) return { text: `${minutes}m`, isNow: false };
|
|
@@ -112743,8 +112875,8 @@ var require_timestamp = __commonJS({
|
|
|
112743
112875
|
function timestampFromDate(date9) {
|
|
112744
112876
|
return timestampFromMs(date9.getTime());
|
|
112745
112877
|
}
|
|
112746
|
-
function timestampDate(
|
|
112747
|
-
return new Date(timestampMs(
|
|
112878
|
+
function timestampDate(timestamp2) {
|
|
112879
|
+
return new Date(timestampMs(timestamp2));
|
|
112748
112880
|
}
|
|
112749
112881
|
function timestampFromMs(timestampMs2) {
|
|
112750
112882
|
const seconds = Math.floor(timestampMs2 / 1e3);
|
|
@@ -112753,8 +112885,8 @@ var require_timestamp = __commonJS({
|
|
|
112753
112885
|
nanos: (timestampMs2 - seconds * 1e3) * 1e6
|
|
112754
112886
|
});
|
|
112755
112887
|
}
|
|
112756
|
-
function timestampMs(
|
|
112757
|
-
return Number(
|
|
112888
|
+
function timestampMs(timestamp2) {
|
|
112889
|
+
return Number(timestamp2.seconds) * 1e3 + Math.round(timestamp2.nanos / 1e6);
|
|
112758
112890
|
}
|
|
112759
112891
|
}
|
|
112760
112892
|
});
|
|
@@ -114650,28 +114782,28 @@ var require_from_json = __commonJS({
|
|
|
114650
114782
|
}
|
|
114651
114783
|
(0, index_js_1.anyPack)(msg.desc, msg.message, any3);
|
|
114652
114784
|
}
|
|
114653
|
-
function timestampFromJson(
|
|
114785
|
+
function timestampFromJson(timestamp2, json3) {
|
|
114654
114786
|
if (typeof json3 !== "string") {
|
|
114655
|
-
throw new Error(`cannot decode message ${
|
|
114787
|
+
throw new Error(`cannot decode message ${timestamp2.$typeName} from JSON: ${(0, reflect_check_js_1.formatVal)(json3)}`);
|
|
114656
114788
|
}
|
|
114657
114789
|
const matches2 = json3.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
|
|
114658
114790
|
if (!matches2) {
|
|
114659
|
-
throw new Error(`cannot decode message ${
|
|
114791
|
+
throw new Error(`cannot decode message ${timestamp2.$typeName} from JSON: invalid RFC 3339 string`);
|
|
114660
114792
|
}
|
|
114661
114793
|
const ms = Date.parse(
|
|
114662
114794
|
// biome-ignore format: want this to read well
|
|
114663
114795
|
matches2[1] + "-" + matches2[2] + "-" + matches2[3] + "T" + matches2[4] + ":" + matches2[5] + ":" + matches2[6] + (matches2[8] ? matches2[8] : "Z")
|
|
114664
114796
|
);
|
|
114665
114797
|
if (Number.isNaN(ms)) {
|
|
114666
|
-
throw new Error(`cannot decode message ${
|
|
114798
|
+
throw new Error(`cannot decode message ${timestamp2.$typeName} from JSON: invalid RFC 3339 string`);
|
|
114667
114799
|
}
|
|
114668
114800
|
if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z")) {
|
|
114669
|
-
throw new Error(`cannot decode message ${
|
|
114801
|
+
throw new Error(`cannot decode message ${timestamp2.$typeName} from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);
|
|
114670
114802
|
}
|
|
114671
|
-
|
|
114672
|
-
|
|
114803
|
+
timestamp2.seconds = proto_int64_js_1.protoInt64.parse(ms / 1e3);
|
|
114804
|
+
timestamp2.nanos = 0;
|
|
114673
114805
|
if (matches2[7]) {
|
|
114674
|
-
|
|
114806
|
+
timestamp2.nanos = parseInt("1" + matches2[7] + "0".repeat(9 - matches2[7].length)) - 1e9;
|
|
114675
114807
|
}
|
|
114676
114808
|
}
|
|
114677
114809
|
function durationFromJson(duration5, json3) {
|
|
@@ -118887,21 +119019,21 @@ var require_get_request = __commonJS({
|
|
|
118887
119019
|
}
|
|
118888
119020
|
}
|
|
118889
119021
|
function transformConnectPostToGetRequest(request2, message, useBase64) {
|
|
118890
|
-
let
|
|
119022
|
+
let query2 = `?connect=v${version_js_1.protocolVersion}`;
|
|
118891
119023
|
const contentType = request2.header.get(headers_js_1.headerContentType);
|
|
118892
119024
|
if ((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(contentTypePrefix)) === 0) {
|
|
118893
|
-
|
|
119025
|
+
query2 += "&encoding=" + encodeURIComponent(contentType.slice(contentTypePrefix.length));
|
|
118894
119026
|
}
|
|
118895
119027
|
const compression = request2.header.get(headers_js_1.headerUnaryEncoding);
|
|
118896
119028
|
if (compression !== null && compression !== "identity") {
|
|
118897
|
-
|
|
119029
|
+
query2 += "&compression=" + encodeURIComponent(compression);
|
|
118898
119030
|
useBase64 = true;
|
|
118899
119031
|
}
|
|
118900
119032
|
if (useBase64) {
|
|
118901
|
-
|
|
119033
|
+
query2 += "&base64=1";
|
|
118902
119034
|
}
|
|
118903
|
-
|
|
118904
|
-
const url3 = request2.url +
|
|
119035
|
+
query2 += "&message=" + encodeMessageForUrl(message, useBase64);
|
|
119036
|
+
const url3 = request2.url + query2;
|
|
118905
119037
|
const header = new Headers(request2.header);
|
|
118906
119038
|
[
|
|
118907
119039
|
headers_js_1.headerProtocolVersion,
|
|
@@ -127230,8 +127362,8 @@ var require_dist3 = __commonJS({
|
|
|
127230
127362
|
const hashArray = new Uint8Array(hashBuffer);
|
|
127231
127363
|
return btoa(String.fromCharCode(...hashArray));
|
|
127232
127364
|
}
|
|
127233
|
-
const { createHash:
|
|
127234
|
-
const hash3 =
|
|
127365
|
+
const { createHash: createHash29 } = __require("crypto");
|
|
127366
|
+
const hash3 = createHash29("sha256").update(data, "utf8").digest();
|
|
127235
127367
|
return hash3.toString("base64");
|
|
127236
127368
|
}
|
|
127237
127369
|
function timeoutToSeconds(timeout) {
|
|
@@ -131294,8 +131426,8 @@ ${err.stdout}`.toLowerCase();
|
|
|
131294
131426
|
Sandbox2.defaultSandboxTimeoutMs = DEFAULT_SANDBOX_TIMEOUT_MS;
|
|
131295
131427
|
var import_chalk6 = __toESM4((init_source(), __toCommonJS(source_exports)));
|
|
131296
131428
|
var LogEntry = class {
|
|
131297
|
-
constructor(
|
|
131298
|
-
this.timestamp =
|
|
131429
|
+
constructor(timestamp2, level, message) {
|
|
131430
|
+
this.timestamp = timestamp2;
|
|
131299
131431
|
this.level = level;
|
|
131300
131432
|
this.message = message;
|
|
131301
131433
|
}
|
|
@@ -131306,13 +131438,13 @@ ${err.stdout}`.toLowerCase();
|
|
|
131306
131438
|
}
|
|
131307
131439
|
};
|
|
131308
131440
|
var LogEntryStart = class extends LogEntry {
|
|
131309
|
-
constructor(
|
|
131310
|
-
super(
|
|
131441
|
+
constructor(timestamp2, message) {
|
|
131442
|
+
super(timestamp2, "debug", message);
|
|
131311
131443
|
}
|
|
131312
131444
|
};
|
|
131313
131445
|
var LogEntryEnd = class extends LogEntry {
|
|
131314
|
-
constructor(
|
|
131315
|
-
super(
|
|
131446
|
+
constructor(timestamp2, message) {
|
|
131447
|
+
super(timestamp2, "debug", message);
|
|
131316
131448
|
}
|
|
131317
131449
|
};
|
|
131318
131450
|
var TIMER_UPDATE_INTERVAL_MS = 150;
|
|
@@ -131371,7 +131503,7 @@ ${err.stdout}`.toLowerCase();
|
|
|
131371
131503
|
}
|
|
131372
131504
|
formatLogLine(line) {
|
|
131373
131505
|
const timer = this.formatTimerLine().padEnd(5);
|
|
131374
|
-
const
|
|
131506
|
+
const timestamp2 = import_chalk6.default.dim(
|
|
131375
131507
|
line.timestamp.toLocaleTimeString(void 0, {
|
|
131376
131508
|
hour: "2-digit",
|
|
131377
131509
|
minute: "2-digit",
|
|
@@ -131380,7 +131512,7 @@ ${err.stdout}`.toLowerCase();
|
|
|
131380
131512
|
);
|
|
131381
131513
|
const level = levels[line.level] || levels[DEFAULT_LEVEL];
|
|
131382
131514
|
const msg = line.message;
|
|
131383
|
-
return `${timer} | ${
|
|
131515
|
+
return `${timer} | ${timestamp2} ${level} ${msg}`;
|
|
131384
131516
|
}
|
|
131385
131517
|
startTimer() {
|
|
131386
131518
|
if (!process.stdout.isTTY) {
|
|
@@ -131408,7 +131540,7 @@ ${err.stdout}`.toLowerCase();
|
|
|
131408
131540
|
const buildLogger = new DefaultBuildLogger(options == null ? void 0 : options.minLevel);
|
|
131409
131541
|
return buildLogger.logger.bind(buildLogger);
|
|
131410
131542
|
}
|
|
131411
|
-
var
|
|
131543
|
+
var import_node_crypto64 = __toESM4(__require("crypto"));
|
|
131412
131544
|
var import_node_fs27 = __toESM4(__require("fs"));
|
|
131413
131545
|
var import_node_path112 = __toESM4(__require("path"));
|
|
131414
131546
|
var FINALIZE_STEP_NAME = "finalize";
|
|
@@ -131496,7 +131628,7 @@ ${err.stdout}`.toLowerCase();
|
|
|
131496
131628
|
}
|
|
131497
131629
|
async function calculateFilesHash(src, dest, contextPath, ignorePatterns, resolveSymlinks, stackTrace) {
|
|
131498
131630
|
const srcPath = import_node_path112.default.join(contextPath, src);
|
|
131499
|
-
const hash3 =
|
|
131631
|
+
const hash3 = import_node_crypto64.default.createHash("sha256");
|
|
131500
131632
|
const content = `COPY ${src} ${dest}`;
|
|
131501
131633
|
hash3.update(content);
|
|
131502
131634
|
const files = await getAllFilesInPath(src, contextPath, ignorePatterns, true);
|
|
@@ -141947,7 +142079,7 @@ var init_threadStartProgress = __esm({
|
|
|
141947
142079
|
case "copying_state":
|
|
141948
142080
|
return {
|
|
141949
142081
|
stage,
|
|
141950
|
-
label: "Copying
|
|
142082
|
+
label: "Copying box state",
|
|
141951
142083
|
currentStep: 2,
|
|
141952
142084
|
totalSteps: TOTAL_STEPS
|
|
141953
142085
|
};
|
|
@@ -142532,6 +142664,164 @@ var init_projectLifecycleMaintenance = __esm({
|
|
|
142532
142664
|
}
|
|
142533
142665
|
});
|
|
142534
142666
|
|
|
142667
|
+
// ../../../../shared/projectConfiguration/maintenanceHistory.ts
|
|
142668
|
+
var timestamp, renderMaintenanceRun, renderMaintenanceRunHistory, renderMaintenanceRunLogs;
|
|
142669
|
+
var init_maintenanceHistory = __esm({
|
|
142670
|
+
"../../../../shared/projectConfiguration/maintenanceHistory.ts"() {
|
|
142671
|
+
"use strict";
|
|
142672
|
+
timestamp = (value) => value === null ? "not recorded" : new Date(value).toISOString();
|
|
142673
|
+
renderMaintenanceRun = (run2) => [
|
|
142674
|
+
`Run: ${run2.publicRunId}`,
|
|
142675
|
+
`Status: ${run2.status}${run2.phase ? ` (${run2.phase})` : ""}`,
|
|
142676
|
+
`Triggers: ${run2.triggerSources.join(", ")}`,
|
|
142677
|
+
`Requested: ${timestamp(run2.requestedAt)}`,
|
|
142678
|
+
`Due: ${timestamp(run2.dueAt)}`,
|
|
142679
|
+
`Started: ${timestamp(run2.startedAt)}`,
|
|
142680
|
+
`Finished: ${timestamp(run2.finishedAt)}`,
|
|
142681
|
+
`Script: ${run2.scriptStatus}; exit code: ${run2.scriptExitCode ?? "not recorded"}`,
|
|
142682
|
+
...run2.failureDetail ? [`Failure: ${run2.failureCode}: ${run2.failureDetail}`] : [],
|
|
142683
|
+
...run2.cleanupDetail ? [`Cleanup: ${run2.cleanupDetail}`] : [],
|
|
142684
|
+
...run2.snapshotDetail ? [`Snapshot: ${run2.snapshotDetail}`] : [],
|
|
142685
|
+
...run2.indeterminate ? ["The final script result is unknown."] : []
|
|
142686
|
+
].join("\n");
|
|
142687
|
+
renderMaintenanceRunHistory = (history) => history.runs.length === 0 ? "No recorded maintenance runs." : history.runs.map(renderMaintenanceRun).join("\n\n");
|
|
142688
|
+
renderMaintenanceRunLogs = (logs) => `${renderMaintenanceRun(logs.run)}
|
|
142689
|
+
|
|
142690
|
+
Combined stdout/stderr tail (up to ${String(logs.outputLimitCharacters)} characters):
|
|
142691
|
+
${logs.outputTail || "(no recorded output)"}`;
|
|
142692
|
+
}
|
|
142693
|
+
});
|
|
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
|
+
|
|
142535
142825
|
// ../../../../shared/threadRuntime/threadInventory.ts
|
|
142536
142826
|
var init_threadInventory = __esm({
|
|
142537
142827
|
"../../../../shared/threadRuntime/threadInventory.ts"() {
|
|
@@ -142557,6 +142847,10 @@ var init_threadInventory = __esm({
|
|
|
142557
142847
|
init_threadListPresentation();
|
|
142558
142848
|
init_threadListWindowData();
|
|
142559
142849
|
init_projectLifecycleMaintenance();
|
|
142850
|
+
init_maintenanceHistory();
|
|
142851
|
+
init_onboxThreadReadAccess();
|
|
142852
|
+
init_onboxAgentPermissionRequestProtocol();
|
|
142853
|
+
init_onboxAgentPermissionRequestPresentation();
|
|
142560
142854
|
}
|
|
142561
142855
|
});
|
|
142562
142856
|
|
|
@@ -142862,6 +143156,7 @@ var init_errors5 = __esm({
|
|
|
142862
143156
|
"watch_removal_confirmation_required",
|
|
142863
143157
|
"github_connection_required",
|
|
142864
143158
|
"github_repository_access_required",
|
|
143159
|
+
"maintenance_run_not_found",
|
|
142865
143160
|
"service_update_required",
|
|
142866
143161
|
"invalid_delivery_policy",
|
|
142867
143162
|
"port_not_eligible",
|
|
@@ -143055,11 +143350,13 @@ var init_projects2 = __esm({
|
|
|
143055
143350
|
});
|
|
143056
143351
|
|
|
143057
143352
|
// src/devbox/resourceApi/queryRefs.ts
|
|
143058
|
-
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;
|
|
143059
143354
|
var init_queryRefs2 = __esm({
|
|
143060
143355
|
"src/devbox/resourceApi/queryRefs.ts"() {
|
|
143061
143356
|
"use strict";
|
|
143062
143357
|
init_server();
|
|
143358
|
+
getCliAgentToolThreadForProject = makeFunctionReference("clientThreads:getForProject");
|
|
143359
|
+
getCliAgentToolThreadAnchor = makeFunctionReference("threadPlacements:getForVisibleThread");
|
|
143063
143360
|
listCliAgentToolProjectExecutionsV1 = makeFunctionReference("cliAgentTools:listProjectExecutionsV1");
|
|
143064
143361
|
createCliAgentToolDevboxV1 = makeFunctionReference("cliAgentTools:createDevboxV1");
|
|
143065
143362
|
getCliAgentToolDevboxOperationV1 = makeFunctionReference("cliAgentTools:getDevboxOperationV1");
|
|
@@ -143806,13 +144103,13 @@ var init_nativeAgentAttachmentError = __esm({
|
|
|
143806
144103
|
"use strict";
|
|
143807
144104
|
createNativeAgentAttachmentError = ({
|
|
143808
144105
|
code: code2,
|
|
143809
|
-
boxLabel
|
|
144106
|
+
boxLabel: boxLabel2
|
|
143810
144107
|
}) => {
|
|
143811
144108
|
switch (code2) {
|
|
143812
144109
|
case "capability_unavailable":
|
|
143813
144110
|
return {
|
|
143814
144111
|
code: code2,
|
|
143815
|
-
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.`
|
|
143816
144113
|
};
|
|
143817
144114
|
case "unsupported_image":
|
|
143818
144115
|
return {
|
|
@@ -143862,12 +144159,12 @@ var init_nativeAgentAttachmentError = __esm({
|
|
|
143862
144159
|
case "remote_storage_full":
|
|
143863
144160
|
return {
|
|
143864
144161
|
code: code2,
|
|
143865
|
-
message: `This ${
|
|
144162
|
+
message: `This ${boxLabel2} doesn't have enough free storage for the image.`
|
|
143866
144163
|
};
|
|
143867
144164
|
case "transport_lost":
|
|
143868
144165
|
return {
|
|
143869
144166
|
code: code2,
|
|
143870
|
-
message: `The image upload disconnected from this ${
|
|
144167
|
+
message: `The image upload disconnected from this ${boxLabel2}. Reopen the thread and try again.`
|
|
143871
144168
|
};
|
|
143872
144169
|
case "checksum_mismatch":
|
|
143873
144170
|
return {
|
|
@@ -164167,11 +164464,11 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164167
164464
|
};
|
|
164168
164465
|
isNativeAgentImageUploadError = (error55) => error55 instanceof NativeAgentImageUploadError;
|
|
164169
164466
|
throwAttachmentError = ({
|
|
164170
|
-
boxLabel,
|
|
164467
|
+
boxLabel: boxLabel2,
|
|
164171
164468
|
code: code2
|
|
164172
164469
|
}) => {
|
|
164173
164470
|
throw new NativeAgentImageUploadError(
|
|
164174
|
-
createNativeAgentAttachmentError({ boxLabel, code: code2 })
|
|
164471
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: code2 })
|
|
164175
164472
|
);
|
|
164176
164473
|
};
|
|
164177
164474
|
mapServerErrorCode = (code2) => {
|
|
@@ -164203,9 +164500,9 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164203
164500
|
}
|
|
164204
164501
|
};
|
|
164205
164502
|
throwServerError = ({
|
|
164206
|
-
boxLabel,
|
|
164503
|
+
boxLabel: boxLabel2,
|
|
164207
164504
|
code: code2
|
|
164208
|
-
}) => throwAttachmentError({ boxLabel, code: mapServerErrorCode(code2) });
|
|
164505
|
+
}) => throwAttachmentError({ boxLabel: boxLabel2, code: mapServerErrorCode(code2) });
|
|
164209
164506
|
metadataForImages = (images) => images.map((image2) => ({
|
|
164210
164507
|
name: image2.name,
|
|
164211
164508
|
mimeType: image2.mimeType,
|
|
@@ -164228,7 +164525,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164228
164525
|
};
|
|
164229
164526
|
runUploadAttempt = async ({
|
|
164230
164527
|
alias,
|
|
164231
|
-
boxLabel,
|
|
164528
|
+
boxLabel: boxLabel2,
|
|
164232
164529
|
clientThreadId,
|
|
164233
164530
|
idempotencyKey,
|
|
164234
164531
|
images,
|
|
@@ -164256,29 +164553,29 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164256
164553
|
});
|
|
164257
164554
|
const start = parseNativeAgentImageUploadResult(startRaw);
|
|
164258
164555
|
if (!start || start.type !== "native_agent_image_batch_start_result_v1") {
|
|
164259
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164556
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164260
164557
|
}
|
|
164261
164558
|
if (start.status === "error") {
|
|
164262
|
-
return throwServerError({ boxLabel, code: start.error.code });
|
|
164559
|
+
return throwServerError({ boxLabel: boxLabel2, code: start.error.code });
|
|
164263
164560
|
}
|
|
164264
164561
|
if (start.status === "completed") {
|
|
164265
164562
|
if (!verifyCompletedImages({ completed: start.images, metadata })) {
|
|
164266
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164563
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164267
164564
|
}
|
|
164268
164565
|
return start.images;
|
|
164269
164566
|
}
|
|
164270
164567
|
if (start.images.length !== images.length) {
|
|
164271
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164568
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164272
164569
|
}
|
|
164273
164570
|
let finished = false;
|
|
164274
164571
|
const queue = new PQueue({ concurrency: 3 });
|
|
164275
164572
|
try {
|
|
164276
|
-
const
|
|
164573
|
+
const writes2 = images.map(
|
|
164277
164574
|
(image2, imageIndex) => queue.add(
|
|
164278
164575
|
async () => {
|
|
164279
164576
|
const remoteImage = start.images[imageIndex];
|
|
164280
164577
|
if (!remoteImage) {
|
|
164281
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164578
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164282
164579
|
}
|
|
164283
164580
|
let partIndex = 0;
|
|
164284
164581
|
let offsetBytes = 0;
|
|
@@ -164324,19 +164621,19 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164324
164621
|
const partResult2 = parseNativeAgentImageUploadResult(partRaw);
|
|
164325
164622
|
if (!partResult2 || partResult2.type !== "native_agent_image_part_write_result_v1") {
|
|
164326
164623
|
return throwAttachmentError({
|
|
164327
|
-
boxLabel,
|
|
164624
|
+
boxLabel: boxLabel2,
|
|
164328
164625
|
code: "protocol_error"
|
|
164329
164626
|
});
|
|
164330
164627
|
}
|
|
164331
164628
|
if (partResult2.status === "error") {
|
|
164332
164629
|
return throwServerError({
|
|
164333
|
-
boxLabel,
|
|
164630
|
+
boxLabel: boxLabel2,
|
|
164334
164631
|
code: partResult2.error.code
|
|
164335
164632
|
});
|
|
164336
164633
|
}
|
|
164337
164634
|
if (partResult2.batchId !== start.batchId || partResult2.imageId !== remoteImage.imageId || partResult2.partIndex !== partIndex || partResult2.offsetBytes !== offsetBytes || partResult2.sizeBytes !== part.byteLength) {
|
|
164338
164635
|
return throwAttachmentError({
|
|
164339
|
-
boxLabel,
|
|
164636
|
+
boxLabel: boxLabel2,
|
|
164340
164637
|
code: "protocol_error"
|
|
164341
164638
|
});
|
|
164342
164639
|
}
|
|
@@ -164347,7 +164644,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164347
164644
|
{ signal }
|
|
164348
164645
|
)
|
|
164349
164646
|
);
|
|
164350
|
-
await Promise.all(
|
|
164647
|
+
await Promise.all(writes2);
|
|
164351
164648
|
const finishRaw = await runControlRequest({
|
|
164352
164649
|
alias,
|
|
164353
164650
|
provider: "e2b",
|
|
@@ -164365,13 +164662,13 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164365
164662
|
});
|
|
164366
164663
|
const finish = parseNativeAgentImageUploadResult(finishRaw);
|
|
164367
164664
|
if (!finish || finish.type !== "native_agent_image_batch_finish_result_v1") {
|
|
164368
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164665
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164369
164666
|
}
|
|
164370
164667
|
if (finish.status === "error") {
|
|
164371
|
-
return throwServerError({ boxLabel, code: finish.error.code });
|
|
164668
|
+
return throwServerError({ boxLabel: boxLabel2, code: finish.error.code });
|
|
164372
164669
|
}
|
|
164373
164670
|
if (finish.batchId !== start.batchId || !verifyCompletedImages({ completed: finish.images, metadata })) {
|
|
164374
|
-
return throwAttachmentError({ boxLabel, code: "protocol_error" });
|
|
164671
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164375
164672
|
}
|
|
164376
164673
|
finished = true;
|
|
164377
164674
|
return finish.images;
|
|
@@ -164403,7 +164700,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164403
164700
|
};
|
|
164404
164701
|
uploadNativeAgentImages = async ({
|
|
164405
164702
|
alias,
|
|
164406
|
-
boxLabel,
|
|
164703
|
+
boxLabel: boxLabel2,
|
|
164407
164704
|
clientThreadId,
|
|
164408
164705
|
idempotencyKey = randomUUID15(),
|
|
164409
164706
|
images,
|
|
@@ -164422,7 +164719,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164422
164719
|
try {
|
|
164423
164720
|
const result = await runUploadAttempt({
|
|
164424
164721
|
alias,
|
|
164425
|
-
boxLabel,
|
|
164722
|
+
boxLabel: boxLabel2,
|
|
164426
164723
|
clientThreadId,
|
|
164427
164724
|
idempotencyKey,
|
|
164428
164725
|
images,
|
|
@@ -164447,7 +164744,7 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164447
164744
|
}
|
|
164448
164745
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
164449
164746
|
return throwAttachmentError({
|
|
164450
|
-
boxLabel,
|
|
164747
|
+
boxLabel: boxLabel2,
|
|
164451
164748
|
code: "capability_unavailable"
|
|
164452
164749
|
});
|
|
164453
164750
|
}
|
|
@@ -164462,14 +164759,14 @@ var init_nativeAgentImageUpload = __esm({
|
|
|
164462
164759
|
}
|
|
164463
164760
|
if (isDirectDaemonTransportError(error55)) {
|
|
164464
164761
|
return throwAttachmentError({
|
|
164465
|
-
boxLabel,
|
|
164762
|
+
boxLabel: boxLabel2,
|
|
164466
164763
|
code: error55.transportCode === "request_timeout" ? "upload_timeout" : "transport_lost"
|
|
164467
164764
|
});
|
|
164468
164765
|
}
|
|
164469
164766
|
throw error55;
|
|
164470
164767
|
}
|
|
164471
164768
|
}
|
|
164472
|
-
return throwAttachmentError({ boxLabel, code: "transport_lost" });
|
|
164769
|
+
return throwAttachmentError({ boxLabel: boxLabel2, code: "transport_lost" });
|
|
164473
164770
|
};
|
|
164474
164771
|
}
|
|
164475
164772
|
});
|
|
@@ -164485,16 +164782,16 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164485
164782
|
init_nativeAgentImageIntake();
|
|
164486
164783
|
init_nativeAgentImageUpload();
|
|
164487
164784
|
failIntake = ({
|
|
164488
|
-
boxLabel,
|
|
164785
|
+
boxLabel: boxLabel2,
|
|
164489
164786
|
code: code2
|
|
164490
164787
|
}) => {
|
|
164491
164788
|
throw new NativeAgentImageUploadError(
|
|
164492
|
-
createNativeAgentAttachmentError({ boxLabel, code: code2 })
|
|
164789
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: code2 })
|
|
164493
164790
|
);
|
|
164494
164791
|
};
|
|
164495
164792
|
transformCodexLocalImages = async ({
|
|
164496
164793
|
alias,
|
|
164497
|
-
boxLabel,
|
|
164794
|
+
boxLabel: boxLabel2,
|
|
164498
164795
|
clientThreadId,
|
|
164499
164796
|
cwd: cwd2,
|
|
164500
164797
|
data,
|
|
@@ -164514,18 +164811,18 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164514
164811
|
path: localPath
|
|
164515
164812
|
});
|
|
164516
164813
|
if (intake.kind === "not_local_image") {
|
|
164517
|
-
return failIntake({ boxLabel, code: "image_read_failed" });
|
|
164814
|
+
return failIntake({ boxLabel: boxLabel2, code: "image_read_failed" });
|
|
164518
164815
|
}
|
|
164519
164816
|
if (intake.kind === "error") {
|
|
164520
|
-
return failIntake({ boxLabel, code: intake.code });
|
|
164817
|
+
return failIntake({ boxLabel: boxLabel2, code: intake.code });
|
|
164521
164818
|
}
|
|
164522
164819
|
images.push(intake.image);
|
|
164523
164820
|
const batchError = validateNativeAgentImageBatch(images);
|
|
164524
|
-
if (batchError) return failIntake({ boxLabel, code: batchError });
|
|
164821
|
+
if (batchError) return failIntake({ boxLabel: boxLabel2, code: batchError });
|
|
164525
164822
|
}
|
|
164526
164823
|
const completed = await upload({
|
|
164527
164824
|
alias,
|
|
164528
|
-
boxLabel,
|
|
164825
|
+
boxLabel: boxLabel2,
|
|
164529
164826
|
clientThreadId,
|
|
164530
164827
|
idempotencyKey: randomUUID16(),
|
|
164531
164828
|
images,
|
|
@@ -164537,7 +164834,7 @@ var init_codexLocalImageTransform = __esm({
|
|
|
164537
164834
|
});
|
|
164538
164835
|
} catch (error55) {
|
|
164539
164836
|
if (error55 instanceof CodexLocalImageFrameError) {
|
|
164540
|
-
return failIntake({ boxLabel, code: "protocol_error" });
|
|
164837
|
+
return failIntake({ boxLabel: boxLabel2, code: "protocol_error" });
|
|
164541
164838
|
}
|
|
164542
164839
|
throw error55;
|
|
164543
164840
|
}
|
|
@@ -164572,14 +164869,14 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164572
164869
|
randomId: () => randomUUID17().replace(/-/g, "")
|
|
164573
164870
|
};
|
|
164574
164871
|
normalizeAttachmentError = ({
|
|
164575
|
-
boxLabel,
|
|
164872
|
+
boxLabel: boxLabel2,
|
|
164576
164873
|
error: error55
|
|
164577
164874
|
}) => {
|
|
164578
164875
|
if (isNativeAgentImageUploadError(error55)) {
|
|
164579
164876
|
return error55.attachmentError;
|
|
164580
164877
|
}
|
|
164581
164878
|
return createNativeAgentAttachmentError({
|
|
164582
|
-
boxLabel,
|
|
164879
|
+
boxLabel: boxLabel2,
|
|
164583
164880
|
code: error55 instanceof CodexLocalRendererForwarderError && error55.code === "input_queue_overflow" ? "upload_queue_overflow" : "protocol_error"
|
|
164584
164881
|
});
|
|
164585
164882
|
};
|
|
@@ -164600,7 +164897,7 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164600
164897
|
waitForChildExit = waitForCodexLocalRendererExit;
|
|
164601
164898
|
runCodexRemoteRenderer = async ({
|
|
164602
164899
|
alias,
|
|
164603
|
-
boxLabel,
|
|
164900
|
+
boxLabel: boxLabel2,
|
|
164604
164901
|
primaryInstanceId,
|
|
164605
164902
|
clientThreadId,
|
|
164606
164903
|
threadId: threadId2,
|
|
@@ -164653,10 +164950,10 @@ var init_codexRemoteRenderer = __esm({
|
|
|
164653
164950
|
const rendererCwd = process.cwd();
|
|
164654
164951
|
const forwarder = await createCodexLoopbackForwarder2({
|
|
164655
164952
|
token,
|
|
164656
|
-
attachmentBoxLabel:
|
|
164953
|
+
attachmentBoxLabel: boxLabel2,
|
|
164657
164954
|
transformRendererFrame: async ({ data, signal }) => (await transformCodexLocalImages({
|
|
164658
164955
|
alias,
|
|
164659
|
-
boxLabel,
|
|
164956
|
+
boxLabel: boxLabel2,
|
|
164660
164957
|
clientThreadId,
|
|
164661
164958
|
cwd: rendererCwd,
|
|
164662
164959
|
data,
|
|
@@ -164815,7 +165112,7 @@ var init_codexNewThreadRenderer = __esm({
|
|
|
164815
165112
|
});
|
|
164816
165113
|
runCodexNewThreadRenderer = async ({
|
|
164817
165114
|
alias,
|
|
164818
|
-
boxLabel,
|
|
165115
|
+
boxLabel: boxLabel2,
|
|
164819
165116
|
startupAttemptId,
|
|
164820
165117
|
primaryInstanceId,
|
|
164821
165118
|
targetExecutionInstanceId,
|
|
@@ -164863,10 +165160,10 @@ var init_codexNewThreadRenderer = __esm({
|
|
|
164863
165160
|
const rendererCwd = process.cwd();
|
|
164864
165161
|
const forwarder = await createCodexLoopbackForwarder2({
|
|
164865
165162
|
token,
|
|
164866
|
-
attachmentBoxLabel:
|
|
165163
|
+
attachmentBoxLabel: boxLabel2,
|
|
164867
165164
|
transformRendererFrame: async ({ data, signal }) => (await transformCodexLocalImages({
|
|
164868
165165
|
alias,
|
|
164869
|
-
boxLabel,
|
|
165166
|
+
boxLabel: boxLabel2,
|
|
164870
165167
|
clientThreadId,
|
|
164871
165168
|
cwd: rendererCwd,
|
|
164872
165169
|
data,
|
|
@@ -165547,7 +165844,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165547
165844
|
encodeClaudeRemotePath = (path106) => path106.replace(/[\s'"()\\]/gu, (character) => `\\${character}`);
|
|
165548
165845
|
createClaudeNativeImageInput = ({
|
|
165549
165846
|
alias,
|
|
165550
|
-
boxLabel,
|
|
165847
|
+
boxLabel: boxLabel2,
|
|
165551
165848
|
clientThreadId,
|
|
165552
165849
|
cwd: cwd2,
|
|
165553
165850
|
platform: platform3 = process.platform,
|
|
@@ -165566,12 +165863,12 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165566
165863
|
const batchError = validateNativeAgentImageBatch(images);
|
|
165567
165864
|
if (batchError) {
|
|
165568
165865
|
throw new NativeAgentImageUploadError(
|
|
165569
|
-
createNativeAgentAttachmentError({ boxLabel, code: batchError })
|
|
165866
|
+
createNativeAgentAttachmentError({ boxLabel: boxLabel2, code: batchError })
|
|
165570
165867
|
);
|
|
165571
165868
|
}
|
|
165572
165869
|
return await dependencies.upload({
|
|
165573
165870
|
alias,
|
|
165574
|
-
boxLabel,
|
|
165871
|
+
boxLabel: boxLabel2,
|
|
165575
165872
|
clientThreadId,
|
|
165576
165873
|
idempotencyKey: randomUUID19(),
|
|
165577
165874
|
images,
|
|
@@ -165588,7 +165885,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165588
165885
|
if (clipboard.code === "image_too_large" || clipboard.code === "invalid_image") {
|
|
165589
165886
|
throw new NativeAgentImageUploadError(
|
|
165590
165887
|
createNativeAgentAttachmentError({
|
|
165591
|
-
boxLabel,
|
|
165888
|
+
boxLabel: boxLabel2,
|
|
165592
165889
|
code: clipboard.code === "image_too_large" ? "image_too_large" : "unsupported_image"
|
|
165593
165890
|
})
|
|
165594
165891
|
);
|
|
@@ -165602,7 +165899,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165602
165899
|
if (intake.kind !== "accepted") {
|
|
165603
165900
|
throw new NativeAgentImageUploadError(
|
|
165604
165901
|
createNativeAgentAttachmentError({
|
|
165605
|
-
boxLabel,
|
|
165902
|
+
boxLabel: boxLabel2,
|
|
165606
165903
|
code: intake.kind === "error" ? intake.code : "unsupported_image"
|
|
165607
165904
|
})
|
|
165608
165905
|
);
|
|
@@ -165615,7 +165912,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165615
165912
|
if (!remote) {
|
|
165616
165913
|
throw new NativeAgentImageUploadError(
|
|
165617
165914
|
createNativeAgentAttachmentError({
|
|
165618
|
-
boxLabel,
|
|
165915
|
+
boxLabel: boxLabel2,
|
|
165619
165916
|
code: "protocol_error"
|
|
165620
165917
|
})
|
|
165621
165918
|
);
|
|
@@ -165656,7 +165953,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165656
165953
|
if (intake.kind === "error") {
|
|
165657
165954
|
throw new NativeAgentImageUploadError(
|
|
165658
165955
|
createNativeAgentAttachmentError({
|
|
165659
|
-
boxLabel,
|
|
165956
|
+
boxLabel: boxLabel2,
|
|
165660
165957
|
code: intake.code
|
|
165661
165958
|
})
|
|
165662
165959
|
);
|
|
@@ -165668,7 +165965,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165668
165965
|
if (batchError) {
|
|
165669
165966
|
throw new NativeAgentImageUploadError(
|
|
165670
165967
|
createNativeAgentAttachmentError({
|
|
165671
|
-
boxLabel,
|
|
165968
|
+
boxLabel: boxLabel2,
|
|
165672
165969
|
code: batchError
|
|
165673
165970
|
})
|
|
165674
165971
|
);
|
|
@@ -165684,7 +165981,7 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165684
165981
|
if (completed.length !== accepted.length) {
|
|
165685
165982
|
throw new NativeAgentImageUploadError(
|
|
165686
165983
|
createNativeAgentAttachmentError({
|
|
165687
|
-
boxLabel,
|
|
165984
|
+
boxLabel: boxLabel2,
|
|
165688
165985
|
code: "protocol_error"
|
|
165689
165986
|
})
|
|
165690
165987
|
);
|
|
@@ -165737,10 +166034,10 @@ var init_claudeNativeImageInput = __esm({
|
|
|
165737
166034
|
};
|
|
165738
166035
|
};
|
|
165739
166036
|
mapClaudeNativeImageInputError = ({
|
|
165740
|
-
boxLabel,
|
|
166037
|
+
boxLabel: boxLabel2,
|
|
165741
166038
|
error: error55
|
|
165742
166039
|
}) => isNativeAgentImageUploadError(error55) ? error55.attachmentError : createNativeAgentAttachmentError({
|
|
165743
|
-
boxLabel,
|
|
166040
|
+
boxLabel: boxLabel2,
|
|
165744
166041
|
code: "protocol_error"
|
|
165745
166042
|
});
|
|
165746
166043
|
}
|
|
@@ -167308,7 +167605,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167308
167605
|
return sanitized || "Claude thread";
|
|
167309
167606
|
};
|
|
167310
167607
|
formatClaudeTuiSleepScreen = ({
|
|
167311
|
-
boxLabel,
|
|
167608
|
+
boxLabel: boxLabel2,
|
|
167312
167609
|
columns = DEFAULT_TERMINAL_COLUMNS,
|
|
167313
167610
|
detachLabel,
|
|
167314
167611
|
state,
|
|
@@ -167318,7 +167615,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167318
167615
|
const title = cliTruncate(sanitizeThreadTitle(threadTitle2), contentWidth, {
|
|
167319
167616
|
position: "end"
|
|
167320
167617
|
});
|
|
167321
|
-
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."];
|
|
167322
167619
|
return [
|
|
167323
167620
|
CLEAR_AND_HOME_SCREEN,
|
|
167324
167621
|
`${BOLD}${title}${RESET}`,
|
|
@@ -167330,7 +167627,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167330
167627
|
].join("\r\n");
|
|
167331
167628
|
};
|
|
167332
167629
|
renderClaudeTuiSleepScreen = ({
|
|
167333
|
-
boxLabel,
|
|
167630
|
+
boxLabel: boxLabel2,
|
|
167334
167631
|
state,
|
|
167335
167632
|
stderr = process.stderr,
|
|
167336
167633
|
stdout = process.stdout,
|
|
@@ -167340,7 +167637,7 @@ var init_claudeTuiSleep = __esm({
|
|
|
167340
167637
|
resetTerminalInputModes({ stderr, stdout });
|
|
167341
167638
|
stdout.write(
|
|
167342
167639
|
formatClaudeTuiSleepScreen({
|
|
167343
|
-
boxLabel,
|
|
167640
|
+
boxLabel: boxLabel2,
|
|
167344
167641
|
...stdout.columns === void 0 ? {} : { columns: stdout.columns },
|
|
167345
167642
|
detachLabel: detachControl.label,
|
|
167346
167643
|
state,
|
|
@@ -167473,7 +167770,7 @@ var init_claudeTui = __esm({
|
|
|
167473
167770
|
};
|
|
167474
167771
|
runClaudeTui = async ({
|
|
167475
167772
|
alias,
|
|
167476
|
-
boxLabel,
|
|
167773
|
+
boxLabel: boxLabel2,
|
|
167477
167774
|
backend,
|
|
167478
167775
|
clientThreadId,
|
|
167479
167776
|
threadId: threadId2,
|
|
@@ -167582,7 +167879,7 @@ var init_claudeTui = __esm({
|
|
|
167582
167879
|
const inputTransformer = createClaudeManagedCommandInput({
|
|
167583
167880
|
downstream: createClaudeNativeImageInput({
|
|
167584
167881
|
alias,
|
|
167585
|
-
boxLabel,
|
|
167882
|
+
boxLabel: boxLabel2,
|
|
167586
167883
|
clientThreadId,
|
|
167587
167884
|
cwd: process.cwd(),
|
|
167588
167885
|
resolveConnectInfo
|
|
@@ -167600,10 +167897,10 @@ var init_claudeTui = __esm({
|
|
|
167600
167897
|
isRawCtrlCChunk,
|
|
167601
167898
|
inputTransformer,
|
|
167602
167899
|
inputQueueOverflowError: createNativeAgentAttachmentError({
|
|
167603
|
-
boxLabel,
|
|
167900
|
+
boxLabel: boxLabel2,
|
|
167604
167901
|
code: "upload_queue_overflow"
|
|
167605
167902
|
}),
|
|
167606
|
-
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel, error: error55 }),
|
|
167903
|
+
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel: boxLabel2, error: error55 }),
|
|
167607
167904
|
onOpen: () => {
|
|
167608
167905
|
if (!readyReported) {
|
|
167609
167906
|
readyReported = true;
|
|
@@ -167634,7 +167931,7 @@ var init_claudeTui = __esm({
|
|
|
167634
167931
|
let screenState = "sleeping";
|
|
167635
167932
|
while (true) {
|
|
167636
167933
|
runtime.renderSleepScreen({
|
|
167637
|
-
boxLabel,
|
|
167934
|
+
boxLabel: boxLabel2,
|
|
167638
167935
|
state: screenState,
|
|
167639
167936
|
threadTitle: threadTitle2
|
|
167640
167937
|
});
|
|
@@ -167642,7 +167939,7 @@ var init_claudeTui = __esm({
|
|
|
167642
167939
|
return { kind: "detached" };
|
|
167643
167940
|
}
|
|
167644
167941
|
runtime.renderSleepScreen({
|
|
167645
|
-
boxLabel,
|
|
167942
|
+
boxLabel: boxLabel2,
|
|
167646
167943
|
state: "waking",
|
|
167647
167944
|
threadTitle: threadTitle2
|
|
167648
167945
|
});
|
|
@@ -167664,7 +167961,7 @@ var init_claudeTui = __esm({
|
|
|
167664
167961
|
}
|
|
167665
167962
|
if (running) {
|
|
167666
167963
|
runtime.renderSleepScreen({
|
|
167667
|
-
boxLabel,
|
|
167964
|
+
boxLabel: boxLabel2,
|
|
167668
167965
|
state: "reconnecting",
|
|
167669
167966
|
threadTitle: threadTitle2
|
|
167670
167967
|
});
|
|
@@ -167706,7 +168003,7 @@ var init_claudeTui = __esm({
|
|
|
167706
168003
|
};
|
|
167707
168004
|
runClaudeEmptyTui = async ({
|
|
167708
168005
|
alias,
|
|
167709
|
-
boxLabel,
|
|
168006
|
+
boxLabel: boxLabel2,
|
|
167710
168007
|
startupAttemptId,
|
|
167711
168008
|
clientThreadId,
|
|
167712
168009
|
plannedClaudeSessionId,
|
|
@@ -167779,7 +168076,7 @@ var init_claudeTui = __esm({
|
|
|
167779
168076
|
let readyPromise = null;
|
|
167780
168077
|
const inputTransformer = createClaudeNativeImageInput({
|
|
167781
168078
|
alias,
|
|
167782
|
-
boxLabel,
|
|
168079
|
+
boxLabel: boxLabel2,
|
|
167783
168080
|
clientThreadId,
|
|
167784
168081
|
cwd: process.cwd(),
|
|
167785
168082
|
resolveConnectInfo
|
|
@@ -167794,10 +168091,10 @@ var init_claudeTui = __esm({
|
|
|
167794
168091
|
isRawCtrlCChunk,
|
|
167795
168092
|
inputTransformer,
|
|
167796
168093
|
inputQueueOverflowError: createNativeAgentAttachmentError({
|
|
167797
|
-
boxLabel,
|
|
168094
|
+
boxLabel: boxLabel2,
|
|
167798
168095
|
code: "upload_queue_overflow"
|
|
167799
168096
|
}),
|
|
167800
|
-
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel, error: error55 }),
|
|
168097
|
+
mapInputTransformError: (error55) => mapClaudeNativeImageInputError({ boxLabel: boxLabel2, error: error55 }),
|
|
167801
168098
|
onOpen: () => {
|
|
167802
168099
|
readyPromise = onReady();
|
|
167803
168100
|
}
|
|
@@ -168327,14 +168624,14 @@ var init_actionPresentation = __esm({
|
|
|
168327
168624
|
if (item.actions.enter.kind !== "view_only") {
|
|
168328
168625
|
throw new Error("Expected a view-only thread action.");
|
|
168329
168626
|
}
|
|
168330
|
-
const
|
|
168627
|
+
const boxLabel2 = item.actions.shell.kind === "shell" ? targetRoleLabel(item.actions.shell.targetRole) : "machine";
|
|
168331
168628
|
switch (item.actions.enter.reason) {
|
|
168332
168629
|
case "draft_thread":
|
|
168333
168630
|
return "Start this draft before opening it in a terminal.";
|
|
168334
168631
|
case "native_identity_missing":
|
|
168335
168632
|
return "This thread can't open in a terminal because it doesn't have a resumable session yet.";
|
|
168336
168633
|
case "native_path_missing":
|
|
168337
|
-
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}.`;
|
|
168338
168635
|
case "history_only":
|
|
168339
168636
|
return "This thread is history only. Its saved session is unavailable, so it can't be continued.";
|
|
168340
168637
|
case "empty_state_missing":
|
|
@@ -168345,24 +168642,24 @@ var init_actionPresentation = __esm({
|
|
|
168345
168642
|
};
|
|
168346
168643
|
formatCodexRuntimeViewOnlyReason = ({
|
|
168347
168644
|
reason,
|
|
168348
|
-
boxLabel
|
|
168645
|
+
boxLabel: boxLabel2
|
|
168349
168646
|
}) => {
|
|
168350
168647
|
switch (reason) {
|
|
168351
168648
|
case "native_thread_missing":
|
|
168352
|
-
return `This Codex thread is no longer available on this ${
|
|
168649
|
+
return `This Codex thread is no longer available on this ${boxLabel2}.`;
|
|
168353
168650
|
case "native_thread_ambiguous":
|
|
168354
|
-
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.`;
|
|
168355
168652
|
case "native_thread_archived":
|
|
168356
168653
|
return "This Codex thread's saved session is archived and can't open in a terminal.";
|
|
168357
168654
|
case "native_path_mismatch":
|
|
168358
|
-
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}.`;
|
|
168359
168656
|
case "managed_codex_unavailable":
|
|
168360
|
-
return `Codex isn't ready on this ${
|
|
168657
|
+
return `Codex isn't ready on this ${boxLabel2}. Wake it and try again in a moment.`;
|
|
168361
168658
|
}
|
|
168362
168659
|
};
|
|
168363
168660
|
formatCodexOutcome = ({
|
|
168364
168661
|
outcome,
|
|
168365
|
-
boxLabel
|
|
168662
|
+
boxLabel: boxLabel2
|
|
168366
168663
|
}) => {
|
|
168367
168664
|
switch (outcome.kind) {
|
|
168368
168665
|
case "renderer_exit":
|
|
@@ -168375,7 +168672,7 @@ var init_actionPresentation = __esm({
|
|
|
168375
168672
|
return {
|
|
168376
168673
|
message: formatCodexRuntimeViewOnlyReason({
|
|
168377
168674
|
reason: outcome.reason,
|
|
168378
|
-
boxLabel
|
|
168675
|
+
boxLabel: boxLabel2
|
|
168379
168676
|
}),
|
|
168380
168677
|
tone: "neutral"
|
|
168381
168678
|
};
|
|
@@ -168386,7 +168683,7 @@ var init_actionPresentation = __esm({
|
|
|
168386
168683
|
};
|
|
168387
168684
|
case "disconnected":
|
|
168388
168685
|
return {
|
|
168389
|
-
message: `Codex disconnected from this ${
|
|
168686
|
+
message: `Codex disconnected from this ${boxLabel2}. Press Enter to reconnect.`,
|
|
168390
168687
|
tone: "error"
|
|
168391
168688
|
};
|
|
168392
168689
|
case "attachment_error":
|
|
@@ -168404,13 +168701,13 @@ var init_actionPresentation = __esm({
|
|
|
168404
168701
|
case "channel_exists":
|
|
168405
168702
|
case "open_failed":
|
|
168406
168703
|
return {
|
|
168407
|
-
message: `Codex couldn't open on this ${
|
|
168704
|
+
message: `Codex couldn't open on this ${boxLabel2}. Review the latest status and try again.`,
|
|
168408
168705
|
tone: "error"
|
|
168409
168706
|
};
|
|
168410
168707
|
}
|
|
168411
168708
|
}
|
|
168412
168709
|
};
|
|
168413
|
-
formatClaudeOutcome = (outcome, backend,
|
|
168710
|
+
formatClaudeOutcome = (outcome, backend, boxLabel2) => {
|
|
168414
168711
|
switch (outcome.kind) {
|
|
168415
168712
|
case "detached":
|
|
168416
168713
|
return {
|
|
@@ -168426,12 +168723,12 @@ var init_actionPresentation = __esm({
|
|
|
168426
168723
|
switch (outcome.reason) {
|
|
168427
168724
|
case "native_thread_missing":
|
|
168428
168725
|
return {
|
|
168429
|
-
message: `This Claude thread is no longer available on this ${
|
|
168726
|
+
message: `This Claude thread is no longer available on this ${boxLabel2}.`,
|
|
168430
168727
|
tone: "neutral"
|
|
168431
168728
|
};
|
|
168432
168729
|
case "native_path_mismatch":
|
|
168433
168730
|
return {
|
|
168434
|
-
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}.`,
|
|
168435
168732
|
tone: "neutral"
|
|
168436
168733
|
};
|
|
168437
168734
|
case "owner_conflict":
|
|
@@ -168476,7 +168773,7 @@ var init_actionPresentation = __esm({
|
|
|
168476
168773
|
};
|
|
168477
168774
|
case "disconnected":
|
|
168478
168775
|
return {
|
|
168479
|
-
message: `Claude disconnected from this ${
|
|
168776
|
+
message: `Claude disconnected from this ${boxLabel2}. Press Enter to reconnect.`,
|
|
168480
168777
|
tone: "error"
|
|
168481
168778
|
};
|
|
168482
168779
|
case "attachment_error":
|
|
@@ -168484,10 +168781,10 @@ var init_actionPresentation = __esm({
|
|
|
168484
168781
|
}
|
|
168485
168782
|
};
|
|
168486
168783
|
formatMissingServiceUpdate = ({
|
|
168487
|
-
boxLabel,
|
|
168784
|
+
boxLabel: boxLabel2,
|
|
168488
168785
|
subject
|
|
168489
168786
|
}) => ({
|
|
168490
|
-
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.`,
|
|
168491
168788
|
tone: "error"
|
|
168492
168789
|
});
|
|
168493
168790
|
}
|
|
@@ -168684,7 +168981,7 @@ var init_agentDirectResume = __esm({
|
|
|
168684
168981
|
executionInstanceId: resolvedThread.executionInstanceId
|
|
168685
168982
|
}
|
|
168686
168983
|
);
|
|
168687
|
-
const
|
|
168984
|
+
const boxLabel2 = resolvedTarget.role === "primary" ? "Template box" : "devbox";
|
|
168688
168985
|
const resolveConnectInfo = dependencies.resolveConnectInfo(getToken);
|
|
168689
168986
|
let markViewedFailed = false;
|
|
168690
168987
|
const onReady = async () => {
|
|
@@ -168707,7 +169004,7 @@ var init_agentDirectResume = __esm({
|
|
|
168707
169004
|
if (backend === "codex") {
|
|
168708
169005
|
const outcome2 = await dependencies.openCodex({
|
|
168709
169006
|
alias: resolvedTarget.alias,
|
|
168710
|
-
boxLabel,
|
|
169007
|
+
boxLabel: boxLabel2,
|
|
168711
169008
|
primaryInstanceId: project.primaryInstanceId,
|
|
168712
169009
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
168713
169010
|
threadId: resolvedThread.backendThreadId,
|
|
@@ -168719,7 +169016,7 @@ var init_agentDirectResume = __esm({
|
|
|
168719
169016
|
suspendTerminal: async (callback) => await callback()
|
|
168720
169017
|
});
|
|
168721
169018
|
reportOutcome({
|
|
168722
|
-
...formatCodexOutcome({ outcome: outcome2, boxLabel }),
|
|
169019
|
+
...formatCodexOutcome({ outcome: outcome2, boxLabel: boxLabel2 }),
|
|
168723
169020
|
markViewedFailed,
|
|
168724
169021
|
dependencies
|
|
168725
169022
|
});
|
|
@@ -168728,7 +169025,7 @@ var init_agentDirectResume = __esm({
|
|
|
168728
169025
|
let confirmation = null;
|
|
168729
169026
|
let outcome = await dependencies.openClaude({
|
|
168730
169027
|
alias: resolvedTarget.alias,
|
|
168731
|
-
boxLabel,
|
|
169028
|
+
boxLabel: boxLabel2,
|
|
168732
169029
|
backend: "claude",
|
|
168733
169030
|
primaryInstanceId: project.primaryInstanceId,
|
|
168734
169031
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
@@ -168753,7 +169050,7 @@ var init_agentDirectResume = __esm({
|
|
|
168753
169050
|
};
|
|
168754
169051
|
outcome = await dependencies.openClaude({
|
|
168755
169052
|
alias: resolvedTarget.alias,
|
|
168756
|
-
boxLabel,
|
|
169053
|
+
boxLabel: boxLabel2,
|
|
168757
169054
|
backend: "claude",
|
|
168758
169055
|
primaryInstanceId: project.primaryInstanceId,
|
|
168759
169056
|
clientThreadId: String(resolvedThread.clientThreadId),
|
|
@@ -168774,7 +169071,7 @@ var init_agentDirectResume = __esm({
|
|
|
168774
169071
|
return;
|
|
168775
169072
|
}
|
|
168776
169073
|
reportOutcome({
|
|
168777
|
-
...formatClaudeOutcome(outcome, "claude",
|
|
169074
|
+
...formatClaudeOutcome(outcome, "claude", boxLabel2),
|
|
168778
169075
|
markViewedFailed,
|
|
168779
169076
|
dependencies
|
|
168780
169077
|
});
|
|
@@ -217313,11 +217610,11 @@ var init_peekController = __esm({
|
|
|
217313
217610
|
}
|
|
217314
217611
|
assertPeekContract(binding.contractVersion);
|
|
217315
217612
|
if (binding.status !== "ready") {
|
|
217316
|
-
const
|
|
217613
|
+
const unavailable2 = phaseForUnavailableBinding(binding.status);
|
|
217317
217614
|
active.binding = null;
|
|
217318
217615
|
active.entry = null;
|
|
217319
|
-
active.phase =
|
|
217320
|
-
active.retryable =
|
|
217616
|
+
active.phase = unavailable2.phase;
|
|
217617
|
+
active.retryable = unavailable2.retryable;
|
|
217321
217618
|
active.loadingEarlier = false;
|
|
217322
217619
|
this.onChange();
|
|
217323
217620
|
return;
|
|
@@ -218015,8 +218312,8 @@ var init_composerSettingsFocus = __esm({
|
|
|
218015
218312
|
const index = (Math.max(0, currentIndex) + delta + options.length) % options.length;
|
|
218016
218313
|
return options[index].value;
|
|
218017
218314
|
};
|
|
218018
|
-
matchAgentViewComposerSettingsOption = (context34, segment,
|
|
218019
|
-
const normalized =
|
|
218315
|
+
matchAgentViewComposerSettingsOption = (context34, segment, query2) => {
|
|
218316
|
+
const normalized = query2.trim().toLocaleLowerCase();
|
|
218020
218317
|
if (normalized.length === 0) {
|
|
218021
218318
|
return null;
|
|
218022
218319
|
}
|
|
@@ -218064,8 +218361,8 @@ var init_composerSlashCommands = __esm({
|
|
|
218064
218361
|
];
|
|
218065
218362
|
};
|
|
218066
218363
|
resolveAgentViewComposerSlashTrigger = (text) => /^\/\S*$/u.test(text) ? text.slice(1) : null;
|
|
218067
|
-
matchAgentViewComposerSlashCommands = (commands,
|
|
218068
|
-
const normalized =
|
|
218364
|
+
matchAgentViewComposerSlashCommands = (commands, query2) => {
|
|
218365
|
+
const normalized = query2.trim().toLocaleLowerCase();
|
|
218069
218366
|
if (normalized.length === 0) {
|
|
218070
218367
|
return [...commands];
|
|
218071
218368
|
}
|
|
@@ -220001,13 +220298,13 @@ var init_creationComposerController = __esm({
|
|
|
220001
220298
|
* resets the selection to the first row, the way the reference menu does.
|
|
220002
220299
|
*/
|
|
220003
220300
|
presentSlashMenu(composer, text) {
|
|
220004
|
-
const
|
|
220005
|
-
if (
|
|
220301
|
+
const query2 = resolveAgentViewComposerSlashTrigger(text);
|
|
220302
|
+
if (query2 === null) {
|
|
220006
220303
|
return null;
|
|
220007
220304
|
}
|
|
220008
220305
|
const commands = matchAgentViewComposerSlashCommands(
|
|
220009
220306
|
listAgentViewComposerSlashCommands(this.settingsContext(composer)),
|
|
220010
|
-
|
|
220307
|
+
query2
|
|
220011
220308
|
);
|
|
220012
220309
|
if (commands.length === 0) {
|
|
220013
220310
|
return null;
|
|
@@ -220107,7 +220404,7 @@ var init_creationComposerController = __esm({
|
|
|
220107
220404
|
)
|
|
220108
220405
|
);
|
|
220109
220406
|
}
|
|
220110
|
-
async applySettingsQuery(
|
|
220407
|
+
async applySettingsQuery(query2) {
|
|
220111
220408
|
const composer = this.snapshot.composer;
|
|
220112
220409
|
const focus = composer?.settingsFocus;
|
|
220113
220410
|
if (!composer || !focus || !canEditAgentViewCreationComposer(composer)) {
|
|
@@ -220116,13 +220413,13 @@ var init_creationComposerController = __esm({
|
|
|
220116
220413
|
this.updateSnapshot({
|
|
220117
220414
|
composer: {
|
|
220118
220415
|
...composer,
|
|
220119
|
-
settingsFocus: { segment: focus.segment, query }
|
|
220416
|
+
settingsFocus: { segment: focus.segment, query: query2 }
|
|
220120
220417
|
}
|
|
220121
220418
|
});
|
|
220122
220419
|
const match = matchAgentViewComposerSettingsOption(
|
|
220123
220420
|
this.settingsContext(composer),
|
|
220124
220421
|
focus.segment,
|
|
220125
|
-
|
|
220422
|
+
query2
|
|
220126
220423
|
);
|
|
220127
220424
|
if (match && !match.current) {
|
|
220128
220425
|
await this.applySettingsValue(match.value);
|
|
@@ -221805,10 +222102,10 @@ var init_renameModal = __esm({
|
|
|
221805
222102
|
AGENT_VIEW_THREAD_TITLE_MAX_CODE_POINTS = 120;
|
|
221806
222103
|
createAgentViewRenameModal = ({
|
|
221807
222104
|
target,
|
|
221808
|
-
boxLabel
|
|
222105
|
+
boxLabel: boxLabel2
|
|
221809
222106
|
}) => ({
|
|
221810
222107
|
target,
|
|
221811
|
-
boxLabel,
|
|
222108
|
+
boxLabel: boxLabel2,
|
|
221812
222109
|
// An unnamed devbox starts empty so saving untouched text does not name it
|
|
221813
222110
|
// after its first thread.
|
|
221814
222111
|
editor: createAgentViewTextBuffer(
|
|
@@ -221903,8 +222200,8 @@ var init_threadActionExecutor = __esm({
|
|
|
221903
222200
|
target,
|
|
221904
222201
|
operation
|
|
221905
222202
|
}) => {
|
|
221906
|
-
const
|
|
221907
|
-
await client.mutation(
|
|
222203
|
+
const mutation2 = operation === "archive" ? target.isSecondaryDevboxThread ? archiveAgentViewSecondaryThreadMetadata : archiveAgentViewTemplateThreadMetadata : target.isSecondaryDevboxThread ? unarchiveAgentViewSecondaryThreadMetadata : unarchiveAgentViewTemplateThreadMetadata;
|
|
222204
|
+
await client.mutation(mutation2, {
|
|
221908
222205
|
instanceId: target.primaryInstanceId,
|
|
221909
222206
|
clientThreadId: target.clientThreadId
|
|
221910
222207
|
});
|
|
@@ -222166,7 +222463,7 @@ var init_metadataActionController = __esm({
|
|
|
222166
222463
|
statusTone: "neutral"
|
|
222167
222464
|
});
|
|
222168
222465
|
try {
|
|
222169
|
-
let
|
|
222466
|
+
let boxLabel2 = "Template box";
|
|
222170
222467
|
if (target.renameSubject.kind === "thread" && target.executionInstanceId !== target.primaryInstanceId) {
|
|
222171
222468
|
const resolved = await this.client.query(resolveAgentViewTargetV1, {
|
|
222172
222469
|
primaryInstanceId: target.primaryInstanceId,
|
|
@@ -222177,13 +222474,13 @@ var init_metadataActionController = __esm({
|
|
|
222177
222474
|
"Resolved machine target did not match rename target."
|
|
222178
222475
|
);
|
|
222179
222476
|
}
|
|
222180
|
-
|
|
222477
|
+
boxLabel2 = resolved.target.alias;
|
|
222181
222478
|
}
|
|
222182
222479
|
if (!this.host.isSelectionCurrent(capture)) {
|
|
222183
222480
|
return;
|
|
222184
222481
|
}
|
|
222185
222482
|
this.update({
|
|
222186
|
-
renameModal: createAgentViewRenameModal({ target, boxLabel })
|
|
222483
|
+
renameModal: createAgentViewRenameModal({ target, boxLabel: boxLabel2 })
|
|
222187
222484
|
});
|
|
222188
222485
|
} catch (error55) {
|
|
222189
222486
|
this.update({
|
|
@@ -223139,12 +223436,12 @@ var init_controller = __esm({
|
|
|
223139
223436
|
};
|
|
223140
223437
|
this.emit();
|
|
223141
223438
|
try {
|
|
223142
|
-
const
|
|
223439
|
+
const boxLabel2 = target.executionInstanceId === target.primaryInstanceId ? "Template box" : await this.resolvePreviewDevboxAlias(target);
|
|
223143
223440
|
if (this.stopped || this.snapshot.selectedKey !== target.selectedKey) {
|
|
223144
223441
|
return;
|
|
223145
223442
|
}
|
|
223146
223443
|
this.peekReturnSelectionKey = target.selectedKey;
|
|
223147
|
-
this.peekController.open({ ...target, boxLabel });
|
|
223444
|
+
this.peekController.open({ ...target, boxLabel: boxLabel2 });
|
|
223148
223445
|
} catch {
|
|
223149
223446
|
this.snapshot = {
|
|
223150
223447
|
...this.snapshot,
|
|
@@ -224024,9 +224321,9 @@ var init_controller = __esm({
|
|
|
224024
224321
|
});
|
|
224025
224322
|
} catch (error55) {
|
|
224026
224323
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
224027
|
-
const
|
|
224324
|
+
const boxLabel2 = selected.actions.shell.kind === "shell" && selected.actions.shell.targetRole === "template" ? "Template box" : "devbox";
|
|
224028
224325
|
const presentation = formatMissingServiceUpdate({
|
|
224029
|
-
boxLabel,
|
|
224326
|
+
boxLabel: boxLabel2,
|
|
224030
224327
|
subject: "Claude"
|
|
224031
224328
|
});
|
|
224032
224329
|
nextMessage = presentation.message;
|
|
@@ -224087,7 +224384,7 @@ var init_controller = __esm({
|
|
|
224087
224384
|
if (resolved.target.primaryInstanceId !== action.primaryInstanceId || resolved.target.executionInstanceId !== action.executionInstanceId || resolved.target.computeProvider !== "e2b") {
|
|
224088
224385
|
throw new Error("Resolved machine target did not match the selection.");
|
|
224089
224386
|
}
|
|
224090
|
-
const
|
|
224387
|
+
const boxLabel2 = resolved.target.role === "primary" ? "Template box" : "devbox";
|
|
224091
224388
|
logger2.info("agent_view_native_target_resolved", {
|
|
224092
224389
|
alias: resolved.target.alias,
|
|
224093
224390
|
requestType: "codex_tui_open",
|
|
@@ -224099,7 +224396,7 @@ var init_controller = __esm({
|
|
|
224099
224396
|
});
|
|
224100
224397
|
const outcome = await this.actionDependencies.openCodex?.({
|
|
224101
224398
|
alias: resolved.target.alias,
|
|
224102
|
-
boxLabel,
|
|
224399
|
+
boxLabel: boxLabel2,
|
|
224103
224400
|
primaryInstanceId: action.primaryInstanceId,
|
|
224104
224401
|
clientThreadId: action.clientThreadId,
|
|
224105
224402
|
threadId: action.backendThreadId,
|
|
@@ -224132,7 +224429,7 @@ var init_controller = __esm({
|
|
|
224132
224429
|
if (!outcome) {
|
|
224133
224430
|
throw new Error("Codex renderer action is unavailable.");
|
|
224134
224431
|
}
|
|
224135
|
-
const formatted = formatCodexOutcome({ outcome, boxLabel });
|
|
224432
|
+
const formatted = formatCodexOutcome({ outcome, boxLabel: boxLabel2 });
|
|
224136
224433
|
nextMessage = markViewedFailed ? `${formatted.message} Its unread status could not be updated.` : formatted.message;
|
|
224137
224434
|
nextTone = formatted.tone;
|
|
224138
224435
|
logger2.info("agent_view_codex_renderer_completed", {
|
|
@@ -224143,9 +224440,9 @@ var init_controller = __esm({
|
|
|
224143
224440
|
});
|
|
224144
224441
|
} catch (error55) {
|
|
224145
224442
|
if (isDirectDaemonTransportError(error55) && error55.transportCode === "missing_capabilities") {
|
|
224146
|
-
const
|
|
224443
|
+
const boxLabel2 = selected.actions.shell.kind === "shell" && selected.actions.shell.targetRole === "template" ? "Template box" : "devbox";
|
|
224147
224444
|
const presentation = formatMissingServiceUpdate({
|
|
224148
|
-
boxLabel,
|
|
224445
|
+
boxLabel: boxLabel2,
|
|
224149
224446
|
subject: "this thread"
|
|
224150
224447
|
});
|
|
224151
224448
|
nextMessage = presentation.message;
|
|
@@ -238487,18 +238784,116 @@ var init_scanOutputs = __esm({
|
|
|
238487
238784
|
}
|
|
238488
238785
|
});
|
|
238489
238786
|
|
|
238787
|
+
// ../../../../shared/initPrep/src/gitSigningProfiles.mjs
|
|
238788
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
238789
|
+
var normalizeGitSigningFormat, buildIdentityWarnings, buildProfileId, createManagedGitSigningRepoPlan;
|
|
238790
|
+
var init_gitSigningProfiles = __esm({
|
|
238791
|
+
"../../../../shared/initPrep/src/gitSigningProfiles.mjs"() {
|
|
238792
|
+
"use strict";
|
|
238793
|
+
init_devboxCore2();
|
|
238794
|
+
normalizeGitSigningFormat = (rawFormat) => {
|
|
238795
|
+
if (!rawFormat || rawFormat.trim().length === 0) {
|
|
238796
|
+
return { format: "openpgp", unsupportedFormat: null };
|
|
238797
|
+
}
|
|
238798
|
+
const normalized = rawFormat.trim().toLowerCase();
|
|
238799
|
+
if (normalized === "openpgp" || normalized === "ssh") {
|
|
238800
|
+
return { format: normalized, unsupportedFormat: null };
|
|
238801
|
+
}
|
|
238802
|
+
return { format: null, unsupportedFormat: rawFormat.trim() };
|
|
238803
|
+
};
|
|
238804
|
+
buildIdentityWarnings = (email5) => email5.toLowerCase().endsWith("@users.noreply.github.com") ? ["noreply_email"] : [];
|
|
238805
|
+
buildProfileId = ({
|
|
238806
|
+
fingerprint,
|
|
238807
|
+
format: format2,
|
|
238808
|
+
signingKey,
|
|
238809
|
+
userEmail,
|
|
238810
|
+
userName
|
|
238811
|
+
}) => createHash16("sha256").update(
|
|
238812
|
+
JSON.stringify({ fingerprint, format: format2, signingKey, userEmail, userName })
|
|
238813
|
+
).digest("hex").slice(0, 16);
|
|
238814
|
+
createManagedGitSigningRepoPlan = async ({
|
|
238815
|
+
accountScope,
|
|
238816
|
+
env: env3,
|
|
238817
|
+
format: format2,
|
|
238818
|
+
homeDir: homeDir2,
|
|
238819
|
+
repo
|
|
238820
|
+
}) => {
|
|
238821
|
+
for (const [key2, value] of [
|
|
238822
|
+
["user.name", repo.userName],
|
|
238823
|
+
["user.email", repo.userEmail]
|
|
238824
|
+
]) {
|
|
238825
|
+
if (!value) {
|
|
238826
|
+
throw new Error(
|
|
238827
|
+
`Git signing requires ${key2} in ${repo.repoDisplayName}. Set your Git name and email in that repository, then retry. Or skip Git signing setup.`
|
|
238828
|
+
);
|
|
238829
|
+
}
|
|
238830
|
+
}
|
|
238831
|
+
const key = format2 === "openpgp" ? await ensureGitSigningOpenPgpKey({
|
|
238832
|
+
accountScope,
|
|
238833
|
+
env: env3,
|
|
238834
|
+
homeDir: homeDir2,
|
|
238835
|
+
userName: repo.userName,
|
|
238836
|
+
userEmail: repo.userEmail
|
|
238837
|
+
}) : await ensureGitRemoteSshKey({ accountScope, homeDir: homeDir2 });
|
|
238838
|
+
const fingerprint = format2 === "openpgp" ? key.fingerprint : key.publicKeyFingerprint;
|
|
238839
|
+
const signingKey = format2 === "openpgp" ? key.fingerprint : key.publicKeyPath;
|
|
238840
|
+
const profile = {
|
|
238841
|
+
id: buildProfileId({
|
|
238842
|
+
fingerprint,
|
|
238843
|
+
format: format2,
|
|
238844
|
+
signingKey,
|
|
238845
|
+
userName: repo.userName,
|
|
238846
|
+
userEmail: repo.userEmail
|
|
238847
|
+
}),
|
|
238848
|
+
format: format2,
|
|
238849
|
+
userName: repo.userName,
|
|
238850
|
+
userEmail: repo.userEmail,
|
|
238851
|
+
signingKey,
|
|
238852
|
+
publicKeyFingerprint: fingerprint,
|
|
238853
|
+
publicKeyBlock: format2 === "openpgp" ? key.publicKeyBlock : key.publicKey,
|
|
238854
|
+
publicKeyPaths: format2 === "openpgp" ? [] : [key.publicKeyPath],
|
|
238855
|
+
privateKeyPath: format2 === "openpgp" ? null : key.privateKeyPath,
|
|
238856
|
+
gnupgHome: format2 === "openpgp" ? key.gpgHome : null,
|
|
238857
|
+
keyType: format2 === "openpgp" ? null : "ed25519",
|
|
238858
|
+
// A generated boxes.dev key does not establish a personal profile to copy.
|
|
238859
|
+
copyAvailability: {
|
|
238860
|
+
available: false,
|
|
238861
|
+
material: null,
|
|
238862
|
+
sourcePaths: [],
|
|
238863
|
+
passphraseProtected: null,
|
|
238864
|
+
reason: format2 === "openpgp" ? "missing_openpgp_secret_key" : "missing_ssh_private_key",
|
|
238865
|
+
detail: "No complete local Git signing profile was found to copy."
|
|
238866
|
+
},
|
|
238867
|
+
identityWarnings: buildIdentityWarnings(repo.userEmail)
|
|
238868
|
+
};
|
|
238869
|
+
return {
|
|
238870
|
+
...repo,
|
|
238871
|
+
format: format2,
|
|
238872
|
+
signingKey,
|
|
238873
|
+
status: "ready",
|
|
238874
|
+
profileId: profile.id,
|
|
238875
|
+
reason: null,
|
|
238876
|
+
incompleteReason: null,
|
|
238877
|
+
outOfScopeReason: null,
|
|
238878
|
+
profile
|
|
238879
|
+
};
|
|
238880
|
+
};
|
|
238881
|
+
}
|
|
238882
|
+
});
|
|
238883
|
+
|
|
238490
238884
|
// ../../../../shared/initPrep/src/gitSigning.mjs
|
|
238491
238885
|
import { execFile as execFile6, spawn as spawn18 } from "node:child_process";
|
|
238492
|
-
import { createHash as
|
|
238886
|
+
import { createHash as createHash17, randomUUID as randomUUID23 } from "node:crypto";
|
|
238493
238887
|
import fs43 from "node:fs/promises";
|
|
238494
238888
|
import os22 from "node:os";
|
|
238495
238889
|
import path52 from "node:path";
|
|
238496
|
-
var uniqueStrings2, trim9, buildSpawnEnv2, runLocalCommand2, runCommandOrThrow, isMissingCommandError, readEffectiveGitConfig,
|
|
238890
|
+
var uniqueStrings2, trim9, buildSpawnEnv2, runLocalCommand2, runCommandOrThrow, isMissingCommandError, readEffectiveGitConfig, normalizeOpenPgpSelector, openPgpKeyMatchesSelector, openPgpKeyMatchesEmail, parseGpgSecretKeyListing, detectOpenPgpPassphraseProtected, inspectOpenPgpKeys, getOpenPgpCopyAvailability, expandUserPath, resolveSigningKeyPath, readFileIfExists3, isPublicSshKeyLine, parseSshPublicKey, missingSshPrivateKeyCopyAvailability, inspectLiteralSshPublicKey, inspectPublicSshKeyFile, inspectPrivateSshKeyFile, inspectSshSigningKey, buildIncompleteRepoPlan, detectOpenPgpRepoPlan, detectSshRepoPlan, detectGitSigningRepoPlan, profileKey, collectProfiles, computeRemoteConfigScope, deriveSetupStatus, collectCopyUnavailableReasons, collectWarnings, buildGitSigningSetupPlan, detectDesktopGitSigningSetup, parseGitRemoteHost2, hostsByProfile, dedupePublicKeys, registrationStatusFor, buildProfilePublicKey, buildSigningPublicKeys, createDesktopGitSigningDecisionFromPlan, assertOpenPgpToolsAvailable, validateModeSelection, buildCreateGitSigningPlan, buildSelectedDesktopGitSigningDecision, ensureFreshDir, throwSourceMissing, normalizeArchivePath, shouldExcludeGpgEntry, copyFileStrict, copyGpgHome, hashFile, assertCopyAvailable, prepareOpenPgpProfile, prepareSshProfile, prepareGitSigningPayload, relativeFromStagingRoot, stageDesktopGitSigningPayload;
|
|
238497
238891
|
var init_gitSigning2 = __esm({
|
|
238498
238892
|
"../../../../shared/initPrep/src/gitSigning.mjs"() {
|
|
238499
238893
|
"use strict";
|
|
238500
238894
|
init_devboxCore2();
|
|
238501
238895
|
init_gitPathStream();
|
|
238896
|
+
init_gitSigningProfiles();
|
|
238502
238897
|
uniqueStrings2 = (values) => [...new Set(values)];
|
|
238503
238898
|
trim9 = (value) => typeof value === "string" ? value.trim() : "";
|
|
238504
238899
|
buildSpawnEnv2 = (env3) => env3 ? { ...process.env, ...env3 } : process.env;
|
|
@@ -238566,29 +238961,6 @@ var init_gitSigning2 = __esm({
|
|
|
238566
238961
|
const value = result.stdout.trim();
|
|
238567
238962
|
return value.length > 0 ? value : null;
|
|
238568
238963
|
};
|
|
238569
|
-
normalizeGitSigningFormat = (rawFormat) => {
|
|
238570
|
-
if (!rawFormat || rawFormat.trim().length === 0) {
|
|
238571
|
-
return { format: "openpgp", unsupportedFormat: null };
|
|
238572
|
-
}
|
|
238573
|
-
const normalized = rawFormat.trim().toLowerCase();
|
|
238574
|
-
if (normalized === "openpgp") {
|
|
238575
|
-
return { format: "openpgp", unsupportedFormat: null };
|
|
238576
|
-
}
|
|
238577
|
-
if (normalized === "ssh") {
|
|
238578
|
-
return { format: "ssh", unsupportedFormat: null };
|
|
238579
|
-
}
|
|
238580
|
-
return { format: null, unsupportedFormat: rawFormat.trim() };
|
|
238581
|
-
};
|
|
238582
|
-
buildIdentityWarnings = (email5) => email5.toLowerCase().endsWith("@users.noreply.github.com") ? ["noreply_email"] : [];
|
|
238583
|
-
buildProfileId = ({
|
|
238584
|
-
fingerprint,
|
|
238585
|
-
format: format2,
|
|
238586
|
-
signingKey,
|
|
238587
|
-
userEmail,
|
|
238588
|
-
userName
|
|
238589
|
-
}) => createHash16("sha256").update(
|
|
238590
|
-
JSON.stringify({ fingerprint, format: format2, signingKey, userEmail, userName })
|
|
238591
|
-
).digest("hex").slice(0, 16);
|
|
238592
238964
|
normalizeOpenPgpSelector = (value) => value.trim().replace(/^0x/iu, "").replace(/!$/u, "").toUpperCase();
|
|
238593
238965
|
openPgpKeyMatchesSelector = (key, selector) => {
|
|
238594
238966
|
const normalized = normalizeOpenPgpSelector(selector);
|
|
@@ -238835,7 +239207,7 @@ var init_gitSigning2 = __esm({
|
|
|
238835
239207
|
try {
|
|
238836
239208
|
const blob = Buffer.from(keyBlob, "base64");
|
|
238837
239209
|
if (blob.length === 0) return null;
|
|
238838
|
-
const fingerprint =
|
|
239210
|
+
const fingerprint = createHash17("sha256").update(blob).digest("base64").replace(/=+$/u, "");
|
|
238839
239211
|
return {
|
|
238840
239212
|
keyType,
|
|
238841
239213
|
publicKey: value.trim(),
|
|
@@ -239427,16 +239799,7 @@ var init_gitSigning2 = __esm({
|
|
|
239427
239799
|
}
|
|
239428
239800
|
return warnings;
|
|
239429
239801
|
};
|
|
239430
|
-
|
|
239431
|
-
env: env3,
|
|
239432
|
-
homeDir: homeDir2 = os22.homedir(),
|
|
239433
|
-
projectLayout
|
|
239434
|
-
}) => {
|
|
239435
|
-
const repos = await Promise.all(
|
|
239436
|
-
projectLayout.repos.map(
|
|
239437
|
-
(repo) => detectGitSigningRepoPlan({ env: env3, homeDir: homeDir2, repo })
|
|
239438
|
-
)
|
|
239439
|
-
);
|
|
239802
|
+
buildGitSigningSetupPlan = (repos) => {
|
|
239440
239803
|
const profiles = collectProfiles(repos);
|
|
239441
239804
|
const readyRepos = repos.filter((repo) => repo.status === "ready");
|
|
239442
239805
|
const formats = uniqueStrings2(
|
|
@@ -239461,6 +239824,17 @@ var init_gitSigning2 = __esm({
|
|
|
239461
239824
|
}
|
|
239462
239825
|
};
|
|
239463
239826
|
};
|
|
239827
|
+
detectDesktopGitSigningSetup = async ({
|
|
239828
|
+
env: env3,
|
|
239829
|
+
homeDir: homeDir2 = os22.homedir(),
|
|
239830
|
+
projectLayout
|
|
239831
|
+
}) => buildGitSigningSetupPlan(
|
|
239832
|
+
await Promise.all(
|
|
239833
|
+
projectLayout.repos.map(
|
|
239834
|
+
(repo) => detectGitSigningRepoPlan({ env: env3, homeDir: homeDir2, repo })
|
|
239835
|
+
)
|
|
239836
|
+
)
|
|
239837
|
+
);
|
|
239464
239838
|
parseGitRemoteHost2 = (origin) => {
|
|
239465
239839
|
const value = trim9(origin);
|
|
239466
239840
|
if (!value) return null;
|
|
@@ -239642,7 +240016,7 @@ var init_gitSigning2 = __esm({
|
|
|
239642
240016
|
const formats = plan ? plan.profiles.length > 0 ? plan.profiles.map((profile) => profile.format) : plan.repos.map(
|
|
239643
240017
|
(repo) => normalizeGitSigningFormat(repo.rawFormat).format
|
|
239644
240018
|
) : [];
|
|
239645
|
-
if (formats.includes("openpgp")) {
|
|
240019
|
+
if (mode === "copy" && formats.includes("openpgp")) {
|
|
239646
240020
|
await assertOpenPgpToolsAvailable({ env: env3, projectLayout });
|
|
239647
240021
|
}
|
|
239648
240022
|
if (!plan || plan.status !== "ready" || plan.profiles.length === 0) {
|
|
@@ -239656,16 +240030,51 @@ var init_gitSigning2 = __esm({
|
|
|
239656
240030
|
"Copying Git signing material requires explicit confirmation."
|
|
239657
240031
|
);
|
|
239658
240032
|
}
|
|
239659
|
-
const
|
|
240033
|
+
const unavailable2 = plan.profiles.find(
|
|
239660
240034
|
(profile) => !profile.copyAvailability.available
|
|
239661
240035
|
);
|
|
239662
|
-
if (
|
|
240036
|
+
if (unavailable2) {
|
|
239663
240037
|
throw new Error(
|
|
239664
|
-
`Git signing profile ${
|
|
240038
|
+
`Git signing profile ${unavailable2.id} cannot be copied: ${unavailable2.copyAvailability.reason}`
|
|
239665
240039
|
);
|
|
239666
240040
|
}
|
|
239667
240041
|
}
|
|
239668
240042
|
};
|
|
240043
|
+
buildCreateGitSigningPlan = async ({
|
|
240044
|
+
accountScope,
|
|
240045
|
+
env: env3,
|
|
240046
|
+
homeDir: homeDir2,
|
|
240047
|
+
plan,
|
|
240048
|
+
projectLayout
|
|
240049
|
+
}) => {
|
|
240050
|
+
const signingEnabled = plan.repos.some((repo) => repo.commitGpgSign);
|
|
240051
|
+
const targets = plan.repos.filter(
|
|
240052
|
+
(repo) => !signingEnabled || repo.commitGpgSign
|
|
240053
|
+
);
|
|
240054
|
+
if (targets.some(
|
|
240055
|
+
(repo) => normalizeGitSigningFormat(repo.rawFormat).format === "openpgp"
|
|
240056
|
+
)) {
|
|
240057
|
+
await assertOpenPgpToolsAvailable({ env: env3, projectLayout });
|
|
240058
|
+
}
|
|
240059
|
+
const profilesById = new Map(
|
|
240060
|
+
plan.profiles.map((profile) => [profile.id, profile])
|
|
240061
|
+
);
|
|
240062
|
+
const repos = [];
|
|
240063
|
+
for (const repo of plan.repos) {
|
|
240064
|
+
const profile = profilesById.get(repo.profileId);
|
|
240065
|
+
const { format: format2 } = normalizeGitSigningFormat(repo.rawFormat);
|
|
240066
|
+
repos.push(
|
|
240067
|
+
profile || !targets.includes(repo) || !format2 ? { ...repo, profile } : await createManagedGitSigningRepoPlan({
|
|
240068
|
+
accountScope,
|
|
240069
|
+
env: env3,
|
|
240070
|
+
format: format2,
|
|
240071
|
+
homeDir: homeDir2,
|
|
240072
|
+
repo
|
|
240073
|
+
})
|
|
240074
|
+
);
|
|
240075
|
+
}
|
|
240076
|
+
return buildGitSigningSetupPlan(repos);
|
|
240077
|
+
};
|
|
239669
240078
|
buildSelectedDesktopGitSigningDecision = async ({
|
|
239670
240079
|
accountScope,
|
|
239671
240080
|
copyConfirmed,
|
|
@@ -239676,13 +240085,22 @@ var init_gitSigning2 = __esm({
|
|
|
239676
240085
|
projectLayout
|
|
239677
240086
|
}) => {
|
|
239678
240087
|
let plan = previousDecision?.plan ?? null;
|
|
239679
|
-
if (mode !== "skip" && plan
|
|
240088
|
+
if (mode === "copy" || mode !== "skip" && (!plan || plan.profiles.length === 0)) {
|
|
239680
240089
|
plan = await detectDesktopGitSigningSetup({
|
|
239681
240090
|
env: env3,
|
|
239682
240091
|
homeDir: homeDir2,
|
|
239683
240092
|
projectLayout
|
|
239684
240093
|
});
|
|
239685
240094
|
}
|
|
240095
|
+
if (mode === "create") {
|
|
240096
|
+
plan = await buildCreateGitSigningPlan({
|
|
240097
|
+
accountScope,
|
|
240098
|
+
env: env3,
|
|
240099
|
+
homeDir: homeDir2,
|
|
240100
|
+
plan,
|
|
240101
|
+
projectLayout
|
|
240102
|
+
});
|
|
240103
|
+
}
|
|
239686
240104
|
await validateModeSelection({
|
|
239687
240105
|
copyConfirmed,
|
|
239688
240106
|
env: env3,
|
|
@@ -239780,7 +240198,7 @@ var init_gitSigning2 = __esm({
|
|
|
239780
240198
|
}
|
|
239781
240199
|
};
|
|
239782
240200
|
hashFile = async (filePath) => {
|
|
239783
|
-
const hash3 =
|
|
240201
|
+
const hash3 = createHash17("sha256");
|
|
239784
240202
|
const bytes = await fs43.readFile(filePath);
|
|
239785
240203
|
hash3.update(bytes);
|
|
239786
240204
|
return { bytes: bytes.length, sha256: hash3.digest("hex") };
|
|
@@ -240460,7 +240878,7 @@ var init_untrackedFileTree = __esm({
|
|
|
240460
240878
|
});
|
|
240461
240879
|
|
|
240462
240880
|
// ../../../../shared/initPrep/src/editableSetupFileStaging.mjs
|
|
240463
|
-
import { createHash as
|
|
240881
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
240464
240882
|
import fs46 from "node:fs/promises";
|
|
240465
240883
|
import path55 from "node:path";
|
|
240466
240884
|
var EDITABLE_SETUP_FILE_MAX_BYTES, STAGING_FILE_SUFFIXES, resolveStagingFileSuffix, deriveEditableSetupFileStagingId, resolveEditableSetupFileStagingPath, ensurePrivateStagingDir, readEligibleSourceFile, snapshotEditableSetupFile, readEditableSetupFileContents, writeEditableSetupFileContents, deleteEditableSetupFile, pruneEditableSetupFilesByKind;
|
|
@@ -240481,7 +240899,7 @@ var init_editableSetupFileStaging = __esm({
|
|
|
240481
240899
|
}
|
|
240482
240900
|
return suffix;
|
|
240483
240901
|
};
|
|
240484
|
-
deriveEditableSetupFileStagingId = ({ namespace, sourcePath }) =>
|
|
240902
|
+
deriveEditableSetupFileStagingId = ({ namespace, sourcePath }) => createHash18("sha256").update(`${namespace}\0${sourcePath}`, "utf8").digest("hex").slice(0, 32);
|
|
240485
240903
|
resolveEditableSetupFileStagingPath = ({
|
|
240486
240904
|
id: id2,
|
|
240487
240905
|
kind,
|
|
@@ -240741,7 +241159,7 @@ var init_untrackedFileRules = __esm({
|
|
|
240741
241159
|
import { execFile as execFile7, spawn as spawn19 } from "node:child_process";
|
|
240742
241160
|
import {
|
|
240743
241161
|
createCipheriv,
|
|
240744
|
-
createHash as
|
|
241162
|
+
createHash as createHash19,
|
|
240745
241163
|
createPublicKey,
|
|
240746
241164
|
diffieHellman,
|
|
240747
241165
|
generateKeyPairSync,
|
|
@@ -241266,10 +241684,10 @@ var init_localPrepService = __esm({
|
|
|
241266
241684
|
try {
|
|
241267
241685
|
managedTool = await databaseDumpToolResolver({ command, env: env3 });
|
|
241268
241686
|
} catch (resolverError) {
|
|
241269
|
-
const
|
|
241270
|
-
|
|
241271
|
-
|
|
241272
|
-
throw
|
|
241687
|
+
const unavailable2 = createMissingDatabaseDumpToolError(command);
|
|
241688
|
+
unavailable2.message = toErrorMessage(resolverError);
|
|
241689
|
+
unavailable2.userMessage = toErrorMessage(resolverError);
|
|
241690
|
+
throw unavailable2;
|
|
241273
241691
|
}
|
|
241274
241692
|
if (!managedTool) throw error55;
|
|
241275
241693
|
await executeDatabaseDumpCommand(managedTool.command, args, {
|
|
@@ -242374,7 +242792,7 @@ var init_localPrepService = __esm({
|
|
|
242374
242792
|
upload: state.upload,
|
|
242375
242793
|
bundleOptions: state.bundleOptions ?? createBundleOptions(),
|
|
242376
242794
|
forkStartupScript: state.forkStartupScript ?? createForkStartupScriptSetup({ repo: state.repo }),
|
|
242377
|
-
initialProjectConfigurationHash: state.initialProjectConfiguration ?
|
|
242795
|
+
initialProjectConfigurationHash: state.initialProjectConfiguration ? createHash19("sha256").update(JSON.stringify(state.initialProjectConfiguration), "utf8").digest("hex") : null,
|
|
242378
242796
|
gitSigningSetup: state.gitSigningSetup ?? null,
|
|
242379
242797
|
setupReviewState: state.setupReviewState ?? null,
|
|
242380
242798
|
githubAccessMode: state.githubAccessMode ?? null,
|
|
@@ -244535,7 +244953,7 @@ var init_localPrepService = __esm({
|
|
|
244535
244953
|
return (await fs48.stat(outputPath)).size;
|
|
244536
244954
|
};
|
|
244537
244955
|
sha256File3 = async (filePath) => {
|
|
244538
|
-
const hash3 =
|
|
244956
|
+
const hash3 = createHash19("sha256");
|
|
244539
244957
|
const handle = await fs48.open(filePath, "r");
|
|
244540
244958
|
try {
|
|
244541
244959
|
for await (const chunk2 of handle.createReadStream()) {
|
|
@@ -244558,7 +244976,7 @@ var init_localPrepService = __esm({
|
|
|
244558
244976
|
const authTag = cipher.getAuthTag();
|
|
244559
244977
|
const encryptedSizeBytes = (await fs48.stat(outputPath)).size;
|
|
244560
244978
|
const ciphertextSha256 = await sha256File3(outputPath);
|
|
244561
|
-
const dataKeySha256 =
|
|
244979
|
+
const dataKeySha256 = createHash19("sha256").update(dataKey).digest("hex");
|
|
244562
244980
|
return {
|
|
244563
244981
|
dataKey,
|
|
244564
244982
|
dataKeySha256,
|
|
@@ -244619,7 +245037,7 @@ var init_localPrepService = __esm({
|
|
|
244619
245037
|
remotePublicKeyId: remotePublicKey.id,
|
|
244620
245038
|
algorithm: "x25519-aes-256-gcm",
|
|
244621
245039
|
envelopeCiphertextBase64: envelopePayload.toString("base64"),
|
|
244622
|
-
envelopeSha256:
|
|
245040
|
+
envelopeSha256: createHash19("sha256").update(envelopePayload).digest("hex"),
|
|
244623
245041
|
createdAt: nowIso7()
|
|
244624
245042
|
};
|
|
244625
245043
|
};
|
|
@@ -244644,8 +245062,8 @@ var init_localPrepService = __esm({
|
|
|
244644
245062
|
completedParts: []
|
|
244645
245063
|
} : null;
|
|
244646
245064
|
shouldRefreshMultipartUploadUrlsBeforeUpload = (expiresAt) => {
|
|
244647
|
-
const
|
|
244648
|
-
return !Number.isFinite(
|
|
245065
|
+
const timestamp2 = Date.parse(trim10(expiresAt));
|
|
245066
|
+
return !Number.isFinite(timestamp2) || timestamp2 - Date.now() <= MULTIPART_UPLOAD_URL_REFRESH_SKEW_MS;
|
|
244649
245067
|
};
|
|
244650
245068
|
normalizeRepo = (repo) => {
|
|
244651
245069
|
if (!repo || typeof repo !== "object" || Array.isArray(repo)) {
|
|
@@ -249758,11 +250176,11 @@ var init_controlPlane2 = __esm({
|
|
|
249758
250176
|
createAgentInitControlPlaneClient = ({
|
|
249759
250177
|
getToken
|
|
249760
250178
|
}) => {
|
|
249761
|
-
const
|
|
250179
|
+
const query2 = async (reference, request2) => await withConvexClient(
|
|
249762
250180
|
await getToken(),
|
|
249763
250181
|
async (client) => await client.query(reference, request2)
|
|
249764
250182
|
);
|
|
249765
|
-
const
|
|
250183
|
+
const mutation2 = async (reference, request2) => await withConvexClient(
|
|
249766
250184
|
await getToken(),
|
|
249767
250185
|
async (client) => await client.mutation(reference, request2)
|
|
249768
250186
|
);
|
|
@@ -249771,25 +250189,25 @@ var init_controlPlane2 = __esm({
|
|
|
249771
250189
|
async (client) => await client.action(reference, request2)
|
|
249772
250190
|
);
|
|
249773
250191
|
return {
|
|
249774
|
-
preflightDesktopInitProject: (request2) =>
|
|
249775
|
-
upsertDesktopInitRegistryStatus: (request2) =>
|
|
249776
|
-
removeDesktopInitRegistryProject: (request2) =>
|
|
250192
|
+
preflightDesktopInitProject: (request2) => query2(preflightProject, request2),
|
|
250193
|
+
upsertDesktopInitRegistryStatus: (request2) => mutation2(registryUpsert2, request2),
|
|
250194
|
+
removeDesktopInitRegistryProject: (request2) => mutation2(registryRemove, request2),
|
|
249777
250195
|
// Marks the job as agent-driven so the desktop app observes it instead
|
|
249778
250196
|
// of resuming it as its own setup.
|
|
249779
|
-
startOrResumeDesktopInitJob: (request2) =>
|
|
250197
|
+
startOrResumeDesktopInitJob: (request2) => mutation2(startOrResumeJob, { ...request2, startedBy: "agent_init" }),
|
|
249780
250198
|
createDesktopInitUploadSession: (request2) => action(createUploadSession, request2),
|
|
249781
250199
|
refreshDesktopInitMultipartUploadParts: (request2) => action(refreshMultipartUploadParts, request2),
|
|
249782
250200
|
listDesktopInitMultipartUploadedParts: (request2) => action(listMultipartUploadedParts, request2),
|
|
249783
250201
|
completeDesktopInitMultipartUpload: (request2) => action(completeMultipartUpload, request2),
|
|
249784
250202
|
abortDesktopInitMultipartUpload: (request2) => action(abortMultipartUpload, request2),
|
|
249785
|
-
commitDesktopInitUpload: (request2) =>
|
|
249786
|
-
commitDesktopInitDecryptKeyEnvelope: (request2) =>
|
|
249787
|
-
fetchDesktopInitJobProgress: (request2) =>
|
|
249788
|
-
destroyDesktopInitAndStartOver: (request2) =>
|
|
249789
|
-
retryDesktopInitRecoverableFailure: (request2) =>
|
|
249790
|
-
fetchDesktopInitMarkerRepairState: (request2) =>
|
|
249791
|
-
getGithubConnection: (request2) =>
|
|
249792
|
-
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),
|
|
249793
250211
|
listGithubRepositories: (request2) => action(listGithubRepositories, request2),
|
|
249794
250212
|
getGithubInstallTarget: async (request2) => withConvexClient(
|
|
249795
250213
|
await getToken(),
|
|
@@ -250461,7 +250879,7 @@ var init_codingAgents2 = __esm({
|
|
|
250461
250879
|
});
|
|
250462
250880
|
|
|
250463
250881
|
// src/devbox/commands/claudeSetupOauth.ts
|
|
250464
|
-
import { createHash as
|
|
250882
|
+
import { createHash as createHash20, randomBytes as randomBytes14, randomUUID as randomUUID25 } from "node:crypto";
|
|
250465
250883
|
import http10 from "node:http";
|
|
250466
250884
|
import https3 from "node:https";
|
|
250467
250885
|
import { brotliDecompressSync, gunzipSync, inflateSync } from "node:zlib";
|
|
@@ -250519,7 +250937,7 @@ var init_claudeSetupOauth = __esm({
|
|
|
250519
250937
|
};
|
|
250520
250938
|
base64UrlEncode = (buffer) => buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
250521
250939
|
generateClaudeSetupCodeVerifier = () => base64UrlEncode(randomBytes14(32));
|
|
250522
|
-
generateClaudeSetupCodeChallenge = (verifier) => base64UrlEncode(
|
|
250940
|
+
generateClaudeSetupCodeChallenge = (verifier) => base64UrlEncode(createHash20("sha256").update(verifier).digest());
|
|
250523
250941
|
generateClaudeSetupState = () => base64UrlEncode(randomBytes14(32));
|
|
250524
250942
|
buildClaudeSetupAuthorizeUrls = ({
|
|
250525
250943
|
discovery,
|
|
@@ -254799,7 +255217,7 @@ var require_timestamp2 = __commonJS({
|
|
|
254799
255217
|
resolve: (str) => parseSexagesimal(str, false),
|
|
254800
255218
|
stringify: stringifySexagesimal
|
|
254801
255219
|
};
|
|
254802
|
-
var
|
|
255220
|
+
var timestamp2 = {
|
|
254803
255221
|
identify: (value) => value instanceof Date,
|
|
254804
255222
|
default: true,
|
|
254805
255223
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -254808,7 +255226,7 @@ var require_timestamp2 = __commonJS({
|
|
|
254808
255226
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
254809
255227
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
254810
255228
|
resolve(str) {
|
|
254811
|
-
const match = str.match(
|
|
255229
|
+
const match = str.match(timestamp2.test);
|
|
254812
255230
|
if (!match)
|
|
254813
255231
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
254814
255232
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -254827,7 +255245,7 @@ var require_timestamp2 = __commonJS({
|
|
|
254827
255245
|
};
|
|
254828
255246
|
exports.floatTime = floatTime;
|
|
254829
255247
|
exports.intTime = intTime;
|
|
254830
|
-
exports.timestamp =
|
|
255248
|
+
exports.timestamp = timestamp2;
|
|
254831
255249
|
}
|
|
254832
255250
|
});
|
|
254833
255251
|
|
|
@@ -254847,7 +255265,7 @@ var require_schema4 = __commonJS({
|
|
|
254847
255265
|
var omap = require_omap();
|
|
254848
255266
|
var pairs = require_pairs();
|
|
254849
255267
|
var set3 = require_set();
|
|
254850
|
-
var
|
|
255268
|
+
var timestamp2 = require_timestamp2();
|
|
254851
255269
|
var schema = [
|
|
254852
255270
|
map3.map,
|
|
254853
255271
|
seq.seq,
|
|
@@ -254867,9 +255285,9 @@ var require_schema4 = __commonJS({
|
|
|
254867
255285
|
omap.omap,
|
|
254868
255286
|
pairs.pairs,
|
|
254869
255287
|
set3.set,
|
|
254870
|
-
|
|
254871
|
-
|
|
254872
|
-
|
|
255288
|
+
timestamp2.intTime,
|
|
255289
|
+
timestamp2.floatTime,
|
|
255290
|
+
timestamp2.timestamp
|
|
254873
255291
|
];
|
|
254874
255292
|
exports.schema = schema;
|
|
254875
255293
|
}
|
|
@@ -254894,7 +255312,7 @@ var require_tags = __commonJS({
|
|
|
254894
255312
|
var pairs = require_pairs();
|
|
254895
255313
|
var schema$2 = require_schema4();
|
|
254896
255314
|
var set3 = require_set();
|
|
254897
|
-
var
|
|
255315
|
+
var timestamp2 = require_timestamp2();
|
|
254898
255316
|
var schemas = /* @__PURE__ */ new Map([
|
|
254899
255317
|
["core", schema.schema],
|
|
254900
255318
|
["failsafe", [map3.map, seq.seq, string7.string]],
|
|
@@ -254908,11 +255326,11 @@ var require_tags = __commonJS({
|
|
|
254908
255326
|
float: float.float,
|
|
254909
255327
|
floatExp: float.floatExp,
|
|
254910
255328
|
floatNaN: float.floatNaN,
|
|
254911
|
-
floatTime:
|
|
255329
|
+
floatTime: timestamp2.floatTime,
|
|
254912
255330
|
int: int3.int,
|
|
254913
255331
|
intHex: int3.intHex,
|
|
254914
255332
|
intOct: int3.intOct,
|
|
254915
|
-
intTime:
|
|
255333
|
+
intTime: timestamp2.intTime,
|
|
254916
255334
|
map: map3.map,
|
|
254917
255335
|
merge: merge4.merge,
|
|
254918
255336
|
null: _null7.nullTag,
|
|
@@ -254920,7 +255338,7 @@ var require_tags = __commonJS({
|
|
|
254920
255338
|
pairs: pairs.pairs,
|
|
254921
255339
|
seq: seq.seq,
|
|
254922
255340
|
set: set3.set,
|
|
254923
|
-
timestamp:
|
|
255341
|
+
timestamp: timestamp2.timestamp
|
|
254924
255342
|
};
|
|
254925
255343
|
var coreKnownTags = {
|
|
254926
255344
|
"tag:yaml.org,2002:binary": binary.binary,
|
|
@@ -254928,7 +255346,7 @@ var require_tags = __commonJS({
|
|
|
254928
255346
|
"tag:yaml.org,2002:omap": omap.omap,
|
|
254929
255347
|
"tag:yaml.org,2002:pairs": pairs.pairs,
|
|
254930
255348
|
"tag:yaml.org,2002:set": set3.set,
|
|
254931
|
-
"tag:yaml.org,2002:timestamp":
|
|
255349
|
+
"tag:yaml.org,2002:timestamp": timestamp2.timestamp
|
|
254932
255350
|
};
|
|
254933
255351
|
function getTags(customTags, schemaName, addMergeTag) {
|
|
254934
255352
|
const schemaTags = schemas.get(schemaName);
|
|
@@ -260751,7 +261169,7 @@ var init_commandCore = __esm({
|
|
|
260751
261169
|
});
|
|
260752
261170
|
|
|
260753
261171
|
// src/devbox/agentInit/manifest/check.ts
|
|
260754
|
-
import { createHash as
|
|
261172
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
260755
261173
|
import fs52 from "node:fs/promises";
|
|
260756
261174
|
import os25 from "node:os";
|
|
260757
261175
|
import path63 from "node:path";
|
|
@@ -260761,7 +261179,7 @@ var init_check = __esm({
|
|
|
260761
261179
|
"use strict";
|
|
260762
261180
|
init_initPrep();
|
|
260763
261181
|
init_parse6();
|
|
260764
|
-
hashManifestText = (rawText) =>
|
|
261182
|
+
hashManifestText = (rawText) => createHash21("sha256").update(rawText, "utf8").digest("hex");
|
|
260765
261183
|
expandHomePath = (value, homeDir2) => value === "~" || value.startsWith("~/") ? path63.join(homeDir2, value.slice(1)) : value;
|
|
260766
261184
|
pathExists6 = async (target) => {
|
|
260767
261185
|
try {
|
|
@@ -262707,16 +263125,28 @@ var init_detect = __esm({
|
|
|
262707
263125
|
});
|
|
262708
263126
|
|
|
262709
263127
|
// src/devbox/commands/desktopApp.ts
|
|
262710
|
-
import { spawn as spawn20 } from "node:child_process";
|
|
263128
|
+
import { execFile as execFile8, spawn as spawn20 } from "node:child_process";
|
|
262711
263129
|
import { constants as fsConstants3 } from "node:fs";
|
|
262712
263130
|
import { access as access3 } from "node:fs/promises";
|
|
262713
263131
|
import os26 from "node:os";
|
|
262714
263132
|
import path65 from "node:path";
|
|
262715
|
-
|
|
263133
|
+
import { promisify as promisify5 } from "node:util";
|
|
263134
|
+
var execFileAsync4, resolveDesktopAppOs, DESKTOP_APP_NAMES, buildDesktopAppDownloadUrl, trim12, createDesktopThreadQueryValue, DESKTOP_APP_BUNDLE_NAME, DESKTOP_APP_TARGET_PATH, resolveDesktopAppInstallPaths, pathExists7, findInstalledDesktopAppPath, LINUX_DESKTOP_APP_SCHEME_MIME_TYPE, findLinuxDesktopAppEntry, findInstalledDesktopApp, setDesktopAppSelection, buildDesktopAppWorkbenchUrl, buildDesktopAppLink, buildDesktopAppOpenArgs, runDetached, openDesktopApp, openDesktopAppLink;
|
|
262716
263135
|
var init_desktopApp = __esm({
|
|
262717
263136
|
"src/devbox/commands/desktopApp.ts"() {
|
|
262718
263137
|
"use strict";
|
|
262719
263138
|
init_siteUrl();
|
|
263139
|
+
execFileAsync4 = promisify5(execFile8);
|
|
263140
|
+
resolveDesktopAppOs = (platform3) => {
|
|
263141
|
+
if (platform3 === "darwin") return "mac";
|
|
263142
|
+
if (platform3 === "linux") return "linux";
|
|
263143
|
+
return null;
|
|
263144
|
+
};
|
|
263145
|
+
DESKTOP_APP_NAMES = {
|
|
263146
|
+
linux: "Linux app",
|
|
263147
|
+
mac: "Mac app"
|
|
263148
|
+
};
|
|
263149
|
+
buildDesktopAppDownloadUrl = (desktopOs, siteUrl) => new URL(`/${desktopOs}`, siteUrl).toString();
|
|
262720
263150
|
trim12 = (value) => value.trim().replace(/\r/g, "");
|
|
262721
263151
|
createDesktopThreadQueryValue = (threadId2) => `thread:${threadId2}`;
|
|
262722
263152
|
DESKTOP_APP_BUNDLE_NAME = "Boxes.dev.app";
|
|
@@ -262751,6 +263181,37 @@ var init_desktopApp = __esm({
|
|
|
262751
263181
|
}
|
|
262752
263182
|
return null;
|
|
262753
263183
|
};
|
|
263184
|
+
LINUX_DESKTOP_APP_SCHEME_MIME_TYPE = "x-scheme-handler/boxesdesktop";
|
|
263185
|
+
findLinuxDesktopAppEntry = async ({
|
|
263186
|
+
execFileImpl = execFileAsync4
|
|
263187
|
+
} = {}) => {
|
|
263188
|
+
try {
|
|
263189
|
+
const { stdout } = await execFileImpl("xdg-mime", [
|
|
263190
|
+
"query",
|
|
263191
|
+
"default",
|
|
263192
|
+
LINUX_DESKTOP_APP_SCHEME_MIME_TYPE
|
|
263193
|
+
]);
|
|
263194
|
+
return trim12(stdout.toString()) || null;
|
|
263195
|
+
} catch {
|
|
263196
|
+
return null;
|
|
263197
|
+
}
|
|
263198
|
+
};
|
|
263199
|
+
findInstalledDesktopApp = async ({
|
|
263200
|
+
platform: platform3 = process.platform,
|
|
263201
|
+
findMacAppPath = findInstalledDesktopAppPath,
|
|
263202
|
+
findLinuxEntry = findLinuxDesktopAppEntry
|
|
263203
|
+
} = {}) => {
|
|
263204
|
+
const desktopOs = resolveDesktopAppOs(platform3);
|
|
263205
|
+
if (desktopOs === "mac") {
|
|
263206
|
+
const appPath = await findMacAppPath();
|
|
263207
|
+
return appPath === null ? null : { os: "mac", appPath };
|
|
263208
|
+
}
|
|
263209
|
+
if (desktopOs === "linux") {
|
|
263210
|
+
const desktopEntry = await findLinuxEntry();
|
|
263211
|
+
return desktopEntry === null ? null : { os: "linux", desktopEntry };
|
|
263212
|
+
}
|
|
263213
|
+
return null;
|
|
263214
|
+
};
|
|
262754
263215
|
setDesktopAppSelection = (url3, { alias, clientThreadId }) => {
|
|
262755
263216
|
url3.searchParams.set("box", trim12(alias));
|
|
262756
263217
|
const trimmedThreadId = trim12(clientThreadId ?? "");
|
|
@@ -262774,9 +263235,9 @@ var init_desktopApp = __esm({
|
|
|
262774
263235
|
}
|
|
262775
263236
|
return ["-a", appPath, "--args", "--start-url", trimmedStartUrl];
|
|
262776
263237
|
};
|
|
262777
|
-
|
|
263238
|
+
runDetached = (command, args, spawnImpl) => {
|
|
262778
263239
|
try {
|
|
262779
|
-
const child = spawnImpl(
|
|
263240
|
+
const child = spawnImpl(command, args, {
|
|
262780
263241
|
detached: true,
|
|
262781
263242
|
stdio: "ignore"
|
|
262782
263243
|
});
|
|
@@ -262790,12 +263251,16 @@ var init_desktopApp = __esm({
|
|
|
262790
263251
|
appPath,
|
|
262791
263252
|
startUrl,
|
|
262792
263253
|
spawnImpl = spawn20
|
|
262793
|
-
}) =>
|
|
263254
|
+
}) => runDetached(
|
|
263255
|
+
"open",
|
|
263256
|
+
buildDesktopAppOpenArgs({ appPath, startUrl }),
|
|
263257
|
+
spawnImpl
|
|
263258
|
+
);
|
|
262794
263259
|
openDesktopAppLink = ({
|
|
262795
|
-
|
|
263260
|
+
app,
|
|
262796
263261
|
link: link2,
|
|
262797
263262
|
spawnImpl = spawn20
|
|
262798
|
-
}) =>
|
|
263263
|
+
}) => app.os === "mac" ? runDetached("open", ["-a", app.appPath, link2], spawnImpl) : runDetached("xdg-open", [link2], spawnImpl);
|
|
262799
263264
|
}
|
|
262800
263265
|
});
|
|
262801
263266
|
|
|
@@ -262809,25 +263274,26 @@ var init_desktopHandoff = __esm({
|
|
|
262809
263274
|
init_siteUrl();
|
|
262810
263275
|
init_remoteSession();
|
|
262811
263276
|
resolveDesktopHandoff = ({
|
|
262812
|
-
|
|
263277
|
+
installedApp,
|
|
262813
263278
|
platform: platform3,
|
|
262814
263279
|
remote
|
|
262815
263280
|
}) => {
|
|
262816
|
-
|
|
262817
|
-
|
|
263281
|
+
const desktopOs = resolveDesktopAppOs(platform3);
|
|
263282
|
+
if (remote || desktopOs === null) return { kind: "mobile_app" };
|
|
263283
|
+
return installedApp === null ? { kind: "download_desktop_app", os: desktopOs } : { kind: "open_desktop_app", app: installedApp };
|
|
262818
263284
|
};
|
|
262819
263285
|
detectDesktopHandoff = async () => resolveDesktopHandoff({
|
|
262820
|
-
|
|
263286
|
+
installedApp: await findInstalledDesktopApp(),
|
|
262821
263287
|
platform: process.platform,
|
|
262822
263288
|
remote: isRemoteShellSession()
|
|
262823
263289
|
});
|
|
262824
263290
|
buildSetupThreadHandoffMessage = (handoff, siteUrl) => {
|
|
262825
263291
|
const started = "The setup thread has started on the Template box, and this command will keep running.";
|
|
262826
|
-
switch (handoff) {
|
|
262827
|
-
case "
|
|
262828
|
-
return `${started} Offer to open it in the boxes.dev
|
|
262829
|
-
case "
|
|
262830
|
-
return `${started} Tell the user they can follow it in the boxes.dev
|
|
263292
|
+
switch (handoff.kind) {
|
|
263293
|
+
case "open_desktop_app":
|
|
263294
|
+
return `${started} Offer to open it in the boxes.dev ${DESKTOP_APP_NAMES[handoff.app.os]}. If the user agrees, run \`dvb agent-init open-desktop\`. When setup finishes, this command will open the app on the setup thread.`;
|
|
263295
|
+
case "download_desktop_app":
|
|
263296
|
+
return `${started} Tell the user they can follow it in the boxes.dev ${DESKTOP_APP_NAMES[handoff.os]} and give them the download link: ${buildDesktopAppDownloadUrl(handoff.os, siteUrl)}`;
|
|
262831
263297
|
case "mobile_app":
|
|
262832
263298
|
return `${started} Tell the user they can follow it in the boxes.dev mobile app: ${siteUrl}/m`;
|
|
262833
263299
|
}
|
|
@@ -262849,15 +263315,15 @@ var init_desktopHandoff = __esm({
|
|
|
262849
263315
|
siteUrl
|
|
262850
263316
|
}) => {
|
|
262851
263317
|
const otherOptions = buildTerminalAndMobileOptions({ alias, siteUrl });
|
|
262852
|
-
switch (handoff) {
|
|
262853
|
-
case "
|
|
263318
|
+
switch (handoff.kind) {
|
|
263319
|
+
case "open_desktop_app":
|
|
262854
263320
|
return [
|
|
262855
|
-
|
|
263321
|
+
`open it in the boxes.dev ${DESKTOP_APP_NAMES[handoff.app.os]} (run \`dvb agent-init open-desktop\`)`,
|
|
262856
263322
|
...otherOptions
|
|
262857
263323
|
];
|
|
262858
|
-
case "
|
|
263324
|
+
case "download_desktop_app":
|
|
262859
263325
|
return [
|
|
262860
|
-
`open it in the boxes.dev
|
|
263326
|
+
`open it in the boxes.dev ${DESKTOP_APP_NAMES[handoff.os]}, which they can download from ${buildDesktopAppDownloadUrl(handoff.os, siteUrl)}`,
|
|
262861
263327
|
...otherOptions
|
|
262862
263328
|
];
|
|
262863
263329
|
case "mobile_app":
|
|
@@ -262866,7 +263332,7 @@ var init_desktopHandoff = __esm({
|
|
|
262866
263332
|
};
|
|
262867
263333
|
readSetupThreadId = (job) => typeof job?.["setupThreadId"] === "string" && job["setupThreadId"] !== "" ? job["setupThreadId"] : null;
|
|
262868
263334
|
openSetupInDesktopApp = async ({
|
|
262869
|
-
|
|
263335
|
+
app,
|
|
262870
263336
|
context: context34,
|
|
262871
263337
|
repo,
|
|
262872
263338
|
setupThreadId
|
|
@@ -262877,13 +263343,14 @@ var init_desktopHandoff = __esm({
|
|
|
262877
263343
|
setupThreadId
|
|
262878
263344
|
);
|
|
262879
263345
|
const link2 = buildDesktopAppLink({ alias: repo.alias, clientThreadId });
|
|
262880
|
-
|
|
263346
|
+
const appName = DESKTOP_APP_NAMES[app.os];
|
|
263347
|
+
if (!openDesktopAppLink({ app, link: link2 })) {
|
|
262881
263348
|
throw new Error(
|
|
262882
|
-
`Couldn't open the boxes.dev
|
|
263349
|
+
app.os === "mac" ? `Couldn't open the boxes.dev ${appName}. Ask the user to open it from ${app.appPath}.` : `Couldn't open the boxes.dev ${appName}. Ask the user to open boxes.dev from their applications menu.`
|
|
262883
263350
|
);
|
|
262884
263351
|
}
|
|
262885
263352
|
console.log(
|
|
262886
|
-
setupThreadId === null ? `Opened the boxes.dev
|
|
263353
|
+
setupThreadId === null ? `Opened the boxes.dev ${appName} on ${repo.alias}.` : `Opened the boxes.dev ${appName} on the setup thread for ${repo.alias}.`
|
|
262887
263354
|
);
|
|
262888
263355
|
};
|
|
262889
263356
|
reportCompletedSetup = async ({
|
|
@@ -262895,21 +263362,16 @@ var init_desktopHandoff = __esm({
|
|
|
262895
263362
|
console.log(`Template box setup is complete: ${repo.alias}`);
|
|
262896
263363
|
console.log("");
|
|
262897
263364
|
const siteUrl = resolveSiteUrl();
|
|
262898
|
-
const
|
|
262899
|
-
|
|
262900
|
-
installedAppPath: appPath,
|
|
262901
|
-
platform: process.platform,
|
|
262902
|
-
remote: isRemoteShellSession()
|
|
262903
|
-
});
|
|
262904
|
-
if (handoff === "open_mac_app" && appPath !== null) {
|
|
263365
|
+
const handoff = await detectDesktopHandoff();
|
|
263366
|
+
if (handoff.kind === "open_desktop_app") {
|
|
262905
263367
|
await openSetupInDesktopApp({
|
|
262906
|
-
|
|
263368
|
+
app: handoff.app,
|
|
262907
263369
|
context: context34,
|
|
262908
263370
|
repo,
|
|
262909
263371
|
setupThreadId: readSetupThreadId(job)
|
|
262910
263372
|
});
|
|
262911
263373
|
console.log(
|
|
262912
|
-
|
|
263374
|
+
`Tell the user their Template box is ready and the setup thread is open in the boxes.dev ${DESKTOP_APP_NAMES[handoff.app.os]}. They can also:`
|
|
262913
263375
|
);
|
|
262914
263376
|
for (const option of buildTerminalAndMobileOptions({
|
|
262915
263377
|
alias: repo.alias,
|
|
@@ -263736,22 +264198,23 @@ var init_openDesktop = __esm({
|
|
|
263736
264198
|
};
|
|
263737
264199
|
runAgentInitOpenDesktop = async (args) => {
|
|
263738
264200
|
const { projectPath } = parseOpenDesktopArgs(args);
|
|
263739
|
-
|
|
264201
|
+
const desktopOs = resolveDesktopAppOs(process.platform);
|
|
264202
|
+
if (desktopOs === null) {
|
|
263740
264203
|
throw new Error(
|
|
263741
|
-
`The boxes.dev desktop app is only available for macOS. The user can follow setup in the mobile app instead: ${resolveSiteUrl()}/m`
|
|
264204
|
+
`The boxes.dev desktop app is only available for macOS and Linux. The user can follow setup in the mobile app instead: ${resolveSiteUrl()}/m`
|
|
263742
264205
|
);
|
|
263743
264206
|
}
|
|
263744
|
-
const
|
|
263745
|
-
if (
|
|
264207
|
+
const app = await findInstalledDesktopApp();
|
|
264208
|
+
if (app === null) {
|
|
263746
264209
|
throw new Error(
|
|
263747
|
-
`The boxes.dev
|
|
264210
|
+
`The boxes.dev ${DESKTOP_APP_NAMES[desktopOs]} isn't installed. Give the user the download link: ${buildDesktopAppDownloadUrl(desktopOs, resolveSiteUrl())}`
|
|
263748
264211
|
);
|
|
263749
264212
|
}
|
|
263750
264213
|
const { context: context34, repo } = await resolveAgentInitProject({ projectPath });
|
|
263751
264214
|
const progress = await fetchJobProgress({ context: context34, jobId: null, repo });
|
|
263752
264215
|
const job = progress && isRecord15(progress["job"]) ? progress["job"] : null;
|
|
263753
264216
|
await openSetupInDesktopApp({
|
|
263754
|
-
|
|
264217
|
+
app,
|
|
263755
264218
|
context: context34,
|
|
263756
264219
|
repo,
|
|
263757
264220
|
setupThreadId: readSetupThreadId(job)
|
|
@@ -265313,7 +265776,7 @@ var init_agentInit = __esm({
|
|
|
265313
265776
|
" run Execute the approved manifest end to end",
|
|
265314
265777
|
" status Current state and next action (poll-safe, supports --json)",
|
|
265315
265778
|
" watch Attach to a running setup and stream progress",
|
|
265316
|
-
" open-desktop Open the boxes.dev
|
|
265779
|
+
" open-desktop Open the boxes.dev desktop app on the setup thread",
|
|
265317
265780
|
" retry Retry a recoverable remote failure",
|
|
265318
265781
|
" destroy Destroy the incomplete setup and start over (keeps the manifest)",
|
|
265319
265782
|
" diagnostics Redacted local+remote state dump for debugging"
|
|
@@ -271703,7 +272166,7 @@ ${usageText}`;
|
|
|
271703
272166
|
});
|
|
271704
272167
|
|
|
271705
272168
|
// src/devbox/commands/init/codex/artifacts.ts
|
|
271706
|
-
import { createHash as
|
|
272169
|
+
import { createHash as createHash22, randomUUID as randomUUID29 } from "node:crypto";
|
|
271707
272170
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
271708
272171
|
import fsSync from "node:fs";
|
|
271709
272172
|
import fs63 from "node:fs/promises";
|
|
@@ -271924,7 +272387,7 @@ var init_artifacts = __esm({
|
|
|
271924
272387
|
return totalBytes;
|
|
271925
272388
|
};
|
|
271926
272389
|
sha256File4 = async (filePath) => await new Promise((resolve3, reject) => {
|
|
271927
|
-
const hash3 =
|
|
272390
|
+
const hash3 = createHash22("sha256");
|
|
271928
272391
|
const stream = createReadStream2(filePath);
|
|
271929
272392
|
stream.on("data", (chunk2) => hash3.update(chunk2));
|
|
271930
272393
|
stream.on("error", reject);
|
|
@@ -274947,7 +275410,7 @@ var init_setupArtifactsValidation = __esm({
|
|
|
274947
275410
|
});
|
|
274948
275411
|
|
|
274949
275412
|
// src/devbox/commands/init/databaseCopy.ts
|
|
274950
|
-
import { createHash as
|
|
275413
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
274951
275414
|
import { parseEnv } from "node:util";
|
|
274952
275415
|
import path80 from "node:path";
|
|
274953
275416
|
import fs66 from "node:fs/promises";
|
|
@@ -275040,7 +275503,7 @@ var init_databaseCopy = __esm({
|
|
|
275040
275503
|
const { statePath } = resolveDatabaseCopyPaths(projectDir);
|
|
275041
275504
|
await writeSecureJson(statePath, state);
|
|
275042
275505
|
};
|
|
275043
|
-
buildDatabaseSelectionFingerprint = (databaseCopies) =>
|
|
275506
|
+
buildDatabaseSelectionFingerprint = (databaseCopies) => createHash23("sha256").update(JSON.stringify(databaseCopies)).digest("hex");
|
|
275044
275507
|
DATABASE_SOURCE_FINGERPRINT_ROLES = [
|
|
275045
275508
|
"url",
|
|
275046
275509
|
"host",
|
|
@@ -275104,7 +275567,7 @@ var init_databaseCopy = __esm({
|
|
|
275104
275567
|
repoRoot,
|
|
275105
275568
|
homeDir: homeDir2
|
|
275106
275569
|
});
|
|
275107
|
-
const credentialsFingerprint = credentialsPath ?
|
|
275570
|
+
const credentialsFingerprint = credentialsPath ? createHash23("sha256").update(await fs66.readFile(credentialsPath)).digest("hex") : null;
|
|
275108
275571
|
return {
|
|
275109
275572
|
id: candidate.id,
|
|
275110
275573
|
engine: candidate.engine,
|
|
@@ -275115,7 +275578,7 @@ var init_databaseCopy = __esm({
|
|
|
275115
275578
|
};
|
|
275116
275579
|
})
|
|
275117
275580
|
);
|
|
275118
|
-
return
|
|
275581
|
+
return createHash23("sha256").update(JSON.stringify(resolvedInputs)).digest("hex");
|
|
275119
275582
|
};
|
|
275120
275583
|
getRefValuesForRole = (candidate, role) => candidate.source.refs.filter(
|
|
275121
275584
|
(ref) => (ref.kind === "env_var" || ref.kind === "env_file") && ref.role === role
|
|
@@ -277783,7 +278246,7 @@ var init_projectLayout = __esm({
|
|
|
277783
278246
|
});
|
|
277784
278247
|
|
|
277785
278248
|
// src/devbox/commands/init/provisionFlow.ts
|
|
277786
|
-
import { createHash as
|
|
278249
|
+
import { createHash as createHash24, randomUUID as randomUUID31 } from "node:crypto";
|
|
277787
278250
|
import path85 from "node:path";
|
|
277788
278251
|
import fs70 from "node:fs/promises";
|
|
277789
278252
|
import os33 from "node:os";
|
|
@@ -277963,7 +278426,7 @@ var init_provisionFlow = __esm({
|
|
|
277963
278426
|
);
|
|
277964
278427
|
}
|
|
277965
278428
|
try {
|
|
277966
|
-
const hash3 =
|
|
278429
|
+
const hash3 = createHash24("sha256");
|
|
277967
278430
|
for (const partPath of plan.partPaths) {
|
|
277968
278431
|
if (uploadedBytes >= sizeBytes) break;
|
|
277969
278432
|
const bytesRemaining = sizeBytes - uploadedBytes;
|
|
@@ -278489,12 +278952,10 @@ var init_provisionFlow = __esm({
|
|
|
278489
278952
|
if (process.stdin.isTTY && !parsed.json) {
|
|
278490
278953
|
status.stage("Inspecting project repos");
|
|
278491
278954
|
}
|
|
278492
|
-
return repoStates.map(
|
|
278493
|
-
|
|
278494
|
-
|
|
278495
|
-
|
|
278496
|
-
})
|
|
278497
|
-
);
|
|
278955
|
+
return repoStates.map((entry) => ({
|
|
278956
|
+
...entry,
|
|
278957
|
+
copyWorktree: Boolean(entry.headState.commit) && hasWorktreeChanges(entry.worktreeState) && copyWorktree
|
|
278958
|
+
}));
|
|
278498
278959
|
}
|
|
278499
278960
|
});
|
|
278500
278961
|
const packaged = await runInitStep({
|
|
@@ -281469,7 +281930,7 @@ var init_setupAgents = __esm({
|
|
|
281469
281930
|
|
|
281470
281931
|
// src/devbox/commands/setup.ts
|
|
281471
281932
|
import { spawn as spawn24 } from "node:child_process";
|
|
281472
|
-
import { createHash as
|
|
281933
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
281473
281934
|
import {
|
|
281474
281935
|
createReadStream as createReadStream3,
|
|
281475
281936
|
createWriteStream as createWriteStream2,
|
|
@@ -281480,7 +281941,7 @@ import os35 from "node:os";
|
|
|
281480
281941
|
import path87 from "node:path";
|
|
281481
281942
|
import { Readable as Readable2 } from "node:stream";
|
|
281482
281943
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
281483
|
-
var trim15, readManagedCodexAuthCache, resolveE2bAuthMode, MOBILE_DOWNLOAD_LINK, MAC_DESKTOP_DOWNLOAD_MANIFEST_URL, MAC_DESKTOP_DOWNLOAD_LINK, SHA256_PATTERN, requireManifestString, requireManifestNumber, parseDesktopDownloadManifest, parseSetupArgs2, splitQrLines, hasMobileAppInstallAcknowledgement, shouldOfferMobileAppInstall, mobileAppInstallPrompt, printMobileDownloadQr, saveMobileAppInstallAcknowledgement, maybeConfirmMobileAppInstalled, shouldOfferDesktopAppInstall, shellEscape4, appleScriptEscape, formatCommandFailure2, runCommand8, downloadFile, fetchDesktopDownloadManifest, calculateFileSha256, verifyDesktopDmgDownload, attachDmg, detachDmg, isWritable, buildInstallScript, installDesktopAppToApplications, printDesktopDownloadOffer, firstSetupCompleteMessage, desktopAppInstallPrompt, desktopAppLaunchPrompt, shouldOfferDesktopAppLaunch, installDesktopAppFromDownload, ensureDesktopAppInstalledForInit, maybeOfferDesktopAppInstall, maybeOfferDesktopAppLaunch, printFirstSetupCompleteMessage, runSetupWithParsedArgs, runSetup, buildSetupArgsForInit, runSetupForInit;
|
|
281944
|
+
var trim15, readManagedCodexAuthCache, resolveE2bAuthMode, MOBILE_DOWNLOAD_LINK, MAC_DESKTOP_DOWNLOAD_MANIFEST_URL, MAC_DESKTOP_DOWNLOAD_LINK, LINUX_DESKTOP_DOWNLOAD_LINK, SHA256_PATTERN, requireManifestString, requireManifestNumber, parseDesktopDownloadManifest, parseSetupArgs2, splitQrLines, hasMobileAppInstallAcknowledgement, shouldOfferMobileAppInstall, mobileAppInstallPrompt, printMobileDownloadQr, saveMobileAppInstallAcknowledgement, maybeConfirmMobileAppInstalled, shouldOfferDesktopAppInstall, shellEscape4, appleScriptEscape, formatCommandFailure2, runCommand8, downloadFile, fetchDesktopDownloadManifest, calculateFileSha256, verifyDesktopDmgDownload, attachDmg, detachDmg, isWritable, buildInstallScript, installDesktopAppToApplications, printDesktopDownloadOffer, shouldShowLinuxDesktopAppDownload, firstSetupCompleteMessage, desktopAppInstallPrompt, desktopAppLaunchPrompt, shouldOfferDesktopAppLaunch, installDesktopAppFromDownload, ensureDesktopAppInstalledForInit, printLinuxDesktopAppDownload, maybeOfferDesktopAppInstall, maybeOfferDesktopAppLaunch, linuxDesktopAppLaunchPrompt, maybeOfferLinuxDesktopAppLaunch, printFirstSetupCompleteMessage, runSetupWithParsedArgs, runSetup, buildSetupArgsForInit, runSetupForInit;
|
|
281484
281945
|
var init_setup = __esm({
|
|
281485
281946
|
"src/devbox/commands/setup.ts"() {
|
|
281486
281947
|
"use strict";
|
|
@@ -281504,6 +281965,7 @@ var init_setup = __esm({
|
|
|
281504
281965
|
init_managedCodex();
|
|
281505
281966
|
init_setupAgents();
|
|
281506
281967
|
init_desktopApp();
|
|
281968
|
+
init_remoteSession();
|
|
281507
281969
|
init_managedCodexAuth();
|
|
281508
281970
|
trim15 = (value) => value.trim().replace(/\r/g, "");
|
|
281509
281971
|
readManagedCodexAuthCache = async (homeDir2, accountScope) => {
|
|
@@ -281528,6 +281990,10 @@ var init_setup = __esm({
|
|
|
281528
281990
|
label: "Desktop (macOS)",
|
|
281529
281991
|
url: new URL("/mac", resolveSiteUrl()).toString()
|
|
281530
281992
|
};
|
|
281993
|
+
LINUX_DESKTOP_DOWNLOAD_LINK = {
|
|
281994
|
+
label: "Desktop (Linux)",
|
|
281995
|
+
url: new URL("/linux", resolveSiteUrl()).toString()
|
|
281996
|
+
};
|
|
281531
281997
|
SHA256_PATTERN = /^[a-f0-9]{64}$/u;
|
|
281532
281998
|
requireManifestString = (value, label) => {
|
|
281533
281999
|
if (typeof value !== "string" || value.trim() === "") {
|
|
@@ -281750,7 +282216,7 @@ var init_setup = __esm({
|
|
|
281750
282216
|
return parseDesktopDownloadManifest(payload);
|
|
281751
282217
|
};
|
|
281752
282218
|
calculateFileSha256 = async (filePath) => await new Promise((resolve3, reject) => {
|
|
281753
|
-
const hash3 =
|
|
282219
|
+
const hash3 = createHash25("sha256");
|
|
281754
282220
|
const stream = createReadStream3(filePath);
|
|
281755
282221
|
stream.on("data", (chunk2) => hash3.update(chunk2));
|
|
281756
282222
|
stream.on("error", reject);
|
|
@@ -281824,12 +282290,21 @@ var init_setup = __esm({
|
|
|
281824
282290
|
)}" with administrator privileges`
|
|
281825
282291
|
]);
|
|
281826
282292
|
};
|
|
281827
|
-
printDesktopDownloadOffer = (
|
|
281828
|
-
|
|
282293
|
+
printDesktopDownloadOffer = ({
|
|
282294
|
+
link: link2,
|
|
282295
|
+
osName
|
|
282296
|
+
}) => {
|
|
281829
282297
|
console.log(
|
|
281830
|
-
|
|
282298
|
+
colors.boldWhite(`Install the boxes.dev desktop app for ${osName}:`)
|
|
281831
282299
|
);
|
|
282300
|
+
console.log(`${colors.style(link2.label, ["bold", "cyan"])}: ${link2.url}`);
|
|
281832
282301
|
};
|
|
282302
|
+
shouldShowLinuxDesktopAppDownload = ({
|
|
282303
|
+
platform: platform3 = process.platform,
|
|
282304
|
+
stdoutIsTTY = Boolean(process.stdout.isTTY),
|
|
282305
|
+
remote = isRemoteShellSession(),
|
|
282306
|
+
installed
|
|
282307
|
+
}) => platform3 === "linux" && stdoutIsTTY && !remote && !installed;
|
|
281833
282308
|
firstSetupCompleteMessage = {
|
|
281834
282309
|
heading: "boxes.dev setup complete!",
|
|
281835
282310
|
nextStep: "Next step: in your project's folder, ask Claude Code or Codex to run `dvb agent-init` and follow its instructions."
|
|
@@ -281969,21 +282444,37 @@ var init_setup = __esm({
|
|
|
281969
282444
|
const spinner = Ie();
|
|
281970
282445
|
return await installDesktopAppFromDownload({ spinner });
|
|
281971
282446
|
};
|
|
282447
|
+
printLinuxDesktopAppDownload = () => {
|
|
282448
|
+
printDesktopDownloadOffer({
|
|
282449
|
+
link: LINUX_DESKTOP_DOWNLOAD_LINK,
|
|
282450
|
+
osName: "Linux"
|
|
282451
|
+
});
|
|
282452
|
+
console.log("");
|
|
282453
|
+
};
|
|
281972
282454
|
maybeOfferDesktopAppInstall = async () => {
|
|
282455
|
+
if (process.platform === "linux") {
|
|
282456
|
+
const installed = await findLinuxDesktopAppEntry() !== null;
|
|
282457
|
+
if (shouldShowLinuxDesktopAppDownload({ installed })) {
|
|
282458
|
+
printLinuxDesktopAppDownload();
|
|
282459
|
+
}
|
|
282460
|
+
return;
|
|
282461
|
+
}
|
|
281973
282462
|
const installedAppPath = await findInstalledDesktopAppPath();
|
|
281974
282463
|
if (!shouldOfferDesktopAppInstall({ installedAppPath })) {
|
|
281975
|
-
return
|
|
282464
|
+
return;
|
|
281976
282465
|
}
|
|
281977
|
-
printDesktopDownloadOffer(
|
|
282466
|
+
printDesktopDownloadOffer({
|
|
282467
|
+
link: MAC_DESKTOP_DOWNLOAD_LINK,
|
|
282468
|
+
osName: "macOS"
|
|
282469
|
+
});
|
|
281978
282470
|
const decision = await qt(desktopAppInstallPrompt);
|
|
281979
282471
|
if (Ct(decision) || decision === "skip") {
|
|
281980
282472
|
console.log("");
|
|
281981
|
-
return
|
|
282473
|
+
return;
|
|
281982
282474
|
}
|
|
281983
|
-
|
|
282475
|
+
await installDesktopAppFromDownload({
|
|
281984
282476
|
spinner: Ie()
|
|
281985
282477
|
});
|
|
281986
|
-
return outcome.appPath;
|
|
281987
282478
|
};
|
|
281988
282479
|
maybeOfferDesktopAppLaunch = async ({
|
|
281989
282480
|
installedAppPath,
|
|
@@ -282009,6 +282500,28 @@ var init_setup = __esm({
|
|
|
282009
282500
|
console.log("");
|
|
282010
282501
|
return opened;
|
|
282011
282502
|
};
|
|
282503
|
+
linuxDesktopAppLaunchPrompt = {
|
|
282504
|
+
...desktopAppLaunchPrompt,
|
|
282505
|
+
message: "Open the boxes.dev desktop app now?"
|
|
282506
|
+
};
|
|
282507
|
+
maybeOfferLinuxDesktopAppLaunch = async ({
|
|
282508
|
+
app,
|
|
282509
|
+
link: link2
|
|
282510
|
+
}) => {
|
|
282511
|
+
const decision = await qt(linuxDesktopAppLaunchPrompt);
|
|
282512
|
+
if (Ct(decision) || decision === "skip") {
|
|
282513
|
+
console.log("");
|
|
282514
|
+
return false;
|
|
282515
|
+
}
|
|
282516
|
+
const opened = openDesktopAppLink({ app, link: link2 });
|
|
282517
|
+
if (!opened) {
|
|
282518
|
+
console.warn(
|
|
282519
|
+
`Unable to open the boxes.dev desktop app automatically. Run: xdg-open "${link2}"`
|
|
282520
|
+
);
|
|
282521
|
+
}
|
|
282522
|
+
console.log("");
|
|
282523
|
+
return opened;
|
|
282524
|
+
};
|
|
282012
282525
|
printFirstSetupCompleteMessage = () => {
|
|
282013
282526
|
const isTty = process.stdout.isTTY;
|
|
282014
282527
|
const heading = isTty ? `${colors.style("boxes.dev", ["bold", "cyan"])} ${colors.style(
|
|
@@ -282510,7 +283023,7 @@ var init_gitSigningOpenPgp = __esm({
|
|
|
282510
283023
|
});
|
|
282511
283024
|
|
|
282512
283025
|
// src/devbox/commands/init/gitSigningSsh.ts
|
|
282513
|
-
import { createHash as
|
|
283026
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
282514
283027
|
import fs72 from "node:fs/promises";
|
|
282515
283028
|
import path89 from "node:path";
|
|
282516
283029
|
var expandUserPath2, resolveSigningKeyPath2, readFileIfExists4, isPublicSshKeyLine2, parseSshPublicKey2, missingSshPrivateKeyCopyAvailability2, inspectLiteralSshPublicKey2, inspectPublicSshKeyFile2, inspectPrivateSshKeyFile2, inspectSshSigningKey2;
|
|
@@ -282552,7 +283065,7 @@ var init_gitSigningSsh = __esm({
|
|
|
282552
283065
|
try {
|
|
282553
283066
|
const blob = Buffer.from(keyBlob, "base64");
|
|
282554
283067
|
if (blob.length === 0) return null;
|
|
282555
|
-
const fingerprint =
|
|
283068
|
+
const fingerprint = createHash26("sha256").update(blob).digest("base64").replace(/=+$/u, "");
|
|
282556
283069
|
return {
|
|
282557
283070
|
keyType,
|
|
282558
283071
|
publicKey: value.trim(),
|
|
@@ -282773,7 +283286,7 @@ var init_gitSigningSsh = __esm({
|
|
|
282773
283286
|
});
|
|
282774
283287
|
|
|
282775
283288
|
// src/devbox/commands/init/gitSigning.ts
|
|
282776
|
-
import { createHash as
|
|
283289
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
282777
283290
|
import { spawn as spawn25 } from "node:child_process";
|
|
282778
283291
|
import os36 from "node:os";
|
|
282779
283292
|
var uniqueStrings3, buildSpawnEnv3, runLocalCommand3, readEffectiveGitConfig2, normalizeGitSigningFormat2, buildIdentityWarnings2, buildProfileId2, buildIncompleteRepoPlan2, detectOpenPgpRepoPlan2, detectSshRepoPlan2, detectGitSigningRepoPlan2, profileKey2, computeRemoteConfigScope2, deriveSetupStatus2, collectProfiles2, collectCopyUnavailableReasons2, collectWarnings2, detectGitSigningSetup;
|
|
@@ -282855,7 +283368,7 @@ var init_gitSigning3 = __esm({
|
|
|
282855
283368
|
signingKey,
|
|
282856
283369
|
fingerprint
|
|
282857
283370
|
});
|
|
282858
|
-
return
|
|
283371
|
+
return createHash27("sha256").update(stable).digest("hex").slice(0, 16);
|
|
282859
283372
|
};
|
|
282860
283373
|
buildIncompleteRepoPlan2 = ({
|
|
282861
283374
|
repo,
|
|
@@ -283322,7 +283835,7 @@ var init_gitSigning3 = __esm({
|
|
|
283322
283835
|
});
|
|
283323
283836
|
|
|
283324
283837
|
// src/devbox/commands/init/gitSigningPackage.ts
|
|
283325
|
-
import { createHash as
|
|
283838
|
+
import { createHash as createHash28, randomUUID as randomUUID33 } from "node:crypto";
|
|
283326
283839
|
import fs73 from "node:fs/promises";
|
|
283327
283840
|
import path90 from "node:path";
|
|
283328
283841
|
var GitSigningPackagingError, macCopyfileDisabledEnv4, runTar3, ensureFreshDir2, throwSourceMissing2, normalizeArchivePath2, shouldExcludeGpgEntry2, copyFileStrict2, copyGpgHome2, hashFile2, assertCopyAvailable2, prepareOpenPgpProfile2, prepareSshProfile2, prepareGitSigningPayload2;
|
|
@@ -283427,7 +283940,7 @@ var init_gitSigningPackage = __esm({
|
|
|
283427
283940
|
}
|
|
283428
283941
|
};
|
|
283429
283942
|
hashFile2 = async (filePath) => {
|
|
283430
|
-
const hash3 =
|
|
283943
|
+
const hash3 = createHash28("sha256");
|
|
283431
283944
|
const bytes = await fs73.readFile(filePath);
|
|
283432
283945
|
hash3.update(bytes);
|
|
283433
283946
|
return {
|
|
@@ -284934,6 +285447,7 @@ var init_finalizeFlow = __esm({
|
|
|
284934
285447
|
init_servicesToml();
|
|
284935
285448
|
init_servicesConfig();
|
|
284936
285449
|
init_desktopApp();
|
|
285450
|
+
init_remoteSession();
|
|
284937
285451
|
init_setup();
|
|
284938
285452
|
init_progress();
|
|
284939
285453
|
init_projectLayout();
|
|
@@ -285672,22 +286186,25 @@ var init_finalizeFlow = __esm({
|
|
|
285672
286186
|
runCompanionAppOnboardingDuringInit = async ({
|
|
285673
286187
|
getInitState,
|
|
285674
286188
|
updateInitState,
|
|
285675
|
-
|
|
286189
|
+
desktopAppSelection = null,
|
|
285676
286190
|
loadConfigFn = loadConfig,
|
|
285677
286191
|
maybeConfirmMobileAppInstalledFn = maybeConfirmMobileAppInstalled,
|
|
285678
286192
|
maybeOfferDesktopAppLaunchFn = maybeOfferDesktopAppLaunch,
|
|
285679
286193
|
ensureDesktopAppInstalledForInitFn = ensureDesktopAppInstalledForInit,
|
|
285680
286194
|
findInstalledDesktopAppPathFn = findInstalledDesktopAppPath,
|
|
286195
|
+
findLinuxDesktopAppEntryFn = findLinuxDesktopAppEntry,
|
|
286196
|
+
maybeOfferLinuxDesktopAppLaunchFn = maybeOfferLinuxDesktopAppLaunch,
|
|
285681
286197
|
platform: platform3 = process.platform,
|
|
286198
|
+
remote = isRemoteShellSession(),
|
|
285682
286199
|
stdinIsTTY = Boolean(process.stdin.isTTY),
|
|
285683
286200
|
stdoutIsTTY = Boolean(process.stdout.isTTY)
|
|
285684
286201
|
}) => {
|
|
285685
286202
|
const currentSteps = getInitState()?.steps;
|
|
285686
286203
|
const homeDir2 = process.env.HOME;
|
|
285687
286204
|
const config5 = await loadConfigFn(homeDir2 ? { homeDir: homeDir2 } : void 0);
|
|
285688
|
-
const
|
|
285689
|
-
|
|
285690
|
-
);
|
|
286205
|
+
const desktopOs = resolveDesktopAppOs(platform3);
|
|
286206
|
+
const installedDesktopAppPath = desktopOs === "mac" ? await findInstalledDesktopAppPathFn(homeDir2 ? { homeDir: homeDir2 } : void 0) : null;
|
|
286207
|
+
const linuxDesktopAppEntry = desktopOs === "linux" && !remote ? await findLinuxDesktopAppEntryFn() : null;
|
|
285691
286208
|
const mobileAlreadyAcknowledged = hasMobileAppInstallAcknowledgement2(
|
|
285692
286209
|
config5?.mobileAppInstalledAt
|
|
285693
286210
|
);
|
|
@@ -285697,7 +286214,8 @@ var init_finalizeFlow = __esm({
|
|
|
285697
286214
|
config: config5
|
|
285698
286215
|
});
|
|
285699
286216
|
const shouldMarkMobileInstalled = !currentSteps?.mobileAppInstalled && mobileAlreadyAcknowledged;
|
|
285700
|
-
const
|
|
286217
|
+
const shouldHandleLinuxDesktop = desktopOs === "linux" && !remote && stdinIsTTY && stdoutIsTTY;
|
|
286218
|
+
const shouldHandleDesktop = !currentSteps?.desktopAppInstalled && (shouldHandleLinuxDesktop || shouldOfferDesktopAppInstall({
|
|
285701
286219
|
platform: platform3,
|
|
285702
286220
|
stdinIsTTY,
|
|
285703
286221
|
stdoutIsTTY,
|
|
@@ -285718,9 +286236,10 @@ var init_finalizeFlow = __esm({
|
|
|
285718
286236
|
if (!shouldPromptMobile && !shouldHandleDesktop) {
|
|
285719
286237
|
return;
|
|
285720
286238
|
}
|
|
286239
|
+
const desktopAppName = DESKTOP_APP_NAMES[desktopOs === "linux" ? "linux" : "mac"];
|
|
285721
286240
|
console.log("");
|
|
285722
286241
|
console.log(
|
|
285723
|
-
shouldPromptMobile && shouldHandleDesktop ?
|
|
286242
|
+
shouldPromptMobile && shouldHandleDesktop ? `While remote setup runs, set up the ${desktopAppName} and mobile app.` : shouldHandleDesktop ? `While remote setup runs, set up the ${desktopAppName}.` : "While remote setup runs, set up the mobile app."
|
|
285724
286243
|
);
|
|
285725
286244
|
console.log("");
|
|
285726
286245
|
if (shouldPromptMobile) {
|
|
@@ -285742,6 +286261,26 @@ var init_finalizeFlow = __esm({
|
|
|
285742
286261
|
if (!shouldHandleDesktop) {
|
|
285743
286262
|
return;
|
|
285744
286263
|
}
|
|
286264
|
+
if (desktopOs === "linux") {
|
|
286265
|
+
if (linuxDesktopAppEntry === null) {
|
|
286266
|
+
printLinuxDesktopAppDownload();
|
|
286267
|
+
return;
|
|
286268
|
+
}
|
|
286269
|
+
await updateInitState({
|
|
286270
|
+
steps: {
|
|
286271
|
+
desktopAppInstalled: true
|
|
286272
|
+
}
|
|
286273
|
+
});
|
|
286274
|
+
const launchedDesktopApp = desktopAppSelection !== null && await maybeOfferLinuxDesktopAppLaunchFn({
|
|
286275
|
+
app: { os: "linux", desktopEntry: linuxDesktopAppEntry },
|
|
286276
|
+
link: buildDesktopAppLink(desktopAppSelection)
|
|
286277
|
+
});
|
|
286278
|
+
console.log(
|
|
286279
|
+
launchedDesktopApp ? "Follow the remote setup thread in the `Boxes.dev` desktop app." : "Open `Boxes.dev` desktop app to follow the remote setup thread."
|
|
286280
|
+
);
|
|
286281
|
+
console.log("");
|
|
286282
|
+
return;
|
|
286283
|
+
}
|
|
285745
286284
|
const desktopOutcome = await ensureDesktopAppInstalledForInitFn({
|
|
285746
286285
|
platform: platform3,
|
|
285747
286286
|
stdinIsTTY,
|
|
@@ -285755,7 +286294,7 @@ var init_finalizeFlow = __esm({
|
|
|
285755
286294
|
});
|
|
285756
286295
|
const launchedDesktopApp = await maybeOfferDesktopAppLaunchFn({
|
|
285757
286296
|
installedAppPath: desktopOutcome.appPath,
|
|
285758
|
-
startUrl:
|
|
286297
|
+
startUrl: desktopAppSelection === null ? null : buildDesktopAppWorkbenchUrl(desktopAppSelection)
|
|
285759
286298
|
});
|
|
285760
286299
|
console.log(
|
|
285761
286300
|
launchedDesktopApp ? "Follow the remote setup thread in the `Boxes.dev` desktop app." : "Open `Boxes.dev` desktop app to follow the remote setup thread."
|
|
@@ -286291,10 +286830,7 @@ var init_finalizeFlow = __esm({
|
|
|
286291
286830
|
await runCompanionAppOnboardingDuringInit({
|
|
286292
286831
|
getInitState,
|
|
286293
286832
|
updateInitState,
|
|
286294
|
-
|
|
286295
|
-
alias,
|
|
286296
|
-
clientThreadId
|
|
286297
|
-
})
|
|
286833
|
+
desktopAppSelection: { alias, clientThreadId }
|
|
286298
286834
|
});
|
|
286299
286835
|
}
|
|
286300
286836
|
});
|
|
@@ -286365,10 +286901,10 @@ var init_finalizeFlow = __esm({
|
|
|
286365
286901
|
await runCompanionAppOnboardingDuringInit({
|
|
286366
286902
|
getInitState,
|
|
286367
286903
|
updateInitState,
|
|
286368
|
-
|
|
286904
|
+
desktopAppSelection: {
|
|
286369
286905
|
alias,
|
|
286370
286906
|
clientThreadId: await resolveDesktopSetupClientThreadId(threadId2)
|
|
286371
|
-
}
|
|
286907
|
+
}
|
|
286372
286908
|
});
|
|
286373
286909
|
} finally {
|
|
286374
286910
|
statusPaused = false;
|
|
@@ -291296,6 +291832,660 @@ var init_mcp = __esm({
|
|
|
291296
291832
|
}
|
|
291297
291833
|
});
|
|
291298
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
|
+
|
|
291299
292489
|
// src/devbox/commands/power.ts
|
|
291300
292490
|
var parsePowerArgs, resolveTargetInstance2, resolveRequestedTarget, requireE2bTarget, parseSleepArgs, parseWakeArgs, runSleep, runWake;
|
|
291301
292491
|
var init_power = __esm({
|
|
@@ -292087,6 +293277,73 @@ var init_projectUrls = __esm({
|
|
|
292087
293277
|
}
|
|
292088
293278
|
});
|
|
292089
293279
|
|
|
293280
|
+
// src/devbox/commands/projectMaintenanceHistory.ts
|
|
293281
|
+
var readHistory, parseProjectMaintenanceHistoryArgs, runProjectMaintenanceHistory;
|
|
293282
|
+
var init_projectMaintenanceHistory = __esm({
|
|
293283
|
+
"src/devbox/commands/projectMaintenanceHistory.ts"() {
|
|
293284
|
+
"use strict";
|
|
293285
|
+
init_server();
|
|
293286
|
+
init_threadInventory();
|
|
293287
|
+
init_args();
|
|
293288
|
+
init_errors4();
|
|
293289
|
+
init_projects2();
|
|
293290
|
+
init_resourceOutput();
|
|
293291
|
+
readHistory = makeFunctionReference("maintenanceHistory:readForViewer");
|
|
293292
|
+
parseProjectMaintenanceHistoryArgs = (args) => {
|
|
293293
|
+
const command = args[0];
|
|
293294
|
+
const commandPath = ["projects", "maintenance", command ?? ""];
|
|
293295
|
+
if (command !== "runs" && command !== "logs") {
|
|
293296
|
+
throw usageError(
|
|
293297
|
+
commandPath,
|
|
293298
|
+
"Choose runs or logs for maintenance history."
|
|
293299
|
+
);
|
|
293300
|
+
}
|
|
293301
|
+
const { flags, positionals } = parseCommandArgs({
|
|
293302
|
+
args: args.slice(1),
|
|
293303
|
+
commandPath,
|
|
293304
|
+
flagLabel: "Maintenance history",
|
|
293305
|
+
boolean: ["json"],
|
|
293306
|
+
string: command === "logs" ? ["project", "run"] : ["project"]
|
|
293307
|
+
});
|
|
293308
|
+
if (positionals.length)
|
|
293309
|
+
throw usageError(commandPath, "This command does not accept arguments.");
|
|
293310
|
+
const runId = readStringFlag(flags, "run")?.trim() || null;
|
|
293311
|
+
if (command === "logs" && !runId) {
|
|
293312
|
+
throw usageError(
|
|
293313
|
+
commandPath,
|
|
293314
|
+
"Logs requires --run <run-id>. List recent runs to choose an ID."
|
|
293315
|
+
);
|
|
293316
|
+
}
|
|
293317
|
+
return {
|
|
293318
|
+
command,
|
|
293319
|
+
project: readStringFlag(flags, "project")?.trim() || null,
|
|
293320
|
+
json: readBooleanFlag(flags, "json"),
|
|
293321
|
+
runId
|
|
293322
|
+
};
|
|
293323
|
+
};
|
|
293324
|
+
runProjectMaintenanceHistory = async (args, dependencies) => {
|
|
293325
|
+
const parsed = parseProjectMaintenanceHistoryArgs(args);
|
|
293326
|
+
await runResourceCommand({
|
|
293327
|
+
json: parsed.json,
|
|
293328
|
+
dependencies,
|
|
293329
|
+
load: async ({ client }, requestId2) => {
|
|
293330
|
+
const project = await resolveCliAgentToolProjectSelection(
|
|
293331
|
+
client,
|
|
293332
|
+
parsed.project
|
|
293333
|
+
);
|
|
293334
|
+
const result = await client.query(readHistory, {
|
|
293335
|
+
projectFingerprint: project.fingerprint,
|
|
293336
|
+
runId: parsed.runId,
|
|
293337
|
+
requestId: requestId2
|
|
293338
|
+
});
|
|
293339
|
+
return { operation: parsed.command, project, result };
|
|
293340
|
+
},
|
|
293341
|
+
render: (data) => "runs" in data.result ? renderMaintenanceRunHistory(data.result) : renderMaintenanceRunLogs(data.result)
|
|
293342
|
+
});
|
|
293343
|
+
};
|
|
293344
|
+
}
|
|
293345
|
+
});
|
|
293346
|
+
|
|
292090
293347
|
// src/devbox/commands/projectLifecycleMaintenance.ts
|
|
292091
293348
|
import fs80 from "node:fs/promises";
|
|
292092
293349
|
import path102 from "node:path";
|
|
@@ -292094,6 +293351,7 @@ var LIFECYCLE_SCRIPT_MAX_BYTES, WATCH_FILE_MAX_BYTES, getLifecycle, patchLifecyc
|
|
|
292094
293351
|
var init_projectLifecycleMaintenance2 = __esm({
|
|
292095
293352
|
"src/devbox/commands/projectLifecycleMaintenance.ts"() {
|
|
292096
293353
|
"use strict";
|
|
293354
|
+
init_projectMaintenanceHistory();
|
|
292097
293355
|
init_server();
|
|
292098
293356
|
init_threadInventory();
|
|
292099
293357
|
init_args();
|
|
@@ -292198,7 +293456,7 @@ var init_projectLifecycleMaintenance2 = __esm({
|
|
|
292198
293456
|
if (command !== "get" && command !== "apply") {
|
|
292199
293457
|
throw usageError(
|
|
292200
293458
|
["projects", "maintenance"],
|
|
292201
|
-
"Choose get or
|
|
293459
|
+
"Choose get, apply, runs, or logs for Template maintenance."
|
|
292202
293460
|
);
|
|
292203
293461
|
}
|
|
292204
293462
|
const commandPath = ["projects", "maintenance", command];
|
|
@@ -292379,6 +293637,9 @@ ${watchLines.join("\n")}` : "GitHub watches: none",
|
|
|
292379
293637
|
});
|
|
292380
293638
|
};
|
|
292381
293639
|
runProjectMaintenanceWithDependencies = async (args, dependencies) => {
|
|
293640
|
+
if (args[0] === "runs" || args[0] === "logs") {
|
|
293641
|
+
return await runProjectMaintenanceHistory(args, dependencies);
|
|
293642
|
+
}
|
|
292382
293643
|
const parsed = parseProjectMaintenanceArgs(args);
|
|
292383
293644
|
await runResourceCommand({
|
|
292384
293645
|
json: parsed.json,
|
|
@@ -295158,6 +296419,244 @@ var init_whoami = __esm({
|
|
|
295158
296419
|
}
|
|
295159
296420
|
});
|
|
295160
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
|
+
|
|
295161
296660
|
// src/devbox/threadImport/selection.ts
|
|
295162
296661
|
var THREAD_IMPORT_MAX_BATCH_RAW_BYTES, DAY_MS, parseThreadImportSince, lastUpdatedMs, newestFirst, selectThreadsForImport, splitThreadImportBatches;
|
|
295163
296662
|
var init_selection = __esm({
|
|
@@ -297178,6 +298677,8 @@ var init_dispatch = __esm({
|
|
|
297178
298677
|
init_logout();
|
|
297179
298678
|
init_mount();
|
|
297180
298679
|
init_mcp();
|
|
298680
|
+
init_agentPermissions();
|
|
298681
|
+
init_agentPermissionRequests();
|
|
297181
298682
|
init_power();
|
|
297182
298683
|
init_ports3();
|
|
297183
298684
|
init_projects3();
|
|
@@ -297195,6 +298696,7 @@ var init_dispatch = __esm({
|
|
|
297195
298696
|
init_version2();
|
|
297196
298697
|
init_whoami();
|
|
297197
298698
|
init_threads2();
|
|
298699
|
+
init_threadArchive2();
|
|
297198
298700
|
init_threadsImport();
|
|
297199
298701
|
init_threadMutations();
|
|
297200
298702
|
init_threadNotifications();
|
|
@@ -297212,6 +298714,11 @@ var init_dispatch = __esm({
|
|
|
297212
298714
|
["agents", runAgents],
|
|
297213
298715
|
["mcp list", runMcpList],
|
|
297214
298716
|
["mcp authorize", runMcpAuthorize],
|
|
298717
|
+
["permissions get", runAgentPermissionsGet],
|
|
298718
|
+
["permissions set", runAgentPermissionsSet],
|
|
298719
|
+
["permissions requests", runAgentPermissionRequests],
|
|
298720
|
+
["permissions allow", runAgentPermissionAllow],
|
|
298721
|
+
["permissions deny", runAgentPermissionDeny],
|
|
297215
298722
|
["projects list", runProjects],
|
|
297216
298723
|
["projects lifecycle", runProjectLifecycle],
|
|
297217
298724
|
["projects maintenance", runProjectMaintenance],
|
|
@@ -297223,6 +298730,8 @@ var init_dispatch = __esm({
|
|
|
297223
298730
|
["devboxes wake", runDevboxWake],
|
|
297224
298731
|
["devboxes destroy", runDevboxDestroy],
|
|
297225
298732
|
["threads list", runThreads],
|
|
298733
|
+
["threads archive", runThreadArchive],
|
|
298734
|
+
["threads unarchive", runThreadUnarchive],
|
|
297226
298735
|
["threads read", runThreadRead],
|
|
297227
298736
|
["threads start", runThreadStart],
|
|
297228
298737
|
["threads send", runThreadSend],
|
|
@@ -297973,4 +299482,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
297973
299482
|
*)
|
|
297974
299483
|
*/
|
|
297975
299484
|
|
|
297976
|
-
//# debugId=
|
|
299485
|
+
//# debugId=249a0abb-e483-5aa3-b76c-e668263ae2b8
|