@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.
- 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/inspector/a2aSpans.d.ts +7 -0
- package/lib/components/inspector/a2aSpans.js +34 -2
- package/lib/components/inspector/agentSpans.d.ts +1 -1
- package/lib/components/inspector/agentSpans.js +1 -0
- 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
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
import type { AppAccent, AppThemeMode, AppThemeVariant, AppAvatar, AppAvatarId, AppAvatarModel3D, AppEmbedMode, PapProfile, AppCustomComponentSpec, AppVoiceSpec, AppKind, AppLayout, AppPageOutputComponent, AppSpec, UiChoice } from '../../types/agentspecs';
|
|
28
28
|
/** The version of the spec itself. */
|
|
29
29
|
export declare const APP_SCHEMA = "loop.app/v1";
|
|
30
|
-
/** The language an application's own words are in, unless it says
|
|
30
|
+
/** The language an application's own words are in, unless it says. */
|
|
31
31
|
export declare const DEFAULT_LANGUAGE = "en";
|
|
32
32
|
/** The face of an application that has not chosen one. */
|
|
33
33
|
export declare const DEFAULT_EMOJI = "\uD83D\uDC40";
|
|
34
34
|
export declare const APP_KINDS: AppKind[];
|
|
35
35
|
export declare const APP_ACCENTS: AppAccent[];
|
|
36
36
|
/**
|
|
37
|
-
* The themes an application may run in
|
|
37
|
+
* The themes an application may run in: Appearance's, as
|
|
38
38
|
* primer-addons lists them (`themeVariants`), in its order.
|
|
39
39
|
*/
|
|
40
40
|
export declare const APP_THEME_VARIANTS: AppThemeVariant[];
|
|
41
41
|
/** The colour modes a theme is worn in. */
|
|
42
42
|
export declare const APP_THEME_MODES: AppThemeMode[];
|
|
43
|
-
/** The four ways an application sits in another product's page
|
|
43
|
+
/** The four ways an application sits in another product's page. */
|
|
44
44
|
export declare const APP_EMBED_MODES: AppEmbedMode[];
|
|
45
45
|
/**
|
|
46
|
-
* How an Appspec names the avatar of its floating assistant
|
|
46
|
+
* How an Appspec names the avatar of its floating assistant: the
|
|
47
47
|
* id a plugin contributes it under, `paperclip` or `acme-owl` — as
|
|
48
48
|
* agentspecs' `ASSISTANT_AVATAR_ID`. Which ids exist is what the enabled
|
|
49
49
|
* plugins contribute (`assistantCharacterNamed`), not the spec's to say.
|
|
@@ -105,7 +105,7 @@ type Data = Record<string, unknown>;
|
|
|
105
105
|
export declare function retentionDays(keepFor: string): number;
|
|
106
106
|
/** An application with nothing said: what *Start blank* opens. */
|
|
107
107
|
export declare function emptyAppspec(kind?: AppKind): AppSpec;
|
|
108
|
-
/** The Personal Agent Protocol profiles Datalayer speaks, as agentspecs' `PAP_PROFILES
|
|
108
|
+
/** The Personal Agent Protocol profiles Datalayer speaks, as agentspecs' `PAP_PROFILES`. */
|
|
109
109
|
export declare const PAP_PROFILES: readonly PapProfile[];
|
|
110
110
|
/** The profile a `pap` block is written for when the Studio or a builder starts one. */
|
|
111
111
|
export declare const PAP_PROFILE: PapProfile;
|
|
@@ -114,16 +114,16 @@ export declare const PAP_PROFILE: PapProfile;
|
|
|
114
114
|
* (`pap_profile_problem`); `undefined` when it is one Datalayer speaks.
|
|
115
115
|
*/
|
|
116
116
|
export declare function papProfileProblem(value: unknown): string | undefined;
|
|
117
|
-
/** An application's voice
|
|
117
|
+
/** An application's voice: off unless said. */
|
|
118
118
|
export declare const DEFAULT_VOICE: AppVoiceSpec;
|
|
119
|
-
/** What a page's output may be drawn with
|
|
119
|
+
/** What a page's output may be drawn with, and the property of each that shows its value. */
|
|
120
120
|
export declare const PAGE_OUTPUT_SHOWS: Record<AppPageOutputComponent, string>;
|
|
121
|
-
/** The height of a component its developer wrote
|
|
121
|
+
/** The height of a component its developer wrote, unless it says. */
|
|
122
122
|
export declare const DEFAULT_CUSTOM_HEIGHT = 240;
|
|
123
123
|
/**
|
|
124
|
-
* The property a page's output fills with its value
|
|
124
|
+
* The property a page's output fills with its value: a catalog
|
|
125
125
|
* component's (`PAGE_OUTPUT_SHOWS`), or what a component of the
|
|
126
|
-
* application's own shows first
|
|
126
|
+
* application's own shows first. Undefined for any other.
|
|
127
127
|
*/
|
|
128
128
|
export declare function pageOutputShows(component: string, own?: readonly AppCustomComponentSpec[]): string | undefined;
|
|
129
129
|
/** What reading a document gives: the application, and what the document got wrong. */
|
|
@@ -150,8 +150,7 @@ export declare function parseAppspec(document: unknown): ParsedAppspec;
|
|
|
150
150
|
*/
|
|
151
151
|
export declare function uiProblems(app: Pick<AppSpec, 'ui' | 'enabled'>): string[];
|
|
152
152
|
/**
|
|
153
|
-
* What is wrong with the protocols an application says it speaks
|
|
154
|
-
* (PS-02), as agentspecs says it: an id the catalogue does not
|
|
153
|
+
* What is wrong with the protocols an application says it speaks, as agentspecs says it: an id the catalogue does not
|
|
155
154
|
* know or said twice, a planned protocol while it is offered, and a `pap`,
|
|
156
155
|
* `pact`, `a2a` or `signed_fetch` block configuring a protocol it does not list.
|
|
157
156
|
*/
|
package/lib/apps/apps/appspec.js
CHANGED
|
@@ -9,7 +9,7 @@ import { UI_RENDERER_CATALOGUE } from '../../specs/uiRenderers.js';
|
|
|
9
9
|
import { DEFAULT_MAX_FILES, DEFAULT_UPLOAD_MB } from './uploads.js';
|
|
10
10
|
/** The version of the spec itself. */
|
|
11
11
|
export const APP_SCHEMA = 'loop.app/v1';
|
|
12
|
-
/** The language an application's own words are in, unless it says
|
|
12
|
+
/** The language an application's own words are in, unless it says. */
|
|
13
13
|
export const DEFAULT_LANGUAGE = 'en';
|
|
14
14
|
/** The face of an application that has not chosen one. */
|
|
15
15
|
export const DEFAULT_EMOJI = '\u{1F440}';
|
|
@@ -23,7 +23,7 @@ export const APP_ACCENTS = [
|
|
|
23
23
|
'violet',
|
|
24
24
|
];
|
|
25
25
|
/**
|
|
26
|
-
* The themes an application may run in
|
|
26
|
+
* The themes an application may run in: Appearance's, as
|
|
27
27
|
* primer-addons lists them (`themeVariants`), in its order.
|
|
28
28
|
*/
|
|
29
29
|
export const APP_THEME_VARIANTS = [
|
|
@@ -40,7 +40,7 @@ export const APP_THEME_VARIANTS = [
|
|
|
40
40
|
];
|
|
41
41
|
/** The colour modes a theme is worn in. */
|
|
42
42
|
export const APP_THEME_MODES = ['light', 'dark', 'auto'];
|
|
43
|
-
/** The four ways an application sits in another product's page
|
|
43
|
+
/** The four ways an application sits in another product's page. */
|
|
44
44
|
export const APP_EMBED_MODES = [
|
|
45
45
|
'inline',
|
|
46
46
|
'bubble',
|
|
@@ -48,7 +48,7 @@ export const APP_EMBED_MODES = [
|
|
|
48
48
|
'assistant',
|
|
49
49
|
];
|
|
50
50
|
/**
|
|
51
|
-
* How an Appspec names the avatar of its floating assistant
|
|
51
|
+
* How an Appspec names the avatar of its floating assistant: the
|
|
52
52
|
* id a plugin contributes it under, `paperclip` or `acme-owl` — as
|
|
53
53
|
* agentspecs' `ASSISTANT_AVATAR_ID`. Which ids exist is what the enabled
|
|
54
54
|
* plugins contribute (`assistantCharacterNamed`), not the spec's to say.
|
|
@@ -188,7 +188,7 @@ const uiShapeProblems = (value) => Array.isArray(value)
|
|
|
188
188
|
: '.'))
|
|
189
189
|
: [];
|
|
190
190
|
/**
|
|
191
|
-
* One turn of a test's conversation as its document says it
|
|
191
|
+
* One turn of a test's conversation as its document says it:
|
|
192
192
|
* what it says, chooses or presses, with a press's payload; nothing it does
|
|
193
193
|
* not say.
|
|
194
194
|
*/
|
|
@@ -327,9 +327,9 @@ const KNOWN_KEYS = [
|
|
|
327
327
|
'avatar',
|
|
328
328
|
'banner',
|
|
329
329
|
];
|
|
330
|
-
/** Where a check of its code runs
|
|
330
|
+
/** Where a check of its code runs. */
|
|
331
331
|
const CHECK_STAGES = ['answer', 'tool_call'];
|
|
332
|
-
/** A tool of its own, written in its code
|
|
332
|
+
/** A tool of its own, written in its code; a wrong one is said by the checks. */
|
|
333
333
|
function parseTool(data) {
|
|
334
334
|
return {
|
|
335
335
|
name: text(data.name),
|
|
@@ -348,7 +348,7 @@ function parseConnection(data) {
|
|
|
348
348
|
only: texts(data.only),
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
/** The Personal Agent Protocol profiles Datalayer speaks, as agentspecs' `PAP_PROFILES
|
|
351
|
+
/** The Personal Agent Protocol profiles Datalayer speaks, as agentspecs' `PAP_PROFILES`. */
|
|
352
352
|
export const PAP_PROFILES = ['draft-01'];
|
|
353
353
|
/** The profile a `pap` block is written for when the Studio or a builder starts one. */
|
|
354
354
|
export const PAP_PROFILE = PAP_PROFILES[PAP_PROFILES.length - 1];
|
|
@@ -376,7 +376,7 @@ const enumsOf = (value, allowed, otherwise) => {
|
|
|
376
376
|
return value.filter((item) => allowed.includes(item));
|
|
377
377
|
};
|
|
378
378
|
/**
|
|
379
|
-
* Personal Agent Protocol
|
|
379
|
+
* Personal Agent Protocol: the companies the
|
|
380
380
|
* application works with, and whether it is one. Defaults are agentspecs'.
|
|
381
381
|
*/
|
|
382
382
|
function parsePap(data) {
|
|
@@ -410,11 +410,7 @@ function parsePap(data) {
|
|
|
410
410
|
operations: records(company.operations).map(operation => ({
|
|
411
411
|
action: text(operation.action),
|
|
412
412
|
tool: text(operation.tool),
|
|
413
|
-
...(isData(operation.allows)
|
|
414
|
-
? { allows: parsePapStanding(operation.allows) }
|
|
415
|
-
: {}),
|
|
416
413
|
summary: text(operation.summary),
|
|
417
|
-
userApprovalRequired: flag(operation.user_approval_required, true),
|
|
418
414
|
})),
|
|
419
415
|
},
|
|
420
416
|
};
|
|
@@ -490,38 +486,6 @@ function dumpPapExcludedTask(task) {
|
|
|
490
486
|
: {}),
|
|
491
487
|
};
|
|
492
488
|
}
|
|
493
|
-
/** A standing permission an operation gives (R-07), as agentspecs reads it. */
|
|
494
|
-
function parsePapStanding(data) {
|
|
495
|
-
return {
|
|
496
|
-
connection: text(data.connection),
|
|
497
|
-
action: oneOf(data.action, ['write', 'buy'], 'buy'),
|
|
498
|
-
limits: records(data.limits).map(limit => ({
|
|
499
|
-
path: text(limit.path),
|
|
500
|
-
...(typeof limit.maximum === 'string'
|
|
501
|
-
? { maximum: text(limit.maximum) }
|
|
502
|
-
: {}),
|
|
503
|
-
...(typeof limit.allowed === 'string'
|
|
504
|
-
? { allowed: text(limit.allowed) }
|
|
505
|
-
: {}),
|
|
506
|
-
})),
|
|
507
|
-
uses: text(data.uses),
|
|
508
|
-
days: text(data.days),
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
|
-
/** A standing permission as its document says it: every field, none has a default. */
|
|
512
|
-
function dumpPapStanding(standing) {
|
|
513
|
-
return {
|
|
514
|
-
connection: standing.connection,
|
|
515
|
-
action: standing.action,
|
|
516
|
-
limits: standing.limits.map(limit => ({
|
|
517
|
-
path: limit.path,
|
|
518
|
-
...(limit.maximum !== undefined ? { maximum: limit.maximum } : {}),
|
|
519
|
-
...(limit.allowed !== undefined ? { allowed: limit.allowed } : {}),
|
|
520
|
-
})),
|
|
521
|
-
uses: standing.uses,
|
|
522
|
-
days: standing.days,
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
489
|
/** Personal Agent Protocol as its document says it, nothing at its default. */
|
|
526
490
|
function dumpPap(pap) {
|
|
527
491
|
if (!pap)
|
|
@@ -550,15 +514,10 @@ function dumpPap(pap) {
|
|
|
550
514
|
.list('registered_agents', pap.company.registeredAgents)
|
|
551
515
|
.list('operations', pap.company.operations.map(operation => new Writer()
|
|
552
516
|
.text('action', operation.action, '\u0000')
|
|
553
|
-
|
|
554
|
-
.text('
|
|
555
|
-
.present('allows', operation.allows
|
|
556
|
-
? dumpPapStanding(operation.allows)
|
|
557
|
-
: undefined)
|
|
558
|
-
.text('summary', operation.summary, '\u0000')
|
|
559
|
-
.value('user_approval_required', operation.userApprovalRequired, true).data)).data).data;
|
|
517
|
+
.text('tool', operation.tool, '\u0000')
|
|
518
|
+
.text('summary', operation.summary, '\u0000').data)).data).data;
|
|
560
519
|
}
|
|
561
|
-
/** PACT
|
|
520
|
+
/** PACT: the businesses it asks for each person, and as one. */
|
|
562
521
|
function parsePact(data) {
|
|
563
522
|
const business = isData(data.business) ? data.business : {};
|
|
564
523
|
const scopes = {};
|
|
@@ -586,7 +545,7 @@ function parsePact(data) {
|
|
|
586
545
|
},
|
|
587
546
|
};
|
|
588
547
|
}
|
|
589
|
-
/** Commerce
|
|
548
|
+
/** Commerce: the merchants it shops at for each person. */
|
|
590
549
|
function parseCommerce(data) {
|
|
591
550
|
return {
|
|
592
551
|
merchants: records(data.merchants).map(merchant => ({
|
|
@@ -621,7 +580,7 @@ function dumpCommerce(commerce) {
|
|
|
621
580
|
}
|
|
622
581
|
: {}).data)).data;
|
|
623
582
|
}
|
|
624
|
-
/** Signed fetch
|
|
583
|
+
/** Signed fetch: the exact sites it reads pages of, each request signed. */
|
|
625
584
|
function parseSignedFetch(data) {
|
|
626
585
|
return {
|
|
627
586
|
sites: records(data.sites).map(site => ({
|
|
@@ -638,7 +597,7 @@ function dumpSignedFetch(signedFetch) {
|
|
|
638
597
|
.text('id', site.id, '\u0000')
|
|
639
598
|
.text('site', site.site, '\u0000').data)).data;
|
|
640
599
|
}
|
|
641
|
-
/** One of a pair of examples
|
|
600
|
+
/** One of a pair of examples: its id and its side, or a problem. */
|
|
642
601
|
function parsePair(data) {
|
|
643
602
|
const id = text(data.id);
|
|
644
603
|
const role = text(data.role);
|
|
@@ -675,7 +634,7 @@ function dumpPact(pact) {
|
|
|
675
634
|
.text('issuer', agent.issuer, '\u0000')
|
|
676
635
|
.text('jwks_uri', agent.jwksUri, '\u0000').data)).data).data;
|
|
677
636
|
}
|
|
678
|
-
/** A2A
|
|
637
|
+
/** A2A: the extensions its Agent Card advertises. */
|
|
679
638
|
function parseA2A(data) {
|
|
680
639
|
return {
|
|
681
640
|
extensions: records(data.extensions).map(extension => ({
|
|
@@ -705,8 +664,8 @@ function parseRule(data) {
|
|
|
705
664
|
behaviour: oneOf(data.behaviour, BEHAVIOURS, 'ask_first'),
|
|
706
665
|
};
|
|
707
666
|
}
|
|
708
|
-
/** A slash command
|
|
709
|
-
/** An action of its code, typed
|
|
667
|
+
/** A slash command; a wrong one is said by the checks. */
|
|
668
|
+
/** An action of its code, typed: its payload's schema kept as written. */
|
|
710
669
|
function parseAction(data) {
|
|
711
670
|
const action = { name: text(data.name) };
|
|
712
671
|
if (text(data.description)) {
|
|
@@ -737,7 +696,7 @@ function parseModeOption(data) {
|
|
|
737
696
|
}
|
|
738
697
|
return option;
|
|
739
698
|
}
|
|
740
|
-
/** A mode switch
|
|
699
|
+
/** A mode switch. */
|
|
741
700
|
function parseMode(data) {
|
|
742
701
|
const mode = {
|
|
743
702
|
id: text(data.id),
|
|
@@ -749,7 +708,7 @@ function parseMode(data) {
|
|
|
749
708
|
}
|
|
750
709
|
return mode;
|
|
751
710
|
}
|
|
752
|
-
/** A starter, its category said only when it has one
|
|
711
|
+
/** A starter, its category said only when it has one. */
|
|
753
712
|
function parseStarter(data) {
|
|
754
713
|
const starter = {
|
|
755
714
|
label: text(data.label),
|
|
@@ -760,7 +719,7 @@ function parseStarter(data) {
|
|
|
760
719
|
}
|
|
761
720
|
return starter;
|
|
762
721
|
}
|
|
763
|
-
/** One of several assistants in one application
|
|
722
|
+
/** One of several assistants in one application. */
|
|
764
723
|
function parseProfile(data) {
|
|
765
724
|
return {
|
|
766
725
|
id: text(data.id),
|
|
@@ -780,7 +739,7 @@ function recordsBy(value) {
|
|
|
780
739
|
return Object.fromEntries(Object.entries(isData(value) ? value : {}).filter((entry) => isData(entry[1])));
|
|
781
740
|
}
|
|
782
741
|
const mapValues = (value, map) => Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)]));
|
|
783
|
-
/** An application's words in one other language
|
|
742
|
+
/** An application's words in one other language, every key present. */
|
|
784
743
|
function parseTranslation(data) {
|
|
785
744
|
return {
|
|
786
745
|
name: text(data.name),
|
|
@@ -819,7 +778,7 @@ function parseSurface(data) {
|
|
|
819
778
|
composedAt: text(data.composed_at),
|
|
820
779
|
};
|
|
821
780
|
}
|
|
822
|
-
/** An application's voice
|
|
781
|
+
/** An application's voice: off unless said. */
|
|
823
782
|
export const DEFAULT_VOICE = {
|
|
824
783
|
enabled: false,
|
|
825
784
|
input: 'push_to_talk',
|
|
@@ -839,7 +798,7 @@ function parseVoice(data) {
|
|
|
839
798
|
where: oneOf(voice.where, ['auto', 'device', 'server'], DEFAULT_VOICE.where),
|
|
840
799
|
};
|
|
841
800
|
}
|
|
842
|
-
/** What a person may send without being asked
|
|
801
|
+
/** What a person may send without being asked, as the spec says it. */
|
|
843
802
|
function parseUploads(data) {
|
|
844
803
|
return {
|
|
845
804
|
kinds: records(data.kinds).map(kind => ({
|
|
@@ -849,17 +808,17 @@ function parseUploads(data) {
|
|
|
849
808
|
maxFiles: numberOf(data.max_files, DEFAULT_MAX_FILES),
|
|
850
809
|
};
|
|
851
810
|
}
|
|
852
|
-
/** What a page's output may be drawn with
|
|
811
|
+
/** What a page's output may be drawn with, and the property of each that shows its value. */
|
|
853
812
|
export const PAGE_OUTPUT_SHOWS = {
|
|
854
813
|
Text: 'text',
|
|
855
814
|
Image: 'url',
|
|
856
815
|
Table: 'rows',
|
|
857
816
|
Chart: 'points',
|
|
858
817
|
};
|
|
859
|
-
/** The height of a component its developer wrote
|
|
818
|
+
/** The height of a component its developer wrote, unless it says. */
|
|
860
819
|
export const DEFAULT_CUSTOM_HEIGHT = 240;
|
|
861
820
|
/**
|
|
862
|
-
* A component its developer wrote
|
|
821
|
+
* A component its developer wrote, as written: its schema and
|
|
863
822
|
* example kept whole, so that the checks say what is wrong with them.
|
|
864
823
|
*/
|
|
865
824
|
function parseCustomComponent(data) {
|
|
@@ -897,9 +856,9 @@ function dumpCustomComponent(component) {
|
|
|
897
856
|
return written.data;
|
|
898
857
|
}
|
|
899
858
|
/**
|
|
900
|
-
* The property a page's output fills with its value
|
|
859
|
+
* The property a page's output fills with its value: a catalog
|
|
901
860
|
* component's (`PAGE_OUTPUT_SHOWS`), or what a component of the
|
|
902
|
-
* application's own shows first
|
|
861
|
+
* application's own shows first. Undefined for any other.
|
|
903
862
|
*/
|
|
904
863
|
export function pageOutputShows(component, own = []) {
|
|
905
864
|
if (component in PAGE_OUTPUT_SHOWS) {
|
|
@@ -908,7 +867,7 @@ export function pageOutputShows(component, own = []) {
|
|
|
908
867
|
return own.find(each => each.name === component)?.shows[0];
|
|
909
868
|
}
|
|
910
869
|
/**
|
|
911
|
-
* A widget's page written in its code
|
|
870
|
+
* A widget's page written in its code, as written: its inputs a form
|
|
912
871
|
* kept whole, an output drawn with another component kept as written so that
|
|
913
872
|
* the checks say it.
|
|
914
873
|
*/
|
|
@@ -966,13 +925,13 @@ function parseInterface(data, kind) {
|
|
|
966
925
|
voice: parseVoice(data.voice),
|
|
967
926
|
outputs: texts(data.outputs),
|
|
968
927
|
};
|
|
969
|
-
// Its settings are the JSON Schema of a form
|
|
928
|
+
// Its settings are the JSON Schema of a form, kept as written: what
|
|
970
929
|
// is not one — the list of settings of earlier versions among it — is not
|
|
971
930
|
// read, and is said by the checks.
|
|
972
931
|
if (isData(data.settings)) {
|
|
973
932
|
parsed.settings = JSON.parse(JSON.stringify(data.settings));
|
|
974
933
|
}
|
|
975
|
-
// How its settings' fields are drawn
|
|
934
|
+
// How its settings' fields are drawn, kept as written: a wrong
|
|
976
935
|
// widget is said by the checks.
|
|
977
936
|
if (isData(data.settings_ui)) {
|
|
978
937
|
parsed.settingsUi = JSON.parse(JSON.stringify(data.settings_ui));
|
|
@@ -980,7 +939,7 @@ function parseInterface(data, kind) {
|
|
|
980
939
|
if (isData(data.uploads)) {
|
|
981
940
|
parsed.uploads = parseUploads(data.uploads);
|
|
982
941
|
}
|
|
983
|
-
// Components its developer wrote
|
|
942
|
+
// Components its developer wrote: absent when it has none.
|
|
984
943
|
if (Array.isArray(data.custom_components)) {
|
|
985
944
|
parsed.customComponents = records(data.custom_components).map(parseCustomComponent);
|
|
986
945
|
}
|
|
@@ -1035,7 +994,7 @@ function parseDecision(data) {
|
|
|
1035
994
|
decisionModel: text(data.decision_model),
|
|
1036
995
|
};
|
|
1037
996
|
}
|
|
1038
|
-
/** What it is tried on before it is anybody's
|
|
997
|
+
/** What it is tried on before it is anybody's: read only. */
|
|
1039
998
|
function parseSamples(data) {
|
|
1040
999
|
return {
|
|
1041
1000
|
documents: records(data.documents).map(document => ({
|
|
@@ -1068,7 +1027,7 @@ function parseDeployment(data) {
|
|
|
1068
1027
|
host: {
|
|
1069
1028
|
context: texts(data.embedded.host.context),
|
|
1070
1029
|
// Kept as written when said: a value that is none is refused
|
|
1071
|
-
// by the checks, never read as `claimed
|
|
1030
|
+
// by the checks, never read as `claimed`.
|
|
1072
1031
|
...(data.embedded.host.user !== undefined
|
|
1073
1032
|
? { user: text(data.embedded.host.user) }
|
|
1074
1033
|
: {}),
|
|
@@ -1136,7 +1095,7 @@ export function parseAppspec(document) {
|
|
|
1136
1095
|
const verified = isData(tests.verified) ? tests.verified : {};
|
|
1137
1096
|
const record = isData(data.record) ? data.record : {};
|
|
1138
1097
|
const checks = isData(data.checks) ? data.checks : {};
|
|
1139
|
-
// A check of its code runs on an answer or a tool call
|
|
1098
|
+
// A check of its code runs on an answer or a tool call.
|
|
1140
1099
|
for (const check of records(checks.code)) {
|
|
1141
1100
|
if (!CHECK_STAGES.includes(check.on)) {
|
|
1142
1101
|
problems.push(`The check \`${text(check.name)}\` of its code runs on answer or tool_call, not \`${String(check.on)}\`.`);
|
|
@@ -1194,12 +1153,12 @@ export function parseAppspec(document) {
|
|
|
1194
1153
|
evalset: text(tests.evalset),
|
|
1195
1154
|
cases: records(tests.cases).map(testCase => ({
|
|
1196
1155
|
ask: text(testCase.ask),
|
|
1197
|
-
// A conversation, turn by turn, when it is one
|
|
1156
|
+
// A conversation, turn by turn, when it is one.
|
|
1198
1157
|
...(records(testCase.turns).length
|
|
1199
1158
|
? { turns: records(testCase.turns).map(parseTestTurn) }
|
|
1200
1159
|
: {}),
|
|
1201
1160
|
expect: text(testCase.expect),
|
|
1202
|
-
// Decided by its code
|
|
1161
|
+
// Decided by its code, when it names the function.
|
|
1203
1162
|
...(text(testCase.code) ? { code: text(testCase.code) } : {}),
|
|
1204
1163
|
// Given files with what it is asked, when it is.
|
|
1205
1164
|
...(records(testCase.files).length
|
|
@@ -1253,7 +1212,7 @@ export function parseAppspec(document) {
|
|
|
1253
1212
|
app.decision = parseDecision(data.decision);
|
|
1254
1213
|
}
|
|
1255
1214
|
// A `pap` block names a profile Datalayer speaks, or it is refused and not
|
|
1256
|
-
// read
|
|
1215
|
+
// read; a block saying nothing is no block.
|
|
1257
1216
|
if (isData(data.pap) && Object.keys(data.pap).length > 0) {
|
|
1258
1217
|
const problem = papProfileProblem(data.pap.profile);
|
|
1259
1218
|
if (problem) {
|
|
@@ -1332,8 +1291,7 @@ export function uiProblems(app) {
|
|
|
1332
1291
|
return problems;
|
|
1333
1292
|
}
|
|
1334
1293
|
/**
|
|
1335
|
-
* What is wrong with the protocols an application says it speaks
|
|
1336
|
-
* (PS-02), as agentspecs says it: an id the catalogue does not
|
|
1294
|
+
* What is wrong with the protocols an application says it speaks, as agentspecs says it: an id the catalogue does not
|
|
1337
1295
|
* know or said twice, a planned protocol while it is offered, and a `pap`,
|
|
1338
1296
|
* `pact`, `a2a` or `signed_fetch` block configuring a protocol it does not list.
|
|
1339
1297
|
*/
|
|
@@ -1445,7 +1403,7 @@ function dumpStarter(starter) {
|
|
|
1445
1403
|
}
|
|
1446
1404
|
/** Words by key, what is empty left out. */
|
|
1447
1405
|
const saidWords = (words) => Object.fromEntries(Object.entries(words).filter(([, said]) => said !== ''));
|
|
1448
|
-
/** One translation as it is written
|
|
1406
|
+
/** One translation as it is written: only what it says. */
|
|
1449
1407
|
function dumpTranslation(words) {
|
|
1450
1408
|
const parts = (value, dump) => Object.fromEntries(Object.entries(value).map(([key, item]) => [key, dump(item)]));
|
|
1451
1409
|
return new Writer()
|
|
@@ -1512,14 +1470,14 @@ function dumpInterface(spec, kind) {
|
|
|
1512
1470
|
.text('model', profile.model ?? '')
|
|
1513
1471
|
.list('starters', profile.starters.map(dumpStarter)).data))
|
|
1514
1472
|
.part('settings', spec.settings ? { ...spec.settings } : {});
|
|
1515
|
-
// How its settings' fields are drawn
|
|
1473
|
+
// How its settings' fields are drawn: written when said.
|
|
1516
1474
|
if (spec.settingsUi) {
|
|
1517
1475
|
writer.data.settings_ui = { ...spec.settingsUi };
|
|
1518
1476
|
}
|
|
1519
1477
|
writer
|
|
1520
1478
|
.text('language', spec.language ?? DEFAULT_LANGUAGE, DEFAULT_LANGUAGE)
|
|
1521
1479
|
.part('translations', mapValues(spec.translations ?? {}, dumpTranslation));
|
|
1522
|
-
// What a person may send without being asked
|
|
1480
|
+
// What a person may send without being asked: written when said.
|
|
1523
1481
|
if (spec.uploads) {
|
|
1524
1482
|
writer.data.uploads = new Writer()
|
|
1525
1483
|
.list('kinds', spec.uploads.kinds.map(kind => new Writer()
|
|
@@ -1547,7 +1505,7 @@ function dumpInterface(spec, kind) {
|
|
|
1547
1505
|
? { variant: spec.theme.variant, mode: spec.theme.mode }
|
|
1548
1506
|
: { variant: spec.theme.variant };
|
|
1549
1507
|
}
|
|
1550
|
-
// Its voice, when it says one
|
|
1508
|
+
// Its voice, when it says one: a spec made before voice has none.
|
|
1551
1509
|
if (spec.voice) {
|
|
1552
1510
|
writer.part('voice', new Writer()
|
|
1553
1511
|
.value('enabled', spec.voice.enabled, DEFAULT_VOICE.enabled)
|
|
@@ -1672,7 +1630,7 @@ export function dumpAppspec(app) {
|
|
|
1672
1630
|
.value('ready_at', app.tests.readyAt, DEFAULT_READY_AT)
|
|
1673
1631
|
.text('evalset', app.tests.evalset)
|
|
1674
1632
|
.list('cases', app.tests.cases.map(testCase => ({
|
|
1675
|
-
// One message, or a conversation in its place
|
|
1633
|
+
// One message, or a conversation in its place.
|
|
1676
1634
|
...(testCase.turns?.length
|
|
1677
1635
|
? {
|
|
1678
1636
|
turns: testCase.turns.map(turn => parseTestTurn({ ...turn })),
|
|
@@ -46,7 +46,7 @@ export function ToolApprovalCard({ approval, onApprove, onReject, onToggleRead,
|
|
|
46
46
|
return (
|
|
47
47
|
// primer-addons' Card, as the other pages' rows: an unread request is the
|
|
48
48
|
// selected one (an accent border on an accent wash).
|
|
49
|
-
_jsx(Card, { border: true, shadow: "none", display: "block", p: 3, selected: !isRead, children: _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [_jsxs(Box, { flex: 1, minWidth: 0, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 1, flexWrap: "wrap", children: [_jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: approval.toolName }), _jsx(Label, { variant: statusConfig.variant, children: statusConfig.label }), _jsx(Label, { variant: riskConfig.variant, children: riskConfig.label }), !isRead && _jsx(Label, { variant: "accent", children: "Unread" })] }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: ["Requested by ", approval.requestedBy, ' ', formatRelativeTime(approval.requestedAt), reviewSummary] }), _jsx(
|
|
49
|
+
_jsx(Card, { border: true, shadow: "none", display: "block", p: 3, selected: !isRead, children: _jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [_jsxs(Box, { flex: 1, minWidth: 0, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 2, mb: 1, flexWrap: "wrap", children: [_jsx(Text, { sx: { fontWeight: 'bold', fontSize: 2 }, children: approval.toolName }), _jsx(Label, { variant: statusConfig.variant, children: statusConfig.label }), _jsx(Label, { variant: riskConfig.variant, children: riskConfig.label }), !isRead && _jsx(Label, { variant: "accent", children: "Unread" })] }), _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 0, display: 'block' }, children: ["Requested by ", approval.requestedBy, ' ', formatRelativeTime(approval.requestedAt), reviewSummary] }), _jsx(Card, { border: true, shadow: "none", variant: "accent", display: "block", mt: 2, width: "100%", p: 2, children: _jsxs("details", { open: isDetailsExpanded, children: [_jsx("summary", { onClick: e => {
|
|
50
50
|
e.preventDefault();
|
|
51
51
|
setIsDetailsExpanded(prev => !prev);
|
|
52
52
|
}, style: {
|
|
@@ -54,6 +54,8 @@ export function ToolApprovalCard({ approval, onApprove, onReject, onToggleRead,
|
|
|
54
54
|
display: 'flex',
|
|
55
55
|
alignItems: 'center',
|
|
56
56
|
minWidth: 0,
|
|
57
|
-
}, children: _jsxs(Box, { display: "flex", alignItems: "center", gap: 1, children: [_jsx(Box, { display: "flex", alignItems: "center", color: "fg.muted", transition: "transform 0.15s ease", transform: isDetailsExpanded ? 'rotate(180deg)' : 'rotate(0deg)', children: _jsx(ChevronDownIcon, { size: 12 }) }), _jsx(Text, { sx: { fontSize: 0, fontWeight: 'semibold' }, children: "View details" })] }) }), _jsxs(Box, { mt: 2, display: "grid", gap: 1, children: [_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Source:", ' '] }), _jsxs(Text, { as: "span", sx: detailValueSx, children: [approval.sourceName, " (", approval.sourceType, ")"] })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Request ID:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.id })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Requested at:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: new Date(approval.requestedAt).toLocaleString() })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Requested by:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.requestedBy })] }), approval.reviewedAt && (_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Reviewed at:", ' '] }), _jsxs(Text, { as: "span", sx: detailValueSx, children: [new Date(approval.reviewedAt).toLocaleString(), " by", ' ', approval.reviewedBy || 'reviewer'] })] })), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Parameters:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: parameterCount })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Reason:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.reason || approval.toolDescription })] })] }), parameterCount > 0 && (_jsx(Box, { mt: 2, display: "grid", gap: 1, children: Object.entries(approval.parameters || {}).map(([key, value]) => (_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: [key, ":", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children:
|
|
57
|
+
}, children: _jsxs(Box, { display: "flex", alignItems: "center", gap: 1, children: [_jsx(Box, { display: "flex", alignItems: "center", color: "fg.muted", transition: "transform 0.15s ease", transform: isDetailsExpanded ? 'rotate(180deg)' : 'rotate(0deg)', children: _jsx(ChevronDownIcon, { size: 12 }) }), _jsx(Text, { sx: { fontSize: 0, fontWeight: 'semibold' }, children: "View details" })] }) }), _jsxs(Box, { mt: 2, display: "grid", gap: 1, children: [_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Source:", ' '] }), _jsxs(Text, { as: "span", sx: detailValueSx, children: [approval.sourceName, " (", approval.sourceType, ")"] })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Request ID:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.id })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Requested at:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: new Date(approval.requestedAt).toLocaleString() })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Requested by:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.requestedBy })] }), approval.reviewedAt && (_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Reviewed at:", ' '] }), _jsxs(Text, { as: "span", sx: detailValueSx, children: [new Date(approval.reviewedAt).toLocaleString(), " by", ' ', approval.reviewedBy || 'reviewer'] })] })), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Parameters:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: parameterCount })] }), _jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: ["Reason:", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: approval.reason || approval.toolDescription })] })] }), parameterCount > 0 && (_jsx(Box, { mt: 2, display: "grid", gap: 1, children: Object.entries(approval.parameters || {}).map(([key, value]) => (_jsxs(Text, { sx: detailLineSx, children: [_jsxs(Text, { as: "span", sx: detailLabelSx, children: [key, ":", ' '] }), _jsx(Text, { as: "span", sx: detailValueSx, children: typeof value === 'object' && value !== null
|
|
58
|
+
? JSON.stringify(value)
|
|
59
|
+
: String(value) })] }, key))) }))] }) })] }), approval.status === 'pending' && (_jsxs(Box, { display: "flex", gap: 2, flexShrink: 0, children: [_jsx(Button, { size: "small", variant: "primary", leadingVisual: CheckCircleIcon, onClick: () => onApprove?.(approval.id), children: "Approve" }), _jsx(Button, { size: "small", variant: "danger", leadingVisual: XCircleIcon, onClick: () => onReject?.(approval.id), children: "Reject" })] })), _jsxs(Box, { display: "flex", alignItems: "center", gap: 1, flexShrink: 0, children: [_jsx(Button, { size: "small", variant: "invisible", onClick: () => onToggleRead?.(approval.id, isRead), sx: { p: 1 }, title: `Mark as ${isRead ? 'unread' : 'read'}`, "aria-label": `Mark as ${isRead ? 'unread' : 'read'}`, children: isRead ? _jsx(EyeClosedIcon, { size: 12 }) : _jsx(EyeIcon, { size: 12 }) }), _jsx(Button, { size: "small", variant: "invisible", onClick: () => onDelete?.(approval.id), sx: { p: 1, color: 'danger.fg' }, title: "Delete", "aria-label": "Delete", children: _jsx(TrashIcon, { size: 12 }) })] })] }) }));
|
|
58
60
|
}
|
|
59
61
|
export default ToolApprovalCard;
|
|
@@ -51,6 +51,13 @@ export type A2ASpansOptions = {
|
|
|
51
51
|
};
|
|
52
52
|
/** The text of an A2A 1.0 message's or artifact's parts, as JSON carries them. */
|
|
53
53
|
export declare function partsText(parts: unknown): string;
|
|
54
|
+
/** The step a status message carries: a tool call or its end. */
|
|
55
|
+
/**
|
|
56
|
+
* A harness's step as a line says it: *Read README.md*, its kind then its
|
|
57
|
+
* title (the runtime's `{kind, title, status}` in the status message's
|
|
58
|
+
* metadata).
|
|
59
|
+
*/
|
|
60
|
+
export declare function harnessStepName(kind: string, title: string): string;
|
|
54
61
|
/** Whether a message carries a pressed button's action: `metadata.loop.action`. */
|
|
55
62
|
export declare function pressedAction(message: unknown): boolean;
|
|
56
63
|
/**
|
|
@@ -26,6 +26,26 @@ function rpcOf(body) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
/** The step a status message carries: a tool call or its end. */
|
|
29
|
+
/**
|
|
30
|
+
* A harness's step as a line says it: *Read README.md*, its kind then its
|
|
31
|
+
* title (the runtime's `{kind, title, status}` in the status message's
|
|
32
|
+
* metadata).
|
|
33
|
+
*/
|
|
34
|
+
export function harnessStepName(kind, title) {
|
|
35
|
+
const word = kind.trim() && kind !== 'other' ? kind.trim() : '';
|
|
36
|
+
const named = title.trim();
|
|
37
|
+
const capital = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
38
|
+
if (!word) {
|
|
39
|
+
return named;
|
|
40
|
+
}
|
|
41
|
+
if (!named || named.toLowerCase() === word.toLowerCase()) {
|
|
42
|
+
return capital(word);
|
|
43
|
+
}
|
|
44
|
+
if (named.toLowerCase().startsWith(`${word.toLowerCase()} `)) {
|
|
45
|
+
return capital(named);
|
|
46
|
+
}
|
|
47
|
+
return `${capital(word)} ${named}`;
|
|
48
|
+
}
|
|
29
49
|
function stepOf(message) {
|
|
30
50
|
if (!isObject(message) || !Array.isArray(message.parts)) {
|
|
31
51
|
return undefined;
|
|
@@ -39,9 +59,15 @@ function stepOf(message) {
|
|
|
39
59
|
const done = isObject(data.tool_result) ? data.tool_result : undefined;
|
|
40
60
|
const told = call ?? done;
|
|
41
61
|
if (told && typeof told.name === 'string') {
|
|
62
|
+
// A harness says its kind and title in the message's metadata: the step
|
|
63
|
+
// is named by both, and drawn on its workspace.
|
|
64
|
+
const meta = isObject(message.metadata) ? message.metadata : undefined;
|
|
65
|
+
const kind = meta && typeof meta.kind === 'string' ? meta.kind : '';
|
|
66
|
+
const title = meta && typeof meta.title === 'string' ? meta.title : '';
|
|
42
67
|
return {
|
|
43
68
|
...(typeof told.id === 'string' ? { toolId: told.id } : {}),
|
|
44
|
-
name: told.name,
|
|
69
|
+
name: kind ? harnessStepName(kind, title || told.name) : told.name,
|
|
70
|
+
...(kind ? { harness: kind } : {}),
|
|
45
71
|
ended: !call,
|
|
46
72
|
...(call && isObject(call.arguments)
|
|
47
73
|
? { args: call.arguments }
|
|
@@ -171,7 +197,9 @@ class ResponseRecorder {
|
|
|
171
197
|
name: step.name,
|
|
172
198
|
id: step.toolId,
|
|
173
199
|
args: step.args ?? {},
|
|
174
|
-
tool:
|
|
200
|
+
tool: step.harness
|
|
201
|
+
? { kind: 'harness' }
|
|
202
|
+
: (classifyTool?.(step.name, step.args) ?? { kind: 'runtime' }),
|
|
175
203
|
parent: this.span.context,
|
|
176
204
|
origin: 'a2a.status',
|
|
177
205
|
}));
|
|
@@ -180,6 +208,10 @@ class ResponseRecorder {
|
|
|
180
208
|
const call = this.calls.get(key);
|
|
181
209
|
if (call) {
|
|
182
210
|
this.calls.delete(key);
|
|
211
|
+
if (step.harness) {
|
|
212
|
+
// Its end names it as it was done: *Read README.md*, not *Read*.
|
|
213
|
+
call.setAttribute('gen_ai.tool.name', step.name);
|
|
214
|
+
}
|
|
183
215
|
endToolCall(call, { result: step.result, error: step.error });
|
|
184
216
|
}
|
|
185
217
|
}
|
|
@@ -45,7 +45,7 @@ export declare const AGENT_SPAN_ATTRIBUTES: {
|
|
|
45
45
|
readonly errorType: "error.type";
|
|
46
46
|
};
|
|
47
47
|
/** Where a tool call comes from. */
|
|
48
|
-
export type AgentToolKind = 'mcp' | 'frontend' | 'skill' | 'codemode' | 'runtime';
|
|
48
|
+
export type AgentToolKind = 'mcp' | 'frontend' | 'skill' | 'codemode' | 'runtime' | 'harness';
|
|
49
49
|
/** Every kind, in the order the filters list them. */
|
|
50
50
|
export declare const AGENT_TOOL_KINDS: readonly AgentToolKind[];
|
|
51
51
|
/** What a tool call is: where it comes from, and its marks. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A harness's mark, from Datalayer's icons.
|
|
3
|
+
*
|
|
4
|
+
* @module components/teams/HarnessIcon
|
|
5
|
+
*/
|
|
6
|
+
import type { JSX } from 'react';
|
|
7
|
+
/** A harness's mark; the agent's own for one that has none. */
|
|
8
|
+
export declare function HarnessIcon({ id, size, }: {
|
|
9
|
+
id: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AiAgentIcon, ClaudeCodeIcon, CodexIcon, GeminiCliIcon, GooseIcon, OpencodeIcon, OpenhandsIcon, PiCodingAgentIcon, PydanticIcon, } from '@datalayer/icons-react';
|
|
3
|
+
const HARNESS_ICONS = {
|
|
4
|
+
'claude-code': ClaudeCodeIcon,
|
|
5
|
+
codex: CodexIcon,
|
|
6
|
+
'gemini-cli': GeminiCliIcon,
|
|
7
|
+
goose: GooseIcon,
|
|
8
|
+
opencode: OpencodeIcon,
|
|
9
|
+
openhands: OpenhandsIcon,
|
|
10
|
+
pi: PiCodingAgentIcon,
|
|
11
|
+
'pydantic-ai': PydanticIcon,
|
|
12
|
+
};
|
|
13
|
+
/** A harness's mark; the agent's own for one that has none. */
|
|
14
|
+
export function HarnessIcon({ id, size = 14, }) {
|
|
15
|
+
const Icon = HARNESS_ICONS[id] ?? AiAgentIcon;
|
|
16
|
+
return _jsx(Icon, { size: size });
|
|
17
|
+
}
|
|
@@ -25,7 +25,7 @@ export type SceneTranscriptProps = {
|
|
|
25
25
|
writeText?: (text: string) => Promise<void>;
|
|
26
26
|
/** The selected line's key: drawn marked (SCENES S2-03). */
|
|
27
27
|
selected?: string | null;
|
|
28
|
-
/** A line was clicked: its key. */
|
|
28
|
+
/** A line was clicked, or its time's button pressed: its key. */
|
|
29
29
|
onSelect?: (key: string) => void;
|
|
30
30
|
};
|
|
31
31
|
/** The transcript as a list of lines, newest last, with *Copy as text*. */
|