@deepseek-ai/dsh-action-cards 0.0.0-stage → 0.2.2-alpha.2
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/LICENSE +21 -0
- package/README.i18n.yaml +67 -0
- package/README.md +136 -2
- package/README.zh.md +137 -0
- package/lib/index.js +625 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +873 -0
- package/lib/typert.remote-client.d.ts +31 -0
- package/lib/typert.remote-client.js +137 -0
- package/lib/types/index.d.ts +178 -0
- package/lib/types/index.js +398 -0
- package/lib/types/projection.d.ts +66 -0
- package/lib/types/projection.js +122 -0
- package/lib/types/types.d.ts +81 -0
- package/lib/types/types.js +2 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +72 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import type {
|
|
3
|
+
RemoteResult,
|
|
4
|
+
TypertRemoteInfo,
|
|
5
|
+
TypertRemoteMethod,
|
|
6
|
+
} from '@deepseek-ai/dsh-typert-protocol'
|
|
7
|
+
import type { ActionCardResult } from '@deepseek-ai/dsh-action-cards/types'
|
|
8
|
+
import type { ToolCallId } from '@deepseek-ai/dsh-llm/brand'
|
|
9
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
10
|
+
import type { JsonValue } from '@deepseek-ai/dsh-util-values'
|
|
11
|
+
|
|
12
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
13
|
+
interface TypertRemoteNamespace$616374696f6e4361726473 {
|
|
14
|
+
act: (agentId: SessionId, callId: ToolCallId, verb: string, payload?: Record<string, JsonValue>) => Promise<RemoteResult<ActionCardResult>>
|
|
15
|
+
}
|
|
16
|
+
interface TypertRemoteMap {
|
|
17
|
+
'actionCards/act': (agentId: SessionId, callId: ToolCallId, verb: string, payload?: Record<string, JsonValue>) => Promise<RemoteResult<ActionCardResult>>
|
|
18
|
+
}
|
|
19
|
+
interface TypertRemoteNamespaceMap {
|
|
20
|
+
'actionCards': TypertRemoteNamespace$616374696f6e4361726473
|
|
21
|
+
}
|
|
22
|
+
interface TypertRemoteScopeMap {
|
|
23
|
+
'agent:actionCards/act': (callId: ToolCallId, verb: string, payload?: Record<string, JsonValue>) => Promise<RemoteResult<ActionCardResult>>
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare const TYPERT_REMOTE: TypertRemoteInfo<{
|
|
28
|
+
readonly 'actionCards/act': TypertRemoteMethod<{ readonly 'agentId': SessionId; readonly 'callId': ToolCallId; readonly 'verb': string; readonly 'payload'?: Record<string, JsonValue> }, ActionCardResult>
|
|
29
|
+
}>
|
|
30
|
+
export default TYPERT_REMOTE
|
|
31
|
+
//# sourceMappingURL=typert.remote-client.d.ts.map
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* Generated by @deepseek-ai/dsh-typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { createTypertRemoteInfo } from '@deepseek-ai/dsh-typert-protocol/remote-info'
|
|
5
|
+
|
|
6
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema$value
|
|
7
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema$value ??= z.string())
|
|
8
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema$value
|
|
9
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema$value ??= z.string())
|
|
10
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema$value
|
|
11
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema$value ??= z.string())
|
|
12
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema$value
|
|
13
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema$value ??= z.union([z.undefined(), z.record(z.string(), z.json())]))
|
|
14
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_result$schema$value
|
|
15
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_result$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_result$schema$value ??= z.union([z.object({
|
|
16
|
+
'status': z.literal("accepted").readonly(),
|
|
17
|
+
}), z.object({
|
|
18
|
+
'status': z.literal("settled").readonly(),
|
|
19
|
+
'decision': z.object({
|
|
20
|
+
'callId': z.string().readonly(),
|
|
21
|
+
'action': z.string().readonly(),
|
|
22
|
+
'phase': z.string().readonly(),
|
|
23
|
+
'data': z.union([z.undefined(), z.record(z.string(), z.json()).readonly()]).readonly().optional().describe('Kind-defined fields such as a chosen location or a created package.'),
|
|
24
|
+
}).readonly(),
|
|
25
|
+
}), z.object({
|
|
26
|
+
'status': z.literal("refused").readonly(),
|
|
27
|
+
'reason': z.string().readonly(),
|
|
28
|
+
}), z.object({
|
|
29
|
+
'status': z.literal("unconfirmed").readonly(),
|
|
30
|
+
'reason': z.string().readonly(),
|
|
31
|
+
})]))
|
|
32
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema$value
|
|
33
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema$value ??= z.string())
|
|
34
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema$value
|
|
35
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema$value ??= z.string())
|
|
36
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema$value
|
|
37
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema$value ??= z.string())
|
|
38
|
+
let _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema$value
|
|
39
|
+
const _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema = () => (_deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema$value ??= z.union([z.undefined(), z.record(z.string(), z.json())]))
|
|
40
|
+
|
|
41
|
+
export const TYPERT_REMOTE = createTypertRemoteInfo({
|
|
42
|
+
package: '@deepseek-ai/dsh-action-cards',
|
|
43
|
+
methods: {
|
|
44
|
+
'actionCards/act': {
|
|
45
|
+
service: 'actionCards',
|
|
46
|
+
description: 'Apply a user action to a logged card. Shared checks run first, then the kind reconciles the card; `dismiss` is recorded here and every other verb goes to the card\'s kind. `dismiss` also works on an unstarted card whose kind is no longer registered. Concurrent actions on one card share one operation.',
|
|
47
|
+
invocation: { kind: 'direct' },
|
|
48
|
+
scope: {
|
|
49
|
+
context: 'agent',
|
|
50
|
+
wire: 'agentId',
|
|
51
|
+
},
|
|
52
|
+
parameters: [
|
|
53
|
+
{
|
|
54
|
+
name: 'agent',
|
|
55
|
+
wire: 'agentId',
|
|
56
|
+
description: 'live root resolved from the displayed Session.',
|
|
57
|
+
source: 'lookup',
|
|
58
|
+
lookup: 'agent',
|
|
59
|
+
codec: {
|
|
60
|
+
mode: 'strict',
|
|
61
|
+
typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
|
|
62
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0$schema,
|
|
63
|
+
jsonSchema: {"type":"string"},
|
|
64
|
+
},
|
|
65
|
+
strictCodec: {
|
|
66
|
+
mode: 'strict',
|
|
67
|
+
typeSymbol: '@deepseek-ai/dsh-session/types#SessionId',
|
|
68
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_0_strict$schema,
|
|
69
|
+
jsonSchema: {"type":"string"},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'callId',
|
|
74
|
+
description: 'the card\'s `propose_action` call id.',
|
|
75
|
+
source: 'json',
|
|
76
|
+
codec: {
|
|
77
|
+
mode: 'strict',
|
|
78
|
+
typeSymbol: '@deepseek-ai/dsh-llm/brand#ToolCallId',
|
|
79
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1$schema,
|
|
80
|
+
jsonSchema: {"type":"string"},
|
|
81
|
+
},
|
|
82
|
+
strictCodec: {
|
|
83
|
+
mode: 'strict',
|
|
84
|
+
typeSymbol: '@deepseek-ai/dsh-llm/brand#ToolCallId',
|
|
85
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_1_strict$schema,
|
|
86
|
+
jsonSchema: {"type":"string"},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'verb',
|
|
91
|
+
description: '`dismiss` or one of the kind\'s verbs.',
|
|
92
|
+
source: 'json',
|
|
93
|
+
codec: {
|
|
94
|
+
mode: 'strict',
|
|
95
|
+
typeSymbol: '@deepseek-ai/dsh-action-cards#actionCards/act:verb',
|
|
96
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2$schema,
|
|
97
|
+
jsonSchema: {"type":"string"},
|
|
98
|
+
},
|
|
99
|
+
strictCodec: {
|
|
100
|
+
mode: 'strict',
|
|
101
|
+
typeSymbol: '@deepseek-ai/dsh-action-cards#actionCards/act:verb',
|
|
102
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_2_strict$schema,
|
|
103
|
+
jsonSchema: {"type":"string"},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'payload',
|
|
108
|
+
description: 'kind-defined fields such as a chosen location.',
|
|
109
|
+
source: 'json',
|
|
110
|
+
acceptsUndefined: true,
|
|
111
|
+
codec: {
|
|
112
|
+
mode: 'strict',
|
|
113
|
+
typeSymbol: '@deepseek-ai/dsh-action-cards#actionCards/act:payload',
|
|
114
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3$schema,
|
|
115
|
+
jsonSchema: {"type":"object","properties":{},"required":[],"additionalProperties":true},
|
|
116
|
+
},
|
|
117
|
+
strictCodec: {
|
|
118
|
+
mode: 'strict',
|
|
119
|
+
typeSymbol: '@deepseek-ai/dsh-action-cards#actionCards/act:payload',
|
|
120
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_parameter_3_strict$schema,
|
|
121
|
+
jsonSchema: {"type":"object","properties":{},"required":[],"additionalProperties":true},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
result: {
|
|
126
|
+
mode: 'strict',
|
|
127
|
+
typeSymbol: '@deepseek-ai/dsh-action-cards/types#ActionCardResult',
|
|
128
|
+
create: _deepseek_ai_dsh_action_cards_actionCards_act_result$schema,
|
|
129
|
+
description: 'acceptance of background work, the decision in effect, or a refusal.',
|
|
130
|
+
jsonSchema: {"oneOf":[{"type":"object","properties":{"status":{"type":"string","const":"accepted"}},"required":["status"],"additionalProperties":true},{"type":"object","properties":{"status":{"type":"string","const":"settled"},"decision":{"type":"object","properties":{"callId":{"type":"string"},"action":{"type":"string"},"phase":{"type":"string"},"data":{"type":"object","properties":{},"required":[],"additionalProperties":true,"description":"Kind-defined fields such as a chosen location or a created package."}},"required":["callId","action","phase"],"additionalProperties":true}},"required":["status","decision"],"additionalProperties":true},{"type":"object","properties":{"status":{"type":"string","const":"refused"},"reason":{"type":"string"}},"required":["status","reason"],"additionalProperties":true},{"type":"object","properties":{"status":{"type":"string","const":"unconfirmed"},"reason":{"type":"string"}},"required":["status","reason"],"additionalProperties":true}]},
|
|
131
|
+
},
|
|
132
|
+
sourceLocation: {"file":"packages/experimental/action-cards/src/index.ts","line":338,"column":3},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
}, z)
|
|
136
|
+
|
|
137
|
+
export default TYPERT_REMOTE
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/** Optional action cards below an answer: the `propose_action` tool, card state, user actions and status notices for registered kinds. */
|
|
2
|
+
import { FiberState, Service, type Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { z, type ZodType } from 'zod';
|
|
4
|
+
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
5
|
+
import { HarnessError, type ToolCallId } from '@deepseek-ai/dsh-llm';
|
|
6
|
+
import { type Session } from '@deepseek-ai/dsh-session';
|
|
7
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
8
|
+
import type { JsonValue } from '@deepseek-ai/dsh-util-values';
|
|
9
|
+
import type { ActionCardDecision, ActionCardFields, ActionCardProposal, ActionCardResult, ActionCardView } from './types.ts';
|
|
10
|
+
export type * from './types.ts';
|
|
11
|
+
/** Deployment-tunable limits for offering cards. */
|
|
12
|
+
export declare const Config: z.ZodPrefault<z.ZodObject<{
|
|
13
|
+
queuedMessageLimit: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
/** Validated card limits after schema defaults. */
|
|
16
|
+
export type Config = z.infer<typeof Config>;
|
|
17
|
+
declare module '@deepseek-ai/cordis' {
|
|
18
|
+
interface Context {
|
|
19
|
+
actionCards: ActionCards;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** The fiber fields the stopping check reads. */
|
|
23
|
+
export interface PluginFiber {
|
|
24
|
+
readonly uid: number | null;
|
|
25
|
+
readonly state: FiberState;
|
|
26
|
+
readonly parent: {
|
|
27
|
+
readonly fiber: PluginFiber;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether a plugin must refuse new work: its fiber or an ancestor is disposed or unloading, since a parent's disposal
|
|
32
|
+
* begins before the plugin's own effects run, or the plugin's own drain has begun.
|
|
33
|
+
* @param owner - the plugin's fiber.
|
|
34
|
+
* @param draining - whether the plugin's drain effect has started.
|
|
35
|
+
* @returns whether the plugin is stopping.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPluginStopping(owner: PluginFiber, draining: boolean): boolean;
|
|
38
|
+
/** A refused `propose_action` call; the message tells the model what to do instead. */
|
|
39
|
+
export declare class ActionCardError extends HarnessError {
|
|
40
|
+
}
|
|
41
|
+
/** Shared checks one user action of a kind requires before the kind handles it. */
|
|
42
|
+
export interface ActionCardVerb {
|
|
43
|
+
/** The connection must hold global Remote access, as for profile changes. */
|
|
44
|
+
readonly global?: true;
|
|
45
|
+
/** Refused while the Session sandbox mode is read-only. */
|
|
46
|
+
readonly writes?: true;
|
|
47
|
+
}
|
|
48
|
+
/** A proposal whose details passed its kind's schema. */
|
|
49
|
+
export type ActionCardProposalOf<Details> = Omit<ActionCardProposal, 'details'> & {
|
|
50
|
+
readonly details: Details;
|
|
51
|
+
};
|
|
52
|
+
/** Host half of one action kind: the skill that proposes it, its fields and its user actions. */
|
|
53
|
+
export interface ActionCardKind<Details> {
|
|
54
|
+
/** Value of the `action` argument. */
|
|
55
|
+
readonly action: string;
|
|
56
|
+
/** Skill whose instructions propose this action; a load in the current turn admits the call. */
|
|
57
|
+
readonly skill: string;
|
|
58
|
+
/**
|
|
59
|
+
* Model-facing closing guidance that the result of an accepted call gives: one or two sentences on how to invite
|
|
60
|
+
* the user to the card, in the user's language. Refused calls never carry it, so the model invites the user only to a
|
|
61
|
+
* card that exists.
|
|
62
|
+
*/
|
|
63
|
+
readonly invitation: string;
|
|
64
|
+
/** Validates `details` when the model proposes and before each user action. */
|
|
65
|
+
readonly details: ZodType<Details>;
|
|
66
|
+
/** User actions besides `dismiss`, with the shared checks each requires; other verbs are refused as unavailable. */
|
|
67
|
+
readonly verbs: Readonly<Record<string, ActionCardVerb>>;
|
|
68
|
+
/** Recorded phases that still offer the action; dismissal is recorded for these and for an unstarted card. */
|
|
69
|
+
readonly openPhases?: readonly string[];
|
|
70
|
+
/** Sentences the status notice adds when it reports this kind's decisions. */
|
|
71
|
+
readonly statusGuidance?: string;
|
|
72
|
+
/** Decision data fields the status notice reports; omitted reports every field. */
|
|
73
|
+
readonly statusFields?: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Fields recorded with a dismissal.
|
|
76
|
+
* @param proposal - the dismissed card.
|
|
77
|
+
* @param payload - fields the user's client sent.
|
|
78
|
+
* @returns decision data, or undefined to record none.
|
|
79
|
+
*/
|
|
80
|
+
dismissal?(proposal: ActionCardProposalOf<Details>, payload: ActionCardFields | undefined): ActionCardFields | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Bring the card's recorded decision up to date with state outside the Session, such as an installation that
|
|
83
|
+
* finished while the Session was closed, recording each change with {@link ActionCards.record}. The service awaits it
|
|
84
|
+
* before every user action, including `dismiss`, then reads the card's decision again, so a card that is no longer
|
|
85
|
+
* open settles instead of being dismissed.
|
|
86
|
+
* @param agent - live root of the card's Session.
|
|
87
|
+
* @param proposal - the card with validated details.
|
|
88
|
+
* @throws when that state cannot be read; the action is then refused as unavailable.
|
|
89
|
+
*/
|
|
90
|
+
reconcile?(agent: Agent, proposal: ActionCardProposalOf<Details>): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Handle one user action other than `dismiss` after the shared checks passed. The handler records each new
|
|
93
|
+
* decision with {@link ActionCards.record}.
|
|
94
|
+
* @param agent - live root of the card's Session.
|
|
95
|
+
* @param proposal - the card with validated details.
|
|
96
|
+
* @param verb - one of {@link verbs}.
|
|
97
|
+
* @param payload - fields the user's client sent; the kind validates them.
|
|
98
|
+
* @returns the action's result.
|
|
99
|
+
*/
|
|
100
|
+
act(agent: Agent, proposal: ActionCardProposalOf<Details>, verb: string, payload: ActionCardFields | undefined): Promise<ActionCardResult>;
|
|
101
|
+
}
|
|
102
|
+
/** Card tool, kind registry, Session projection, user actions and status notices. */
|
|
103
|
+
export declare class ActionCards extends TypertRemoteService {
|
|
104
|
+
private readonly config;
|
|
105
|
+
static inject: string[];
|
|
106
|
+
static Config: z.ZodPrefault<z.ZodObject<{
|
|
107
|
+
queuedMessageLimit: z.ZodDefault<z.ZodNumber>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
private projection;
|
|
110
|
+
private readonly kinds;
|
|
111
|
+
/**
|
|
112
|
+
* Actions whose kind unregistered. Cordis disposes a plugin's effects concurrently, so a kind's unload drain can
|
|
113
|
+
* still record the outcome of its in-flight work after its registration is gone.
|
|
114
|
+
*/
|
|
115
|
+
private readonly retired;
|
|
116
|
+
/** Skills of registered kinds each live agent has loaded; `propose_action` is declared while one is still registered. */
|
|
117
|
+
private readonly loaded;
|
|
118
|
+
/** Kind skills each agent loaded in its latest turn. */
|
|
119
|
+
private readonly turnLoads;
|
|
120
|
+
/** The call accepted in each agent's latest turn, until its result fails. */
|
|
121
|
+
private readonly accepted;
|
|
122
|
+
private readonly actions;
|
|
123
|
+
private closing;
|
|
124
|
+
private readonly owner;
|
|
125
|
+
/**
|
|
126
|
+
* @param ctx - Owning plugin context.
|
|
127
|
+
* @param config - Validated card limits; direct composition without a config gets the schema defaults.
|
|
128
|
+
*/
|
|
129
|
+
constructor(ctx: Context, config?: Config);
|
|
130
|
+
protected [Service.init](): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Register one action kind for the caller's lifetime.
|
|
133
|
+
* @param kind - the kind's skill, details schema, verbs and handler.
|
|
134
|
+
* @returns disposer removing the kind; actions on its cards are then unavailable.
|
|
135
|
+
* @throws when another kind already registered the same action.
|
|
136
|
+
*/
|
|
137
|
+
register<Details>(kind: ActionCardKind<Details>): () => void;
|
|
138
|
+
/**
|
|
139
|
+
* Record a card decision in the Session log; the next model request reports it.
|
|
140
|
+
* @param agent - agent whose Session owns the card.
|
|
141
|
+
* @param decision - the card's new state.
|
|
142
|
+
* @throws when no kind ever registered the decision's action with this service, or its phase is one the projection derives.
|
|
143
|
+
*/
|
|
144
|
+
record(agent: Agent, decision: ActionCardDecision): void;
|
|
145
|
+
/**
|
|
146
|
+
* Read the cards of one Session.
|
|
147
|
+
* @param session - a Session whose projections are prepared.
|
|
148
|
+
* @returns proposals and decisions by call id.
|
|
149
|
+
*/
|
|
150
|
+
view(session: Session): ActionCardView;
|
|
151
|
+
/**
|
|
152
|
+
* Apply a user action to a logged card. Shared checks run first, then the kind reconciles the card; `dismiss` is
|
|
153
|
+
* recorded here and every other verb goes to the card's kind. `dismiss` also works on an unstarted card whose kind
|
|
154
|
+
* is no longer registered. Concurrent actions on one card share one operation.
|
|
155
|
+
* @param agent - live root resolved from the displayed Session.
|
|
156
|
+
* @param callId - the card's `propose_action` call id.
|
|
157
|
+
* @param verb - `dismiss` or one of the kind's verbs.
|
|
158
|
+
* @param payload - kind-defined fields such as a chosen location.
|
|
159
|
+
* @returns acceptance of background work, the decision in effect, or a refusal.
|
|
160
|
+
*/
|
|
161
|
+
act(agent: Agent, callId: ToolCallId, verb: string, payload?: Record<string, JsonValue>): Promise<ActionCardResult>;
|
|
162
|
+
/** Share one operation per card, run under the Agent's initiator, until it settles. */
|
|
163
|
+
private coalesce;
|
|
164
|
+
/**
|
|
165
|
+
* Await the kind's reconciliation. A kind that unloads meanwhile still handles the action and refuses it itself.
|
|
166
|
+
* @returns a refusal when reconciliation failed or the root closed meanwhile; undefined to continue.
|
|
167
|
+
*/
|
|
168
|
+
private reconciled;
|
|
169
|
+
private dismiss;
|
|
170
|
+
private perform;
|
|
171
|
+
private append;
|
|
172
|
+
/** Whether `propose_action` is declared for this agent's next step. */
|
|
173
|
+
private declares;
|
|
174
|
+
private propose;
|
|
175
|
+
private isStopping;
|
|
176
|
+
}
|
|
177
|
+
export default ActionCards;
|
|
178
|
+
//# sourceMappingURL=index.d.ts.map
|