@astrale-os/kernel-client 0.6.0 → 1.0.0-beta.10
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/dist/client/result.d.ts +8 -2
- package/dist/{schema → execution}/admission.d.ts +2 -2
- package/dist/{schema → execution}/admission.js +2 -2
- package/dist/{session/execution.d.ts → execution/contracts.d.ts} +22 -34
- package/dist/execution/contracts.js +1 -0
- package/dist/execution/deadline.d.ts +8 -0
- package/dist/execution/deadline.js +13 -0
- package/dist/execution/execution.d.ts +57 -0
- package/dist/execution/execution.js +137 -0
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.js +3 -0
- package/dist/schema/contracts.d.ts +34 -70
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +1 -1
- package/dist/schema/installation.d.ts +26 -64
- package/dist/schema/installation.js +23 -129
- package/dist/schema/schema.d.ts +8 -10
- package/dist/schema/schema.js +46 -33
- package/dist/session/bound.d.ts +2 -0
- package/dist/session/bound.js +3 -0
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +0 -1
- package/dist/session/options.d.ts +0 -2
- package/dist/session/options.js +0 -3
- package/dist/session/reference.d.ts +1 -1
- package/dist/session/session.d.ts +3 -0
- package/dist/session/session.js +8 -2
- package/dist/session/session.typecheck.js +5 -4
- package/dist/transport/http/admission.js +6 -1
- package/dist/transport/websocket/exchange.js +1 -0
- package/package.json +5 -5
- package/dist/session/execution.js +0 -34
|
@@ -4,7 +4,7 @@ import { K, KernelSchema } from '@astrale-os/kernel-core/schema';
|
|
|
4
4
|
import { defineSchema, func, method, nodeClass, schema, valueSchema, } from '@astrale-os/kernel-dsl/v1';
|
|
5
5
|
import { isBinaryInput } from '@astrale-os/kernel-dsl/v1/language';
|
|
6
6
|
import { call } from '../client/index.js';
|
|
7
|
-
import { ClientSession, credentials,
|
|
7
|
+
import { ClientSession, credentials, reference } from './index.js';
|
|
8
8
|
void new ClientSession(options);
|
|
9
9
|
void auth;
|
|
10
10
|
void control;
|
|
@@ -189,12 +189,13 @@ const durableDomain = schema.resolve(defineSchema('client.durable.typecheck', {
|
|
|
189
189
|
}));
|
|
190
190
|
const remindReference = reference(durableDomain, durableDomain.classes.Invoice.methods.remind)(Path.id(NodeId('invoice-1')));
|
|
191
191
|
const durableReturnsExecution = true;
|
|
192
|
+
const outcome = session.execution.result(run, { waitMs: 1_000 });
|
|
192
193
|
const outcomeIsTyped = true;
|
|
194
|
+
const status = session.execution.status(run);
|
|
193
195
|
const statusIsTyped = true;
|
|
194
|
-
void session.
|
|
195
|
-
void session.invoke(execution.signal(run), { name: 'approval', value: { by: 'billing' } });
|
|
196
|
+
void session.execution.signal(run, { name: 'approval', value: { by: 'billing' } });
|
|
196
197
|
// @ts-expect-error Force is the only cancellation option.
|
|
197
|
-
void session.
|
|
198
|
+
void session.execution.cancel(run, { waitMs: 1_000 });
|
|
198
199
|
void durableReturnsExecution;
|
|
199
200
|
void outcomeIsTyped;
|
|
200
201
|
void statusIsTyped;
|
|
@@ -91,7 +91,12 @@ export async function admitResponse(response, requestId, context) {
|
|
|
91
91
|
}
|
|
92
92
|
requireLive(control);
|
|
93
93
|
if ('execution' in envelope) {
|
|
94
|
-
return {
|
|
94
|
+
return {
|
|
95
|
+
kind: 'execution',
|
|
96
|
+
execution: envelope.execution,
|
|
97
|
+
...(envelope.replayed === undefined ? {} : { replayed: envelope.replayed }),
|
|
98
|
+
invocation: envelope.invocation,
|
|
99
|
+
};
|
|
95
100
|
}
|
|
96
101
|
return { kind: 'value', value: envelope.result, invocation: envelope.invocation };
|
|
97
102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@astrale-os/kernel-core": "0.9
|
|
69
|
-
"@astrale-os/kernel-dsl": "0.
|
|
70
|
-
"@astrale-os/kernel-protocol": "0.
|
|
68
|
+
"@astrale-os/kernel-core": "1.0.0-beta.9",
|
|
69
|
+
"@astrale-os/kernel-dsl": "1.0.0-beta.4",
|
|
70
|
+
"@astrale-os/kernel-protocol": "1.0.0-beta.9",
|
|
71
71
|
"@tanstack/pacer": "0.20.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@astrale-os/kernel-server": "0.
|
|
74
|
+
"@astrale-os/kernel-server": "1.0.0-beta.9",
|
|
75
75
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"typescript": "7.0.2",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import { execution as methods } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
3
|
-
import { kernelReference } from './reference.js';
|
|
4
|
-
const bound = {
|
|
5
|
-
status: kernelReference(methods.status),
|
|
6
|
-
result: kernelReference(methods.result),
|
|
7
|
-
cancel: kernelReference(methods.cancel),
|
|
8
|
-
signal: kernelReference(methods.signal),
|
|
9
|
-
resume: kernelReference(methods.resume),
|
|
10
|
-
delete: kernelReference(methods.delete),
|
|
11
|
-
};
|
|
12
|
-
function receiver(execution) {
|
|
13
|
-
return Path.id(typeof execution === 'string' ? execution : execution.id);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Typed references to the methods of one Execution, for `session.invoke`:
|
|
17
|
-
*
|
|
18
|
-
* ```ts
|
|
19
|
-
* const run = await session.invoke(remind(invoice), { days: 3 })
|
|
20
|
-
* const outcome = await session.invoke(execution.result(run), { waitMs: 10_000 })
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export const execution = Object.freeze({
|
|
24
|
-
status: (target) => bound.status(receiver(target)),
|
|
25
|
-
/** Outcome once terminal; fails `EXECUTION_PENDING` when `waitMs` elapses first. */
|
|
26
|
-
result: (target) => bound.result(receiver(target)),
|
|
27
|
-
/** Cooperative cancellation; `force` kills without compensation (owner Domain only). */
|
|
28
|
-
cancel: (target) => bound.cancel(receiver(target)),
|
|
29
|
-
/** Resolve a named durable promise once (owner Domain only). */
|
|
30
|
-
signal: (target) => bound.signal(receiver(target)),
|
|
31
|
-
resume: (target) => bound.resume(receiver(target)),
|
|
32
|
-
/** Forget the Execution and stop its run (owner Domain only). */
|
|
33
|
-
delete: (target) => bound.delete(receiver(target)),
|
|
34
|
-
});
|