@boxes-dev/dvb-runtime 1.0.1026 → 1.0.1028

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.
@@ -60,9 +60,11 @@ Fill in every section marked `TODO(agent)`. Each has a guide:
60
60
 
61
61
  For GitHub repos, the manifest defaults to `githubAccess: managed` and keeps
62
62
  the seeded GitHub `gitSsh` rows in skip mode. If check says GitHub is not
63
- connected, run `dvb agent-init github connect`, have the user finish in the
64
- browser, and then re-run check. If the boxes.dev GitHub App is missing
65
- repository access or needs an update, follow the exact action printed by check.
63
+ connected, or that the boxes.dev GitHub App can't access a repository, run
64
+ `dvb agent-init github connect`, have the user finish in the browser, and then
65
+ re-run check. Once GitHub is connected, that command opens GitHub and prints
66
+ which account the user should choose. If an installation needs an update,
67
+ follow the exact action printed by check.
66
68
  Set `githubAccess: ssh` and the GitHub `gitSsh` rows to setup only when the user
67
69
  chooses the SSH alternative. GitLab and other origins continue to use their
68
70
  seeded `gitSsh` entries.
@@ -17,9 +17,10 @@ gitSsh:
17
17
 
18
18
  Managed access uses the user's existing boxes.dev GitHub connection for the
19
19
  Template box and future devboxes. If needed, run `dvb agent-init github
20
- connect`, let the user finish in the browser, and rerun `check`. Check also
21
- prints the exact GitHub action when a repo is not covered, is not writable, or
22
- an installation needs updated access. Do not put any returned URL, connection
20
+ connect`, let the user finish in the browser, and rerun `check`. When a repo
21
+ is not covered by the boxes.dev GitHub App, the same command opens the
22
+ GitHub page that grants access. Check prints the exact GitHub action when a
23
+ repo is not writable or an installation needs updated access. Do not put any returned URL, connection
23
24
  id, repository id, or token in the manifest. Managed access can push changes
24
25
  under `.github/workflows` after every affected installation accepts the shown
25
26
  update. Keep the GitHub `gitSsh` rows at `mode: skip` and
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]="1070e312-ab17-583b-b7e7-a4fc9ca2001d")}catch(e){}}();
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]="635ddc0b-9426-57b3-b255-3ff5f3c561ff")}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";
@@ -101146,8 +101146,8 @@ var init_otel = __esm({
101146
101146
  return trimmed && trimmed.length > 0 ? trimmed : void 0;
101147
101147
  };
101148
101148
  readBuildMetadata = () => {
101149
- const rawPackageVersion = "1.0.1026";
101150
- const rawGitSha = "bb661b08ff5c9fc2e9417aabf09466ace1ac19a8";
101149
+ const rawPackageVersion = "1.0.1028";
101150
+ const rawGitSha = "ecb8f0fdfaad3f4c2d389ec6fc4ee49de0b175d9";
101151
101151
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
101152
101152
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
101153
101153
  return { packageVersion, gitSha };
@@ -133553,9 +133553,9 @@ var init_sentry = __esm({
133553
133553
  uncaughtExceptionMonitorInstalled = false;
133554
133554
  currentDevboxSentryUser = null;
133555
133555
  readBuildMetadata2 = () => {
133556
- const rawPackageVersion = "1.0.1026";
133557
- const rawGitSha = "bb661b08ff5c9fc2e9417aabf09466ace1ac19a8";
133558
- const rawSentryRelease = "boxes-dev-dvb@1.0.1026+bb661b08ff5c9fc2e9417aabf09466ace1ac19a8";
133556
+ const rawPackageVersion = "1.0.1028";
133557
+ const rawGitSha = "ecb8f0fdfaad3f4c2d389ec6fc4ee49de0b175d9";
133558
+ const rawSentryRelease = "boxes-dev-dvb@1.0.1028+ecb8f0fdfaad3f4c2d389ec6fc4ee49de0b175d9";
133559
133559
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
133560
133560
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
133561
133561
  const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
@@ -138773,7 +138773,7 @@ var init_packageVersion = __esm({
138773
138773
  return path17.join(process.cwd(), "dvb");
138774
138774
  };
138775
138775
  readEmbeddedPackageVersion = () => {
138776
- const raw = "1.0.1026";
138776
+ const raw = "1.0.1028";
138777
138777
  return trimVersion(raw);
138778
138778
  };
138779
138779
  readNearestPackageMetadata = (basePath) => {
@@ -204824,6 +204824,7 @@ var init_threadInventoryBuilder = __esm({
204824
204824
  forkAnchorClientThreadId: null,
204825
204825
  devboxFolderId: null,
204826
204826
  devboxFolderRevision: 0,
204827
+ devboxName: null,
204827
204828
  ownsForkPlacement: false,
204828
204829
  forkOperationId: null,
204829
204830
  isFork: false,
@@ -204951,6 +204952,7 @@ var init_threadInventoryBuilder = __esm({
204951
204952
  row.devboxFolderRevision = normalizeDevboxFolderRevision(
204952
204953
  placement.devboxFolderRevision
204953
204954
  );
204955
+ row.devboxName = normalizeText2(placement.devboxName);
204954
204956
  row.ownsForkPlacement = ownsForkPlacement;
204955
204957
  row.forkOperationId = placement.operationId;
204956
204958
  row.isFork = true;
@@ -205250,7 +205252,7 @@ var init_threadInventoryBuilder = __esm({
205250
205252
  });
205251
205253
 
205252
205254
  // ../../../../shared/threadRuntime/forkThreadGroups.ts
205253
- var compareChildRows, resolveGroupSection, resolveGroupChildrenForSection, sortGroupChildren, isForkThreadChildRow, buildForkThreadGroupMap, buildForkThreadListEntries;
205255
+ var compareChildRows, resolveGroupSection, resolveGroupChildrenForSection, sortGroupChildren, isForkThreadChildRow, resolveMinimumGroupSize, buildForkThreadGroupMap, buildForkThreadListEntries;
205254
205256
  var init_forkThreadGroups = __esm({
205255
205257
  "../../../../shared/threadRuntime/forkThreadGroups.ts"() {
205256
205258
  "use strict";
@@ -205272,6 +205274,7 @@ var init_forkThreadGroups = __esm({
205272
205274
  ...children.filter((row) => row.key !== anchorRow.key).sort(compareChildRows)
205273
205275
  ];
205274
205276
  isForkThreadChildRow = (row) => row.forkAnchorPlacementId !== null && row.executionInstanceId !== row.primaryInstanceId;
205277
+ resolveMinimumGroupSize = (anchorRow) => anchorRow.devboxName === null ? 2 : 1;
205275
205278
  buildForkThreadGroupMap = ({
205276
205279
  rows,
205277
205280
  resolveTitle
@@ -205287,9 +205290,6 @@ var init_forkThreadGroups = __esm({
205287
205290
  }
205288
205291
  const groupsByPlacementId = /* @__PURE__ */ new Map();
205289
205292
  for (const [placementId, children] of childrenByPlacementId) {
205290
- if (children.length < 2) {
205291
- continue;
205292
- }
205293
205293
  const anchorRow = children.find((row) => row.ownsForkPlacement) ?? children.find(
205294
205294
  (row) => row.clientThreadId === row.forkAnchorClientThreadId
205295
205295
  );
@@ -205298,7 +205298,7 @@ var init_forkThreadGroups = __esm({
205298
205298
  }
205299
205299
  const section = resolveGroupSection(anchorRow);
205300
205300
  const sectionChildren = resolveGroupChildrenForSection(children, section);
205301
- if (sectionChildren.length < 2) {
205301
+ if (sectionChildren.length < resolveMinimumGroupSize(anchorRow)) {
205302
205302
  continue;
205303
205303
  }
205304
205304
  const sortedChildren = sortGroupChildren(sectionChildren, anchorRow);
@@ -205307,7 +205307,8 @@ var init_forkThreadGroups = __esm({
205307
205307
  forkAnchorPlacementId: placementId,
205308
205308
  forkAnchorClientThreadId: anchorRow.forkAnchorClientThreadId,
205309
205309
  executionInstanceId: anchorRow.executionInstanceId,
205310
- title: resolveTitle(anchorRow),
205310
+ title: anchorRow.devboxName ?? resolveTitle(anchorRow),
205311
+ devboxName: anchorRow.devboxName,
205311
205312
  anchorRow,
205312
205313
  children: sortedChildren,
205313
205314
  additionalThreadCount: sortedChildren.length - 1,
@@ -206814,7 +206815,7 @@ var init_projectSelection = __esm({
206814
206815
  });
206815
206816
 
206816
206817
  // src/devbox/agentView/queryRefs.ts
206817
- var getAgentViewCreationOptionsV1, getAgentViewCreationExecutionDefaultsV1, setAgentViewCreationExecutionDefaultV1, setAgentViewCreationAgentDefaultV1, getAgentViewCreateContextV1, createAgentViewDraftV1, discardAgentViewDraftV1, getAgentViewDraftForEditV1, setAgentViewComposerDraftText, setAgentViewFailedStartDraftTextV1, updateAgentViewDraftBackendV1, prewarmAgentViewDraftV1, startAgentViewTextThreadV2, createAgentViewImageUploadTargets, discardAgentViewImageUploads, kickoffAgentViewThreadStartV1, getAgentViewCreationStatusV1, getAgentViewEmptyNativeThreadStatusV1, startAgentViewEmptyNativeThreadV1, createAndStartAgentViewEmptyNativeThreadV1, listAgentViewProjectsV1, listAgentViewProjectsV2, getAgentViewProjectWindowV1, getAgentViewProjectWindowV2, getAgentViewProjectPresenceV1, getAgentViewThreadPeekBindingV1, loadAgentViewThreadPeekV1, markAgentViewThreadPeekViewedV1, resolveAgentViewTargetV1, resolveAgentViewNativeThreadV1, markAgentViewThreadViewed, loadAgentViewProjectPageV1, loadAgentViewProjectPageV2, retryAgentViewEmptyNativeThreadV1, discardAgentViewEmptyNativeThreadV1, pinAgentViewThread, unpinAgentViewThread, setAgentViewThreadTitle, clearAgentViewThreadTitle, archiveAgentViewTemplateThreadMetadata, archiveAgentViewSecondaryThreadMetadata, unarchiveAgentViewTemplateThreadMetadata, unarchiveAgentViewSecondaryThreadMetadata, restoreAgentViewColdThread;
206818
+ var getAgentViewCreationOptionsV1, getAgentViewCreationExecutionDefaultsV1, setAgentViewCreationExecutionDefaultV1, setAgentViewCreationAgentDefaultV1, getAgentViewCreateContextV1, createAgentViewDraftV1, discardAgentViewDraftV1, getAgentViewDraftForEditV1, setAgentViewComposerDraftText, setAgentViewFailedStartDraftTextV1, updateAgentViewDraftBackendV1, prewarmAgentViewDraftV1, startAgentViewTextThreadV2, createAgentViewImageUploadTargets, discardAgentViewImageUploads, kickoffAgentViewThreadStartV1, getAgentViewCreationStatusV1, getAgentViewEmptyNativeThreadStatusV1, startAgentViewEmptyNativeThreadV1, createAndStartAgentViewEmptyNativeThreadV1, listAgentViewProjectsV1, listAgentViewProjectsV2, getAgentViewProjectWindowV1, getAgentViewProjectWindowV2, getAgentViewProjectPresenceV1, getAgentViewThreadPeekBindingV1, loadAgentViewThreadPeekV1, markAgentViewThreadPeekViewedV1, resolveAgentViewTargetV1, resolveAgentViewNativeThreadV1, markAgentViewThreadViewed, loadAgentViewProjectPageV1, loadAgentViewProjectPageV2, retryAgentViewEmptyNativeThreadV1, discardAgentViewEmptyNativeThreadV1, pinAgentViewThread, unpinAgentViewThread, setAgentViewThreadTitle, clearAgentViewThreadTitle, setAgentViewDevboxName, archiveAgentViewTemplateThreadMetadata, archiveAgentViewSecondaryThreadMetadata, unarchiveAgentViewTemplateThreadMetadata, unarchiveAgentViewSecondaryThreadMetadata, restoreAgentViewColdThread;
206818
206819
  var init_queryRefs = __esm({
206819
206820
  "src/devbox/agentView/queryRefs.ts"() {
206820
206821
  "use strict";
@@ -206858,6 +206859,7 @@ var init_queryRefs = __esm({
206858
206859
  unpinAgentViewThread = makeFunctionReference("desktopAgentState:unpinThread");
206859
206860
  setAgentViewThreadTitle = makeFunctionReference("desktopAgentState:setThreadTitleOverride");
206860
206861
  clearAgentViewThreadTitle = makeFunctionReference("desktopAgentState:clearThreadTitleOverride");
206862
+ setAgentViewDevboxName = makeFunctionReference("devboxNames:setForViewer");
206861
206863
  archiveAgentViewTemplateThreadMetadata = makeFunctionReference("desktopAgentState:archiveThreadMetadata");
206862
206864
  archiveAgentViewSecondaryThreadMetadata = makeFunctionReference("desktopAgentState:archiveSecondaryForkThreadMetadata");
206863
206865
  unarchiveAgentViewTemplateThreadMetadata = makeFunctionReference("desktopAgentState:unarchiveThreadMetadata");
@@ -284923,7 +284925,7 @@ var init_creationPresentation = __esm({
284923
284925
  });
284924
284926
 
284925
284927
  // src/devbox/agentView/threadActions.ts
284926
- var disabledAgentViewThreadMetadataActions, isTemplateThread, isDevboxAnchor, createTarget, projectAgentViewThreadMetadataActions, resolvePostArchiveSelectionKey;
284928
+ var disabledAgentViewThreadMetadataActions, isTemplateThread, isDevboxAnchor, createTarget, projectAgentViewThreadMetadataActions, projectAgentViewDevboxGroupMetadataActions, resolvePostArchiveSelectionKey;
284927
284929
  var init_threadActions = __esm({
284928
284930
  "src/devbox/agentView/threadActions.ts"() {
284929
284931
  "use strict";
@@ -284954,7 +284956,8 @@ var init_threadActions = __esm({
284954
284956
  storageState: row.storageState,
284955
284957
  isDevboxAnchor: devboxAnchor,
284956
284958
  isSecondaryDevboxThread: row.executionInstanceId !== row.primaryInstanceId && !devboxAnchor,
284957
- forkGroupKey: row.forkAnchorPlacementId === null ? null : `fork-group:${String(row.forkAnchorPlacementId)}`
284959
+ forkGroupKey: row.forkAnchorPlacementId === null ? null : `fork-group:${String(row.forkAnchorPlacementId)}`,
284960
+ renameSubject: { kind: "thread" }
284958
284961
  };
284959
284962
  };
284960
284963
  projectAgentViewThreadMetadataActions = ({
@@ -284982,6 +284985,23 @@ var init_threadActions = __esm({
284982
284985
  }
284983
284986
  return { pin, rename, archive };
284984
284987
  };
284988
+ projectAgentViewDevboxGroupMetadataActions = ({
284989
+ anchorRow,
284990
+ selectionKey,
284991
+ placementId,
284992
+ devboxName,
284993
+ groupTitle
284994
+ }) => ({
284995
+ ...projectAgentViewThreadMetadataActions({ row: anchorRow, selectionKey }),
284996
+ rename: {
284997
+ kind: "ready",
284998
+ target: {
284999
+ ...createTarget({ row: anchorRow, selectionKey }),
285000
+ currentTitle: groupTitle,
285001
+ renameSubject: { kind: "devbox", placementId, devboxName }
285002
+ }
285003
+ }
285004
+ });
284985
285005
  resolvePostArchiveSelectionKey = ({
284986
285006
  selectedKey,
284987
285007
  selectableItems
@@ -285230,18 +285250,19 @@ var init_renderState = __esm({
285230
285250
  }
285231
285251
  const expanded = !collapsedForkGroupKeys.has(entry.group.key);
285232
285252
  const totalThreadCount = entry.group.additionalThreadCount + 1;
285253
+ const expandedLabel = entry.group.devboxName === null ? "Devbox" : toSingleLineRowTitle(entry.group.devboxName);
285233
285254
  blocks.push({
285234
285255
  kind: "fork_group",
285235
285256
  key: entry.group.key,
285236
285257
  section,
285237
- title: expanded ? `Devbox (${String(totalThreadCount)} threads)` : toSingleLineRowTitle(entry.group.title),
285258
+ title: expanded ? `${expandedLabel} (${String(totalThreadCount)} ${totalThreadCount === 1 ? "thread" : "threads"})` : toSingleLineRowTitle(entry.group.title),
285238
285259
  originLabel: null,
285239
285260
  dotTone: entry.group.hasActiveChild ? "active" : null,
285240
285261
  // The group row is the devbox row, so it keeps the devbox's git counts
285241
285262
  // whether or not its threads are showing. Only the collapsed row also
285242
285263
  // carries the hidden-thread count, since expanding reveals them.
285243
285264
  tokens: [
285244
- ...expanded ? [] : [
285265
+ ...expanded || entry.group.additionalThreadCount === 0 ? [] : [
285245
285266
  {
285246
285267
  kind: "group_count",
285247
285268
  text: `+${String(entry.group.additionalThreadCount)}`
@@ -285259,9 +285280,12 @@ var init_renderState = __esm({
285259
285280
  targetRole: "devbox"
285260
285281
  },
285261
285282
  discardEmptyNative: { kind: "none" },
285262
- metadata: projectAgentViewThreadMetadataActions({
285263
- row: entry.group.anchorRow,
285264
- selectionKey: entry.group.key
285283
+ metadata: projectAgentViewDevboxGroupMetadataActions({
285284
+ anchorRow: entry.group.anchorRow,
285285
+ selectionKey: entry.group.key,
285286
+ placementId: entry.group.forkAnchorPlacementId,
285287
+ devboxName: entry.group.devboxName,
285288
+ groupTitle: toSingleLineRowTitle(entry.group.title)
285265
285289
  })
285266
285290
  },
285267
285291
  target: {
@@ -285765,7 +285789,11 @@ var init_renameModal = __esm({
285765
285789
  }) => ({
285766
285790
  target,
285767
285791
  boxLabel,
285768
- editor: createAgentViewTextBuffer(target.currentTitle),
285792
+ // An unnamed devbox starts empty so saving untouched text does not name it
285793
+ // after its first thread.
285794
+ editor: createAgentViewTextBuffer(
285795
+ target.renameSubject.kind === "devbox" ? target.renameSubject.devboxName ?? "" : target.currentTitle
285796
+ ),
285769
285797
  validationMessage: null,
285770
285798
  submitting: false
285771
285799
  });
@@ -285774,12 +285802,12 @@ var init_renameModal = __esm({
285774
285802
  editor: reduceAgentViewTextBuffer(modal.editor, action),
285775
285803
  validationMessage: null
285776
285804
  });
285777
- validateAgentViewThreadTitle = (text) => {
285805
+ validateAgentViewThreadTitle = (text, subject) => {
285778
285806
  const codePointCount = Array.from(text).length;
285779
285807
  if (codePointCount > AGENT_VIEW_THREAD_TITLE_MAX_CODE_POINTS) {
285780
285808
  return {
285781
285809
  valid: false,
285782
- message: "Thread titles can be at most 120 characters.",
285810
+ message: subject === "devbox" ? "Devbox names can be at most 120 characters." : "Thread titles can be at most 120 characters.",
285783
285811
  codePointCount
285784
285812
  };
285785
285813
  }
@@ -285789,7 +285817,7 @@ var init_renameModal = __esm({
285789
285817
  });
285790
285818
 
285791
285819
  // src/devbox/agentView/threadActionExecutor.ts
285792
- var AgentViewThreadArchiveError, runAgentViewPinAction, runAgentViewRenameAction, setMetadataArchivedState, requireResolvedArchiveTarget, runAgentViewArchiveAction;
285820
+ var AgentViewThreadArchiveError, runAgentViewPinAction, runAgentViewRenameAction, runAgentViewDevboxRenameAction, setMetadataArchivedState, requireResolvedArchiveTarget, runAgentViewArchiveAction;
285793
285821
  var init_threadActionExecutor = __esm({
285794
285822
  "src/devbox/agentView/threadActionExecutor.ts"() {
285795
285823
  "use strict";
@@ -285839,6 +285867,17 @@ var init_threadActionExecutor = __esm({
285839
285867
  });
285840
285868
  return { automaticTitle: false, title: result.title };
285841
285869
  };
285870
+ runAgentViewDevboxRenameAction = async ({
285871
+ client,
285872
+ placementId,
285873
+ name
285874
+ }) => {
285875
+ const result = await client.mutation(setAgentViewDevboxName, {
285876
+ placementId,
285877
+ name
285878
+ });
285879
+ return { devboxName: result.devboxName };
285880
+ };
285842
285881
  setMetadataArchivedState = async ({
285843
285882
  client,
285844
285883
  target,
@@ -285998,7 +286037,7 @@ var init_metadataActionController = __esm({
285998
286037
  return "This Codex thread isn\u2019t ready to be archived yet.";
285999
286038
  }
286000
286039
  };
286001
- genericFailureCopy = (action) => action === "pin" ? "Thread couldn\u2019t be pinned. Review the latest status and try again." : action === "rename" ? "Thread couldn\u2019t be renamed. Review the latest status and try again." : action === "archive" ? "Thread couldn\u2019t be archived. Review the latest status and try again." : "Thread couldn\u2019t be unarchived. Review the latest status and try again.";
286040
+ genericFailureCopy = (action) => action === "pin" ? "Thread couldn\u2019t be pinned. Review the latest status and try again." : action === "rename" ? "Thread couldn\u2019t be renamed. Review the latest status and try again." : action === "rename_devbox" ? "Devbox couldn\u2019t be renamed. Review the latest status and try again." : action === "archive" ? "Thread couldn\u2019t be archived. Review the latest status and try again." : "Thread couldn\u2019t be unarchived. Review the latest status and try again.";
286002
286041
  AgentViewMetadataActionController = class {
286003
286042
  constructor(client, setCodexArchivedState, managedProject, host) {
286004
286043
  this.client = client;
@@ -286108,7 +286147,7 @@ var init_metadataActionController = __esm({
286108
286147
  });
286109
286148
  try {
286110
286149
  let boxLabel = "Template box";
286111
- if (target.executionInstanceId !== target.primaryInstanceId) {
286150
+ if (target.renameSubject.kind === "thread" && target.executionInstanceId !== target.primaryInstanceId) {
286112
286151
  const resolved = await this.client.query(resolveAgentViewTargetV1, {
286113
286152
  primaryInstanceId: target.primaryInstanceId,
286114
286153
  executionInstanceId: target.executionInstanceId
@@ -286157,7 +286196,11 @@ var init_metadataActionController = __esm({
286157
286196
  if (!modal || modal.submitting || this.snapshot.pendingLabel !== null) {
286158
286197
  return;
286159
286198
  }
286160
- const validation = validateAgentViewThreadTitle(modal.editor.text);
286199
+ const subject = modal.target.renameSubject;
286200
+ const validation = validateAgentViewThreadTitle(
286201
+ modal.editor.text,
286202
+ subject.kind
286203
+ );
286161
286204
  if (!validation.valid) {
286162
286205
  this.update({
286163
286206
  renameModal: {
@@ -286174,6 +286217,30 @@ var init_metadataActionController = __esm({
286174
286217
  renameModal: { ...modal, submitting: true, validationMessage: null }
286175
286218
  });
286176
286219
  try {
286220
+ if (subject.kind === "devbox") {
286221
+ const result2 = await runAgentViewDevboxRenameAction({
286222
+ client: this.client,
286223
+ placementId: subject.placementId,
286224
+ name: validation.title
286225
+ });
286226
+ this.setCompletedAction({
286227
+ kind: "rename",
286228
+ subject: "devbox",
286229
+ clientThreadId: modal.target.clientThreadId,
286230
+ expectedValue: result2.devboxName,
286231
+ observedExpected: false
286232
+ });
286233
+ this.update({
286234
+ renameModal: null,
286235
+ statusMessage: result2.devboxName === null ? "Using the first thread\u2019s title for this devbox." : `Renamed devbox to \u201C${result2.devboxName}\u201D.`,
286236
+ statusTone: "neutral"
286237
+ });
286238
+ logger2.info("agent_view_devbox_rename_completed", {
286239
+ placementId: subject.placementId,
286240
+ cleared: result2.devboxName === null
286241
+ });
286242
+ return;
286243
+ }
286177
286244
  const result = await runAgentViewRenameAction({
286178
286245
  client: this.client,
286179
286246
  target: modal.target,
@@ -286181,8 +286248,9 @@ var init_metadataActionController = __esm({
286181
286248
  });
286182
286249
  this.setCompletedAction({
286183
286250
  kind: "rename",
286251
+ subject: "thread",
286184
286252
  clientThreadId: modal.target.clientThreadId,
286185
- expectedManualTitle: result.automaticTitle ? null : result.title,
286253
+ expectedValue: result.automaticTitle ? null : result.title,
286186
286254
  observedExpected: false
286187
286255
  });
286188
286256
  this.update({
@@ -286202,13 +286270,18 @@ var init_metadataActionController = __esm({
286202
286270
  submitting: false,
286203
286271
  validationMessage: null
286204
286272
  },
286205
- statusMessage: genericFailureCopy("rename"),
286273
+ statusMessage: genericFailureCopy(
286274
+ subject.kind === "devbox" ? "rename_devbox" : "rename"
286275
+ ),
286206
286276
  statusTone: "error"
286207
286277
  });
286208
- logger2.warn("agent_view_thread_rename_failed", {
286209
- clientThreadId: modal.target.clientThreadId,
286210
- error: error55 instanceof Error ? error55.message : String(error55)
286211
- });
286278
+ logger2.warn(
286279
+ subject.kind === "devbox" ? "agent_view_devbox_rename_failed" : "agent_view_thread_rename_failed",
286280
+ {
286281
+ clientThreadId: modal.target.clientThreadId,
286282
+ error: error55 instanceof Error ? error55.message : String(error55)
286283
+ }
286284
+ );
286212
286285
  } finally {
286213
286286
  this.update({ pendingLabel: null });
286214
286287
  }
@@ -286365,12 +286438,13 @@ var init_metadataActionController = __esm({
286365
286438
  return;
286366
286439
  }
286367
286440
  const readyAction = items.map((item) => item.actions.metadata[completed.kind]).find(
286368
- (action) => action.kind === "ready" && action.target.clientThreadId === completed.clientThreadId
286441
+ (action) => action.kind === "ready" && action.target.clientThreadId === completed.clientThreadId && (completed.kind !== "rename" || action.target.renameSubject.kind === completed.subject)
286369
286442
  );
286370
286443
  if (!readyAction) {
286371
286444
  return;
286372
286445
  }
286373
- const matches2 = completed.kind === "pin" ? readyAction.target.isPinned === completed.expectedPinned : completed.kind === "rename" ? readyAction.target.manualTitle === completed.expectedManualTitle : readyAction.target.isArchived === completed.expectedArchived;
286446
+ const renameSubject = readyAction.target.renameSubject;
286447
+ const matches2 = completed.kind === "pin" ? readyAction.target.isPinned === completed.expectedPinned : completed.kind === "rename" ? (renameSubject.kind === "devbox" ? renameSubject.devboxName : readyAction.target.manualTitle) === completed.expectedValue : readyAction.target.isArchived === completed.expectedArchived;
286374
286448
  if (matches2) {
286375
286449
  completed.observedExpected = true;
286376
286450
  return;
@@ -291514,6 +291588,7 @@ var init_AgentViewRenameModal = __esm({
291514
291588
  viewportHeight,
291515
291589
  width
291516
291590
  }) => {
291591
+ const isDevbox = modal.target.renameSubject.kind === "devbox";
291517
291592
  const modalWidth = Math.max(24, Math.min(width - 4, 76));
291518
291593
  const contentWidth = modalWidth - 4;
291519
291594
  const horizontalRule = "\u2500".repeat(modalWidth - 2);
@@ -291527,11 +291602,18 @@ var init_AgentViewRenameModal = __esm({
291527
291602
  justifyContent: "center",
291528
291603
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Box_default, { flexDirection: "column", width: modalWidth, children: [
291529
291604
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text, { children: `\u256D${horizontalRule}\u256E` }),
291530
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalLine, { text: "Rename thread", width: contentWidth, bold: true }),
291531
291605
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
291532
291606
  ModalLine,
291533
291607
  {
291534
- text: `${modal.target.currentTitle} \xB7 ${modal.boxLabel}`,
291608
+ text: isDevbox ? "Rename devbox" : "Rename thread",
291609
+ width: contentWidth,
291610
+ bold: true
291611
+ }
291612
+ ),
291613
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
291614
+ ModalLine,
291615
+ {
291616
+ text: isDevbox ? modal.target.currentTitle : `${modal.target.currentTitle} \xB7 ${modal.boxLabel}`,
291535
291617
  width: contentWidth,
291536
291618
  dimColor: true
291537
291619
  }
@@ -291539,7 +291621,7 @@ var init_AgentViewRenameModal = __esm({
291539
291621
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
291540
291622
  ModalLine,
291541
291623
  {
291542
- text: "Leave the title empty to use the automatic title.",
291624
+ text: isDevbox ? "Leave the name empty to use the first thread\u2019s title." : "Leave the title empty to use the automatic title.",
291543
291625
  width: contentWidth,
291544
291626
  dimColor: true
291545
291627
  }
@@ -313431,7 +313513,7 @@ var init_databaseDumpTools2 = __esm({
313431
313513
  });
313432
313514
 
313433
313515
  // src/devbox/agentInit/controlPlane.ts
313434
- var preflightProject, registryUpsert2, registryRemove, startOrResumeJob, createUploadSession, refreshMultipartUploadParts, listMultipartUploadedParts, completeMultipartUpload, abortMultipartUpload, commitUpload, commitDecryptKeyEnvelope, getProgress, destroyStartOver, retryRecoverableFailure, getMarkerRepairState, getGithubConnection, startGithubConnection, setGithubCliAccess, listGithubRepositories, createAgentInitControlPlaneClient;
313516
+ var preflightProject, registryUpsert2, registryRemove, startOrResumeJob, createUploadSession, refreshMultipartUploadParts, listMultipartUploadedParts, completeMultipartUpload, abortMultipartUpload, commitUpload, commitDecryptKeyEnvelope, getProgress, destroyStartOver, retryRecoverableFailure, getMarkerRepairState, getGithubConnection, startGithubConnection, setGithubCliAccess, listGithubRepositories, getGithubInstallTarget, createAgentInitControlPlaneClient;
313435
313517
  var init_controlPlane2 = __esm({
313436
313518
  "src/devbox/agentInit/controlPlane.ts"() {
313437
313519
  "use strict";
@@ -313467,6 +313549,7 @@ var init_controlPlane2 = __esm({
313467
313549
  startGithubConnection = makeFunctionReference("githubOAuth:startConnectionForViewer");
313468
313550
  setGithubCliAccess = makeFunctionReference("githubConnections:setRuntimeGhProjectionForViewer");
313469
313551
  listGithubRepositories = makeFunctionReference("githubRepositoryActions:listRepositoriesForViewer");
313552
+ getGithubInstallTarget = makeFunctionReference("githubRepositoryActions:getInstallTargetForViewer");
313470
313553
  createAgentInitControlPlaneClient = ({
313471
313554
  getToken
313472
313555
  }) => {
@@ -313501,6 +313584,10 @@ var init_controlPlane2 = __esm({
313501
313584
  getGithubConnection: (request2) => query(getGithubConnection, request2),
313502
313585
  startGithubConnection: (request2) => mutation(startGithubConnection, request2),
313503
313586
  listGithubRepositories: (request2) => action(listGithubRepositories, request2),
313587
+ getGithubInstallTarget: async (request2) => withConvexClient(
313588
+ await getToken(),
313589
+ async (client) => client.action(getGithubInstallTarget, request2)
313590
+ ),
313504
313591
  setGithubCliAccess: async (request2) => withConvexClient(
313505
313592
  await getToken(),
313506
313593
  async (client) => client.mutation(setGithubCliAccess, request2)
@@ -323159,11 +323246,32 @@ var init_instanceType = __esm({
323159
323246
  });
323160
323247
 
323161
323248
  // src/devbox/agentInit/githubAccess.ts
323162
- var isRecord8, githubIssue, githubInventoryFailureIssue, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess;
323249
+ var resolveAgentInitGithubAccessPage, isRecord8, githubIssue, githubInventoryFailureIssue, readAgentInitProjectLayoutRepos, manifestGithubAccess, buildAgentInitGithubManifestIssues, normalizeInventoryRepository, normalizeInventoryInstallation, matchAgentInitGithubRepositories, agentInitGithubBlockedIssue, resolveAgentInitGithubAccessDefault, resolveAgentInitManagedGithubAccess, configureAgentInitGithubAccess;
323163
323250
  var init_githubAccess = __esm({
323164
323251
  "src/devbox/agentInit/githubAccess.ts"() {
323165
323252
  "use strict";
323166
323253
  init_devboxCore();
323254
+ resolveAgentInitGithubAccessPage = (missingAccess) => {
323255
+ const owners = [
323256
+ ...new Set(
323257
+ missingAccess.repositoryFullNames.map(
323258
+ (fullName) => fullName.split("/")[0]?.toLowerCase() ?? ""
323259
+ )
323260
+ )
323261
+ ].filter((owner) => owner.length > 0);
323262
+ const ownerLogin = owners.length === 1 ? missingAccess.repositoryFullNames[0]?.split("/")[0] ?? null : null;
323263
+ if (!ownerLogin) {
323264
+ return { kind: "install", url: missingAccess.appInstallationUrl };
323265
+ }
323266
+ const installation = missingAccess.installations.find(
323267
+ (candidate) => candidate.accountLogin.toLowerCase() === ownerLogin.toLowerCase()
323268
+ );
323269
+ return installation ? {
323270
+ kind: "installation_settings",
323271
+ ownerLogin,
323272
+ url: installation.managementUrl
323273
+ } : { kind: "owner_lookup", ownerLogin };
323274
+ };
323167
323275
  isRecord8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
323168
323276
  githubIssue = (message, fix) => ({
323169
323277
  level: "error",
@@ -323496,8 +323604,16 @@ var init_githubAccess = __esm({
323496
323604
  ok: false,
323497
323605
  issue: githubIssue(
323498
323606
  `boxes.dev does not have GitHub App repository access for: ${missing.join(", ") || "this project"}.`,
323499
- appInstallationUrl ? `Choose the personal account or organization at ${appInstallationUrl} and grant repository access. An organization owner may need to approve the request. Then re-run check.` : "Grant the boxes.dev GitHub App access to each listed repository. An organization owner may need to approve the request. Then re-run check."
323500
- )
323607
+ "Run `dvb agent-init github connect` to open GitHub and give boxes.dev access to each listed repository. An organization owner may need to approve the request. Then re-run check."
323608
+ ),
323609
+ missingAccess: {
323610
+ appInstallationUrl,
323611
+ installations: installations.map(({ accountLogin, managementUrl }) => ({
323612
+ accountLogin,
323613
+ managementUrl
323614
+ })),
323615
+ repositoryFullNames: missing
323616
+ }
323501
323617
  };
323502
323618
  }
323503
323619
  const installationById = new Map(
@@ -324801,10 +324917,12 @@ var init_gitSsh = __esm({
324801
324917
  });
324802
324918
 
324803
324919
  // src/devbox/commands/agentInit/github.ts
324804
- var GITHUB_USAGE, startAgentInitGithubConnection, runAgentInitGithub, manageAgentInitGithubCliAccess;
324920
+ var GITHUB_USAGE, startAgentInitGithubConnection, runAgentInitGithub, isGithubConnectionReady, readInstallUrl, connectAgentInitGithub, manageAgentInitGithubCliAccess;
324805
324921
  var init_github = __esm({
324806
324922
  "src/devbox/commands/agentInit/github.ts"() {
324807
324923
  "use strict";
324924
+ init_commandCore();
324925
+ init_githubAccess();
324808
324926
  init_service();
324809
324927
  init_browser();
324810
324928
  init_errors4();
@@ -324846,9 +324964,94 @@ var init_github = __esm({
324846
324964
  });
324847
324965
  return;
324848
324966
  }
324849
- await startAgentInitGithubConnection({
324850
- client: context35.controlPlaneClient
324967
+ await connectAgentInitGithub({
324968
+ client: context35.controlPlaneClient,
324969
+ loadProjectLayoutRepos: async () => {
324970
+ const { repo, validation } = await resolveAgentInitProject({
324971
+ projectPath: process.cwd()
324972
+ });
324973
+ return readAgentInitProjectLayoutRepos({ repo, validation });
324974
+ }
324975
+ });
324976
+ };
324977
+ isGithubConnectionReady = (connectionResult) => {
324978
+ if (!connectionResult || typeof connectionResult !== "object") return false;
324979
+ const connection = connectionResult.connection;
324980
+ if (!connection || typeof connection !== "object") return false;
324981
+ const fields = connection;
324982
+ return fields["connectionStatus"] === "connected" && fields["tokenStatus"] === "valid" && fields["authorizationStatus"] === "current" && fields["credentialUpgradeStatus"] !== "update_available";
324983
+ };
324984
+ readInstallUrl = (result) => {
324985
+ if (!result || typeof result !== "object") return null;
324986
+ const fields = result;
324987
+ if (fields["ok"] !== true) return { ok: false };
324988
+ return {
324989
+ ok: true,
324990
+ accountType: fields["accountType"],
324991
+ installUrl: typeof fields["installUrl"] === "string" ? fields["installUrl"] : null
324992
+ };
324993
+ };
324994
+ connectAgentInitGithub = async ({
324995
+ client,
324996
+ loadProjectLayoutRepos,
324997
+ openBrowserFn = openBrowser,
324998
+ print = console.log
324999
+ }) => {
325000
+ const connectionResult = await client.getGithubConnection({});
325001
+ if (!isGithubConnectionReady(connectionResult)) {
325002
+ await startAgentInitGithubConnection({ client, openBrowserFn, print });
325003
+ return;
325004
+ }
325005
+ const resolution = resolveAgentInitManagedGithubAccess({
325006
+ connectionResult,
325007
+ inventoryResult: await client.listGithubRepositories({}),
325008
+ projectLayoutRepos: await loadProjectLayoutRepos()
324851
325009
  });
325010
+ if (resolution.ok) {
325011
+ print(
325012
+ `GitHub is connected and boxes.dev can access ${resolution.repositories.length === 1 ? "this project's repository" : `all ${resolution.repositories.length} of this project's repositories`}. Re-run \`dvb agent-init check\`.`
325013
+ );
325014
+ return;
325015
+ }
325016
+ if (!("missingAccess" in resolution)) {
325017
+ print(resolution.issue.message);
325018
+ print(resolution.issue.fix);
325019
+ return;
325020
+ }
325021
+ const page = resolveAgentInitGithubAccessPage(resolution.missingAccess);
325022
+ const repositories = resolution.missingAccess.repositoryFullNames.join(", ");
325023
+ let url3;
325024
+ let instruction;
325025
+ if (page.kind === "installation_settings") {
325026
+ url3 = page.url;
325027
+ instruction = `Add ${repositories} to the boxes.dev GitHub App for @${page.ownerLogin}, then re-run \`dvb agent-init check\`.`;
325028
+ } else if (page.kind === "install") {
325029
+ url3 = page.url;
325030
+ instruction = `Give boxes.dev access to ${repositories} on GitHub for each account that owns them. An organization owner may need to approve the request. Then re-run \`dvb agent-init check\`.`;
325031
+ } else {
325032
+ const target = readInstallUrl(
325033
+ await client.getGithubInstallTarget({ ownerLogin: page.ownerLogin })
325034
+ );
325035
+ if (target?.ok && target.installUrl === null) {
325036
+ print(
325037
+ `${repositories} belongs to @${page.ownerLogin}'s personal account. Ask @${page.ownerLogin} to give boxes.dev access to it on GitHub, or use \`githubAccess: ssh\`.`
325038
+ );
325039
+ return;
325040
+ }
325041
+ url3 = target?.ok ? target.installUrl : resolution.missingAccess.appInstallationUrl;
325042
+ instruction = target?.ok && target.accountType === "user" ? `Give boxes.dev access to ${repositories} on GitHub: keep "All repositories" selected, or choose repositories that include them. Then re-run \`dvb agent-init check\`.` : `Give boxes.dev access to ${repositories} on GitHub: choose @${page.ownerLogin}, then keep "All repositories" selected or choose repositories that include them. If @${page.ownerLogin} requires an owner's approval, GitHub will send your request to an organization owner. If @${page.ownerLogin} isn't listed, ask an owner of @${page.ownerLogin} to give boxes.dev access. Then re-run \`dvb agent-init check\`.`;
325043
+ }
325044
+ if (url3 === null) {
325045
+ print(instruction);
325046
+ return;
325047
+ }
325048
+ if (openBrowserFn(url3)) {
325049
+ print("GitHub opened in your browser.");
325050
+ } else {
325051
+ print("The browser did not open. Continue on GitHub at:");
325052
+ print(url3);
325053
+ }
325054
+ print(instruction);
324852
325055
  };
324853
325056
  manageAgentInitGithubCliAccess = async ({
324854
325057
  client,
@@ -359808,4 +360011,4 @@ react/cjs/react-jsx-runtime.development.js:
359808
360011
  *)
359809
360012
  */
359810
360013
 
359811
- //# debugId=1070e312-ab17-583b-b7e7-a4fc9ca2001d
360014
+ //# debugId=635ddc0b-9426-57b3-b255-3ff5f3c561ff