@inerrata-corporation/errata 2.0.6-dev.2082 → 2.0.6-dev.2115

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 (2) hide show
  1. package/errata.mjs +18 -6
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -77056,7 +77056,7 @@ function createWatchBreaker(deps) {
77056
77056
  }
77057
77057
 
77058
77058
  // src/engine.ts
77059
- var DAEMON_VERSION = true ? "2.0.6-dev.2082" : "2.0.0-alpha.0";
77059
+ var DAEMON_VERSION = true ? "2.0.6-dev.2115" : "2.0.0-alpha.0";
77060
77060
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
77061
77061
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
77062
77062
  var GIT_OP_MUTE_MS = 4e3;
@@ -82578,10 +82578,21 @@ init_cloud_auth();
82578
82578
  import { createServer } from "node:http";
82579
82579
  var DEFAULT_OAUTH_SCOPE = "openid profile graph:read graph:write mcp:tools";
82580
82580
  var strip = (u) => u.replace(/\/+$/, "");
82581
- function deviceEndpoints(tokenEndpoint) {
82581
+ function deviceEndpoints(tokenEndpoint, deviceAuthorizationEndpoint) {
82582
82582
  const token = new URL(tokenEndpoint);
82583
82583
  const authRoot = token.pathname.replace(/\/(?:oauth2|mcp)\/token\/?$/, "");
82584
- if (authRoot === token.pathname) throw new Error("authorization server exposes no device endpoint");
82584
+ if (authRoot === token.pathname) {
82585
+ if (deviceAuthorizationEndpoint) {
82586
+ const device = new URL(deviceAuthorizationEndpoint);
82587
+ const code = `${device.origin}${device.pathname.replace(/\/+$/, "")}`;
82588
+ return {
82589
+ code,
82590
+ token: `${code}/token`,
82591
+ resource: new URL("/api/gate/session-token", device.origin).toString()
82592
+ };
82593
+ }
82594
+ throw new Error("authorization server exposes no device endpoint");
82595
+ }
82585
82596
  const prefix = authRoot.replace(/\/api\/auth\/?$/, "");
82586
82597
  const at = (path2) => new URL(`${path2}`, `${token.origin}${prefix || "/"}`).toString();
82587
82598
  return {
@@ -82593,7 +82604,7 @@ function deviceEndpoints(tokenEndpoint) {
82593
82604
  async function loginOAuthDevice(opts) {
82594
82605
  const fetchFn = opts.fetchFn ?? fetch;
82595
82606
  const endpoints = await discoverEndpoints(opts.cloudUrl, fetchFn);
82596
- const device = deviceEndpoints(endpoints.tokenEndpoint);
82607
+ const device = deviceEndpoints(endpoints.tokenEndpoint, endpoints.deviceAuthorizationEndpoint);
82597
82608
  const clientId = oauthClientId();
82598
82609
  const scope = opts.scope ?? DEFAULT_OAUTH_SCOPE;
82599
82610
  const codeResponse = await fetchFn(device.code, {
@@ -82692,7 +82703,8 @@ async function discoverEndpoints(cloudUrl, fetchFn = fetch) {
82692
82703
  return {
82693
82704
  authorizationEndpoint: j.authorization_endpoint,
82694
82705
  tokenEndpoint: j.token_endpoint,
82695
- ...j.registration_endpoint ? { registrationEndpoint: j.registration_endpoint } : {}
82706
+ ...j.registration_endpoint ? { registrationEndpoint: j.registration_endpoint } : {},
82707
+ ...j.device_authorization_endpoint ? { deviceAuthorizationEndpoint: j.device_authorization_endpoint } : {}
82696
82708
  };
82697
82709
  }
82698
82710
  }
@@ -82809,7 +82821,7 @@ function isDecision(value) {
82809
82821
  async function linkThroughConsole(opts) {
82810
82822
  const fetchFn = opts.fetchFn ?? fetch;
82811
82823
  const endpoints = await discoverEndpoints(opts.cloudUrl, fetchFn);
82812
- const device = deviceEndpoints(endpoints.tokenEndpoint);
82824
+ const device = deviceEndpoints(endpoints.tokenEndpoint, endpoints.deviceAuthorizationEndpoint);
82813
82825
  const clientId = oauthClientId();
82814
82826
  const link = {
82815
82827
  locator: opts.facts.locator,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2082",
3
+ "version": "2.0.6-dev.2115",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {