@resolveworks/fork 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/index.ts +29 -18
- package/package.json +2 -1
package/README.md
CHANGED
package/index.ts
CHANGED
|
@@ -80,6 +80,9 @@ const BRANCH_PREFIX = "agent/";
|
|
|
80
80
|
const BRANCH_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
81
81
|
const RESULT_TYPE = "fork-result";
|
|
82
82
|
const MESSAGE_TYPE = "fork-message";
|
|
83
|
+
const PARENT_REQUEST_REMINDER =
|
|
84
|
+
"Act on this request. It remains open until you submit the complete response " +
|
|
85
|
+
"with message_parent before going idle.";
|
|
83
86
|
|
|
84
87
|
/** Number of markdown lines shown when the message row is collapsed (ctrl+o to expand). */
|
|
85
88
|
const PREVIEW_LINES = 10;
|
|
@@ -581,9 +584,11 @@ function setupParent(pi: ExtensionAPI, ctx: ExtensionContext): void {
|
|
|
581
584
|
const taskPath = taskPathFor(id);
|
|
582
585
|
// Tag the task like every other parent message, so the child learns one
|
|
583
586
|
// rule: tagged input is the parent, untagged input is a human at its window.
|
|
584
|
-
fs.writeFileSync(
|
|
585
|
-
|
|
586
|
-
|
|
587
|
+
fs.writeFileSync(
|
|
588
|
+
taskPath,
|
|
589
|
+
`<message-from-parent>\n${task}\n</message-from-parent>\n\n${PARENT_REQUEST_REMINDER}`,
|
|
590
|
+
{ mode: 0o600 },
|
|
591
|
+
);
|
|
587
592
|
|
|
588
593
|
let worktree: WorktreeInfo | undefined;
|
|
589
594
|
try {
|
|
@@ -742,14 +747,18 @@ function subagentSystemPrompt(branch?: string): string {
|
|
|
742
747
|
"conversation. Focus only on the delegated task. " +
|
|
743
748
|
workspace +
|
|
744
749
|
"\n\n" +
|
|
745
|
-
"#
|
|
746
|
-
"
|
|
747
|
-
"tags.
|
|
748
|
-
"
|
|
749
|
-
"
|
|
750
|
-
"
|
|
751
|
-
"After
|
|
752
|
-
"
|
|
750
|
+
"# Delegated work\n\n" +
|
|
751
|
+
"Parent requests, including your initial task, arrive in " +
|
|
752
|
+
"<message-from-parent> tags. A request remains open until you call " +
|
|
753
|
+
"message_parent with its complete response. Call it with the outcome when " +
|
|
754
|
+
"finished, the answer to a parent question, or a blocker requiring parent " +
|
|
755
|
+
"input. Ordinary assistant text does not reach the parent.\n\n" +
|
|
756
|
+
"After submitting, wait for the parent's next request. The session remains " +
|
|
757
|
+
"open for revisions.\n\n" +
|
|
758
|
+
"# Direct human interaction\n\n" +
|
|
759
|
+
"Untagged messages come from the human using this session. Answer them in " +
|
|
760
|
+
"text unless they ask you to relay something to the parent. These exchanges " +
|
|
761
|
+
"do not complete or replace an open parent request."
|
|
753
762
|
);
|
|
754
763
|
}
|
|
755
764
|
|
|
@@ -784,7 +793,7 @@ function processAgentLine(pi: ExtensionAPI, line: string): void {
|
|
|
784
793
|
customType: MESSAGE_TYPE,
|
|
785
794
|
content:
|
|
786
795
|
`<message-from-parent>\n${candidate.text}\n</message-from-parent>\n\n` +
|
|
787
|
-
|
|
796
|
+
PARENT_REQUEST_REMINDER,
|
|
788
797
|
display: true,
|
|
789
798
|
},
|
|
790
799
|
{ triggerTurn: true, deliverAs: "steer" },
|
|
@@ -818,14 +827,16 @@ function setupChild(
|
|
|
818
827
|
name: "message_parent",
|
|
819
828
|
label: "Message Parent",
|
|
820
829
|
description:
|
|
821
|
-
"
|
|
822
|
-
"
|
|
823
|
-
"
|
|
830
|
+
"Submit a complete response to the parent session. Use it for completed " +
|
|
831
|
+
"work, answers to parent requests, or blockers requiring input. The parent " +
|
|
832
|
+
"receives only this tool's message, not ordinary assistant text. Send " +
|
|
833
|
+
"outcomes, not progress updates.",
|
|
824
834
|
parameters: Type.Object({
|
|
825
835
|
message: Type.String({
|
|
826
836
|
description:
|
|
827
|
-
"The
|
|
828
|
-
"verification
|
|
837
|
+
"The full response for the parent, including the requested deliverable " +
|
|
838
|
+
"and relevant edits, verification, or blocker—not merely a notification " +
|
|
839
|
+
"that work is done.",
|
|
829
840
|
}),
|
|
830
841
|
}),
|
|
831
842
|
execute: async (_id, params, _signal, _onUpdate, toolCtx) => {
|
|
@@ -876,7 +887,7 @@ function setupChild(
|
|
|
876
887
|
content: [
|
|
877
888
|
{
|
|
878
889
|
type: "text" as const,
|
|
879
|
-
text: "
|
|
890
|
+
text: "Submitted to the parent. End your turn and wait for its next request.",
|
|
880
891
|
},
|
|
881
892
|
],
|
|
882
893
|
details: {},
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resolveworks/fork",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Subagents for Pi — spawn pi sessions in tmux windows with task delegation and revision loops",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"engines": {
|
|
7
8
|
"node": ">=22.18.0"
|