@narumitw/pi-subagents 0.4.1 → 0.4.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/package.json +1 -1
- package/src/subagents.ts +7 -7
package/package.json
CHANGED
package/src/subagents.ts
CHANGED
|
@@ -55,7 +55,7 @@ const KILL_GRACE_MS = 5000;
|
|
|
55
55
|
const STATUS_KEY = "subagents";
|
|
56
56
|
const activeStatuses = new Map<string, string>();
|
|
57
57
|
|
|
58
|
-
function parsePositiveInteger(value: string | undefined): number | undefined {
|
|
58
|
+
export function parsePositiveInteger(value: string | undefined): number | undefined {
|
|
59
59
|
if (!value) return undefined;
|
|
60
60
|
const parsed = Number.parseInt(value, 10);
|
|
61
61
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
@@ -114,14 +114,14 @@ function fanInStatus(agent: string): string {
|
|
|
114
114
|
return `🧑🤝🧑 fan-in ${agent}`;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
function formatTokens(count: number): string {
|
|
117
|
+
export function formatTokens(count: number): string {
|
|
118
118
|
if (count < 1000) return count.toString();
|
|
119
119
|
if (count < 10000) return `${(count / 1000).toFixed(1)}k`;
|
|
120
120
|
if (count < 1000000) return `${Math.round(count / 1000)}k`;
|
|
121
121
|
return `${(count / 1000000).toFixed(1)}M`;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function formatUsageStats(
|
|
124
|
+
export function formatUsageStats(
|
|
125
125
|
usage: {
|
|
126
126
|
input: number;
|
|
127
127
|
output: number;
|
|
@@ -626,7 +626,7 @@ function isPositiveNumber(value: unknown): value is number {
|
|
|
626
626
|
return typeof value === "number" && Number.isFinite(value) && value >= 1;
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
-
function normalizeAgentSettings(value: unknown): SubagentAgentConfig | undefined {
|
|
629
|
+
export function normalizeAgentSettings(value: unknown): SubagentAgentConfig | undefined {
|
|
630
630
|
if (!isPlainObject(value)) return undefined;
|
|
631
631
|
|
|
632
632
|
const config: SubagentAgentConfig = {};
|
|
@@ -653,7 +653,7 @@ function normalizeAgentSettings(value: unknown): SubagentAgentConfig | undefined
|
|
|
653
653
|
return hasKnownField ? config : undefined;
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
-
function normalizeSubagentSettings(value: unknown): SubagentSettings | undefined {
|
|
656
|
+
export function normalizeSubagentSettings(value: unknown): SubagentSettings | undefined {
|
|
657
657
|
if (!isPlainObject(value)) return undefined;
|
|
658
658
|
if (!hasOwn(value, "agents")) return {};
|
|
659
659
|
if (!isPlainObject(value.agents)) return undefined;
|
|
@@ -685,11 +685,11 @@ function saveSubagentConfig(settings: SubagentSettings): void {
|
|
|
685
685
|
fs.writeFileSync(configPath, `${JSON.stringify(settings, null, "\t")}\n`, "utf-8");
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
function uniqueToolNames(tools: string[]): string[] {
|
|
688
|
+
export function uniqueToolNames(tools: string[]): string[] {
|
|
689
689
|
return [...new Set(tools)];
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
-
function sameToolSet(left: string[], right: string[]): boolean {
|
|
692
|
+
export function sameToolSet(left: string[], right: string[]): boolean {
|
|
693
693
|
const leftSet = new Set(left);
|
|
694
694
|
const rightSet = new Set(right);
|
|
695
695
|
if (leftSet.size !== rightSet.size) return false;
|