@tangle-network/agent-app 1.0.14 → 1.0.16

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.
@@ -82,13 +82,13 @@ import {
82
82
  turnCarriesFiles,
83
83
  turnPromptText,
84
84
  withProducerStream
85
- } from "../chunk-SSH4OQ33.js";
85
+ } from "../chunk-NC4K5QWP.js";
86
86
  import "../chunk-SBHFMDR7.js";
87
87
  import "../chunk-H6BRJU5M.js";
88
88
  import "../chunk-4DBHC63F.js";
89
89
  import "../chunk-RN4WPTBH.js";
90
90
  import "../chunk-MM6RLOXF.js";
91
- import "../chunk-3HRU245P.js";
91
+ import "../chunk-OZWHBH4T.js";
92
92
  import "../chunk-F4TUZYMX.js";
93
93
  import {
94
94
  redactErrorMessage
@@ -27,7 +27,7 @@ import {
27
27
  sandboxRunFailureDetail,
28
28
  streamSandboxPrompt,
29
29
  turnStorageBindings
30
- } from "./chunk-3HRU245P.js";
30
+ } from "./chunk-OZWHBH4T.js";
31
31
  import {
32
32
  redactErrorMessage
33
33
  } from "./chunk-MH74DY2I.js";
@@ -4153,4 +4153,4 @@ export {
4153
4153
  createChatTurnRoutes,
4154
4154
  streamChatRouteAsSandboxEvents
4155
4155
  };
4156
- //# sourceMappingURL=chunk-SSH4OQ33.js.map
4156
+ //# sourceMappingURL=chunk-NC4K5QWP.js.map
@@ -4140,14 +4140,18 @@ function secretStoreFromClient(shell) {
4140
4140
  create: async (name, value) => {
4141
4141
  await client.secrets.create(name, value);
4142
4142
  },
4143
- // The API has no replace route, so a replacement is a delete followed by a
4144
- // create. That pair is NOT atomic: if the create fails, the secret is left
4145
- // deleted rather than at its previous value. `storeSecret` reports that
4146
- // state instead of reporting a generic write failure, because a caller
4147
- // retrying a lost secret needs to know it is now absent.
4143
+ // Replace in place, guarded by the row's updatedAt: a concurrent writer
4144
+ // cannot clobber a successor, and a failure leaves the PREVIOUS value
4145
+ // live (the platform re-keys matching boxes on the update).
4148
4146
  update: async (name, value) => {
4149
- await client.secrets.delete(name);
4150
- await client.secrets.create(name, value);
4147
+ const current = await client.secrets.list().then((rows) => rows.find((row) => row.name === name));
4148
+ if (!current) {
4149
+ await client.secrets.create(name, value);
4150
+ return;
4151
+ }
4152
+ await client.secrets.update(name, value, {
4153
+ expectedUpdatedAt: current.updatedAt.toISOString()
4154
+ });
4151
4155
  },
4152
4156
  delete: async (name) => {
4153
4157
  await client.secrets.delete(name);
@@ -4165,7 +4169,7 @@ async function storeSecret(store, name, value) {
4165
4169
  } catch (err) {
4166
4170
  return fail(
4167
4171
  new Error(
4168
- `Failed to store sandbox secret ${name}. A replacement deletes before it creates, so ${name} may now be absent rather than holding its previous value.`,
4172
+ `Failed to store sandbox secret ${name}. The previous value remains live; a concurrent writer may have replaced it first (retry resolves by expectedUpdatedAt).`,
4169
4173
  { cause: err }
4170
4174
  )
4171
4175
  );
@@ -4306,4 +4310,4 @@ export {
4306
4310
  deleteSecret,
4307
4311
  mintSandboxScopedToken
4308
4312
  };
4309
- //# sourceMappingURL=chunk-3HRU245P.js.map
4313
+ //# sourceMappingURL=chunk-OZWHBH4T.js.map