privateer-agent 0.2.1 → 0.3.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.
Files changed (111) hide show
  1. package/README.md +135 -443
  2. package/bin/privateer-tui +86 -0
  3. package/bin/privateer.mjs +17 -6
  4. package/bin/pv +28 -0
  5. package/package.json +26 -23
  6. package/src/auth/privateer.ts +57 -0
  7. package/src/boot.ts +43 -0
  8. package/src/bridge/engineAdapter.ts +182 -0
  9. package/src/cli/chat.ts +243 -0
  10. package/src/config/paths.ts +24 -46
  11. package/src/config/permissionMode.ts +5 -0
  12. package/src/crypto/outboxSeal.ts +61 -0
  13. package/src/daemon/index.ts +204 -121
  14. package/src/daemon/ipc.ts +1 -1
  15. package/src/engine/errors.ts +85 -45
  16. package/src/engine/router.ts +11 -165
  17. package/src/ext/permissionGate.ts +216 -0
  18. package/src/main.ts +32 -0
  19. package/src/permissions/classify.ts +172 -0
  20. package/src/permissions/gate.ts +11 -14
  21. package/src/permissions/mode.ts +6 -2
  22. package/src/permissions/{uiGate.ts → modeGate.ts} +18 -3
  23. package/src/providers/account.ts +170 -0
  24. package/src/providers/catalog.ts +73 -61
  25. package/src/providers/genModelsJson.ts +97 -0
  26. package/src/remote/relayClient.ts +15 -0
  27. package/src/remote/remoteBridge.ts +152 -0
  28. package/src/routines/delivery.ts +118 -9
  29. package/src/routines/schema.ts +24 -5
  30. package/src/routines/store.ts +44 -1
  31. package/src/routines/toolSelect.ts +3 -1
  32. package/src/session.ts +81 -273
  33. package/src/tools/routine.ts +120 -101
  34. package/src/tools/saveAttachment.ts +39 -42
  35. package/src/tools/sendFile.ts +75 -0
  36. package/src/util/attachmentStore.ts +18 -35
  37. package/src/util/redact.ts +33 -3
  38. package/LICENSE +0 -21
  39. package/src/agents/loader.ts +0 -49
  40. package/src/commands/custom.ts +0 -123
  41. package/src/commands/registry.ts +0 -618
  42. package/src/components/AgentGroupView.tsx +0 -104
  43. package/src/components/App.tsx +0 -1626
  44. package/src/components/ApprovalPrompt.tsx +0 -49
  45. package/src/components/Banner.tsx +0 -78
  46. package/src/components/Markdown.tsx +0 -183
  47. package/src/components/ModeHint.tsx +0 -40
  48. package/src/components/ModelPicker.tsx +0 -302
  49. package/src/components/Onboarding.tsx +0 -203
  50. package/src/components/OptionPicker.tsx +0 -134
  51. package/src/components/PlanConfirm.tsx +0 -37
  52. package/src/components/PrivateerLogin.tsx +0 -109
  53. package/src/components/PromptInput.tsx +0 -602
  54. package/src/components/RewindPicker.tsx +0 -69
  55. package/src/components/Root.tsx +0 -116
  56. package/src/components/SessionPicker.tsx +0 -64
  57. package/src/components/StatusBar.tsx +0 -131
  58. package/src/components/TodoPanel.tsx +0 -36
  59. package/src/components/ToolCallView.tsx +0 -113
  60. package/src/components/Transcript.tsx +0 -210
  61. package/src/components/figures.ts +0 -14
  62. package/src/components/promptModel.ts +0 -73
  63. package/src/components/spinnerVerbs.ts +0 -46
  64. package/src/components/theme.ts +0 -57
  65. package/src/components/types.ts +0 -34
  66. package/src/components/useTeeShield.ts +0 -104
  67. package/src/components/useTerminalWidth.ts +0 -24
  68. package/src/components/useZdrShield.ts +0 -126
  69. package/src/config/load.ts +0 -115
  70. package/src/config/schema.ts +0 -94
  71. package/src/context/outputStyles.ts +0 -42
  72. package/src/context/projectInfo.ts +0 -59
  73. package/src/context/systemPrompt.ts +0 -176
  74. package/src/engine/QueryEngine.ts +0 -399
  75. package/src/hooks/engine.ts +0 -155
  76. package/src/main.tsx +0 -209
  77. package/src/mcp/client.ts +0 -251
  78. package/src/mcp/oauth.ts +0 -245
  79. package/src/memory/auto.ts +0 -146
  80. package/src/memory/checkpoints.ts +0 -227
  81. package/src/memory/store.ts +0 -127
  82. package/src/providers/attestation.ts +0 -149
  83. package/src/providers/capabilities.ts +0 -104
  84. package/src/providers/models.ts +0 -183
  85. package/src/providers/registry.ts +0 -71
  86. package/src/providers/resolve.ts +0 -78
  87. package/src/skills/installer.ts +0 -222
  88. package/src/skills/loader.ts +0 -88
  89. package/src/tools/askUser.ts +0 -92
  90. package/src/tools/bash.ts +0 -98
  91. package/src/tools/context.ts +0 -128
  92. package/src/tools/edit.ts +0 -67
  93. package/src/tools/exec.ts +0 -60
  94. package/src/tools/glob.ts +0 -39
  95. package/src/tools/grep.ts +0 -86
  96. package/src/tools/index.ts +0 -83
  97. package/src/tools/memory.ts +0 -53
  98. package/src/tools/processRegistry.ts +0 -77
  99. package/src/tools/read.ts +0 -42
  100. package/src/tools/sendFileToClient.ts +0 -55
  101. package/src/tools/skill.ts +0 -44
  102. package/src/tools/task.ts +0 -52
  103. package/src/tools/todo.ts +0 -36
  104. package/src/tools/todoStore.ts +0 -31
  105. package/src/tools/walk.ts +0 -44
  106. package/src/tools/web.ts +0 -145
  107. package/src/tools/worktree.ts +0 -145
  108. package/src/tools/write.ts +0 -40
  109. package/src/util/images.ts +0 -378
  110. package/src/util/limit.ts +0 -32
  111. package/src/version.ts +0 -13
@@ -1,104 +0,0 @@
1
- import React from "react";
2
- import { Box, Text } from "ink";
3
- import Spinner from "ink-spinner";
4
- import type { ToolEntry } from "./types.ts";
5
- import { theme } from "./theme.ts";
6
- import { formatTokens } from "./StatusBar.tsx";
7
- import { BULLET, BRANCH, CORNER, VLINE } from "./figures.ts";
8
-
9
- // Title-case a sub-agent type for the header ("code-reviewer" → "Code-reviewer");
10
- // the default read-only explorer (no type) is shown as "Explore", matching the
11
- // stock agent's role.
12
- function agentLabel(subagentType?: string): string {
13
- if (!subagentType) return "Explore";
14
- return subagentType.charAt(0).toUpperCase() + subagentType.slice(1);
15
- }
16
-
17
- function statusWord(s: ToolEntry["status"]): string {
18
- return s === "running" ? "Running…" : s === "error" ? "Failed" : "Done";
19
- }
20
-
21
- // The grouped "N agents finished" block for a run of concurrent `task` sub-agents,
22
- // modeled on Claude Code's fan-out view: a header summarizing the batch, then one
23
- // tree row per agent with its description, tool-use + token counts, and status.
24
- // Collapsed (the default) shows just status; Ctrl+O expands each agent's full output.
25
- export function AgentGroupView({
26
- agents,
27
- collapsed,
28
- }: {
29
- agents: ToolEntry[];
30
- collapsed?: boolean;
31
- }) {
32
- const running = agents.some((a) => a.status === "running");
33
- const errored = agents.some((a) => a.status === "error");
34
- // A single shared label when every agent is the same type, else a bare "agents".
35
- const types = new Set(agents.map((a) => a.agent?.subagentType ?? ""));
36
- const label = types.size === 1 ? `${agentLabel([...types][0] || undefined)} ` : "";
37
- const verb = running ? "running" : errored ? "finished (with errors)" : "finished";
38
- const headColor = running ? theme.accent : errored ? theme.error : theme.success;
39
-
40
- return (
41
- <Box flexDirection="column" marginTop={1}>
42
- <Box gap={1}>
43
- {running ? (
44
- <Text color={theme.accent}>
45
- <Spinner type="dots" />
46
- </Text>
47
- ) : (
48
- <Text color={headColor}>{BULLET}</Text>
49
- )}
50
- <Text>
51
- <Text bold>
52
- {agents.length} {label}agent{agents.length === 1 ? "" : "s"} {verb}
53
- </Text>
54
- {collapsed && !running && <Text color={theme.dim}> (ctrl+o to expand)</Text>}
55
- </Text>
56
- </Box>
57
-
58
- <Box flexDirection="column" marginLeft={2}>
59
- {agents.map((a, i) => {
60
- const last = i === agents.length - 1;
61
- const m = a.agent;
62
- const metrics =
63
- a.status !== "running" && m && (m.toolUses != null || m.tokens != null)
64
- ? ` · ${m.toolUses ?? 0} tool uses · ${formatTokens(m.tokens ?? 0)} tokens`
65
- : "";
66
- const trunk = last ? " " : VLINE;
67
- const body = a.status === "error" ? a.error ?? "" : a.output ?? "";
68
- const outLines = body.trim() === "" ? [] : body.replace(/\n+$/, "").split("\n");
69
- return (
70
- <Box key={a.id} flexDirection="column">
71
- <Text>
72
- <Text color={theme.dim}>{last ? CORNER : BRANCH} </Text>
73
- <Text bold>{m?.description ?? "agent"}</Text>
74
- <Text color={theme.dim}>{metrics}</Text>
75
- </Text>
76
- <Text>
77
- <Text color={theme.dim}>
78
- {trunk} {CORNER}{" "}
79
- </Text>
80
- {a.status === "running" ? (
81
- <Text color={theme.accent}>
82
- <Spinner type="dots" /> {statusWord(a.status)}
83
- </Text>
84
- ) : (
85
- <Text color={a.status === "error" ? theme.error : theme.dim} dimColor={a.status !== "error"}>
86
- {statusWord(a.status)}
87
- </Text>
88
- )}
89
- </Text>
90
- {!collapsed &&
91
- outLines.map((l, j) => (
92
- <Text key={j} color={theme.dim} dimColor>
93
- {trunk}
94
- {" "}
95
- {l}
96
- </Text>
97
- ))}
98
- </Box>
99
- );
100
- })}
101
- </Box>
102
- </Box>
103
- );
104
- }