Skip to content

Commit 502e83a

Browse files
feat(tasks): add conditional claimability
MoltNet-Diary: c96a5197-c20c-40f9-91c4-88d505d4db36 Task-Group: conditional-task-claimability Task-Family: feature
1 parent 16099cf commit 502e83a

50 files changed

Lines changed: 7228 additions & 534 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/console/src/pages/TaskDetailPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export function TaskDetailPage({ id }: { id: string }) {
2525
}),
2626
refetchInterval: (query) =>
2727
query.state.data &&
28-
['queued', 'dispatched', 'running'].includes(query.state.data.status)
28+
['waiting', 'queued', 'dispatched', 'running'].includes(
29+
query.state.data.status,
30+
)
2931
? 5_000
3032
: false,
3133
});

apps/console/src/pages/TasksPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function TasksPage() {
4343
refetchInterval: (query) => {
4444
const hasActive = query.state.data?.pages.some((page) =>
4545
page.items.some((task) =>
46-
['queued', 'dispatched', 'running'].includes(task.status),
46+
['waiting', 'queued', 'dispatched', 'running'].includes(task.status),
4747
),
4848
);
4949
return hasActive ? 5_000 : false;
@@ -70,8 +70,8 @@ export function TasksPage() {
7070
<Stack gap={1}>
7171
<Text variant="h2">Tasks</Text>
7272
<Text color="muted">
73-
Track queued, running, failed, and completed work in the active
74-
team.
73+
Track waiting, queued, running, failed, and completed work in the
74+
active team.
7575
</Text>
7676
</Stack>
7777
<Button

apps/console/src/tasks/status.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { TaskStatus } from '@moltnet/api-client';
22

33
export const TASK_STATUS_FILTERS: TaskStatus[] = [
4+
'waiting',
45
'queued',
56
'dispatched',
67
'running',

apps/mcp-server/__tests__/task-tools.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const mockTask = {
6262
inputCid: 'bafy-input',
6363
references: [],
6464
correlationId: null,
65-
imposedByAgentId: '330e8400-e29b-41d4-a716-446655440091',
66-
imposedByHumanId: null,
65+
proposedByAgentId: '330e8400-e29b-41d4-a716-446655440091',
66+
proposedByHumanId: null,
6767
acceptedAttemptN: null,
6868
requiredExecutorTrustLevel: 'selfDeclared',
6969
allowedExecutors: [],
@@ -314,8 +314,8 @@ describe('Task tools', () => {
314314
status: 'queued',
315315
task_type: 'curate_pack',
316316
diary_id: DIARY_ID,
317-
imposed_by_agent_id: '330e8400-e29b-41d4-a716-446655440091',
318-
imposed_by_human_id: '330e8400-e29b-41d4-a716-446655440093',
317+
proposed_by_agent_id: '330e8400-e29b-41d4-a716-446655440091',
318+
proposed_by_human_id: '330e8400-e29b-41d4-a716-446655440093',
319319
claimed_by_agent_id: '330e8400-e29b-41d4-a716-446655440092',
320320
has_attempts: true,
321321
queued_after: '2026-04-28T10:00:00.000Z',
@@ -335,8 +335,8 @@ describe('Task tools', () => {
335335
status: 'queued',
336336
taskTypes: ['curate_pack'],
337337
diaryId: DIARY_ID,
338-
imposedByAgentId: '330e8400-e29b-41d4-a716-446655440091',
339-
imposedByHumanId: '330e8400-e29b-41d4-a716-446655440093',
338+
proposedByAgentId: '330e8400-e29b-41d4-a716-446655440091',
339+
proposedByHumanId: '330e8400-e29b-41d4-a716-446655440093',
340340
claimedByAgentId: '330e8400-e29b-41d4-a716-446655440092',
341341
hasAttempts: true,
342342
queuedAfter: '2026-04-28T10:00:00.000Z',

apps/mcp-server/src/schemas/task-schemas.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export type TasksSchemasInput = {};
4545
// definitions, which can make AJV-based MCP clients reject `tools/list`.
4646
const TaskStatusSchema = Type.Union([
4747
Type.Literal('queued'),
48+
Type.Literal('waiting'),
4849
Type.Literal('dispatched'),
4950
Type.Literal('running'),
5051
Type.Literal('completed'),
@@ -64,7 +65,7 @@ export const TaskCreateSchema = Type.Object({
6465
}),
6566
diary_id: Type.String({
6667
format: 'uuid',
67-
description: 'Diary ID the task is imposed against.',
68+
description: 'Diary ID the task is proposed against.',
6869
}),
6970
input: Type.Record(Type.String(), Type.Unknown(), {
7071
description: 'Task-type-specific input payload.',
@@ -171,16 +172,16 @@ export const TaskListSchema = Type.Object({
171172
description: 'Optional diary ID filter.',
172173
}),
173174
),
174-
imposed_by_agent_id: Type.Optional(
175+
proposed_by_agent_id: Type.Optional(
175176
Type.String({
176177
format: 'uuid',
177-
description: 'Optional requester agent ID filter.',
178+
description: 'Optional proposer agent ID filter.',
178179
}),
179180
),
180-
imposed_by_human_id: Type.Optional(
181+
proposed_by_human_id: Type.Optional(
181182
Type.String({
182183
format: 'uuid',
183-
description: 'Optional requester human ID filter.',
184+
description: 'Optional proposer human ID filter.',
184185
}),
185186
),
186187
claimed_by_agent_id: Type.Optional(
@@ -329,8 +330,8 @@ const TaskAppOpenFiltersOutputSchema = Type.Object({
329330
task_type: Type.Optional(Type.String()),
330331
correlation_id: Type.Optional(Type.String()),
331332
diary_id: Type.Optional(Type.String()),
332-
imposed_by_agent_id: Type.Optional(Type.String()),
333-
imposed_by_human_id: Type.Optional(Type.String()),
333+
proposed_by_agent_id: Type.Optional(Type.String()),
334+
proposed_by_human_id: Type.Optional(Type.String()),
334335
claimed_by_agent_id: Type.Optional(Type.String()),
335336
has_attempts: Type.Optional(Type.Boolean()),
336337
queued_after: Type.Optional(Type.String()),
@@ -371,18 +372,18 @@ export const TaskAppOpenSchema = Type.Object({
371372
description: 'Optional diary ID filter used to pre-load the queue.',
372373
}),
373374
),
374-
imposed_by_agent_id: Type.Optional(
375+
proposed_by_agent_id: Type.Optional(
375376
Type.String({
376377
format: 'uuid',
377378
description:
378-
'Optional requester agent ID filter used to pre-load the queue.',
379+
'Optional proposer agent ID filter used to pre-load the queue.',
379380
}),
380381
),
381-
imposed_by_human_id: Type.Optional(
382+
proposed_by_human_id: Type.Optional(
382383
Type.String({
383384
format: 'uuid',
384385
description:
385-
'Optional requester human ID filter used to pre-load the queue.',
386+
'Optional proposer human ID filter used to pre-load the queue.',
386387
}),
387388
),
388389
claimed_by_agent_id: Type.Optional(

apps/mcp-server/src/task-app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export function handleTasksAppOpen(
7171
task_type: args.task_type,
7272
correlation_id: args.correlation_id,
7373
diary_id: args.diary_id,
74-
imposed_by_agent_id: args.imposed_by_agent_id,
75-
imposed_by_human_id: args.imposed_by_human_id,
74+
proposed_by_agent_id: args.proposed_by_agent_id,
75+
proposed_by_human_id: args.proposed_by_human_id,
7676
claimed_by_agent_id: args.claimed_by_agent_id,
7777
has_attempts: args.has_attempts,
7878
queued_after: args.queued_after,

apps/mcp-server/src/task-tools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ export async function handleTasksList(
199199
taskTypes: args.task_type ? [args.task_type] : undefined,
200200
correlationId: args.correlation_id,
201201
diaryId: args.diary_id,
202-
imposedByAgentId: args.imposed_by_agent_id,
203-
imposedByHumanId: args.imposed_by_human_id,
202+
proposedByAgentId: args.proposed_by_agent_id,
203+
proposedByHumanId: args.proposed_by_human_id,
204204
claimedByAgentId: args.claimed_by_agent_id,
205205
hasAttempts: args.has_attempts,
206206
queuedAfter: args.queued_after,

apps/moltnet-cli/cobra_task.go

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -215,43 +215,43 @@ func newTaskListCmd() *cobra.Command {
215215
RunE: func(cmd *cobra.Command, args []string) error {
216216
credPath := flagString(cmd, "credentials")
217217
opts := taskListOpts{
218-
apiURL: resolveAPIURL(cmd, credPath),
219-
credPath: credPath,
220-
teamID: flagString(cmd, "team-id"),
221-
taskTypes: flagStringSlice(cmd, "task-types"),
222-
taskTypeAliases: flagStringArray(cmd, "task-type"),
223-
status: flagString(cmd, "status"),
224-
diaryID: flagString(cmd, "diary-id"),
225-
correlationID: flagString(cmd, "correlation-id"),
226-
imposedByAgentID: flagString(cmd, "imposed-by-agent-id"),
227-
imposedByHumanID: flagString(cmd, "imposed-by-human-id"),
228-
claimedByAgentID: flagString(cmd, "claimed-by-agent-id"),
229-
provider: flagString(cmd, "provider"),
230-
model: flagString(cmd, "model"),
231-
hasAttempts: flagBool(cmd, "has-attempts"),
232-
hasAttemptsSet: cmd.Flags().Changed("has-attempts"),
233-
queuedAfter: flagString(cmd, "queued-after"),
234-
queuedBefore: flagString(cmd, "queued-before"),
235-
completedAfter: flagString(cmd, "completed-after"),
236-
completedBefore: flagString(cmd, "completed-before"),
237-
limit: flagInt(cmd, "limit"),
238-
limitSet: cmd.Flags().Changed("limit"),
239-
cursor: flagString(cmd, "cursor"),
240-
cursorSet: cmd.Flags().Changed("cursor"),
241-
taskTypesSet: cmd.Flags().Changed("task-types"),
242-
taskTypeAliasesSet: cmd.Flags().Changed("task-type"),
243-
statusSet: cmd.Flags().Changed("status"),
244-
diaryIDSet: cmd.Flags().Changed("diary-id"),
245-
correlationIDSet: cmd.Flags().Changed("correlation-id"),
246-
imposedByAgentIDSet: cmd.Flags().Changed("imposed-by-agent-id"),
247-
imposedByHumanIDSet: cmd.Flags().Changed("imposed-by-human-id"),
248-
claimedByAgentIDSet: cmd.Flags().Changed("claimed-by-agent-id"),
249-
providerSet: cmd.Flags().Changed("provider"),
250-
modelSet: cmd.Flags().Changed("model"),
251-
queuedAfterSet: cmd.Flags().Changed("queued-after"),
252-
queuedBeforeSet: cmd.Flags().Changed("queued-before"),
253-
completedAfterSet: cmd.Flags().Changed("completed-after"),
254-
completedBeforeSet: cmd.Flags().Changed("completed-before"),
218+
apiURL: resolveAPIURL(cmd, credPath),
219+
credPath: credPath,
220+
teamID: flagString(cmd, "team-id"),
221+
taskTypes: flagStringSlice(cmd, "task-types"),
222+
taskTypeAliases: flagStringArray(cmd, "task-type"),
223+
status: flagString(cmd, "status"),
224+
diaryID: flagString(cmd, "diary-id"),
225+
correlationID: flagString(cmd, "correlation-id"),
226+
proposedByAgentID: flagString(cmd, "proposed-by-agent-id"),
227+
proposedByHumanID: flagString(cmd, "proposed-by-human-id"),
228+
claimedByAgentID: flagString(cmd, "claimed-by-agent-id"),
229+
provider: flagString(cmd, "provider"),
230+
model: flagString(cmd, "model"),
231+
hasAttempts: flagBool(cmd, "has-attempts"),
232+
hasAttemptsSet: cmd.Flags().Changed("has-attempts"),
233+
queuedAfter: flagString(cmd, "queued-after"),
234+
queuedBefore: flagString(cmd, "queued-before"),
235+
completedAfter: flagString(cmd, "completed-after"),
236+
completedBefore: flagString(cmd, "completed-before"),
237+
limit: flagInt(cmd, "limit"),
238+
limitSet: cmd.Flags().Changed("limit"),
239+
cursor: flagString(cmd, "cursor"),
240+
cursorSet: cmd.Flags().Changed("cursor"),
241+
taskTypesSet: cmd.Flags().Changed("task-types"),
242+
taskTypeAliasesSet: cmd.Flags().Changed("task-type"),
243+
statusSet: cmd.Flags().Changed("status"),
244+
diaryIDSet: cmd.Flags().Changed("diary-id"),
245+
correlationIDSet: cmd.Flags().Changed("correlation-id"),
246+
proposedByAgentIDSet: cmd.Flags().Changed("proposed-by-agent-id"),
247+
proposedByHumanIDSet: cmd.Flags().Changed("proposed-by-human-id"),
248+
claimedByAgentIDSet: cmd.Flags().Changed("claimed-by-agent-id"),
249+
providerSet: cmd.Flags().Changed("provider"),
250+
modelSet: cmd.Flags().Changed("model"),
251+
queuedAfterSet: cmd.Flags().Changed("queued-after"),
252+
queuedBeforeSet: cmd.Flags().Changed("queued-before"),
253+
completedAfterSet: cmd.Flags().Changed("completed-after"),
254+
completedBeforeSet: cmd.Flags().Changed("completed-before"),
255255
}
256256
return runTaskListCmd(opts)
257257
},
@@ -262,8 +262,8 @@ func newTaskListCmd() *cobra.Command {
262262
cmd.Flags().String("status", "", "Filter by task status")
263263
cmd.Flags().String("diary-id", "", "Filter by diary UUID")
264264
cmd.Flags().String("correlation-id", "", "Filter by correlation UUID")
265-
cmd.Flags().String("imposed-by-agent-id", "", "Filter by imposing agent UUID")
266-
cmd.Flags().String("imposed-by-human-id", "", "Filter by imposing human UUID")
265+
cmd.Flags().String("proposed-by-agent-id", "", "Filter by proposing agent UUID")
266+
cmd.Flags().String("proposed-by-human-id", "", "Filter by proposing human UUID")
267267
cmd.Flags().String("claimed-by-agent-id", "", "Filter by claimed agent UUID")
268268
cmd.Flags().String("provider", "", "Filter by executor provider; requires --model")
269269
cmd.Flags().String("model", "", "Filter by executor model; requires --provider")

apps/moltnet-cli/task.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,36 +39,36 @@ type taskListOpts struct {
3939
taskTypeAliases []string
4040
taskTypeAliasesSet bool
4141

42-
status string
43-
statusSet bool
44-
diaryID string
45-
diaryIDSet bool
46-
correlationID string
47-
correlationIDSet bool
48-
imposedByAgentID string
49-
imposedByAgentIDSet bool
50-
imposedByHumanID string
51-
imposedByHumanIDSet bool
52-
claimedByAgentID string
53-
claimedByAgentIDSet bool
54-
provider string
55-
providerSet bool
56-
model string
57-
modelSet bool
58-
hasAttempts bool
59-
hasAttemptsSet bool
60-
queuedAfter string
61-
queuedAfterSet bool
62-
queuedBefore string
63-
queuedBeforeSet bool
64-
completedAfter string
65-
completedAfterSet bool
66-
completedBefore string
67-
completedBeforeSet bool
68-
limit int
69-
limitSet bool
70-
cursor string
71-
cursorSet bool
42+
status string
43+
statusSet bool
44+
diaryID string
45+
diaryIDSet bool
46+
correlationID string
47+
correlationIDSet bool
48+
proposedByAgentID string
49+
proposedByAgentIDSet bool
50+
proposedByHumanID string
51+
proposedByHumanIDSet bool
52+
claimedByAgentID string
53+
claimedByAgentIDSet bool
54+
provider string
55+
providerSet bool
56+
model string
57+
modelSet bool
58+
hasAttempts bool
59+
hasAttemptsSet bool
60+
queuedAfter string
61+
queuedAfterSet bool
62+
queuedBefore string
63+
queuedBeforeSet bool
64+
completedAfter string
65+
completedAfterSet bool
66+
completedBefore string
67+
completedBeforeSet bool
68+
limit int
69+
limitSet bool
70+
cursor string
71+
cursorSet bool
7272
}
7373

7474
func runTaskListCmd(opts taskListOpts) error {
@@ -131,13 +131,13 @@ func buildListTasksParams(opts taskListOpts) (moltnetapi.ListTasksParams, error)
131131
return moltnetapi.ListTasksParams{}, err
132132
}
133133
}
134-
if opts.imposedByAgentIDSet {
135-
if params.ImposedByAgentId, err = parseOptUUIDFlag("imposed-by-agent-id", opts.imposedByAgentID); err != nil {
134+
if opts.proposedByAgentIDSet {
135+
if params.ProposedByAgentId, err = parseOptUUIDFlag("proposed-by-agent-id", opts.proposedByAgentID); err != nil {
136136
return moltnetapi.ListTasksParams{}, err
137137
}
138138
}
139-
if opts.imposedByHumanIDSet {
140-
if params.ImposedByHumanId, err = parseOptUUIDFlag("imposed-by-human-id", opts.imposedByHumanID); err != nil {
139+
if opts.proposedByHumanIDSet {
140+
if params.ProposedByHumanId, err = parseOptUUIDFlag("proposed-by-human-id", opts.proposedByHumanID); err != nil {
141141
return moltnetapi.ListTasksParams{}, err
142142
}
143143
}

0 commit comments

Comments
 (0)