@mystilleef/pi-subagent 0.5.0 → 0.7.0
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 +1 -1
- package/package.json +13 -11
- package/src/agent/agent-cache.ts +258 -0
- package/src/agent/agents.ts +232 -0
- package/src/child/child-events.ts +119 -0
- package/src/{process.ts → child/process.ts} +268 -122
- package/src/{prompt-contract.ts → child/prompt-contract.ts} +2 -0
- package/src/index.ts +43 -24
- package/src/{jobs-command.ts → orchestration/jobs-command.ts} +2 -3
- package/src/{run.ts → orchestration/run.ts} +2 -2
- package/src/{subagent-orchestrator.ts → orchestration/subagent-orchestrator.ts} +246 -124
- package/src/{normalize.ts → output/normalize.ts} +35 -49
- package/src/{summary.ts → output/summary.ts} +4 -2
- package/src/{ui.ts → output/ui.ts} +45 -48
- package/src/{progress-state.ts → progress/progress-state.ts} +164 -52
- package/src/{progress.ts → progress/progress.ts} +21 -21
- package/src/{result-details.ts → progress/result-details.ts} +55 -17
- package/src/shared/instance-name.ts +117 -0
- package/src/{types.ts → shared/types.ts} +13 -2
- package/src/{utils.ts → shared/utils.ts} +4 -6
- package/src/agent-cache.ts +0 -41
- package/src/agents.ts +0 -178
- package/src/child-events.ts +0 -32
- package/src/instance-name.ts +0 -164
- /package/src/{termination.ts → child/termination.ts} +0 -0
- /package/src/{cancel-command.ts → orchestration/cancel-command.ts} +0 -0
- /package/src/{run-command.ts → orchestration/run-command.ts} +0 -0
- /package/src/{run-registry.ts → orchestration/run-registry.ts} +0 -0
package/src/instance-name.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
const DEFAULT_ADJECTIVES = [
|
|
2
|
-
"able",
|
|
3
|
-
"agile",
|
|
4
|
-
"alert",
|
|
5
|
-
"amber",
|
|
6
|
-
"ample",
|
|
7
|
-
"apt",
|
|
8
|
-
"arctic",
|
|
9
|
-
"avid",
|
|
10
|
-
"bold",
|
|
11
|
-
"brave",
|
|
12
|
-
"bright",
|
|
13
|
-
"brisk",
|
|
14
|
-
"calm",
|
|
15
|
-
"clever",
|
|
16
|
-
"cosmic",
|
|
17
|
-
"crisp",
|
|
18
|
-
"daring",
|
|
19
|
-
"dawn",
|
|
20
|
-
"eager",
|
|
21
|
-
"early",
|
|
22
|
-
"fair",
|
|
23
|
-
"fast",
|
|
24
|
-
"fierce",
|
|
25
|
-
"fine",
|
|
26
|
-
"fresh",
|
|
27
|
-
"gentle",
|
|
28
|
-
"golden",
|
|
29
|
-
"grand",
|
|
30
|
-
"happy",
|
|
31
|
-
"honest",
|
|
32
|
-
"jolly",
|
|
33
|
-
"keen",
|
|
34
|
-
"kind",
|
|
35
|
-
"lively",
|
|
36
|
-
"lucky",
|
|
37
|
-
"merry",
|
|
38
|
-
"mighty",
|
|
39
|
-
"nimble",
|
|
40
|
-
"noble",
|
|
41
|
-
"novel",
|
|
42
|
-
"patient",
|
|
43
|
-
"proud",
|
|
44
|
-
"quick",
|
|
45
|
-
"quiet",
|
|
46
|
-
"rapid",
|
|
47
|
-
"ready",
|
|
48
|
-
"sharp",
|
|
49
|
-
"smart",
|
|
50
|
-
"solid",
|
|
51
|
-
"steady",
|
|
52
|
-
"swift",
|
|
53
|
-
"tidy",
|
|
54
|
-
"vivid",
|
|
55
|
-
"warm",
|
|
56
|
-
"wise",
|
|
57
|
-
] as const;
|
|
58
|
-
|
|
59
|
-
const DEFAULT_NOUNS = [
|
|
60
|
-
"badger",
|
|
61
|
-
"beacon",
|
|
62
|
-
"bison",
|
|
63
|
-
"brook",
|
|
64
|
-
"cedar",
|
|
65
|
-
"comet",
|
|
66
|
-
"coral",
|
|
67
|
-
"coyote",
|
|
68
|
-
"crane",
|
|
69
|
-
"dolphin",
|
|
70
|
-
"eagle",
|
|
71
|
-
"ember",
|
|
72
|
-
"falcon",
|
|
73
|
-
"finch",
|
|
74
|
-
"forest",
|
|
75
|
-
"fox",
|
|
76
|
-
"gecko",
|
|
77
|
-
"glade",
|
|
78
|
-
"harbor",
|
|
79
|
-
"hawk",
|
|
80
|
-
"heron",
|
|
81
|
-
"island",
|
|
82
|
-
"jaguar",
|
|
83
|
-
"koala",
|
|
84
|
-
"lagoon",
|
|
85
|
-
"lemur",
|
|
86
|
-
"lynx",
|
|
87
|
-
"maple",
|
|
88
|
-
"meadow",
|
|
89
|
-
"otter",
|
|
90
|
-
"panda",
|
|
91
|
-
"panther",
|
|
92
|
-
"pelican",
|
|
93
|
-
"phoenix",
|
|
94
|
-
"puma",
|
|
95
|
-
"raven",
|
|
96
|
-
"reef",
|
|
97
|
-
"river",
|
|
98
|
-
"salmon",
|
|
99
|
-
"sparrow",
|
|
100
|
-
"summit",
|
|
101
|
-
"tiger",
|
|
102
|
-
"valley",
|
|
103
|
-
"violet",
|
|
104
|
-
"walrus",
|
|
105
|
-
"willow",
|
|
106
|
-
"wolf",
|
|
107
|
-
"wren",
|
|
108
|
-
"yak",
|
|
109
|
-
"zephyr",
|
|
110
|
-
] as const;
|
|
111
|
-
|
|
112
|
-
const usedInstanceNames = new Set<string>();
|
|
113
|
-
|
|
114
|
-
let adjectives: readonly string[] = DEFAULT_ADJECTIVES;
|
|
115
|
-
let nouns: readonly string[] = DEFAULT_NOUNS;
|
|
116
|
-
let randomSource: () => number = Math.random;
|
|
117
|
-
|
|
118
|
-
function normalizeRandomIndex(limit: number): number {
|
|
119
|
-
const value = randomSource();
|
|
120
|
-
if (!Number.isFinite(value)) return 0;
|
|
121
|
-
return Math.min(limit - 1, Math.max(0, Math.floor(value * limit)));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function nameAt(index: number): string {
|
|
125
|
-
const adjective = adjectives[Math.floor(index / nouns.length)];
|
|
126
|
-
const noun = nouns[index % nouns.length];
|
|
127
|
-
return `${adjective}-${noun}`;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function generateSubagentInstanceName(): string {
|
|
131
|
-
const capacity = adjectives.length * nouns.length;
|
|
132
|
-
if (usedInstanceNames.size >= capacity) {
|
|
133
|
-
throw new Error(
|
|
134
|
-
"No unused subagent instance names remain for this session.",
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
const start = normalizeRandomIndex(capacity);
|
|
138
|
-
for (let offset = 0; offset < capacity; offset += 1) {
|
|
139
|
-
const candidate = nameAt((start + offset) % capacity);
|
|
140
|
-
if (!usedInstanceNames.has(candidate)) {
|
|
141
|
-
usedInstanceNames.add(candidate);
|
|
142
|
-
return candidate;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
throw new Error("No unused subagent instance names remain for this session.");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function resetSubagentInstanceNamesForTest() {
|
|
149
|
-
usedInstanceNames.clear();
|
|
150
|
-
adjectives = DEFAULT_ADJECTIVES;
|
|
151
|
-
nouns = DEFAULT_NOUNS;
|
|
152
|
-
randomSource = Math.random;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export function configureSubagentInstanceNamesForTest(options: {
|
|
156
|
-
adjectives?: readonly string[];
|
|
157
|
-
nouns?: readonly string[];
|
|
158
|
-
randomSource?: () => number;
|
|
159
|
-
}) {
|
|
160
|
-
usedInstanceNames.clear();
|
|
161
|
-
adjectives = options.adjectives ?? DEFAULT_ADJECTIVES;
|
|
162
|
-
nouns = options.nouns ?? DEFAULT_NOUNS;
|
|
163
|
-
randomSource = options.randomSource ?? Math.random;
|
|
164
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|