@oddington/sdk 0.1.77 → 0.1.78
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/README.md
CHANGED
|
@@ -292,6 +292,7 @@ import { defineResponse, respond, resolveAsk } from '@oddington/sdk';
|
|
|
292
292
|
// List this action in the owning defineRoutine({ responses: [setStatus], access, ... }).
|
|
293
293
|
// The routine's single access declaration governs both its run and its actions.
|
|
294
294
|
const setStatus = defineResponse<{ recordRef: string; status: string }>({ id: 'set-status', async run({ input }, os) {
|
|
295
|
+
await os.action.progress({ label: 'Updating the record' });
|
|
295
296
|
const changes = os.data.repository('general').changes();
|
|
296
297
|
changes.update(input.recordRef, { status: input.status });
|
|
297
298
|
await changes.publish();
|
|
@@ -300,6 +301,11 @@ const setStatus = defineResponse<{ recordRef: string; status: string }>({ id: 's
|
|
|
300
301
|
// Attach to a published Question with handler: respond(setStatus, { recordRef, status: 'complete' }).
|
|
301
302
|
```
|
|
302
303
|
|
|
304
|
+
`action.progress` replaces the Inbox's generic invoking copy while this action
|
|
305
|
+
is running. Use concise customer-facing text for meaningful waits. It does not
|
|
306
|
+
create timeline events, counted steps or a completion estimate; the next label
|
|
307
|
+
replaces it and the platform clears it when recording the outcome.
|
|
308
|
+
|
|
303
309
|
The SDK owns browser provider setup, email/passcode actions, persisted restoration,
|
|
304
310
|
refresh and expiry. Create one opaque handle outside rendering and bind the app's
|
|
305
311
|
presentation to its state:
|
package/dist/browser.js
CHANGED
|
@@ -6531,7 +6531,13 @@ function createCapabilityRuntime(contract, runtime2, current2, owner) {
|
|
|
6531
6531
|
if (!current2()) throw new Error(`${owner} authority ended`);
|
|
6532
6532
|
return value;
|
|
6533
6533
|
} },
|
|
6534
|
-
inbox: { ...runtime2.inbox, publishAsk: (value, options) => runtime2.inbox.publishAsk(validateHandlers(value), options) }
|
|
6534
|
+
inbox: { ...runtime2.inbox, publishAsk: (value, options) => runtime2.inbox.publishAsk(validateHandlers(value), options) },
|
|
6535
|
+
...owner === "Response" ? { action: freezeRoutineMetadata({ async progress(value) {
|
|
6536
|
+
assertRoutineFields(value, ["label"]);
|
|
6537
|
+
let label = value.label;
|
|
6538
|
+
if (!routineTitle(label) || !runtime2.action) return invalid3();
|
|
6539
|
+
await runtime2.action.progress({ label });
|
|
6540
|
+
} }) } : {}
|
|
6535
6541
|
}) }), guarded, async drain() {
|
|
6536
6542
|
for (; aiWork.size; ) await Promise.allSettled([...aiWork]);
|
|
6537
6543
|
} };
|
|
@@ -10428,12 +10434,12 @@ function parseInboxItem(value) {
|
|
|
10428
10434
|
let execution = object8(question2.execution);
|
|
10429
10435
|
if (assert(id2(execution.id) && ["pending", "running", "completed", "failed"].includes(String(execution.state)) && integer(execution.attempt, 0)), "consequence" in execution) {
|
|
10430
10436
|
let consequence = object8(execution.consequence);
|
|
10431
|
-
keys6(consequence, ["phase", "updatedAt", "evidence"]), assert((consequence.phase === null || ["loading", "invoking", "committing"].includes(String(consequence.phase))) && date(consequence.updatedAt)), array2(consequence.evidence).forEach((value3) => {
|
|
10437
|
+
keys6(consequence, ["phase", "progressLabel", "updatedAt", "evidence"], ["phase", "updatedAt", "evidence"]), assert((consequence.phase === null || ["loading", "invoking", "committing"].includes(String(consequence.phase))) && date(consequence.updatedAt)), "progressLabel" in consequence && assert(consequence.progressLabel === null || text4(consequence.progressLabel) && consequence.progressLabel.length <= 256), array2(consequence.evidence).forEach((value3) => {
|
|
10432
10438
|
let receipt = object8(value3);
|
|
10433
10439
|
receipt.provider === "airtable" ? (keys6(receipt, ["provider", "connection", "baseId", "table", "operation", "records"]), assert(text4(receipt.connection) && /^airtable\/[a-z0-9][a-z0-9-]*$/.test(receipt.connection) && text4(receipt.baseId) && text4(receipt.table) && ["create", "update", "delete"].includes(String(receipt.operation))), array2(receipt.records).forEach((value4) => {
|
|
10434
10440
|
let record4 = object8(value4);
|
|
10435
10441
|
keys6(record4, ["id"]), assert(text4(record4.id));
|
|
10436
|
-
})) : (keys6(receipt, ["repository", "commit", "diff"]), assert(text4(receipt.repository) && text4(receipt.commit) && text4(receipt.diff, !0)));
|
|
10442
|
+
})) : (keys6(receipt, ["repository", "commit", "diff", "url"]), assert(text4(receipt.repository) && text4(receipt.commit) && text4(receipt.diff, !0)), "url" in receipt && assert(text4(receipt.url) && /^https:\/\/github\.com\/[A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9_.-]+\/commit\/[0-9a-f]{40}$/.test(receipt.url) && receipt.url.endsWith(`/commit/${receipt.commit}`)));
|
|
10437
10443
|
});
|
|
10438
10444
|
}
|
|
10439
10445
|
}
|