@datalayer/agent-runtimes 1.5.95 → 1.5.97

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 (96) hide show
  1. package/dist-embed/chunks/{index.esm-zOy6kFPv.js → index.esm-BLDeC6q1.js} +1 -1
  2. package/dist-embed/datalayer-app-main.js +80 -80
  3. package/lib/apps/apps/appspec.d.ts +11 -12
  4. package/lib/apps/apps/appspec.js +45 -87
  5. package/lib/components/cards/ToolApprovalCard.js +4 -2
  6. package/lib/components/inspector/a2aSpans.d.ts +7 -0
  7. package/lib/components/inspector/a2aSpans.js +34 -2
  8. package/lib/components/inspector/agentSpans.d.ts +1 -1
  9. package/lib/components/inspector/agentSpans.js +1 -0
  10. package/lib/components/teams/HarnessIcon.d.ts +11 -0
  11. package/lib/components/teams/HarnessIcon.js +17 -0
  12. package/lib/components/teams/SceneTranscript.d.ts +1 -1
  13. package/lib/components/teams/SceneTranscript.js +12 -7
  14. package/lib/components/teams/SceneView.d.ts +7 -1
  15. package/lib/components/teams/SceneView.js +2 -2
  16. package/lib/components/teams/backdrops/hero.js +1 -1
  17. package/lib/components/teams/backdrops/minimal.js +1 -1
  18. package/lib/components/teams/backdrops/nodes.js +4 -3
  19. package/lib/components/teams/backdrops/space.js +1 -1
  20. package/lib/components/teams/backdrops/types.d.ts +9 -0
  21. package/lib/components/teams/index.d.ts +2 -0
  22. package/lib/components/teams/index.js +2 -0
  23. package/lib/components/teams/memberHarness.d.ts +16 -0
  24. package/lib/components/teams/memberHarness.js +42 -0
  25. package/lib/components/teams/sceneTranscriptRules.js +6 -1
  26. package/lib/components/teams/transcript/LineSelect.d.ts +20 -0
  27. package/lib/components/teams/transcript/LineSelect.js +20 -0
  28. package/lib/components/teams/transcript/TranscriptTable.d.ts +11 -5
  29. package/lib/components/teams/transcript/TranscriptTable.js +24 -7
  30. package/lib/components/teams/transcript/TranscriptViews.js +1 -1
  31. package/lib/components/teams/transcript/recordingPlayback.d.ts +13 -0
  32. package/lib/components/teams/transcript/recordingPlayback.js +32 -0
  33. package/lib/components/teams/transcript/useSceneRecording.d.ts +1 -1
  34. package/lib/components/teams/transcript/useSceneRecording.js +19 -11
  35. package/lib/examples/PapAccountTokensExample.d.ts +1 -1
  36. package/lib/examples/PapAccountTokensExample.js +3 -3
  37. package/lib/examples/PapSessionJwtExample.d.ts +4 -0
  38. package/lib/examples/{PapDpopProofExample.js → PapSessionJwtExample.js} +9 -9
  39. package/lib/examples/PapSessionLifecycleExample.d.ts +1 -1
  40. package/lib/examples/PapSessionLifecycleExample.js +2 -2
  41. package/lib/examples/ScenesExample.js +15 -13
  42. package/lib/examples/example-selector.js +3 -3
  43. package/lib/examples/index.d.ts +1 -1
  44. package/lib/examples/index.js +1 -1
  45. package/lib/examples/main.js +1 -1
  46. package/lib/examples/pap/PapAccountTokensView.d.ts +1 -1
  47. package/lib/examples/pap/PapAuthorizationBoundaryView.js +15 -22
  48. package/lib/examples/pap/PapGuidedJourneyView.js +61 -60
  49. package/lib/examples/pap/PapSessionJwtView.d.ts +4 -0
  50. package/lib/examples/pap/PapSessionJwtView.js +69 -0
  51. package/lib/examples/pap/PapSessionLifecycleView.js +36 -58
  52. package/lib/examples/pap/PapSignInDisplayView.d.ts +1 -1
  53. package/lib/examples/pap/PapSignInDisplayView.js +1 -1
  54. package/lib/examples/pap/PapTraceView.d.ts +1 -1
  55. package/lib/examples/pap/PapTraceView.js +1 -1
  56. package/lib/examples/pap/traces/account-tokens.json +145 -173
  57. package/lib/examples/pap/traces/conversation-control.json +118 -140
  58. package/lib/examples/pap/traces/conversation-streaming.json +114 -134
  59. package/lib/examples/pap/traces/mediated-sign-in.json +151 -166
  60. package/lib/examples/pap/traces/operations.json +613 -391
  61. package/lib/examples/pap/traces/two-companies.json +380 -990
  62. package/lib/examples/pap/traces/user-with-a-company.json +319 -207
  63. package/lib/models/environments.generated.d.ts +2 -2
  64. package/lib/models/environments.generated.js +1 -1
  65. package/lib/pap/index.d.ts +1 -1
  66. package/lib/pap/index.js +3 -3
  67. package/lib/portable/displays.d.ts +13 -22
  68. package/lib/portable/displays.js +17 -65
  69. package/lib/portable/hosts/approvalRenderers.d.ts +4 -4
  70. package/lib/portable/hosts/approvalRenderers.js +26 -13
  71. package/lib/portable/hosts/contracts.json +5 -2
  72. package/lib/portable/index.d.ts +1 -1
  73. package/lib/portable/index.js +1 -1
  74. package/lib/protocols/decks/index.d.ts +37 -0
  75. package/lib/protocols/decks/index.js +48 -0
  76. package/lib/protocols/decks/pact-a-personal-agent-at-a-business.d.ts +2 -0
  77. package/lib/protocols/decks/pact-a-personal-agent-at-a-business.js +148 -0
  78. package/lib/protocols/decks/ucp-a-purchase-approved.d.ts +2 -0
  79. package/lib/protocols/decks/ucp-a-purchase-approved.js +154 -0
  80. package/lib/specs/actions.d.ts +1 -1
  81. package/lib/specs/actions.js +2 -2
  82. package/lib/specs/agents/agents.js +3 -3
  83. package/lib/specs/apps.d.ts +1 -1
  84. package/lib/specs/apps.js +10 -11
  85. package/lib/specs/appspecSchema.js +4 -112
  86. package/lib/specs/envvars.js +2 -2
  87. package/lib/specs/harnesses.js +9 -9
  88. package/lib/specs/scenes.js +10 -33
  89. package/lib/specs/teams/teams.js +2 -2
  90. package/lib/types/agentspecs.d.ts +91 -127
  91. package/package.json +409 -409
  92. package/scripts/codegen/generate_apps.py +6 -7
  93. package/scripts/validate_pap_examples.py +1 -1
  94. package/lib/examples/PapDpopProofExample.d.ts +0 -4
  95. package/lib/examples/pap/PapDpopProofView.d.ts +0 -4
  96. package/lib/examples/pap/PapDpopProofView.js +0 -61
@@ -7,7 +7,7 @@ import { useState } from 'react';
7
7
  import { Box } from '@datalayer/primer-addons';
8
8
  import { contribution, definePlugin } from '@datalayer/reactor';
9
9
  import { Button, Text } from '@primer/react';
10
- import { DpopProofProviders, InMemorySessionKeys, JoseDpopProofProvider, SecretValue, SessionClient, Signers, buildPapReactor, } from '@datalayer/personal-agent-protocol';
10
+ import { DelegatedSessionSigner, InMemoryDelegatedKeys, SecretValue, SessionClient, SessionFetchClient, SessionSigners, buildPapReactor, } from '@datalayer/personal-agent-protocol';
11
11
  import { PapExamplePage, PapResult } from './PapExamplePage.js';
12
12
  /** Exercise the real Session client and retain only safe lifecycle evidence. */
13
13
  const PapSessionLifecycleView = () => {
@@ -15,83 +15,61 @@ const PapSessionLifecycleView = () => {
15
15
  const [error, setError] = useState(null);
16
16
  const runLifecycle = async () => {
17
17
  setError(null);
18
+ const jwts = [];
18
19
  let calls = 0;
19
- const forms = [];
20
- const purposes = [];
21
- const proofRequests = [];
22
- const proofs = new JoseDpopProofProvider({
23
- keys: new InMemorySessionKeys(),
24
- });
25
20
  const localFetch = async (_input, init) => {
26
21
  calls += 1;
27
- forms.push(new URLSearchParams(String(init?.body ?? '')));
28
- if (calls === 1) {
29
- return new Response(JSON.stringify({ error: 'use_dpop_nonce' }), {
22
+ jwts.push(new Headers(init?.headers).get('Poppy-Session') ?? '');
23
+ return calls === 1
24
+ ? new Response(JSON.stringify({ error: 'invalid_session' }), {
30
25
  status: 400,
31
- headers: {
32
- 'content-type': 'application/json',
33
- 'DPoP-Nonce': 'host-only-company-nonce',
34
- },
26
+ headers: { 'content-type': 'application/json' },
27
+ })
28
+ : new Response('{}', {
29
+ status: 200,
30
+ headers: { 'content-type': 'application/json' },
35
31
  });
36
- }
37
- return new Response(JSON.stringify({
38
- access_token: `host-only-session-token-${calls}`,
39
- token_type: 'DPoP',
40
- expires_in: 300,
41
- }), { status: 200, headers: { 'content-type': 'application/json' } });
42
32
  };
43
33
  const securityPlugin = definePlugin({
44
34
  name: '@datalayer/loop-example-pap-session-security',
45
35
  contributes: [
46
- contribution(Signers, {
47
- async sign(_claims, options) {
48
- purposes.push(options.purpose);
49
- return new SecretValue(`host-only-${options.purpose}-${purposes.length}`);
50
- },
51
- }, { id: 'example-signer' }),
52
- contribution(DpopProofProviders, {
53
- // A real P-256 key per Session (the Session Key), its private half
54
- // kept here; each proof is recorded for the evidence only.
55
- newSessionKey: options => proofs.newSessionKey(options),
56
- discardSessionKey: options => proofs.discardSessionKey(options),
57
- async create(request) {
58
- proofRequests.push(request);
59
- return proofs.create(request);
36
+ contribution(SessionSigners,
37
+ // A real delegated P-256 key per User ID, its private half kept here;
38
+ // the delegation's signature is a stand-in for a key in `jwks_uri`.
39
+ new DelegatedSessionSigner({
40
+ custody: new InMemoryDelegatedKeys(),
41
+ signer: {
42
+ sign: async (_claims, options) => new SecretValue(`host-only-${options.purpose}`),
60
43
  },
61
- }, { id: 'example-dpop' }),
44
+ }), { id: 'example-session-signer' }),
62
45
  ],
63
46
  });
64
47
  const reactor = buildPapReactor({ fetch: localFetch }, [securityPlugin]);
65
48
  try {
66
- const client = new SessionClient({ reactor, fetch: localFetch });
67
- const options = {
49
+ const session = await new SessionClient({
50
+ reactor,
51
+ fetch: localFetch,
52
+ }).start({
68
53
  clientId: 'https://assistant.example/agent.json',
69
54
  pairwiseUserId: 'usr_host_only_example',
70
55
  issuer: 'https://company.example',
71
- tokenEndpoint: 'https://company.example/oauth/token',
72
56
  tenantId: 'example-tenant',
73
- };
74
- const started = await client.start(options);
75
- const renewed = await client.renew({
76
- ...options,
77
- sessionKey: started.sessionKey,
78
57
  });
58
+ const requestsToStartASession = calls;
59
+ const sid = session.sid;
60
+ const answer = await new SessionFetchClient({
61
+ reactor,
62
+ fetch: localFetch,
63
+ }).request('GET', 'https://company.example/poppy/orders', { session });
79
64
  setSummary({
80
65
  startStatus: 'created',
81
- renewStatus: 'renewed',
82
- signedIn: false,
83
- tokenType: 'DPoP',
84
- scopes: renewed.scopes,
85
- sameSession: started.sessionKey === renewed.sessionKey,
86
- nonceRetry: proofRequests.length === 3 &&
87
- proofRequests[0]?.nonce === undefined &&
88
- proofRequests[1]?.nonce === 'host-only-company-nonce' &&
89
- proofRequests[2]?.nonce === undefined,
90
- freshAssertions: purposes.length === 6,
91
- freshProofs: proofRequests.length === 3,
92
- provedWithSessionKey: proofRequests.every(request => request.sessionKey === started.sessionKey),
93
- noSessionIdOnTheWire: forms.every(form => !form.has('session_id')),
94
- sessionKeyWithheld: true,
66
+ requestsToStartASession,
67
+ sessionHeaderOnEveryRequest: jwts.every(jwt => jwt !== ''),
68
+ freshJwtPerRequest: new Set(jwts).size === jwts.length,
69
+ restartedOnce: calls === 2 && session.sid !== sid,
70
+ resentRequestStatus: answer.status,
71
+ sameUserAfterRestart: session.sub === 'usr_host_only_example',
72
+ sidWithheld: true,
95
73
  credentialsWithheld: true,
96
74
  });
97
75
  }
@@ -103,6 +81,6 @@ const PapSessionLifecycleView = () => {
103
81
  reactor.stop();
104
82
  }
105
83
  };
106
- return (_jsxs(PapExamplePage, { eyebrow: "PAP \u00B7 Signed-out Session", title: "Start and renew without giving credentials to the agent", description: "This Reactor view drives the real PAP SessionClient (draft 0.3) against a deterministic company transport. The Session has its own DPoP key, the Session Key, whose thumbprint names it: no session_id is sent or read. It handles a DPoP nonce challenge, generates fresh assertions and proofs with that key, and renews the same Session. 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, nonce retry, and renewal 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.3) 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] }));
107
85
  };
108
86
  export default PapSessionLifecycleView;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The sign-in card as a display (RU-1), drawn as the chat draws it.
2
+ * The sign-in card as a display, drawn as the chat draws it.
3
3
  *
4
4
  * A tool that starts a sign-in answers with a `PapSignIn` display
5
5
  * (`application/vnd.datalayer.pap.sign-in+json`). Agent Runtimes gives the
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
6
  /**
7
- * The sign-in card as a display (RU-1), drawn as the chat draws it.
7
+ * The sign-in card as a display, drawn as the chat draws it.
8
8
  *
9
9
  * A tool that starts a sign-in answers with a `PapSignIn` display
10
10
  * (`application/vnd.datalayer.pap.sign-in+json`). Agent Runtimes gives the
@@ -2,7 +2,7 @@
2
2
  * Replay a redacted PAP trace, step by step.
3
3
  *
4
4
  * The traces are generated from the PAP Python SDK's demo worlds by
5
- * `examples/personal-agent-protocol/traces/generate.py`: real keys, proofs
5
+ * `examples/personal-agent-protocol/traces/generate.py`: real keys, Session JWTs
6
6
  * and HTTP between the parties, recorded and redacted. This view calls no
7
7
  * SDK function: it shows what the user sees, what each party holds, and the sequence of
8
8
  * exchanges between them, all synchronized on one step.
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  * Replay a redacted PAP trace, step by step.
8
8
  *
9
9
  * The traces are generated from the PAP Python SDK's demo worlds by
10
- * `examples/personal-agent-protocol/traces/generate.py`: real keys, proofs
10
+ * `examples/personal-agent-protocol/traces/generate.py`: real keys, Session JWTs
11
11
  * and HTTP between the parties, recorded and redacted. This view calls no
12
12
  * SDK function: it shows what the user sees, what each party holds, and the sequence of
13
13
  * exchanges between them, all synchronized on one step.