@aexol/spectral 0.7.1 → 0.7.5
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/CHANGELOG.md +5 -0
- package/dist/agent/agents.js +1 -1
- package/dist/agent/index.js +199 -184
- package/dist/commands/serve.js +0 -3
- package/dist/designer/data/systems/renault/DESIGN.md +1 -1
- package/dist/designer/philosophies.js +668 -0
- package/dist/mcp/sampling-handler.js +1 -1
- package/dist/memory/commands/status.js +1 -1
- package/dist/memory/compaction.js +2 -2
- package/dist/memory/config.js +1 -1
- package/dist/memory/debug-log.js +1 -1
- package/dist/memory/hooks/compaction-hook.js +29 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/observer.js +2 -2
- package/dist/memory/project-observations-store.js +14 -0
- package/dist/memory/tokens.js +1 -1
- package/dist/memory/tools/read-project-observations.js +82 -0
- package/dist/memory/tools/recall-observation.js +2 -2
- package/dist/pi/agent-core/agent-loop.js +501 -0
- package/dist/pi/agent-core/agent.js +401 -0
- package/dist/pi/agent-core/harness/agent-harness.js +899 -0
- package/dist/pi/agent-core/harness/compaction/branch-summarization.js +173 -0
- package/dist/pi/agent-core/harness/compaction/compaction.js +532 -0
- package/dist/pi/agent-core/harness/compaction/utils.js +130 -0
- package/dist/pi/agent-core/harness/env/nodejs.js +485 -0
- package/dist/pi/agent-core/harness/messages.js +101 -0
- package/dist/pi/agent-core/harness/prompt-templates.js +229 -0
- package/dist/pi/agent-core/harness/session/jsonl-repo.js +100 -0
- package/dist/pi/agent-core/harness/session/jsonl-storage.js +230 -0
- package/dist/pi/agent-core/harness/session/memory-repo.js +41 -0
- package/dist/pi/agent-core/harness/session/memory-storage.js +113 -0
- package/dist/pi/agent-core/harness/session/repo-utils.js +38 -0
- package/dist/pi/agent-core/harness/session/session.js +196 -0
- package/dist/pi/agent-core/harness/session/uuid.js +49 -0
- package/dist/pi/agent-core/harness/skills.js +310 -0
- package/dist/pi/agent-core/harness/system-prompt.js +29 -0
- package/dist/pi/agent-core/harness/types.js +93 -0
- package/dist/pi/agent-core/harness/utils/shell-output.js +125 -0
- package/dist/pi/agent-core/harness/utils/truncate.js +289 -0
- package/dist/pi/agent-core/index.js +24 -0
- package/dist/pi/agent-core/node.js +2 -0
- package/dist/pi/agent-core/proxy.js +277 -0
- package/dist/pi/agent-core/types.js +1 -0
- package/dist/pi/ai/api-registry.js +43 -0
- package/dist/pi/ai/cli.js +120 -0
- package/dist/pi/ai/env-api-keys.js +169 -0
- package/dist/pi/ai/image-models.generated.js +441 -0
- package/dist/pi/ai/image-models.js +22 -0
- package/dist/pi/ai/images-api-registry.js +21 -0
- package/dist/pi/ai/images.js +13 -0
- package/dist/pi/ai/index.js +18 -0
- package/dist/pi/ai/models.generated.js +16220 -0
- package/dist/pi/ai/models.js +70 -0
- package/dist/pi/ai/oauth.js +1 -0
- package/dist/pi/ai/providers/anthropic.js +945 -0
- package/dist/pi/ai/providers/faux.js +367 -0
- package/dist/pi/ai/providers/github-copilot-headers.js +28 -0
- package/dist/pi/ai/providers/openai-completions.js +945 -0
- package/dist/pi/ai/providers/openai-prompt-cache.js +9 -0
- package/dist/pi/ai/providers/register-builtins.js +97 -0
- package/dist/pi/ai/providers/simple-options.js +40 -0
- package/dist/pi/ai/providers/transform-messages.js +183 -0
- package/dist/pi/ai/session-resources.js +21 -0
- package/dist/pi/ai/stream.js +26 -0
- package/dist/pi/ai/types.js +1 -0
- package/dist/pi/ai/utils/diagnostics.js +24 -0
- package/dist/pi/ai/utils/event-stream.js +80 -0
- package/dist/pi/ai/utils/hash.js +13 -0
- package/dist/pi/ai/utils/headers.js +7 -0
- package/dist/pi/ai/utils/json-parse.js +112 -0
- package/dist/pi/ai/utils/node-http-proxy.js +96 -0
- package/dist/pi/ai/utils/oauth/anthropic.js +334 -0
- package/dist/pi/ai/utils/oauth/device-code.js +54 -0
- package/dist/pi/ai/utils/oauth/github-copilot.js +270 -0
- package/dist/pi/ai/utils/oauth/index.js +121 -0
- package/dist/pi/ai/utils/oauth/oauth-page.js +104 -0
- package/dist/pi/ai/utils/oauth/openai-codex.js +384 -0
- package/dist/pi/ai/utils/oauth/pkce.js +30 -0
- package/dist/pi/ai/utils/oauth/types.js +1 -0
- package/dist/pi/ai/utils/overflow.js +150 -0
- package/dist/pi/ai/utils/sanitize-unicode.js +25 -0
- package/dist/pi/ai/utils/typebox-helpers.js +20 -0
- package/dist/pi/ai/utils/validation.js +280 -0
- package/dist/pi/coding-agent/bun/cli.js +7 -0
- package/dist/pi/coding-agent/bun/restore-sandbox-env.js +31 -0
- package/dist/pi/coding-agent/cli/args.js +340 -0
- package/dist/pi/coding-agent/cli/file-processor.js +82 -0
- package/dist/pi/coding-agent/cli/initial-message.js +21 -0
- package/dist/pi/coding-agent/cli.js +17 -0
- package/dist/pi/coding-agent/config.js +414 -0
- package/dist/pi/coding-agent/core/agent-session-runtime.js +299 -0
- package/dist/pi/coding-agent/core/agent-session-services.js +117 -0
- package/dist/pi/coding-agent/core/agent-session.js +2498 -0
- package/dist/pi/coding-agent/core/auth-guidance.js +20 -0
- package/dist/pi/coding-agent/core/auth-storage.js +441 -0
- package/dist/pi/coding-agent/core/bash-executor.js +110 -0
- package/dist/pi/coding-agent/core/compaction/branch-summarization.js +242 -0
- package/dist/pi/coding-agent/core/compaction/compaction.js +624 -0
- package/dist/pi/coding-agent/core/compaction/index.js +6 -0
- package/dist/pi/coding-agent/core/compaction/utils.js +152 -0
- package/dist/pi/coding-agent/core/defaults.js +1 -0
- package/dist/pi/coding-agent/core/diagnostics.js +1 -0
- package/dist/pi/coding-agent/core/event-bus.js +24 -0
- package/dist/pi/coding-agent/core/exec.js +74 -0
- package/dist/pi/coding-agent/core/export-html/ansi-to-html.js +248 -0
- package/dist/pi/coding-agent/core/export-html/index.js +225 -0
- package/dist/pi/coding-agent/core/export-html/tool-renderer.js +107 -0
- package/dist/pi/coding-agent/core/extensions/index.js +8 -0
- package/dist/pi/coding-agent/core/extensions/loader.js +485 -0
- package/dist/pi/coding-agent/core/extensions/runner.js +824 -0
- package/dist/pi/coding-agent/core/extensions/types.js +44 -0
- package/dist/pi/coding-agent/core/extensions/wrapper.js +21 -0
- package/dist/pi/coding-agent/core/footer-data-provider.js +309 -0
- package/dist/pi/coding-agent/core/http-dispatcher.js +47 -0
- package/dist/pi/coding-agent/core/index.js +11 -0
- package/dist/pi/coding-agent/core/keybindings.js +294 -0
- package/dist/pi/coding-agent/core/messages.js +122 -0
- package/dist/pi/coding-agent/core/model-registry.js +728 -0
- package/dist/pi/coding-agent/core/model-resolver.js +494 -0
- package/dist/pi/coding-agent/core/output-guard.js +58 -0
- package/dist/pi/coding-agent/core/package-manager.js +2020 -0
- package/dist/pi/coding-agent/core/prompt-templates.js +237 -0
- package/dist/pi/coding-agent/core/provider-display-names.js +32 -0
- package/dist/pi/coding-agent/core/resolve-config-value.js +125 -0
- package/dist/pi/coding-agent/core/resource-loader.js +733 -0
- package/dist/pi/coding-agent/core/sdk.js +282 -0
- package/dist/pi/coding-agent/core/session-cwd.js +37 -0
- package/dist/pi/coding-agent/core/session-manager.js +1146 -0
- package/dist/pi/coding-agent/core/settings-manager.js +794 -0
- package/dist/pi/coding-agent/core/skills.js +386 -0
- package/dist/pi/coding-agent/core/slash-commands.js +24 -0
- package/dist/pi/coding-agent/core/source-info.js +18 -0
- package/dist/pi/coding-agent/core/system-prompt.js +122 -0
- package/dist/pi/coding-agent/core/telemetry.js +8 -0
- package/dist/pi/coding-agent/core/timings.js +30 -0
- package/dist/pi/coding-agent/core/tools/bash.js +341 -0
- package/dist/pi/coding-agent/core/tools/edit-diff.js +344 -0
- package/dist/pi/coding-agent/core/tools/edit.js +324 -0
- package/dist/pi/coding-agent/core/tools/file-mutation-queue.js +36 -0
- package/dist/pi/coding-agent/core/tools/find.js +297 -0
- package/dist/pi/coding-agent/core/tools/grep.js +303 -0
- package/dist/pi/coding-agent/core/tools/index.js +111 -0
- package/dist/pi/coding-agent/core/tools/ls.js +168 -0
- package/dist/pi/coding-agent/core/tools/output-accumulator.js +183 -0
- package/dist/pi/coding-agent/core/tools/path-utils.js +61 -0
- package/dist/pi/coding-agent/core/tools/read.js +288 -0
- package/dist/pi/coding-agent/core/tools/render-utils.js +48 -0
- package/dist/pi/coding-agent/core/tools/tool-definition-wrapper.js +33 -0
- package/dist/pi/coding-agent/core/tools/truncate.js +214 -0
- package/dist/pi/coding-agent/core/tools/write.js +212 -0
- package/dist/pi/coding-agent/index.js +41 -0
- package/dist/pi/coding-agent/main.js +5 -0
- package/dist/pi/coding-agent/migrations.js +280 -0
- package/dist/pi/coding-agent/modes/index.js +7 -0
- package/dist/pi/coding-agent/modes/interactive/components/diff.js +132 -0
- package/dist/pi/coding-agent/modes/interactive/components/keybinding-hints.js +35 -0
- package/dist/pi/coding-agent/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/pi/coding-agent/modes/interactive/interactive-mode.js +3 -0
- package/dist/pi/coding-agent/modes/interactive/theme/theme.js +1023 -0
- package/dist/pi/coding-agent/modes/print-mode.js +130 -0
- package/dist/pi/coding-agent/modes/rpc/jsonl.js +48 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-client.js +409 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-mode.js +600 -0
- package/dist/pi/coding-agent/modes/rpc/rpc-types.js +7 -0
- package/dist/pi/coding-agent/utils/ansi.js +51 -0
- package/dist/pi/coding-agent/utils/changelog.js +86 -0
- package/dist/pi/coding-agent/utils/child-process.js +87 -0
- package/dist/pi/coding-agent/utils/clipboard-image.js +244 -0
- package/dist/pi/coding-agent/utils/clipboard-native.js +13 -0
- package/dist/pi/coding-agent/utils/clipboard.js +116 -0
- package/dist/pi/coding-agent/utils/exif-orientation.js +157 -0
- package/dist/pi/coding-agent/utils/frontmatter.js +25 -0
- package/dist/pi/coding-agent/utils/fs-watch.js +24 -0
- package/dist/pi/coding-agent/utils/git.js +162 -0
- package/dist/pi/coding-agent/utils/html.js +39 -0
- package/dist/pi/coding-agent/utils/image-convert.js +38 -0
- package/dist/pi/coding-agent/utils/image-resize.js +136 -0
- package/dist/pi/coding-agent/utils/mime.js +68 -0
- package/dist/pi/coding-agent/utils/paths.js +91 -0
- package/dist/pi/coding-agent/utils/photon.js +120 -0
- package/dist/pi/coding-agent/utils/pi-user-agent.js +4 -0
- package/dist/pi/coding-agent/utils/shell.js +194 -0
- package/dist/pi/coding-agent/utils/sleep.js +16 -0
- package/dist/pi/coding-agent/utils/syntax-highlight.js +117 -0
- package/dist/pi/coding-agent/utils/tools-manager.js +327 -0
- package/dist/pi/coding-agent/utils/version-check.js +81 -0
- package/dist/pi/coding-agent/utils/windows-self-update.js +76 -0
- package/dist/pi/tui/autocomplete.js +631 -0
- package/dist/pi/tui/components/box.js +103 -0
- package/dist/pi/tui/components/cancellable-loader.js +34 -0
- package/dist/pi/tui/components/editor.js +1915 -0
- package/dist/pi/tui/components/image.js +88 -0
- package/dist/pi/tui/components/input.js +425 -0
- package/dist/pi/tui/components/loader.js +68 -0
- package/dist/pi/tui/components/markdown.js +633 -0
- package/dist/pi/tui/components/select-list.js +158 -0
- package/dist/pi/tui/components/settings-list.js +184 -0
- package/dist/pi/tui/components/spacer.js +22 -0
- package/dist/pi/tui/components/text.js +88 -0
- package/dist/pi/tui/components/truncated-text.js +50 -0
- package/dist/pi/tui/editor-component.js +1 -0
- package/dist/pi/tui/fuzzy.js +109 -0
- package/dist/pi/tui/index.js +31 -0
- package/dist/pi/tui/keybindings.js +173 -0
- package/dist/pi/tui/keys.js +1172 -0
- package/dist/pi/tui/kill-ring.js +43 -0
- package/dist/pi/tui/stdin-buffer.js +360 -0
- package/dist/pi/tui/terminal-image.js +335 -0
- package/dist/pi/tui/terminal.js +324 -0
- package/dist/pi/tui/tui.js +1076 -0
- package/dist/pi/tui/undo-stack.js +24 -0
- package/dist/pi/tui/utils.js +1016 -0
- package/dist/relay/dispatcher.js +30 -0
- package/dist/server/handlers/queue.js +52 -0
- package/dist/server/pi-bridge.js +9 -1
- package/dist/server/session-stream.js +76 -111
- package/dist/server/storage.js +154 -2
- package/dist/server/title-generator.js +14 -153
- package/package.json +24 -6
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
|
2
|
+
import ignore from "ignore";
|
|
3
|
+
import { basename, dirname, join, relative, resolve, sep } from "path";
|
|
4
|
+
import { CONFIG_DIR_NAME, getAgentDir } from "../config.js";
|
|
5
|
+
import { parseFrontmatter } from "../utils/frontmatter.js";
|
|
6
|
+
import { canonicalizePath, resolvePath } from "../utils/paths.js";
|
|
7
|
+
import { createSyntheticSourceInfo } from "./source-info.js";
|
|
8
|
+
/** Max name length per spec */
|
|
9
|
+
const MAX_NAME_LENGTH = 64;
|
|
10
|
+
/** Max description length per spec */
|
|
11
|
+
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
12
|
+
const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
|
|
13
|
+
function toPosixPath(p) {
|
|
14
|
+
return p.split(sep).join("/");
|
|
15
|
+
}
|
|
16
|
+
function prefixIgnorePattern(line, prefix) {
|
|
17
|
+
const trimmed = line.trim();
|
|
18
|
+
if (!trimmed)
|
|
19
|
+
return null;
|
|
20
|
+
if (trimmed.startsWith("#") && !trimmed.startsWith("\\#"))
|
|
21
|
+
return null;
|
|
22
|
+
let pattern = line;
|
|
23
|
+
let negated = false;
|
|
24
|
+
if (pattern.startsWith("!")) {
|
|
25
|
+
negated = true;
|
|
26
|
+
pattern = pattern.slice(1);
|
|
27
|
+
}
|
|
28
|
+
else if (pattern.startsWith("\\!")) {
|
|
29
|
+
pattern = pattern.slice(1);
|
|
30
|
+
}
|
|
31
|
+
if (pattern.startsWith("/")) {
|
|
32
|
+
pattern = pattern.slice(1);
|
|
33
|
+
}
|
|
34
|
+
const prefixed = prefix ? `${prefix}${pattern}` : pattern;
|
|
35
|
+
return negated ? `!${prefixed}` : prefixed;
|
|
36
|
+
}
|
|
37
|
+
function addIgnoreRules(ig, dir, rootDir) {
|
|
38
|
+
const relativeDir = relative(rootDir, dir);
|
|
39
|
+
const prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : "";
|
|
40
|
+
for (const filename of IGNORE_FILE_NAMES) {
|
|
41
|
+
const ignorePath = join(dir, filename);
|
|
42
|
+
if (!existsSync(ignorePath))
|
|
43
|
+
continue;
|
|
44
|
+
try {
|
|
45
|
+
const content = readFileSync(ignorePath, "utf-8");
|
|
46
|
+
const patterns = content
|
|
47
|
+
.split(/\r?\n/)
|
|
48
|
+
.map((line) => prefixIgnorePattern(line, prefix))
|
|
49
|
+
.filter((line) => Boolean(line));
|
|
50
|
+
if (patterns.length > 0) {
|
|
51
|
+
ig.add(patterns);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch { }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Validate skill name per Agent Skills spec.
|
|
59
|
+
* Returns array of validation error messages (empty if valid).
|
|
60
|
+
*/
|
|
61
|
+
function validateName(name) {
|
|
62
|
+
const errors = [];
|
|
63
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
64
|
+
errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);
|
|
65
|
+
}
|
|
66
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
67
|
+
errors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);
|
|
68
|
+
}
|
|
69
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
70
|
+
errors.push(`name must not start or end with a hyphen`);
|
|
71
|
+
}
|
|
72
|
+
if (name.includes("--")) {
|
|
73
|
+
errors.push(`name must not contain consecutive hyphens`);
|
|
74
|
+
}
|
|
75
|
+
return errors;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validate description per Agent Skills spec.
|
|
79
|
+
*/
|
|
80
|
+
function validateDescription(description) {
|
|
81
|
+
const errors = [];
|
|
82
|
+
if (!description || description.trim() === "") {
|
|
83
|
+
errors.push("description is required");
|
|
84
|
+
}
|
|
85
|
+
else if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
86
|
+
errors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);
|
|
87
|
+
}
|
|
88
|
+
return errors;
|
|
89
|
+
}
|
|
90
|
+
function createSkillSourceInfo(filePath, baseDir, source) {
|
|
91
|
+
switch (source) {
|
|
92
|
+
case "user":
|
|
93
|
+
return createSyntheticSourceInfo(filePath, {
|
|
94
|
+
source: "local",
|
|
95
|
+
scope: "user",
|
|
96
|
+
baseDir,
|
|
97
|
+
});
|
|
98
|
+
case "project":
|
|
99
|
+
return createSyntheticSourceInfo(filePath, {
|
|
100
|
+
source: "local",
|
|
101
|
+
scope: "project",
|
|
102
|
+
baseDir,
|
|
103
|
+
});
|
|
104
|
+
case "path":
|
|
105
|
+
return createSyntheticSourceInfo(filePath, {
|
|
106
|
+
source: "local",
|
|
107
|
+
baseDir,
|
|
108
|
+
});
|
|
109
|
+
default:
|
|
110
|
+
return createSyntheticSourceInfo(filePath, { source, baseDir });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Load skills from a directory.
|
|
115
|
+
*
|
|
116
|
+
* Discovery rules:
|
|
117
|
+
* - if a directory contains SKILL.md, treat it as a skill root and do not recurse further
|
|
118
|
+
* - otherwise, load direct .md children in the root
|
|
119
|
+
* - recurse into subdirectories to find SKILL.md
|
|
120
|
+
*/
|
|
121
|
+
export function loadSkillsFromDir(options) {
|
|
122
|
+
const { dir, source } = options;
|
|
123
|
+
return loadSkillsFromDirInternal(dir, source, true);
|
|
124
|
+
}
|
|
125
|
+
function loadSkillsFromDirInternal(dir, source, includeRootFiles, ignoreMatcher, rootDir) {
|
|
126
|
+
const skills = [];
|
|
127
|
+
const diagnostics = [];
|
|
128
|
+
if (!existsSync(dir)) {
|
|
129
|
+
return { skills, diagnostics };
|
|
130
|
+
}
|
|
131
|
+
const root = rootDir ?? dir;
|
|
132
|
+
const ig = ignoreMatcher ?? ignore();
|
|
133
|
+
addIgnoreRules(ig, dir, root);
|
|
134
|
+
try {
|
|
135
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
if (entry.name !== "SKILL.md") {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const fullPath = join(dir, entry.name);
|
|
141
|
+
let isFile = entry.isFile();
|
|
142
|
+
if (entry.isSymbolicLink()) {
|
|
143
|
+
try {
|
|
144
|
+
isFile = statSync(fullPath).isFile();
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const relPath = toPosixPath(relative(root, fullPath));
|
|
151
|
+
if (!isFile || ig.ignores(relPath)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const result = loadSkillFromFile(fullPath, source);
|
|
155
|
+
if (result.skill) {
|
|
156
|
+
skills.push(result.skill);
|
|
157
|
+
}
|
|
158
|
+
diagnostics.push(...result.diagnostics);
|
|
159
|
+
return { skills, diagnostics };
|
|
160
|
+
}
|
|
161
|
+
for (const entry of entries) {
|
|
162
|
+
if (entry.name.startsWith(".")) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
// Skip node_modules to avoid scanning dependencies
|
|
166
|
+
if (entry.name === "node_modules") {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
const fullPath = join(dir, entry.name);
|
|
170
|
+
// For symlinks, check if they point to a directory and follow them
|
|
171
|
+
let isDirectory = entry.isDirectory();
|
|
172
|
+
let isFile = entry.isFile();
|
|
173
|
+
if (entry.isSymbolicLink()) {
|
|
174
|
+
try {
|
|
175
|
+
const stats = statSync(fullPath);
|
|
176
|
+
isDirectory = stats.isDirectory();
|
|
177
|
+
isFile = stats.isFile();
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Broken symlink, skip it
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const relPath = toPosixPath(relative(root, fullPath));
|
|
185
|
+
const ignorePath = isDirectory ? `${relPath}/` : relPath;
|
|
186
|
+
if (ig.ignores(ignorePath)) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (isDirectory) {
|
|
190
|
+
const subResult = loadSkillsFromDirInternal(fullPath, source, false, ig, root);
|
|
191
|
+
skills.push(...subResult.skills);
|
|
192
|
+
diagnostics.push(...subResult.diagnostics);
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
if (!isFile || !includeRootFiles || !entry.name.endsWith(".md")) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const result = loadSkillFromFile(fullPath, source);
|
|
199
|
+
if (result.skill) {
|
|
200
|
+
skills.push(result.skill);
|
|
201
|
+
}
|
|
202
|
+
diagnostics.push(...result.diagnostics);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch { }
|
|
206
|
+
return { skills, diagnostics };
|
|
207
|
+
}
|
|
208
|
+
function loadSkillFromFile(filePath, source) {
|
|
209
|
+
const diagnostics = [];
|
|
210
|
+
try {
|
|
211
|
+
const rawContent = readFileSync(filePath, "utf-8");
|
|
212
|
+
const { frontmatter } = parseFrontmatter(rawContent);
|
|
213
|
+
const skillDir = dirname(filePath);
|
|
214
|
+
const parentDirName = basename(skillDir);
|
|
215
|
+
// Validate description
|
|
216
|
+
const descErrors = validateDescription(frontmatter.description);
|
|
217
|
+
for (const error of descErrors) {
|
|
218
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
219
|
+
}
|
|
220
|
+
// Use name from frontmatter, or fall back to parent directory name
|
|
221
|
+
const name = frontmatter.name || parentDirName;
|
|
222
|
+
// Validate name
|
|
223
|
+
const nameErrors = validateName(name);
|
|
224
|
+
for (const error of nameErrors) {
|
|
225
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
226
|
+
}
|
|
227
|
+
// Still load the skill even with warnings (unless description is completely missing)
|
|
228
|
+
if (!frontmatter.description || frontmatter.description.trim() === "") {
|
|
229
|
+
return { skill: null, diagnostics };
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
skill: {
|
|
233
|
+
name,
|
|
234
|
+
description: frontmatter.description,
|
|
235
|
+
filePath,
|
|
236
|
+
baseDir: skillDir,
|
|
237
|
+
sourceInfo: createSkillSourceInfo(filePath, skillDir, source),
|
|
238
|
+
disableModelInvocation: frontmatter["disable-model-invocation"] === true,
|
|
239
|
+
},
|
|
240
|
+
diagnostics,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
const message = error instanceof Error ? error.message : "failed to parse skill file";
|
|
245
|
+
diagnostics.push({ type: "warning", message, path: filePath });
|
|
246
|
+
return { skill: null, diagnostics };
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Format skills for inclusion in a system prompt.
|
|
251
|
+
* Uses XML format per Agent Skills standard.
|
|
252
|
+
* See: https://agentskills.io/integrate-skills
|
|
253
|
+
*
|
|
254
|
+
* Skills with disableModelInvocation=true are excluded from the prompt
|
|
255
|
+
* (they can only be invoked explicitly via /skill:name commands).
|
|
256
|
+
*/
|
|
257
|
+
export function formatSkillsForPrompt(skills) {
|
|
258
|
+
const visibleSkills = skills.filter((s) => !s.disableModelInvocation);
|
|
259
|
+
if (visibleSkills.length === 0) {
|
|
260
|
+
return "";
|
|
261
|
+
}
|
|
262
|
+
const lines = [
|
|
263
|
+
"\n\nThe following skills provide specialized instructions for specific tasks.",
|
|
264
|
+
"Use the read tool to load a skill's file when the task matches its description.",
|
|
265
|
+
"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.",
|
|
266
|
+
"",
|
|
267
|
+
"<available_skills>",
|
|
268
|
+
];
|
|
269
|
+
for (const skill of visibleSkills) {
|
|
270
|
+
lines.push(" <skill>");
|
|
271
|
+
lines.push(` <name>${escapeXml(skill.name)}</name>`);
|
|
272
|
+
lines.push(` <description>${escapeXml(skill.description)}</description>`);
|
|
273
|
+
lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
|
|
274
|
+
lines.push(" </skill>");
|
|
275
|
+
}
|
|
276
|
+
lines.push("</available_skills>");
|
|
277
|
+
return lines.join("\n");
|
|
278
|
+
}
|
|
279
|
+
function escapeXml(str) {
|
|
280
|
+
return str
|
|
281
|
+
.replace(/&/g, "&")
|
|
282
|
+
.replace(/</g, "<")
|
|
283
|
+
.replace(/>/g, ">")
|
|
284
|
+
.replace(/"/g, """)
|
|
285
|
+
.replace(/'/g, "'");
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Load skills from all configured locations.
|
|
289
|
+
* Returns skills and any validation diagnostics.
|
|
290
|
+
*/
|
|
291
|
+
export function loadSkills(options) {
|
|
292
|
+
const { agentDir, skillPaths, includeDefaults } = options;
|
|
293
|
+
// Resolve agentDir - if not provided, use default from config
|
|
294
|
+
const resolvedCwd = resolvePath(options.cwd);
|
|
295
|
+
const resolvedAgentDir = resolvePath(agentDir ?? getAgentDir());
|
|
296
|
+
const skillMap = new Map();
|
|
297
|
+
const realPathSet = new Set();
|
|
298
|
+
const allDiagnostics = [];
|
|
299
|
+
const collisionDiagnostics = [];
|
|
300
|
+
function addSkills(result) {
|
|
301
|
+
allDiagnostics.push(...result.diagnostics);
|
|
302
|
+
for (const skill of result.skills) {
|
|
303
|
+
// Resolve symlinks to detect duplicate files
|
|
304
|
+
const realPath = canonicalizePath(skill.filePath);
|
|
305
|
+
// Skip silently if we've already loaded this exact file (via symlink)
|
|
306
|
+
if (realPathSet.has(realPath)) {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const existing = skillMap.get(skill.name);
|
|
310
|
+
if (existing) {
|
|
311
|
+
collisionDiagnostics.push({
|
|
312
|
+
type: "collision",
|
|
313
|
+
message: `name "${skill.name}" collision`,
|
|
314
|
+
path: skill.filePath,
|
|
315
|
+
collision: {
|
|
316
|
+
resourceType: "skill",
|
|
317
|
+
name: skill.name,
|
|
318
|
+
winnerPath: existing.filePath,
|
|
319
|
+
loserPath: skill.filePath,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
skillMap.set(skill.name, skill);
|
|
325
|
+
realPathSet.add(realPath);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
if (includeDefaults) {
|
|
330
|
+
addSkills(loadSkillsFromDirInternal(join(resolvedAgentDir, "skills"), "user", true));
|
|
331
|
+
addSkills(loadSkillsFromDirInternal(resolve(resolvedCwd, CONFIG_DIR_NAME, "skills"), "project", true));
|
|
332
|
+
}
|
|
333
|
+
const userSkillsDir = join(resolvedAgentDir, "skills");
|
|
334
|
+
const projectSkillsDir = resolve(resolvedCwd, CONFIG_DIR_NAME, "skills");
|
|
335
|
+
const isUnderPath = (target, root) => {
|
|
336
|
+
const normalizedRoot = resolve(root);
|
|
337
|
+
if (target === normalizedRoot) {
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
const prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;
|
|
341
|
+
return target.startsWith(prefix);
|
|
342
|
+
};
|
|
343
|
+
const getSource = (resolvedPath) => {
|
|
344
|
+
if (!includeDefaults) {
|
|
345
|
+
if (isUnderPath(resolvedPath, userSkillsDir))
|
|
346
|
+
return "user";
|
|
347
|
+
if (isUnderPath(resolvedPath, projectSkillsDir))
|
|
348
|
+
return "project";
|
|
349
|
+
}
|
|
350
|
+
return "path";
|
|
351
|
+
};
|
|
352
|
+
for (const rawPath of skillPaths) {
|
|
353
|
+
const resolvedPath = resolvePath(rawPath, resolvedCwd, { trim: true });
|
|
354
|
+
if (!existsSync(resolvedPath)) {
|
|
355
|
+
allDiagnostics.push({ type: "warning", message: "skill path does not exist", path: resolvedPath });
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
try {
|
|
359
|
+
const stats = statSync(resolvedPath);
|
|
360
|
+
const source = getSource(resolvedPath);
|
|
361
|
+
if (stats.isDirectory()) {
|
|
362
|
+
addSkills(loadSkillsFromDirInternal(resolvedPath, source, true));
|
|
363
|
+
}
|
|
364
|
+
else if (stats.isFile() && resolvedPath.endsWith(".md")) {
|
|
365
|
+
const result = loadSkillFromFile(resolvedPath, source);
|
|
366
|
+
if (result.skill) {
|
|
367
|
+
addSkills({ skills: [result.skill], diagnostics: result.diagnostics });
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
allDiagnostics.push(...result.diagnostics);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
allDiagnostics.push({ type: "warning", message: "skill path is not a markdown file", path: resolvedPath });
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch (error) {
|
|
378
|
+
const message = error instanceof Error ? error.message : "failed to read skill path";
|
|
379
|
+
allDiagnostics.push({ type: "warning", message, path: resolvedPath });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return {
|
|
383
|
+
skills: Array.from(skillMap.values()),
|
|
384
|
+
diagnostics: [...allDiagnostics, ...collisionDiagnostics],
|
|
385
|
+
};
|
|
386
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { APP_NAME } from "../config.js";
|
|
2
|
+
export const BUILTIN_SLASH_COMMANDS = [
|
|
3
|
+
{ name: "settings", description: "Open settings menu" },
|
|
4
|
+
{ name: "model", description: "Select model (opens selector UI)" },
|
|
5
|
+
{ name: "scoped-models", description: "Enable/disable models for Ctrl+P cycling" },
|
|
6
|
+
{ name: "export", description: "Export session (HTML default, or specify path: .html/.jsonl)" },
|
|
7
|
+
{ name: "import", description: "Import and resume a session from a JSONL file" },
|
|
8
|
+
{ name: "share", description: "Share session as a secret GitHub gist" },
|
|
9
|
+
{ name: "copy", description: "Copy last agent message to clipboard" },
|
|
10
|
+
{ name: "name", description: "Set session display name" },
|
|
11
|
+
{ name: "session", description: "Show session info and stats" },
|
|
12
|
+
{ name: "changelog", description: "Show changelog entries" },
|
|
13
|
+
{ name: "hotkeys", description: "Show all keyboard shortcuts" },
|
|
14
|
+
{ name: "fork", description: "Create a new fork from a previous user message" },
|
|
15
|
+
{ name: "clone", description: "Duplicate the current session at the current position" },
|
|
16
|
+
{ name: "tree", description: "Navigate session tree (switch branches)" },
|
|
17
|
+
{ name: "login", description: "Configure provider authentication" },
|
|
18
|
+
{ name: "logout", description: "Remove provider authentication" },
|
|
19
|
+
{ name: "new", description: "Start a new session" },
|
|
20
|
+
{ name: "compact", description: "Manually compact the session context" },
|
|
21
|
+
{ name: "resume", description: "Resume a different session" },
|
|
22
|
+
{ name: "reload", description: "Reload keybindings, extensions, skills, prompts, and themes" },
|
|
23
|
+
{ name: "quit", description: `Quit ${APP_NAME}` },
|
|
24
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function createSourceInfo(path, metadata) {
|
|
2
|
+
return {
|
|
3
|
+
path,
|
|
4
|
+
source: metadata.source,
|
|
5
|
+
scope: metadata.scope,
|
|
6
|
+
origin: metadata.origin,
|
|
7
|
+
baseDir: metadata.baseDir,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function createSyntheticSourceInfo(path, options) {
|
|
11
|
+
return {
|
|
12
|
+
path,
|
|
13
|
+
source: options.source,
|
|
14
|
+
scope: options.scope ?? "temporary",
|
|
15
|
+
origin: options.origin ?? "top-level",
|
|
16
|
+
baseDir: options.baseDir,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System prompt construction and project context loading
|
|
3
|
+
*/
|
|
4
|
+
import { getDocsPath, getExamplesPath, getReadmePath } from "../config.js";
|
|
5
|
+
import { formatSkillsForPrompt } from "./skills.js";
|
|
6
|
+
/** Build the system prompt with tools, guidelines, and context */
|
|
7
|
+
export function buildSystemPrompt(options) {
|
|
8
|
+
const { customPrompt, selectedTools, toolSnippets, promptGuidelines, appendSystemPrompt, cwd, contextFiles: providedContextFiles, skills: providedSkills, } = options;
|
|
9
|
+
const resolvedCwd = cwd;
|
|
10
|
+
const promptCwd = resolvedCwd.replace(/\\/g, "/");
|
|
11
|
+
const now = new Date();
|
|
12
|
+
const year = now.getFullYear();
|
|
13
|
+
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
14
|
+
const day = String(now.getDate()).padStart(2, "0");
|
|
15
|
+
const date = `${year}-${month}-${day}`;
|
|
16
|
+
const appendSection = appendSystemPrompt ? `\n\n${appendSystemPrompt}` : "";
|
|
17
|
+
const contextFiles = providedContextFiles ?? [];
|
|
18
|
+
const skills = providedSkills ?? [];
|
|
19
|
+
if (customPrompt) {
|
|
20
|
+
let prompt = customPrompt;
|
|
21
|
+
if (appendSection) {
|
|
22
|
+
prompt += appendSection;
|
|
23
|
+
}
|
|
24
|
+
// Append project context files
|
|
25
|
+
if (contextFiles.length > 0) {
|
|
26
|
+
prompt += "\n\n<project_context>\n\n";
|
|
27
|
+
prompt += "Project-specific instructions and guidelines:\n\n";
|
|
28
|
+
for (const { path: filePath, content } of contextFiles) {
|
|
29
|
+
prompt += `<project_instructions path="${filePath}">\n${content}\n</project_instructions>\n\n`;
|
|
30
|
+
}
|
|
31
|
+
prompt += "</project_context>\n";
|
|
32
|
+
}
|
|
33
|
+
// Append skills section (only if read tool is available)
|
|
34
|
+
const customPromptHasRead = !selectedTools || selectedTools.includes("read");
|
|
35
|
+
if (customPromptHasRead && skills.length > 0) {
|
|
36
|
+
prompt += formatSkillsForPrompt(skills);
|
|
37
|
+
}
|
|
38
|
+
// Add date and working directory last
|
|
39
|
+
prompt += `\nCurrent date: ${date}`;
|
|
40
|
+
prompt += `\nCurrent working directory: ${promptCwd}`;
|
|
41
|
+
return prompt;
|
|
42
|
+
}
|
|
43
|
+
// Get absolute paths to documentation and examples
|
|
44
|
+
const readmePath = getReadmePath();
|
|
45
|
+
const docsPath = getDocsPath();
|
|
46
|
+
const examplesPath = getExamplesPath();
|
|
47
|
+
// Build tools list based on selected tools.
|
|
48
|
+
// A tool appears in Available tools only when the caller provides a one-line snippet.
|
|
49
|
+
const tools = selectedTools || ["read", "bash", "edit", "write"];
|
|
50
|
+
const visibleTools = tools.filter((name) => !!toolSnippets?.[name]);
|
|
51
|
+
const toolsList = visibleTools.length > 0 ? visibleTools.map((name) => `- ${name}: ${toolSnippets[name]}`).join("\n") : "(none)";
|
|
52
|
+
// Build guidelines based on which tools are actually available
|
|
53
|
+
const guidelinesList = [];
|
|
54
|
+
const guidelinesSet = new Set();
|
|
55
|
+
const addGuideline = (guideline) => {
|
|
56
|
+
if (guidelinesSet.has(guideline)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
guidelinesSet.add(guideline);
|
|
60
|
+
guidelinesList.push(guideline);
|
|
61
|
+
};
|
|
62
|
+
const hasBash = tools.includes("bash");
|
|
63
|
+
const hasGrep = tools.includes("grep");
|
|
64
|
+
const hasFind = tools.includes("find");
|
|
65
|
+
const hasLs = tools.includes("ls");
|
|
66
|
+
const hasRead = tools.includes("read");
|
|
67
|
+
// File exploration guidelines
|
|
68
|
+
if (hasBash && !hasGrep && !hasFind && !hasLs) {
|
|
69
|
+
addGuideline("Use bash for file operations like ls, rg, find");
|
|
70
|
+
}
|
|
71
|
+
else if (hasBash && (hasGrep || hasFind || hasLs)) {
|
|
72
|
+
addGuideline("Prefer grep/find/ls tools over bash for file exploration (faster, respects .gitignore)");
|
|
73
|
+
}
|
|
74
|
+
for (const guideline of promptGuidelines ?? []) {
|
|
75
|
+
const normalized = guideline.trim();
|
|
76
|
+
if (normalized.length > 0) {
|
|
77
|
+
addGuideline(normalized);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Always include these
|
|
81
|
+
addGuideline("Be concise in your responses");
|
|
82
|
+
addGuideline("Show file paths clearly when working with files");
|
|
83
|
+
const guidelines = guidelinesList.map((g) => `- ${g}`).join("\n");
|
|
84
|
+
let prompt = `You are an expert coding assistant operating inside pi, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files.
|
|
85
|
+
|
|
86
|
+
Available tools:
|
|
87
|
+
${toolsList}
|
|
88
|
+
|
|
89
|
+
In addition to the tools above, you may have access to other custom tools depending on the project.
|
|
90
|
+
|
|
91
|
+
Guidelines:
|
|
92
|
+
${guidelines}
|
|
93
|
+
|
|
94
|
+
Pi documentation (read only when the user asks about pi itself, its SDK, extensions, themes, skills, or TUI):
|
|
95
|
+
- Main documentation: ${readmePath}
|
|
96
|
+
- Additional docs: ${docsPath}
|
|
97
|
+
- Examples: ${examplesPath} (extensions, custom tools, SDK)
|
|
98
|
+
- When reading pi docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory
|
|
99
|
+
- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), pi packages (docs/packages.md)
|
|
100
|
+
- When working on pi topics, read the docs and examples, and follow .md cross-references before implementing
|
|
101
|
+
- Always read pi .md files completely and follow links to related docs (e.g., tui.md for TUI API details)`;
|
|
102
|
+
if (appendSection) {
|
|
103
|
+
prompt += appendSection;
|
|
104
|
+
}
|
|
105
|
+
// Append project context files
|
|
106
|
+
if (contextFiles.length > 0) {
|
|
107
|
+
prompt += "\n\n<project_context>\n\n";
|
|
108
|
+
prompt += "Project-specific instructions and guidelines:\n\n";
|
|
109
|
+
for (const { path: filePath, content } of contextFiles) {
|
|
110
|
+
prompt += `<project_instructions path="${filePath}">\n${content}\n</project_instructions>\n\n`;
|
|
111
|
+
}
|
|
112
|
+
prompt += "</project_context>\n";
|
|
113
|
+
}
|
|
114
|
+
// Append skills section (only if read tool is available)
|
|
115
|
+
if (hasRead && skills.length > 0) {
|
|
116
|
+
prompt += formatSkillsForPrompt(skills);
|
|
117
|
+
}
|
|
118
|
+
// Add date and working directory last
|
|
119
|
+
prompt += `\nCurrent date: ${date}`;
|
|
120
|
+
prompt += `\nCurrent working directory: ${promptCwd}`;
|
|
121
|
+
return prompt;
|
|
122
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function isTruthyEnvFlag(value) {
|
|
2
|
+
if (!value)
|
|
3
|
+
return false;
|
|
4
|
+
return value === "1" || value.toLowerCase() === "true" || value.toLowerCase() === "yes";
|
|
5
|
+
}
|
|
6
|
+
export function isInstallTelemetryEnabled(settingsManager, telemetryEnv = process.env.PI_TELEMETRY) {
|
|
7
|
+
return telemetryEnv !== undefined ? isTruthyEnvFlag(telemetryEnv) : settingsManager.getEnableInstallTelemetry();
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central timing instrumentation for startup profiling.
|
|
3
|
+
* Enable with PI_TIMING=1 environment variable.
|
|
4
|
+
*/
|
|
5
|
+
const ENABLED = process.env.PI_TIMING === "1";
|
|
6
|
+
const timings = [];
|
|
7
|
+
let lastTime = Date.now();
|
|
8
|
+
export function resetTimings() {
|
|
9
|
+
if (!ENABLED)
|
|
10
|
+
return;
|
|
11
|
+
timings.length = 0;
|
|
12
|
+
lastTime = Date.now();
|
|
13
|
+
}
|
|
14
|
+
export function time(label) {
|
|
15
|
+
if (!ENABLED)
|
|
16
|
+
return;
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
timings.push({ label, ms: now - lastTime });
|
|
19
|
+
lastTime = now;
|
|
20
|
+
}
|
|
21
|
+
export function printTimings() {
|
|
22
|
+
if (!ENABLED || timings.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
console.error("\n--- Startup Timings ---");
|
|
25
|
+
for (const t of timings) {
|
|
26
|
+
console.error(` ${t.label}: ${t.ms}ms`);
|
|
27
|
+
}
|
|
28
|
+
console.error(` TOTAL: ${timings.reduce((a, b) => a + b.ms, 0)}ms`);
|
|
29
|
+
console.error("------------------------\n");
|
|
30
|
+
}
|