macp-sdk-typescript 0.15.0 → 0.16.0
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 +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/watchers.d.ts +20 -0
- package/dist/watchers.js +11 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to `macp-sdk-typescript` are documented here. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the
|
|
5
5
|
project uses [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.16.0](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/compare/v0.15.0...v0.16.0) (2026-10-18)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **watchers:** SignalWatcher.events() surfaces sender_authenticated (runtime 0.9.0) ([#172](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/issues/172)) ([57491cd](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/commit/57491cd8e156c9f1650a918e36eea5ff9d2bdab1))
|
|
13
|
+
|
|
7
14
|
## [0.15.0](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/compare/v0.14.1...v0.15.0) (2026-10-17)
|
|
8
15
|
|
|
9
16
|
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/watchers.d.ts
CHANGED
|
@@ -53,13 +53,33 @@ export declare class RootsWatcher {
|
|
|
53
53
|
* A missing/invalid credential surfaces as `code === 'UNAUTHENTICATED'` — fix
|
|
54
54
|
* auth, do not reconnect.
|
|
55
55
|
*/
|
|
56
|
+
/**
|
|
57
|
+
* One `WatchSignals` frame: the Signal envelope plus whether the runtime
|
|
58
|
+
* authenticated its `sender` (RFC-MACP-0004 §4.1, runtime ≥ 0.9.0).
|
|
59
|
+
*/
|
|
60
|
+
export interface SignalEvent {
|
|
61
|
+
envelope: Envelope;
|
|
62
|
+
/**
|
|
63
|
+
* `true` only when the runtime authenticated the Signal's `sender` (JWT or
|
|
64
|
+
* static-token auth). `false` in dev mode and on runtimes that predate the
|
|
65
|
+
* field — the safe direction. A Signal with `false` MUST NOT influence
|
|
66
|
+
* operational decisions (RFC-MACP-0004 §4.1).
|
|
67
|
+
*/
|
|
68
|
+
senderAuthenticated: boolean;
|
|
69
|
+
}
|
|
56
70
|
export declare class SignalWatcher {
|
|
57
71
|
private readonly client;
|
|
58
72
|
private readonly auth?;
|
|
59
73
|
constructor(client: MacpClient, options?: {
|
|
60
74
|
auth?: AuthConfig;
|
|
61
75
|
});
|
|
76
|
+
/**
|
|
77
|
+
* Signal envelopes only. Does not say whether a Signal's `sender` was
|
|
78
|
+
* authenticated — use {@link events} wherever a Signal can drive a decision.
|
|
79
|
+
*/
|
|
62
80
|
signals(signal?: AbortSignal): AsyncGenerator<Envelope, void, void>;
|
|
81
|
+
/** Signal envelopes paired with the runtime's `sender_authenticated` verdict. */
|
|
82
|
+
events(signal?: AbortSignal): AsyncGenerator<SignalEvent, void, void>;
|
|
63
83
|
watch(handler: (envelope: Envelope) => void | Promise<void>): Promise<void>;
|
|
64
84
|
nextSignal(): Promise<Envelope>;
|
|
65
85
|
}
|
package/dist/watchers.js
CHANGED
|
@@ -166,16 +166,6 @@ class RootsWatcher {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
exports.RootsWatcher = RootsWatcher;
|
|
169
|
-
/**
|
|
170
|
-
* Watches the ambient signal plane. **Requires auth** as of runtime 0.5.0: if
|
|
171
|
-
* no credential is configured on the watcher or the client, iterating
|
|
172
|
-
* {@link SignalWatcher.signals} throws immediately (via `client.watchSignals`).
|
|
173
|
-
*
|
|
174
|
-
* Consumer lag terminates the stream with a coded `MacpTransportError`
|
|
175
|
-
* (`code === 'RESOURCE_EXHAUSTED'`); the correct response is to reconnect.
|
|
176
|
-
* A missing/invalid credential surfaces as `code === 'UNAUTHENTICATED'` — fix
|
|
177
|
-
* auth, do not reconnect.
|
|
178
|
-
*/
|
|
179
169
|
class SignalWatcher {
|
|
180
170
|
client;
|
|
181
171
|
auth;
|
|
@@ -183,15 +173,25 @@ class SignalWatcher {
|
|
|
183
173
|
this.client = client;
|
|
184
174
|
this.auth = options?.auth;
|
|
185
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Signal envelopes only. Does not say whether a Signal's `sender` was
|
|
178
|
+
* authenticated — use {@link events} wherever a Signal can drive a decision.
|
|
179
|
+
*/
|
|
186
180
|
async *signals(signal) {
|
|
181
|
+
for await (const event of this.events(signal))
|
|
182
|
+
yield event.envelope;
|
|
183
|
+
}
|
|
184
|
+
/** Signal envelopes paired with the runtime's `sender_authenticated` verdict. */
|
|
185
|
+
async *events(signal) {
|
|
187
186
|
const stream = this.client.watchSignals(this.auth);
|
|
188
187
|
if (signal) {
|
|
189
188
|
signal.addEventListener('abort', () => stream.cancel(), { once: true });
|
|
190
189
|
}
|
|
191
190
|
const gen = serverStreamToAsyncGenerator(stream);
|
|
192
191
|
for await (const response of gen) {
|
|
192
|
+
// Strict `=== true`: anything but an explicit true is unauthenticated.
|
|
193
193
|
if (response.envelope)
|
|
194
|
-
yield response.envelope;
|
|
194
|
+
yield { envelope: response.envelope, senderAuthenticated: response.senderAuthenticated === true };
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
async watch(handler) {
|