@markusylisiurunen/tau 0.2.38 → 0.2.40

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.
Files changed (36) hide show
  1. package/README.md +63 -2
  2. package/dist/core/async/cli.js +508 -0
  3. package/dist/core/async/cli.js.map +1 -0
  4. package/dist/core/async/http_protocol.js +60 -0
  5. package/dist/core/async/http_protocol.js.map +1 -0
  6. package/dist/core/async/http_server.js +260 -0
  7. package/dist/core/async/http_server.js.map +1 -0
  8. package/dist/core/async/index.js +8 -0
  9. package/dist/core/async/index.js.map +1 -0
  10. package/dist/core/async/server_config.js +282 -0
  11. package/dist/core/async/server_config.js.map +1 -0
  12. package/dist/core/async/session_manager.js +431 -0
  13. package/dist/core/async/session_manager.js.map +1 -0
  14. package/dist/core/async/telegram.js +560 -0
  15. package/dist/core/async/telegram.js.map +1 -0
  16. package/dist/core/async/workspace.js +90 -0
  17. package/dist/core/async/workspace.js.map +1 -0
  18. package/dist/core/cli.js +2 -0
  19. package/dist/core/cli.js.map +1 -1
  20. package/dist/core/config/index.js.map +1 -1
  21. package/dist/core/config/schema.js +199 -0
  22. package/dist/core/config/schema.js.map +1 -1
  23. package/dist/core/index.js +1 -0
  24. package/dist/core/index.js.map +1 -1
  25. package/dist/core/platform_support.js +7 -0
  26. package/dist/core/platform_support.js.map +1 -0
  27. package/dist/core/utils/type_guards.js +4 -0
  28. package/dist/core/utils/type_guards.js.map +1 -0
  29. package/dist/core/version.js +1 -1
  30. package/dist/main.js +30 -1
  31. package/dist/main.js.map +1 -1
  32. package/dist/starter/prompts/plan.md +1 -53
  33. package/dist/starter/skills/plan/SKILL.md +53 -0
  34. package/dist/tui/clipboard.js +81 -8
  35. package/dist/tui/clipboard.js.map +1 -1
  36. package/package.json +2 -1
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: "plan"
3
+ description: "Create implementation plans in two phases: clarify requirements first, then produce a concrete step-by-step plan without writing code. Trigger: explicit."
4
+ ---
5
+
6
+ Produce implementation plans, not implementations. Explore, ask questions, and document a clear path forward, then stop.
7
+
8
+ ## How this works
9
+
10
+ This task has two phases with a hard boundary between them:
11
+
12
+ 1. **Clarify**: Understand the request fully before planning. Explore the codebase to resolve ambiguity on your own when possible. Only ask questions for things you cannot determine from the code. Do not proceed until the user confirms you have it right.
13
+ 2. **Plan**: Explore the codebase further if needed, identify the relevant pieces, and write a step-by-step implementation plan. Then stop.
14
+
15
+ You must complete Phase 1 before starting Phase 2. You must stop after Phase 2. Do not write code. Do not begin implementing.
16
+
17
+ ## Phase 1: Clarify the request
18
+
19
+ Read the request below. Explore the codebase to answer your own questions when the code can provide clarity. Only ask the user about things you cannot determine from the code itself.
20
+
21
+ If the request is unambiguous (or becomes clear after exploring the code), summarize your understanding in two to three sentences and ask the user to confirm.
22
+
23
+ If you must ask questions, keep them minimal, and focus only on decisions that genuinely require user input. Number questions from 1 to n.
24
+
25
+ Do not guess at requirements. Do not fill gaps with assumptions. But do use the codebase to reduce what you need to ask.
26
+
27
+ ## Phase 2: Write the implementation plan
28
+
29
+ Once the user confirms your understanding, explore the codebase and produce a plan with exactly these sections:
30
+
31
+ ### Summary
32
+
33
+ One paragraph: what is being built and why.
34
+
35
+ ### Background
36
+
37
+ The context a developer would need: relevant existing behavior, constraints, edge cases, and dependencies.
38
+
39
+ ### Plan
40
+
41
+ Numbered steps describing what to change and where. Each step should be concrete enough that a developer could execute it without re-reading the original request. Reference specific files, functions, or patterns when you know them.
42
+
43
+ ### Relevant files
44
+
45
+ A list of files and code sections involved, with a one-line note on each file's role. If you found none, say so.
46
+
47
+ ## Writing style
48
+
49
+ Write the plan as a standalone document, not as a conversation. Use imperative voice ("Add a validation check to...") or neutral third person ("The handler should validate..."). Avoid first person ("I will add..."). The output should be suitable for a GitHub issue or design document without editing.
50
+
51
+ ## When you are done
52
+
53
+ End your response after the plan. Do not offer to implement it. Do not write code unless the user explicitly asks in a follow-up message.
@@ -1,16 +1,89 @@
1
1
  import { spawn } from "node:child_process";
2
- export async function copyTextToClipboard(text) {
2
+ const DARWIN_PROVIDERS = [{ command: "pbcopy", args: [] }];
3
+ const LINUX_PROVIDERS = [
4
+ { command: "wl-copy", args: [] },
5
+ { command: "xclip", args: ["-selection", "clipboard"] },
6
+ { command: "xsel", args: ["--clipboard", "--input"] },
7
+ ];
8
+ function getProvidersForPlatform(platform) {
9
+ if (platform === "darwin") {
10
+ return DARWIN_PROVIDERS;
11
+ }
12
+ if (platform === "linux") {
13
+ return LINUX_PROVIDERS;
14
+ }
15
+ return [];
16
+ }
17
+ function formatProvider(provider) {
18
+ return [provider.command, ...provider.args].join(" ");
19
+ }
20
+ async function runClipboardProvider(provider, text) {
3
21
  await new Promise((resolve, reject) => {
4
- const child = spawn("pbcopy", [], { stdio: ["pipe", "ignore", "pipe"] });
5
- child.on("error", reject);
6
- child.stderr?.on("data", (d) => reject(new Error(String(d))));
22
+ const child = spawn(provider.command, provider.args, {
23
+ stdio: ["pipe", "ignore", "pipe"],
24
+ });
25
+ let settled = false;
26
+ let stderr = "";
27
+ const settleResolve = () => {
28
+ if (settled)
29
+ return;
30
+ settled = true;
31
+ resolve();
32
+ };
33
+ const settleReject = (error) => {
34
+ if (settled)
35
+ return;
36
+ settled = true;
37
+ reject(error);
38
+ };
39
+ child.on("error", (error) => {
40
+ settleReject(error);
41
+ });
42
+ child.stderr?.on("data", (chunk) => {
43
+ stderr += String(chunk);
44
+ });
45
+ child.stdin?.on("error", (error) => {
46
+ settleReject(error);
47
+ });
7
48
  child.on("close", (code) => {
8
- if (code === 0)
9
- resolve();
10
- else
11
- reject(new Error(`pbcopy exited with code ${code}`));
49
+ if (code === 0) {
50
+ settleResolve();
51
+ return;
52
+ }
53
+ const details = stderr.trim();
54
+ const exitDetails = details ? `: ${details}` : "";
55
+ settleReject(new Error(`${formatProvider(provider)} exited with code ${code}${exitDetails}`));
12
56
  });
13
57
  child.stdin?.end(text);
14
58
  });
15
59
  }
60
+ function buildMissingProviderError(platform, providers, errors) {
61
+ const providerNames = providers.map((provider) => provider.command).join(", ");
62
+ const attempts = errors.length > 0 ? ` Attempts: ${errors.join(" | ")}` : "";
63
+ if (platform === "darwin") {
64
+ return new Error(`failed to copy text to clipboard: missing clipboard provider. Ensure pbcopy is available.${attempts}`);
65
+ }
66
+ if (platform === "linux") {
67
+ return new Error(`failed to copy text to clipboard: missing clipboard provider. Install one of: ${providerNames}.${attempts}`);
68
+ }
69
+ return new Error(`failed to copy text to clipboard: missing clipboard provider. Unsupported platform: ${platform}.${attempts}`);
70
+ }
71
+ export async function copyTextToClipboard(text) {
72
+ const providers = getProvidersForPlatform(process.platform);
73
+ if (providers.length === 0) {
74
+ throw buildMissingProviderError(process.platform, providers, []);
75
+ }
76
+ const errors = [];
77
+ for (const provider of providers) {
78
+ try {
79
+ await runClipboardProvider(provider, text);
80
+ return;
81
+ }
82
+ catch (error) {
83
+ const message = error.message;
84
+ errors.push(`${formatProvider(provider)} (${message})`);
85
+ }
86
+ }
87
+ throw buildMissingProviderError(process.platform, providers, errors);
88
+ }
16
89
  //# sourceMappingURL=clipboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../src/tui/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY;IACpD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;QACzE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IA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AC;IAC5D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAI,KAAe,CAAC,OAAO,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,MAAM,yBAAyB,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markusylisiurunen/tau",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tau": "./dist/main.js"
@@ -32,6 +32,7 @@
32
32
  "@sinclair/typebox": "^0.34.48",
33
33
  "chalk": "^5.6.2",
34
34
  "file-type": "^21.3.0",
35
+ "grammy": "^1.40.0",
35
36
  "sharp": "^0.34.5",
36
37
  "strip-ansi": "^7.1.2",
37
38
  "yaml": "^2.8.2",