@datalayer/agent-runtimes 1.3.111 → 1.3.112
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/datalayer-app-main.js +4 -4
- package/lib/apps/apps/appspec.js +2 -0
- package/lib/apps/apps/checks.js +10 -6
- package/lib/examples/PapSignInDisplayExample.d.ts +4 -0
- package/lib/examples/PapSignInDisplayExample.js +23 -0
- package/lib/examples/example-selector.js +1 -0
- package/lib/examples/index.d.ts +1 -0
- package/lib/examples/index.js +1 -0
- package/lib/examples/main.js +2 -0
- package/lib/examples/pap/PapSignInDisplayView.d.ts +15 -0
- package/lib/examples/pap/PapSignInDisplayView.js +49 -0
- package/lib/examples/pap/PapTraceView.d.ts +2 -3
- package/lib/examples/pap/PapTraceView.js +3 -4
- package/lib/examples/pap/papSignInCases.d.ts +12 -0
- package/lib/examples/pap/papSignInCases.js +88 -0
- package/lib/protocols/a2a/index.d.ts +52 -0
- package/lib/protocols/a2a/index.js +164 -0
- package/lib/protocols/agentProtocols.d.ts +15 -0
- package/lib/protocols/agentProtocols.js +47 -0
- package/lib/protocols/agentic-commerce/index.d.ts +86 -0
- package/lib/protocols/agentic-commerce/index.js +267 -0
- package/lib/protocols/agentic-commerce/models.d.ts +3292 -0
- package/lib/protocols/agentic-commerce/models.js +10 -0
- package/lib/protocols/commerce.d.ts +42 -0
- package/lib/protocols/commerce.js +47 -0
- package/lib/protocols/core.d.ts +44 -0
- package/lib/protocols/core.js +62 -0
- package/lib/protocols/mcp/index.d.ts +4 -0
- package/lib/protocols/mcp/index.js +37 -0
- package/lib/protocols/pact/index.d.ts +139 -0
- package/lib/protocols/pact/index.js +357 -0
- package/lib/protocols/ucp/index.d.ts +79 -0
- package/lib/protocols/ucp/index.js +277 -0
- package/lib/protocols/web-bot-auth/index.d.ts +161 -0
- package/lib/protocols/web-bot-auth/index.js +427 -0
- package/lib/specs/actions.js +4 -0
- package/lib/specs/apps.d.ts +2 -0
- package/lib/specs/apps.js +481 -0
- package/lib/specs/appspecSchema.js +200 -2
- package/lib/types/agentspecs.d.ts +2 -0
- package/package.json +4 -1
- package/scripts/codegen/generate_agentic_commerce.sh +74 -0
- package/scripts/codegen/generate_apps.py +11 -0
- package/scripts/validate_pap_examples.py +27 -2
|
@@ -855,6 +855,182 @@ export const APPSPEC_SCHEMA = {
|
|
|
855
855
|
title: 'AppPageOutput',
|
|
856
856
|
type: 'object',
|
|
857
857
|
},
|
|
858
|
+
AppPap: {
|
|
859
|
+
additionalProperties: false,
|
|
860
|
+
description: 'Personal Agent Protocol: the companies it works with, and whether it is one.',
|
|
861
|
+
properties: {
|
|
862
|
+
connections: {
|
|
863
|
+
description: 'Companies, as a personal agent',
|
|
864
|
+
items: {
|
|
865
|
+
$ref: '#/$defs/AppPapConnection',
|
|
866
|
+
},
|
|
867
|
+
title: 'Connections',
|
|
868
|
+
type: 'array',
|
|
869
|
+
},
|
|
870
|
+
company: {
|
|
871
|
+
$ref: '#/$defs/AppPapCompany',
|
|
872
|
+
description: 'As a company',
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
title: 'AppPap',
|
|
876
|
+
type: 'object',
|
|
877
|
+
},
|
|
878
|
+
AppPapCompany: {
|
|
879
|
+
additionalProperties: false,
|
|
880
|
+
description: 'The application is a company personal agents work with (PAP_DATALAYER S-01, U-04).',
|
|
881
|
+
properties: {
|
|
882
|
+
enabled: {
|
|
883
|
+
default: false,
|
|
884
|
+
description: 'Whether it publishes itself as a company at Ship',
|
|
885
|
+
title: 'Enabled',
|
|
886
|
+
type: 'boolean',
|
|
887
|
+
},
|
|
888
|
+
signed_out: {
|
|
889
|
+
default: true,
|
|
890
|
+
description: 'Whether a personal agent may ask before signing in',
|
|
891
|
+
title: 'Signed Out',
|
|
892
|
+
type: 'boolean',
|
|
893
|
+
},
|
|
894
|
+
interfaces: {
|
|
895
|
+
description: 'How personal agents reach it',
|
|
896
|
+
items: {
|
|
897
|
+
$ref: '#/$defs/PapInterface',
|
|
898
|
+
},
|
|
899
|
+
title: 'Interfaces',
|
|
900
|
+
type: 'array',
|
|
901
|
+
},
|
|
902
|
+
scopes: {
|
|
903
|
+
description: 'The scopes it offers',
|
|
904
|
+
items: {
|
|
905
|
+
type: 'string',
|
|
906
|
+
},
|
|
907
|
+
title: 'Scopes',
|
|
908
|
+
type: 'array',
|
|
909
|
+
},
|
|
910
|
+
extensions: {
|
|
911
|
+
description: 'Extensions it offers: `operations`',
|
|
912
|
+
items: {
|
|
913
|
+
type: 'string',
|
|
914
|
+
},
|
|
915
|
+
title: 'Extensions',
|
|
916
|
+
type: 'array',
|
|
917
|
+
},
|
|
918
|
+
personal_agents: {
|
|
919
|
+
$ref: '#/$defs/PapAgents',
|
|
920
|
+
default: 'any',
|
|
921
|
+
description: '`any`, or `registered` only',
|
|
922
|
+
},
|
|
923
|
+
registered_agents: {
|
|
924
|
+
description: "The personal agents it accepts when `registered` only: each one's `client_id` URL",
|
|
925
|
+
items: {
|
|
926
|
+
type: 'string',
|
|
927
|
+
},
|
|
928
|
+
title: 'Registered Agents',
|
|
929
|
+
type: 'array',
|
|
930
|
+
},
|
|
931
|
+
operations: {
|
|
932
|
+
description: 'What it does for the person once they confirm (the `operations` extension)',
|
|
933
|
+
items: {
|
|
934
|
+
$ref: '#/$defs/AppPapOperation',
|
|
935
|
+
},
|
|
936
|
+
title: 'Operations',
|
|
937
|
+
type: 'array',
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
title: 'AppPapCompany',
|
|
941
|
+
type: 'object',
|
|
942
|
+
},
|
|
943
|
+
AppPapConnection: {
|
|
944
|
+
additionalProperties: false,
|
|
945
|
+
description: 'A company the application works with as a Personal Agent (PAP_DATALAYER S-01).\n\nThe company is named by its domain, the discovery input, and nothing else:\nits endpoints, issuer and metadata are what discovery verifies and are kept\nby the deployment, never here, and no credential is ever part of a spec.\n`access` and `as` mean what they mean for every connection.',
|
|
946
|
+
properties: {
|
|
947
|
+
id: {
|
|
948
|
+
description: 'Stable within the application: `orders`',
|
|
949
|
+
title: 'Id',
|
|
950
|
+
type: 'string',
|
|
951
|
+
},
|
|
952
|
+
company: {
|
|
953
|
+
description: "The company's domain, as discovery takes it: `example.com`",
|
|
954
|
+
title: 'Company',
|
|
955
|
+
type: 'string',
|
|
956
|
+
},
|
|
957
|
+
access: {
|
|
958
|
+
$ref: '#/$defs/Access',
|
|
959
|
+
default: 'read',
|
|
960
|
+
description: 'How far: `read`, or `write`',
|
|
961
|
+
},
|
|
962
|
+
as: {
|
|
963
|
+
$ref: '#/$defs/ActsAs',
|
|
964
|
+
default: 'user',
|
|
965
|
+
description: 'In whose account: `user` (each person signs in to their own) or `owner`',
|
|
966
|
+
},
|
|
967
|
+
scopes: {
|
|
968
|
+
description: 'The fewest scopes the application needs',
|
|
969
|
+
items: {
|
|
970
|
+
type: 'string',
|
|
971
|
+
},
|
|
972
|
+
title: 'Scopes',
|
|
973
|
+
type: 'array',
|
|
974
|
+
},
|
|
975
|
+
interfaces: {
|
|
976
|
+
description: 'How it reaches the company',
|
|
977
|
+
items: {
|
|
978
|
+
$ref: '#/$defs/PapInterface',
|
|
979
|
+
},
|
|
980
|
+
title: 'Interfaces',
|
|
981
|
+
type: 'array',
|
|
982
|
+
},
|
|
983
|
+
sign_in: {
|
|
984
|
+
description: 'Sign-in modes the application accepts, preferred first',
|
|
985
|
+
items: {
|
|
986
|
+
$ref: '#/$defs/PapSignIn',
|
|
987
|
+
},
|
|
988
|
+
title: 'Sign In',
|
|
989
|
+
type: 'array',
|
|
990
|
+
},
|
|
991
|
+
extensions: {
|
|
992
|
+
description: 'Extensions it uses: `operations`',
|
|
993
|
+
items: {
|
|
994
|
+
type: 'string',
|
|
995
|
+
},
|
|
996
|
+
title: 'Extensions',
|
|
997
|
+
type: 'array',
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
required: ['id', 'company'],
|
|
1001
|
+
title: 'AppPapConnection',
|
|
1002
|
+
type: 'object',
|
|
1003
|
+
},
|
|
1004
|
+
AppPapOperation: {
|
|
1005
|
+
additionalProperties: false,
|
|
1006
|
+
description: "Something a personal agent may ask the application to do for the person,\ndone only once they confirm its exact terms (PAP_DATALAYER B-04, Operations v1).\n\nAsked by a personal agent, the application's agent does not call `tool`:\nthe call is proposed, its arguments the terms, and the person confirms\nthat revision before the tool runs, with those arguments and only once.",
|
|
1007
|
+
properties: {
|
|
1008
|
+
action: {
|
|
1009
|
+
description: "The action's name at this company, e.g. `orders.exchange`",
|
|
1010
|
+
title: 'Action',
|
|
1011
|
+
type: 'string',
|
|
1012
|
+
},
|
|
1013
|
+
tool: {
|
|
1014
|
+
description: "The application's tool that does it, called with the terms",
|
|
1015
|
+
title: 'Tool',
|
|
1016
|
+
type: 'string',
|
|
1017
|
+
},
|
|
1018
|
+
summary: {
|
|
1019
|
+
description: 'What the person is shown, with `{term}` for each term, e.g. `Exchange order {order_id} for size {size}`; never written by the model',
|
|
1020
|
+
title: 'Summary',
|
|
1021
|
+
type: 'string',
|
|
1022
|
+
},
|
|
1023
|
+
user_approval_required: {
|
|
1024
|
+
default: true,
|
|
1025
|
+
description: 'Whether only the person may confirm it, never an approval in advance',
|
|
1026
|
+
title: 'User Approval Required',
|
|
1027
|
+
type: 'boolean',
|
|
1028
|
+
},
|
|
1029
|
+
},
|
|
1030
|
+
required: ['action', 'tool', 'summary'],
|
|
1031
|
+
title: 'AppPapOperation',
|
|
1032
|
+
type: 'object',
|
|
1033
|
+
},
|
|
858
1034
|
AppPermissions: {
|
|
859
1035
|
additionalProperties: false,
|
|
860
1036
|
description: 'What the application may reach beside its connections. Nothing, unless said.',
|
|
@@ -1790,6 +1966,24 @@ export const APPSPEC_SCHEMA = {
|
|
|
1790
1966
|
title: 'Layout',
|
|
1791
1967
|
type: 'string',
|
|
1792
1968
|
},
|
|
1969
|
+
PapAgents: {
|
|
1970
|
+
description: 'Which personal agents a company application accepts.',
|
|
1971
|
+
enum: ['any', 'registered'],
|
|
1972
|
+
title: 'PapAgents',
|
|
1973
|
+
type: 'string',
|
|
1974
|
+
},
|
|
1975
|
+
PapInterface: {
|
|
1976
|
+
description: 'How a Personal Agent Protocol company is reached (PAP §3.1).',
|
|
1977
|
+
enum: ['agent', 'openapi', 'mcp', 'web'],
|
|
1978
|
+
title: 'PapInterface',
|
|
1979
|
+
type: 'string',
|
|
1980
|
+
},
|
|
1981
|
+
PapSignIn: {
|
|
1982
|
+
description: 'How a person signs in at a company, in the order the application prefers.',
|
|
1983
|
+
enum: ['direct', 'device', 'mediated'],
|
|
1984
|
+
title: 'PapSignIn',
|
|
1985
|
+
type: 'string',
|
|
1986
|
+
},
|
|
1793
1987
|
RecordItem: {
|
|
1794
1988
|
description: 'What an application may keep of what it did.',
|
|
1795
1989
|
enum: [
|
|
@@ -1972,6 +2166,10 @@ export const APPSPEC_SCHEMA = {
|
|
|
1972
2166
|
title: 'Connections',
|
|
1973
2167
|
type: 'array',
|
|
1974
2168
|
},
|
|
2169
|
+
pap: {
|
|
2170
|
+
$ref: '#/$defs/AppPap',
|
|
2171
|
+
description: 'Personal Agent Protocol: companies it works with, or being one',
|
|
2172
|
+
},
|
|
1975
2173
|
rules: {
|
|
1976
2174
|
description: 'When it acts alone, and when it asks',
|
|
1977
2175
|
items: {
|
|
@@ -2081,8 +2279,8 @@ export const APPSPEC_SCHEMA = {
|
|
|
2081
2279
|
},
|
|
2082
2280
|
avatar: {
|
|
2083
2281
|
default: '',
|
|
2084
|
-
description: 'Its avatar,
|
|
2085
|
-
pattern: '^\\s*([A-Z][A-Za-z0-9]{0,
|
|
2282
|
+
description: 'Its avatar, as people keep theirs on their profile: `emoji:<emoji>`, or `@datalayer/icons-react:<Name>Icon` for a drawing of the set. Its emoji stands for it when unsaid, and where only text goes',
|
|
2283
|
+
pattern: '^\\s*(emoji:[^\\sA-Za-z0-9]{1,32}|@datalayer/icons-react:[A-Z][A-Za-z0-9]{0,62}Icon)?\\s*$',
|
|
2086
2284
|
title: 'Avatar',
|
|
2087
2285
|
type: 'string',
|
|
2088
2286
|
},
|
|
@@ -458,6 +458,8 @@ export interface AppPapCompanySpec {
|
|
|
458
458
|
extensions: string[];
|
|
459
459
|
/** `any`, or `registered` personal agents only. */
|
|
460
460
|
personalAgents: 'any' | 'registered';
|
|
461
|
+
/** The personal agents it accepts when `registered` only, by `client_id` URL. */
|
|
462
|
+
registeredAgents: string[];
|
|
461
463
|
/**
|
|
462
464
|
* What it does for the person once they confirm (PAP_DATALAYER B-04, the
|
|
463
465
|
* `operations` extension): each action and each tool once.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datalayer/agent-runtimes",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.112",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -227,6 +227,7 @@
|
|
|
227
227
|
"@tailwindcss/vite": "^4.1.13",
|
|
228
228
|
"@tanstack/react-query": "^5.90.6",
|
|
229
229
|
"@toon-format/toon": "^1.3.0",
|
|
230
|
+
"@ucp-js/sdk": "0.5.1",
|
|
230
231
|
"@xyflow/react": "^12.10.0",
|
|
231
232
|
"ai": "7.0.90",
|
|
232
233
|
"ansi-to-html": "^0.7.2",
|
|
@@ -242,6 +243,7 @@
|
|
|
242
243
|
"fuse.js": "^7.0.0",
|
|
243
244
|
"html2canvas": "^1.4.1",
|
|
244
245
|
"input-otp": "^1.4.2",
|
|
246
|
+
"jose": "^6.2.12",
|
|
245
247
|
"jwt-decode": "^2.2.0",
|
|
246
248
|
"localforage": "^1.10.0",
|
|
247
249
|
"lucide-react": "^0.542.0",
|
|
@@ -278,6 +280,7 @@
|
|
|
278
280
|
"uuid": "^13.0.0",
|
|
279
281
|
"validator": "^13.7.0",
|
|
280
282
|
"vaul": "^1.1.2",
|
|
283
|
+
"web-bot-auth": "0.2.0",
|
|
281
284
|
"yaml": "^2.9.0",
|
|
282
285
|
"zod": "^4.1.13",
|
|
283
286
|
"zustand": "^4.4.1"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
# Distributed under the terms of the Modified BSD License.
|
|
4
|
+
#
|
|
5
|
+
# The Agentic Commerce Protocol's checkout models, generated from the
|
|
6
|
+
# specification's JSON Schema (AGENT_PROTOCOLS PR-41), in both languages:
|
|
7
|
+
# agent_runtimes/protocols/agentic_commerce/models.py (datamodel-code-generator 0.34.0)
|
|
8
|
+
# src/protocols/agentic-commerce/models.ts (json-schema-to-typescript 15.0.4)
|
|
9
|
+
#
|
|
10
|
+
# Usage: scripts/codegen/generate_agentic_commerce.sh [VERSION] (default 2026-04-17)
|
|
11
|
+
# Runs in a throwaway directory under ~/.cache; nothing is installed here.
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
VERSION="${1:-2026-04-17}"
|
|
14
|
+
HERE="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
15
|
+
WORK="${HOME}/.cache/agent-runtimes-codegen/agentic-commerce"
|
|
16
|
+
mkdir -p "$WORK"
|
|
17
|
+
if [ ! -d "$WORK/spec" ]; then
|
|
18
|
+
git clone -q --depth 1 https://github.com/agentic-commerce-protocol/agentic-commerce-protocol.git "$WORK/spec"
|
|
19
|
+
fi
|
|
20
|
+
SCHEMA="$WORK/spec/spec/$VERSION/json-schema/schema.agentic_checkout.json"
|
|
21
|
+
[ -f "$SCHEMA" ] || { echo "no schema for $VERSION" >&2; exit 1; }
|
|
22
|
+
[ -d "$WORK/venv" ] || python3 -m venv "$WORK/venv"
|
|
23
|
+
"$WORK/venv/bin/pip" install -q "datamodel-code-generator==0.34.0"
|
|
24
|
+
"$WORK/venv/bin/datamodel-codegen" --input "$SCHEMA" --input-file-type jsonschema \
|
|
25
|
+
--output-model-type pydantic_v2.BaseModel --target-python-version 3.11 \
|
|
26
|
+
--use-standard-collections --use-union-operator --disable-timestamp \
|
|
27
|
+
--output "$WORK/models.py"
|
|
28
|
+
{
|
|
29
|
+
cat <<HEADER
|
|
30
|
+
# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
31
|
+
# Distributed under the terms of the Modified BSD License.
|
|
32
|
+
#
|
|
33
|
+
# GENERATED — do not edit. The Agentic Commerce Protocol $VERSION, its
|
|
34
|
+
# checkout models: datamodel-code-generator 0.34.0 over
|
|
35
|
+
# agentic-commerce-protocol/agentic-commerce-protocol spec/$VERSION/
|
|
36
|
+
# json-schema/schema.agentic_checkout.json (Apache 2.0), with
|
|
37
|
+
# --output-model-type pydantic_v2.BaseModel --target-python-version 3.11
|
|
38
|
+
# --use-standard-collections --use-union-operator --disable-timestamp
|
|
39
|
+
# Regenerate with scripts/codegen/generate_agentic_commerce.sh.
|
|
40
|
+
# ruff: noqa
|
|
41
|
+
|
|
42
|
+
HEADER
|
|
43
|
+
sed '1,/^from __future__/{/^from __future__/!d}' "$WORK/models.py"
|
|
44
|
+
} > "$HERE/agent_runtimes/protocols/agentic_commerce/models.py"
|
|
45
|
+
( cd "$WORK" && [ -d node_modules/json-schema-to-typescript ] || npm i -s --no-audit --no-fund json-schema-to-typescript@15.0.4 )
|
|
46
|
+
cat > "$WORK/gen.mjs" <<'JS'
|
|
47
|
+
import { compile } from 'json-schema-to-typescript';
|
|
48
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
49
|
+
const schema = JSON.parse(readFileSync(process.argv[2], 'utf8'));
|
|
50
|
+
const root = { ...schema, type: 'object', properties: Object.fromEntries(Object.keys(schema.$defs).map(k => [k, { $ref: `#/$defs/${k}` }])), additionalProperties: false };
|
|
51
|
+
const ts = await compile(root, 'AgenticCheckout', { bannerComment: '', unreachableDefinitions: true, additionalProperties: false, strictIndexSignatures: true });
|
|
52
|
+
writeFileSync(process.argv[3], ts);
|
|
53
|
+
JS
|
|
54
|
+
( cd "$WORK" && node gen.mjs "$SCHEMA" "$WORK/models.ts" )
|
|
55
|
+
{
|
|
56
|
+
cat <<HEADER
|
|
57
|
+
/*
|
|
58
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
59
|
+
* Distributed under the terms of the Modified BSD License.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/* eslint-disable */
|
|
63
|
+
// GENERATED — do not edit. The Agentic Commerce Protocol $VERSION, its checkout
|
|
64
|
+
// types: json-schema-to-typescript 15.0.4 over
|
|
65
|
+
// agentic-commerce-protocol/agentic-commerce-protocol spec/$VERSION/json-schema/
|
|
66
|
+
// schema.agentic_checkout.json (Apache 2.0). Regenerate with
|
|
67
|
+
// scripts/codegen/generate_agentic_commerce.sh.
|
|
68
|
+
|
|
69
|
+
export const AGENTIC_COMMERCE_VERSION = '$VERSION';
|
|
70
|
+
|
|
71
|
+
HEADER
|
|
72
|
+
cat "$WORK/models.ts"
|
|
73
|
+
} > "$HERE/src/protocols/agentic-commerce/models.ts"
|
|
74
|
+
echo "generated $VERSION"
|
|
@@ -56,6 +56,12 @@ CAMEL = {
|
|
|
56
56
|
"character_alone": "characterAlone",
|
|
57
57
|
"settings_ui": "settingsUi",
|
|
58
58
|
"custom_components": "customComponents",
|
|
59
|
+
# Personal Agent Protocol (pap.connections[], pap.company, its operations).
|
|
60
|
+
"sign_in": "signIn",
|
|
61
|
+
"signed_out": "signedOut",
|
|
62
|
+
"personal_agents": "personalAgents",
|
|
63
|
+
"registered_agents": "registeredAgents",
|
|
64
|
+
"user_approval_required": "userApprovalRequired",
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
#: The keys whose value is carried as it is written: a component tree, weights
|
|
@@ -143,6 +149,11 @@ def load_specs(specs_dir: Path) -> tuple[list[dict[str, Any]], dict[str, Any]]:
|
|
|
143
149
|
# Components of its own: said only when it has some.
|
|
144
150
|
if not spec["interface"].get("custom_components"):
|
|
145
151
|
spec["interface"].pop("custom_components", None)
|
|
152
|
+
# Personal Agent Protocol only when the application says something of it:
|
|
153
|
+
# an Appspec that does not mention `pap` reads back with none (the TypeScript
|
|
154
|
+
# reader's rule), so the catalogue leaves the defaults out too.
|
|
155
|
+
if "pap" in spec and spec["pap"] == type(app.pap)().model_dump(mode="json", by_alias=True):
|
|
156
|
+
spec.pop("pap")
|
|
146
157
|
for key in ("description", "instructions", "goal"):
|
|
147
158
|
spec[key] = _flat(spec.get(key))
|
|
148
159
|
spec["interface"]["welcome"] = _flat(spec["interface"].get("welcome"))
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# Copyright (c) 2025-2026 Datalayer, Inc.
|
|
2
2
|
# Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
|
-
"""Build every Agent Runtimes PAP example and reject duplicate identifiers.
|
|
4
|
+
"""Build every Agent Runtimes PAP example, run its read tools, and reject duplicate identifiers.
|
|
5
|
+
|
|
6
|
+
Each example's argument-free ``read`` tool is run once: the demo worlds are in
|
|
7
|
+
process, with no network and no model. An application that is a company
|
|
8
|
+
(``pap.company``) must declare each operation on a tool of its own.
|
|
9
|
+
"""
|
|
5
10
|
|
|
6
11
|
from __future__ import annotations
|
|
7
12
|
|
|
13
|
+
import asyncio
|
|
14
|
+
import json
|
|
8
15
|
import sys
|
|
9
16
|
from pathlib import Path
|
|
10
17
|
|
|
@@ -51,9 +58,27 @@ def main() -> int:
|
|
|
51
58
|
raise RuntimeError(
|
|
52
59
|
f"Host-only PAP values exposed by {app_id}/{tool.name}: {names}"
|
|
53
60
|
)
|
|
61
|
+
declared = {tool.name for tool in built.application.spec.tools}
|
|
62
|
+
for operation in built.application.spec.pap.company.operations:
|
|
63
|
+
if operation.tool not in declared:
|
|
64
|
+
raise RuntimeError(
|
|
65
|
+
f"{app_id} declares {operation.action} on {operation.tool}, "
|
|
66
|
+
"which is not one of its tools"
|
|
67
|
+
)
|
|
68
|
+
ran = 0
|
|
69
|
+
handlers = built.application.tools
|
|
70
|
+
for tool in built.application.spec.tools:
|
|
71
|
+
if tool.does != ["read"] or tool.parameters.get("required"):
|
|
72
|
+
continue
|
|
73
|
+
result = asyncio.run(handlers[tool.name]())
|
|
74
|
+
if not isinstance(result, dict):
|
|
75
|
+
raise RuntimeError(f"{app_id}/{tool.name} returned {type(result)!r}")
|
|
76
|
+
json.dumps(result)
|
|
77
|
+
ran += 1
|
|
78
|
+
count = len(built.application.spec.tools)
|
|
54
79
|
sys.stdout.write(
|
|
55
80
|
f"{path.relative_to(ROOT)}: {app_id} "
|
|
56
|
-
f"({
|
|
81
|
+
f"({count} tool{'s' if count != 1 else ''}, {ran} run)\n"
|
|
57
82
|
)
|
|
58
83
|
return 0
|
|
59
84
|
|