@qilin-agent/experimental-agent-team 0.0.0-stage → 3.1.4
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 +103 -0
- package/README.md +225 -2
- package/README.zh.md +226 -0
- package/lib/index.js +1782 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +875 -0
- package/lib/typert.remote-client.d.ts +30 -0
- package/lib/typert.remote-client.js +141 -0
- package/lib/types/activity.d.ts +23 -0
- package/lib/types/activity.js +85 -0
- package/lib/types/client.d.ts +8 -0
- package/lib/types/client.js +3 -0
- package/lib/types/error.d.ts +13 -0
- package/lib/types/error.js +23 -0
- package/lib/types/index.d.ts +148 -0
- package/lib/types/index.js +340 -0
- package/lib/types/journal.d.ts +39 -0
- package/lib/types/journal.js +63 -0
- package/lib/types/lifecycle.d.ts +45 -0
- package/lib/types/lifecycle.js +103 -0
- package/lib/types/persisted.d.ts +20 -0
- package/lib/types/persisted.js +20 -0
- package/lib/types/projection.d.ts +66 -0
- package/lib/types/projection.js +327 -0
- package/lib/types/remote.d.ts +31 -0
- package/lib/types/remote.js +22 -0
- package/lib/types/roster.d.ts +107 -0
- package/lib/types/roster.js +441 -0
- package/lib/types/session-message.d.ts +11 -0
- package/lib/types/session-message.js +23 -0
- package/lib/types/task-board.d.ts +53 -0
- package/lib/types/task-board.js +235 -0
- package/lib/types/task-graph.d.ts +21 -0
- package/lib/types/task-graph.js +62 -0
- package/lib/types/task-view.d.ts +21 -0
- package/lib/types/task-view.js +57 -0
- package/lib/types/types.d.ts +212 -0
- package/lib/types/types.js +26 -0
- package/lib/types/validation.d.ts +16 -0
- package/lib/types/validation.js +33 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +83 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Generated by @qilin-agent/typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import type {
|
|
3
|
+
RemoteResult,
|
|
4
|
+
TypertRemoteContribution,
|
|
5
|
+
} from '@qilin-agent/typert-protocol'
|
|
6
|
+
import type { TeamTaskView } from '@qilin-agent/experimental-agent-team/client'
|
|
7
|
+
import type { CreateTeamTaskRequest, UpdateTeamTaskRequest } from '@qilin-agent/experimental-agent-team/types'
|
|
8
|
+
import type { SessionId } from '@qilin-agent/session/types'
|
|
9
|
+
|
|
10
|
+
declare module '@qilin-agent/typert-protocol' {
|
|
11
|
+
interface TypertRemoteNamespace$6167656e745465616d73 {
|
|
12
|
+
createTask: (agentId: SessionId, request: CreateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
13
|
+
updateTask: (agentId: SessionId, request: UpdateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
14
|
+
}
|
|
15
|
+
interface TypertRemoteMap {
|
|
16
|
+
'agentTeams/createTask': (agentId: SessionId, request: CreateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
17
|
+
'agentTeams/updateTask': (agentId: SessionId, request: UpdateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
18
|
+
}
|
|
19
|
+
interface TypertRemoteNamespaceMap {
|
|
20
|
+
'agentTeams': TypertRemoteNamespace$6167656e745465616d73
|
|
21
|
+
}
|
|
22
|
+
interface TypertRemoteScopeMap {
|
|
23
|
+
'agent:agentTeams/createTask': (request: CreateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
24
|
+
'agent:agentTeams/updateTask': (request: UpdateTeamTaskRequest) => Promise<RemoteResult<TeamTaskView>>
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare const TYPERT_REMOTE: TypertRemoteContribution
|
|
29
|
+
export default TYPERT_REMOTE
|
|
30
|
+
//# sourceMappingURL=typert.remote-client.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/* Generated by @qilin-agent/typert-generator from the Host FaceModel — do not edit. */
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
let _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_0$schema$value
|
|
5
|
+
const _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_0$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
|
|
6
|
+
let _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_1$schema$value
|
|
7
|
+
const _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_1$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_1$schema$value ??= z.object({
|
|
8
|
+
'subject': z.string().readonly(),
|
|
9
|
+
'description': z.string().readonly(),
|
|
10
|
+
'blockedBy': z.array(z.intersection(z.string(), z.unknown())).readonly().optional(),
|
|
11
|
+
'writeScopes': z.array(z.string()).readonly().optional(),
|
|
12
|
+
}))
|
|
13
|
+
let _qilin_agent_experimental_agent_team_agentTeams_createTask_result$schema$value
|
|
14
|
+
const _qilin_agent_experimental_agent_team_agentTeams_createTask_result$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_createTask_result$schema$value ??= z.object({
|
|
15
|
+
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
16
|
+
'revision': z.number().readonly(),
|
|
17
|
+
'subject': z.string().readonly(),
|
|
18
|
+
'description': z.string().readonly(),
|
|
19
|
+
'status': z.union([z.literal("completed"), z.literal("pending"), z.literal("in_progress"), z.literal("deleted")]).readonly(),
|
|
20
|
+
'blockedBy': z.array(z.intersection(z.string(), z.unknown())).readonly(),
|
|
21
|
+
'writeScopes': z.array(z.string()).readonly(),
|
|
22
|
+
'ownerName': z.string().readonly().optional(),
|
|
23
|
+
'ready': z.boolean().readonly(),
|
|
24
|
+
'writeScopeWarnings': z.array(z.string()).readonly(),
|
|
25
|
+
}))
|
|
26
|
+
let _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_0$schema$value
|
|
27
|
+
const _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_0$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_0$schema$value ??= z.intersection(z.string(), z.unknown()))
|
|
28
|
+
let _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_1$schema$value
|
|
29
|
+
const _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_1$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_1$schema$value ??= z.object({
|
|
30
|
+
'taskId': z.intersection(z.string(), z.unknown()).readonly(),
|
|
31
|
+
'expectedRevision': z.number().readonly(),
|
|
32
|
+
'action': z.union([z.literal("complete"), z.literal("edit"), z.literal("claim"), z.literal("release"), z.literal("set_dependencies"), z.literal("reopen"), z.literal("reassign"), z.literal("delete")]).readonly(),
|
|
33
|
+
'subject': z.string().readonly().optional(),
|
|
34
|
+
'description': z.string().readonly().optional(),
|
|
35
|
+
'blockedBy': z.array(z.intersection(z.string(), z.unknown())).readonly().optional(),
|
|
36
|
+
'writeScopes': z.array(z.string()).readonly().optional(),
|
|
37
|
+
'owner': z.string().readonly().optional(),
|
|
38
|
+
}))
|
|
39
|
+
let _qilin_agent_experimental_agent_team_agentTeams_updateTask_result$schema$value
|
|
40
|
+
const _qilin_agent_experimental_agent_team_agentTeams_updateTask_result$schema = () => (_qilin_agent_experimental_agent_team_agentTeams_updateTask_result$schema$value ??= z.object({
|
|
41
|
+
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
42
|
+
'revision': z.number().readonly(),
|
|
43
|
+
'subject': z.string().readonly(),
|
|
44
|
+
'description': z.string().readonly(),
|
|
45
|
+
'status': z.union([z.literal("completed"), z.literal("pending"), z.literal("in_progress"), z.literal("deleted")]).readonly(),
|
|
46
|
+
'blockedBy': z.array(z.intersection(z.string(), z.unknown())).readonly(),
|
|
47
|
+
'writeScopes': z.array(z.string()).readonly(),
|
|
48
|
+
'ownerName': z.string().readonly().optional(),
|
|
49
|
+
'ready': z.boolean().readonly(),
|
|
50
|
+
'writeScopeWarnings': z.array(z.string()).readonly(),
|
|
51
|
+
}))
|
|
52
|
+
|
|
53
|
+
export const TYPERT_REMOTE = {
|
|
54
|
+
package: '@qilin-agent/experimental-agent-team',
|
|
55
|
+
descriptors: [
|
|
56
|
+
{
|
|
57
|
+
id: '@qilin-agent/experimental-agent-team#agentTeams/createTask',
|
|
58
|
+
service: 'agentTeams',
|
|
59
|
+
namespace: 'agentTeams',
|
|
60
|
+
method: 'createTask',
|
|
61
|
+
implementation: 'remoteCreateTask',
|
|
62
|
+
invocation: { kind: 'direct' },
|
|
63
|
+
scope: {
|
|
64
|
+
context: 'agent',
|
|
65
|
+
wire: 'agentId',
|
|
66
|
+
},
|
|
67
|
+
parameters: [
|
|
68
|
+
{
|
|
69
|
+
name: 'agent',
|
|
70
|
+
wire: 'agentId',
|
|
71
|
+
source: 'lookup',
|
|
72
|
+
lookup: 'agent',
|
|
73
|
+
codec: {
|
|
74
|
+
mode: 'strict',
|
|
75
|
+
typeSymbol: '@qilin-agent/session/types#SessionId',
|
|
76
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_0$schema,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'request',
|
|
81
|
+
wire: 'request',
|
|
82
|
+
source: 'json',
|
|
83
|
+
codec: {
|
|
84
|
+
mode: 'strict',
|
|
85
|
+
typeSymbol: '@qilin-agent/experimental-agent-team/types#CreateTeamTaskRequest',
|
|
86
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_createTask_parameter_1$schema,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
result: {
|
|
91
|
+
mode: 'strict',
|
|
92
|
+
typeSymbol: '@qilin-agent/experimental-agent-team/client#TeamTaskView',
|
|
93
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_createTask_result$schema,
|
|
94
|
+
},
|
|
95
|
+
sourceLocation: {"file":"packages/experimental/agent-team/src/index.ts","line":244,"column":9},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: '@qilin-agent/experimental-agent-team#agentTeams/updateTask',
|
|
99
|
+
service: 'agentTeams',
|
|
100
|
+
namespace: 'agentTeams',
|
|
101
|
+
method: 'updateTask',
|
|
102
|
+
implementation: 'remoteUpdateTask',
|
|
103
|
+
invocation: { kind: 'direct' },
|
|
104
|
+
scope: {
|
|
105
|
+
context: 'agent',
|
|
106
|
+
wire: 'agentId',
|
|
107
|
+
},
|
|
108
|
+
parameters: [
|
|
109
|
+
{
|
|
110
|
+
name: 'agent',
|
|
111
|
+
wire: 'agentId',
|
|
112
|
+
source: 'lookup',
|
|
113
|
+
lookup: 'agent',
|
|
114
|
+
codec: {
|
|
115
|
+
mode: 'strict',
|
|
116
|
+
typeSymbol: '@qilin-agent/session/types#SessionId',
|
|
117
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_0$schema,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'request',
|
|
122
|
+
wire: 'request',
|
|
123
|
+
source: 'json',
|
|
124
|
+
codec: {
|
|
125
|
+
mode: 'strict',
|
|
126
|
+
typeSymbol: '@qilin-agent/experimental-agent-team/types#UpdateTeamTaskRequest',
|
|
127
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_updateTask_parameter_1$schema,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
result: {
|
|
132
|
+
mode: 'strict',
|
|
133
|
+
typeSymbol: '@qilin-agent/experimental-agent-team/client#TeamTaskView',
|
|
134
|
+
create: _qilin_agent_experimental_agent_team_agentTeams_updateTask_result$schema,
|
|
135
|
+
},
|
|
136
|
+
sourceLocation: {"file":"packages/experimental/agent-team/src/index.ts","line":264,"column":9},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default TYPERT_REMOTE
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** One-shot Team change waiters independent of durable state projection. */
|
|
2
|
+
import type { TeamId, TeamWaitResult } from './types.ts';
|
|
3
|
+
/** Owns current Team change waiters and releases each at most once. */
|
|
4
|
+
export declare class TeamActivity {
|
|
5
|
+
private readonly waiters;
|
|
6
|
+
private closed;
|
|
7
|
+
/**
|
|
8
|
+
* Wait for one later Team-domain or member-status change.
|
|
9
|
+
* @param id - Team whose next edge wakes the caller.
|
|
10
|
+
* @param timeoutMs - bounded wait duration from ten seconds through one hour.
|
|
11
|
+
* @param signal - caller cancellation for this wait only.
|
|
12
|
+
* @returns whether the wait ended by timeout.
|
|
13
|
+
*/
|
|
14
|
+
wait(id: TeamId, timeoutMs: number, signal: AbortSignal): Promise<TeamWaitResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Wake and remove every current waiter for one Team.
|
|
17
|
+
* @param id - Team whose current waiters observe the change.
|
|
18
|
+
*/
|
|
19
|
+
notify(id: TeamId): void;
|
|
20
|
+
/** Close admission and wake every current waiter during runtime disposal. */
|
|
21
|
+
close(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** One-shot Team change waiters independent of durable state projection. */
|
|
2
|
+
import { errorMessage, TeamError } from "./error.js";
|
|
3
|
+
/** Owns current Team change waiters and releases each at most once. */
|
|
4
|
+
export class TeamActivity {
|
|
5
|
+
waiters = new Map();
|
|
6
|
+
closed = false;
|
|
7
|
+
/**
|
|
8
|
+
* Wait for one later Team-domain or member-status change.
|
|
9
|
+
* @param id - Team whose next edge wakes the caller.
|
|
10
|
+
* @param timeoutMs - bounded wait duration from ten seconds through one hour.
|
|
11
|
+
* @param signal - caller cancellation for this wait only.
|
|
12
|
+
* @returns whether the wait ended by timeout.
|
|
13
|
+
*/
|
|
14
|
+
async wait(id, timeoutMs, signal) {
|
|
15
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 10_000 || timeoutMs > 3_600_000) {
|
|
16
|
+
throw new TeamError('timeoutMs must be an integer from 10000 through 3600000', 'TEAM_INVALID_TIMEOUT');
|
|
17
|
+
}
|
|
18
|
+
signal.throwIfAborted();
|
|
19
|
+
if (this.closed)
|
|
20
|
+
return { timedOut: false };
|
|
21
|
+
const changed = await new Promise((resolve, reject) => {
|
|
22
|
+
let waiters = this.waiters.get(id);
|
|
23
|
+
if (waiters === undefined) {
|
|
24
|
+
waiters = new Set();
|
|
25
|
+
this.waiters.set(id, waiters);
|
|
26
|
+
}
|
|
27
|
+
let settled = false;
|
|
28
|
+
const finish = (settle) => {
|
|
29
|
+
/* v8 ignore next -- timeout, abort, and notification may race after one winner removes the others. */
|
|
30
|
+
if (settled)
|
|
31
|
+
return;
|
|
32
|
+
settled = true;
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
signal.removeEventListener('abort', onAbort);
|
|
35
|
+
waiters.delete(waiter);
|
|
36
|
+
if (waiters.size === 0)
|
|
37
|
+
this.waiters.delete(id);
|
|
38
|
+
settle();
|
|
39
|
+
};
|
|
40
|
+
const onAbort = () => {
|
|
41
|
+
finish(() => {
|
|
42
|
+
const reason = signal.reason;
|
|
43
|
+
reject(reason instanceof Error
|
|
44
|
+
? reason
|
|
45
|
+
: new TeamError(`wait_agent aborted: ${errorMessage(reason)}`, 'TEAM_WAIT_ABORTED'));
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const waiter = {
|
|
49
|
+
resolve: () => {
|
|
50
|
+
finish(() => { resolve(true); });
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
waiters.add(waiter);
|
|
54
|
+
const timer = setTimeout(() => { finish(() => { resolve(false); }); }, timeoutMs);
|
|
55
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
56
|
+
// AbortSignal does not replay an abort that wins between the pre-check and listener registration.
|
|
57
|
+
/* v8 ignore next -- requires an abort in the synchronous gap between the pre-check and listener registration. */
|
|
58
|
+
if (signal.aborted)
|
|
59
|
+
onAbort();
|
|
60
|
+
});
|
|
61
|
+
return { timedOut: !changed };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wake and remove every current waiter for one Team.
|
|
65
|
+
* @param id - Team whose current waiters observe the change.
|
|
66
|
+
*/
|
|
67
|
+
notify(id) {
|
|
68
|
+
const waiters = this.waiters.get(id);
|
|
69
|
+
if (waiters === undefined)
|
|
70
|
+
return;
|
|
71
|
+
this.waiters.delete(id);
|
|
72
|
+
for (const waiter of waiters)
|
|
73
|
+
waiter.resolve();
|
|
74
|
+
}
|
|
75
|
+
/** Close admission and wake every current waiter during runtime disposal. */
|
|
76
|
+
close() {
|
|
77
|
+
this.closed = true;
|
|
78
|
+
for (const waiters of this.waiters.values()) {
|
|
79
|
+
for (const waiter of waiters)
|
|
80
|
+
waiter.resolve();
|
|
81
|
+
}
|
|
82
|
+
this.waiters.clear();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=activity.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Client-safe Agent Teams roster and task views plus the `agentTeam` projection vocabulary. */
|
|
2
|
+
/**
|
|
3
|
+
* Pull the write face's wire failure codes into every client program, so the
|
|
4
|
+
* `agentTeams` namespace's `RemoteFailure` union names the Team domain codes.
|
|
5
|
+
*/
|
|
6
|
+
export type { TeamRejectedFailureDetails } from './remote.ts';
|
|
7
|
+
export type { TeamMemberPhase, TeamMemberProjection, TeamMemberView, TeamProjection, TeamTaskId, TeamTaskStatus, TeamTaskView, } from './types.ts';
|
|
8
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Typed Agent Teams failures. */
|
|
2
|
+
import { HarnessError } from '@qilin-agent/llm';
|
|
3
|
+
/** Stable failure raised by the Team domain. */
|
|
4
|
+
export declare class TeamError extends HarnessError {
|
|
5
|
+
constructor(message: string, code: string, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render an arbitrary thrown value without replacing the original rejection.
|
|
9
|
+
* @param error - caught value used in a diagnostic or durable failure record.
|
|
10
|
+
* @returns one bounded single-line description.
|
|
11
|
+
*/
|
|
12
|
+
export declare function errorMessage(error: unknown): string;
|
|
13
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Typed Agent Teams failures. */
|
|
2
|
+
import { inspect } from 'node:util';
|
|
3
|
+
import { HarnessError } from '@qilin-agent/llm';
|
|
4
|
+
/** Stable failure raised by the Team domain. */
|
|
5
|
+
export class TeamError extends HarnessError {
|
|
6
|
+
constructor(message, code, options) {
|
|
7
|
+
super(message, code, options);
|
|
8
|
+
this.name = 'TeamError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Render an arbitrary thrown value without replacing the original rejection.
|
|
13
|
+
* @param error - caught value used in a diagnostic or durable failure record.
|
|
14
|
+
* @returns one bounded single-line description.
|
|
15
|
+
*/
|
|
16
|
+
export function errorMessage(error) {
|
|
17
|
+
if (error instanceof Error)
|
|
18
|
+
return error.message;
|
|
19
|
+
if (typeof error === 'string')
|
|
20
|
+
return error;
|
|
21
|
+
return inspect(error, { breakLength: Infinity, compact: true, depth: 4 });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** Agent Teams service façade over roster, messaging, task, and runtime lifecycle owners. */
|
|
2
|
+
import { Context } from '@qilin-agent/kylin';
|
|
3
|
+
import z from '@qilin-agent/schemastery';
|
|
4
|
+
import type { Agent } from '@qilin-agent/agent';
|
|
5
|
+
import { TypertRemoteService } from '@qilin-agent/typert-protocol';
|
|
6
|
+
import type { TeamMembership } from './roster.ts';
|
|
7
|
+
import { TeamTaskId } from './types.ts';
|
|
8
|
+
import type { Config, CreateTeamTaskRequest, SendTeamMessageRequest, SendTeamMessageResult, SpawnTeammateRequest, SpawnTeammateResult, TeamMemberView, TeamTaskView, TeamWaitResult, UpdateTeamTaskRequest } from './types.ts';
|
|
9
|
+
export type * from './types.ts';
|
|
10
|
+
export type { TeamMembership } from './roster.ts';
|
|
11
|
+
export { TeamId, TeamMessageId, TeamTaskId } from './types.ts';
|
|
12
|
+
export { TeamError } from './error.ts';
|
|
13
|
+
declare module '@qilin-agent/kylin' {
|
|
14
|
+
interface Context {
|
|
15
|
+
agentTeams: TeamService;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Agent Teams service backed by the exact live Lead Session log. `createTask`
|
|
20
|
+
* and `updateTask` also carry the browser write bridge through the `agentTeams`
|
|
21
|
+
* Typert Remote namespace; the wire faces map domain failures onto the shared
|
|
22
|
+
* Remote failure vocabulary without changing the domain methods' contracts.
|
|
23
|
+
*/
|
|
24
|
+
export declare class TeamService extends TypertRemoteService {
|
|
25
|
+
static inject: string[];
|
|
26
|
+
static Config: z<Config>;
|
|
27
|
+
/** Validated deployment limits used by every Team operation. */
|
|
28
|
+
private readonly config;
|
|
29
|
+
private readonly activity;
|
|
30
|
+
private readonly lifecycle;
|
|
31
|
+
private readonly journal;
|
|
32
|
+
private readonly roster;
|
|
33
|
+
private readonly tasks;
|
|
34
|
+
constructor(ctx: Context, config?: Config);
|
|
35
|
+
/**
|
|
36
|
+
* Resolve one exact live Agent's Team role.
|
|
37
|
+
* @param agent - exact live Agent used as the authority credential.
|
|
38
|
+
* @returns its root, Team identity, role, and model-facing name.
|
|
39
|
+
*/
|
|
40
|
+
membership(agent: Agent): TeamMembership;
|
|
41
|
+
/**
|
|
42
|
+
* List the runtime-enriched roster visible to one Team member.
|
|
43
|
+
* @param agent - exact live Team member.
|
|
44
|
+
* @returns Lead and teammate rows in creation order.
|
|
45
|
+
*/
|
|
46
|
+
listMembers(agent: Agent): TeamMemberView[];
|
|
47
|
+
/**
|
|
48
|
+
* Create one named, continuable direct child of the Team Lead.
|
|
49
|
+
* @param caller - exact live Lead Agent.
|
|
50
|
+
* @param request - immutable name, description, prompt, context mode, provider, and cancellation.
|
|
51
|
+
* @returns the active roster row.
|
|
52
|
+
*/
|
|
53
|
+
spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<SpawnTeammateResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Steer one peer message into the target inbox or reject the attempt.
|
|
56
|
+
* @param caller - exact live sending Team member.
|
|
57
|
+
* @param request - target name, content, and cancellation before acceptance.
|
|
58
|
+
* @returns accepted inbox identity; acceptance follows normal Agent persistence and does not await model processing.
|
|
59
|
+
*/
|
|
60
|
+
sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Admit one peer message and steer it into the target's inbox.
|
|
63
|
+
* @param caller - exact live sending Team member.
|
|
64
|
+
* @param request - target name, content, and signal already joined with runtime cancellation.
|
|
65
|
+
* @returns the durable message identity carried by the delivered source.
|
|
66
|
+
*/
|
|
67
|
+
private sendAdmitted;
|
|
68
|
+
/**
|
|
69
|
+
* Create one unowned pending task in the Team Lead log.
|
|
70
|
+
* @param caller - exact live Team member creating the task.
|
|
71
|
+
* @param request - task text, blockers, and advisory write scopes.
|
|
72
|
+
* @returns the revision-one task view.
|
|
73
|
+
*/
|
|
74
|
+
createTask(caller: Agent, request: CreateTeamTaskRequest): Promise<TeamTaskView>;
|
|
75
|
+
/**
|
|
76
|
+
* Return one task, including a deleted tombstone.
|
|
77
|
+
* @param caller - exact live Team member reading the task.
|
|
78
|
+
* @param id - Team-local task identity.
|
|
79
|
+
* @returns the latest task value and derived readiness diagnostics.
|
|
80
|
+
*/
|
|
81
|
+
getTask(caller: Agent, id: TeamTaskId): TeamTaskView;
|
|
82
|
+
/**
|
|
83
|
+
* List current non-deleted tasks in numeric creation order.
|
|
84
|
+
* @param caller - exact live Team member reading the board.
|
|
85
|
+
* @returns detached current task views.
|
|
86
|
+
*/
|
|
87
|
+
listTasks(caller: Agent): TeamTaskView[];
|
|
88
|
+
/**
|
|
89
|
+
* Compare-and-set one authorized task transition.
|
|
90
|
+
* @param caller - exact live Team member authorizing the mutation.
|
|
91
|
+
* @param request - task identity, expected revision, action, and action fields.
|
|
92
|
+
* @returns the committed next task revision.
|
|
93
|
+
*/
|
|
94
|
+
updateTask(caller: Agent, request: UpdateTeamTaskRequest): Promise<TeamTaskView>;
|
|
95
|
+
/**
|
|
96
|
+
* Wire face of {@link TeamService.createTask}: create one shared task on a
|
|
97
|
+
* person's behalf through the browser write bridge.
|
|
98
|
+
* @param agent - exact live Team member resolved from the wire identity.
|
|
99
|
+
* @param request - subject, description, optional blockers, and optional write scopes.
|
|
100
|
+
* @returns the revision-one task view.
|
|
101
|
+
* @throws {RemoteError} `agent-team/not-a-member` when the identity is not a Team member, and
|
|
102
|
+
* `agent-team/rejected` when the domain refuses the request.
|
|
103
|
+
*/
|
|
104
|
+
remoteCreateTask(agent: Agent, request: CreateTeamTaskRequest): Promise<TeamTaskView>;
|
|
105
|
+
/**
|
|
106
|
+
* Wire face of {@link TeamService.updateTask}: commit one compare-and-set
|
|
107
|
+
* task transition on a person's behalf. A committed mutation is durable and
|
|
108
|
+
* never undone by a later wire cancellation.
|
|
109
|
+
* @param agent - exact live Team member resolved from the wire identity.
|
|
110
|
+
* @param request - task identity, expected revision, action, and action fields.
|
|
111
|
+
* @returns the committed next task view.
|
|
112
|
+
* @throws {RemoteError} `agent-team/not-a-member` when the identity is not a Team member,
|
|
113
|
+
* `agent-team/stale-revision` when the expected revision no longer matches, and
|
|
114
|
+
* `agent-team/rejected` when the domain refuses the transition.
|
|
115
|
+
*/
|
|
116
|
+
remoteUpdateTask(agent: Agent, request: UpdateTeamTaskRequest): Promise<TeamTaskView>;
|
|
117
|
+
/**
|
|
118
|
+
* Wait for the next Team-domain or member-status change.
|
|
119
|
+
* @param caller - exact live Team member waiting for activity.
|
|
120
|
+
* @param timeoutMs - bounded wait duration from ten seconds through one hour.
|
|
121
|
+
* @param signal - caller cancellation for the wait only.
|
|
122
|
+
* @returns one observed change or a timeout result.
|
|
123
|
+
*/
|
|
124
|
+
waitForChange(caller: Agent, timeoutMs: number, signal: AbortSignal): Promise<TeamWaitResult>;
|
|
125
|
+
/**
|
|
126
|
+
* Interrupt one live teammate turn without clearing its pending inbox.
|
|
127
|
+
* @param caller - exact live Lead Agent.
|
|
128
|
+
* @param targetName - durable teammate name.
|
|
129
|
+
* @returns the target status sampled before cancellation.
|
|
130
|
+
*/
|
|
131
|
+
interrupt(caller: Agent, targetName: string): {
|
|
132
|
+
previousStatus: 'running' | 'inactive';
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Resolve a caller without throwing, used by scoped-tool installation and observers.
|
|
136
|
+
* @param agent - candidate exact live Agent.
|
|
137
|
+
* @returns Team membership, or undefined for non-Team subagents and stale identities.
|
|
138
|
+
*/
|
|
139
|
+
tryMembership(agent: Agent): TeamMembership | undefined;
|
|
140
|
+
/** Queue one contained recovery pass after publication has unwound. */
|
|
141
|
+
private scheduleRecovery;
|
|
142
|
+
/** Reconcile roster provisioning when one Team member Session starts. */
|
|
143
|
+
private recoverFor;
|
|
144
|
+
/** Stop Team-owned live branches and release every waiter before service disposal completes. */
|
|
145
|
+
private disposeRuntime;
|
|
146
|
+
}
|
|
147
|
+
export default TeamService;
|
|
148
|
+
//# sourceMappingURL=index.d.ts.map
|