@parcha/pi-browser 0.1.0-beta.47 → 0.1.0-beta.49
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 +4 -0
- package/dist/durable/store.d.ts +3 -1
- package/dist/durable/store.js +6 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.49 (2026-11-20)
|
|
6
|
+
|
|
7
|
+
- A session whose create answer was lost, and which the release task found later by its tag, is now told to the host's `onSession` at its release with the id that lookup found and the bill its release records. Before, the host heard it with `resourceId` null and nothing spent, because the release is told before the commit that records them. <!-- changes/pi-browser-release-found-id.md -->
|
|
8
|
+
|
|
5
9
|
## 0.1.0-beta.44 (2026-11-17)
|
|
6
10
|
|
|
7
11
|
- An agent whose computer is a browser can record its runs: `computer: {"kind": "browser", ..., "record": true}` makes a video of each browser session's page, `recordings/<computer>.mp4` with one file per session, under the same caps, pause and stop rules as a desktop's or a phone's, listed in the run read's `recordings` and served by the files route. A browser with `record: true` was refused with 422 before.
|
package/dist/durable/store.d.ts
CHANGED
|
@@ -69,7 +69,9 @@ export declare function custodyStore({ name, Config, Sessions, providerOf, emit,
|
|
|
69
69
|
begin: (tx: Tx, row: InventoryRow) => Promise<void>;
|
|
70
70
|
requestRelease: (tx: Tx, row: InventoryRow, reason: ReleaseReason, at: string, notBefore?: number) => Promise<void>;
|
|
71
71
|
bindByTag: (provider: BrowserProvider, row: InventoryRow, commit: (change: (tx: Tx) => Promise<void>) => Promise<unknown>, signal?: AbortSignal, found?: LeaseRef[]) => Promise<LeaseRef | null>;
|
|
72
|
-
emitReleased: (cid: ConversationId, tag: string, read: DocumentReader, context: Context, at?: string
|
|
72
|
+
emitReleased: (cid: ConversationId, tag: string, read: DocumentReader, context: Context, at?: string, found?: {
|
|
73
|
+
resourceId?: string;
|
|
74
|
+
}) => Promise<void>;
|
|
73
75
|
ReleaseTask: import("@earendil-works/pi-durable").Task<ReleaseInput, ReleaseState, {
|
|
74
76
|
released: number;
|
|
75
77
|
}, object>;
|
package/dist/durable/store.js
CHANGED
|
@@ -88,9 +88,12 @@ export function custodyStore({ name, Config, Sessions, providerOf, emit, meter,
|
|
|
88
88
|
await commit((tx) => kept ? move(tx, row, { state: "live", resourceId: kept.id, at: now() }) : unknownCreate(tx, row, now()));
|
|
89
89
|
return kept;
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
/** `found`: the id a release task's lookup found for a record that has none yet, which the commit after this one
|
|
92
|
+
* records; the host hears the session with it, and with the bill that commit makes. */
|
|
93
|
+
async function emitReleased(cid, tag, read, context, at = now(), found = {}) {
|
|
92
94
|
const [state, config] = await Promise.all([read.snapshot(Sessions, cid, context), read.snapshot(Config, cid, context)]);
|
|
93
|
-
const
|
|
95
|
+
const stored = state?.sessions.find((r) => r.tag === tag);
|
|
96
|
+
const record = stored && stored.resourceId === null && found.resourceId ? { ...stored, resourceId: found.resourceId } : stored;
|
|
94
97
|
const spent = record && record.resourceId !== null ? meter(record.spent, at, true).spent : record?.spent;
|
|
95
98
|
if (record && spent)
|
|
96
99
|
await emit(cid, config?.label ?? "", { ...record, state: "released", endedAt: record.endedAt ?? at, spent }, "released");
|
|
@@ -155,7 +158,7 @@ export function custodyStore({ name, Config, Sessions, providerOf, emit, meter,
|
|
|
155
158
|
// The host hears the release before the task's last commit, so at least once, with the bill that commit
|
|
156
159
|
// records.
|
|
157
160
|
const at = iso(runtime.now());
|
|
158
|
-
await emitReleased(cidOf(row), row.tag, runtime, context, at);
|
|
161
|
+
await emitReleased(cidOf(row), row.tag, runtime, context, at, foundId(row, ids));
|
|
159
162
|
await runtime.commit(async (tx) => {
|
|
160
163
|
await move(tx, row, { state: "released", at, ...foundId(row, ids) });
|
|
161
164
|
return { status: "terminal", outcome: { status: "completed", result: { released: ids.length } } };
|