profclaw 0.0.1-beta.2 → 2.0.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/CHANGELOG.md +21 -38
- package/CONTRIBUTING.md +3 -5
- package/README.md +128 -63
- package/dist/chat/execution/tools/index.d.ts +1 -1
- package/dist/chat/execution/tools/index.js +41 -2
- package/dist/chat/providers/slack/index.d.ts +2 -2
- package/dist/cli/commands/models.js +39 -26
- package/dist/cli/commands/onboard.js +64 -79
- package/dist/cli/commands/setup.js +293 -90
- package/dist/cli/index.js +0 -6
- package/dist/cli/providers.d.ts +15 -0
- package/dist/cli/providers.js +41 -0
- package/dist/core/deployment.js +2 -0
- package/dist/providers/ai-sdk.js +26 -6
- package/dist/routes/channels.d.ts +12 -0
- package/dist/routes/channels.js +166 -0
- package/dist/server/route-loader.js +1 -0
- package/dist/server.js +115 -109
- package/package.json +1 -1
- package/skills/git-workflow/SKILL.md +3 -3
- package/ui/dist/assets/{ActivityView-DIPQSJ_d.js → ActivityView-BeshZXmE.js} +1 -1
- package/ui/dist/assets/{AgentList-CqyaYrcq.js → AgentList-QVHeldPi.js} +1 -1
- package/ui/dist/assets/{AnalyticsDashboard-C-mjuGHT.js → AnalyticsDashboard-C9R97dXE.js} +1 -1
- package/ui/dist/assets/{AreaChart-CfYWmbtr.js → AreaChart-B73gaiVQ.js} +1 -1
- package/ui/dist/assets/{CartesianChart-BaQ3It0c.js → CartesianChart-CXYL2R-A.js} +1 -1
- package/ui/dist/assets/{ChatView-DxxQy6pl.js → ChatView-qjZErlrp.js} +1 -1
- package/ui/dist/assets/{CostsDashboard-CDBBcGkg.js → CostsDashboard-O4DCLy1i.js} +1 -1
- package/ui/dist/assets/{EstimateSelect-CDjf5qKl.js → EstimateSelect-1hQf4Osk.js} +1 -1
- package/ui/dist/assets/{FloatingChatbot-CZHjvJIe.js → FloatingChatbot-BZBzrJxd.js} +1 -1
- package/ui/dist/assets/{InviteCodeManagement-DTm-IPTm.js → InviteCodeManagement-LEoGqYeA.js} +1 -1
- package/ui/dist/assets/{ProjectDetail-DlYUcOss.js → ProjectDetail--gPfvATB.js} +1 -1
- package/ui/dist/assets/{ProjectIcon-BMRpnM04.js → ProjectIcon-Chd_ofsw.js} +1 -1
- package/ui/dist/assets/{ProjectList-D85TN0i0.js → ProjectList-BvUfVB6c.js} +1 -1
- package/ui/dist/assets/{Settings-CgPqzUvj.js → Settings-1kaf7VHE.js} +1 -1
- package/ui/dist/assets/{StatusIndicator-yig0uZEA.js → StatusIndicator-pRfkNcdV.js} +1 -1
- package/ui/dist/assets/{SummaryDetail-CwLAfHgJ.js → SummaryDetail-DV3AmONk.js} +1 -1
- package/ui/dist/assets/{SummaryList-BvS5Idnu.js → SummaryList-B6kXiTxL.js} +1 -1
- package/ui/dist/assets/{TaskDetail-zarC1fOt.js → TaskDetail-CV6CzbOS.js} +1 -1
- package/ui/dist/assets/{TaskList-CyJq3ANE.js → TaskList-DL7brQKd.js} +1 -1
- package/ui/dist/assets/{TicketBoard-BlWr3-iH.js → TicketBoard-CrkkFj7C.js} +1 -1
- package/ui/dist/assets/{TicketDetail-DmqWKj2W.js → TicketDetail-hnnYclpD.js} +1 -1
- package/ui/dist/assets/{TicketList-Scj4pMWa.js → TicketList-CsDAyQCL.js} +1 -1
- package/ui/dist/assets/{UserManagement-BH7uG7dw.js → UserManagement-BGFQyTSr.js} +1 -1
- package/ui/dist/assets/{ViewSwitcher-3HzZUdWn.js → ViewSwitcher-CnL0OqA8.js} +1 -1
- package/ui/dist/assets/{alert-dialog-DWPb2IfQ.js → alert-dialog-SKM6Gjz4.js} +1 -1
- package/ui/dist/assets/{archive-CGck7gxR.js → archive-BsLa7brF.js} +1 -1
- package/ui/dist/assets/{badge-DEmc3Z_l.js → badge-CVHH1a-v.js} +1 -1
- package/ui/dist/assets/{brain-CfFdLVqb.js → brain-6o_RHVpe.js} +1 -1
- package/ui/dist/assets/{bug-DqSGPUUE.js → bug-CmZI7jqM.js} +1 -1
- package/ui/dist/assets/{calendar-BuZ4zbPW.js → calendar-Bf0t2B82.js} +1 -1
- package/ui/dist/assets/{chevron-up-DcJ4LL_N.js → chevron-up-CoUsOvZj.js} +1 -1
- package/ui/dist/assets/{circle-x-C78PNZjF.js → circle-x-Dgw11LgT.js} +1 -1
- package/ui/dist/assets/{constants-DhDjZe4P.js → constants-Q5Zivl-a.js} +1 -1
- package/ui/dist/assets/{cpu-Ck6AoG8c.js → cpu-DiPMQICV.js} +1 -1
- package/ui/dist/assets/{database-CA2w8Lvt.js → database-BwTfupDi.js} +1 -1
- package/ui/dist/assets/{dialog-BOdGWhgE.js → dialog-BUqN9Psj.js} +1 -1
- package/ui/dist/assets/{ellipsis-FhHKRbfl.js → ellipsis-UJx4Xnf6.js} +1 -1
- package/ui/dist/assets/{ellipsis-vertical-CO0UqE4-.js → ellipsis-vertical-DoULYEKn.js} +1 -1
- package/ui/dist/assets/{file-code-ChnhYYj1.js → file-code-B2UrJLwi.js} +1 -1
- package/ui/dist/assets/{folder-open-CHwA1-ve.js → folder-open-BJi577JH.js} +1 -1
- package/ui/dist/assets/{funnel-ByEjRFNB.js → funnel-PkaD_HSR.js} +1 -1
- package/ui/dist/assets/{git-branch-GTOPQgU4.js → git-branch-C_K30am0.js} +1 -1
- package/ui/dist/assets/{git-commit-horizontal-F5M84Kut.js → git-commit-horizontal-IT6ecxWQ.js} +1 -1
- package/ui/dist/assets/{globe-CQWfr7hT.js → globe-f-jjCa_g.js} +1 -1
- package/ui/dist/assets/{hash-nKC9gtLg.js → hash-DNEv8Elo.js} +1 -1
- package/ui/dist/assets/{history-DfFSA9xJ.js → history-BQSBo_1Q.js} +1 -1
- package/ui/dist/assets/{index-DHGvP9mp.js → index-BUmnwPQr.js} +1 -1
- package/ui/dist/assets/{index-Z4-RtZcs.js → index-BfF5G4Cw.js} +1 -1
- package/ui/dist/assets/{index-DeI8lKRR.js → index-C8N375c2.js} +1 -1
- package/ui/dist/assets/index-CuxnqVVz.css +1 -0
- package/ui/dist/assets/{index-Ca3vk7Gq.js → index-CzMM3QOk.js} +1 -1
- package/ui/dist/assets/{index--JkIxVXb.js → index-lJlNPFVJ.js} +3 -3
- package/ui/dist/assets/{index-a4Fxq0Hb.js → index-nS3EErDg.js} +1 -1
- package/ui/dist/assets/{layers-DFeLExSa.js → layers-jFqVrWMD.js} +1 -1
- package/ui/dist/assets/{layout-dashboard-WmgjMhWF.js → layout-dashboard-CcKt1hXw.js} +1 -1
- package/ui/dist/assets/{lightbulb-Bo8hEr7B.js → lightbulb-Jhp7FvbU.js} +1 -1
- package/ui/dist/assets/{link-2-YqrpQXBH.js → link-2-DdO7ostF.js} +1 -1
- package/ui/dist/assets/{markdown-renderer-Croje6Xe.js → markdown-renderer-n1ToC4XQ.js} +1 -1
- package/ui/dist/assets/{message-square-CD0H5hot.js → message-square-CBgH65X7.js} +1 -1
- package/ui/dist/assets/{pencil-DpFnj5dn.js → pencil-CYXCEPQh.js} +1 -1
- package/ui/dist/assets/{play-DVgea_jT.js → play-d1ONaH0-.js} +1 -1
- package/ui/dist/assets/{popover-JXecfWG5.js → popover-CrmZgoWu.js} +1 -1
- package/ui/dist/assets/{progress-C1ghf1Fu.js → progress-uv4SPkL5.js} +1 -1
- package/ui/dist/assets/{rocket-BFxPYGx9.js → rocket-DhvUetsk.js} +1 -1
- package/ui/dist/assets/{select-MADP8m6Q.js → select-CeQ8AHGy.js} +1 -1
- package/ui/dist/assets/{send-eYnW_7n-.js → send-P0r5D7td.js} +1 -1
- package/ui/dist/assets/{server-CPMaysH8.js → server-CVHTZB72.js} +1 -1
- package/ui/dist/assets/{settings-2-scXUOuE_.js → settings-2-ocj5uHGx.js} +1 -1
- package/ui/dist/assets/{sheet-r6NSOxi-.js → sheet-DuQExSho.js} +1 -1
- package/ui/dist/assets/{shield-check-PEr7nmVw.js → shield-check-DfVdE34l.js} +1 -1
- package/ui/dist/assets/{shield-off-CLtXio62.js → shield-off-8l0J6R-8.js} +1 -1
- package/ui/dist/assets/{skeleton-C9oEzNlU.js → skeleton-TFiFJ3nB.js} +1 -1
- package/ui/dist/assets/{smartphone-DusFfY0U.js → smartphone-77_g3SQn.js} +1 -1
- package/ui/dist/assets/{square-e1yxB2eR.js → square-Ckzsr3Rn.js} +1 -1
- package/ui/dist/assets/{switch-tNs0n-kz.js → switch-CAePkd6k.js} +1 -1
- package/ui/dist/assets/{table-CXxtLicg.js → table-ZjAZ7hkt.js} +1 -1
- package/ui/dist/assets/{tag-tAwMmQ9G.js → tag-C35mgoEv.js} +1 -1
- package/ui/dist/assets/{textarea-BjiEeIWh.js → textarea-DsVPnSgR.js} +1 -1
- package/ui/dist/assets/{timer-Vel1N3RP.js → timer-DHJBS2w1.js} +1 -1
- package/ui/dist/assets/{tooltip-ZMwtfr1J.js → tooltip-BYmQ331W.js} +1 -1
- package/ui/dist/assets/{trash-2-eM-CNwsZ.js → trash-2-keO5tKPE.js} +1 -1
- package/ui/dist/assets/{trending-up-BGafmjRo.js → trending-up-BBv8KbrY.js} +1 -1
- package/ui/dist/assets/{wand-sparkles-DPvcd9Pi.js → wand-sparkles-BusQ52ZK.js} +1 -1
- package/ui/dist/assets/{wrench-B8s3zYVV.js → wrench-02YaOSiK.js} +1 -1
- package/ui/dist/index.html +2 -2
- package/dist/chat/auto-reply.d.ts +0 -90
- package/dist/chat/auto-reply.js +0 -272
- package/dist/chat/execution/pty.d.ts +0 -92
- package/dist/chat/execution/pty.js +0 -285
- package/dist/chat/execution/tools/glinr-ops.d.ts +0 -202
- package/dist/chat/execution/tools/glinr-ops.js +0 -694
- package/dist/cli/commands/browser.d.ts +0 -3
- package/dist/cli/commands/browser.js +0 -138
- package/dist/cli/commands/canvas.d.ts +0 -3
- package/dist/cli/commands/canvas.js +0 -155
- package/dist/cli/commands/nodes.d.ts +0 -3
- package/dist/cli/commands/nodes.js +0 -193
- package/dist/diagnostics/exporters.d.ts +0 -21
- package/dist/diagnostics/exporters.js +0 -138
- package/dist/diagnostics/index.d.ts +0 -10
- package/dist/diagnostics/index.js +0 -9
- package/dist/diagnostics/middleware.d.ts +0 -12
- package/dist/diagnostics/middleware.js +0 -58
- package/dist/diagnostics/tracer.d.ts +0 -133
- package/dist/diagnostics/tracer.js +0 -257
- package/dist/discovery/index.d.ts +0 -8
- package/dist/discovery/index.js +0 -7
- package/dist/discovery/mdns.d.ts +0 -40
- package/dist/discovery/mdns.js +0 -249
- package/dist/plugins/registry.d.ts +0 -122
- package/dist/plugins/registry.js +0 -352
- package/dist/plugins/sandbox.d.ts +0 -77
- package/dist/plugins/sandbox.js +0 -287
- package/dist/plugins/search/brave.d.ts +0 -9
- package/dist/plugins/search/brave.js +0 -157
- package/dist/plugins/search/duckduckgo.d.ts +0 -9
- package/dist/plugins/search/duckduckgo.js +0 -171
- package/dist/plugins/search/index.d.ts +0 -13
- package/dist/plugins/search/index.js +0 -23
- package/dist/plugins/search/searxng.d.ts +0 -9
- package/dist/plugins/search/searxng.js +0 -170
- package/dist/plugins/search/serper.d.ts +0 -9
- package/dist/plugins/search/serper.js +0 -135
- package/dist/plugins/search/tavily.d.ts +0 -9
- package/dist/plugins/search/tavily.js +0 -146
- package/dist/providers/adapters/anthropic.d.ts +0 -26
- package/dist/providers/adapters/anthropic.js +0 -306
- package/dist/providers/adapters/base.d.ts +0 -53
- package/dist/providers/adapters/base.js +0 -99
- package/dist/providers/adapters/ollama.d.ts +0 -30
- package/dist/providers/adapters/ollama.js +0 -292
- package/dist/utils/ai-cache.d.ts +0 -72
- package/dist/utils/ai-cache.js +0 -204
- package/dist/utils/file-lock.d.ts +0 -85
- package/dist/utils/file-lock.js +0 -204
- package/ui/dist/assets/index-WclMPci1.css +0 -1
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PTY (Pseudo-Terminal) Support
|
|
3
|
-
*
|
|
4
|
-
* Provides interactive terminal support for commands that require TTY.
|
|
5
|
-
* Uses node-pty for cross-platform PTY handling.
|
|
6
|
-
*
|
|
7
|
-
* Use cases:
|
|
8
|
-
* - Interactive installers (npm init, create-react-app)
|
|
9
|
-
* - Text editors (vim, nano)
|
|
10
|
-
* - Pagers (less, more)
|
|
11
|
-
* - Password prompts
|
|
12
|
-
* - SSH sessions
|
|
13
|
-
*/
|
|
14
|
-
import * as pty from 'node-pty';
|
|
15
|
-
import { EventEmitter } from 'events';
|
|
16
|
-
import { logger } from '../../utils/logger.js';
|
|
17
|
-
import { redactSecrets, isSecretsDetectionEnabled } from './secrets.js';
|
|
18
|
-
// =============================================================================
|
|
19
|
-
// Constants
|
|
20
|
-
// =============================================================================
|
|
21
|
-
const DEFAULT_COLS = 80;
|
|
22
|
-
const DEFAULT_ROWS = 24;
|
|
23
|
-
const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
24
|
-
const DEFAULT_MAX_OUTPUT = 200_000;
|
|
25
|
-
// =============================================================================
|
|
26
|
-
// PTY Manager
|
|
27
|
-
// =============================================================================
|
|
28
|
-
export class PTYManager extends EventEmitter {
|
|
29
|
-
sessions = new Map();
|
|
30
|
-
sessionCounter = 0;
|
|
31
|
-
/**
|
|
32
|
-
* Spawn a new PTY session
|
|
33
|
-
*/
|
|
34
|
-
spawn(command, args = [], options = {}) {
|
|
35
|
-
const id = `pty_${Date.now()}_${++this.sessionCounter}`;
|
|
36
|
-
const cols = options.cols ?? DEFAULT_COLS;
|
|
37
|
-
const rows = options.rows ?? DEFAULT_ROWS;
|
|
38
|
-
// Determine shell
|
|
39
|
-
const shell = process.platform === 'win32'
|
|
40
|
-
? process.env.ComSpec || 'cmd.exe'
|
|
41
|
-
: process.env.SHELL || '/bin/bash';
|
|
42
|
-
// Build args
|
|
43
|
-
const shellArgs = process.platform === 'win32'
|
|
44
|
-
? ['/c', command, ...args]
|
|
45
|
-
: ['-c', `${command} ${args.join(' ')}`];
|
|
46
|
-
logger.debug(`[PTY] Spawning: ${command}`, { id, cols, rows });
|
|
47
|
-
// Spawn PTY
|
|
48
|
-
const ptyProcess = pty.spawn(shell, shellArgs, {
|
|
49
|
-
name: 'xterm-256color',
|
|
50
|
-
cols,
|
|
51
|
-
rows,
|
|
52
|
-
cwd: options.cwd ?? process.cwd(),
|
|
53
|
-
env: {
|
|
54
|
-
...process.env,
|
|
55
|
-
...options.env,
|
|
56
|
-
TERM: 'xterm-256color',
|
|
57
|
-
COLORTERM: 'truecolor',
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
const session = {
|
|
61
|
-
id,
|
|
62
|
-
pid: ptyProcess.pid,
|
|
63
|
-
command,
|
|
64
|
-
cols,
|
|
65
|
-
rows,
|
|
66
|
-
status: 'running',
|
|
67
|
-
output: '',
|
|
68
|
-
createdAt: new Date(),
|
|
69
|
-
};
|
|
70
|
-
const entry = {
|
|
71
|
-
pty: ptyProcess,
|
|
72
|
-
session,
|
|
73
|
-
outputBuffer: '',
|
|
74
|
-
listeners: new Set(),
|
|
75
|
-
};
|
|
76
|
-
this.sessions.set(id, entry);
|
|
77
|
-
// Handle data
|
|
78
|
-
ptyProcess.onData((data) => {
|
|
79
|
-
entry.outputBuffer += data;
|
|
80
|
-
session.output = entry.outputBuffer;
|
|
81
|
-
// Truncate if needed
|
|
82
|
-
const maxChars = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
|
|
83
|
-
if (entry.outputBuffer.length > maxChars) {
|
|
84
|
-
entry.outputBuffer = `[...truncated...]\n${entry.outputBuffer.slice(-maxChars)}`;
|
|
85
|
-
session.output = entry.outputBuffer;
|
|
86
|
-
}
|
|
87
|
-
// Notify listeners
|
|
88
|
-
for (const listener of entry.listeners) {
|
|
89
|
-
listener(data);
|
|
90
|
-
}
|
|
91
|
-
this.emit('data', id, data);
|
|
92
|
-
});
|
|
93
|
-
// Handle exit
|
|
94
|
-
ptyProcess.onExit(({ exitCode }) => {
|
|
95
|
-
session.status = 'exited';
|
|
96
|
-
session.exitCode = exitCode;
|
|
97
|
-
session.exitedAt = new Date();
|
|
98
|
-
logger.debug(`[PTY] Exited: ${id}`, { exitCode });
|
|
99
|
-
this.emit('exit', id, exitCode);
|
|
100
|
-
});
|
|
101
|
-
return session;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Execute a command and wait for completion
|
|
105
|
-
*/
|
|
106
|
-
async execute(command, args = [], options = {}) {
|
|
107
|
-
const startTime = Date.now();
|
|
108
|
-
const timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
109
|
-
const maxOutput = options.maxOutputChars ?? DEFAULT_MAX_OUTPUT;
|
|
110
|
-
const session = this.spawn(command, args, options);
|
|
111
|
-
const entry = this.sessions.get(session.id);
|
|
112
|
-
if (!entry) {
|
|
113
|
-
throw new Error('Failed to create PTY session');
|
|
114
|
-
}
|
|
115
|
-
return new Promise((resolve) => {
|
|
116
|
-
let timedOut = false;
|
|
117
|
-
// Timeout handler
|
|
118
|
-
const timeoutId = setTimeout(() => {
|
|
119
|
-
timedOut = true;
|
|
120
|
-
this.kill(session.id);
|
|
121
|
-
}, timeout);
|
|
122
|
-
// Wait for exit
|
|
123
|
-
const exitHandler = (id, exitCode) => {
|
|
124
|
-
if (id !== session.id)
|
|
125
|
-
return;
|
|
126
|
-
clearTimeout(timeoutId);
|
|
127
|
-
this.off('exit', exitHandler);
|
|
128
|
-
const durationMs = Date.now() - startTime;
|
|
129
|
-
let output = entry.outputBuffer;
|
|
130
|
-
let secretsRedacted = false;
|
|
131
|
-
// Redact secrets if enabled
|
|
132
|
-
if (isSecretsDetectionEnabled()) {
|
|
133
|
-
output = redactSecrets(output);
|
|
134
|
-
secretsRedacted = output !== entry.outputBuffer;
|
|
135
|
-
}
|
|
136
|
-
// Clean up session after a delay
|
|
137
|
-
setTimeout(() => this.cleanup(session.id), 5000);
|
|
138
|
-
resolve({
|
|
139
|
-
success: !timedOut && exitCode === 0,
|
|
140
|
-
exitCode: timedOut ? -1 : exitCode,
|
|
141
|
-
output: output.trim() || '(no output)',
|
|
142
|
-
durationMs,
|
|
143
|
-
truncated: entry.outputBuffer.length >= maxOutput,
|
|
144
|
-
secretsRedacted,
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
this.on('exit', exitHandler);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Write input to PTY
|
|
152
|
-
*/
|
|
153
|
-
write(sessionId, data) {
|
|
154
|
-
const entry = this.sessions.get(sessionId);
|
|
155
|
-
if (!entry || entry.session.status !== 'running') {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
entry.pty.write(data);
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Resize PTY dimensions
|
|
163
|
-
*/
|
|
164
|
-
resize(sessionId, cols, rows) {
|
|
165
|
-
const entry = this.sessions.get(sessionId);
|
|
166
|
-
if (!entry || entry.session.status !== 'running') {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
entry.pty.resize(cols, rows);
|
|
170
|
-
entry.session.cols = cols;
|
|
171
|
-
entry.session.rows = rows;
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Kill a PTY session
|
|
176
|
-
*/
|
|
177
|
-
kill(sessionId, signal = 'SIGTERM') {
|
|
178
|
-
const entry = this.sessions.get(sessionId);
|
|
179
|
-
if (!entry || entry.session.status !== 'running') {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
entry.pty.kill(signal);
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
logger.warn(`[PTY] Failed to kill session ${sessionId}`, { error });
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Get session info
|
|
193
|
-
*/
|
|
194
|
-
getSession(sessionId) {
|
|
195
|
-
return this.sessions.get(sessionId)?.session ?? null;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get all active sessions
|
|
199
|
-
*/
|
|
200
|
-
getActiveSessions() {
|
|
201
|
-
return Array.from(this.sessions.values())
|
|
202
|
-
.filter((e) => e.session.status === 'running')
|
|
203
|
-
.map((e) => e.session);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Subscribe to session output
|
|
207
|
-
*/
|
|
208
|
-
subscribe(sessionId, listener) {
|
|
209
|
-
const entry = this.sessions.get(sessionId);
|
|
210
|
-
if (!entry) {
|
|
211
|
-
return () => { };
|
|
212
|
-
}
|
|
213
|
-
entry.listeners.add(listener);
|
|
214
|
-
return () => entry.listeners.delete(listener);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Clean up completed session
|
|
218
|
-
*/
|
|
219
|
-
cleanup(sessionId) {
|
|
220
|
-
const entry = this.sessions.get(sessionId);
|
|
221
|
-
if (entry) {
|
|
222
|
-
if (entry.session.status === 'running') {
|
|
223
|
-
this.kill(sessionId);
|
|
224
|
-
}
|
|
225
|
-
entry.listeners.clear();
|
|
226
|
-
this.sessions.delete(sessionId);
|
|
227
|
-
logger.debug(`[PTY] Cleaned up session: ${sessionId}`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Clean up all sessions
|
|
232
|
-
*/
|
|
233
|
-
cleanupAll() {
|
|
234
|
-
for (const sessionId of this.sessions.keys()) {
|
|
235
|
-
this.cleanup(sessionId);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
// =============================================================================
|
|
240
|
-
// Singleton Instance
|
|
241
|
-
// =============================================================================
|
|
242
|
-
let _ptyManager = null;
|
|
243
|
-
export function getPTYManager() {
|
|
244
|
-
if (!_ptyManager) {
|
|
245
|
-
_ptyManager = new PTYManager();
|
|
246
|
-
}
|
|
247
|
-
return _ptyManager;
|
|
248
|
-
}
|
|
249
|
-
// =============================================================================
|
|
250
|
-
// Helper: Check if command needs PTY
|
|
251
|
-
// =============================================================================
|
|
252
|
-
const PTY_REQUIRED_COMMANDS = new Set([
|
|
253
|
-
'vim', 'vi', 'nvim', 'nano', 'emacs',
|
|
254
|
-
'less', 'more', 'man',
|
|
255
|
-
'top', 'htop', 'btop',
|
|
256
|
-
'ssh', 'telnet',
|
|
257
|
-
'ftp', 'sftp',
|
|
258
|
-
'mysql', 'psql', 'mongo', 'redis-cli',
|
|
259
|
-
'python', 'python3', 'node', 'irb', 'rails',
|
|
260
|
-
'bash', 'zsh', 'sh', 'fish',
|
|
261
|
-
]);
|
|
262
|
-
const PTY_HINT_PATTERNS = [
|
|
263
|
-
/npm\s+init/i,
|
|
264
|
-
/yarn\s+init/i,
|
|
265
|
-
/npx\s+create-/i,
|
|
266
|
-
/\bpassword\b/i,
|
|
267
|
-
/\bsudo\b/,
|
|
268
|
-
/--interactive/i,
|
|
269
|
-
/-i\b/,
|
|
270
|
-
];
|
|
271
|
-
/**
|
|
272
|
-
* Check if a command likely requires PTY
|
|
273
|
-
*/
|
|
274
|
-
export function commandNeedsPTY(command) {
|
|
275
|
-
// Extract base command
|
|
276
|
-
const parts = command.trim().split(/\s+/);
|
|
277
|
-
const baseCmd = parts[0]?.split('/').pop() ?? '';
|
|
278
|
-
// Check known PTY-required commands
|
|
279
|
-
if (PTY_REQUIRED_COMMANDS.has(baseCmd)) {
|
|
280
|
-
return true;
|
|
281
|
-
}
|
|
282
|
-
// Check hint patterns
|
|
283
|
-
return PTY_HINT_PATTERNS.some((p) => p.test(command));
|
|
284
|
-
}
|
|
285
|
-
//# sourceMappingURL=pty.js.map
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GLINR Operations Tools
|
|
3
|
-
*
|
|
4
|
-
* Ticket, project, and sprint management through AI chat.
|
|
5
|
-
* These tools allow the AI to create and manage GLINR's own data.
|
|
6
|
-
*/
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import type { ToolDefinition } from '../types.js';
|
|
9
|
-
declare const CreateTicketParamsSchema: z.ZodObject<{
|
|
10
|
-
projectKey: z.ZodString;
|
|
11
|
-
title: z.ZodString;
|
|
12
|
-
description: z.ZodOptional<z.ZodString>;
|
|
13
|
-
type: z.ZodDefault<z.ZodEnum<["task", "bug", "story", "epic", "subtask", "feature", "improvement"]>>;
|
|
14
|
-
priority: z.ZodDefault<z.ZodEnum<["critical", "high", "medium", "low", "none"]>>;
|
|
15
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
-
storyPoints: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
title: string;
|
|
19
|
-
priority: "critical" | "medium" | "high" | "low" | "none";
|
|
20
|
-
type: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement";
|
|
21
|
-
projectKey: string;
|
|
22
|
-
description?: string | undefined;
|
|
23
|
-
labels?: string[] | undefined;
|
|
24
|
-
storyPoints?: number | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
title: string;
|
|
27
|
-
projectKey: string;
|
|
28
|
-
description?: string | undefined;
|
|
29
|
-
priority?: "critical" | "medium" | "high" | "low" | "none" | undefined;
|
|
30
|
-
type?: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement" | undefined;
|
|
31
|
-
labels?: string[] | undefined;
|
|
32
|
-
storyPoints?: number | undefined;
|
|
33
|
-
}>;
|
|
34
|
-
declare const CreateProjectParamsSchema: z.ZodObject<{
|
|
35
|
-
name: z.ZodString;
|
|
36
|
-
key: z.ZodString;
|
|
37
|
-
description: z.ZodOptional<z.ZodString>;
|
|
38
|
-
icon: z.ZodOptional<z.ZodString>;
|
|
39
|
-
color: z.ZodOptional<z.ZodString>;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
name: string;
|
|
42
|
-
key: string;
|
|
43
|
-
description?: string | undefined;
|
|
44
|
-
icon?: string | undefined;
|
|
45
|
-
color?: string | undefined;
|
|
46
|
-
}, {
|
|
47
|
-
name: string;
|
|
48
|
-
key: string;
|
|
49
|
-
description?: string | undefined;
|
|
50
|
-
icon?: string | undefined;
|
|
51
|
-
color?: string | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
declare const ListTicketsParamsSchema: z.ZodObject<{
|
|
54
|
-
projectKey: z.ZodOptional<z.ZodString>;
|
|
55
|
-
status: z.ZodOptional<z.ZodString>;
|
|
56
|
-
type: z.ZodOptional<z.ZodString>;
|
|
57
|
-
priority: z.ZodOptional<z.ZodString>;
|
|
58
|
-
search: z.ZodOptional<z.ZodString>;
|
|
59
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
60
|
-
}, "strip", z.ZodTypeAny, {
|
|
61
|
-
limit: number;
|
|
62
|
-
priority?: string | undefined;
|
|
63
|
-
type?: string | undefined;
|
|
64
|
-
status?: string | undefined;
|
|
65
|
-
search?: string | undefined;
|
|
66
|
-
projectKey?: string | undefined;
|
|
67
|
-
}, {
|
|
68
|
-
priority?: string | undefined;
|
|
69
|
-
type?: string | undefined;
|
|
70
|
-
status?: string | undefined;
|
|
71
|
-
search?: string | undefined;
|
|
72
|
-
limit?: number | undefined;
|
|
73
|
-
projectKey?: string | undefined;
|
|
74
|
-
}>;
|
|
75
|
-
declare const ListProjectsParamsSchema: z.ZodObject<{
|
|
76
|
-
status: z.ZodDefault<z.ZodEnum<["active", "archived", "all"]>>;
|
|
77
|
-
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
status: "active" | "archived" | "all";
|
|
79
|
-
}, {
|
|
80
|
-
status?: "active" | "archived" | "all" | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
declare const UpdateTicketParamsSchema: z.ZodObject<{
|
|
83
|
-
ticketKey: z.ZodString;
|
|
84
|
-
title: z.ZodOptional<z.ZodString>;
|
|
85
|
-
description: z.ZodOptional<z.ZodString>;
|
|
86
|
-
status: z.ZodOptional<z.ZodEnum<["backlog", "todo", "in_progress", "in_review", "done", "cancelled"]>>;
|
|
87
|
-
priority: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low", "none"]>>;
|
|
88
|
-
type: z.ZodOptional<z.ZodEnum<["task", "bug", "story", "epic", "subtask", "feature", "improvement"]>>;
|
|
89
|
-
labels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
90
|
-
storyPoints: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
ticketKey: string;
|
|
93
|
-
title?: string | undefined;
|
|
94
|
-
description?: string | undefined;
|
|
95
|
-
priority?: "critical" | "medium" | "high" | "low" | "none" | undefined;
|
|
96
|
-
type?: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement" | undefined;
|
|
97
|
-
status?: "in_progress" | "cancelled" | "backlog" | "todo" | "in_review" | "done" | undefined;
|
|
98
|
-
labels?: string[] | undefined;
|
|
99
|
-
storyPoints?: number | undefined;
|
|
100
|
-
}, {
|
|
101
|
-
ticketKey: string;
|
|
102
|
-
title?: string | undefined;
|
|
103
|
-
description?: string | undefined;
|
|
104
|
-
priority?: "critical" | "medium" | "high" | "low" | "none" | undefined;
|
|
105
|
-
type?: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement" | undefined;
|
|
106
|
-
status?: "in_progress" | "cancelled" | "backlog" | "todo" | "in_review" | "done" | undefined;
|
|
107
|
-
labels?: string[] | undefined;
|
|
108
|
-
storyPoints?: number | undefined;
|
|
109
|
-
}>;
|
|
110
|
-
declare const GetTicketParamsSchema: z.ZodObject<{
|
|
111
|
-
ticketKey: z.ZodString;
|
|
112
|
-
}, "strip", z.ZodTypeAny, {
|
|
113
|
-
ticketKey: string;
|
|
114
|
-
}, {
|
|
115
|
-
ticketKey: string;
|
|
116
|
-
}>;
|
|
117
|
-
export type CreateTicketParams = z.infer<typeof CreateTicketParamsSchema>;
|
|
118
|
-
export type CreateProjectParams = z.infer<typeof CreateProjectParamsSchema>;
|
|
119
|
-
export type ListTicketsParams = z.infer<typeof ListTicketsParamsSchema>;
|
|
120
|
-
export type ListProjectsParams = z.infer<typeof ListProjectsParamsSchema>;
|
|
121
|
-
export type UpdateTicketParams = z.infer<typeof UpdateTicketParamsSchema>;
|
|
122
|
-
export type GetTicketParams = z.infer<typeof GetTicketParamsSchema>;
|
|
123
|
-
interface TicketResult {
|
|
124
|
-
id: string;
|
|
125
|
-
key: string;
|
|
126
|
-
title: string;
|
|
127
|
-
description?: string;
|
|
128
|
-
status: string;
|
|
129
|
-
type: string;
|
|
130
|
-
priority: string;
|
|
131
|
-
labels?: string[];
|
|
132
|
-
storyPoints?: number;
|
|
133
|
-
projectKey: string;
|
|
134
|
-
createdAt: string;
|
|
135
|
-
/** URL to view this ticket in the UI */
|
|
136
|
-
url: string;
|
|
137
|
-
}
|
|
138
|
-
interface ProjectResult {
|
|
139
|
-
id: string;
|
|
140
|
-
name: string;
|
|
141
|
-
key: string;
|
|
142
|
-
description?: string;
|
|
143
|
-
icon?: string;
|
|
144
|
-
color?: string;
|
|
145
|
-
status: string;
|
|
146
|
-
ticketCount?: number;
|
|
147
|
-
}
|
|
148
|
-
export declare const createTicketTool: ToolDefinition<CreateTicketParams, TicketResult>;
|
|
149
|
-
export declare const createProjectTool: ToolDefinition<CreateProjectParams, ProjectResult>;
|
|
150
|
-
export declare const listTicketsTool: ToolDefinition<ListTicketsParams, {
|
|
151
|
-
tickets: TicketResult[];
|
|
152
|
-
total: number;
|
|
153
|
-
}>;
|
|
154
|
-
export declare const listProjectsTool: ToolDefinition<ListProjectsParams, {
|
|
155
|
-
projects: ProjectResult[];
|
|
156
|
-
hint?: string;
|
|
157
|
-
}>;
|
|
158
|
-
export declare const updateTicketTool: ToolDefinition<UpdateTicketParams, TicketResult>;
|
|
159
|
-
export declare const getTicketTool: ToolDefinition<GetTicketParams, TicketResult>;
|
|
160
|
-
export declare const glinrTools: (ToolDefinition<{
|
|
161
|
-
title: string;
|
|
162
|
-
priority: "critical" | "medium" | "high" | "low" | "none";
|
|
163
|
-
type: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement";
|
|
164
|
-
projectKey: string;
|
|
165
|
-
description?: string | undefined;
|
|
166
|
-
labels?: string[] | undefined;
|
|
167
|
-
storyPoints?: number | undefined;
|
|
168
|
-
}, TicketResult> | ToolDefinition<{
|
|
169
|
-
name: string;
|
|
170
|
-
key: string;
|
|
171
|
-
description?: string | undefined;
|
|
172
|
-
icon?: string | undefined;
|
|
173
|
-
color?: string | undefined;
|
|
174
|
-
}, ProjectResult> | ToolDefinition<{
|
|
175
|
-
limit: number;
|
|
176
|
-
priority?: string | undefined;
|
|
177
|
-
type?: string | undefined;
|
|
178
|
-
status?: string | undefined;
|
|
179
|
-
search?: string | undefined;
|
|
180
|
-
projectKey?: string | undefined;
|
|
181
|
-
}, {
|
|
182
|
-
tickets: TicketResult[];
|
|
183
|
-
total: number;
|
|
184
|
-
}> | ToolDefinition<{
|
|
185
|
-
status: "active" | "archived" | "all";
|
|
186
|
-
}, {
|
|
187
|
-
projects: ProjectResult[];
|
|
188
|
-
hint?: string;
|
|
189
|
-
}> | ToolDefinition<{
|
|
190
|
-
ticketKey: string;
|
|
191
|
-
title?: string | undefined;
|
|
192
|
-
description?: string | undefined;
|
|
193
|
-
priority?: "critical" | "medium" | "high" | "low" | "none" | undefined;
|
|
194
|
-
type?: "feature" | "bug" | "task" | "epic" | "story" | "subtask" | "improvement" | undefined;
|
|
195
|
-
status?: "in_progress" | "cancelled" | "backlog" | "todo" | "in_review" | "done" | undefined;
|
|
196
|
-
labels?: string[] | undefined;
|
|
197
|
-
storyPoints?: number | undefined;
|
|
198
|
-
}, TicketResult> | ToolDefinition<{
|
|
199
|
-
ticketKey: string;
|
|
200
|
-
}, TicketResult>)[];
|
|
201
|
-
export {};
|
|
202
|
-
//# sourceMappingURL=glinr-ops.d.ts.map
|