@kingingwang/pi-darwin-arm64 0.85.1 → 0.87.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/bin/CHANGELOG.md +148 -0
- package/bin/README.md +39 -1
- package/bin/docs/compaction.md +62 -17
- package/bin/docs/custom-provider.md +22 -13
- package/bin/docs/development.md +4 -4
- package/bin/docs/docs.json +4 -0
- package/bin/docs/environment-variables.md +1 -0
- package/bin/docs/extensions.md +127 -49
- package/bin/docs/json.md +4 -4
- package/bin/docs/models.md +61 -2
- package/bin/docs/providers.md +10 -2
- package/bin/docs/sdk.md +17 -4
- package/bin/docs/security.md +1 -1
- package/bin/docs/session-format.md +96 -41
- package/bin/docs/sessions.md +27 -0
- package/bin/docs/settings.md +56 -1
- package/bin/docs/termux.md +0 -1
- package/bin/docs/tui.md +2 -2
- package/bin/docs/usage.md +1 -0
- package/bin/examples/extensions/README.md +0 -1
- package/bin/examples/extensions/custom-provider-anthropic/index.ts +18 -12
- package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/bin/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/bin/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/bin/examples/extensions/gondolin/package-lock.json +2 -2
- package/bin/examples/extensions/gondolin/package.json +1 -1
- package/bin/examples/extensions/prompt-customizer.ts +19 -67
- package/bin/examples/extensions/sandbox/package-lock.json +2 -2
- package/bin/examples/extensions/sandbox/package.json +1 -1
- package/bin/examples/extensions/with-deps/package-lock.json +2 -2
- package/bin/examples/extensions/with-deps/package.json +1 -1
- package/bin/examples/plugins/pi-example-plugin/src/session.ts +3 -2
- package/bin/export-html/template.js +6 -1
- package/bin/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/bin/package.json +17 -23
- package/bin/pi +2 -2
- package/package.json +1 -1
- package/bin/examples/extensions/kimi-deferred-tools.ts +0 -61
- package/bin/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
- package/bin/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
- package/bin/node_modules/@mariozechner/clipboard/README.md +0 -60
- package/bin/node_modules/@mariozechner/clipboard/build.rs +0 -5
- package/bin/node_modules/@mariozechner/clipboard/clipboard.darwin-arm64.node +0 -0
- package/bin/node_modules/@mariozechner/clipboard/exp.ts +0 -12
- package/bin/node_modules/@mariozechner/clipboard/index.d.ts +0 -37
- package/bin/node_modules/@mariozechner/clipboard/index.js +0 -606
- package/bin/node_modules/@mariozechner/clipboard/package.json +0 -56
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
- package/bin/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
- package/bin/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-gondolin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-gondolin",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.87.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Prompt Customizer Extension
|
|
3
3
|
*
|
|
4
|
-
* Demonstrates using systemPromptOptions to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* This extension adds tool-specific guidance based on what tools and skills
|
|
8
|
-
* are currently active, respecting whatever the user has configured.
|
|
4
|
+
* Demonstrates using systemPromptOptions to add context-aware prompt sections
|
|
5
|
+
* without replacing or reparsing the complete rendered prompt.
|
|
9
6
|
*
|
|
10
7
|
* Usage:
|
|
11
8
|
* 1. Copy this file to ~/.pi/agent/extensions/ or your project's .pi/extensions/
|
|
@@ -14,84 +11,39 @@
|
|
|
14
11
|
|
|
15
12
|
import type { BuildSystemPromptOptions, ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
* Adds tool-specific guidance that adapts to the active tool set.
|
|
19
|
-
* Instead of appending one-size-fits-all instructions, this reads what's
|
|
20
|
-
* actually loaded and tailors the guidance accordingly.
|
|
21
|
-
*/
|
|
22
|
-
function addToolGuidance(options: BuildSystemPromptOptions, basePrompt: string): string {
|
|
14
|
+
function buildToolGuidance(options: BuildSystemPromptOptions): string {
|
|
23
15
|
const hasTool = (name: string) => options.selectedTools?.includes(name) ?? false;
|
|
24
|
-
|
|
25
|
-
const parts: string[] = [];
|
|
16
|
+
const rules: string[] = [];
|
|
26
17
|
|
|
27
18
|
if (hasTool("read")) {
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
19
|
+
rules.push(
|
|
20
|
+
"- Use `read` for file contents; it supports text and images.",
|
|
21
|
+
"- For large files, use `offset` and `limit` to read in chunks.",
|
|
31
22
|
);
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
if (hasTool("bash")) {
|
|
35
|
-
|
|
25
|
+
rules.push("- Use `bash` for file operations such as `ls`, `find`, and `grep`.");
|
|
36
26
|
}
|
|
37
|
-
|
|
38
27
|
if (hasTool("edit")) {
|
|
39
|
-
|
|
40
|
-
"• Use the `edit` tool for precise text replacements in files. Match exact content including whitespace.",
|
|
41
|
-
);
|
|
28
|
+
rules.push("- Use `edit` for precise text replacements that match existing content exactly.");
|
|
42
29
|
}
|
|
43
|
-
|
|
44
30
|
if (hasTool("write")) {
|
|
45
|
-
|
|
31
|
+
rules.push("- Use `write` to create new files or replace existing files completely.");
|
|
46
32
|
}
|
|
47
|
-
|
|
48
33
|
if (options.skills && options.skills.length > 0) {
|
|
49
|
-
|
|
50
|
-
parts.push(`\nAvailable skills: ${skillNames}`, "Use skill documentation for best practices on specific tools.");
|
|
34
|
+
rules.push(`- Available skills: ${options.skills.map((skill) => skill.name).join(", ")}.`);
|
|
51
35
|
}
|
|
52
36
|
|
|
53
|
-
|
|
54
|
-
return basePrompt;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return `${basePrompt}
|
|
58
|
-
|
|
59
|
-
## Tool Guidance
|
|
60
|
-
|
|
61
|
-
${parts.join("\n")}
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Merges extension instructions with user-provided append prompts.
|
|
67
|
-
* This respects whatever the user configured via --append-system-prompt
|
|
68
|
-
* flags or files, rather than duplicating that work.
|
|
69
|
-
*/
|
|
70
|
-
function mergeWithUserAppend(options: BuildSystemPromptOptions): string {
|
|
71
|
-
const userAppend = options.appendSystemPrompt;
|
|
72
|
-
const extensionSpecific = `
|
|
73
|
-
## Extension-Added Context
|
|
74
|
-
|
|
75
|
-
This prompt includes tool guidance and skill information loaded dynamically.
|
|
76
|
-
If you have additional requirements, configure them via --append-system-prompt or project context files.
|
|
77
|
-
`;
|
|
78
|
-
|
|
79
|
-
if (userAppend) {
|
|
80
|
-
return `${userAppend}\n\n${extensionSpecific}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return extensionSpecific;
|
|
37
|
+
return rules.join("\n");
|
|
84
38
|
}
|
|
85
39
|
|
|
86
40
|
export default function promptCustomizer(pi: ExtensionAPI) {
|
|
87
|
-
pi.on("before_agent_start",
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
systemPrompt: `${customPrompt}${appendSection}`,
|
|
95
|
-
};
|
|
41
|
+
pi.on("before_agent_start", (event) => {
|
|
42
|
+
const guidance = buildToolGuidance(event.systemPromptOptions);
|
|
43
|
+
if (guidance) {
|
|
44
|
+
event.systemPromptOptions.sections.tool_guidance = guidance;
|
|
45
|
+
} else {
|
|
46
|
+
delete event.systemPromptOptions.sections.tool_guidance;
|
|
47
|
+
}
|
|
96
48
|
});
|
|
97
49
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.17.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.87.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
|
@@ -16,8 +16,9 @@ export default defineFacet({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
env.onActivate(() => {
|
|
19
|
-
workerActivations.
|
|
20
|
-
|
|
19
|
+
workerActivations.change(BACKGROUND_CONTEXT, (draft) => {
|
|
20
|
+
draft.count += 1;
|
|
21
|
+
});
|
|
21
22
|
});
|
|
22
23
|
},
|
|
23
24
|
});
|
|
@@ -357,6 +357,9 @@
|
|
|
357
357
|
case 'thinking_level_change':
|
|
358
358
|
parts.push('thinking', entry.thinkingLevel);
|
|
359
359
|
break;
|
|
360
|
+
case 'context_edit':
|
|
361
|
+
parts.push('context edit', entry.replacement === null ? 'omit' : 'replace', entry.targetId);
|
|
362
|
+
break;
|
|
360
363
|
}
|
|
361
364
|
|
|
362
365
|
return parts.join(' ').toLowerCase();
|
|
@@ -385,7 +388,7 @@
|
|
|
385
388
|
}
|
|
386
389
|
|
|
387
390
|
// Apply filter mode
|
|
388
|
-
const isSettingsEntry = ['label', 'custom', 'model_change', 'thinking_level_change'].includes(entry.type);
|
|
391
|
+
const isSettingsEntry = ['label', 'custom', 'context_edit', 'model_change', 'thinking_level_change'].includes(entry.type);
|
|
389
392
|
let passesFilter = true;
|
|
390
393
|
|
|
391
394
|
switch (filterMode) {
|
|
@@ -696,6 +699,8 @@
|
|
|
696
699
|
return labelHtml + `<span class="tree-muted">[model: ${escapeHtml(entry.modelId)}]</span>`;
|
|
697
700
|
case 'thinking_level_change':
|
|
698
701
|
return labelHtml + `<span class="tree-muted">[thinking: ${escapeHtml(entry.thinkingLevel)}]</span>`;
|
|
702
|
+
case 'context_edit':
|
|
703
|
+
return labelHtml + `<span class="tree-muted">[context ${entry.replacement === null ? 'omit' : 'replace'}: ${escapeHtml(entry.targetId)}]</span>`;
|
|
699
704
|
default:
|
|
700
705
|
return labelHtml + `<span class="tree-muted">[${escapeHtml(entry.type)}]</span>`;
|
|
701
706
|
}
|
package/bin/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node}
RENAMED
|
Binary file
|
package/bin/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-coding-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -49,45 +49,39 @@
|
|
|
49
49
|
"prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@earendil-works/chord": "^0.
|
|
53
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
54
|
-
"@earendil-works/pi-ai": "^0.
|
|
55
|
-
"@earendil-works/pi-tui": "^0.
|
|
52
|
+
"@earendil-works/chord": "^0.87.0",
|
|
53
|
+
"@earendil-works/pi-agent-core": "^0.87.0",
|
|
54
|
+
"@earendil-works/pi-ai": "^0.87.0",
|
|
55
|
+
"@earendil-works/pi-tui": "^0.87.0",
|
|
56
56
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
57
|
-
"chalk": "
|
|
57
|
+
"chalk": "6.0.0",
|
|
58
58
|
"cross-spawn": "7.0.6",
|
|
59
59
|
"diff": "8.0.4",
|
|
60
|
-
"grok-mermaid": "0.2.
|
|
60
|
+
"grok-mermaid": "0.2.3",
|
|
61
61
|
"highlight.js": "10.7.3",
|
|
62
62
|
"hosted-git-info": "9.0.3",
|
|
63
|
-
"ignore": "7.0.
|
|
63
|
+
"ignore": "7.0.8",
|
|
64
64
|
"jiti": "2.7.0",
|
|
65
|
-
"minimatch": "10.2.
|
|
65
|
+
"minimatch": "10.2.6",
|
|
66
66
|
"proper-lockfile": "4.1.2",
|
|
67
|
-
"semver": "7.8.
|
|
68
|
-
"typebox": "1.3.
|
|
69
|
-
"undici": "8.
|
|
67
|
+
"semver": "7.8.5",
|
|
68
|
+
"typebox": "1.3.27",
|
|
69
|
+
"undici": "8.10.2",
|
|
70
70
|
"yaml": "2.9.0"
|
|
71
71
|
},
|
|
72
72
|
"overrides": {
|
|
73
|
-
"protobufjs": "7.6.
|
|
74
|
-
"rimraf": "6.1.2",
|
|
75
|
-
"gaxios": {
|
|
76
|
-
"rimraf": "6.1.2"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"optionalDependencies": {
|
|
80
|
-
"@mariozechner/clipboard": "0.3.9"
|
|
73
|
+
"protobufjs": "7.6.6"
|
|
81
74
|
},
|
|
82
75
|
"devDependencies": {
|
|
83
|
-
"@earendil-works/pi-client": "^0.
|
|
84
|
-
"@earendil-works/pi-protocol": "^0.
|
|
85
|
-
"@earendil-works/pi-server": "^0.
|
|
76
|
+
"@earendil-works/pi-client": "^0.87.0",
|
|
77
|
+
"@earendil-works/pi-protocol": "^0.87.0",
|
|
78
|
+
"@earendil-works/pi-server": "^0.87.0",
|
|
86
79
|
"@types/cross-spawn": "6.0.6",
|
|
87
80
|
"@types/hosted-git-info": "3.0.5",
|
|
88
81
|
"@types/node": "22.19.19",
|
|
89
82
|
"@types/proper-lockfile": "4.1.4",
|
|
90
83
|
"@types/semver": "7.7.1",
|
|
84
|
+
"marked": "18.0.11",
|
|
91
85
|
"shx": "0.4.0",
|
|
92
86
|
"typescript": "5.9.3",
|
|
93
87
|
"vitest": "4.1.9"
|
package/bin/pi
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/pi
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 75648482 bytes
|
|
4
|
+
sha256: a1f53675d284ebece7e63117b65c26ce2f4cee10f044b8e4148393ad3c24acc3
|
package/package.json
CHANGED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Minimal Kimi deferred-tool loading demo.
|
|
3
|
-
*
|
|
4
|
-
* pi -e ./kimi-deferred-tools.ts
|
|
5
|
-
* example prompt: Use the available tools to calculate 100 + 500. Do not calculate it yourself.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
9
|
-
import { Type } from "typebox";
|
|
10
|
-
|
|
11
|
-
function calculate(_expr: string): string {
|
|
12
|
-
return "42";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function (pi: ExtensionAPI): void {
|
|
16
|
-
pi.registerTool({
|
|
17
|
-
name: "Calculator",
|
|
18
|
-
label: "Calculator",
|
|
19
|
-
description: "Evaluate a simple arithmetic expression.",
|
|
20
|
-
parameters: Type.Object({
|
|
21
|
-
expr: Type.String({ description: "An expression such as 100 + 500" }),
|
|
22
|
-
}),
|
|
23
|
-
async execute(_toolCallId, params) {
|
|
24
|
-
return {
|
|
25
|
-
content: [{ type: "text", text: calculate(params.expr) }],
|
|
26
|
-
details: {},
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
pi.registerTool({
|
|
32
|
-
name: "tool_search",
|
|
33
|
-
label: "Tool Search",
|
|
34
|
-
description: "Find and activate tools for a capability.",
|
|
35
|
-
promptSnippet: "Search for additional tools when the active tools cannot perform the task",
|
|
36
|
-
parameters: Type.Object({
|
|
37
|
-
query: Type.String({ description: "Capability to search for" }),
|
|
38
|
-
}),
|
|
39
|
-
async execute(_toolCallId, params) {
|
|
40
|
-
if (!params.query.toLowerCase().includes("calc")) {
|
|
41
|
-
return {
|
|
42
|
-
content: [{ type: "text", text: "The relevant tools do not exist." }],
|
|
43
|
-
details: { matches: [], added: [] },
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const active = pi.getActiveTools();
|
|
48
|
-
const added = active.includes("Calculator") ? [] : ["Calculator"];
|
|
49
|
-
if (added.length > 0) pi.setActiveTools([...active, ...added]);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
content: [{ type: "text", text: "Success. Found 1 matching tool(s)" }],
|
|
53
|
-
details: { matches: ["Calculator"], added },
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
pi.on("session_start", () => {
|
|
59
|
-
pi.setActiveTools(["tool_search"]);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
edition = "2021"
|
|
3
|
-
name = "crosscopy_clipboard"
|
|
4
|
-
version = "0.0.0"
|
|
5
|
-
|
|
6
|
-
[lib]
|
|
7
|
-
crate-type = ["cdylib"]
|
|
8
|
-
|
|
9
|
-
[features]
|
|
10
|
-
default = ["image"]
|
|
11
|
-
image = ["dep:image"]
|
|
12
|
-
wayland = ["dep:wl-clipboard-rs"]
|
|
13
|
-
|
|
14
|
-
[dependencies]
|
|
15
|
-
base64 = "0.22.0"
|
|
16
|
-
futures = "0.3.30"
|
|
17
|
-
# Pin image to version compatible with older Rust in CI Docker images
|
|
18
|
-
image = { version = "=0.25.5", features = ["png", "jpeg"], optional = true, default-features = false }
|
|
19
|
-
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
|
20
|
-
napi = { version = "3.9.0", default-features = false, features = ["napi4", "tokio_rt", "dyn-symbols"] }
|
|
21
|
-
napi-derive = "3.5.6"
|
|
22
|
-
tokio = "1.36.0"
|
|
23
|
-
|
|
24
|
-
[target.'cfg(all(unix, not(any(target_os="macos", target_os="android", target_os="ios", target_os="emscripten"))))'.dependencies]
|
|
25
|
-
wl-clipboard-rs = { version = "0.9", optional = true }
|
|
26
|
-
x11rb = { version = "0.13.2", features = ["xfixes"] }
|
|
27
|
-
|
|
28
|
-
[target.'cfg(target_os = "macos")'.dependencies]
|
|
29
|
-
image = { version = "=0.25.5", features = ["tiff", "png", "jpeg"], optional = true, default-features = false }
|
|
30
|
-
objc2 = "0.6.3"
|
|
31
|
-
objc2-app-kit = { version = "0.3.2", features = ["NSPasteboard", "NSPasteboardItem", "NSImage"] }
|
|
32
|
-
objc2-foundation = { version = "0.3.2", features = ["NSArray", "NSString", "NSEnumerator"] }
|
|
33
|
-
|
|
34
|
-
[target.'cfg(target_os = "windows")'.dependencies]
|
|
35
|
-
clipboard-win = { version = "5.4.1", features = ["monitor"] }
|
|
36
|
-
image = { version = "=0.25.5", features = ["bmp", "png", "jpeg"], optional = true, default-features = false }
|
|
37
|
-
windows = { version = "0.59.0", features = ["Win32_Foundation", "Win32_Graphics_Gdi", "Win32_System_DataExchange"] }
|
|
38
|
-
|
|
39
|
-
[build-dependencies]
|
|
40
|
-
# Pin to version that works with older Rust in Docker images
|
|
41
|
-
napi-build = "2.3.2"
|
|
42
|
-
|
|
43
|
-
[profile.release]
|
|
44
|
-
lto = true
|
|
45
|
-
strip = "symbols"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# @mariozechner/clipboard
|
|
2
|
-
|
|
3
|
-
> **Fork of [@crosscopy/clipboard](https://github.com/CrossCopy/clipboard)**
|
|
4
|
-
>
|
|
5
|
-
> This fork updates to the latest `clipboard-rs` (0.3.1) and adds musl (Alpine Linux) support.
|
|
6
|
-
> All credit goes to the original authors.
|
|
7
|
-
|
|
8
|
-

|
|
9
|
-
[](https://github.com/badlogic/clipboard/actions/workflows/CI.yml)
|
|
10
|
-
|
|
11
|
-
**NPM Package**: https://www.npmjs.com/package/@mariozechner/clipboard
|
|
12
|
-
|
|
13
|
-
**GitHub**: https://github.com/badlogic/clipboard
|
|
14
|
-
|
|
15
|
-
> This is a clipboard API npm package that allows you to copy and paste data to and from the clipboard.
|
|
16
|
-
> There doesn't seem to be a good clipboard package for node.js (that supports data format beyond text), so I decided to make one.
|
|
17
|
-
> Data Format Supported
|
|
18
|
-
>
|
|
19
|
-
> - Text
|
|
20
|
-
> - Image
|
|
21
|
-
> - Rich Text Format
|
|
22
|
-
> - Files
|
|
23
|
-
> - HTML
|
|
24
|
-
|
|
25
|
-
## Acknowledgements
|
|
26
|
-
|
|
27
|
-
- [ChurchTao/clipboard-rs](https://github.com/ChurchTao/clipboard-rs) is written in rust, which is used to provide the native clipboard support for this package across Linux, Windows and MacOS. This package is basically a wrapper around this rust package.
|
|
28
|
-
- https://crates.io/crates/clipboard-rs
|
|
29
|
-
- [napi.rs](https://napi.rs/) was used to create the node.js addon for this package, so that API calls written in rust can be called from node.js.
|
|
30
|
-
|
|
31
|
-
## API
|
|
32
|
-
|
|
33
|
-
Detailed API function declarations can be found in the [index.d.ts](./index.d.ts).
|
|
34
|
-
|
|
35
|
-
Or you can refer to the source code in [src/lib.rs](./src/lib.rs).
|
|
36
|
-
|
|
37
|
-
## Sample
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
import Clipboard from "@mariozechner/clipboard";
|
|
41
|
-
|
|
42
|
-
console.log(await Clipboard.getText());
|
|
43
|
-
|
|
44
|
-
console.log(await Clipboard.getHtml());
|
|
45
|
-
|
|
46
|
-
if (await Clipboard.hasImage()) {
|
|
47
|
-
console.log(await Clipboard.getImageBase64());
|
|
48
|
-
} else {
|
|
49
|
-
console.log("No Image");
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Publish
|
|
54
|
-
|
|
55
|
-
Everything is done with GitHub Action.
|
|
56
|
-
|
|
57
|
-
Run `npm version patch` to bump the version.
|
|
58
|
-
Then `git push --follow-tags` to push the changes and tags to GitHub. GitHub Action will automatically build and publish.
|
|
59
|
-
|
|
60
|
-
The GitHub Actions `NPM_TOKEN` repository secret is a granular npm token with publish access to `@mariozechner/clipboard` and all `@mariozechner/clipboard-*` platform packages. npm granular access tokens expire after 90 days, so this secret must be rotated before expiry.
|
|
Binary file
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Clipboard from "./index.js";
|
|
2
|
-
|
|
3
|
-
console.log(await Clipboard.getText());
|
|
4
|
-
|
|
5
|
-
console.log(await Clipboard.getHtml());
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (await Clipboard.hasImage()) {
|
|
9
|
-
console.log(await Clipboard.getImageBase64());
|
|
10
|
-
} else {
|
|
11
|
-
console.log("No Image");
|
|
12
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* auto-generated by NAPI-RS */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export declare function availableFormats(): Array<string>
|
|
4
|
-
|
|
5
|
-
export declare function callThreadsafeFunction(callback: ((err: Error | null, arg: number) => void)): void
|
|
6
|
-
|
|
7
|
-
export declare function clear(): Promise<void>
|
|
8
|
-
|
|
9
|
-
export declare function getHtml(): Promise<string>
|
|
10
|
-
|
|
11
|
-
export declare function getImageBase64(): Promise<string>
|
|
12
|
-
|
|
13
|
-
export declare function getImageBinary(): Promise<Array<number>>
|
|
14
|
-
|
|
15
|
-
export declare function getRtf(): Promise<string>
|
|
16
|
-
|
|
17
|
-
export declare function getText(): Promise<string>
|
|
18
|
-
|
|
19
|
-
export declare function hasHtml(): boolean
|
|
20
|
-
|
|
21
|
-
export declare function hasImage(): boolean
|
|
22
|
-
|
|
23
|
-
export declare function hasRtf(): boolean
|
|
24
|
-
|
|
25
|
-
export declare function hasText(): boolean
|
|
26
|
-
|
|
27
|
-
export declare function setHtml(html: string): Promise<void>
|
|
28
|
-
|
|
29
|
-
export declare function setImageBase64(base64Str: string): Promise<void>
|
|
30
|
-
|
|
31
|
-
export declare function setImageBinary(imageBytes: Array<number>): Promise<void>
|
|
32
|
-
|
|
33
|
-
export declare function setRtf(rtf: string): Promise<void>
|
|
34
|
-
|
|
35
|
-
export declare function setText(text: string): Promise<void>
|
|
36
|
-
|
|
37
|
-
export declare function watch(): void
|