macp-sdk-typescript 0.15.0 → 0.16.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/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ 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.1](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/compare/v0.16.0...v0.16.1) (2026-10-18)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **watchers:** type PolicyChange.observedAtUnixMs as string ([#175](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/issues/175)) ([3ff812b](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/commit/3ff812b00b96c2088364c9e521a1440eee91ca0a))
13
+ * **watchers:** unwrap .change in ModeRegistryWatcher/RootsWatcher ([#163](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/issues/163)) ([#174](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/issues/174)) ([98cb23e](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/commit/98cb23e9736ffd9c6eef24b85714f6faf5880b39))
14
+
15
+ ## [0.16.0](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/compare/v0.15.0...v0.16.0) (2026-10-18)
16
+
17
+
18
+ ### Features
19
+
20
+ * **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))
21
+
7
22
  ## [0.15.0](https://github.com/multiagentcoordinationprotocol/macp-sdk-typescript/compare/v0.14.1...v0.15.0) (2026-10-17)
8
23
 
9
24
 
package/dist/version.d.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * Kept in sync with package.json by release-please (see the
5
5
  * `x-release-please-version` annotation).
6
6
  */
7
- export declare const VERSION = "0.15.0";
7
+ export declare const VERSION = "0.16.1";
package/dist/version.js CHANGED
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * Kept in sync with package.json by release-please (see the
8
8
  * `x-release-please-version` annotation).
9
9
  */
10
- exports.VERSION = '0.15.0'; // x-release-please-version
10
+ exports.VERSION = '0.16.1'; // x-release-please-version
@@ -53,19 +53,44 @@ 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
  }
66
86
  export interface PolicyChange {
67
87
  descriptors: PolicyDescriptor[];
68
- observedAtUnixMs: number;
88
+ /**
89
+ * Unix ms as a decimal string — the proto field is `int64`, which the
90
+ * client decodes with `longs: String` (same as `RegistryChanged`,
91
+ * `RootsChanged` and `SessionLifecycleEvent`). Was mistyped `number`.
92
+ */
93
+ observedAtUnixMs: string;
69
94
  }
70
95
  export declare class PolicyWatcher {
71
96
  private readonly client;
package/dist/watchers.js CHANGED
@@ -116,11 +116,16 @@ class ModeRegistryWatcher {
116
116
  this.auth = options?.auth;
117
117
  }
118
118
  async *changes(signal) {
119
+ // The wire frame is `WatchModeRegistryResponse { RegistryChanged change = 1; }` — unwrap it
120
+ // (issue #163; yielding the frame itself left every field undefined).
119
121
  const stream = this.client.watchModeRegistry(this.auth);
120
122
  if (signal) {
121
123
  signal.addEventListener('abort', () => stream.cancel(), { once: true });
122
124
  }
123
- yield* serverStreamToAsyncGenerator(stream);
125
+ for await (const response of serverStreamToAsyncGenerator(stream)) {
126
+ if (response.change)
127
+ yield response.change;
128
+ }
124
129
  }
125
130
  async watch(handler) {
126
131
  for await (const change of this.changes()) {
@@ -145,11 +150,16 @@ class RootsWatcher {
145
150
  this.auth = options?.auth;
146
151
  }
147
152
  async *changes(signal) {
153
+ // The wire frame is `WatchRootsResponse { RootsChanged change = 1; }` — unwrap it
154
+ // (issue #163; yielding the frame itself left every field undefined).
148
155
  const stream = this.client.watchRoots(this.auth);
149
156
  if (signal) {
150
157
  signal.addEventListener('abort', () => stream.cancel(), { once: true });
151
158
  }
152
- yield* serverStreamToAsyncGenerator(stream);
159
+ for await (const response of serverStreamToAsyncGenerator(stream)) {
160
+ if (response.change)
161
+ yield response.change;
162
+ }
153
163
  }
154
164
  async watch(handler) {
155
165
  for await (const change of this.changes()) {
@@ -166,16 +176,6 @@ class RootsWatcher {
166
176
  }
167
177
  }
168
178
  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
179
  class SignalWatcher {
180
180
  client;
181
181
  auth;
@@ -183,15 +183,25 @@ class SignalWatcher {
183
183
  this.client = client;
184
184
  this.auth = options?.auth;
185
185
  }
186
+ /**
187
+ * Signal envelopes only. Does not say whether a Signal's `sender` was
188
+ * authenticated — use {@link events} wherever a Signal can drive a decision.
189
+ */
186
190
  async *signals(signal) {
191
+ for await (const event of this.events(signal))
192
+ yield event.envelope;
193
+ }
194
+ /** Signal envelopes paired with the runtime's `sender_authenticated` verdict. */
195
+ async *events(signal) {
187
196
  const stream = this.client.watchSignals(this.auth);
188
197
  if (signal) {
189
198
  signal.addEventListener('abort', () => stream.cancel(), { once: true });
190
199
  }
191
200
  const gen = serverStreamToAsyncGenerator(stream);
192
201
  for await (const response of gen) {
202
+ // Strict `=== true`: anything but an explicit true is unauthenticated.
193
203
  if (response.envelope)
194
- yield response.envelope;
204
+ yield { envelope: response.envelope, senderAuthenticated: response.senderAuthenticated === true };
195
205
  }
196
206
  }
197
207
  async watch(handler) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "macp-sdk-typescript",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "description": "TypeScript SDK for the MACP Rust runtime",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",