@scitrera/aether-client 0.1.60 → 0.2.1
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 +20 -12
- package/dist/index.cjs +103 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +103 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -282,7 +282,7 @@ await kv.putSync({
|
|
|
282
282
|
|
|
283
283
|
## Progress Reporting
|
|
284
284
|
|
|
285
|
-
Agents and tasks report progress through the `pg
|
|
285
|
+
Agents and tasks report progress through the `pg::{workspace}` stream. Users subscribed to the workspace receive filtered updates:
|
|
286
286
|
|
|
287
287
|
```typescript
|
|
288
288
|
agent.reportProgress({
|
|
@@ -458,7 +458,7 @@ uniqueTaskTopic("prod", "report", "daily"); // "tu.prod.report.daily"
|
|
|
458
458
|
taskBroadcastTopic("prod", "worker"); // "tb.prod.worker"
|
|
459
459
|
globalAgentsTopic("prod"); // "ga.prod"
|
|
460
460
|
eventTopic("task.completed"); // "event.task.completed"
|
|
461
|
-
bridgeTopic("
|
|
461
|
+
bridgeTopic("example-bridge", "instance-1"); // "br.example-bridge.instance-1"
|
|
462
462
|
```
|
|
463
463
|
|
|
464
464
|
## Principal Types
|
|
@@ -467,15 +467,15 @@ Aether supports 8 principal types. The TypeScript SDK provides dedicated client
|
|
|
467
467
|
|
|
468
468
|
| Type | Client Class | Description | Topic Format |
|
|
469
469
|
|------|-------------|-------------|-------------|
|
|
470
|
-
| Agent | `AgentClient` | Persistent entity | `ag
|
|
471
|
-
| UniqueTask | `TaskClient` (with specifier) | Named task | `tu
|
|
472
|
-
| NonUniqueTask | `TaskClient` (no specifier) | Ephemeral task | `ta
|
|
473
|
-
| User | `UserClient` | Browser session | `us
|
|
470
|
+
| Agent | `AgentClient` | Persistent entity | `ag::{workspace}::{impl}::{spec}` |
|
|
471
|
+
| UniqueTask | `TaskClient` (with specifier) | Named task | `tu::{workspace}::{impl}::{spec}` |
|
|
472
|
+
| NonUniqueTask | `TaskClient` (no specifier) | Ephemeral task | `ta::{workspace}::{impl}::{id}` |
|
|
473
|
+
| User | `UserClient` | Browser session | `us::{userId}::{windowId}` |
|
|
474
474
|
| Orchestrator | `OrchestratorClient` | Compute provisioner | receives `TaskAssignment` |
|
|
475
475
|
| WorkflowEngine | `WorkflowEngineClient` | Event processor (singleton) | subscribes to `event.*` |
|
|
476
476
|
| MetricsBridge | `MetricsBridgeClient` | Telemetry collector (singleton) | subscribes to `metric.*` |
|
|
477
|
-
| Bridge | `BridgeClient` | Cross-workspace relay | `br
|
|
478
|
-
| Service | _(no dedicated client)_ | Sidecar service proxy | `sv
|
|
477
|
+
| Bridge | `BridgeClient` | Cross-workspace relay | `br::{impl}::{spec}` |
|
|
478
|
+
| Service | _(no dedicated client)_ | Sidecar service proxy | `sv::{impl}::{spec}` |
|
|
479
479
|
|
|
480
480
|
> **Known gap:** The TypeScript SDK does not currently have a dedicated `ServiceClient`. The `Service` principal type represents sidecar services addressable via the HTTP proxy feature. If you need to connect as a service principal, use `BridgeClient` (cross-workspace) or `AgentClient` (workspace-scoped) as a workaround and set your identity fields to match the service's `impl`/`spec`. A dedicated `ServiceClient` is planned for a future release.
|
|
481
481
|
|
|
@@ -574,8 +574,8 @@ import { BridgeClient, MessageType } from "@scitrera/aether-client";
|
|
|
574
574
|
|
|
575
575
|
const bridge = new BridgeClient({
|
|
576
576
|
address: "localhost:50051",
|
|
577
|
-
implementation: "
|
|
578
|
-
specifier: "
|
|
577
|
+
implementation: "example-bridge",
|
|
578
|
+
specifier: "instance-1",
|
|
579
579
|
});
|
|
580
580
|
|
|
581
581
|
bridge.onMessage((msg) => {
|
|
@@ -642,7 +642,7 @@ agent.switchWorkspace("staging");
|
|
|
642
642
|
// agent.workspace === "staging"
|
|
643
643
|
|
|
644
644
|
// UserClient — declares the user's active app workspace to the gateway.
|
|
645
|
-
// Users do not encode a workspace in their identity (topic: us
|
|
645
|
+
// Users do not encode a workspace in their identity (topic: us::{userId}::{windowId}),
|
|
646
646
|
// so calling switchWorkspace right after connect() is recommended to ensure
|
|
647
647
|
// server-side session state has the correct workspace for task-authority scoping.
|
|
648
648
|
await user.connect();
|
|
@@ -674,6 +674,14 @@ The connection itself IS the distributed lock AND the heartbeat. When the gRPC s
|
|
|
674
674
|
|
|
675
675
|
See the [Go SDK documentation](../go/aether/doc.go) and [Python SDK](../python-client/) for additional API patterns. This TypeScript SDK follows the same conventions.
|
|
676
676
|
|
|
677
|
+
|
|
677
678
|
## License
|
|
678
679
|
|
|
679
|
-
Apache License, Version 2.0
|
|
680
|
+
Copyright 2025+ scitrera.ai. Licensed under the Apache License, Version 2.0.
|
|
681
|
+
|
|
682
|
+
## Links
|
|
683
|
+
|
|
684
|
+
- [GitHub Repository](https://github.com/scitrera/aether)
|
|
685
|
+
- [Documentation](https://github.com/scitrera/aether#readme)
|
|
686
|
+
- [Issue Tracker](https://github.com/scitrera/aether/issues)
|
|
687
|
+
|
package/dist/index.cjs
CHANGED
|
@@ -1448,6 +1448,94 @@ function extractGrant(response) {
|
|
|
1448
1448
|
return grant;
|
|
1449
1449
|
}
|
|
1450
1450
|
|
|
1451
|
+
// package.json
|
|
1452
|
+
var package_default = {
|
|
1453
|
+
name: "@scitrera/aether-client",
|
|
1454
|
+
version: "0.2.1",
|
|
1455
|
+
description: "TypeScript/JavaScript SDK for the Aether distributed control plane",
|
|
1456
|
+
license: "Apache-2.0",
|
|
1457
|
+
author: "scitrera.ai",
|
|
1458
|
+
homepage: "https://memorylayer.ai",
|
|
1459
|
+
repository: {
|
|
1460
|
+
type: "git",
|
|
1461
|
+
url: "https://github.com/scitrera/aether",
|
|
1462
|
+
directory: "sdk/typescript"
|
|
1463
|
+
},
|
|
1464
|
+
type: "module",
|
|
1465
|
+
main: "./dist/index.cjs",
|
|
1466
|
+
module: "./dist/index.js",
|
|
1467
|
+
types: "./dist/index.d.ts",
|
|
1468
|
+
exports: {
|
|
1469
|
+
".": {
|
|
1470
|
+
import: {
|
|
1471
|
+
types: "./dist/index.d.ts",
|
|
1472
|
+
default: "./dist/index.js"
|
|
1473
|
+
},
|
|
1474
|
+
require: {
|
|
1475
|
+
types: "./dist/index.d.cts",
|
|
1476
|
+
default: "./dist/index.cjs"
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
files: [
|
|
1481
|
+
"dist",
|
|
1482
|
+
"README.md"
|
|
1483
|
+
],
|
|
1484
|
+
scripts: {
|
|
1485
|
+
build: "tsup",
|
|
1486
|
+
test: "vitest run",
|
|
1487
|
+
"test:watch": "vitest",
|
|
1488
|
+
typecheck: "tsc --noEmit",
|
|
1489
|
+
lint: "tsc --noEmit",
|
|
1490
|
+
clean: "rm -rf dist"
|
|
1491
|
+
},
|
|
1492
|
+
dependencies: {
|
|
1493
|
+
"@grpc/grpc-js": "1.14.3",
|
|
1494
|
+
"@grpc/proto-loader": "0.8.1"
|
|
1495
|
+
},
|
|
1496
|
+
devDependencies: {
|
|
1497
|
+
typescript: "^5.4.0",
|
|
1498
|
+
tsup: "^8.0.0",
|
|
1499
|
+
vitest: "^1.4.0"
|
|
1500
|
+
},
|
|
1501
|
+
engines: {
|
|
1502
|
+
node: ">=18.0.0"
|
|
1503
|
+
},
|
|
1504
|
+
keywords: [
|
|
1505
|
+
"aether",
|
|
1506
|
+
"scitrera",
|
|
1507
|
+
"grpc",
|
|
1508
|
+
"distributed",
|
|
1509
|
+
"control-plane",
|
|
1510
|
+
"messaging"
|
|
1511
|
+
]
|
|
1512
|
+
};
|
|
1513
|
+
|
|
1514
|
+
// src/version-meta.ts
|
|
1515
|
+
var CLIENT_SDK_NAME = "ts";
|
|
1516
|
+
var cachedMeta;
|
|
1517
|
+
function clientVersionMeta() {
|
|
1518
|
+
if (cachedMeta !== void 0) {
|
|
1519
|
+
return cachedMeta;
|
|
1520
|
+
}
|
|
1521
|
+
const version = package_default.version ?? "unknown";
|
|
1522
|
+
let runtime = "unknown";
|
|
1523
|
+
let os = "unknown";
|
|
1524
|
+
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
1525
|
+
runtime = `node${process.versions.node}`;
|
|
1526
|
+
os = `${process.platform}/${process.arch}`;
|
|
1527
|
+
} else if (typeof navigator !== "undefined") {
|
|
1528
|
+
runtime = "browser";
|
|
1529
|
+
os = navigator.userAgent ?? "browser";
|
|
1530
|
+
}
|
|
1531
|
+
cachedMeta = {
|
|
1532
|
+
clientVersion: version,
|
|
1533
|
+
clientSdk: CLIENT_SDK_NAME,
|
|
1534
|
+
clientBuildInfo: { runtime, os }
|
|
1535
|
+
};
|
|
1536
|
+
return cachedMeta;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1451
1539
|
// src/client.ts
|
|
1452
1540
|
var import_meta = {};
|
|
1453
1541
|
var DEFAULT_CONNECTION = {
|
|
@@ -1831,7 +1919,7 @@ var AetherClient = class {
|
|
|
1831
1919
|
/**
|
|
1832
1920
|
* Registers a handler for progress updates from agents/tasks.
|
|
1833
1921
|
*
|
|
1834
|
-
* Progress updates are delivered via the pg
|
|
1922
|
+
* Progress updates are delivered via the pg::{workspace} stream with
|
|
1835
1923
|
* server-side recipient filtering.
|
|
1836
1924
|
*
|
|
1837
1925
|
* @param handler - Function called when a progress update is received
|
|
@@ -2069,7 +2157,7 @@ var AetherClient = class {
|
|
|
2069
2157
|
stream.on("end", () => {
|
|
2070
2158
|
this._handleStreamEnd();
|
|
2071
2159
|
});
|
|
2072
|
-
const initMsg = this._buildInitMessage();
|
|
2160
|
+
const initMsg = { ...clientVersionMeta(), ...this._buildInitMessage() };
|
|
2073
2161
|
stream.write({ init: initMsg });
|
|
2074
2162
|
} catch (err) {
|
|
2075
2163
|
if (err instanceof ConnectionError) {
|
|
@@ -2734,7 +2822,7 @@ var AetherClient = class {
|
|
|
2734
2822
|
/**
|
|
2735
2823
|
* Reports progress for a task through the Aether gateway.
|
|
2736
2824
|
*
|
|
2737
|
-
* Progress updates are routed through RabbitMQ Streams via the pg
|
|
2825
|
+
* Progress updates are routed through RabbitMQ Streams via the pg::{workspace}
|
|
2738
2826
|
* topic with server-side recipient filtering.
|
|
2739
2827
|
*
|
|
2740
2828
|
* @param opts - Progress report options
|
|
@@ -3926,7 +4014,7 @@ var AgentClient = class extends AetherClient {
|
|
|
3926
4014
|
/**
|
|
3927
4015
|
* Returns this agent's topic address.
|
|
3928
4016
|
*
|
|
3929
|
-
* Format: ag
|
|
4017
|
+
* Format: ag::{workspace}::{implementation}::{specifier}
|
|
3930
4018
|
*/
|
|
3931
4019
|
get topic() {
|
|
3932
4020
|
return agentTopic(this._workspace, this._implementation, this._specifier);
|
|
@@ -3988,8 +4076,8 @@ var AgentClient = class extends AetherClient {
|
|
|
3988
4076
|
/**
|
|
3989
4077
|
* Sends a message to a specific task.
|
|
3990
4078
|
*
|
|
3991
|
-
* For unique tasks (with specifier), uses tu
|
|
3992
|
-
* For non-unique tasks (empty specifier), uses tb
|
|
4079
|
+
* For unique tasks (with specifier), uses tu::{workspace}::{impl}::{spec} topic.
|
|
4080
|
+
* For non-unique tasks (empty specifier), uses tb::{workspace}::{impl} broadcast topic.
|
|
3993
4081
|
*
|
|
3994
4082
|
* @param workspace - Target task's workspace
|
|
3995
4083
|
* @param implementation - Target task's implementation type
|
|
@@ -4180,8 +4268,8 @@ var TaskClient = class extends AetherClient {
|
|
|
4180
4268
|
}
|
|
4181
4269
|
/**
|
|
4182
4270
|
* Returns this task's topic address.
|
|
4183
|
-
* For unique tasks: tu
|
|
4184
|
-
* For non-unique tasks: returns the broadcast topic tb
|
|
4271
|
+
* For unique tasks: tu::{workspace}::{impl}::{spec}
|
|
4272
|
+
* For non-unique tasks: returns the broadcast topic tb::{workspace}::{impl}
|
|
4185
4273
|
* (the actual instance topic is assigned by the server).
|
|
4186
4274
|
*/
|
|
4187
4275
|
get topic() {
|
|
@@ -4343,7 +4431,7 @@ var UserClient = class extends AetherClient {
|
|
|
4343
4431
|
/**
|
|
4344
4432
|
* Returns this user's topic address.
|
|
4345
4433
|
*
|
|
4346
|
-
* Format: us
|
|
4434
|
+
* Format: us::{userId}::{windowId}
|
|
4347
4435
|
*/
|
|
4348
4436
|
get topic() {
|
|
4349
4437
|
return userTopic(this._userId, this._windowId);
|
|
@@ -4351,7 +4439,7 @@ var UserClient = class extends AetherClient {
|
|
|
4351
4439
|
/**
|
|
4352
4440
|
* Returns this user's workspace-scoped topic address.
|
|
4353
4441
|
*
|
|
4354
|
-
* Format: uw
|
|
4442
|
+
* Format: uw::{userId}::{workspace}
|
|
4355
4443
|
*
|
|
4356
4444
|
* Returns empty string if no workspace is set.
|
|
4357
4445
|
*/
|
|
@@ -4425,8 +4513,8 @@ var UserClient = class extends AetherClient {
|
|
|
4425
4513
|
/**
|
|
4426
4514
|
* Sends a message to a specific task.
|
|
4427
4515
|
*
|
|
4428
|
-
* For unique tasks (with specifier), uses tu
|
|
4429
|
-
* For non-unique tasks (empty specifier), uses tb
|
|
4516
|
+
* For unique tasks (with specifier), uses tu::{workspace}::{impl}::{spec} topic.
|
|
4517
|
+
* For non-unique tasks (empty specifier), uses tb::{workspace}::{impl} broadcast topic.
|
|
4430
4518
|
*
|
|
4431
4519
|
* @param workspace - Target task's workspace
|
|
4432
4520
|
* @param implementation - Target task's implementation type
|
|
@@ -4909,7 +4997,7 @@ var BridgeClient = class extends AetherClient {
|
|
|
4909
4997
|
/**
|
|
4910
4998
|
* Returns this bridge's topic address.
|
|
4911
4999
|
*
|
|
4912
|
-
* Format: br
|
|
5000
|
+
* Format: br::{implementation}::{specifier}
|
|
4913
5001
|
*/
|
|
4914
5002
|
get topic() {
|
|
4915
5003
|
return bridgeTopic(this._implementation, this._specifier);
|
|
@@ -4946,8 +5034,8 @@ var BridgeClient = class extends AetherClient {
|
|
|
4946
5034
|
/**
|
|
4947
5035
|
* Sends a message to a specific task in any workspace.
|
|
4948
5036
|
*
|
|
4949
|
-
* For unique tasks (with specifier), uses tu
|
|
4950
|
-
* For non-unique tasks (empty specifier), uses tb
|
|
5037
|
+
* For unique tasks (with specifier), uses tu::{workspace}::{impl}::{spec} topic.
|
|
5038
|
+
* For non-unique tasks (empty specifier), uses tb::{workspace}::{impl} broadcast topic.
|
|
4951
5039
|
*
|
|
4952
5040
|
* @param workspace - Target task's workspace
|
|
4953
5041
|
* @param implementation - Target task's implementation type
|