@robota-sdk/agent-session 3.2.1 → 3.2.3
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.
- package/CHANGELOG.md +17 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +63 -65
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +63 -65
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +12 -12
- package/dist/node.d.ts +12 -12
- package/dist/node.js.map +1 -1
- package/dist/session-claims-DB4Q00_J.js.map +1 -1
- package/package.json +6 -6
package/dist/node.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ interface IEncodedSession {
|
|
|
8
8
|
readonly stored: Uint8Array;
|
|
9
9
|
readonly text: string;
|
|
10
10
|
}
|
|
11
|
-
/** What a record's stored bytes are to a migration that seals what is still plain
|
|
11
|
+
/** What a record's stored bytes are to a migration that seals what is still plain. */
|
|
12
12
|
type TStoredSessionMigrationState =
|
|
13
13
|
/** Not sealed framing: whatever it holds — a valid, corrupt, unsupported or bare record. */
|
|
14
14
|
'plain' |
|
|
@@ -188,7 +188,7 @@ declare const SESSION_CLAIMS_DIRECTORY = "claims";
|
|
|
188
188
|
/** How a {@link NodeSessionStore} is built. */
|
|
189
189
|
interface INodeSessionStoreOptions extends ISessionStoreOptions {
|
|
190
190
|
/**
|
|
191
|
-
* An ancestor of the store's directory the HOST also owns, tightened along with it
|
|
191
|
+
* An ancestor of the store's directory the HOST also owns, tightened along with it.
|
|
192
192
|
* Optional because this adapter does not interpret its base directory as a trusted root and must
|
|
193
193
|
* not guess that a parent belongs to the product — which of them do is composition's knowledge.
|
|
194
194
|
* Left out, a store root that already exists keeps whatever mode it was given: the leaf is made
|
|
@@ -228,7 +228,7 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
228
228
|
/** Whether session `id` may have a writer now (`IInteractiveSessionStore.hasWriter`). */
|
|
229
229
|
hasWriter(id: string): boolean;
|
|
230
230
|
/**
|
|
231
|
-
* Ensure the storage directory exists AND that only its owner can enter it
|
|
231
|
+
* Ensure the storage directory exists AND that only its owner can enter it.
|
|
232
232
|
*
|
|
233
233
|
* The `existsSync` guard this replaces is the whole defect. It skipped the case that matters: a
|
|
234
234
|
* directory some earlier version, a shared CI checkout, or another local user left at a wider
|
|
@@ -240,10 +240,10 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
240
240
|
/**
|
|
241
241
|
* Absolute path to a session's JSON file.
|
|
242
242
|
*
|
|
243
|
-
*
|
|
243
|
+
* Every public method routes through here, so validating the id at this one point covers
|
|
244
244
|
* `save` (write), `load` (read), and `delete` (unlink) at once.
|
|
245
245
|
*
|
|
246
|
-
*
|
|
246
|
+
* `assertSafeSessionId` is the guard, and it is sound — no separator, no `.`/`..`
|
|
247
247
|
* can pass it. But it is a regex reject behind a helper, which static analysis does not model as
|
|
248
248
|
* a path sanitizer, so `js/path-injection` re-opened on `load` every time this function changed
|
|
249
249
|
* length. The containment check below is the shape such tools DO recognise: the resolved path
|
|
@@ -252,14 +252,14 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
252
252
|
*/
|
|
253
253
|
private filePath;
|
|
254
254
|
/**
|
|
255
|
-
* Persist a session record to disk atomically
|
|
255
|
+
* Persist a session record to disk atomically.
|
|
256
256
|
* Creates the storage directory if needed.
|
|
257
257
|
*
|
|
258
258
|
* Bytes go to a same-directory temp file first, then move into place with rename —
|
|
259
259
|
* a crash mid-write can therefore never leave a truncated JSON where the previous
|
|
260
260
|
* record used to be. Same-directory is load-bearing: cross-device rename is a copy.
|
|
261
261
|
*
|
|
262
|
-
*
|
|
262
|
+
* The atomic write now comes from `writeOwnerOnlyFile`, which carries the mode from the
|
|
263
263
|
* moment the temp file is created. The hand-rolled version here wrote it at the umask's default
|
|
264
264
|
* and let `rename` carry that mode to the final path, so every record was 0644 — and even setting
|
|
265
265
|
* the mode after the write would leave a window in which the full transcript was world-readable
|
|
@@ -326,7 +326,7 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
326
326
|
* The outcome for one directory entry, without letting a bad NAME throw out of `list`.
|
|
327
327
|
*
|
|
328
328
|
* `load` validates the id, because an id reaching it is a caller's value and a malformed one is a
|
|
329
|
-
* bug or an attack
|
|
329
|
+
* bug or an attack. A name read out of the directory is neither: the store did not
|
|
330
330
|
* choose it, and one file it cannot use as an id must not take the whole listing down with it.
|
|
331
331
|
* Routing `list` through `load` made exactly that happen — a single `my session.json` in the
|
|
332
332
|
* sessions directory threw, and the resume picker went with it.
|
|
@@ -450,7 +450,7 @@ declare class StoredPayloads {
|
|
|
450
450
|
*/
|
|
451
451
|
open(stored: Uint8Array, maxBytes: number, ownerId: string | undefined, relativePath: string): Uint8Array;
|
|
452
452
|
}
|
|
453
|
-
/** What a stored sidecar is to a migration that seals what is still plain in place
|
|
453
|
+
/** What a stored sidecar is to a migration that seals what is still plain in place. */
|
|
454
454
|
type TStoredPayloadMigrationState = 'plain' | 'sealed' | 'does-not-open' | 'newer-format';
|
|
455
455
|
/**
|
|
456
456
|
* Where a sidecar of session `ownerId` stands: decided by whether it opens for that session, never by
|
|
@@ -542,7 +542,7 @@ interface IMigrateSessionLogsOptions {
|
|
|
542
542
|
readonly sealer: IArtifactSealer;
|
|
543
543
|
/** `false` plans: everything is read and counted exactly as a run would, and nothing is written. */
|
|
544
544
|
readonly apply: boolean;
|
|
545
|
-
/** An ancestor of the directory the host also owns, tightened along with it
|
|
545
|
+
/** An ancestor of the directory the host also owns, tightened along with it. */
|
|
546
546
|
readonly ownedRoot?: string;
|
|
547
547
|
/** Runs before each sidecar replace and each log replace; throwing stops the migration there. */
|
|
548
548
|
readonly beforeCommit?: () => void;
|
|
@@ -736,7 +736,7 @@ declare class NodeToolResultSpillStore implements IToolResultSpillStore {
|
|
|
736
736
|
/** 64 KiB: a few hundred prompts per block — enough for the first frame, small enough to yield often. */
|
|
737
737
|
declare const DEFAULT_PROMPT_HISTORY_BLOCK_BYTES: number;
|
|
738
738
|
interface INodePromptHistoryFileOptions extends ISessionStoreOptions {
|
|
739
|
-
/** An ancestor of the file the host also owns, tightened along with the directory
|
|
739
|
+
/** An ancestor of the file the host also owns, tightened along with the directory. */
|
|
740
740
|
readonly ownedRoot?: string;
|
|
741
741
|
/** Test seam: the read block size in bytes. */
|
|
742
742
|
readonly blockBytes?: number;
|
|
@@ -776,7 +776,7 @@ interface ICompactPromptHistoryOptions {
|
|
|
776
776
|
* replaces nothing.
|
|
777
777
|
*/
|
|
778
778
|
readonly sealer: IArtifactSealer;
|
|
779
|
-
/** An ancestor of the file the host also owns, tightened along with the directory
|
|
779
|
+
/** An ancestor of the file the host also owns, tightened along with the directory. */
|
|
780
780
|
readonly ownedRoot?: string;
|
|
781
781
|
/**
|
|
782
782
|
* Runs once the new file is written and flushed, just before it replaces the history. Throwing
|
package/dist/node.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface IEncodedSession {
|
|
|
8
8
|
readonly stored: Uint8Array;
|
|
9
9
|
readonly text: string;
|
|
10
10
|
}
|
|
11
|
-
/** What a record's stored bytes are to a migration that seals what is still plain
|
|
11
|
+
/** What a record's stored bytes are to a migration that seals what is still plain. */
|
|
12
12
|
type TStoredSessionMigrationState =
|
|
13
13
|
/** Not sealed framing: whatever it holds — a valid, corrupt, unsupported or bare record. */
|
|
14
14
|
'plain' |
|
|
@@ -188,7 +188,7 @@ declare const SESSION_CLAIMS_DIRECTORY = "claims";
|
|
|
188
188
|
/** How a {@link NodeSessionStore} is built. */
|
|
189
189
|
interface INodeSessionStoreOptions extends ISessionStoreOptions {
|
|
190
190
|
/**
|
|
191
|
-
* An ancestor of the store's directory the HOST also owns, tightened along with it
|
|
191
|
+
* An ancestor of the store's directory the HOST also owns, tightened along with it.
|
|
192
192
|
* Optional because this adapter does not interpret its base directory as a trusted root and must
|
|
193
193
|
* not guess that a parent belongs to the product — which of them do is composition's knowledge.
|
|
194
194
|
* Left out, a store root that already exists keeps whatever mode it was given: the leaf is made
|
|
@@ -228,7 +228,7 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
228
228
|
/** Whether session `id` may have a writer now (`IInteractiveSessionStore.hasWriter`). */
|
|
229
229
|
hasWriter(id: string): boolean;
|
|
230
230
|
/**
|
|
231
|
-
* Ensure the storage directory exists AND that only its owner can enter it
|
|
231
|
+
* Ensure the storage directory exists AND that only its owner can enter it.
|
|
232
232
|
*
|
|
233
233
|
* The `existsSync` guard this replaces is the whole defect. It skipped the case that matters: a
|
|
234
234
|
* directory some earlier version, a shared CI checkout, or another local user left at a wider
|
|
@@ -240,10 +240,10 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
240
240
|
/**
|
|
241
241
|
* Absolute path to a session's JSON file.
|
|
242
242
|
*
|
|
243
|
-
*
|
|
243
|
+
* Every public method routes through here, so validating the id at this one point covers
|
|
244
244
|
* `save` (write), `load` (read), and `delete` (unlink) at once.
|
|
245
245
|
*
|
|
246
|
-
*
|
|
246
|
+
* `assertSafeSessionId` is the guard, and it is sound — no separator, no `.`/`..`
|
|
247
247
|
* can pass it. But it is a regex reject behind a helper, which static analysis does not model as
|
|
248
248
|
* a path sanitizer, so `js/path-injection` re-opened on `load` every time this function changed
|
|
249
249
|
* length. The containment check below is the shape such tools DO recognise: the resolved path
|
|
@@ -252,14 +252,14 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
252
252
|
*/
|
|
253
253
|
private filePath;
|
|
254
254
|
/**
|
|
255
|
-
* Persist a session record to disk atomically
|
|
255
|
+
* Persist a session record to disk atomically.
|
|
256
256
|
* Creates the storage directory if needed.
|
|
257
257
|
*
|
|
258
258
|
* Bytes go to a same-directory temp file first, then move into place with rename —
|
|
259
259
|
* a crash mid-write can therefore never leave a truncated JSON where the previous
|
|
260
260
|
* record used to be. Same-directory is load-bearing: cross-device rename is a copy.
|
|
261
261
|
*
|
|
262
|
-
*
|
|
262
|
+
* The atomic write now comes from `writeOwnerOnlyFile`, which carries the mode from the
|
|
263
263
|
* moment the temp file is created. The hand-rolled version here wrote it at the umask's default
|
|
264
264
|
* and let `rename` carry that mode to the final path, so every record was 0644 — and even setting
|
|
265
265
|
* the mode after the write would leave a window in which the full transcript was world-readable
|
|
@@ -326,7 +326,7 @@ declare class NodeSessionStore implements IInteractiveSessionStore {
|
|
|
326
326
|
* The outcome for one directory entry, without letting a bad NAME throw out of `list`.
|
|
327
327
|
*
|
|
328
328
|
* `load` validates the id, because an id reaching it is a caller's value and a malformed one is a
|
|
329
|
-
* bug or an attack
|
|
329
|
+
* bug or an attack. A name read out of the directory is neither: the store did not
|
|
330
330
|
* choose it, and one file it cannot use as an id must not take the whole listing down with it.
|
|
331
331
|
* Routing `list` through `load` made exactly that happen — a single `my session.json` in the
|
|
332
332
|
* sessions directory threw, and the resume picker went with it.
|
|
@@ -450,7 +450,7 @@ declare class StoredPayloads {
|
|
|
450
450
|
*/
|
|
451
451
|
open(stored: Uint8Array, maxBytes: number, ownerId: string | undefined, relativePath: string): Uint8Array;
|
|
452
452
|
}
|
|
453
|
-
/** What a stored sidecar is to a migration that seals what is still plain in place
|
|
453
|
+
/** What a stored sidecar is to a migration that seals what is still plain in place. */
|
|
454
454
|
type TStoredPayloadMigrationState = 'plain' | 'sealed' | 'does-not-open' | 'newer-format';
|
|
455
455
|
/**
|
|
456
456
|
* Where a sidecar of session `ownerId` stands: decided by whether it opens for that session, never by
|
|
@@ -542,7 +542,7 @@ interface IMigrateSessionLogsOptions {
|
|
|
542
542
|
readonly sealer: IArtifactSealer;
|
|
543
543
|
/** `false` plans: everything is read and counted exactly as a run would, and nothing is written. */
|
|
544
544
|
readonly apply: boolean;
|
|
545
|
-
/** An ancestor of the directory the host also owns, tightened along with it
|
|
545
|
+
/** An ancestor of the directory the host also owns, tightened along with it. */
|
|
546
546
|
readonly ownedRoot?: string;
|
|
547
547
|
/** Runs before each sidecar replace and each log replace; throwing stops the migration there. */
|
|
548
548
|
readonly beforeCommit?: () => void;
|
|
@@ -736,7 +736,7 @@ declare class NodeToolResultSpillStore implements IToolResultSpillStore {
|
|
|
736
736
|
/** 64 KiB: a few hundred prompts per block — enough for the first frame, small enough to yield often. */
|
|
737
737
|
declare const DEFAULT_PROMPT_HISTORY_BLOCK_BYTES: number;
|
|
738
738
|
interface INodePromptHistoryFileOptions extends ISessionStoreOptions {
|
|
739
|
-
/** An ancestor of the file the host also owns, tightened along with the directory
|
|
739
|
+
/** An ancestor of the file the host also owns, tightened along with the directory. */
|
|
740
740
|
readonly ownedRoot?: string;
|
|
741
741
|
/** Test seam: the read block size in bytes. */
|
|
742
742
|
readonly blockBytes?: number;
|
|
@@ -776,7 +776,7 @@ interface ICompactPromptHistoryOptions {
|
|
|
776
776
|
* replaces nothing.
|
|
777
777
|
*/
|
|
778
778
|
readonly sealer: IArtifactSealer;
|
|
779
|
-
/** An ancestor of the file the host also owns, tightened along with the directory
|
|
779
|
+
/** An ancestor of the file the host also owns, tightened along with the directory. */
|
|
780
780
|
readonly ownedRoot?: string;
|
|
781
781
|
/**
|
|
782
782
|
* Runs once the new file is written and flushed, just before it replaces the history. Throwing
|