@integrity-labs/agt-cli 0.28.1253 → 0.28.1254

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 (35) hide show
  1. package/dist/{api-client-5ZXNFF4W.js → api-client-EW7NBMWI.js} +3 -3
  2. package/dist/bin/agt.js +7 -7
  3. package/dist/{chunk-233HXJ2D.js → chunk-AZOT5URF.js} +2 -2
  4. package/dist/{chunk-UHT6L77A.js → chunk-EWD3K6YD.js} +40 -3
  5. package/dist/{chunk-UHT6L77A.js.map → chunk-EWD3K6YD.js.map} +1 -1
  6. package/dist/{chunk-2HF77X4C.js → chunk-FD3GWWVL.js} +3 -3
  7. package/dist/{chunk-UBGHZ2O2.js → chunk-SEXB6LTM.js} +194 -9
  8. package/dist/chunk-SEXB6LTM.js.map +1 -0
  9. package/dist/{chunk-CMLBFY5C.js → chunk-ZDON4IXL.js} +2 -2
  10. package/dist/{chunk-GRTMENH5.js → chunk-ZKLOPCWS.js} +20 -9
  11. package/dist/{chunk-GRTMENH5.js.map → chunk-ZKLOPCWS.js.map} +1 -1
  12. package/dist/{claude-code-updater-EKABTDXO.js → claude-code-updater-CHEL6LOF.js} +3 -3
  13. package/dist/{claude-pair-runtime-ZA24UQ7V.js → claude-pair-runtime-AGJH54AR.js} +3 -3
  14. package/dist/lib/manager-worker.js +50 -33
  15. package/dist/lib/manager-worker.js.map +1 -1
  16. package/dist/mcp/direct-chat-channel.js +33 -2
  17. package/dist/mcp/index.js +33 -2
  18. package/dist/mcp/origami.js +33 -2
  19. package/dist/mcp/remote-oauth-proxy.js +142 -5
  20. package/dist/mcp/slack-channel.js +33 -2
  21. package/dist/mcp/telegram-channel.js +33 -2
  22. package/dist/{persistent-session-HXK2Z6GH.js → persistent-session-HQPQPNPK.js} +4 -4
  23. package/dist/{responsiveness-probe-TPKISRGQ.js → responsiveness-probe-6GNSPLD2.js} +4 -4
  24. package/dist/{session-auth-dead-KMB35KRB.js → session-auth-dead-4Z24MU6C.js} +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-UBGHZ2O2.js.map +0 -1
  27. /package/dist/{api-client-5ZXNFF4W.js.map → api-client-EW7NBMWI.js.map} +0 -0
  28. /package/dist/{chunk-233HXJ2D.js.map → chunk-AZOT5URF.js.map} +0 -0
  29. /package/dist/{chunk-2HF77X4C.js.map → chunk-FD3GWWVL.js.map} +0 -0
  30. /package/dist/{chunk-CMLBFY5C.js.map → chunk-ZDON4IXL.js.map} +0 -0
  31. /package/dist/{claude-code-updater-EKABTDXO.js.map → claude-code-updater-CHEL6LOF.js.map} +0 -0
  32. /package/dist/{claude-pair-runtime-ZA24UQ7V.js.map → claude-pair-runtime-AGJH54AR.js.map} +0 -0
  33. /package/dist/{persistent-session-HXK2Z6GH.js.map → persistent-session-HQPQPNPK.js.map} +0 -0
  34. /package/dist/{responsiveness-probe-TPKISRGQ.js.map → responsiveness-probe-6GNSPLD2.js.map} +0 -0
  35. /package/dist/{session-auth-dead-KMB35KRB.js.map → session-auth-dead-4Z24MU6C.js.map} +0 -0
@@ -42667,7 +42667,12 @@ var REMOTE_MCP_PROXY_ENV = {
42667
42667
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
42668
42668
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
42669
42669
  // looks like, so the connectivity probe has nothing to reconstruct from it.
42670
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
42670
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
42671
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
42672
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
42673
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
42674
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
42675
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
42671
42676
  };
42672
42677
  var REMOTE_MCP_AUTH_ENV_KEYS = [
42673
42678
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -46790,7 +46795,7 @@ var FLAG_REGISTRY = [
46790
46795
  },
46791
46796
  {
46792
46797
  key: "scheduled-task-nudge-durable",
46793
- description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager keeps the current tmux send-keys delivery, byte-for-byte as today. This is the kill switch: ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061); flip OFF to fall back to send-keys instantly without a code rollback if the durable path misbehaves. Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
46798
+ description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager delivers the nudge by tmux send-keys. ONE EXCEPTION, whatever this flag says (ENG-8006): when send-keys reaches nothing because the session is down or restarting, the nudge is still queued on the durable rail for the next session, and if that enqueue fails the card is closed as failed. So OFF is a partial kill switch: it takes live sessions off the rail, but not firings whose session is down. ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061). During a rail incident, OFF limits the blast radius to down-session firings, and those show up as cards closed failed with "scheduled-task nudge undeliverable". Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
46794
46799
  flagType: "boolean",
46795
46800
  // Declared safe value is `false`: the current, reverted-to send-keys delivery. Turning
46796
46801
  // it ON activates the durable rail per org/host once operators are confident. `false`
@@ -47108,6 +47113,32 @@ var FLAG_REGISTRY = [
47108
47113
  // `sensitive: true`, plus the two gates spelled out in the description.
47109
47114
  since: "0.28.1015"
47110
47115
  },
47116
+ {
47117
+ key: "remote-mcp-oauth-broker-credentials",
47118
+ description: "Deliver the bearer of every OAuth remote MCP served through remote-oauth-proxy (OAUTH_PROVIDERS entries with an mcpUrl: granola, brand-ninja, kajabi, otter, plaud, datadog-ap1/ap2 today) through the broker credential endpoint at USE time, instead of materializing it into `.env.integrations` (ENG-12046). Mechanically the sibling of `xero-broker-credentials`. ON: POST /host/agent-integrations strips `access_token`, `refresh_token` and `token_expires_at` from those rows and marks them credential_delivery=broker, so `<DEF>_ACCESS_TOKEN` is no longer written to `.env.integrations` and so is no longer in the agent process env (the session wrapper `source`s that file with `set -a`). The claudecode adapter then emits AGT_REMOTE_MCP_INTEGRATION_ID instead of a token file/var, and the proxy fetches the bearer per use from POST /host/agent-integrations/<uuid>/credential with the agent's own host credentials (memory only, fail closed, no fallback). OFF (default): byte-for-byte today's behaviour. THIS IS HYGIENE, NOT A BOUNDARY: an agent that calls the same fetch can still obtain the token. The binding control for broad-scope providers (Datadog mcp_all) remains a read-only provider user; the real boundary is ENG-12047 (host-side proxy). SINCE IS A PLACEHOLDER: `since` (0.29.0) is an unreachable placeholder, not a verified threshold. Before enabling, replace it with the first published agt-cli whose remote-oauth-proxy carries broker mode (bisected from the tarballs), or the reach estimate means nothing. FLIP GATE: an under-`since` host honours the marker (it skips the token write, ENG-8344) but still emits a token-file proxy entry, so its remote OAuth MCPs answer \"no current access token\" for every call: an outage of those integrations, not a leak. Zero hosts carrying these integrations below `since` per hosts.agt_version before flipping, counting NULL as unconverged. agt_version names the bundle on disk, not the running proxy: a session started before the update keeps its pre-broker proxy until it restarts, so also confirm every affected session has respawned. HARD GATE: Do not enable, for any provider, until ENG-12053 is merged AND deployed to every API instance serving the credential route (a merge alone is not enough: an older route ignores on_missing_expiry: 'serve'), and a fetch with it on a no-expiry row is verified not to refresh. Reason: a provider whose refresh response omits expires_in makes oauth-refresh drop token_expires_at, the credential route treats that as \"refresh now\", and the row then refreshes about every 60s; the next poll returns the row to env delivery, but that does NOT respawn the running session, so its proxy keeps refreshing about every 60s until some unrelated restart (provider rate limits, token churn, possible lockouts). None of the in-scope providers (granola, brand-ninja, kajabi, otter, plaud, datadog-ap1, datadog-ap2) is verified on expires_in, and the flag covers all of them at once, so no per-provider exception exists. claude-code agents only: opencode has no broker path and keeps env delivery. See docs/runbooks/remote-mcp-oauth-broker-credentials-rollout.md.",
47119
+ flagType: "boolean",
47120
+ // `false` = today's env delivery. A wrongly-ON flip on an unconverged host is
47121
+ // an outage of the remote OAuth MCPs (see the description), so the ON path is
47122
+ // the one with a reach precondition.
47123
+ defaultValue: false,
47124
+ // Changes how every remote-OAuth MCP on the scope authenticates. A
47125
+ // deliberate, confirmed action (ADR-0022 §4).
47126
+ sensitive: true,
47127
+ // ADR-0120: an org owner/admin must not be able to switch this on for their
47128
+ // own org before its prerequisites (ENG-12053 deployed, hosts and sessions
47129
+ // converged) are met. Nothing in code enforces those gates, and an early
47130
+ // enable is an outage of that org's remote OAuth MCPs (CodeRabbit on #7568).
47131
+ platformAdminOnly: true,
47132
+ // PLACEHOLDER, like `github-broker-credentials` shipped with. Replace with the
47133
+ // first published agt-cli whose remote-oauth-proxy carries broker mode
47134
+ // (grep the bundle for AGT_REMOTE_MCP_INTEGRATION_ID), bisected from the
47135
+ // tarballs as `xero-broker-credentials` did. This version names the bundle on
47136
+ // disk. remote-oauth-proxy.js is not in RESTARTABLE_CHANNEL_FILES, so a
47137
+ // session started before the update keeps its older proxy until it restarts:
47138
+ // a host at this version can still run a pre-broker proxy. Advisory only: it
47139
+ // feeds computeFlagReach, it does not block a flip.
47140
+ since: "0.29.0"
47141
+ },
47111
47142
  {
47112
47143
  key: "help-kb-auto-grant",
47113
47144
  description: "Auto-grant the `augmented-help-kb` integration at ORG scope when an organization is provisioned (ENG-8542), so every agent in that org gets product-doc search without a per-agent operator action. One organization_integrations row reaches every agent in the org: POST /host/agent-integrations merges org -> team -> agent and buildMcpJson's predicate reads that merged set with no scope filter. ON: the two org-provisioning call sites write the row (status=active, created_by=the org owner). OFF (default): they write nothing - byte-for-byte today's behaviour. STAGED ROLLOUT IS THE POINT. ENG-8332 argues against widening distribution of the help KB until two things close, because distributing a corpus with wrong articles \"converts one agent's wrong answer into everyone's\": (1) a live 200 from GET /host/kb/search as the anon role has still never been observed - ENG-7260 was closed on remediation evidence, not on a live call, and the deploy seed log is SERVICE-ROLE evidence that says nothing about the anon grant; (2) the `site-structure` article is unverified against the current IA. Turning this on for ONE org and watching that org's help-kb connectivity-probe verdicts (ENG-8332 added a real mcp_stdio probe that calls search_knowledge_base) is the cheap positive control for (1) - an ENG-7260-class 500 then reports as `down` per agent instead of as silence. Widen only after it comes back healthy. REVOKING IS DELETING THE ROW, not flipping this off: the flag gates GRANTING, so an already-granted org keeps its row when the flag goes off. Evaluated API-side only, per org, inside grantHelpKbToOrg; no host-side envVar and deliberately no sst.config.ts entry (a literal default there would pin it - ENG-8303).",
package/dist/mcp/index.js CHANGED
@@ -28763,7 +28763,12 @@ var REMOTE_MCP_PROXY_ENV = {
28763
28763
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
28764
28764
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
28765
28765
  // looks like, so the connectivity probe has nothing to reconstruct from it.
28766
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
28766
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
28767
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
28768
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
28769
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
28770
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
28771
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
28767
28772
  };
28768
28773
  var REMOTE_MCP_AUTH_ENV_KEYS = [
28769
28774
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -32472,7 +32477,7 @@ var FLAG_REGISTRY = [
32472
32477
  },
32473
32478
  {
32474
32479
  key: "scheduled-task-nudge-durable",
32475
- description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager keeps the current tmux send-keys delivery, byte-for-byte as today. This is the kill switch: ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061); flip OFF to fall back to send-keys instantly without a code rollback if the durable path misbehaves. Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
32480
+ description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager delivers the nudge by tmux send-keys. ONE EXCEPTION, whatever this flag says (ENG-8006): when send-keys reaches nothing because the session is down or restarting, the nudge is still queued on the durable rail for the next session, and if that enqueue fails the card is closed as failed. So OFF is a partial kill switch: it takes live sessions off the rail, but not firings whose session is down. ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061). During a rail incident, OFF limits the blast radius to down-session firings, and those show up as cards closed failed with "scheduled-task nudge undeliverable". Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
32476
32481
  flagType: "boolean",
32477
32482
  // Declared safe value is `false`: the current, reverted-to send-keys delivery. Turning
32478
32483
  // it ON activates the durable rail per org/host once operators are confident. `false`
@@ -32790,6 +32795,32 @@ var FLAG_REGISTRY = [
32790
32795
  // `sensitive: true`, plus the two gates spelled out in the description.
32791
32796
  since: "0.28.1015"
32792
32797
  },
32798
+ {
32799
+ key: "remote-mcp-oauth-broker-credentials",
32800
+ description: "Deliver the bearer of every OAuth remote MCP served through remote-oauth-proxy (OAUTH_PROVIDERS entries with an mcpUrl: granola, brand-ninja, kajabi, otter, plaud, datadog-ap1/ap2 today) through the broker credential endpoint at USE time, instead of materializing it into `.env.integrations` (ENG-12046). Mechanically the sibling of `xero-broker-credentials`. ON: POST /host/agent-integrations strips `access_token`, `refresh_token` and `token_expires_at` from those rows and marks them credential_delivery=broker, so `<DEF>_ACCESS_TOKEN` is no longer written to `.env.integrations` and so is no longer in the agent process env (the session wrapper `source`s that file with `set -a`). The claudecode adapter then emits AGT_REMOTE_MCP_INTEGRATION_ID instead of a token file/var, and the proxy fetches the bearer per use from POST /host/agent-integrations/<uuid>/credential with the agent's own host credentials (memory only, fail closed, no fallback). OFF (default): byte-for-byte today's behaviour. THIS IS HYGIENE, NOT A BOUNDARY: an agent that calls the same fetch can still obtain the token. The binding control for broad-scope providers (Datadog mcp_all) remains a read-only provider user; the real boundary is ENG-12047 (host-side proxy). SINCE IS A PLACEHOLDER: `since` (0.29.0) is an unreachable placeholder, not a verified threshold. Before enabling, replace it with the first published agt-cli whose remote-oauth-proxy carries broker mode (bisected from the tarballs), or the reach estimate means nothing. FLIP GATE: an under-`since` host honours the marker (it skips the token write, ENG-8344) but still emits a token-file proxy entry, so its remote OAuth MCPs answer \"no current access token\" for every call: an outage of those integrations, not a leak. Zero hosts carrying these integrations below `since` per hosts.agt_version before flipping, counting NULL as unconverged. agt_version names the bundle on disk, not the running proxy: a session started before the update keeps its pre-broker proxy until it restarts, so also confirm every affected session has respawned. HARD GATE: Do not enable, for any provider, until ENG-12053 is merged AND deployed to every API instance serving the credential route (a merge alone is not enough: an older route ignores on_missing_expiry: 'serve'), and a fetch with it on a no-expiry row is verified not to refresh. Reason: a provider whose refresh response omits expires_in makes oauth-refresh drop token_expires_at, the credential route treats that as \"refresh now\", and the row then refreshes about every 60s; the next poll returns the row to env delivery, but that does NOT respawn the running session, so its proxy keeps refreshing about every 60s until some unrelated restart (provider rate limits, token churn, possible lockouts). None of the in-scope providers (granola, brand-ninja, kajabi, otter, plaud, datadog-ap1, datadog-ap2) is verified on expires_in, and the flag covers all of them at once, so no per-provider exception exists. claude-code agents only: opencode has no broker path and keeps env delivery. See docs/runbooks/remote-mcp-oauth-broker-credentials-rollout.md.",
32801
+ flagType: "boolean",
32802
+ // `false` = today's env delivery. A wrongly-ON flip on an unconverged host is
32803
+ // an outage of the remote OAuth MCPs (see the description), so the ON path is
32804
+ // the one with a reach precondition.
32805
+ defaultValue: false,
32806
+ // Changes how every remote-OAuth MCP on the scope authenticates. A
32807
+ // deliberate, confirmed action (ADR-0022 §4).
32808
+ sensitive: true,
32809
+ // ADR-0120: an org owner/admin must not be able to switch this on for their
32810
+ // own org before its prerequisites (ENG-12053 deployed, hosts and sessions
32811
+ // converged) are met. Nothing in code enforces those gates, and an early
32812
+ // enable is an outage of that org's remote OAuth MCPs (CodeRabbit on #7568).
32813
+ platformAdminOnly: true,
32814
+ // PLACEHOLDER, like `github-broker-credentials` shipped with. Replace with the
32815
+ // first published agt-cli whose remote-oauth-proxy carries broker mode
32816
+ // (grep the bundle for AGT_REMOTE_MCP_INTEGRATION_ID), bisected from the
32817
+ // tarballs as `xero-broker-credentials` did. This version names the bundle on
32818
+ // disk. remote-oauth-proxy.js is not in RESTARTABLE_CHANNEL_FILES, so a
32819
+ // session started before the update keeps its older proxy until it restarts:
32820
+ // a host at this version can still run a pre-broker proxy. Advisory only: it
32821
+ // feeds computeFlagReach, it does not block a flip.
32822
+ since: "0.29.0"
32823
+ },
32793
32824
  {
32794
32825
  key: "help-kb-auto-grant",
32795
32826
  description: "Auto-grant the `augmented-help-kb` integration at ORG scope when an organization is provisioned (ENG-8542), so every agent in that org gets product-doc search without a per-agent operator action. One organization_integrations row reaches every agent in the org: POST /host/agent-integrations merges org -> team -> agent and buildMcpJson's predicate reads that merged set with no scope filter. ON: the two org-provisioning call sites write the row (status=active, created_by=the org owner). OFF (default): they write nothing - byte-for-byte today's behaviour. STAGED ROLLOUT IS THE POINT. ENG-8332 argues against widening distribution of the help KB until two things close, because distributing a corpus with wrong articles \"converts one agent's wrong answer into everyone's\": (1) a live 200 from GET /host/kb/search as the anon role has still never been observed - ENG-7260 was closed on remediation evidence, not on a live call, and the deploy seed log is SERVICE-ROLE evidence that says nothing about the anon grant; (2) the `site-structure` article is unverified against the current IA. Turning this on for ONE org and watching that org's help-kb connectivity-probe verdicts (ENG-8332 added a real mcp_stdio probe that calls search_knowledge_base) is the cheap positive control for (1) - an ENG-7260-class 500 then reports as `down` per agent instead of as silence. Widen only after it comes back healthy. REVOKING IS DELETING THE ROW, not flipping this off: the flag gates GRANTING, so an already-granted org keeps its row when the flag goes off. Evaluated API-side only, per org, inside grantHelpKbToOrg; no host-side envVar and deliberately no sst.config.ts entry (a literal default there would pin it - ENG-8303).",
@@ -42824,7 +42824,12 @@ var REMOTE_MCP_PROXY_ENV = {
42824
42824
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
42825
42825
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
42826
42826
  // looks like, so the connectivity probe has nothing to reconstruct from it.
42827
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
42827
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
42828
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
42829
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
42830
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
42831
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
42832
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
42828
42833
  };
42829
42834
  var REMOTE_MCP_AUTH_ENV_KEYS = [
42830
42835
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -46274,7 +46279,7 @@ var FLAG_REGISTRY = [
46274
46279
  },
46275
46280
  {
46276
46281
  key: "scheduled-task-nudge-durable",
46277
- description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager keeps the current tmux send-keys delivery, byte-for-byte as today. This is the kill switch: ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061); flip OFF to fall back to send-keys instantly without a code rollback if the durable path misbehaves. Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
46282
+ description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager delivers the nudge by tmux send-keys. ONE EXCEPTION, whatever this flag says (ENG-8006): when send-keys reaches nothing because the session is down or restarting, the nudge is still queued on the durable rail for the next session, and if that enqueue fails the card is closed as failed. So OFF is a partial kill switch: it takes live sessions off the rail, but not firings whose session is down. ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061). During a rail incident, OFF limits the blast radius to down-session firings, and those show up as cards closed failed with "scheduled-task nudge undeliverable". Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
46278
46283
  flagType: "boolean",
46279
46284
  // Declared safe value is `false`: the current, reverted-to send-keys delivery. Turning
46280
46285
  // it ON activates the durable rail per org/host once operators are confident. `false`
@@ -46592,6 +46597,32 @@ var FLAG_REGISTRY = [
46592
46597
  // `sensitive: true`, plus the two gates spelled out in the description.
46593
46598
  since: "0.28.1015"
46594
46599
  },
46600
+ {
46601
+ key: "remote-mcp-oauth-broker-credentials",
46602
+ description: "Deliver the bearer of every OAuth remote MCP served through remote-oauth-proxy (OAUTH_PROVIDERS entries with an mcpUrl: granola, brand-ninja, kajabi, otter, plaud, datadog-ap1/ap2 today) through the broker credential endpoint at USE time, instead of materializing it into `.env.integrations` (ENG-12046). Mechanically the sibling of `xero-broker-credentials`. ON: POST /host/agent-integrations strips `access_token`, `refresh_token` and `token_expires_at` from those rows and marks them credential_delivery=broker, so `<DEF>_ACCESS_TOKEN` is no longer written to `.env.integrations` and so is no longer in the agent process env (the session wrapper `source`s that file with `set -a`). The claudecode adapter then emits AGT_REMOTE_MCP_INTEGRATION_ID instead of a token file/var, and the proxy fetches the bearer per use from POST /host/agent-integrations/<uuid>/credential with the agent's own host credentials (memory only, fail closed, no fallback). OFF (default): byte-for-byte today's behaviour. THIS IS HYGIENE, NOT A BOUNDARY: an agent that calls the same fetch can still obtain the token. The binding control for broad-scope providers (Datadog mcp_all) remains a read-only provider user; the real boundary is ENG-12047 (host-side proxy). SINCE IS A PLACEHOLDER: `since` (0.29.0) is an unreachable placeholder, not a verified threshold. Before enabling, replace it with the first published agt-cli whose remote-oauth-proxy carries broker mode (bisected from the tarballs), or the reach estimate means nothing. FLIP GATE: an under-`since` host honours the marker (it skips the token write, ENG-8344) but still emits a token-file proxy entry, so its remote OAuth MCPs answer \"no current access token\" for every call: an outage of those integrations, not a leak. Zero hosts carrying these integrations below `since` per hosts.agt_version before flipping, counting NULL as unconverged. agt_version names the bundle on disk, not the running proxy: a session started before the update keeps its pre-broker proxy until it restarts, so also confirm every affected session has respawned. HARD GATE: Do not enable, for any provider, until ENG-12053 is merged AND deployed to every API instance serving the credential route (a merge alone is not enough: an older route ignores on_missing_expiry: 'serve'), and a fetch with it on a no-expiry row is verified not to refresh. Reason: a provider whose refresh response omits expires_in makes oauth-refresh drop token_expires_at, the credential route treats that as \"refresh now\", and the row then refreshes about every 60s; the next poll returns the row to env delivery, but that does NOT respawn the running session, so its proxy keeps refreshing about every 60s until some unrelated restart (provider rate limits, token churn, possible lockouts). None of the in-scope providers (granola, brand-ninja, kajabi, otter, plaud, datadog-ap1, datadog-ap2) is verified on expires_in, and the flag covers all of them at once, so no per-provider exception exists. claude-code agents only: opencode has no broker path and keeps env delivery. See docs/runbooks/remote-mcp-oauth-broker-credentials-rollout.md.",
46603
+ flagType: "boolean",
46604
+ // `false` = today's env delivery. A wrongly-ON flip on an unconverged host is
46605
+ // an outage of the remote OAuth MCPs (see the description), so the ON path is
46606
+ // the one with a reach precondition.
46607
+ defaultValue: false,
46608
+ // Changes how every remote-OAuth MCP on the scope authenticates. A
46609
+ // deliberate, confirmed action (ADR-0022 §4).
46610
+ sensitive: true,
46611
+ // ADR-0120: an org owner/admin must not be able to switch this on for their
46612
+ // own org before its prerequisites (ENG-12053 deployed, hosts and sessions
46613
+ // converged) are met. Nothing in code enforces those gates, and an early
46614
+ // enable is an outage of that org's remote OAuth MCPs (CodeRabbit on #7568).
46615
+ platformAdminOnly: true,
46616
+ // PLACEHOLDER, like `github-broker-credentials` shipped with. Replace with the
46617
+ // first published agt-cli whose remote-oauth-proxy carries broker mode
46618
+ // (grep the bundle for AGT_REMOTE_MCP_INTEGRATION_ID), bisected from the
46619
+ // tarballs as `xero-broker-credentials` did. This version names the bundle on
46620
+ // disk. remote-oauth-proxy.js is not in RESTARTABLE_CHANNEL_FILES, so a
46621
+ // session started before the update keeps its older proxy until it restarts:
46622
+ // a host at this version can still run a pre-broker proxy. Advisory only: it
46623
+ // feeds computeFlagReach, it does not block a flip.
46624
+ since: "0.29.0"
46625
+ },
46595
46626
  {
46596
46627
  key: "help-kb-auto-grant",
46597
46628
  description: "Auto-grant the `augmented-help-kb` integration at ORG scope when an organization is provisioned (ENG-8542), so every agent in that org gets product-doc search without a per-agent operator action. One organization_integrations row reaches every agent in the org: POST /host/agent-integrations merges org -> team -> agent and buildMcpJson's predicate reads that merged set with no scope filter. ON: the two org-provisioning call sites write the row (status=active, created_by=the org owner). OFF (default): they write nothing - byte-for-byte today's behaviour. STAGED ROLLOUT IS THE POINT. ENG-8332 argues against widening distribution of the help KB until two things close, because distributing a corpus with wrong articles \"converts one agent's wrong answer into everyone's\": (1) a live 200 from GET /host/kb/search as the anon role has still never been observed - ENG-7260 was closed on remediation evidence, not on a live call, and the deploy seed log is SERVICE-ROLE evidence that says nothing about the anon grant; (2) the `site-structure` article is unverified against the current IA. Turning this on for ONE org and watching that org's help-kb connectivity-probe verdicts (ENG-8332 added a real mcp_stdio probe that calls search_knowledge_base) is the cheap positive control for (1) - an ENG-7260-class 500 then reports as `down` per agent instead of as silence. Widen only after it comes back healthy. REVOKING IS DELETING THE ROW, not flipping this off: the flag gates GRANTING, so an already-granted org keeps its row when the flag goes off. Evaluated API-side only, per org, inside grantHelpKbToOrg; no host-side envVar and deliberately no sst.config.ts entry (a literal default there would pin it - ENG-8303).",
@@ -38,7 +38,12 @@ var REMOTE_MCP_PROXY_ENV = {
38
38
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
39
39
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
40
40
  // looks like, so the connectivity probe has nothing to reconstruct from it.
41
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
41
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
42
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
43
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
44
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
45
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
46
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
42
47
  };
43
48
  var REMOTE_MCP_AUTH_ENV_KEYS = [
44
49
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -82,6 +87,121 @@ function buildForwardHeaders(token, authHeader, extras, readVar) {
82
87
  return headers;
83
88
  }
84
89
 
90
+ // ../core/dist/integrations/remote-mcp-broker-token.js
91
+ var BROKER_TOKEN_EXPIRY_SKEW_MS = 6e4;
92
+ var BROKER_TOKEN_UNKNOWN_EXPIRY_TTL_MS = 6e4;
93
+ var BROKER_FETCH_TIMEOUT_MS = 15e3;
94
+ function trimTrailingSlashes(host) {
95
+ let end = host.length;
96
+ while (end > 0 && host.charCodeAt(end - 1) === 47)
97
+ end -= 1;
98
+ return host.slice(0, end);
99
+ }
100
+ function brokerCredentialPath(integrationId) {
101
+ return `/host/agent-integrations/${encodeURIComponent(integrationId)}/credential`;
102
+ }
103
+ var BROKER_FORCED_REFRESH_MIN_INTERVAL_MS = 5 * 60 * 1e3;
104
+ function createBrokerTokenSource(config, deps = {}) {
105
+ const fetchImpl = deps.fetchImpl ?? fetch;
106
+ const now = deps.now ?? (() => Date.now());
107
+ const host = trimTrailingSlashes(config.host);
108
+ let cached = null;
109
+ let inFlight = null;
110
+ let refreshNext = false;
111
+ let lastForcedRefreshAt = Number.NEGATIVE_INFINITY;
112
+ let generation = 0;
113
+ const missing = [
114
+ !host ? "AGT_HOST" : null,
115
+ !config.apiKey ? "AGT_API_KEY" : null,
116
+ !config.agentId ? "AGT_AGENT_ID" : null,
117
+ !config.integrationId ? "AGT_REMOTE_MCP_INTEGRATION_ID" : null
118
+ ].filter((v) => v !== null);
119
+ async function postJson(path, body, bearer) {
120
+ let res;
121
+ try {
122
+ res = await fetchImpl(host + path, {
123
+ method: "POST",
124
+ headers: { "Content-Type": "application/json", ...bearer ? { Authorization: `Bearer ${bearer}` } : {} },
125
+ body: JSON.stringify(body),
126
+ signal: AbortSignal.timeout(BROKER_FETCH_TIMEOUT_MS)
127
+ });
128
+ } catch (err) {
129
+ return { ok: false, reason: `cannot reach ${path} (${err instanceof Error ? err.message : String(err)})` };
130
+ }
131
+ const text = await res.text().catch(() => "");
132
+ if (!res.ok) {
133
+ let detail = "";
134
+ let needsReauth = false;
135
+ try {
136
+ const parsed = JSON.parse(text);
137
+ if (parsed && typeof parsed.error === "string")
138
+ detail = `: ${parsed.error}`;
139
+ needsReauth = parsed?.needs_reauth === true;
140
+ } catch {
141
+ }
142
+ return { ok: false, reason: `${path} returned HTTP ${res.status}${detail}`, status: res.status, needsReauth };
143
+ }
144
+ try {
145
+ return { ok: true, json: JSON.parse(text) };
146
+ } catch {
147
+ return { ok: false, reason: `${path} returned a non-JSON body` };
148
+ }
149
+ }
150
+ async function fetchToken() {
151
+ if (missing.length > 0)
152
+ return { ok: false, reason: `${missing.join(", ")} not set in the proxy environment` };
153
+ const startedAt = generation;
154
+ const exchanged = await postJson("/host/exchange", { host_key: config.apiKey, agent_id: config.agentId });
155
+ if (!exchanged.ok)
156
+ return { ok: false, reason: `host key exchange failed - ${exchanged.reason}` };
157
+ const jwt = exchanged.json?.token;
158
+ if (typeof jwt !== "string" || jwt.length === 0)
159
+ return { ok: false, reason: "host key exchange returned no token" };
160
+ const onMissingExpiry = refreshNext ? "refresh" : "serve";
161
+ if (refreshNext) {
162
+ refreshNext = false;
163
+ lastForcedRefreshAt = now();
164
+ }
165
+ const cred = await postJson(brokerCredentialPath(config.integrationId), { agent_id: config.agentId, on_missing_expiry: onMissingExpiry }, jwt);
166
+ if (!cred.ok) {
167
+ const needsReauth = cred.needsReauth === true || cred.status === 400;
168
+ return { ok: false, reason: `credential fetch failed - ${cred.reason}`, ...needsReauth ? { needsReauth: true } : {} };
169
+ }
170
+ const body = cred.json;
171
+ const token = body?.access_token;
172
+ if (typeof token !== "string" || token.length === 0)
173
+ return { ok: false, reason: "credential fetch returned no access_token" };
174
+ const expiresAtMs = typeof body?.expires_at === "string" ? Date.parse(body.expires_at) : NaN;
175
+ const freshUntil = Number.isFinite(expiresAtMs) ? expiresAtMs - BROKER_TOKEN_EXPIRY_SKEW_MS : now() + BROKER_TOKEN_UNKNOWN_EXPIRY_TTL_MS;
176
+ cached = freshUntil > now() && startedAt === generation ? { token, freshUntil } : null;
177
+ return { ok: true, token };
178
+ }
179
+ return {
180
+ async get() {
181
+ if (cached && cached.freshUntil > now())
182
+ return { ok: true, token: cached.token };
183
+ cached = null;
184
+ if (!inFlight) {
185
+ inFlight = fetchToken().finally(() => {
186
+ inFlight = null;
187
+ });
188
+ }
189
+ return inFlight;
190
+ },
191
+ /**
192
+ * Drop the cached token, e.g. after the remote answered 401 with it. The
193
+ * next fetch also asks for a refresh of a no-expiry row, at most once per
194
+ * BROKER_FORCED_REFRESH_MIN_INTERVAL_MS.
195
+ */
196
+ invalidate() {
197
+ cached = null;
198
+ generation += 1;
199
+ if (now() - lastForcedRefreshAt >= BROKER_FORCED_REFRESH_MIN_INTERVAL_MS)
200
+ refreshNext = true;
201
+ }
202
+ };
203
+ }
204
+
85
205
  // src/remote-oauth-proxy.ts
86
206
  var URL_ENV = REMOTE_MCP_PROXY_ENV.url;
87
207
  var TOKEN_FILE_ENV = REMOTE_MCP_PROXY_ENV.tokenFile;
@@ -95,6 +215,18 @@ var remoteUrl = process.env[URL_ENV] ?? "";
95
215
  var tokenFile = process.env[TOKEN_FILE_ENV] ?? "";
96
216
  var tokenVar = process.env[TOKEN_VAR_ENV] ?? "";
97
217
  var label = process.env[REMOTE_MCP_PROXY_ENV.label] || tokenVar || "remote-oauth";
218
+ var brokerIntegrationId = process.env[REMOTE_MCP_PROXY_ENV.integrationId] ?? "";
219
+ var brokerToken = brokerIntegrationId ? createBrokerTokenSource({
220
+ host: process.env["AGT_HOST"] ?? "",
221
+ apiKey: process.env["AGT_API_KEY"] ?? "",
222
+ agentId: process.env["AGT_AGENT_ID"] ?? "",
223
+ integrationId: brokerIntegrationId
224
+ }) : null;
225
+ async function resolveCurrentToken() {
226
+ if (brokerToken) return brokerToken.get();
227
+ const token = readCurrentToken(tokenFile, tokenVar);
228
+ return token ? { ok: true, token } : { ok: false, reason: `no token in ${tokenFile} (var ${tokenVar})` };
229
+ }
98
230
  var toolAllowlist = parseToolAllowlist(process.env[ALLOWLIST_ENV] ?? "");
99
231
  var preEnableToolsets = parsePreEnableToolsets(process.env[PREENABLE_ENV] ?? "");
100
232
  var argRejects = parseArgRejects(process.env[ARG_REJECTS_ENV] ?? "");
@@ -455,6 +587,7 @@ async function postRpc(token, body) {
455
587
  signal: AbortSignal.timeout(REMOTE_FETCH_TIMEOUT_MS)
456
588
  });
457
589
  const text = await res.text().catch(() => "");
590
+ if (res.status === 401) brokerToken?.invalidate();
458
591
  return { ok: res.ok, status: res.status, ct: res.headers.get("content-type") ?? "", text };
459
592
  }
460
593
  var unionOnce = null;
@@ -550,11 +683,13 @@ async function forward(line, id, isNotification, method, params) {
550
683
  logErr(`refused agent-issued ${ACTIVATION_TOOL} (activation is proxy-managed)`);
551
684
  return isNotification ? [] : [jsonRpcError(id, -32601, activationRefusalMessage(label, preEnableToolsets))];
552
685
  }
553
- const token = readCurrentToken(tokenFile, tokenVar);
554
- if (!token) {
555
- logErr(`no token in ${tokenFile} (var ${tokenVar})`);
556
- return isNotification ? [] : [jsonRpcError(id, -32e3, `${label}: no current access token available (reconnect the integration)`)];
686
+ const resolved = await resolveCurrentToken();
687
+ if (!resolved.ok) {
688
+ logErr(resolved.reason);
689
+ const message = brokerToken ? "needsReauth" in resolved && resolved.needsReauth ? `${label}: the integration's authorisation is no longer valid (${resolved.reason}). Reconnect the integration; retrying will not help.` : `${label}: could not fetch the current access token from Augmented (${resolved.reason}). No stored copy is used; retry shortly.` : `${label}: no current access token available (reconnect the integration)`;
690
+ return isNotification ? [] : [jsonRpcError(id, -32e3, message)];
557
691
  }
692
+ const token = resolved.token;
558
693
  if (method === "tools/list" && preEnableToolsets.length > 0) {
559
694
  const build = await ensureUnionManifest(token);
560
695
  let tools = [...unionToolByName.values()];
@@ -592,6 +727,7 @@ async function forward(line, id, isNotification, method, params) {
592
727
  logErr(`fetch failed: ${err.message}`);
593
728
  return isNotification ? [] : [jsonRpcError(id, -32001, `${label}: transport error contacting MCP server`)];
594
729
  }
730
+ if (res.status === 401) brokerToken?.invalidate();
595
731
  const ct = res.headers.get("content-type") ?? "";
596
732
  let body = "";
597
733
  try {
@@ -624,6 +760,7 @@ async function forward(line, id, isNotification, method, params) {
624
760
  }
625
761
  function isMissingConfig() {
626
762
  if (!remoteUrl) return URL_ENV;
763
+ if (brokerToken) return null;
627
764
  if (!tokenFile) return TOKEN_FILE_ENV;
628
765
  if (!tokenVar) return TOKEN_VAR_ENV;
629
766
  return null;
@@ -37257,7 +37257,12 @@ var REMOTE_MCP_PROXY_ENV = {
37257
37257
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
37258
37258
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
37259
37259
  // looks like, so the connectivity probe has nothing to reconstruct from it.
37260
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
37260
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
37261
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
37262
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
37263
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
37264
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
37265
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
37261
37266
  };
37262
37267
  var REMOTE_MCP_AUTH_ENV_KEYS = [
37263
37268
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -41129,7 +41134,7 @@ var FLAG_REGISTRY = [
41129
41134
  },
41130
41135
  {
41131
41136
  key: "scheduled-task-nudge-durable",
41132
- description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager keeps the current tmux send-keys delivery, byte-for-byte as today. This is the kill switch: ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061); flip OFF to fall back to send-keys instantly without a code rollback if the durable path misbehaves. Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
41137
+ description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager delivers the nudge by tmux send-keys. ONE EXCEPTION, whatever this flag says (ENG-8006): when send-keys reaches nothing because the session is down or restarting, the nudge is still queued on the durable rail for the next session, and if that enqueue fails the card is closed as failed. So OFF is a partial kill switch: it takes live sessions off the rail, but not firings whose session is down. ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061). During a rail incident, OFF limits the blast radius to down-session firings, and those show up as cards closed failed with "scheduled-task nudge undeliverable". Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
41133
41138
  flagType: "boolean",
41134
41139
  // Declared safe value is `false`: the current, reverted-to send-keys delivery. Turning
41135
41140
  // it ON activates the durable rail per org/host once operators are confident. `false`
@@ -41447,6 +41452,32 @@ var FLAG_REGISTRY = [
41447
41452
  // `sensitive: true`, plus the two gates spelled out in the description.
41448
41453
  since: "0.28.1015"
41449
41454
  },
41455
+ {
41456
+ key: "remote-mcp-oauth-broker-credentials",
41457
+ description: "Deliver the bearer of every OAuth remote MCP served through remote-oauth-proxy (OAUTH_PROVIDERS entries with an mcpUrl: granola, brand-ninja, kajabi, otter, plaud, datadog-ap1/ap2 today) through the broker credential endpoint at USE time, instead of materializing it into `.env.integrations` (ENG-12046). Mechanically the sibling of `xero-broker-credentials`. ON: POST /host/agent-integrations strips `access_token`, `refresh_token` and `token_expires_at` from those rows and marks them credential_delivery=broker, so `<DEF>_ACCESS_TOKEN` is no longer written to `.env.integrations` and so is no longer in the agent process env (the session wrapper `source`s that file with `set -a`). The claudecode adapter then emits AGT_REMOTE_MCP_INTEGRATION_ID instead of a token file/var, and the proxy fetches the bearer per use from POST /host/agent-integrations/<uuid>/credential with the agent's own host credentials (memory only, fail closed, no fallback). OFF (default): byte-for-byte today's behaviour. THIS IS HYGIENE, NOT A BOUNDARY: an agent that calls the same fetch can still obtain the token. The binding control for broad-scope providers (Datadog mcp_all) remains a read-only provider user; the real boundary is ENG-12047 (host-side proxy). SINCE IS A PLACEHOLDER: `since` (0.29.0) is an unreachable placeholder, not a verified threshold. Before enabling, replace it with the first published agt-cli whose remote-oauth-proxy carries broker mode (bisected from the tarballs), or the reach estimate means nothing. FLIP GATE: an under-`since` host honours the marker (it skips the token write, ENG-8344) but still emits a token-file proxy entry, so its remote OAuth MCPs answer \"no current access token\" for every call: an outage of those integrations, not a leak. Zero hosts carrying these integrations below `since` per hosts.agt_version before flipping, counting NULL as unconverged. agt_version names the bundle on disk, not the running proxy: a session started before the update keeps its pre-broker proxy until it restarts, so also confirm every affected session has respawned. HARD GATE: Do not enable, for any provider, until ENG-12053 is merged AND deployed to every API instance serving the credential route (a merge alone is not enough: an older route ignores on_missing_expiry: 'serve'), and a fetch with it on a no-expiry row is verified not to refresh. Reason: a provider whose refresh response omits expires_in makes oauth-refresh drop token_expires_at, the credential route treats that as \"refresh now\", and the row then refreshes about every 60s; the next poll returns the row to env delivery, but that does NOT respawn the running session, so its proxy keeps refreshing about every 60s until some unrelated restart (provider rate limits, token churn, possible lockouts). None of the in-scope providers (granola, brand-ninja, kajabi, otter, plaud, datadog-ap1, datadog-ap2) is verified on expires_in, and the flag covers all of them at once, so no per-provider exception exists. claude-code agents only: opencode has no broker path and keeps env delivery. See docs/runbooks/remote-mcp-oauth-broker-credentials-rollout.md.",
41458
+ flagType: "boolean",
41459
+ // `false` = today's env delivery. A wrongly-ON flip on an unconverged host is
41460
+ // an outage of the remote OAuth MCPs (see the description), so the ON path is
41461
+ // the one with a reach precondition.
41462
+ defaultValue: false,
41463
+ // Changes how every remote-OAuth MCP on the scope authenticates. A
41464
+ // deliberate, confirmed action (ADR-0022 §4).
41465
+ sensitive: true,
41466
+ // ADR-0120: an org owner/admin must not be able to switch this on for their
41467
+ // own org before its prerequisites (ENG-12053 deployed, hosts and sessions
41468
+ // converged) are met. Nothing in code enforces those gates, and an early
41469
+ // enable is an outage of that org's remote OAuth MCPs (CodeRabbit on #7568).
41470
+ platformAdminOnly: true,
41471
+ // PLACEHOLDER, like `github-broker-credentials` shipped with. Replace with the
41472
+ // first published agt-cli whose remote-oauth-proxy carries broker mode
41473
+ // (grep the bundle for AGT_REMOTE_MCP_INTEGRATION_ID), bisected from the
41474
+ // tarballs as `xero-broker-credentials` did. This version names the bundle on
41475
+ // disk. remote-oauth-proxy.js is not in RESTARTABLE_CHANNEL_FILES, so a
41476
+ // session started before the update keeps its older proxy until it restarts:
41477
+ // a host at this version can still run a pre-broker proxy. Advisory only: it
41478
+ // feeds computeFlagReach, it does not block a flip.
41479
+ since: "0.29.0"
41480
+ },
41450
41481
  {
41451
41482
  key: "help-kb-auto-grant",
41452
41483
  description: "Auto-grant the `augmented-help-kb` integration at ORG scope when an organization is provisioned (ENG-8542), so every agent in that org gets product-doc search without a per-agent operator action. One organization_integrations row reaches every agent in the org: POST /host/agent-integrations merges org -> team -> agent and buildMcpJson's predicate reads that merged set with no scope filter. ON: the two org-provisioning call sites write the row (status=active, created_by=the org owner). OFF (default): they write nothing - byte-for-byte today's behaviour. STAGED ROLLOUT IS THE POINT. ENG-8332 argues against widening distribution of the help KB until two things close, because distributing a corpus with wrong articles \"converts one agent's wrong answer into everyone's\": (1) a live 200 from GET /host/kb/search as the anon role has still never been observed - ENG-7260 was closed on remediation evidence, not on a live call, and the deploy seed log is SERVICE-ROLE evidence that says nothing about the anon grant; (2) the `site-structure` article is unverified against the current IA. Turning this on for ONE org and watching that org's help-kb connectivity-probe verdicts (ENG-8332 added a real mcp_stdio probe that calls search_knowledge_base) is the cheap positive control for (1) - an ENG-7260-class 500 then reports as `down` per agent instead of as silence. Widen only after it comes back healthy. REVOKING IS DELETING THE ROW, not flipping this off: the flag gates GRANTING, so an already-granted org keeps its row when the flag goes off. Evaluated API-side only, per org, inside grantHelpKbToOrg; no host-side envVar and deliberately no sst.config.ts entry (a literal default there would pin it - ENG-8303).",
@@ -37709,7 +37709,12 @@ var REMOTE_MCP_PROXY_ENV = {
37709
37709
  // Deliberately NOT in REMOTE_MCP_AUTH_ENV_KEYS, for the same reason as
37710
37710
  // `argRejects`: it shapes WHICH calls we forward, not what an outbound request
37711
37711
  // looks like, so the connectivity probe has nothing to reconstruct from it.
37712
- toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS"
37712
+ toolTiers: "AGT_REMOTE_MCP_TOOL_TIERS",
37713
+ // ENG-12046: when set, the proxy fetches its bearer from the broker at use
37714
+ // time for THIS integration row (uuid) instead of reading TOKEN_FILE/TOKEN_VAR,
37715
+ // and the token is no longer written to `.env.integrations`. Hygiene, not a
37716
+ // boundary: see core/integrations/remote-mcp-broker-token.ts.
37717
+ integrationId: "AGT_REMOTE_MCP_INTEGRATION_ID"
37713
37718
  };
37714
37719
  var REMOTE_MCP_AUTH_ENV_KEYS = [
37715
37720
  REMOTE_MCP_PROXY_ENV.tokenVar,
@@ -41575,7 +41580,7 @@ var FLAG_REGISTRY = [
41575
41580
  },
41576
41581
  {
41577
41582
  key: "scheduled-task-nudge-durable",
41578
- description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager keeps the current tmux send-keys delivery, byte-for-byte as today. This is the kill switch: ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061); flip OFF to fall back to send-keys instantly without a code rollback if the durable path misbehaves. Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
41583
+ description: 'Deliver the scheduled-task "work this card" nudge over the durable direct-chat notice rail instead of unverified tmux send-keys (ENG-8068, re-landing ENG-7971). When ON, routeScheduledTaskViaKanban enqueues the nudge via POST /host/scheduled-task/notify (kind:notice, push-and-consumed by the in-session MCP with a per-card consume-time revalidation) and closes the card + run on an enqueue failure, retiring the ENG-6351 orphaned-card gap where an unsubmitted keystroke left a scheduled task silently unrun. When OFF (default) the manager delivers the nudge by tmux send-keys. ONE EXCEPTION, whatever this flag says (ENG-8006): when send-keys reaches nothing because the session is down or restarting, the nudge is still queued on the durable rail for the next session, and if that enqueue fails the card is closed as failed. So OFF is a partial kill switch: it takes live sessions off the rail, but not firings whose session is down. ENG-7971 was reverted once because the durable rail 500d on a session_id bug (fixed in ENG-8061). During a rail incident, OFF limits the blast radius to down-session firings, and those show up as cards closed failed with "scheduled-task nudge undeliverable". Resolved host-side by the manager via hostFlagStore().getBoolean (the manager evaluates the decision itself, so no spawn-env materialization is needed). Ships dark.',
41579
41584
  flagType: "boolean",
41580
41585
  // Declared safe value is `false`: the current, reverted-to send-keys delivery. Turning
41581
41586
  // it ON activates the durable rail per org/host once operators are confident. `false`
@@ -41893,6 +41898,32 @@ var FLAG_REGISTRY = [
41893
41898
  // `sensitive: true`, plus the two gates spelled out in the description.
41894
41899
  since: "0.28.1015"
41895
41900
  },
41901
+ {
41902
+ key: "remote-mcp-oauth-broker-credentials",
41903
+ description: "Deliver the bearer of every OAuth remote MCP served through remote-oauth-proxy (OAUTH_PROVIDERS entries with an mcpUrl: granola, brand-ninja, kajabi, otter, plaud, datadog-ap1/ap2 today) through the broker credential endpoint at USE time, instead of materializing it into `.env.integrations` (ENG-12046). Mechanically the sibling of `xero-broker-credentials`. ON: POST /host/agent-integrations strips `access_token`, `refresh_token` and `token_expires_at` from those rows and marks them credential_delivery=broker, so `<DEF>_ACCESS_TOKEN` is no longer written to `.env.integrations` and so is no longer in the agent process env (the session wrapper `source`s that file with `set -a`). The claudecode adapter then emits AGT_REMOTE_MCP_INTEGRATION_ID instead of a token file/var, and the proxy fetches the bearer per use from POST /host/agent-integrations/<uuid>/credential with the agent's own host credentials (memory only, fail closed, no fallback). OFF (default): byte-for-byte today's behaviour. THIS IS HYGIENE, NOT A BOUNDARY: an agent that calls the same fetch can still obtain the token. The binding control for broad-scope providers (Datadog mcp_all) remains a read-only provider user; the real boundary is ENG-12047 (host-side proxy). SINCE IS A PLACEHOLDER: `since` (0.29.0) is an unreachable placeholder, not a verified threshold. Before enabling, replace it with the first published agt-cli whose remote-oauth-proxy carries broker mode (bisected from the tarballs), or the reach estimate means nothing. FLIP GATE: an under-`since` host honours the marker (it skips the token write, ENG-8344) but still emits a token-file proxy entry, so its remote OAuth MCPs answer \"no current access token\" for every call: an outage of those integrations, not a leak. Zero hosts carrying these integrations below `since` per hosts.agt_version before flipping, counting NULL as unconverged. agt_version names the bundle on disk, not the running proxy: a session started before the update keeps its pre-broker proxy until it restarts, so also confirm every affected session has respawned. HARD GATE: Do not enable, for any provider, until ENG-12053 is merged AND deployed to every API instance serving the credential route (a merge alone is not enough: an older route ignores on_missing_expiry: 'serve'), and a fetch with it on a no-expiry row is verified not to refresh. Reason: a provider whose refresh response omits expires_in makes oauth-refresh drop token_expires_at, the credential route treats that as \"refresh now\", and the row then refreshes about every 60s; the next poll returns the row to env delivery, but that does NOT respawn the running session, so its proxy keeps refreshing about every 60s until some unrelated restart (provider rate limits, token churn, possible lockouts). None of the in-scope providers (granola, brand-ninja, kajabi, otter, plaud, datadog-ap1, datadog-ap2) is verified on expires_in, and the flag covers all of them at once, so no per-provider exception exists. claude-code agents only: opencode has no broker path and keeps env delivery. See docs/runbooks/remote-mcp-oauth-broker-credentials-rollout.md.",
41904
+ flagType: "boolean",
41905
+ // `false` = today's env delivery. A wrongly-ON flip on an unconverged host is
41906
+ // an outage of the remote OAuth MCPs (see the description), so the ON path is
41907
+ // the one with a reach precondition.
41908
+ defaultValue: false,
41909
+ // Changes how every remote-OAuth MCP on the scope authenticates. A
41910
+ // deliberate, confirmed action (ADR-0022 §4).
41911
+ sensitive: true,
41912
+ // ADR-0120: an org owner/admin must not be able to switch this on for their
41913
+ // own org before its prerequisites (ENG-12053 deployed, hosts and sessions
41914
+ // converged) are met. Nothing in code enforces those gates, and an early
41915
+ // enable is an outage of that org's remote OAuth MCPs (CodeRabbit on #7568).
41916
+ platformAdminOnly: true,
41917
+ // PLACEHOLDER, like `github-broker-credentials` shipped with. Replace with the
41918
+ // first published agt-cli whose remote-oauth-proxy carries broker mode
41919
+ // (grep the bundle for AGT_REMOTE_MCP_INTEGRATION_ID), bisected from the
41920
+ // tarballs as `xero-broker-credentials` did. This version names the bundle on
41921
+ // disk. remote-oauth-proxy.js is not in RESTARTABLE_CHANNEL_FILES, so a
41922
+ // session started before the update keeps its older proxy until it restarts:
41923
+ // a host at this version can still run a pre-broker proxy. Advisory only: it
41924
+ // feeds computeFlagReach, it does not block a flip.
41925
+ since: "0.29.0"
41926
+ },
41896
41927
  {
41897
41928
  key: "help-kb-auto-grant",
41898
41929
  description: "Auto-grant the `augmented-help-kb` integration at ORG scope when an organization is provisioned (ENG-8542), so every agent in that org gets product-doc search without a per-agent operator action. One organization_integrations row reaches every agent in the org: POST /host/agent-integrations merges org -> team -> agent and buildMcpJson's predicate reads that merged set with no scope filter. ON: the two org-provisioning call sites write the row (status=active, created_by=the org owner). OFF (default): they write nothing - byte-for-byte today's behaviour. STAGED ROLLOUT IS THE POINT. ENG-8332 argues against widening distribution of the help KB until two things close, because distributing a corpus with wrong articles \"converts one agent's wrong answer into everyone's\": (1) a live 200 from GET /host/kb/search as the anon role has still never been observed - ENG-7260 was closed on remediation evidence, not on a live call, and the deploy seed log is SERVICE-ROLE evidence that says nothing about the anon grant; (2) the `site-structure` article is unverified against the current IA. Turning this on for ONE org and watching that org's help-kb connectivity-probe verdicts (ENG-8332 added a real mcp_stdio probe that calls search_knowledge_base) is the cheap positive control for (1) - an ENG-7260-class 500 then reports as `down` per agent instead of as silence. Widen only after it comes back healthy. REVOKING IS DELETING THE ROW, not flipping this off: the flag gates GRANTING, so an already-granted org keeps its row when the flag goes off. Evaluated API-side only, per org, inside grantHelpKbToOrg; no host-side envVar and deliberately no sst.config.ts entry (a literal default there would pin it - ENG-8303).",
@@ -68,12 +68,12 @@ import {
68
68
  writeDirectChatSessionState,
69
69
  writeEgressAllowlist,
70
70
  writePersistentClaudeWrapper
71
- } from "./chunk-GRTMENH5.js";
72
- import "./chunk-CMLBFY5C.js";
71
+ } from "./chunk-ZKLOPCWS.js";
72
+ import "./chunk-ZDON4IXL.js";
73
73
  import "./chunk-HYQ7VOC3.js";
74
74
  import "./chunk-6HBXEJHO.js";
75
75
  import "./chunk-XWVM4KPK.js";
76
- import "./chunk-UHT6L77A.js";
76
+ import "./chunk-EWD3K6YD.js";
77
77
  import "./chunk-AIUIMEUS.js";
78
78
  import "./chunk-DGUM43GV.js";
79
79
  export {
@@ -147,4 +147,4 @@ export {
147
147
  writeEgressAllowlist,
148
148
  writePersistentClaudeWrapper
149
149
  };
150
- //# sourceMappingURL=persistent-session-HXK2Z6GH.js.map
150
+ //# sourceMappingURL=persistent-session-HQPQPNPK.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-GRTMENH5.js";
4
- import "./chunk-CMLBFY5C.js";
3
+ } from "./chunk-ZKLOPCWS.js";
4
+ import "./chunk-ZDON4IXL.js";
5
5
  import "./chunk-HYQ7VOC3.js";
6
6
  import "./chunk-6HBXEJHO.js";
7
7
  import "./chunk-XWVM4KPK.js";
8
- import "./chunk-UHT6L77A.js";
8
+ import "./chunk-EWD3K6YD.js";
9
9
  import "./chunk-AIUIMEUS.js";
10
10
  import "./chunk-DGUM43GV.js";
11
11
 
@@ -804,4 +804,4 @@ export {
804
804
  readAndResetSlackReplyBindingClassifications,
805
805
  readAndResetSlackReplyTargetClassifications
806
806
  };
807
- //# sourceMappingURL=responsiveness-probe-TPKISRGQ.js.map
807
+ //# sourceMappingURL=responsiveness-probe-6GNSPLD2.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sessionTranscriptDir
3
- } from "./chunk-CMLBFY5C.js";
4
- import "./chunk-UHT6L77A.js";
3
+ } from "./chunk-ZDON4IXL.js";
4
+ import "./chunk-EWD3K6YD.js";
5
5
  import "./chunk-DGUM43GV.js";
6
6
 
7
7
  // src/lib/session-auth-dead.ts
@@ -205,4 +205,4 @@ export {
205
205
  decideSessionAuthState,
206
206
  probeSessionAuth
207
207
  };
208
- //# sourceMappingURL=session-auth-dead-KMB35KRB.js.map
208
+ //# sourceMappingURL=session-auth-dead-4Z24MU6C.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.1253",
3
+ "version": "0.28.1254",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {