@datalayer/agent-runtimes 1.5.115 → 1.5.121

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.
Files changed (33) hide show
  1. package/dist-embed/datalayer-app-main.js +52 -52
  2. package/lib/api/runtimes/runtimes.d.ts +5 -0
  3. package/lib/apps/apps/appspec.js +4 -0
  4. package/lib/examples/pap/PapAgentIdentityView.js +0 -1
  5. package/lib/examples/pap/PapCompanyDiscoveryView.js +5 -4
  6. package/lib/examples/pap/PapGuidedJourneyView.js +31 -17
  7. package/lib/examples/pap/PapSessionLifecycleView.js +1 -1
  8. package/lib/examples/pap/traces/account-tokens.json +54 -30
  9. package/lib/examples/pap/traces/conversation-control.json +171 -220
  10. package/lib/examples/pap/traces/conversation-streaming.json +66 -44
  11. package/lib/examples/pap/traces/mediated-sign-in.json +54 -30
  12. package/lib/examples/pap/traces/operations.json +174 -223
  13. package/lib/examples/pap/traces/two-companies.json +252 -306
  14. package/lib/examples/pap/traces/user-with-a-company.json +159 -162
  15. package/lib/hooks/useCheckpoints.d.ts +2 -0
  16. package/lib/pap/index.d.ts +8 -0
  17. package/lib/pap/index.js +3 -6
  18. package/lib/portable/direct.d.ts +9 -3
  19. package/lib/portable/direct.js +9 -4
  20. package/lib/specs/actions.js +72 -9
  21. package/lib/specs/agents/agents.js +32 -9
  22. package/lib/specs/apps.js +18 -8
  23. package/lib/specs/appspecSchema.js +13 -1
  24. package/lib/specs/battles.js +6 -6
  25. package/lib/specs/mcpServers.js +66 -31
  26. package/lib/specs/models.d.ts +8 -1
  27. package/lib/specs/models.js +40 -2
  28. package/lib/specs/protocols.js +1 -1
  29. package/lib/specs/scenes.js +1 -5
  30. package/lib/types/agentspecs.d.ts +10 -0
  31. package/package.json +2 -2
  32. package/scripts/codegen/generate_apps.py +2 -0
  33. package/scripts/codegen/generate_models.py +17 -4
@@ -61,6 +61,11 @@ export interface PauseResumeResponse {
61
61
  success: boolean;
62
62
  message: string;
63
63
  checkpoint_id: string | null;
64
+ /**
65
+ * The new runtime a resume launched, for the same agent and user: a light
66
+ * pause is resumed as a launch, under a uid of its own. Absent on a pause.
67
+ */
68
+ runtime_uid?: string;
64
69
  }
65
70
  /**
66
71
  * Optional body for the pause endpoint.
@@ -398,6 +398,8 @@ function parsePap(data) {
398
398
  signedOut: flag(company.signed_out, true),
399
399
  signInDisabled: flag(company.sign_in_disabled, false),
400
400
  publishSkills: flag(company.publish_skills, false),
401
+ webUnscoped: flag(company.web_unscoped, false),
402
+ webDisabled: flag(company.web_disabled, false),
401
403
  interfaces: enumsOf(company.interfaces, PAP_INTERFACES, PAP_DEFAULT_INTERFACES),
402
404
  scopes: records(company.scopes).map(parsePapCompanyScope),
403
405
  excludedTasks: records(company.excluded_tasks).map(task => ({
@@ -510,6 +512,8 @@ function dumpPap(pap) {
510
512
  .value('signed_out', pap.company.signedOut, true)
511
513
  .value('sign_in_disabled', pap.company.signInDisabled, false)
512
514
  .value('publish_skills', pap.company.publishSkills, false)
515
+ .value('web_unscoped', pap.company.webUnscoped, false)
516
+ .value('web_disabled', pap.company.webDisabled, false)
513
517
  .list('interfaces', pap.company.interfaces, [...PAP_DEFAULT_INTERFACES])
514
518
  .list('scopes', pap.company.scopes.map(dumpPapCompanyScope))
515
519
  .list('excluded_tasks', pap.company.excludedTasks.map(dumpPapExcludedTask))
@@ -27,7 +27,6 @@ const PapAgentIdentityView = () => {
27
27
  jwks_uri: `${new URL(requested).origin}/jwks.json`,
28
28
  redirect_uris: [`${new URL(requested).origin}/callback`],
29
29
  token_endpoint_auth_method: 'private_key_jwt',
30
- extensions: { memory: { version: '2' } },
31
30
  }),
32
31
  fetchJwks: async () => parseJsonWebKeySet({
33
32
  keys: [
@@ -13,7 +13,7 @@ const SAMPLE_DOMAIN = 'shop.example';
13
13
  const sampleCompany = (domain) => ({
14
14
  discoveryUrl: `https://${domain}/.well-known/poppy.json`,
15
15
  document: parseDiscoveryDocument({
16
- protocol_version: '0.3',
16
+ protocol_version: '0.4',
17
17
  organization: { name: 'Example Shop', domain },
18
18
  auth: {
19
19
  issuer: `https://auth.${domain}`,
@@ -37,9 +37,10 @@ const sampleCompany = (domain) => ({
37
37
  description: 'Read the catalogue',
38
38
  },
39
39
  ],
40
- extensions: { operations: { version: '1' } },
40
+ // Draft 0.4 §3.3: an entry per version it supports; a Session declares the one it implements.
41
+ extensions: { operations: [{ version: '1' }, { version: '2' }] },
41
42
  }),
42
- // Direct and Device are what the issuer's grants say (0.3 as published §3.2).
43
+ // Direct and Device are what the issuer's grants say (draft 0.4 §3.2).
43
44
  oauthMetadata: parseOAuthServerMetadata({
44
45
  issuer: `https://auth.${domain}`,
45
46
  token_endpoint: `https://auth.${domain}/token`,
@@ -80,6 +81,6 @@ const PapCompanyDiscoveryView = () => {
80
81
  setError(cause instanceof Error ? cause.message : String(cause));
81
82
  }
82
83
  };
83
- return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Company discovery", title: "Discover capabilities, not credentials", description: "The PAP parser validates the discovery document and the issuer's metadata (0.3 as published); Agent Runtimes then projects them into a model-safe summary: the sign-ins the issuer's grants offer, the company's own scopes with their hints, and the domains its issuer protects. Change the sample domain to see issuer and discovery binding move together.", children: [_jsxs(Box, { display: "flex", flexDirection: "column", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { as: "label", sx: { fontWeight: 600 }, children: "Company DNS domain" }), _jsxs(Box, { display: "flex", gap: 2, children: [_jsx(TextInput, { block: true, value: domain, "aria-label": "Company DNS domain", onChange: event => setDomain(event.target.value) }), _jsx(Button, { variant: "primary", onClick: () => void inspect(), children: "Validate sample" })] }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "The sample uses an injected Reactor-compatible transport. Production replaces it with DNS-pinned HTTPS discovery." }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null] }), summary ? (_jsx(PapResult, { title: "Safe company summary", value: summary })) : null] }));
84
+ return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Company discovery", title: "Discover capabilities, not credentials", description: "The PAP parser validates the discovery document and the issuer's metadata (draft 0.4); Agent Runtimes then projects them into a model-safe summary: the sign-ins the issuer's grants offer, the company's own scopes with their hints, and the domains its issuer protects. Change the sample domain to see issuer and discovery binding move together.", children: [_jsxs(Box, { display: "flex", flexDirection: "column", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { as: "label", sx: { fontWeight: 600 }, children: "Company DNS domain" }), _jsxs(Box, { display: "flex", gap: 2, children: [_jsx(TextInput, { block: true, value: domain, "aria-label": "Company DNS domain", onChange: event => setDomain(event.target.value) }), _jsx(Button, { variant: "primary", onClick: () => void inspect(), children: "Validate sample" })] }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "The sample uses an injected Reactor-compatible transport. Production replaces it with DNS-pinned HTTPS discovery." }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null] }), summary ? (_jsx(PapResult, { title: "Safe company summary", value: summary })) : null] }));
84
85
  };
85
86
  export default PapCompanyDiscoveryView;
@@ -28,7 +28,7 @@ const STEPS = [
28
28
  channel: 'Discovery',
29
29
  messages: conversationStart,
30
30
  facts: [
31
- { label: 'Publishes', value: 'poppy.json · 0.3 as published' },
31
+ { label: 'Publishes', value: 'poppy.json · draft 0.4' },
32
32
  { label: 'Returns', value: 'Company conversation agent' },
33
33
  { label: 'Sign-in', value: "Northstar's own page" },
34
34
  ],
@@ -38,7 +38,7 @@ const STEPS = [
38
38
  request: 'Accept: application/json',
39
39
  response: `200 OK
40
40
  {
41
- "protocol_version": "0.3",
41
+ "protocol_version": "0.4",
42
42
  "organization": { "name": "Northstar Outfitters" },
43
43
  "auth": {
44
44
  "issuer": "https://auth.northstar.example",
@@ -70,11 +70,12 @@ const STEPS = [
70
70
  target: 'https://api.northstar.example/poppy/conversations',
71
71
  detailLabel: 'Atlas → company agent',
72
72
  request: `Poppy-Session: [fresh JWT, naming the sid, signed with a delegated key]
73
+ Poppy-Version: 0.4
73
74
  Content-Type: application/json
74
75
 
75
76
  {
77
+ "id": "req_return",
76
78
  "message": {
77
- "id": "msg_return",
78
79
  "author": { "type": "agent" },
79
80
  "text": "The user wants to return a jacket."
80
81
  }
@@ -87,8 +88,10 @@ Content-Type: application/json
87
88
  "error": "insufficient_scope",
88
89
  "scope": "orders:read orders:return"
89
90
  }],
90
- "status": "idle",
91
- "responder": "agent"
91
+ "working": false,
92
+ "handoff": "none",
93
+ "responder": "agent",
94
+ "closed": false
92
95
  }`,
93
96
  },
94
97
  {
@@ -140,11 +143,12 @@ Location: https://atlas.example/oauth/callback
140
143
  detailLabel: 'Atlas ↔ company agent',
141
144
  request: `Authorization: Bearer [host-only access token]
142
145
  Poppy-Session: [fresh JWT]
146
+ Poppy-Version: 0.4
143
147
  Content-Type: application/json
144
148
 
145
149
  {
150
+ "id": "req_offer",
146
151
  "message": {
147
- "id": "msg_offer",
148
152
  "author": { "type": "agent" },
149
153
  "text": "The user has signed in. Continue the return request."
150
154
  }
@@ -159,8 +163,10 @@ Content-Type: application/json
159
163
  "text": "Choose an even exchange or refund."
160
164
  }
161
165
  }],
162
- "status": "idle",
163
- "responder": "agent"
166
+ "working": false,
167
+ "handoff": "none",
168
+ "responder": "agent",
169
+ "closed": false
164
170
  }`,
165
171
  },
166
172
  {
@@ -191,11 +197,12 @@ Content-Type: application/json
191
197
  detailLabel: 'Atlas ↔ company agent',
192
198
  request: `Authorization: Bearer [host-only access token]
193
199
  Poppy-Session: [fresh JWT]
200
+ Poppy-Version: 0.4
194
201
  Content-Type: application/json
195
202
 
196
203
  {
204
+ "id": "req_exchange_choice",
197
205
  "message": {
198
- "id": "msg_exchange_choice",
199
206
  "author": { "type": "agent" },
200
207
  "text": "The user chose the even exchange."
201
208
  }
@@ -210,7 +217,10 @@ Content-Type: application/json
210
217
  "text": "The exchange is arranged."
211
218
  }
212
219
  }],
213
- "status": "closed"
220
+ "working": false,
221
+ "handoff": "none",
222
+ "responder": "agent",
223
+ "closed": true
214
224
  }`,
215
225
  },
216
226
  ];
@@ -238,7 +248,7 @@ const companyReply = (response) => {
238
248
  */
239
249
  const runJourney = async () => {
240
250
  parseDiscoveryDocument({
241
- protocol_version: '0.3',
251
+ protocol_version: '0.4',
242
252
  organization: { name: 'Northstar Outfitters', domain: 'northstar.example' },
243
253
  auth: {
244
254
  issuer: 'https://auth.northstar.example',
@@ -256,7 +266,7 @@ const runJourney = async () => {
256
266
  ],
257
267
  },
258
268
  });
259
- // Direct Sign-In is what the issuer's grants offer (0.3 as published §3.2).
269
+ // Direct Sign-In is what the issuer's grants offer (draft 0.4 §3.2).
260
270
  parseOAuthServerMetadata({
261
271
  issuer: 'https://auth.northstar.example',
262
272
  token_endpoint: 'https://auth.northstar.example/oauth/token',
@@ -288,6 +298,7 @@ const runJourney = async () => {
288
298
  headers: { 'content-type': 'application/json' },
289
299
  });
290
300
  }
301
+ // The request's id is top-level, the message's own (draft 0.4 §8.3).
291
302
  const incoming = JSON.parse(String(init?.body ?? '{}'));
292
303
  return new Response(JSON.stringify({
293
304
  conversation_id: 'cnv_return',
@@ -301,14 +312,17 @@ const runJourney = async () => {
301
312
  author: { type: 'agent' },
302
313
  role: 'company',
303
314
  text: reply,
304
- context: { in_reply_to: incoming.message?.id ?? 'unknown' },
315
+ as_of_request: incoming.id,
305
316
  },
306
317
  },
307
318
  ],
308
319
  cursor: `cursor_${index + 1}`,
309
320
  has_more: false,
310
- status: index === replies.length - 1 ? 'closed' : 'idle',
321
+ // Draft 0.4 §8.7: the four state fields.
322
+ working: false,
323
+ handoff: 'none',
311
324
  responder: 'agent',
325
+ closed: index === replies.length - 1,
312
326
  }), {
313
327
  status: index === 0 ? 201 : 202,
314
328
  headers: { 'content-type': 'application/json' },
@@ -359,18 +373,18 @@ const runJourney = async () => {
359
373
  });
360
374
  const endpoint = 'https://api.northstar.example/poppy/conversations';
361
375
  const started = await conversations.start(endpoint, {
362
- id: conversations.generateMessageId(),
376
+ id: conversations.generateRequestId(),
363
377
  author: { type: 'agent' },
364
378
  text: conversationStart[0]?.text,
365
379
  }, requestOptions(false));
366
380
  const signInReply = companyReply(started);
367
381
  const offer = companyReply(await conversations.send(endpoint, 'cnv_return', {
368
- id: conversations.generateMessageId(),
382
+ id: conversations.generateRequestId(),
369
383
  author: { type: 'agent' },
370
384
  text: 'The user has signed in. Continue the return request.',
371
385
  }, requestOptions(true)));
372
386
  const confirmation = companyReply(await conversations.send(endpoint, 'cnv_return', {
373
- id: conversations.generateMessageId(),
387
+ id: conversations.generateRequestId(),
374
388
  author: { type: 'agent' },
375
389
  text: 'The user chose the even exchange.',
376
390
  }, requestOptions(true)));
@@ -81,6 +81,6 @@ const PapSessionLifecycleView = () => {
81
81
  reactor.stop();
82
82
  }
83
83
  };
84
- return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Session", title: "Start and restart a Session without giving credentials to the agent", description: "This Reactor view drives the real PAP SessionClient and SessionFetchClient (0.3 as published) against a deterministic company transport. A Session is local: a random sid, and no request. Every request carries a fresh Poppy-Session JWT signed with a delegated key. Answered invalid_session, it starts again once, with a new sid and the same User ID. Only lifecycle evidence enters React state.", children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { sx: { color: 'fg.muted' }, children: "Exercise start, the Session header and a restart entirely inside this host." }), _jsx(Button, { variant: "primary", onClick: () => void runLifecycle(), children: "Run lifecycle" })] }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null, summary ? (_jsx(PapResult, { title: "Safe Session evidence", value: summary })) : null] }));
84
+ return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Session", title: "Start and restart a Session without giving credentials to the agent", description: "This Reactor view drives the real PAP SessionClient and SessionFetchClient (draft 0.4) against a deterministic company transport. A Session is local: a random sid, and no request. Every request carries a fresh Poppy-Session JWT signed with a delegated key and names its protocol version in Poppy-Version. Answered session_ended, it starts again once, with a new sid and the same User ID. Only lifecycle evidence enters React state.", children: [_jsxs(Box, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 3, p: 3, border: "1px solid", borderColor: "border.default", borderRadius: 2, bg: "canvas.default", children: [_jsx(Text, { sx: { color: 'fg.muted' }, children: "Exercise start, the Session header and a restart entirely inside this host." }), _jsx(Button, { variant: "primary", onClick: () => void runLifecycle(), children: "Run lifecycle" })] }), error ? _jsx(Text, { sx: { color: 'danger.fg' }, children: error }) : null, summary ? (_jsx(PapResult, { title: "Safe Session evidence", value: summary })) : null] }));
85
85
  };
86
86
  export default PapSessionLifecycleView;
@@ -3,7 +3,7 @@
3
3
  "title": "Refresh tokens",
4
4
  "description": "Refresh, rotation, narrowing, re-consent, and revocation of the refresh token Atlas holds for Ada at Manzanita, which never leaves the host's vault.",
5
5
  "generator": "examples/personal-agent-protocol/traces/generate.py",
6
- "sdk": "personal-agent-protocol 0.29.0",
6
+ "sdk": "personal-agent-protocol 0.32.0",
7
7
  "parties": [
8
8
  {
9
9
  "id": "user",
@@ -86,7 +86,7 @@
86
86
  "content-type": "application/json"
87
87
  },
88
88
  "body": {
89
- "protocol_version": "0.3",
89
+ "protocol_version": "0.4",
90
90
  "organization": {
91
91
  "name": "Manzanita Outfitters",
92
92
  "domain": "manzanita.example"
@@ -103,7 +103,8 @@
103
103
  "issuer": "https://manzanita.example",
104
104
  "scopes": {
105
105
  "orders:read": "See your orders, returns and exchanges",
106
- "orders:write": "Exchange or return items in your orders"
106
+ "orders:write": "Exchange or return items in your orders",
107
+ "poppy:browser-sign-in": "Use the website signed in, with the other access you approve"
107
108
  },
108
109
  "scope_hints": {
109
110
  "orders:read": {
@@ -138,25 +139,44 @@
138
139
  "url": "https://manzanita.example/poppy/excluded-tasks.json"
139
140
  },
140
141
  "extensions": {
141
- "operations": {
142
- "version": "2"
143
- },
144
- "mediated-sign-in": {
145
- "version": "1",
146
- "fields": [
147
- {
148
- "name": "email",
149
- "label": "Email",
150
- "secret": false
151
- },
152
- {
153
- "name": "password",
154
- "label": "Password",
155
- "secret": true
156
- }
157
- ],
158
- "scopes": ["orders:read", "orders:write"]
159
- }
142
+ "operations": [
143
+ {
144
+ "version": "2"
145
+ }
146
+ ],
147
+ "links": [
148
+ {
149
+ "version": "1"
150
+ }
151
+ ],
152
+ "disclosures": [
153
+ {
154
+ "version": "1"
155
+ }
156
+ ],
157
+ "ucp": [
158
+ {
159
+ "version": "1"
160
+ }
161
+ ],
162
+ "mediated-sign-in": [
163
+ {
164
+ "version": "1",
165
+ "fields": [
166
+ {
167
+ "name": "email",
168
+ "label": "Email",
169
+ "secret": false
170
+ },
171
+ {
172
+ "name": "password",
173
+ "label": "Password",
174
+ "secret": true
175
+ }
176
+ ],
177
+ "scopes": ["orders:read", "orders:write"]
178
+ }
179
+ ]
160
180
  }
161
181
  }
162
182
  }
@@ -180,7 +200,11 @@
180
200
  "body": {
181
201
  "resource": "https://manzanita.example",
182
202
  "authorization_servers": ["https://manzanita.example"],
183
- "scopes_supported": ["orders:read", "orders:write"],
203
+ "scopes_supported": [
204
+ "orders:read",
205
+ "orders:write",
206
+ "poppy:browser-sign-in"
207
+ ],
184
208
  "bearer_methods_supported": ["header"]
185
209
  }
186
210
  }
@@ -211,7 +235,12 @@
211
235
  "urn:ietf:params:oauth:grant-type:device_code",
212
236
  "https://personalagentprotocol.org/grant/mediated-sign-in"
213
237
  ],
214
- "scopes_supported": ["orders:read", "orders:write"],
238
+ "token_endpoint_auth_methods_supported": ["private_key_jwt"],
239
+ "scopes_supported": [
240
+ "orders:read",
241
+ "orders:write",
242
+ "poppy:browser-sign-in"
243
+ ],
215
244
  "protected_resources": [
216
245
  "https://manzanita.example",
217
246
  "https://manzanita.example/mcp"
@@ -344,12 +373,7 @@
344
373
  "client_name": "Atlas",
345
374
  "jwks_uri": "https://atlas.example/jwks.json",
346
375
  "redirect_uris": ["https://atlas.example/oauth/callback"],
347
- "token_endpoint_auth_method": "private_key_jwt",
348
- "extensions": {
349
- "operations": {
350
- "version": "2"
351
- }
352
- }
376
+ "token_endpoint_auth_method": "private_key_jwt"
353
377
  }
354
378
  }
355
379
  },