Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
feat(proactive): keep Tasks started by a proactive wake quiet
muterC676b56ebb5bc
diff --git a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts b/apps/node-services/src/agent/prompt/compact-meta-instructions.tsindex fab94a15..5e5b8c62 100644--- a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts+++ b/apps/node-services/src/agent/prompt/compact-meta-instructions.ts@@ -82,7 +82,7 @@ const ROOM_TASKS = `- Delegate research and multi-step investigation to your Alt${OWN_BROWSER}${TASK_BRIEF}`;-const TASK_COORDINATION = `- After creating a Task, say in a line that it's under way, then move on. Don't wait or check on it; its report wakes you.+const TASK_COORDINATION = `- After creating a Task, say in a line that it's under way, then move on; during a proactive wake or a Routine that serves a Tracking Item, say nothing about it, and its report tells you how to remind. Don't wait or check on it; its report wakes you.- The report is private to you. Read its outputs in ./playground/<task-id>/ and deliver the result with one message: teamhub message send --content "<the result in a few sentences>" --attach ./playground/<task-id>/<file>. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"<path>"}. If it failed or needs a decision, say so in an ordinary message.- teamhub task send --task-id <id> --message "..." corrects or continues a Task (--steer changes its current turn); teamhub task stop --task-id <id> stops it; teamhub task check shows how it really stands.- Approval cards for a Task's actions appear here and go to the AlterEgo; don't relay them.`;diff --git a/apps/node-services/src/agent/prompt/meta-instructions.ts b/apps/node-services/src/agent/prompt/meta-instructions.tsindex e2b50094..2aa0f477 100644--- a/apps/node-services/src/agent/prompt/meta-instructions.ts+++ b/apps/node-services/src/agent/prompt/meta-instructions.ts@@ -136,7 +136,7 @@ ${OWN_BROWSER}${TASK_BRIEF}`;const TASK_COORDINATION = `- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonlindex 8b560e31..857d499c 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt b/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txtindex c01cea95..d6fef8b5 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt@@ -82,7 +82,7 @@ In this Room you are a collaborator: you work on a Human's explicit request or o- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonlindex d3e00880..f98966e9 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonlindex b50287e1..66789e85 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonlindex 240d48a7..6020a244 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonlindex 980728bf..2cbdd47b 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonlindex 00459689..d8f2090e 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"mark":"stop during submit"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"step":"state.cancelLocalRun","runId":"run-1","status":"canceled"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonlindex 72518f89..e04c292b 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonlindex 36a626b5..d339f636 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"prepareInput","feature":"trace-failing","threw":true}diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonlindex 25bcbfa8..c08322e1 100644--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl@@ -2,7 +2,7 @@{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}-{"step":"backend.activate","developerInstructions":"sha256:1db0a3bed6d7ca38","mappings":1}+{"step":"backend.activate","developerInstructions":"sha256:9f5586a54d7ab037","mappings":1}{"step":"provider.createSession"}{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}{"hook":"context.prepareInput","messageId":"m-1"}diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txtindex de3f183a..f5b8e8c5 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt@@ -45,7 +45,7 @@ In this Room you orchestrate work addressed to you, and contribute too.- Delegate research and multi-step investigation to your AlterEgo so the Room isn't blocked on you: teamhub task create --name "<title>" --requirement "<brief>" (--requirement-file for a long brief). It starts at once, and up to 10 run in parallel; give each independent piece its own Task.- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't see this conversation or message anyone. Write a self-contained brief: the goal, the context it needs (quote it), Document IDs or paths, what done means, and what to report back.-- After creating a Task, say in a line that it's under way, then move on. Don't wait or check on it; its report wakes you.+- After creating a Task, say in a line that it's under way, then move on; during a proactive wake or a Routine that serves a Tracking Item, say nothing about it, and its report tells you how to remind. Don't wait or check on it; its report wakes you.- The report is private to you. Read its outputs in ./playground/<task-id>/ and deliver the result with one message: teamhub message send --content "<the result in a few sentences>" --attach ./playground/<task-id>/<file>. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"<path>"}. If it failed or needs a decision, say so in an ordinary message.- teamhub task send --task-id <id> --message "..." corrects or continues a Task (--steer changes its current turn); teamhub task stop --task-id <id> stops it; teamhub task check shows how it really stands.- Approval cards for a Task's actions appear here and go to the AlterEgo; don't relay them.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-unconfigured.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-unconfigured.txtindex 82337c93..9854db91 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-unconfigured.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-unconfigured.txt@@ -85,7 +85,7 @@ In this Room you are the orchestrator for work addressed to you, and a contribut- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txtindex 49cb4b5a..53b8c778 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt@@ -85,7 +85,7 @@ In this Room you are the orchestrator for work addressed to you, and a contribut- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txtindex 542a46df..a6d37968 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt@@ -44,7 +44,7 @@ Stay available: keep your own turns short and delegate heavier work.- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't see this conversation or message anyone. Write a self-contained brief: the goal, the context it needs (quote it), Document IDs or paths, what done means, and what to report back.- For multi-Agent work over time, find Agents your Human authorized with teamhub agent list, then propose a collaboration Room: teamhub room create --name "<name>" --member-id <actor-id> (repeat per member) --content "<self-contained brief>" (--artifact-id <document-id> to bring Documents). It waits for approval; then continue the work there.-- After creating a Task, say in a line that it's under way, then move on. Don't wait or check on it; its report wakes you.+- After creating a Task, say in a line that it's under way, then move on; during a proactive wake or a Routine that serves a Tracking Item, say nothing about it, and its report tells you how to remind. Don't wait or check on it; its report wakes you.- The report is private to you. Read its outputs in ./playground/<task-id>/ and deliver the result with one message: teamhub message send --content "<the result in a few sentences>" --attach ./playground/<task-id>/<file>. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"<path>"}. If it failed or needs a decision, say so in an ordinary message.- teamhub task send --task-id <id> --message "..." corrects or continues a Task (--steer changes its current turn); teamhub task stop --task-id <id> stops it; teamhub task check shows how it really stands.- Approval cards for a Task's actions appear here and go to the AlterEgo; don't relay them.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-unconfigured.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-unconfigured.txtindex 125f5cd6..9d7cbb56 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-unconfigured.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-unconfigured.txt@@ -80,7 +80,7 @@ Stay available to your Human: keep your own turns short (a reply, a quick lookup- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- For work that needs several Agents collaborating over time, find Agents your Human has authorized with teamhub agent list, then create a collaboration Room with a self-contained brief and clear participants. Creating it also asks for approval. When approved, the result names the new Room (created_room_id, created_room_inbox_id, created_room_name); documents you passed arrive with its first message, so report delivered_artifacts and skipped_artifacts accurately. A Room existing doesn't mean anyone has started work there. Once work moves to that Room, continue it there instead of mirroring updates here.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txtindex 271f35f1..69e33029 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt@@ -80,7 +80,7 @@ Stay available to your Human: keep your own turns short (a reply, a quick lookup- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- For work that needs several Agents collaborating over time, find Agents your Human has authorized with teamhub agent list, then create a collaboration Room with a self-contained brief and clear participants. Creating it also asks for approval. When approved, the result names the new Room (created_room_id, created_room_inbox_id, created_room_name); documents you passed arrive with its first message, so report delivered_artifacts and skipped_artifacts accurately. A Room existing doesn't mean anyone has started work there. Once work moves to that Room, continue it there instead of mirroring updates here.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txtindex 5ecc98ef..6395c0d9 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt@@ -44,7 +44,7 @@ In this Room you work on a Human's explicit request or an explicit Assignment; a- Delegate research and multi-step investigation to your AlterEgo so the Room isn't blocked on you: teamhub task create --name "<title>" --requirement "<brief>" (--requirement-file for a long brief). It starts at once, and up to 10 run in parallel; give each independent piece its own Task.- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't see this conversation or message anyone. Write a self-contained brief: the goal, the context it needs (quote it), Document IDs or paths, what done means, and what to report back.-- After creating a Task, say in a line that it's under way, then move on. Don't wait or check on it; its report wakes you.+- After creating a Task, say in a line that it's under way, then move on; during a proactive wake or a Routine that serves a Tracking Item, say nothing about it, and its report tells you how to remind. Don't wait or check on it; its report wakes you.- The report is private to you. Read its outputs in ./playground/<task-id>/ and deliver the result with one message: teamhub message send --content "<the result in a few sentences>" --attach ./playground/<task-id>/<file>. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"<path>"}. If it failed or needs a decision, say so in an ordinary message.- teamhub task send --task-id <id> --message "..." corrects or continues a Task (--steer changes its current turn); teamhub task stop --task-id <id> stops it; teamhub task check shows how it really stands.- Approval cards for a Task's actions appear here and go to the AlterEgo; don't relay them.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-unconfigured.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-unconfigured.txtindex f7c0ab41..ecef13df 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-unconfigured.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-unconfigured.txt@@ -80,7 +80,7 @@ In this Room you are a collaborator: you work on a Human's explicit request or o- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txtindex fb594c3d..cc4a5276 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt@@ -80,7 +80,7 @@ In this Room you are a collaborator: you work on a Human's explicit request or o- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txtindex e171e695..a457e8a1 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt@@ -43,7 +43,7 @@ Stay available: keep your own turns short and delegate heavier work.- Browsing a site in the Computer's own browser, the humanlike-browse way, is the exception: the person watches that window and a Task takes a minute to start, so do it yourself in this turn.- The AlterEgo can't see this conversation or message anyone. Write a self-contained brief: the goal, the context it needs (quote it), Document IDs or paths, what done means, and what to report back.- Don't create Rooms or dispatch other Agents; tell the person when another role is needed.-- After creating a Task, say in a line that it's under way, then move on. Don't wait or check on it; its report wakes you.+- After creating a Task, say in a line that it's under way, then move on; during a proactive wake or a Routine that serves a Tracking Item, say nothing about it, and its report tells you how to remind. Don't wait or check on it; its report wakes you.- The report is private to you. Read its outputs in ./playground/<task-id>/ and deliver the result with one message: teamhub message send --content "<the result in a few sentences>" --attach ./playground/<task-id>/<file>. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"<path>"}. If it failed or needs a decision, say so in an ordinary message.- teamhub task send --task-id <id> --message "..." corrects or continues a Task (--steer changes its current turn); teamhub task stop --task-id <id> stops it; teamhub task check shows how it really stands.- Approval cards for a Task's actions appear here and go to the AlterEgo; don't relay them.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-unconfigured.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-unconfigured.txtindex 04c54b9e..3e05f859 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-unconfigured.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-unconfigured.txt@@ -78,7 +78,7 @@ Take requests that fit your role and stay available to the person: keep your own- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- Don't create collaboration Rooms or dispatch other Agents. When the request needs another role, tell the person.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txtindex 7c7f61a1..4a8b71ff 100644--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt@@ -78,7 +78,7 @@ Take requests that fit your role and stay available to the person: keep your own- The AlterEgo can't read this Room, so write a self-contained requirement: what to do, the context from this conversation it needs (quote it), Document IDs or file paths, what counts as done, and what to report back. It can't reach people and reports only to you, so don't ask it to message anyone.- Don't create collaboration Rooms or dispatch other Agents. When the request needs another role, tell the person.- A Task runs as a separate AlterEgo of you in the background; its progress is not yours. Don't redo its work here.-- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. Don't wait for it or keep checking on it: its report wakes you.+- Once it's created, tell the person in a line that it's under way, unless nobody is waiting on you; then carry on with other work or end your turn. A Task you create during a proactive wake or a Routine that serves a Tracking Item is quiet: say nothing about it, and its report tells you how to remind. Don't wait for it or keep checking on it: its report wakes you.- When it ends a turn you get a private Task report with its final reply; nobody else sees it. Read its outputs in ./playground/<task-id>/ (live, also while it runs), then decide what this Room needs. When the Task is done, deliver it with one teamhub message send: the result in a few sentences, and its files with --attach. When the result includes an existing Document, send one complete --message instead, without --content or --attach: {"segments":[{"type":"text","content":"<the result>"},{"type":"document","document_id":"<document-id>","content":"<title>","presentation":"card"}]}; a file goes in it as {"type":"document","content-path":"./playground/<task-id>/<file>"}. If it failed or needs a decision, say so in an ordinary message; say nothing when there is nothing worth saying. Keep message card for things the person must notice. docs create only imports inline data:image images; put local images in with teamhub docs image put.- teamhub task send --task-id <id> --message "..." continues or corrects a Task (it queues while the Task is running; add --steer to change the turn in progress); send follow-ups and corrections there instead of creating another Task. teamhub task stop --task-id <id> cancels the current turn and keeps its work. A stopped, failed, or idle Task resumes with task send.- Run teamhub task check before you tell someone how a Task is going, or when it seems stuck, and say how it really stands; don't use it to wait for the result.diff --git a/apps/teamhub/internal/collaboration/room_control.go b/apps/teamhub/internal/collaboration/room_control.goindex 5c1d1130..366cc6af 100644--- a/apps/teamhub/internal/collaboration/room_control.go+++ b/apps/teamhub/internal/collaboration/room_control.go@@ -161,6 +161,12 @@ func (s *Service) RoomBackgroundTasks(ctx context.Context, accountID, roomID str}items := make([]httpapi.RoomBackgroundTask, 0, len(rows))for _, row := range rows {+ // A Task started during a proactive wake or a Routine that serves a+ // Tracking Item stays out of the indicator; it keeps its origin link+ // for task check, send and stop.+ if row.Quiet {+ continue+ }items = append(items, httpapi.RoomBackgroundTask{Id: row.ID, Title: row.Title, Requirement: row.Description, CreatedAt: row.CreatedAt.Time})}return items, nildiff --git a/apps/teamhub/internal/store/models.go b/apps/teamhub/internal/store/models.goindex 0ac56e6d..b1913268 100644--- a/apps/teamhub/internal/store/models.go+++ b/apps/teamhub/internal/store/models.go@@ -1988,6 +1988,7 @@ type WorkItem struct {TaskLeaseTokenHash []byte `json:"task_lease_token_hash"`TaskLeaseGeneration pgtype.Int8 `json:"task_lease_generation"`TaskLeaseExpiresAt pgtype.Timestamptz `json:"task_lease_expires_at"`+ Quiet bool `json:"quiet"`}type WorkItemAccessGrant struct {diff --git a/apps/teamhub/internal/store/queries/task_delegation.sql b/apps/teamhub/internal/store/queries/task_delegation.sqlindex 2b1ef02d..f70364e5 100644--- a/apps/teamhub/internal/store/queries/task_delegation.sql+++ b/apps/teamhub/internal/store/queries/task_delegation.sql@@ -119,8 +119,9 @@ LIMIT 50;-- name: ListRoomRunningTasks :many-- The Tasks running for this Room, oldest first: the background Tasks its Meta-- delegated and the tasks Live started with it as their home Room; live--- marks the latter, which have no Meta.-SELECT item.id, item.title, item.description, item.created_at,+-- marks the latter, which have no Meta. quiet marks a Task started during a+-- proactive wake or a Routine that serves a Tracking Item.+SELECT item.id, item.title, item.description, item.created_at, item.quiet,EXISTS (SELECT 1 FROM voice_live_tasks voice WHERE voice.work_item_id=item.id)::boolean AS liveFROM work_items itemWHERE item.id IN (diff --git a/apps/teamhub/internal/store/queries/task_execution.sql b/apps/teamhub/internal/store/queries/task_execution.sqlindex 05b2dde4..bb4fc7fd 100644--- a/apps/teamhub/internal/store/queries/task_execution.sql+++ b/apps/teamhub/internal/store/queries/task_execution.sql@@ -126,6 +126,7 @@ UPDATE work_itemsSET state=sqlc.arg(work_item_state)::text,resolution=NULL,task_source_key=sqlc.narg(source_key)::text,+ quiet=sqlc.arg(quiet)::boolean,task_execution_generation=sqlc.arg(generation)::bigint,task_execution_status=sqlc.arg(execution_status)::text,task_execution_revision=sqlc.arg(execution_revision)::bigint,@@ -193,7 +194,7 @@ WHERE registration.agent_management_id=sqlc.arg(agent_management_id)::text-- name: LockTaskExecutionSnapshot :oneSELECT item.id AS task_id,item.tenant_id,item.title,item.state AS work_item_state,item.resolution,item.version,- item.task_source_key,item.task_execution_generation,+ item.quiet,item.task_source_key,item.task_execution_generation,item.task_execution_status,item.task_execution_revision,item.task_execution_reason_code,item.task_desired_control,item.task_control_revision,item.task_control_settled_revision,item.task_control_outcome,item.task_control_payload,item.task_execution_updated_at,diff --git a/apps/teamhub/internal/store/queries/task_execution_worker.sql b/apps/teamhub/internal/store/queries/task_execution_worker.sqlindex 5eba3d77..b7735b69 100644--- a/apps/teamhub/internal/store/queries/task_execution_worker.sql+++ b/apps/teamhub/internal/store/queries/task_execution_worker.sql@@ -34,7 +34,7 @@ SET task_worker_id=sqlc.arg(worker_id)::text,task_next_reconcile_at=clock_timestamp()+make_interval(secs=>sqlc.arg(lease_seconds)::int)FROM candidateWHERE item.id=candidate.id-RETURNING item.id AS task_id,item.task_worker_id,item.task_lease_generation,item.task_lease_expires_at;+RETURNING item.id AS task_id,item.task_worker_id,item.task_lease_generation,item.task_lease_expires_at, item.quiet;-- name: NextTaskExecutionClaimDelay :one-- Milliseconds on the database clock until the earliest Task satisfies the@@ -62,7 +62,7 @@ FROM (HAVING min(ready.ready_at) IS NOT NULL;-- name: GetTaskExecutionWorkerLease :one-SELECT id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at+SELECT id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at, quietFROM work_itemsWHERE id=sqlc.arg(task_id)::textAND task_worker_id=sqlc.arg(worker_id)::text@@ -118,7 +118,7 @@ WHERE id=sqlc.arg(task_id)::textAND task_lease_token_hash=sqlc.arg(lease_token_hash)::byteaAND task_lease_expires_at>clock_timestamp()AND (SELECT count(*) FROM extended_effects)>=0-RETURNING id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at;+RETURNING id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at, quiet;-- name: ScheduleTaskExecutionReconcile :one-- The running Attempt's deadline caps the delay, so the timeout needs nodiff --git a/apps/teamhub/internal/store/queries/typed_card.sql b/apps/teamhub/internal/store/queries/typed_card.sqlindex 9d2750cc..5da74437 100644--- a/apps/teamhub/internal/store/queries/typed_card.sql+++ b/apps/teamhub/internal/store/queries/typed_card.sql@@ -13,7 +13,7 @@ RETURNING id,tenant_id,number,kind,title,description,priority,state,resolution,vtask_control_source_kind,task_control_source_id,task_control_requested_by_actor_id,task_control_requested_at,task_control_payload,task_execution_updated_at,task_next_reconcile_at,task_worker_id,- task_lease_token_hash,task_lease_generation,task_lease_expires_at;+ task_lease_token_hash,task_lease_generation,task_lease_expires_at, quiet;-- name: CreateMessageCard :execINSERT INTO message_cards(@@ -44,7 +44,7 @@ SELECT id,tenant_id,number,kind,title,description,priority,state,resolution,verstask_control_source_kind,task_control_source_id,task_control_requested_by_actor_id,task_control_requested_at,task_control_payload,task_execution_updated_at,task_next_reconcile_at,task_worker_id,- task_lease_token_hash,task_lease_generation,task_lease_expires_at+ task_lease_token_hash,task_lease_generation,task_lease_expires_at, quietFROM work_itemsWHERE id=$1;diff --git a/apps/teamhub/internal/store/queries/work_item.sql b/apps/teamhub/internal/store/queries/work_item.sqlindex 8014e076..6cf86713 100644--- a/apps/teamhub/internal/store/queries/work_item.sql+++ b/apps/teamhub/internal/store/queries/work_item.sql@@ -26,7 +26,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at;+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet;-- name: GetWorkItemForHuman :oneSELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priority,@@ -38,7 +38,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=sqlc.arg(id)::textAND EXISTS (@@ -58,7 +58,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=sqlc.arg(id)::textAND EXISTS (@@ -79,7 +79,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.tenant_id=sqlc.arg(tenant_id)::textAND EXISTS (@@ -167,7 +167,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at;+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet;-- name: TransitionWorkItem :oneUPDATE work_items@@ -185,7 +185,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at;+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet;-- name: SetWorkItemArchived :oneUPDATE work_items@@ -202,7 +202,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at;+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet;-- name: TouchWorkItem :execUPDATE work_itemsdiff --git a/apps/teamhub/internal/store/queries/work_item_comment.sql b/apps/teamhub/internal/store/queries/work_item_comment.sqlindex b784e63f..350b015d 100644--- a/apps/teamhub/internal/store/queries/work_item_comment.sql+++ b/apps/teamhub/internal/store/queries/work_item_comment.sql@@ -19,7 +19,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=sqlc.arg(id)::textAND wi.tenant_id=sqlc.arg(tenant_id)::text@@ -57,7 +57,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=sqlc.arg(id)::textAND wi.tenant_id=sqlc.arg(tenant_id)::text@@ -80,7 +80,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.tenant_id=sqlc.arg(tenant_id)::textAND (sqlc.arg(kind_filter)::text = '' OR wi.kind=sqlc.arg(kind_filter)::text)diff --git a/apps/teamhub/internal/store/task_delegation.sql.go b/apps/teamhub/internal/store/task_delegation.sql.goindex 70d532da..3594b7e4 100644--- a/apps/teamhub/internal/store/task_delegation.sql.go+++ b/apps/teamhub/internal/store/task_delegation.sql.go@@ -324,7 +324,7 @@ func (q *Queries) ListRoomBackgroundTasks(ctx context.Context, arg ListRoomBackg}const listRoomRunningTasks = `-- name: ListRoomRunningTasks :many-SELECT item.id, item.title, item.description, item.created_at,+SELECT item.id, item.title, item.description, item.created_at, item.quiet,EXISTS (SELECT 1 FROM voice_live_tasks voice WHERE voice.work_item_id=item.id)::boolean AS liveFROM work_items itemWHERE item.id IN (@@ -349,12 +349,14 @@ type ListRoomRunningTasksRow struct {Title string `json:"title"`Description string `json:"description"`CreatedAt pgtype.Timestamptz `json:"created_at"`+ Quiet bool `json:"quiet"`Live bool `json:"live"`}// The Tasks running for this Room, oldest first: the background Tasks its Meta// delegated and the tasks Live started with it as their home Room; live-// marks the latter, which have no Meta.+// marks the latter, which have no Meta. quiet marks a Task started during a+// proactive wake or a Routine that serves a Tracking Item.func (q *Queries) ListRoomRunningTasks(ctx context.Context, arg ListRoomRunningTasksParams) ([]ListRoomRunningTasksRow, error) {rows, err := q.db.Query(ctx, listRoomRunningTasks, arg.RoomID, arg.TenantID)if err != nil {@@ -369,6 +371,7 @@ func (q *Queries) ListRoomRunningTasks(ctx context.Context, arg ListRoomRunningT&i.Title,&i.Description,&i.CreatedAt,+ &i.Quiet,&i.Live,); err != nil {return nil, errdiff --git a/apps/teamhub/internal/store/task_execution.sql.go b/apps/teamhub/internal/store/task_execution.sql.goindex 8bb93151..14f26823 100644--- a/apps/teamhub/internal/store/task_execution.sql.go+++ b/apps/teamhub/internal/store/task_execution.sql.go@@ -26,7 +26,7 @@ WHERE id=$5::textAND task_execution_revision=$8::bigintAND task_control_revision=$9::bigintAND task_execution_status=$10::text-RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at+RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type AdvanceTaskExecutionStatusParams struct {@@ -92,6 +92,7 @@ func (q *Queries) AdvanceTaskExecutionStatus(ctx context.Context, arg AdvanceTas&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -1038,7 +1039,7 @@ func (q *Queries) LockHumanTaskInputTargetByWorkRoom(ctx context.Context, arg Loconst lockTaskExecutionSnapshot = `-- name: LockTaskExecutionSnapshot :oneSELECT item.id AS task_id,item.tenant_id,item.title,item.state AS work_item_state,item.resolution,item.version,- item.task_source_key,item.task_execution_generation,+ item.quiet,item.task_source_key,item.task_execution_generation,item.task_execution_status,item.task_execution_revision,item.task_execution_reason_code,item.task_desired_control,item.task_control_revision,item.task_control_settled_revision,item.task_control_outcome,item.task_control_payload,item.task_execution_updated_at,@@ -1063,6 +1064,7 @@ type LockTaskExecutionSnapshotRow struct {WorkItemState string `json:"work_item_state"`Resolution pgtype.Text `json:"resolution"`Version int64 `json:"version"`+ Quiet bool `json:"quiet"`TaskSourceKey pgtype.Text `json:"task_source_key"`TaskExecutionGeneration pgtype.Int8 `json:"task_execution_generation"`TaskExecutionStatus pgtype.Text `json:"task_execution_status"`@@ -1090,6 +1092,7 @@ func (q *Queries) LockTaskExecutionSnapshot(ctx context.Context, taskID string)&i.WorkItemState,&i.Resolution,&i.Version,+ &i.Quiet,&i.TaskSourceKey,&i.TaskExecutionGeneration,&i.TaskExecutionStatus,@@ -1160,9 +1163,10 @@ UPDATE work_itemsSET state=$1::text,resolution=NULL,task_source_key=$2::text,- task_execution_generation=$3::bigint,- task_execution_status=$4::text,- task_execution_revision=$5::bigint,+ quiet=$3::boolean,+ task_execution_generation=$4::bigint,+ task_execution_status=$5::text,+ task_execution_revision=$6::bigint,task_execution_reason_code=NULL,task_desired_control='run',task_control_revision=0,@@ -1171,16 +1175,17 @@ SET state=$1::text,task_execution_updated_at=clock_timestamp(),task_next_reconcile_at=clock_timestamp(),task_lease_generation=0-WHERE id=$6::text- AND tenant_id=$7::text+WHERE id=$7::text+ AND tenant_id=$8::textAND kind='task'AND task_execution_generation IS NULL-RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at+RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type PromoteTaskToManagedExecutionParams struct {WorkItemState string `json:"work_item_state"`SourceKey pgtype.Text `json:"source_key"`+ Quiet bool `json:"quiet"`Generation int64 `json:"generation"`ExecutionStatus string `json:"execution_status"`ExecutionRevision int64 `json:"execution_revision"`@@ -1192,6 +1197,7 @@ func (q *Queries) PromoteTaskToManagedExecution(ctx context.Context, arg Promoterow := q.db.QueryRow(ctx, promoteTaskToManagedExecution,arg.WorkItemState,arg.SourceKey,+ arg.Quiet,arg.Generation,arg.ExecutionStatus,arg.ExecutionRevision,@@ -1235,6 +1241,7 @@ func (q *Queries) PromoteTaskToManagedExecution(ctx context.Context, arg Promote&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}diff --git a/apps/teamhub/internal/store/task_execution_worker.sql.go b/apps/teamhub/internal/store/task_execution_worker.sql.goindex e00f963a..72114575 100644--- a/apps/teamhub/internal/store/task_execution_worker.sql.go+++ b/apps/teamhub/internal/store/task_execution_worker.sql.go@@ -198,7 +198,7 @@ SET task_worker_id=$1::text,task_next_reconcile_at=clock_timestamp()+make_interval(secs=>$3::int)FROM candidateWHERE item.id=candidate.id-RETURNING item.id AS task_id,item.task_worker_id,item.task_lease_generation,item.task_lease_expires_at+RETURNING item.id AS task_id,item.task_worker_id,item.task_lease_generation,item.task_lease_expires_at, item.quiet`type ClaimTaskExecutionForWorkerParams struct {@@ -212,6 +212,7 @@ type ClaimTaskExecutionForWorkerRow struct {TaskWorkerID pgtype.Text `json:"task_worker_id"`TaskLeaseGeneration pgtype.Int8 `json:"task_lease_generation"`TaskLeaseExpiresAt pgtype.Timestamptz `json:"task_lease_expires_at"`+ Quiet bool `json:"quiet"`}func (q *Queries) ClaimTaskExecutionForWorker(ctx context.Context, arg ClaimTaskExecutionForWorkerParams) (ClaimTaskExecutionForWorkerRow, error) {@@ -222,6 +223,7 @@ func (q *Queries) ClaimTaskExecutionForWorker(ctx context.Context, arg ClaimTask&i.TaskWorkerID,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -407,7 +409,7 @@ WHERE id=$2::textAND task_lease_token_hash=$5::byteaAND task_lease_expires_at>clock_timestamp()AND (SELECT count(*) FROM extended_effects)>=0-RETURNING id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at+RETURNING id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at, quiet`type ExtendTaskExecutionWorkerLeaseParams struct {@@ -423,6 +425,7 @@ type ExtendTaskExecutionWorkerLeaseRow struct {TaskWorkerID pgtype.Text `json:"task_worker_id"`TaskLeaseGeneration pgtype.Int8 `json:"task_lease_generation"`TaskLeaseExpiresAt pgtype.Timestamptz `json:"task_lease_expires_at"`+ Quiet bool `json:"quiet"`}// While a lease is held, the reconcile time falls due only when a writer such@@ -444,12 +447,13 @@ func (q *Queries) ExtendTaskExecutionWorkerLease(ctx context.Context, arg Extend&i.TaskWorkerID,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}const getTaskExecutionWorkerLease = `-- name: GetTaskExecutionWorkerLease :one-SELECT id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at+SELECT id AS task_id,task_worker_id,task_lease_generation,task_lease_expires_at, quietFROM work_itemsWHERE id=$1::textAND task_worker_id=$2::text@@ -470,6 +474,7 @@ type GetTaskExecutionWorkerLeaseRow struct {TaskWorkerID pgtype.Text `json:"task_worker_id"`TaskLeaseGeneration pgtype.Int8 `json:"task_lease_generation"`TaskLeaseExpiresAt pgtype.Timestamptz `json:"task_lease_expires_at"`+ Quiet bool `json:"quiet"`}func (q *Queries) GetTaskExecutionWorkerLease(ctx context.Context, arg GetTaskExecutionWorkerLeaseParams) (GetTaskExecutionWorkerLeaseRow, error) {@@ -485,12 +490,13 @@ func (q *Queries) GetTaskExecutionWorkerLease(ctx context.Context, arg GetTaskEx&i.TaskWorkerID,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}const lockTaskExecutionWorkerLease = `-- name: LockTaskExecutionWorkerLease :one-SELECT id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at+SELECT id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at, quietFROM work_itemsWHERE id=$1::textAND task_worker_id=$2::text@@ -551,6 +557,7 @@ func (q *Queries) LockTaskExecutionWorkerLease(ctx context.Context, arg LockTask&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -715,7 +722,7 @@ WHERE id=$2::textAND task_lease_generation=$8::bigintAND task_lease_token_hash=$9::byteaAND task_lease_expires_at>clock_timestamp()-RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at+RETURNING id, tenant_id, number, kind, title, description, priority, state, resolution, version, created_by_actor_id, updated_by_actor_id, archived_at, created_at, updated_at, task_source_key, task_execution_generation, task_execution_status, task_execution_revision, task_execution_reason_code, task_desired_control, task_control_revision, task_control_settled_revision, task_control_outcome, task_control_source_kind, task_control_source_id, task_control_requested_by_actor_id, task_control_requested_at, task_control_payload, task_execution_updated_at, task_next_reconcile_at, task_worker_id, task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type ScheduleTaskExecutionReconcileParams struct {@@ -785,6 +792,7 @@ func (q *Queries) ScheduleTaskExecutionReconcile(ctx context.Context, arg Schedu&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}diff --git a/apps/teamhub/internal/store/typed_card.sql.go b/apps/teamhub/internal/store/typed_card.sql.goindex b94fa11b..fd34d1a4 100644--- a/apps/teamhub/internal/store/typed_card.sql.go+++ b/apps/teamhub/internal/store/typed_card.sql.go@@ -110,7 +110,7 @@ RETURNING id,tenant_id,number,kind,title,description,priority,state,resolution,vtask_control_source_kind,task_control_source_id,task_control_requested_by_actor_id,task_control_requested_at,task_control_payload,task_execution_updated_at,task_next_reconcile_at,task_worker_id,- task_lease_token_hash,task_lease_generation,task_lease_expires_at+ task_lease_token_hash,task_lease_generation,task_lease_expires_at, quiet`type CreateTypedCardWorkItemParams struct {@@ -172,6 +172,7 @@ func (q *Queries) CreateTypedCardWorkItem(ctx context.Context, arg CreateTypedCa&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -261,7 +262,7 @@ SELECT id,tenant_id,number,kind,title,description,priority,state,resolution,verstask_control_source_kind,task_control_source_id,task_control_requested_by_actor_id,task_control_requested_at,task_control_payload,task_execution_updated_at,task_next_reconcile_at,task_worker_id,- task_lease_token_hash,task_lease_generation,task_lease_expires_at+ task_lease_token_hash,task_lease_generation,task_lease_expires_at, quietFROM work_itemsWHERE id=$1`@@ -305,6 +306,7 @@ func (q *Queries) GetTypedCardWorkItem(ctx context.Context, id string) (WorkItem&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}diff --git a/apps/teamhub/internal/store/work_item.sql.go b/apps/teamhub/internal/store/work_item.sql.goindex 40190294..ebb9bce2 100644--- a/apps/teamhub/internal/store/work_item.sql.go+++ b/apps/teamhub/internal/store/work_item.sql.go@@ -47,7 +47,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type CreateWorkItemParams struct {@@ -109,6 +109,7 @@ func (q *Queries) CreateWorkItem(ctx context.Context, arg CreateWorkItemParams)&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -362,7 +363,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=$1::textAND EXISTS (@@ -417,6 +418,7 @@ func (q *Queries) GetWorkItemForHuman(ctx context.Context, arg GetWorkItemForHum&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -431,7 +433,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=$1::textAND EXISTS (@@ -487,6 +489,7 @@ func (q *Queries) GetWorkItemForHumanForUpdate(ctx context.Context, arg GetWorkI&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -641,7 +644,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.tenant_id=$1::textAND EXISTS (@@ -796,6 +799,7 @@ func (q *Queries) ListWorkItemsForHuman(ctx context.Context, arg ListWorkItemsFo&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,); err != nil {return nil, err}@@ -822,7 +826,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type SetWorkItemArchivedParams struct {@@ -876,6 +880,7 @@ func (q *Queries) SetWorkItemArchived(ctx context.Context, arg SetWorkItemArchiv&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -913,7 +918,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type TransitionWorkItemParams struct {@@ -969,6 +974,7 @@ func (q *Queries) TransitionWorkItem(ctx context.Context, arg TransitionWorkItem&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -990,7 +996,7 @@ RETURNING id, tenant_id, number, kind, title, description, priority, state, resotask_control_source_kind, task_control_source_id, task_control_requested_by_actor_id,task_control_requested_at, task_control_payload,task_execution_updated_at, task_next_reconcile_at, task_worker_id,- task_lease_token_hash, task_lease_generation, task_lease_expires_at+ task_lease_token_hash, task_lease_generation, task_lease_expires_at, quiet`type UpdateWorkItemMetadataParams struct {@@ -1048,6 +1054,7 @@ func (q *Queries) UpdateWorkItemMetadata(ctx context.Context, arg UpdateWorkItem&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}diff --git a/apps/teamhub/internal/store/work_item_comment.sql.go b/apps/teamhub/internal/store/work_item_comment.sql.goindex 5271cd3a..afbabad4 100644--- a/apps/teamhub/internal/store/work_item_comment.sql.go+++ b/apps/teamhub/internal/store/work_item_comment.sql.go@@ -290,7 +290,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=$1::textAND wi.tenant_id=$2::text@@ -364,6 +364,7 @@ func (q *Queries) GetWorkItemForAgent(ctx context.Context, arg GetWorkItemForAge&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -378,7 +379,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.id=$1::textAND wi.tenant_id=$2::text@@ -437,6 +438,7 @@ func (q *Queries) GetWorkItemForAgentForUpdate(ctx context.Context, arg GetWorkI&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,)return i, err}@@ -614,7 +616,7 @@ SELECT wi.id, wi.tenant_id, wi.number, wi.kind, wi.title, wi.description, wi.priwi.task_control_source_kind, wi.task_control_source_id, wi.task_control_requested_by_actor_id,wi.task_control_requested_at, wi.task_control_payload,wi.task_execution_updated_at, wi.task_next_reconcile_at, wi.task_worker_id,- wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at+ wi.task_lease_token_hash, wi.task_lease_generation, wi.task_lease_expires_at, wi.quietFROM work_items wiWHERE wi.tenant_id=$1::textAND ($2::text = '' OR wi.kind=$2::text)@@ -713,6 +715,7 @@ func (q *Queries) ListWorkItemsForAgent(ctx context.Context, arg ListWorkItemsFo&i.TaskLeaseTokenHash,&i.TaskLeaseGeneration,&i.TaskLeaseExpiresAt,+ &i.Quiet,); err != nil {return nil, err}diff --git a/apps/teamhub/internal/taskdelegation/service.go b/apps/teamhub/internal/taskdelegation/service.goindex f507fb21..6cc70b5a 100644--- a/apps/teamhub/internal/taskdelegation/service.go+++ b/apps/teamhub/internal/taskdelegation/service.go@@ -15,6 +15,8 @@ import ("github.com/jackc/pgx/v5""github.com/jackc/pgx/v5/pgxpool""github.com/simplexai-labs/linger/apps/teamhub/internal/agentauth"+ "github.com/simplexai-labs/linger/apps/teamhub/internal/messagecreation"+ "github.com/simplexai-labs/linger/apps/teamhub/internal/reminder""github.com/simplexai-labs/linger/apps/teamhub/internal/store""github.com/simplexai-labs/linger/apps/teamhub/internal/typedcard")@@ -138,11 +140,16 @@ func (s *Service) Create(if err != nil {return CreateResult{}, err}+ quiet, err := startedByProactiveWake(ctx, queries, authorization)+ if err != nil {+ return CreateResult{}, err+ }created, err := typedcard.CreateDelegatedTaskInTx(ctx, tx, queries, typedcard.DelegatedTaskInput{TenantID: authorization.TenantID, OriginRoomID: authorization.RoomID,Agent: agent, AgentManagementID: authorization.AgentID, Sponsor: sponsor,Name: input.Name, Requirement: input.Requirement,SourceKey: "task_delegation:" + operationKey(authorization, input.InvocationID),+ Quiet: quiet,})if errors.Is(err, typedcard.ErrInvalid) {return CreateResult{}, ErrInvalid@@ -164,6 +171,22 @@ func (s *Service) Create(return CreateResult{TaskID: created.TaskID}, nil}+// startedByProactiveWake tells whether the Run creating the Task was started by+// a proactive wake (a review, plan, event or a Routine serving a Tracking Item)+// rather than by the Human, from the Run its request names. A plain Routine the+// Human set up is the Human's own request, so its Tasks stay ordinary.+func startedByProactiveWake(ctx context.Context, queries *store.Queries, authorization agentauth.Authorization) (bool, error) {+ run, err := messagecreation.ResolveRunClaim(ctx, queries, authorization.TenantID, authorization.AgentActorID, authorization.RoomID)+ if err != nil || !run.Valid {+ return false, err+ }+ source, err := queries.GetRunProactiveWakeSource(ctx, store.GetRunProactiveWakeSourceParams{RunID: run.String, RoomID: authorization.RoomID})+ if errors.Is(err, pgx.ErrNoRows) {+ return false, nil+ }+ return err == nil && source != reminder.SourceScheduled, err+}+func hashRequest(input CreateInput) ([]byte, error) {encoded, err := json.Marshal([]string{input.Name, input.Requirement})if err != nil {diff --git a/apps/teamhub/internal/taskexecution/attempt_reconcile.go b/apps/teamhub/internal/taskexecution/attempt_reconcile.goindex e57db7fb..1538aa7c 100644--- a/apps/teamhub/internal/taskexecution/attempt_reconcile.go+++ b/apps/teamhub/internal/taskexecution/attempt_reconcile.go@@ -258,7 +258,7 @@ func settleTaskTurn(}// The Meta reads what to do, then the AlterEgo's own words as their// own report, the one a live call tells as the Task's latest.- reports = []string{"Task " + snapshot.Title + " (" + input.TaskID + ") is idle. " + taskDoneReminder(input.TaskID), reply}+ reports = []string{"Task " + snapshot.Title + " (" + input.TaskID + ") is idle. " + taskDoneReminder(input.TaskID, snapshot.Quiet), reply}}return settleTaskStatus(ctx, queries, lease, snapshot, input, status, reason, reports, map[string]any{"attempt_id": attempt.ID, "input_revision": attempt.CurrentInputRevision,@@ -268,14 +268,22 @@ func settleTaskTurn(// taskDoneReminder asks the Meta to hand a finished Task's result to the user// as one card, followed by one ordinary message for anything the user must-// add or check. Only an idle report carries it; a failure is told in plain-// words.-func taskDoneReminder(taskID string) string {+// add or check. A quiet Task, started during a proactive wake or a Routine+// that serves a Tracking Item, is delivered as the one reminder it prepared+// for. Only an idle report carries it; a failure is told in plain words.+func taskDoneReminder(taskID string, quiet bool) string {+ if quiet {+ return quietTaskNote + "If it is done, send the user one reminder about the matter it prepared for, " ++ "with its files from ./playground/" + taskID + "/ attached or its Document as a card, and nothing else about the Task."+ }return "If it is done, deliver it to the user with teamhub message card: a title, " +"a one-line result, and its files from ./playground/" + taskID + "/ with --attach; then say in one " +"ordinary message what the user should add or check, if anything."}+// quietTaskNote tells the Meta that the user never saw a quiet Task start.+const quietTaskNote = "You started it during a proactive wake or a Routine that serves a Tracking Item, so the user never saw it start. "+func failTaskAttempt(ctx context.Context,queries *store.Queries,@@ -303,6 +311,9 @@ func failTaskAttempt(return err}report := "Task " + snapshot.Title + " (" + input.TaskID + ") failed: " + truncateRunes(failure, taskReportFailureMaxRunes)+ if snapshot.Quiet {+ report += " " + quietTaskNote + "Remind the user without it, or say nothing."+ }return settleTaskStatus(ctx, queries, lease, snapshot, input, "failed", stopReason, []string{report}, map[string]any{"attempt_id": attempt.ID, "attempt_number": attempt.AttemptNumber, "stop_reason_code": stopReason,})diff --git a/apps/teamhub/internal/taskexecution/attempt_reconcile_test.go b/apps/teamhub/internal/taskexecution/attempt_reconcile_test.goindex f905e155..a1b6519d 100644--- a/apps/teamhub/internal/taskexecution/attempt_reconcile_test.go+++ b/apps/teamhub/internal/taskexecution/attempt_reconcile_test.go@@ -1,6 +1,7 @@package taskexecutionimport (+ "strings""testing""github.com/simplexai-labs/linger/apps/teamhub/internal/store"@@ -113,3 +114,13 @@ func TestInspectCurrentAttemptRunsKeepsTheReportedRunAndError(t *testing.T) {t.Fatalf("activation failure=%+v err=%v", result, err)}}++func TestQuietTaskReportAsksForOneReminder(t *testing.T) {+ quiet, ordinary := taskDoneReminder("task_1", true), taskDoneReminder("task_1", false)+ if !strings.Contains(quiet, "never saw it start") || !strings.Contains(quiet, "one reminder") || strings.Contains(quiet, "message card") {+ t.Fatalf("quiet report=%q", quiet)+ }+ if !strings.Contains(ordinary, "teamhub message card") || strings.Contains(ordinary, "never saw it start") {+ t.Fatalf("ordinary report=%q", ordinary)+ }+}diff --git a/apps/teamhub/internal/taskexecution/service.go b/apps/teamhub/internal/taskexecution/service.goindex d2739abb..6ec4b093 100644--- a/apps/teamhub/internal/taskexecution/service.go+++ b/apps/teamhub/internal/taskexecution/service.go@@ -235,7 +235,7 @@ func CreateManagedGeneration(return CreateManagedGenerationResult{}, err}if _, err := queries.PromoteTaskToManagedExecution(ctx, store.PromoteTaskToManagedExecutionParams{- WorkItemState: "in_progress", SourceKey: optionalText(input.SourceKey),+ WorkItemState: "in_progress", SourceKey: optionalText(input.SourceKey), Quiet: input.Quiet,Generation: generation, ExecutionStatus: "running", ExecutionRevision: 1,TaskID: input.TaskID, TenantID: locked.TenantID,}); err != nil {diff --git a/apps/teamhub/internal/taskexecution/types.go b/apps/teamhub/internal/taskexecution/types.goindex 42d4556d..27367c57 100644--- a/apps/teamhub/internal/taskexecution/types.go+++ b/apps/teamhub/internal/taskexecution/types.go@@ -48,7 +48,10 @@ type CreateManagedGenerationInput struct {EventRoomID stringWorkItemVersion int64SourceKey string- RunSpec RunSpecV1+ // Quiet marks a Task started during a proactive wake or a Routine that+ // serves a Tracking Item.+ Quiet bool+ RunSpec RunSpecV1// Participant is the AlterEgo of RunSpec's result Agent, the Task's only// participant.Participant ParticipantInputdiff --git a/apps/teamhub/internal/typedcard/task_delegation.go b/apps/teamhub/internal/typedcard/task_delegation.goindex 37094f2a..09b3e8d2 100644--- a/apps/teamhub/internal/typedcard/task_delegation.go+++ b/apps/teamhub/internal/typedcard/task_delegation.go@@ -26,6 +26,9 @@ type DelegatedTaskInput struct {Requirement stringSourceKey stringHidden bool+ // Quiet marks a Task started during a proactive wake or a Routine that+ // serves a Tracking Item.+ Quiet bool}type DelegatedTaskResult struct {@@ -95,7 +98,7 @@ func CreateDelegatedTaskInTx(}if _, err := taskexecution.CreateManagedGeneration(ctx, tx, queries, taskexecution.CreateManagedGenerationInput{TaskID: item.ID, TenantID: input.TenantID, WorkItemVersion: item.Version,- SourceKey: input.SourceKey,+ SourceKey: input.SourceKey, Quiet: input.Quiet,RunSpec: taskexecution.RunSpecV1{SchemaVersion: 1, ResultAgentActorID: input.Agent.ID,AttemptPolicy: taskexecution.DelegatedAttemptPolicyV1(),diff --git a/apps/teamhub/migrations/00870_quiet_proactive_tasks.sql b/apps/teamhub/migrations/00870_quiet_proactive_tasks.sqlnew file mode 100644index 00000000..da19289c--- /dev/null+++ b/apps/teamhub/migrations/00870_quiet_proactive_tasks.sql@@ -0,0 +1,11 @@+-- +goose Up+-- A Task that AnotherMe starts during a proactive wake or a Routine that+-- serves a Tracking Item is quiet: it keeps its origin Room but stays out of+-- the running-Task indicator, and its report asks for one reminder instead of+-- an announcement.+ALTER TABLE work_items+ ADD COLUMN quiet boolean NOT NULL DEFAULT false;++-- +goose Down+ALTER TABLE work_items+ DROP COLUMN quiet;diff --git a/apps/teamhub/tests/integration/task_quiet_test.go b/apps/teamhub/tests/integration/task_quiet_test.gonew file mode 100644index 00000000..361e0d61--- /dev/null+++ b/apps/teamhub/tests/integration/task_quiet_test.go@@ -0,0 +1,113 @@+package integration_test++import (+ "encoding/json"+ "net/http"+ "testing"+ "time"++ "github.com/simplexai-labs/linger/apps/teamhub/internal/agentcredential"+ "github.com/simplexai-labs/linger/apps/teamhub/internal/agentruntimestate"+ "github.com/simplexai-labs/linger/apps/teamhub/internal/proactive"+ "github.com/simplexai-labs/linger/apps/teamhub/internal/reminder"+)++// A Task AnotherMe starts in a Run that a delivered proactive wake started is+// quiet: it keeps its origin link, so task check, send and stop still reach+// it, but the running-Task indicator leaves it out. A Task started by the Human or by a+// plain Routine they set up is ordinary.+func TestTaskStartedByProactiveWakeIsQuiet(t *testing.T) {+ allowParallelIntegrationTest(t)+ env, pool := newConnectedAnotherMeEnv(t, nil)+ alice := env.login("alice", alicePassword)+ roomID := anotherMeRoomID(t, pool, "actor_acme_alice")+ var managementID string+ if err := pool.QueryRow(t.Context(), `SELECT agent_management_id FROM agent_registrations+ WHERE represented_human_actor_id='actor_acme_alice' AND agent_type='anotherme'`).Scan(&managementID); err != nil {+ t.Fatal(err)+ }+ ensured, err := agentruntimestate.New(pool).EnsureContext(t.Context(), agentruntimestate.EnsureContextInput{TargetResidency: "active",+ Ref: agentruntimestate.ContextRef{Kind: "meta", AgentID: managementID, RoomID: roomID},+ })+ if err != nil {+ t.Fatal(err)+ }+ // wakeRun delivers a wake, gives it this source and makes a running Run+ // whose initial input carries it, as an accepted Room Inbox notification does.+ sequence := int64(1000)+ wakeRun := func(runID, source string) string {+ t.Helper()+ sequence += 1000+ if err := proactive.New(pool, nil, nil).QueueWake(t.Context(), managementID, roomID, "[Proactive review] "+runID); err != nil {+ t.Fatal(err)+ }+ wakeID := pendingWakeID(t, pool, roomID)+ if wait, err := reminder.Deliver(t.Context(), pool, wakeID, time.Now().Add(reminder.Window+time.Minute), reminder.Window); err != nil || wait != 0 {+ t.Fatalf("wake not delivered: wait=%v err=%v", wait, err)+ }+ var wakeMessageID string+ if err := pool.QueryRow(t.Context(), `UPDATE proactive_pending_wakes SET source=$2 WHERE id=$1 RETURNING message_id`, wakeID, source).Scan(&wakeMessageID); err != nil {+ t.Fatal(err)+ }+ payload, _ := json.Marshal(map[string]any{"invocationMessageIds": []string{wakeMessageID}})+ if _, err := pool.Exec(t.Context(), `INSERT INTO agent_local_runs(run_id,context_key,status,status_room_id,started_at) VALUES($1,$2,'running',$3,now())`,+ runID, ensured.Context.ContextKey, roomID); err != nil {+ t.Fatal(err)+ }+ inputID := runID + "-input"+ if _, err := pool.Exec(t.Context(), `INSERT INTO agent_runtime_inputs(context_key,input_id,input_sequence,payload,payload_hash,source_kind,source_inbox_id,status,local_run_id)+ VALUES($1,$2,$6,$3,decode(repeat('a',64),'hex'),'inbox',$4,'handled',$5)`,+ ensured.Context.ContextKey, inputID, payload, "room:"+roomID, runID, sequence); err != nil {+ t.Fatal(err)+ }+ if _, err := pool.Exec(t.Context(), `INSERT INTO agent_local_run_inputs(run_id,context_key,input_id,relation,ordinal)+ VALUES($1,$2,$3,'initial',0)`, runID, ensured.Context.ContextKey, inputID); err != nil {+ t.Fatal(err)+ }+ return runID+ }+ issued, err := agentcredential.New(pool).IssueManaged(t.Context(), managementID, "quiet task")+ if err != nil {+ t.Fatal(err)+ }+ create := func(invocation, name string, headers http.Header) string {+ t.Helper()+ code, body := postDelegatedTask(t, env, issued, invocation, name, name+".", headers)+ var created delegatedTaskResponse+ if code != http.StatusOK || json.Unmarshal(body, &created) != nil || created.TaskID == "" {+ t.Fatalf("create %s=%d %s", name, code, body)+ }+ return created.TaskID+ }+ inRun := func(runID string) http.Header {+ headers := taskDelegationRoomContext(roomID)+ headers.Set("X-TeamHub-Run-Id", runID)+ return headers+ }+ quietTask := create("quiet-task", "Prepare the pitch deck", inRun(wakeRun("review-wake-run", "review")))+ // A Context runs one Run at a time.+ if _, err := pool.Exec(t.Context(), `UPDATE agent_local_runs SET status='succeeded', terminal='{"type":"succeeded"}', finished_at=now() WHERE run_id='review-wake-run'`); err != nil {+ t.Fatal(err)+ }+ // A plain Routine the Human set up is their own request.+ scheduledTask := create("scheduled-task", "Research the market", inRun(wakeRun("scheduled-wake-run", "scheduled")))+ ordinaryTask := create("ordinary-task", "Draft the reply", taskDelegationRoomContext(roomID))++ quiet := func(taskID string) bool {+ t.Helper()+ var value bool+ if err := pool.QueryRow(t.Context(), `SELECT quiet FROM work_items WHERE id=$1`, taskID).Scan(&value); err != nil {+ t.Fatal(err)+ }+ return value+ }+ if !quiet(quietTask) || quiet(scheduledTask) || quiet(ordinaryTask) {+ t.Fatalf("quiet: review Task=%v scheduled Task=%v ordinary Task=%v", quiet(quietTask), quiet(scheduledTask), quiet(ordinaryTask))+ }+ if titles := roomBackgroundTaskTitles(t, env, alice, roomID); len(titles) != 2 || titles[0] != "Research the market" || titles[1] != "Draft the reply" {+ t.Fatalf("indicator=%v", titles)+ }+ if got := countRows(t, env, `SELECT count(*) FROM work_item_room_links WHERE work_item_id=$1 AND room_id=$2 AND link_type='origin'`, quietTask, roomID); got != 1 {+ t.Fatalf("quiet Task origin links=%d", got)+ }+}diff --git a/docs/proactive.md b/docs/proactive.mdindex 377414c9..f06a59fb 100644--- a/docs/proactive.md+++ b/docs/proactive.md@@ -17,15 +17,15 @@ Another Me judges each window or event in a run of its own, with the generalrules, the user's learned rules and the open follow-up items, and acts on theresult.-| Stage | Behavior |-| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| Input | The chat with Another Me in windows of 20 messages; Gmail and Outlook inboxes, Google Calendar changes and Slack mentions, polled every 10 minutes |-| Apps | From 22:00 to 08:00, or after five reminders that day, an app event is only recorded; one item in one state is judged once a day |-| Delivery | Waits until the chat has been quiet for 3 minutes |-| Tell now | Another Me checks the facts that may have changed, then sends one short message: the point, the facts, the next step |-| Prepare | For an interview, a first meeting, a talk or pitch, or one with an investor, client or partner, Another Me first looks through your notes, recordings, mail and the web; a few points go in the reminder, more go into a prep document it links, and a pitch without a deck gets a short one |-| Follow up later | A follow-up item with scheduled checks, recorded without a message |-| Stay silent | The run ends without a reply |+| Stage | Behavior |+| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Input | The chat with Another Me in windows of 20 messages; Gmail and Outlook inboxes, Google Calendar changes and Slack mentions, polled every 10 minutes |+| Apps | From 22:00 to 08:00, or after five reminders that day, an app event is only recorded; one item in one state is judged once a day |+| Delivery | Waits until the chat has been quiet for 3 minutes |+| Tell now | Another Me checks the facts that may have changed, then sends one short message: the point, the facts, the next step |+| Prepare | For an interview, a first meeting, a talk or pitch, or one with an investor, client or partner, Another Me first looks through your notes, recordings, mail and the web; a few points go in the reminder, more go into a prep document it links, and a pitch without a deck gets a short one. Work it hands to a background Task stays out of the running-Task indicator and arrives only with the reminder, as a file or document card |+| Follow up later | A follow-up item with scheduled checks, recorded without a message |+| Stay silent | The run ends without a reply |## Learning rules