@integrity-labs/agt-cli 0.28.1264 → 0.28.1266

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 (39) hide show
  1. package/dist/{api-client-Q2FXLBH5.js → api-client-5CNPCJKS.js} +3 -3
  2. package/dist/bin/agt.js +8 -8
  3. package/dist/{chunk-GSMGU2QA.js → chunk-7Z3N4G2Y.js} +6 -6
  4. package/dist/{chunk-5BXIXSSH.js → chunk-BMO6GCK2.js} +2 -2
  5. package/dist/{chunk-C3PSUSJ2.js → chunk-SGYCPC5K.js} +3 -3
  6. package/dist/{chunk-KJ5OCCSJ.js → chunk-W2GHPRPZ.js} +2 -2
  7. package/dist/{chunk-KJ5OCCSJ.js.map → chunk-W2GHPRPZ.js.map} +1 -1
  8. package/dist/{chunk-GZMUGH6X.js → chunk-WJUGK4R5.js} +48 -32
  9. package/dist/chunk-WJUGK4R5.js.map +1 -0
  10. package/dist/{chunk-HJWOXFJM.js → chunk-X2FBQPNR.js} +2 -2
  11. package/dist/{chunk-HYQ7VOC3.js → chunk-XL2HPM67.js} +19 -3
  12. package/dist/chunk-XL2HPM67.js.map +1 -0
  13. package/dist/{claude-code-updater-JQLNRK25.js → claude-code-updater-XISTQTZX.js} +3 -3
  14. package/dist/{claude-pair-runtime-M6VJ3KZ3.js → claude-pair-runtime-2XKML4U6.js} +16 -14
  15. package/dist/claude-pair-runtime-2XKML4U6.js.map +1 -0
  16. package/dist/lib/manager-worker.js +42 -40
  17. package/dist/lib/manager-worker.js.map +1 -1
  18. package/dist/mcp/direct-chat-channel.js +8 -2
  19. package/dist/mcp/index.js +1 -1
  20. package/dist/mcp/origami.js +1 -1
  21. package/dist/mcp/slack-channel.js +8 -2
  22. package/dist/mcp/telegram-channel.js +8 -2
  23. package/dist/mcp/xero.js +727 -169
  24. package/dist/{persistent-session-3OES5QXZ.js → persistent-session-YBCMFF7T.js} +7 -5
  25. package/dist/{responsiveness-probe-BSSNRCPM.js → responsiveness-probe-ZOCD6UYO.js} +5 -5
  26. package/dist/{session-auth-dead-A3TO2N63.js → session-auth-dead-U62KZ342.js} +3 -3
  27. package/package.json +1 -1
  28. package/dist/chunk-GZMUGH6X.js.map +0 -1
  29. package/dist/chunk-HYQ7VOC3.js.map +0 -1
  30. package/dist/claude-pair-runtime-M6VJ3KZ3.js.map +0 -1
  31. /package/dist/{api-client-Q2FXLBH5.js.map → api-client-5CNPCJKS.js.map} +0 -0
  32. /package/dist/{chunk-GSMGU2QA.js.map → chunk-7Z3N4G2Y.js.map} +0 -0
  33. /package/dist/{chunk-5BXIXSSH.js.map → chunk-BMO6GCK2.js.map} +0 -0
  34. /package/dist/{chunk-C3PSUSJ2.js.map → chunk-SGYCPC5K.js.map} +0 -0
  35. /package/dist/{chunk-HJWOXFJM.js.map → chunk-X2FBQPNR.js.map} +0 -0
  36. /package/dist/{claude-code-updater-JQLNRK25.js.map → claude-code-updater-XISTQTZX.js.map} +0 -0
  37. /package/dist/{persistent-session-3OES5QXZ.js.map → persistent-session-YBCMFF7T.js.map} +0 -0
  38. /package/dist/{responsiveness-probe-BSSNRCPM.js.map → responsiveness-probe-ZOCD6UYO.js.map} +0 -0
  39. /package/dist/{session-auth-dead-A3TO2N63.js.map → session-auth-dead-U62KZ342.js.map} +0 -0
@@ -47347,7 +47347,7 @@ var FLAG_REGISTRY = [
47347
47347
  },
47348
47348
  {
47349
47349
  key: "org-two-factor-enforcement",
47350
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47350
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
47351
47351
  flagType: "boolean",
47352
47352
  defaultValue: false,
47353
47353
  // Turning it on changes the admission rule for people on the platform's
@@ -49056,9 +49056,15 @@ function probeClaudeProcessInTmux(tmuxSession) {
49056
49056
  return e?.status === 1 ? "dead" : "unknown";
49057
49057
  }
49058
49058
  }
49059
+ function tmuxSessionTarget(session) {
49060
+ let n = session;
49061
+ if (n.startsWith("=")) n = n.slice(1);
49062
+ if (n.endsWith(":")) n = n.slice(0, -1);
49063
+ return `=${n}`;
49064
+ }
49059
49065
  function probeTmuxSession(tmuxSession) {
49060
49066
  try {
49061
- execFileSync("tmux", ["has-session", "-t", tmuxSession], {
49067
+ execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
49062
49068
  stdio: "ignore",
49063
49069
  timeout: 3e3
49064
49070
  });
package/dist/mcp/index.js CHANGED
@@ -32980,7 +32980,7 @@ var FLAG_REGISTRY = [
32980
32980
  },
32981
32981
  {
32982
32982
  key: "org-two-factor-enforcement",
32983
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32983
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
32984
32984
  flagType: "boolean",
32985
32985
  defaultValue: false,
32986
32986
  // Turning it on changes the admission rule for people on the platform's
@@ -46782,7 +46782,7 @@ var FLAG_REGISTRY = [
46782
46782
  },
46783
46783
  {
46784
46784
  key: "org-two-factor-enforcement",
46785
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46785
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
46786
46786
  flagType: "boolean",
46787
46787
  defaultValue: false,
46788
46788
  // Turning it on changes the admission rule for people on the platform's
@@ -41637,7 +41637,7 @@ var FLAG_REGISTRY = [
41637
41637
  },
41638
41638
  {
41639
41639
  key: "org-two-factor-enforcement",
41640
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41640
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
41641
41641
  flagType: "boolean",
41642
41642
  defaultValue: false,
41643
41643
  // Turning it on changes the admission rule for people on the platform's
@@ -42665,9 +42665,15 @@ function probeClaudeProcessInTmux(tmuxSession) {
42665
42665
  return e?.status === 1 ? "dead" : "unknown";
42666
42666
  }
42667
42667
  }
42668
+ function tmuxSessionTarget(session) {
42669
+ let n = session;
42670
+ if (n.startsWith("=")) n = n.slice(1);
42671
+ if (n.endsWith(":")) n = n.slice(0, -1);
42672
+ return `=${n}`;
42673
+ }
42668
42674
  function probeTmuxSession(tmuxSession) {
42669
42675
  try {
42670
- execFileSync("tmux", ["has-session", "-t", tmuxSession], {
42676
+ execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
42671
42677
  stdio: "ignore",
42672
42678
  timeout: 3e3
42673
42679
  });
@@ -42103,7 +42103,7 @@ var FLAG_REGISTRY = [
42103
42103
  },
42104
42104
  {
42105
42105
  key: "org-two-factor-enforcement",
42106
- description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. NOT YET COVERED: direct database access. A stolen password plus the public anon key gives an aal1 JWT that Supabase PostgREST and Realtime still accept, so until ENG-12033 (ENG-12023 slice 3) adds an aal2 RLS policy and Realtime channel auth, enforcement stays OFF in code (ORG_TWO_FACTOR_UNCOVERED_SURFACES) even with this flag on. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
42106
+ description: "ENG-11881: the global off switch for refusing single-factor sessions in authMiddleware ENG-12023: also enforced by hostAuthMiddleware, and in the webapp, whose middleware asks GET /me/two-factor-gate (the same check) and sends a refused person to the code screen or to authenticator setup, and refuses its /api handlers with the same 403. It also gates the MCP OAuth consent flow (/oauth/authorize, /oauth/consent, POST /oauth/consent/approve, the only place an OAuth code is minted), so a single-factor session cannot mint a long-lived token. A test pins that every named createMiddleware in packages/api/src/middleware and routes that stamps a user runs the check (and that no file there stamps one from an unnamed middleware), except OAuth-token principals (userOAuthMiddleware, the MCP token validator), which carry no session level and are covered by that consent gate, and the admin-debug staff principal, which is not a GoTrue session. Tokens minted BEFORE enforcement is on keep working until they expire or are revoked. Direct database access (ENG-12033): the SAME flag row drives a RESTRICTIVE org_two_factor_required RLS policy on every RLS table, realtime.messages and storage.objects. The API, the webapp and the database all read this one flag row, so they never settle in different states while that read works. One exception: if the API cannot read the flag it treats enforcement as OFF (as every flag read failure here does), while the database keeps enforcing, so for as long as that read fails an aal1 member of a requiring org can see no organization instead of being sent to setup. They are not in lockstep, though: the database reads the row on every statement, while the API and the webapp gate read it through the ~60s evaluation cache. For up to a minute after turning it ON, an aal1 member of a requiring org can see no organization (the database already enforces, the gate does not yet redirect them to setup); for up to a minute after turning it OFF, the API may still refuse them. The database refuses to turn this ON while public.org_two_factor_db_uncovered() reports anything (a table without the policy, a storage policy the migration role could not create, a readable view that does not run as the caller, a table with RLS off that authenticated can touch, or a SECURITY DEFINER function in public that authenticated can execute and that is not on the reviewed allowlist, since each of those bypasses RLS). Turning it OFF always works. If something becomes uncovered while it is on, enforcement stays on and the API raises a critical org_two_factor_db_coverage_gap alert naming it. Exempt there as here: aal2, SSO, live impersonation sessions, host and broker tokens. (packages/api/src/lib/org-two-factor-enforcement.ts). When on, a person in any organization with the `require_two_factor` setting gets a 403 with code two_factor_required on every authMiddleware route until their session is aal2, apart from POST /auth/sign-out, DELETE /devices and the routes a person needs before they can have a second factor (GET /auth/me, GET /auth/pending-invitations, POST /auth/complete-invite, POST /auth/link-identity, POST /auth/ensure-person; each acts only on the identity of the caller), and the two reads the authenticator-setup screen needs (GET /flags, GET /me/onboarding). The credential-adding routes and those two reads are reachable single-factor ONLY for a person with no verified factor yet; see SINGLE_FACTOR_ROUTES. SSO accounts are exempt; impersonation and admin-onboarding are exempt with an audit row, and refused if the row cannot be written. First-party tokens (host-exchange and the rest) are out of scope. MUST STAY OFF until a human confirms the iOS two-factor code screen has shipped: with it on, an aal1 phone session in a requiring org can do nothing but sign out. It is evaluated with no org in context, so it is stage-wide and a per-org override would be inert. A flag-read failure degrades to off. Deliberately NO envVar (the API Lambda environment is at the AWS 4KB cap, ENG-7972, and an envVar would pin every stage). Flipping it back takes effect within the ~60s evaluation cache, with no deploy.",
42107
42107
  flagType: "boolean",
42108
42108
  defaultValue: false,
42109
42109
  // Turning it on changes the admission rule for people on the platform's
@@ -43573,9 +43573,15 @@ function probeClaudeProcessInTmux(tmuxSession) {
43573
43573
  return e?.status === 1 ? "dead" : "unknown";
43574
43574
  }
43575
43575
  }
43576
+ function tmuxSessionTarget(session) {
43577
+ let n = session;
43578
+ if (n.startsWith("=")) n = n.slice(1);
43579
+ if (n.endsWith(":")) n = n.slice(0, -1);
43580
+ return `=${n}`;
43581
+ }
43576
43582
  function probeTmuxSession(tmuxSession) {
43577
43583
  try {
43578
- execFileSync("tmux", ["has-session", "-t", tmuxSession], {
43584
+ execFileSync("tmux", ["has-session", "-t", tmuxSessionTarget(tmuxSession)], {
43579
43585
  stdio: "ignore",
43580
43586
  timeout: 3e3
43581
43587
  });