repoburg 1.3.312 → 1.3.314

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.
Files changed (29) hide show
  1. package/agent-pane/backend/dist/index.js +427 -279
  2. package/agent-pane/backend/dist/server.js +427 -279
  3. package/agent-pane/frontend/dist/assets/{TerminalView-BF35pnWS.js → TerminalView-HheF07Iz.js} +1 -1
  4. package/agent-pane/frontend/dist/assets/index-Do_-oQ87.js +846 -0
  5. package/agent-pane/frontend/dist/assets/index-PWGU-lZn.css +1 -0
  6. package/agent-pane/frontend/dist/index.html +2 -2
  7. package/daemon/dist/api/auth.js +27 -63
  8. package/daemon/dist/auth/accountServer.js +11 -0
  9. package/daemon/dist/auth/authManager.js +27 -30
  10. package/daemon/dist/auth/deviceLogin.js +122 -0
  11. package/daemon/dist/auth/deviceLogin.spec.js +74 -0
  12. package/daemon/dist/index.js +0 -0
  13. package/daemon/dist/remote/orchestrator.js +29 -2
  14. package/daemon/dist/remote/orchestrator.spec.js +49 -0
  15. package/daemon/dist/remote/provisioner.js +7 -12
  16. package/daemon/dist/tabtape/mcp/server.js +2 -1
  17. package/package.json +1 -1
  18. package/platform-cli.js +4 -2
  19. package/tabtape/extension/dist/build-info.json +3 -3
  20. package/tabtape/extension/dist/manifest.json +1 -1
  21. package/tabtape/ui/dist/build-info.json +3 -3
  22. package/agent-pane/frontend/dist/assets/index-7ikRAI4J.js +0 -841
  23. package/agent-pane/frontend/dist/assets/index-wFHgyM6i.css +0 -1
  24. package/daemon/dist/middleware/corsOrigin.js +0 -53
  25. package/daemon/dist/middleware/corsOrigin.spec.js +0 -46
  26. package/daemon/dist/remote/access-jwt.js +0 -67
  27. package/daemon/dist/remote/access-jwt.spec.js +0 -94
  28. package/daemon/dist/remote/edge-gate-move.js +0 -40
  29. package/daemon/dist/remote/edge-gate-move.spec.js +0 -44
@@ -17,6 +17,11 @@ exports.runEnable = runEnable;
17
17
  * - service already running with live edge connections → everything is
18
18
  * skipped (the job goes straight to ready).
19
19
  *
20
+ * Provisioning needs this machine's Repoburg account (the device token).
21
+ * Without one — or when the account server answers 401 — the job stops in
22
+ * `needs_login`: the dialog signs the user in and starts the job again. No
23
+ * troubleshooting session for that; an agent cannot sign in for the user.
24
+ *
20
25
  * When a deterministic step fails, the orchestrator opens a troubleshooting
21
26
  * SESSION on the embedded pane (last used provider/model/cwd combo) with the
22
27
  * diagnostics inlined — the agent then works the problem in the background
@@ -26,9 +31,12 @@ exports.runEnable = runEnable;
26
31
  const os_1 = __importDefault(require("os"));
27
32
  const tunnel_state_1 = require("./tunnel-state");
28
33
  const provisioner_1 = require("./provisioner");
34
+ const authManager_1 = require("../auth/authManager");
29
35
  const cloudflared_1 = require("./cloudflared");
30
36
  const probes_1 = require("./probes");
31
- const DEFAULT_PANE_BASE_URL = 'http://127.0.0.1:9998';
37
+ // This daemon's own pane: a second daemon (REPOBURG_DAEMON_PORT, see index.ts)
38
+ // must not open its troubleshooting session in the one on :9998.
39
+ const DEFAULT_PANE_BASE_URL = `http://127.0.0.1:${Number(process.env.REPOBURG_DAEMON_PORT) || 9998}`;
32
40
  const DEFAULT_VERIFY_TIMEOUT_MS = 90000;
33
41
  const DEFAULT_VERIFY_INTERVAL_MS = 5000;
34
42
  /** The single active (or last finished) job — one enable at a time. */
@@ -68,6 +76,11 @@ function startEnableJob(mahlas, deps = {}) {
68
76
  });
69
77
  return job;
70
78
  }
79
+ function finishNeedsLogin(job) {
80
+ log(job, 'provision', 'This machine is not signed in to a Repoburg account.');
81
+ job.state = 'needs_login';
82
+ job.finishedAt = new Date().toISOString();
83
+ }
71
84
  function finishFailed(job, error) {
72
85
  job.state = 'failed';
73
86
  job.step = 'failed';
@@ -79,6 +92,7 @@ async function runEnable(job, depOverrides = {}) {
79
92
  const d = {
80
93
  loadTunnelState: tunnel_state_1.loadTunnelState,
81
94
  provisionTunnel: provisioner_1.provisionTunnel,
95
+ isSignedIn: async () => (await authManager_1.authManager.getAuthStatus()) === 'authorized',
82
96
  isInstalled: cloudflared_1.isInstalled,
83
97
  downloadCloudflared: cloudflared_1.downloadCloudflared,
84
98
  installService: cloudflared_1.installService,
@@ -107,8 +121,21 @@ async function runEnable(job, depOverrides = {}) {
107
121
  // ---- provision (only when no local state exists) ----
108
122
  let state = existing;
109
123
  if (!state) {
124
+ if (!(await d.isSignedIn())) {
125
+ finishNeedsLogin(job);
126
+ return;
127
+ }
110
128
  log(job, 'provision', `Provisioning the tunnel as "${job.mahlas ?? ''}".`);
111
- state = await d.provisionTunnel(job.mahlas ?? '');
129
+ try {
130
+ state = await d.provisionTunnel(job.mahlas ?? '');
131
+ }
132
+ catch (error) {
133
+ if (error?.statusCode === 401) {
134
+ finishNeedsLogin(job);
135
+ return;
136
+ }
137
+ throw error;
138
+ }
112
139
  job.hostname = state.hostname;
113
140
  }
114
141
  else {
@@ -43,6 +43,7 @@ function makeDeps(overrides = {}) {
43
43
  return {
44
44
  loadTunnelState: mockedLoad,
45
45
  provisionTunnel: jest.fn().mockResolvedValue(STATE),
46
+ isSignedIn: jest.fn().mockResolvedValue(true),
46
47
  isInstalled: mockedIsInstalled,
47
48
  downloadCloudflared: jest.fn().mockResolvedValue('/bin/cloudflared'),
48
49
  installService: jest.fn().mockResolvedValue('/service'),
@@ -188,3 +189,51 @@ describe('orchestrator: troubleshooting fallback', () => {
188
189
  expect((0, orchestrator_1.getEnableJob)()).toBeNull();
189
190
  });
190
191
  });
192
+ describe('orchestrator: sign-in', () => {
193
+ beforeEach(() => {
194
+ jest.clearAllMocks();
195
+ });
196
+ it('stops in needs_login before provisioning when the machine has no account', async () => {
197
+ mockedLoad.mockReturnValue(null);
198
+ mockedConnected.mockResolvedValue(false);
199
+ const deps = makeDeps({
200
+ isSignedIn: jest.fn().mockResolvedValue(false),
201
+ isServiceRunning: jest.fn().mockResolvedValue(false),
202
+ });
203
+ const job = makeJob();
204
+ await (0, orchestrator_1.runEnable)(job, deps);
205
+ expect(job.state).toBe('needs_login');
206
+ expect(job.finishedAt).not.toBeNull();
207
+ expect(deps.provisionTunnel).not.toHaveBeenCalled();
208
+ expect(deps.fetchImpl).not.toHaveBeenCalled(); // no troubleshooting session
209
+ });
210
+ it('stops in needs_login when the account server answers 401', async () => {
211
+ mockedLoad.mockReturnValue(null);
212
+ mockedConnected.mockResolvedValue(false);
213
+ const deps = makeDeps({
214
+ provisionTunnel: jest
215
+ .fn()
216
+ .mockRejectedValue(Object.assign(new Error('Account server: expired'), { statusCode: 401 })),
217
+ isServiceRunning: jest.fn().mockResolvedValue(false),
218
+ });
219
+ const job = makeJob();
220
+ await (0, orchestrator_1.runEnable)(job, deps);
221
+ expect(job.state).toBe('needs_login');
222
+ expect(deps.installService).not.toHaveBeenCalled();
223
+ expect(deps.fetchImpl).not.toHaveBeenCalled();
224
+ });
225
+ it('needs no account to resume a provisioned tunnel', async () => {
226
+ mockedLoad.mockReturnValue(STATE);
227
+ mockedIsInstalled.mockReturnValue(true);
228
+ mockedConnected.mockResolvedValue(true);
229
+ const isSignedIn = jest.fn().mockResolvedValue(false);
230
+ const deps = makeDeps({
231
+ isSignedIn,
232
+ isServiceRunning: jest.fn().mockResolvedValueOnce(false).mockResolvedValue(true),
233
+ });
234
+ const job = makeJob('zz');
235
+ await (0, orchestrator_1.runEnable)(job, deps);
236
+ expect(job.state).toBe('ready');
237
+ expect(isSignedIn).not.toHaveBeenCalled();
238
+ });
239
+ });
@@ -1,23 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProvisioningError = void 0;
4
- exports.accountServerUrl = accountServerUrl;
3
+ exports.ProvisioningError = exports.accountServerUrl = void 0;
5
4
  exports.provisionTunnel = provisionTunnel;
6
5
  exports.listTunnels = listTunnels;
7
6
  exports.uninstallTunnel = uninstallTunnel;
8
7
  /**
9
8
  * Account-server client for tunnel lifecycle. The daemon authenticates with
10
- * the device JWT from `repoburg login` (~/.repoburg/token.jwt).
9
+ * the device JWT from the device login (~/.repoburg/token.jwt): the Remote
10
+ * Access dialog's "Continue with Google" or `repoburg login`.
11
11
  */
12
12
  const authManager_1 = require("../auth/authManager");
13
+ const accountServer_1 = require("../auth/accountServer");
14
+ Object.defineProperty(exports, "accountServerUrl", { enumerable: true, get: function () { return accountServer_1.accountServerUrl; } });
13
15
  const tunnel_state_1 = require("./tunnel-state");
14
- const isDevelopment = process.env.NODE_ENV === 'development';
15
- const DEFAULT_ACCOUNT_SERVER_URL = isDevelopment
16
- ? 'http://localhost:2999'
17
- : 'https://repoburg.com/api/account';
18
- function accountServerUrl() {
19
- return process.env.ACCOUNT_SERVER_URL ?? DEFAULT_ACCOUNT_SERVER_URL;
20
- }
21
16
  class ProvisioningError extends Error {
22
17
  constructor(message, statusCode) {
23
18
  super(message);
@@ -26,7 +21,7 @@ class ProvisioningError extends Error {
26
21
  }
27
22
  exports.ProvisioningError = ProvisioningError;
28
23
  async function callAccountServer(method, path, token, body) {
29
- const response = await fetch(`${accountServerUrl()}${path}`, {
24
+ const response = await fetch(`${(0, accountServer_1.accountServerUrl)()}${path}`, {
30
25
  method,
31
26
  headers: {
32
27
  Authorization: `Bearer ${token}`,
@@ -48,7 +43,7 @@ async function callAccountServer(method, path, token, body) {
48
43
  async function provisionTunnel(mahlas) {
49
44
  const token = await authManager_1.authManager.readToken();
50
45
  if (!token) {
51
- throw new ProvisioningError('Not logged in. Run `repoburg login` first.', 401);
46
+ throw new ProvisioningError('Not signed in to a Repoburg account.', 401);
52
47
  }
53
48
  // `edgeAuth`: this daemon checks the edge gate's tokens (MUH-108). The
54
49
  // account server refuses daemons that do not say so (426).
@@ -31,7 +31,8 @@ Start with list_sessions or get_session_summary (session_id "latest" is the most
31
31
  Request and response bodies are only returned by get_request or with include_bodies=true. Sensitive headers are shown as [redacted].
32
32
  Recordings made in deep mode also have the real request headers and cookies, the timing split, why a request failed (CORS, blocked cookies, mixed content) and WebSocket connections: get_network with kind=websocket lists them, get_request on a connection pages its messages.
33
33
  get_session_summary says how the JS heap grew over the recording; get_context_at gives the heap at the moment and ends with the last store actions before it and the state paths they changed.
34
- To record a browser you drive yourself (Playwright MCP, a Playwright script), get_record_link returns links that start and stop a recording in it; open the start link before the check and the stop link after it. That browser needs the tabtape extension; start_proxy_recording needs none and works in any browser: open the URL it returns and call stop_proxy_recording after the check.`;
34
+ To record a browser you drive yourself (Playwright MCP, a Playwright script), get_record_link returns links that start and stop a recording in it; open the start link before the check and the stop link after it. That browser needs the tabtape extension; start_proxy_recording needs none and works in any browser: open the URL it returns and call stop_proxy_recording after the check.
35
+ When you check a change end-to-end in a browser, record the check and give the user its replay link: with Playwright MCP, call get_record_link (name: what you check, url: the first page), open the start link with browser_navigate, do the check, then open the stop link, whose page shows the replay link; in a browser without the extension, use start_proxy_recording and stop_proxy_recording. When a check fails, look into its recording with these tools before guessing. If recording does not work (the start page says "Nothing happened", or tabtape cannot be reached), carry on with the check and tell the user the recording failed; never skip it silently.`;
35
36
  const RESOURCE_PREFIX = 'tabtape://session/';
36
37
  const SESSION_TEMPLATE = {
37
38
  name: 'session',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repoburg",
3
- "version": "1.3.312",
3
+ "version": "1.3.314",
4
4
  "description": "A local AI-powered software developer assistant that runs on your own machine.",
5
5
  "author": "Celal Ertug",
6
6
  "license": "SEE LICENSE IN LICENSE",
package/platform-cli.js CHANGED
@@ -149,11 +149,12 @@ program
149
149
  // 2. Initiate login
150
150
  console.log(chalk.yellow('Opening your browser to log in...'));
151
151
  const initiateResponse = await axios.post(`${DAEMON_BASE_URL}/auth/initiate`);
152
- const { loginUrl } = initiateResponse.data;
152
+ const { loginUrl, userCode } = initiateResponse.data;
153
153
 
154
154
  if (loginUrl) {
155
155
  await open(loginUrl);
156
156
  console.log(chalk.green('✓ Please complete the authentication in your browser.'));
157
+ if (userCode) console.log(chalk.cyan(` Approve it only if the page shows the code ${userCode}.`));
157
158
  await pollForAuth();
158
159
  } else {
159
160
  console.error(chalk.red('Could not retrieve login URL from the daemon.'));
@@ -354,11 +355,12 @@ program
354
355
  try {
355
356
  console.log(chalk.yellow('Opening your browser to log in...'));
356
357
  const response = await axios.post(`${DAEMON_BASE_URL}/auth/initiate`);
357
- const { loginUrl } = response.data;
358
+ const { loginUrl, userCode } = response.data;
358
359
 
359
360
  if (loginUrl) {
360
361
  await open(loginUrl);
361
362
  console.log(chalk.green('✓ Please complete the authentication in your browser.'));
363
+ if (userCode) console.log(chalk.cyan(` Approve it only if the page shows the code ${userCode}.`));
362
364
  } else {
363
365
  console.error(chalk.red('Could not retrieve login URL from the daemon.'));
364
366
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "tree": "3f01773d2dfcfcfee7b73a8c7d7497c15ad692bc",
3
- "commit": "98373b2b5d9e1ece8cbc7ffe6a38862f0a9a1695",
3
+ "commit": "87745c14c1f37aed331c5136e327bb7977eab678",
4
4
  "dirty": false,
5
- "repoburgVersion": "1.3.312",
6
- "builtAt": "2026-11-09T03:36:41.034Z"
5
+ "repoburgVersion": "1.3.314",
6
+ "builtAt": "2026-11-09T07:10:52.151Z"
7
7
  }
@@ -58,5 +58,5 @@
58
58
  ]
59
59
  }
60
60
  ],
61
- "version_name": "0.6.0 (repoburg 1.3.312, 98373b2)"
61
+ "version_name": "0.6.0 (repoburg 1.3.314, 87745c1)"
62
62
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "tree": "3f01773d2dfcfcfee7b73a8c7d7497c15ad692bc",
3
- "commit": "98373b2b5d9e1ece8cbc7ffe6a38862f0a9a1695",
3
+ "commit": "87745c14c1f37aed331c5136e327bb7977eab678",
4
4
  "dirty": false,
5
- "repoburgVersion": "1.3.312",
6
- "builtAt": "2026-11-09T03:36:41.034Z"
5
+ "repoburgVersion": "1.3.314",
6
+ "builtAt": "2026-11-09T07:10:52.151Z"
7
7
  }