@datalayer/agent-runtimes 1.5.96 → 1.5.98
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/dist-embed/chunks/{index.esm-zOy6kFPv.js → index.esm-BLDeC6q1.js} +1 -1
- package/dist-embed/datalayer-app-main.js +80 -80
- package/lib/apps/apps/appspec.d.ts +11 -12
- package/lib/apps/apps/appspec.js +45 -87
- package/lib/components/cards/ToolApprovalCard.js +4 -2
- package/lib/components/teams/HarnessIcon.d.ts +11 -0
- package/lib/components/teams/HarnessIcon.js +17 -0
- package/lib/components/teams/SceneTranscript.d.ts +1 -1
- package/lib/components/teams/SceneTranscript.js +12 -7
- package/lib/components/teams/SceneView.d.ts +7 -1
- package/lib/components/teams/SceneView.js +2 -2
- package/lib/components/teams/backdrops/hero.js +1 -1
- package/lib/components/teams/backdrops/minimal.js +1 -1
- package/lib/components/teams/backdrops/nodes.js +4 -3
- package/lib/components/teams/backdrops/space.js +1 -1
- package/lib/components/teams/backdrops/types.d.ts +9 -0
- package/lib/components/teams/index.d.ts +2 -0
- package/lib/components/teams/index.js +2 -0
- package/lib/components/teams/memberHarness.d.ts +16 -0
- package/lib/components/teams/memberHarness.js +42 -0
- package/lib/components/teams/sceneTranscriptRules.js +6 -1
- package/lib/components/teams/transcript/LineSelect.d.ts +20 -0
- package/lib/components/teams/transcript/LineSelect.js +20 -0
- package/lib/components/teams/transcript/TranscriptTable.d.ts +11 -5
- package/lib/components/teams/transcript/TranscriptTable.js +24 -7
- package/lib/components/teams/transcript/TranscriptViews.js +1 -1
- package/lib/components/teams/transcript/recordingPlayback.d.ts +13 -0
- package/lib/components/teams/transcript/recordingPlayback.js +32 -0
- package/lib/components/teams/transcript/useSceneRecording.d.ts +1 -1
- package/lib/components/teams/transcript/useSceneRecording.js +19 -11
- package/lib/examples/PapAccountTokensExample.d.ts +1 -1
- package/lib/examples/PapAccountTokensExample.js +3 -3
- package/lib/examples/PapSessionJwtExample.d.ts +4 -0
- package/lib/examples/{PapDpopProofExample.js → PapSessionJwtExample.js} +9 -9
- package/lib/examples/PapSessionLifecycleExample.d.ts +1 -1
- package/lib/examples/PapSessionLifecycleExample.js +2 -2
- package/lib/examples/ScenesExample.js +15 -13
- package/lib/examples/example-selector.js +3 -3
- package/lib/examples/index.d.ts +1 -1
- package/lib/examples/index.js +1 -1
- package/lib/examples/main.js +1 -1
- package/lib/examples/pap/PapAccountTokensView.d.ts +1 -1
- package/lib/examples/pap/PapAuthorizationBoundaryView.js +15 -22
- package/lib/examples/pap/PapGuidedJourneyView.js +61 -60
- package/lib/examples/pap/PapSessionJwtView.d.ts +4 -0
- package/lib/examples/pap/PapSessionJwtView.js +69 -0
- package/lib/examples/pap/PapSessionLifecycleView.js +36 -58
- package/lib/examples/pap/PapSignInDisplayView.d.ts +1 -1
- package/lib/examples/pap/PapSignInDisplayView.js +1 -1
- package/lib/examples/pap/PapTraceView.d.ts +1 -1
- package/lib/examples/pap/PapTraceView.js +1 -1
- package/lib/examples/pap/traces/account-tokens.json +145 -173
- package/lib/examples/pap/traces/conversation-control.json +118 -140
- package/lib/examples/pap/traces/conversation-streaming.json +114 -134
- package/lib/examples/pap/traces/mediated-sign-in.json +151 -166
- package/lib/examples/pap/traces/operations.json +613 -391
- package/lib/examples/pap/traces/two-companies.json +380 -990
- package/lib/examples/pap/traces/user-with-a-company.json +319 -207
- package/lib/models/environments.generated.d.ts +2 -2
- package/lib/models/environments.generated.js +1 -1
- package/lib/pap/index.d.ts +1 -1
- package/lib/pap/index.js +3 -3
- package/lib/portable/displays.d.ts +13 -22
- package/lib/portable/displays.js +17 -65
- package/lib/portable/hosts/approvalRenderers.d.ts +4 -4
- package/lib/portable/hosts/approvalRenderers.js +26 -13
- package/lib/portable/hosts/contracts.json +5 -2
- package/lib/portable/index.d.ts +1 -1
- package/lib/portable/index.js +1 -1
- package/lib/protocols/decks/index.d.ts +37 -0
- package/lib/protocols/decks/index.js +48 -0
- package/lib/protocols/decks/pact-a-personal-agent-at-a-business.d.ts +2 -0
- package/lib/protocols/decks/pact-a-personal-agent-at-a-business.js +148 -0
- package/lib/protocols/decks/ucp-a-purchase-approved.d.ts +2 -0
- package/lib/protocols/decks/ucp-a-purchase-approved.js +154 -0
- package/lib/specs/actions.d.ts +1 -1
- package/lib/specs/actions.js +2 -2
- package/lib/specs/agents/agents.js +3 -3
- package/lib/specs/apps.d.ts +1 -1
- package/lib/specs/apps.js +10 -11
- package/lib/specs/appspecSchema.js +4 -112
- package/lib/specs/envvars.js +2 -2
- package/lib/specs/harnesses.js +9 -9
- package/lib/specs/scenes.js +10 -33
- package/lib/specs/teams/teams.js +2 -2
- package/lib/types/agentspecs.d.ts +91 -127
- package/package.json +409 -409
- package/scripts/codegen/generate_apps.py +6 -7
- package/scripts/validate_pap_examples.py +1 -1
- package/lib/examples/PapDpopProofExample.d.ts +0 -4
- package/lib/examples/pap/PapDpopProofView.d.ts +0 -4
- package/lib/examples/pap/PapDpopProofView.js +0 -61
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The `$id` of the JSON Schema these types are generated from. */
|
|
2
2
|
export declare const ENVIRONMENT_SCHEMA_ID = "https://datalayer.io/schemas/environments/v1alpha1/environment.json";
|
|
3
3
|
/** The sha256 of the schema text these types are generated from. */
|
|
4
|
-
export declare const ENVIRONMENT_SCHEMA_SHA256 = "
|
|
4
|
+
export declare const ENVIRONMENT_SCHEMA_SHA256 = "09cce136da97122a653c3b91b14b830ec1d4a1c8b7de9221284e37088039110e";
|
|
5
5
|
/** The `apiVersion` an Environment document carries. */
|
|
6
6
|
export declare const ENVIRONMENT_API_VERSION = "environments.datalayer.io/v1alpha1";
|
|
7
7
|
/** The `kind` an Environment document carries. */
|
|
@@ -29,7 +29,7 @@ export interface BuildSpec {
|
|
|
29
29
|
dockerfile?: DockerfileSpec | null;
|
|
30
30
|
image?: ImageSourceSpec | null;
|
|
31
31
|
/** Default: `"packages"`. */
|
|
32
|
-
source?: 'packages' | 'dependencyFile' | 'dockerfile' | 'image';
|
|
32
|
+
source?: 'packages' | 'dependencyFile' | 'dockerfile' | 'image' | 'foreignDockerfile';
|
|
33
33
|
}
|
|
34
34
|
export interface Commands {
|
|
35
35
|
postInstall?: string[];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** The `$id` of the JSON Schema these types are generated from. */
|
|
7
7
|
export const ENVIRONMENT_SCHEMA_ID = 'https://datalayer.io/schemas/environments/v1alpha1/environment.json';
|
|
8
8
|
/** The sha256 of the schema text these types are generated from. */
|
|
9
|
-
export const ENVIRONMENT_SCHEMA_SHA256 = '
|
|
9
|
+
export const ENVIRONMENT_SCHEMA_SHA256 = '09cce136da97122a653c3b91b14b830ec1d4a1c8b7de9221284e37088039110e';
|
|
10
10
|
/** The `apiVersion` an Environment document carries. */
|
|
11
11
|
export const ENVIRONMENT_API_VERSION = 'environments.datalayer.io/v1alpha1';
|
|
12
12
|
/** The `kind` an Environment document carries. */
|
package/lib/pap/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface PapCompanySummary {
|
|
|
7
7
|
readonly issuer: string | null;
|
|
8
8
|
/**
|
|
9
9
|
* Direct and Device as the issuer's `grant_types_supported` offers them,
|
|
10
|
-
* Mediated
|
|
10
|
+
* Mediated when the company offers that extension and its grant.
|
|
11
11
|
*/
|
|
12
12
|
readonly signIn: readonly string[];
|
|
13
13
|
/** The company's own scopes and what each allows (`auth.scopes`). */
|
package/lib/pap/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
import { AgentIdentityClient, discoverCompany, offersDevice, offersDirect, } from '@datalayer/personal-agent-protocol';
|
|
5
|
+
import { AgentIdentityClient, discoverCompany, mediatedSignIn, offersDevice, offersDirect, } from '@datalayer/personal-agent-protocol';
|
|
6
6
|
function extensionVersions(extensions) {
|
|
7
7
|
return Object.freeze(Object.fromEntries(Object.entries(extensions).map(([name, value]) => [name, value.version])));
|
|
8
8
|
}
|
|
@@ -27,7 +27,7 @@ export class PapPersonalAgentCapability {
|
|
|
27
27
|
const signIn = [
|
|
28
28
|
...(oauthMetadata && offersDirect(oauthMetadata) ? ['direct'] : []),
|
|
29
29
|
...(oauthMetadata && offersDevice(oauthMetadata) ? ['device'] : []),
|
|
30
|
-
...(
|
|
30
|
+
...(mediatedSignIn(company) === undefined ? [] : ['mediated']),
|
|
31
31
|
];
|
|
32
32
|
const interfaces = [
|
|
33
33
|
...(document.agent?.protocols.map(protocol => `agent:${protocol.type}`) ??
|
|
@@ -39,7 +39,7 @@ export class PapPersonalAgentCapability {
|
|
|
39
39
|
organization: document.organization.name,
|
|
40
40
|
domain: document.organization.domain,
|
|
41
41
|
protocolVersion: document.protocol_version,
|
|
42
|
-
issuer:
|
|
42
|
+
issuer: oauthMetadata?.issuer ?? null,
|
|
43
43
|
signIn: Object.freeze(signIn),
|
|
44
44
|
scopes: Object.freeze({ ...(auth?.scopes ?? {}) }),
|
|
45
45
|
scopeHints: Object.freeze(Object.fromEntries(Object.entries(auth?.scope_hints ?? {}).map(([name, hint]) => [
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The protocol displays a run's tool results carry, read strictly for any
|
|
3
|
-
* renderer
|
|
3
|
+
* renderer: the page's half of a tool result
|
|
4
4
|
* — `_meta["reactor.ui/display"]`, as the runtime's AG-UI stream sends it
|
|
5
5
|
* beside the model's view — decoded into what a card draws.
|
|
6
6
|
*
|
|
7
7
|
* - **Sign in at a company** (`…pap.sign-in+json`, and a plain `pap_sign_in`
|
|
8
8
|
* or a business's `pact_sign_in` answer): Direct, Device or Mediated, its
|
|
9
9
|
* page (`https` only), its code, until when, what it needs.
|
|
10
|
-
* - **An operation to
|
|
11
|
-
* verbatim, its terms
|
|
12
|
-
* (a Rules class; `buy` when money
|
|
13
|
-
*
|
|
14
|
-
* approval it stands for is named
|
|
15
|
-
*
|
|
10
|
+
* - **An operation to approve** (`…pap.confirm+json`): the company's words
|
|
11
|
+
* verbatim, its terms and what the terms check found, the opaque revision
|
|
12
|
+
* and the one it replaced, what it does (a Rules class; `buy` when money
|
|
13
|
+
* moves — a purchase). Every operation is the person's: it is answered where
|
|
14
|
+
* approvals are, never here, and the approval it stands for is named
|
|
15
|
+
* (`approvalId`).
|
|
16
16
|
* - **What a company answered** (`…pap.replies+json`): each reply with who
|
|
17
17
|
* wrote it there (its agent or one of its people), who answers now and
|
|
18
18
|
* where the conversation stands — participation.
|
|
@@ -33,13 +33,12 @@
|
|
|
33
33
|
import { type PapSignInWaiting } from './signIn';
|
|
34
34
|
export declare const PAP_SIGN_IN_TYPE = "application/vnd.datalayer.pap.sign-in+json";
|
|
35
35
|
export declare const PAP_CONFIRM_TYPE = "application/vnd.datalayer.pap.confirm+json";
|
|
36
|
-
export declare const PAP_OUTCOME_TYPE = "application/vnd.datalayer.pap.outcome+json";
|
|
37
36
|
export declare const PAP_REPLIES_TYPE = "application/vnd.datalayer.pap.replies+json";
|
|
38
37
|
export declare const SHIELD_DIFF_TYPE = "application/vnd.datalayer.shield.diff+json";
|
|
39
38
|
export declare const SHIELD_TERMINAL_TYPE = "application/vnd.datalayer.shield.terminal+json";
|
|
40
39
|
/** Where a tool result carries its display for the page. */
|
|
41
40
|
export declare const DISPLAY_META_KEY = "reactor.ui/display";
|
|
42
|
-
/** What
|
|
41
|
+
/** What approving an operation does, as an application's Rules class it. */
|
|
43
42
|
export type ActionClass = 'read' | 'write' | 'send' | 'buy' | 'delete' | 'publish';
|
|
44
43
|
export type ProtocolDisplay = ({
|
|
45
44
|
kind: 'sign-in';
|
|
@@ -57,25 +56,17 @@ export type ProtocolDisplay = ({
|
|
|
57
56
|
summary: string;
|
|
58
57
|
terms: Record<string, unknown>;
|
|
59
58
|
operationRef: string;
|
|
60
|
-
|
|
59
|
+
/** Opaque, the company's: approved exactly as it is shown. */
|
|
60
|
+
revision: string;
|
|
61
61
|
does: ActionClass | null;
|
|
62
62
|
signedIn: boolean | null;
|
|
63
63
|
expiresAt: string;
|
|
64
|
+
/** What the terms check found: terms the summary does not say. */
|
|
65
|
+
differences: string[];
|
|
64
66
|
was: {
|
|
65
|
-
revision:
|
|
67
|
+
revision: string;
|
|
66
68
|
terms: Record<string, unknown>;
|
|
67
69
|
} | null;
|
|
68
|
-
onlyThePerson: boolean;
|
|
69
|
-
} | {
|
|
70
|
-
kind: 'outcome';
|
|
71
|
-
id: string;
|
|
72
|
-
company: string;
|
|
73
|
-
summary: string;
|
|
74
|
-
operationRef: string;
|
|
75
|
-
revision: number;
|
|
76
|
-
state: 'in_progress' | 'succeeded' | 'failed' | 'cancelled' | 'expired';
|
|
77
|
-
result: string;
|
|
78
|
-
approvedBy: 'user' | 'standing_permission' | null;
|
|
79
70
|
} | {
|
|
80
71
|
kind: 'replies';
|
|
81
72
|
id: string;
|
package/lib/portable/displays.js
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* The protocol displays a run's tool results carry, read strictly for any
|
|
7
|
-
* renderer
|
|
7
|
+
* renderer: the page's half of a tool result
|
|
8
8
|
* — `_meta["reactor.ui/display"]`, as the runtime's AG-UI stream sends it
|
|
9
9
|
* beside the model's view — decoded into what a card draws.
|
|
10
10
|
*
|
|
11
11
|
* - **Sign in at a company** (`…pap.sign-in+json`, and a plain `pap_sign_in`
|
|
12
12
|
* or a business's `pact_sign_in` answer): Direct, Device or Mediated, its
|
|
13
13
|
* page (`https` only), its code, until when, what it needs.
|
|
14
|
-
* - **An operation to
|
|
15
|
-
* verbatim, its terms
|
|
16
|
-
* (a Rules class; `buy` when money
|
|
17
|
-
*
|
|
18
|
-
* approval it stands for is named
|
|
19
|
-
*
|
|
14
|
+
* - **An operation to approve** (`…pap.confirm+json`): the company's words
|
|
15
|
+
* verbatim, its terms and what the terms check found, the opaque revision
|
|
16
|
+
* and the one it replaced, what it does (a Rules class; `buy` when money
|
|
17
|
+
* moves — a purchase). Every operation is the person's: it is answered where
|
|
18
|
+
* approvals are, never here, and the approval it stands for is named
|
|
19
|
+
* (`approvalId`).
|
|
20
20
|
* - **What a company answered** (`…pap.replies+json`): each reply with who
|
|
21
21
|
* wrote it there (its agent or one of its people), who answers now and
|
|
22
22
|
* where the conversation stands — participation.
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
import { isPapSignInTool, readPapSignIn, } from './signIn.js';
|
|
38
38
|
export const PAP_SIGN_IN_TYPE = 'application/vnd.datalayer.pap.sign-in+json';
|
|
39
39
|
export const PAP_CONFIRM_TYPE = 'application/vnd.datalayer.pap.confirm+json';
|
|
40
|
-
export const PAP_OUTCOME_TYPE = 'application/vnd.datalayer.pap.outcome+json';
|
|
41
40
|
export const PAP_REPLIES_TYPE = 'application/vnd.datalayer.pap.replies+json';
|
|
42
41
|
export const SHIELD_DIFF_TYPE = 'application/vnd.datalayer.shield.diff+json';
|
|
43
42
|
export const SHIELD_TERMINAL_TYPE = 'application/vnd.datalayer.shield.terminal+json';
|
|
@@ -48,9 +47,6 @@ const record = (value) => value && typeof value === 'object' && !Array.isArray(v
|
|
|
48
47
|
: null;
|
|
49
48
|
const text = (value) => typeof value === 'string' ? value : '';
|
|
50
49
|
const words = (value) => text(value).trim();
|
|
51
|
-
const count = (value) => typeof value === 'number' && Number.isInteger(value) && value >= 1
|
|
52
|
-
? value
|
|
53
|
-
: 0;
|
|
54
50
|
const ACTIONS = [
|
|
55
51
|
'read',
|
|
56
52
|
'write',
|
|
@@ -59,13 +55,6 @@ const ACTIONS = [
|
|
|
59
55
|
'delete',
|
|
60
56
|
'publish',
|
|
61
57
|
];
|
|
62
|
-
const OUTCOMES = [
|
|
63
|
-
'in_progress',
|
|
64
|
-
'succeeded',
|
|
65
|
-
'failed',
|
|
66
|
-
'cancelled',
|
|
67
|
-
'expired',
|
|
68
|
-
];
|
|
69
58
|
const STATUSES = ['working', 'idle', 'queued', 'closed'];
|
|
70
59
|
const who = (value) => value === 'agent' || value === 'human' ? value : null;
|
|
71
60
|
/** A display's wire (`{type, version, id, text, data}`) decoded, or `unknown` with its text. */
|
|
@@ -96,19 +85,22 @@ export function protocolDisplayOf(wire) {
|
|
|
96
85
|
const company = words(data.company);
|
|
97
86
|
const summary = text(data.summary);
|
|
98
87
|
const operationRef = words(data.operation_ref);
|
|
99
|
-
const revision =
|
|
88
|
+
const revision = words(data.revision);
|
|
100
89
|
const terms = record(data.terms);
|
|
101
90
|
const was = record(data.was);
|
|
102
|
-
const wasRevision = was ?
|
|
91
|
+
const wasRevision = was ? words(was.revision) : '';
|
|
92
|
+
const expiresAt = words(data.expires_at);
|
|
103
93
|
if (!company ||
|
|
104
94
|
!summary.trim() ||
|
|
105
95
|
!operationRef ||
|
|
106
96
|
!revision ||
|
|
107
97
|
!terms ||
|
|
98
|
+
!expiresAt ||
|
|
99
|
+
!Array.isArray(data.differences) ||
|
|
108
100
|
!id.endsWith('-confirm')) {
|
|
109
101
|
return unknown;
|
|
110
102
|
}
|
|
111
|
-
if (was && (!wasRevision || wasRevision
|
|
103
|
+
if (was && (!wasRevision || wasRevision === revision)) {
|
|
112
104
|
return unknown;
|
|
113
105
|
}
|
|
114
106
|
const does = data.does === null || data.does === undefined
|
|
@@ -130,41 +122,11 @@ export function protocolDisplayOf(wire) {
|
|
|
130
122
|
signedIn: session && typeof session.signed_in === 'boolean'
|
|
131
123
|
? session.signed_in
|
|
132
124
|
: null,
|
|
133
|
-
expiresAt
|
|
125
|
+
expiresAt,
|
|
126
|
+
differences: data.differences.map(text),
|
|
134
127
|
was: was
|
|
135
128
|
? { revision: wasRevision, terms: record(was.terms) ?? {} }
|
|
136
129
|
: null,
|
|
137
|
-
onlyThePerson: data.only_the_person === true,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
case PAP_OUTCOME_TYPE: {
|
|
141
|
-
const state = OUTCOMES.find(s => s === data.state);
|
|
142
|
-
const company = words(data.company);
|
|
143
|
-
const summary = text(data.summary);
|
|
144
|
-
const result = text(data.result);
|
|
145
|
-
if (!state ||
|
|
146
|
-
!company ||
|
|
147
|
-
!summary.trim() ||
|
|
148
|
-
!words(data.operation_ref) ||
|
|
149
|
-
!count(data.revision)) {
|
|
150
|
-
return unknown;
|
|
151
|
-
}
|
|
152
|
-
// Final, it says what it came to in the company's words; in progress, nothing yet.
|
|
153
|
-
if ((state === 'in_progress') !== !result.trim())
|
|
154
|
-
return unknown;
|
|
155
|
-
return {
|
|
156
|
-
kind: 'outcome',
|
|
157
|
-
id,
|
|
158
|
-
company,
|
|
159
|
-
summary,
|
|
160
|
-
operationRef: words(data.operation_ref),
|
|
161
|
-
revision: count(data.revision),
|
|
162
|
-
state,
|
|
163
|
-
result,
|
|
164
|
-
approvedBy: data.approved_by === 'user' ||
|
|
165
|
-
data.approved_by === 'standing_permission'
|
|
166
|
-
? data.approved_by
|
|
167
|
-
: null,
|
|
168
130
|
};
|
|
169
131
|
}
|
|
170
132
|
case PAP_REPLIES_TYPE: {
|
|
@@ -282,11 +244,7 @@ export function displayLine(display) {
|
|
|
282
244
|
case 'sign-in-refused':
|
|
283
245
|
return display.why;
|
|
284
246
|
case 'confirm':
|
|
285
|
-
return `${display.company} asks you to
|
|
286
|
-
case 'outcome':
|
|
287
|
-
return display.state === 'in_progress'
|
|
288
|
-
? `Still in progress at ${display.company}: ${display.summary}`
|
|
289
|
-
: `${OUTCOME_LEADS[display.state]} ${display.company}: ${display.result}`;
|
|
247
|
+
return `${display.company} asks you to approve: ${display.summary} (revision ${display.revision})`;
|
|
290
248
|
case 'replies':
|
|
291
249
|
return `${display.company} answered${display.responder === 'human' ? ': one of its people is answering' : ''}`;
|
|
292
250
|
case 'handoff':
|
|
@@ -312,17 +270,11 @@ export function displayLine(display) {
|
|
|
312
270
|
return display.text || `A display this app cannot draw (${display.type})`;
|
|
313
271
|
}
|
|
314
272
|
}
|
|
315
|
-
const OUTCOME_LEADS = {
|
|
316
|
-
succeeded: 'Done at',
|
|
317
|
-
failed: 'Failed at',
|
|
318
|
-
cancelled: 'Cancelled at',
|
|
319
|
-
expired: 'Expired at',
|
|
320
|
-
};
|
|
321
273
|
/** Who wrote a reply, said apart from the person's words and the agent's summaries (PAP-7.8-01). */
|
|
322
274
|
export const replyAuthor = (company, author, name) => `${author === 'human'
|
|
323
275
|
? `${company}, one of its people`
|
|
324
276
|
: `${company}, its agent`}${name ? ` (${name})` : ''}`;
|
|
325
|
-
// -- a diff and a terminal
|
|
277
|
+
// -- a diff and a terminal ------------------------------------
|
|
326
278
|
const countLines = (value) => value === '' ? 0 : value.split('\n').length - (value.endsWith('\n') ? 1 : 0);
|
|
327
279
|
/** A file's language from its suffix, the same table the runtime uses. */
|
|
328
280
|
const LANGUAGES = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApprovalPresentation } from './contracts';
|
|
2
2
|
/**
|
|
3
|
-
* Typed approval renderers
|
|
3
|
+
* Typed approval renderers.
|
|
4
4
|
* A host offers Approve and Reject only when a renderer that knows the
|
|
5
5
|
* tool proves that every material argument is shown: each argument the server
|
|
6
6
|
* presented is named by the renderer, or the card fails closed. An unknown
|
|
@@ -8,10 +8,10 @@ import type { ApprovalPresentation } from './contracts';
|
|
|
8
8
|
* action that is not mail (reads, writes, other sends, destructive, financial,
|
|
9
9
|
* publishing, executing) are reviewed in Datalayer (decided by the user on 16 October 2026: mail only),
|
|
10
10
|
* but for a company's `pap_confirm`, decided in a host with the operation's
|
|
11
|
-
* exact revision since 28 October 2026 (the user
|
|
11
|
+
* exact revision since 28 October 2026 (the user's decision).
|
|
12
12
|
* They render ai-agents' presentation v1, a different input
|
|
13
13
|
* from `../approvals.ts` and `../approvalCard.ts`. Moved from the Slack
|
|
14
|
-
* service
|
|
14
|
+
* service.
|
|
15
15
|
*
|
|
16
16
|
* @module portable/hosts/approvalRenderers
|
|
17
17
|
*/
|
|
@@ -43,7 +43,7 @@ export declare const DATALAYER_ONLY: Set<"unknown" | "read" | "write" | "send" |
|
|
|
43
43
|
export declare const MAIL_WORDS: ReadonlySet<string>;
|
|
44
44
|
export declare const isPapConfirm: (toolName: string) => boolean;
|
|
45
45
|
/** What a `pap_confirm` approval carries: contracts.json `presentation.pap_confirm_keys`. */
|
|
46
|
-
export declare const PAP_CONFIRM_KEYS: readonly ["key", "company", "summary", "terms", "operation_ref", "revision", "digest", "class", "session", "
|
|
46
|
+
export declare const PAP_CONFIRM_KEYS: readonly ["key", "company", "company_name", "summary", "terms", "operation_ref", "revision", "expires_at", "digest", "differences", "class", "session", "retry", "was"];
|
|
47
47
|
/**
|
|
48
48
|
* The renderers, the first that matches wins: a company's `pap_confirm`
|
|
49
49
|
* (whose name says no class), then Datalayer-only before any other.
|
|
@@ -105,22 +105,27 @@ export const isPapConfirm = (toolName) => PAP_CONFIRM.test(toolName);
|
|
|
105
105
|
export const PAP_CONFIRM_KEYS = [
|
|
106
106
|
'key',
|
|
107
107
|
'company',
|
|
108
|
+
'company_name',
|
|
108
109
|
'summary',
|
|
109
110
|
'terms',
|
|
110
111
|
'operation_ref',
|
|
111
112
|
'revision',
|
|
113
|
+
'expires_at',
|
|
112
114
|
'digest',
|
|
115
|
+
'differences',
|
|
113
116
|
'class',
|
|
114
117
|
'session',
|
|
115
|
-
'
|
|
118
|
+
'retry',
|
|
116
119
|
'was',
|
|
117
120
|
];
|
|
118
121
|
/**
|
|
119
|
-
* A company's operation the person
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* no other; a changed revision is another
|
|
123
|
-
* summary, operation, revision or digest
|
|
122
|
+
* A company's operation the person approves (decided by the user 28 October
|
|
123
|
+
* 2026): the company by its name and domain, its own summary, every term and
|
|
124
|
+
* what the terms check found, the operation and its **exact revision**, opaque
|
|
125
|
+
* — a decision is on that revision and no other; a changed revision is another
|
|
126
|
+
* approval. A missing company, summary, operation, revision, expiry or digest
|
|
127
|
+
* fails the card closed. `retry` holds the request the company answered, its
|
|
128
|
+
* body included: known, and never shown.
|
|
124
129
|
*/
|
|
125
130
|
const papConfirm = {
|
|
126
131
|
name: 'pap-confirm',
|
|
@@ -131,15 +136,14 @@ const papConfirm = {
|
|
|
131
136
|
const missing = [];
|
|
132
137
|
const extra = [];
|
|
133
138
|
const company = typeof args.company === 'string' ? args.company : '';
|
|
139
|
+
const companyName = typeof args.company_name === 'string' ? args.company_name : '';
|
|
134
140
|
const summary = typeof args.summary === 'string' ? args.summary : '';
|
|
135
141
|
const operation = typeof args.operation_ref === 'string' ? args.operation_ref : '';
|
|
136
|
-
const revision =
|
|
137
|
-
|
|
138
|
-
: undefined;
|
|
139
|
-
if (!company)
|
|
142
|
+
const revision = typeof args.revision === 'string' ? args.revision : '';
|
|
143
|
+
if (!company || !companyName)
|
|
140
144
|
missing.push('the company');
|
|
141
145
|
else
|
|
142
|
-
fields.push({ label: 'Company', value: company });
|
|
146
|
+
fields.push({ label: 'Company', value: companyName }, { label: 'Domain', value: company });
|
|
143
147
|
if (!summary)
|
|
144
148
|
missing.push('what it does, in its words');
|
|
145
149
|
else
|
|
@@ -152,14 +156,23 @@ const papConfirm = {
|
|
|
152
156
|
else
|
|
153
157
|
for (const [name, value] of Object.entries((args.terms ?? {})))
|
|
154
158
|
fields.push({ label: name, value: text(value) });
|
|
159
|
+
if (Array.isArray(args.differences))
|
|
160
|
+
for (const difference of args.differences)
|
|
161
|
+
fields.push({ label: 'Not in its words', value: text(difference) });
|
|
162
|
+
else
|
|
163
|
+
missing.push('what the terms check found');
|
|
155
164
|
if (!operation)
|
|
156
165
|
missing.push('the operation');
|
|
157
166
|
else
|
|
158
167
|
fields.push({ label: 'Operation', value: operation });
|
|
159
|
-
if (revision
|
|
168
|
+
if (!revision)
|
|
160
169
|
missing.push('its exact revision');
|
|
161
170
|
else
|
|
162
|
-
fields.push({ label: 'Revision', value:
|
|
171
|
+
fields.push({ label: 'Revision', value: revision });
|
|
172
|
+
if (typeof args.expires_at !== 'string' || !args.expires_at)
|
|
173
|
+
missing.push('until when it holds');
|
|
174
|
+
else
|
|
175
|
+
fields.push({ label: 'Holds until', value: args.expires_at });
|
|
163
176
|
if (typeof args.digest !== 'string' || !args.digest)
|
|
164
177
|
missing.push('the digest of its terms');
|
|
165
178
|
if (typeof args.class === 'string' && args.class)
|
|
@@ -372,17 +372,20 @@
|
|
|
372
372
|
"pap_confirm_keys": [
|
|
373
373
|
"key",
|
|
374
374
|
"company",
|
|
375
|
+
"company_name",
|
|
375
376
|
"summary",
|
|
376
377
|
"terms",
|
|
377
378
|
"operation_ref",
|
|
378
379
|
"revision",
|
|
380
|
+
"expires_at",
|
|
379
381
|
"digest",
|
|
382
|
+
"differences",
|
|
380
383
|
"class",
|
|
381
384
|
"session",
|
|
382
|
-
"
|
|
385
|
+
"retry",
|
|
383
386
|
"was"
|
|
384
387
|
],
|
|
385
|
-
"pap_confirm_about": "
|
|
388
|
+
"pap_confirm_about": "Decided 28 October 2026: a company's pap_confirm (any gateway prefix) is decided in a host, on its exact revision; every other non-mail action stays in Datalayer."
|
|
386
389
|
},
|
|
387
390
|
"decision": {
|
|
388
391
|
"request": {
|
package/lib/portable/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { conversationEventsOf, sanitizeAssistantContent, snapshotOfMessages, typ
|
|
|
19
19
|
export { PRESENCE_LINES, presenceOfConversation, presenceState, presenceToolOf, type PresenceState, type PresenceTool, } from './presence';
|
|
20
20
|
export { ANSWER_BELOW, ANSWER_COMPLETE, composerOf, droppedWords, ENDED_WORDS, messageLabel, OPENING_WORDS, presenceLine, showsQuestion, stepLine, TOOL_STATUS_WORDS, toolLabel, type ComposerProps, type ComposerState, type ConversationViewProps, type ErrorItem, type ErrorRowProps, type MessageItem, type MessageRowProps, type PresenceLineProps, type ProtocolDisplayProps, type QuestionCardProps, type StepItem, type StepRowProps, type ToolItem, type ToolRowProps, type TurnEndItem, type TurnEndRowProps, } from './views';
|
|
21
21
|
export { activityFixture, conversationFixture } from './fixtures';
|
|
22
|
-
export { DISPLAY_META_KEY, displayLine, displayOfToolResult, PAP_CONFIRM_TYPE, PAP_HANDOFF_TOOL,
|
|
22
|
+
export { DISPLAY_META_KEY, displayLine, displayOfToolResult, PAP_CONFIRM_TYPE, PAP_HANDOFF_TOOL, PAP_REPLIES_TYPE, PAP_SIGN_IN_TYPE, protocolDisplayOf, replyAuthor, type ActionClass, type ProtocolDisplay, DIFF_LINES_LIMIT, SHIELD_DIFF_TYPE, SHIELD_TERMINAL_TYPE, languageOf, unifiedDiffLines, unifiedDiffText, type DiffLine, } from './displays';
|
|
23
23
|
export { shieldDisplayFixtures } from './fixtures';
|
|
24
24
|
export { isPapSignInTool, PAP_SIGN_IN_WORDS, readPapSignIn, safeSignInUrl, type PapSignInWaiting, } from './signIn';
|
|
25
25
|
export { DIRECT_MAX, DIRECT_WORDS, directAnswerOf, directAuthor, directClient, openDirect, withDirectAnswer, type DirectAnswer, type DirectClient, type DirectClientOptions, type DirectLine, type DirectOpen, type DirectReply, type DirectTarget, } from './direct';
|
package/lib/portable/index.js
CHANGED
|
@@ -32,7 +32,7 @@ export { PRESENCE_LINES, presenceOfConversation, presenceState, presenceToolOf,
|
|
|
32
32
|
export { ANSWER_BELOW, ANSWER_COMPLETE, composerOf, droppedWords, ENDED_WORDS, messageLabel, OPENING_WORDS, presenceLine, showsQuestion, stepLine, TOOL_STATUS_WORDS, toolLabel, } from './views.js';
|
|
33
33
|
export { activityFixture, conversationFixture } from './fixtures.js';
|
|
34
34
|
// The protocol displays a run's tool results carry (M-037).
|
|
35
|
-
export { DISPLAY_META_KEY, displayLine, displayOfToolResult, PAP_CONFIRM_TYPE, PAP_HANDOFF_TOOL,
|
|
35
|
+
export { DISPLAY_META_KEY, displayLine, displayOfToolResult, PAP_CONFIRM_TYPE, PAP_HANDOFF_TOOL, PAP_REPLIES_TYPE, PAP_SIGN_IN_TYPE, protocolDisplayOf, replyAuthor,
|
|
36
36
|
// A coding agent's diff and terminal (SH-16).
|
|
37
37
|
DIFF_LINES_LIMIT, SHIELD_DIFF_TYPE, SHIELD_TERMINAL_TYPE, languageOf, unifiedDiffLines, unifiedDiffText, } from './displays.js';
|
|
38
38
|
export { shieldDisplayFixtures } from './fixtures.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The cases, in the order they are told. */
|
|
2
|
+
export declare const PROTOCOL_DECK_IDS: readonly ["ucp-a-purchase-approved", "pact-a-personal-agent-at-a-business"];
|
|
3
|
+
export type ProtocolDeckId = (typeof PROTOCOL_DECK_IDS)[number];
|
|
4
|
+
/** One slide: its `type` says what else it holds (`SlideSpec` of `@datalayer/decks`). */
|
|
5
|
+
export type ProtocolDeckSlide = {
|
|
6
|
+
type: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
notes?: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
/** A deck's specification, assignable to `DeckSpec` of `@datalayer/decks`. */
|
|
13
|
+
export type ProtocolDeckSpec = {
|
|
14
|
+
deck: {
|
|
15
|
+
title: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
template: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
slides: ProtocolDeckSlide[];
|
|
21
|
+
};
|
|
22
|
+
export type ProtocolDeck = {
|
|
23
|
+
/** The case it explains. */
|
|
24
|
+
id: ProtocolDeckId;
|
|
25
|
+
/** The protocol it shows: none of these is the Personal Agent Protocol. */
|
|
26
|
+
protocol: 'UCP' | 'PACT';
|
|
27
|
+
/** The case's name. */
|
|
28
|
+
title: string;
|
|
29
|
+
/** The deck as YAML. */
|
|
30
|
+
yaml: string;
|
|
31
|
+
/** The same deck, parsed. */
|
|
32
|
+
spec: ProtocolDeckSpec;
|
|
33
|
+
};
|
|
34
|
+
/** Every deck, in the order of the cases. */
|
|
35
|
+
export declare const PROTOCOL_DECKS: readonly ProtocolDeck[];
|
|
36
|
+
/** The deck of a case; refused when the case has none. */
|
|
37
|
+
export declare function protocolDeck(id: string): ProtocolDeck;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Two cases of the protocols integrated here, each explained as a deck.
|
|
7
|
+
*
|
|
8
|
+
* `@datalayer/agent-runtimes/lib/protocols/decks`: a deck is a specification,
|
|
9
|
+
* its slides, their types and their words, in the format of `@datalayer/decks`,
|
|
10
|
+
* written as YAML in a TypeScript file of its own, with `spec` the same deck
|
|
11
|
+
* parsed. UCP's and PACT's cases are told here because this is where those
|
|
12
|
+
* protocols are spoken; the Personal Agent Protocol's four are in
|
|
13
|
+
* `@datalayer/personal-agent-protocol/decks`, in the same shape.
|
|
14
|
+
*
|
|
15
|
+
* This module imports nothing but `yaml`: the Datalayer home page loads it only
|
|
16
|
+
* when a deck is opened.
|
|
17
|
+
*
|
|
18
|
+
* @module protocols/decks
|
|
19
|
+
*/
|
|
20
|
+
import { parse } from 'yaml';
|
|
21
|
+
import { yaml as personalAgentAtABusiness } from './pact-a-personal-agent-at-a-business.js';
|
|
22
|
+
import { yaml as purchaseApproved } from './ucp-a-purchase-approved.js';
|
|
23
|
+
/** The cases, in the order they are told. */
|
|
24
|
+
export const PROTOCOL_DECK_IDS = [
|
|
25
|
+
'ucp-a-purchase-approved',
|
|
26
|
+
'pact-a-personal-agent-at-a-business',
|
|
27
|
+
];
|
|
28
|
+
const SOURCES = {
|
|
29
|
+
'ucp-a-purchase-approved': { protocol: 'UCP', yaml: purchaseApproved },
|
|
30
|
+
'pact-a-personal-agent-at-a-business': {
|
|
31
|
+
protocol: 'PACT',
|
|
32
|
+
yaml: personalAgentAtABusiness,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
/** Every deck, in the order of the cases. */
|
|
36
|
+
export const PROTOCOL_DECKS = PROTOCOL_DECK_IDS.map(id => {
|
|
37
|
+
const { protocol, yaml } = SOURCES[id];
|
|
38
|
+
const spec = parse(yaml);
|
|
39
|
+
return { id, protocol, title: spec.deck.title, yaml, spec };
|
|
40
|
+
});
|
|
41
|
+
/** The deck of a case; refused when the case has none. */
|
|
42
|
+
export function protocolDeck(id) {
|
|
43
|
+
const deck = PROTOCOL_DECKS.find(one => one.id === id);
|
|
44
|
+
if (deck === undefined) {
|
|
45
|
+
throw new Error(`There is no deck for the case "${id}".`);
|
|
46
|
+
}
|
|
47
|
+
return deck;
|
|
48
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** A Personal Agent at a Business, as a deck in YAML. */
|
|
2
|
+
export declare const yaml = "deck:\n title: A Personal Agent at a Business\n subtitle: Personal Agent Consent & Trust, by example\n template: datalayer\nslides:\n - id: pact-a-personal-agent-at-a-business\n type: title\n title: A Personal Agent at a Business\n subtitle: Ada\u2019s Travel Desk asks an airline about her flight, and she allows it to read her bookings, not to change them.\n meta: PACT 1.0 \u00B7 a case \u00B7 not the Personal Agent Protocol\n notes: >-\n This case is over PACT, Personal Agent Consent and Trust. It is a different\n protocol from the Personal Agent Protocol, built on A2A and OAuth, with the\n same aim: a person\u2019s own agent working with a business. It is played with a\n demo airline, so nothing here signs in anywhere.\n - id: who\n type: three-columns\n title: Who is in this case\n columns:\n - heading: Ada\n type: text\n content: The person. She chooses what is allowed.\n - heading: Travel Desk\n type: text\n content: An application that works for Ada.\n - heading: Example Air Support\n type: text\n content: A business, at air.examples.datalayer.run, answered for by Example Provider.\n notes: >-\n Three parties. Ada wants to know when she flies. Travel Desk is an\n application working for her. Example Air Support is the airline\u2019s agent, and\n a Provider answers for it, which is how PACT describes a business that\n reaches agents through a platform.\n - id: what-happens\n type: mermaid\n title: What happens\n diagram: |-\n sequenceDiagram\n actor Ada\n participant Desk as Travel Desk\n participant Air as Example Air Support\n Ada->>Desk: When is my flight?\n Desk->>Air: Reads its card\n Desk->>Air: Asks, as Travel Desk\n Air-->>Desk: Please sign in\n Desk->>Ada: Sign in at Example Air\n Ada->>Air: Allows See your bookings, only\n Air-->>Desk: AB123 flies on 2026-11-02\n Desk->>Ada: Your flight is on 2 November 2026\n notes: >-\n Ada asks. The application reads the card the business publishes, and asks\n the airline\u2019s agent, saying which application it is. The airline asks for a\n sign-in. Ada signs in on the airline\u2019s page and allows one thing of the two\n asked. The airline answers, and signs a receipt.\n - id: identity\n type: flow\n title: Who is asking\n items:\n - label: \"1\"\n title: Card\n detail: Published at the business\u2019s own domain\n - label: \"2\"\n title: Identity\n detail: Each request is signed, naming which application asks\n - label: \"3\"\n title: Ask\n detail: Over A2A, with nobody signed in yet\n current: true\n notes: >-\n PACT has two profiles. In the Identity profile every request but the card\n carries a signed personal-agent token that says which agent is asking and\n for what stable, opaque person. It lives two minutes. That is enough to\n talk. Acting on the person\u2019s account is the second profile.\n - id: scopes\n type: comparison\n title: Ada allows one of the two\n columns:\n - Asked\n - Allowed\n rows:\n - label: See your bookings and their status\n values:\n - true\n - true\n - label: Change the date of a booking\n values:\n - true\n - false\n notes: >-\n The application asks for the two permissions on the card, one to read and\n one to change. Ada signs in on the airline\u2019s own page with a link and a code,\n and allows reading only. The airline gives Travel Desk a permission for Ada\n and for this application alone.\n - id: step-up\n type: statement\n title: Allowing less is an answer\n statement: >-\n If Travel Desk later needs more, the business **says what is missing**, and\n Ada is asked again.\n notes: >-\n The application reads back what was granted. If a later request needs more,\n the business answers that it needs authorization, naming the missing\n permission, and Ada is asked. Nothing widens silently. What she allowed\n stays what she allowed.\n - id: receipt\n type: two-columns\n title: A receipt, signed by the airline\n left:\n heading: Each answer comes with\n type: bullets\n items:\n - A receipt of what was done with the permission\n - The airline\u2019s signature, verified before it is kept\n right:\n heading: The record shows\n type: bullets\n items:\n - Signed in at Example Air, for Ada\n - Allowed, See your bookings and their status\n - Looked up booking AB123\n notes: >-\n The airline signs a receipt of what it did with the permission. The\n application verifies it before it keeps it, with its record. Ada can see the\n permission and end it with Disconnect.\n - id: why\n type: statement\n title: Why it matters\n statement: >-\n The business knows **which agent is asking**, the person chooses **what it\n may do**, and a signed receipt says **what it did**.\n notes: >-\n Three questions a business has about somebody\u2019s agent, each with an answer\n that can be checked, without a password ever passing through the agent.\n - id: run-it\n type: closing\n title: Run it yourself\n cta: The PACT page of the Agent Runtimes docs, and the demo Provider that plays this case.\n notes: >-\n This case is written from the Agent Runtimes demo Provider, Example Air, with\n its card, permissions and answers as they are. Read the PACT page for the\n personal agent and its contribution points, and PAP and PACT side by side\n for how the two protocols compare.\n";
|