@vellumai/credential-executor 0.10.3-dev.202606292136.ce8bf33 → 0.10.3-dev.202606292252.adea010

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/managed-main.ts +19 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/credential-executor",
3
- "version": "0.10.3-dev.202606292136.ce8bf33",
3
+ "version": "0.10.3-dev.202606292252.adea010",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -122,7 +122,7 @@ function buildHandlers(
122
122
  apiKeyRef: ApiKeyRef,
123
123
  assistantIdRef: AssistantIdRef,
124
124
  secureKeyBackend: SecureKeyBackend,
125
- ): { handlers: RpcHandlerRegistry; temporaryGrantStore: TemporaryGrantStore } {
125
+ ): RpcHandlerRegistry {
126
126
  // -- Grant stores ----------------------------------------------------------
127
127
  const persistentGrantStore = new PersistentGrantStore(
128
128
  getCesGrantsDir("managed"),
@@ -411,7 +411,7 @@ function buildHandlers(
411
411
  return { results };
412
412
  }) as (typeof handlers)[string];
413
413
 
414
- return { handlers, temporaryGrantStore };
414
+ return handlers;
415
415
  }
416
416
 
417
417
  // ---------------------------------------------------------------------------
@@ -668,10 +668,12 @@ async function main(): Promise<void> {
668
668
  // `unregister` miss a tool registered in an earlier session and orphan its
669
669
  // bundle.
670
670
  //
671
- // The in-memory temporary-grant store is the exception: `allow_once` /
672
- // `allow_10m` grants are keyed by proposal hash only (not session), so they
673
- // would otherwise leak ephemeral approvals across sessions. It is cleared at
674
- // the end of every session below so a reconnecting assistant must re-prompt.
671
+ // The in-memory temporary-grant store is also process-scoped, and (unlike
672
+ // before) is NOT cleared between sessions: ephemeral approvals are shared
673
+ // across all of a daemon's connections for the process lifetime. Its own
674
+ // semantics keep this safe `allow_once` is consumed on first use,
675
+ // `allow_10m` expires by wall-clock TTL, `allow_conversation` is cleared when
676
+ // its conversation ends (see the serve loop below).
675
677
  //
676
678
  // The mutable refs carry the handshake-provided API key and assistant ID;
677
679
  // handlers read them at call time. These don't vary across a daemon's
@@ -680,7 +682,7 @@ async function main(): Promise<void> {
680
682
  // at call time for audit attribution).
681
683
  const apiKeyRef: ApiKeyRef = { current: "" };
682
684
  const assistantIdRef: AssistantIdRef = { current: "" };
683
- const { handlers, temporaryGrantStore } = buildHandlers(
685
+ const handlers = buildHandlers(
684
686
  apiKeyRef,
685
687
  assistantIdRef,
686
688
  secureKeyBackend,
@@ -780,14 +782,16 @@ async function main(): Promise<void> {
780
782
 
781
783
  rpcConnected = false;
782
784
 
783
- // Drop all ephemeral approvals when the session ends. `allow_once` /
784
- // `allow_10m` grants are keyed by proposal hash only, so reusing the
785
- // store across a reconnect would let a pre-disconnect approval be
786
- // consumed by a later session without re-prompting. Clearing here
787
- // restores the prior behavior, where the process exited on stream end
788
- // and these grants never survived.
789
- temporaryGrantStore.clear();
790
-
785
+ // Temporary grants are process-shared: they are NOT cleared when a session
786
+ // ends. CES is moving to a model where the assistant daemon's multiple
787
+ // processes each hold their own connection, so an ephemeral approval
788
+ // (`allow_once` / `allow_10m` / `allow_conversation`) granted on one
789
+ // connection must remain usable by the others rather than being scoped to a
790
+ // single session. The store's own semantics keep this safe across a
791
+ // reconnect: `allow_once` is consumed on first use, `allow_10m` is bounded
792
+ // by its wall-clock TTL, and `allow_conversation` is cleared when its
793
+ // conversation ends.
794
+ //
791
795
  // A signal-driven end means the process is shutting down; exit the loop.
792
796
  // Any other end reason (the assistant disconnected, its stream closed,
793
797
  // or the transport errored) means we keep the sidecar up and await a