@aria-cli/tools 1.0.9 → 1.0.11
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/package.json +9 -5
- package/src/__tests__/web-fetch-download.test.ts +0 -433
- package/src/__tests__/web-tools.test.ts +0 -619
- package/src/ask-user-interaction.ts +0 -33
- package/src/cache/web-cache.ts +0 -110
- package/src/definitions/arion.ts +0 -118
- package/src/definitions/browser/browser.ts +0 -502
- package/src/definitions/browser/index.ts +0 -5
- package/src/definitions/browser/pw-downloads.ts +0 -142
- package/src/definitions/browser/pw-interactions.ts +0 -282
- package/src/definitions/browser/pw-responses.ts +0 -98
- package/src/definitions/browser/pw-session.ts +0 -405
- package/src/definitions/browser/pw-shared.ts +0 -85
- package/src/definitions/browser/pw-snapshot.ts +0 -383
- package/src/definitions/browser/pw-state.ts +0 -101
- package/src/definitions/browser/types.ts +0 -203
- package/src/definitions/code-intelligence.ts +0 -526
- package/src/definitions/core.ts +0 -118
- package/src/definitions/delegation.ts +0 -567
- package/src/definitions/deploy.ts +0 -73
- package/src/definitions/filesystem.ts +0 -217
- package/src/definitions/frg.ts +0 -67
- package/src/definitions/index.ts +0 -28
- package/src/definitions/memory.ts +0 -150
- package/src/definitions/messaging.ts +0 -734
- package/src/definitions/meta.ts +0 -392
- package/src/definitions/network.ts +0 -179
- package/src/definitions/outlook.ts +0 -318
- package/src/definitions/patch/apply-patch.ts +0 -235
- package/src/definitions/patch/fuzzy-match.ts +0 -217
- package/src/definitions/patch/index.ts +0 -1
- package/src/definitions/patch/patch-parser.ts +0 -297
- package/src/definitions/patch/sandbox-paths.ts +0 -129
- package/src/definitions/process/index.ts +0 -5
- package/src/definitions/process/process-registry.ts +0 -303
- package/src/definitions/process/process.ts +0 -456
- package/src/definitions/process/pty-keys.ts +0 -298
- package/src/definitions/process/session-slug.ts +0 -147
- package/src/definitions/quip.ts +0 -225
- package/src/definitions/search.ts +0 -67
- package/src/definitions/session-history.ts +0 -79
- package/src/definitions/shell.ts +0 -202
- package/src/definitions/slack.ts +0 -211
- package/src/definitions/web.ts +0 -119
- package/src/executors/apply-patch.ts +0 -1035
- package/src/executors/arion.ts +0 -199
- package/src/executors/code-intelligence.ts +0 -1179
- package/src/executors/deploy.ts +0 -1066
- package/src/executors/filesystem.ts +0 -1428
- package/src/executors/frg-freshness.ts +0 -743
- package/src/executors/frg.ts +0 -394
- package/src/executors/index.ts +0 -280
- package/src/executors/learning-meta.ts +0 -1367
- package/src/executors/lsp-client.ts +0 -355
- package/src/executors/memory.ts +0 -978
- package/src/executors/meta.ts +0 -293
- package/src/executors/process-registry.ts +0 -570
- package/src/executors/pty-session-store.ts +0 -43
- package/src/executors/pty.ts +0 -342
- package/src/executors/restart.ts +0 -133
- package/src/executors/search-freshness.ts +0 -249
- package/src/executors/search-types.ts +0 -98
- package/src/executors/search.ts +0 -89
- package/src/executors/self-diagnose.ts +0 -552
- package/src/executors/session-history.ts +0 -435
- package/src/executors/shell-safety.ts +0 -519
- package/src/executors/shell.ts +0 -1243
- package/src/executors/utils.ts +0 -40
- package/src/executors/web.ts +0 -786
- package/src/extraction/content-extraction.ts +0 -281
- package/src/extraction/index.ts +0 -5
- package/src/headless-control-contract.ts +0 -1149
- package/src/index.ts +0 -788
- package/src/local-control-http-auth.ts +0 -2
- package/src/mcp/client.ts +0 -218
- package/src/mcp/connection.ts +0 -568
- package/src/mcp/index.ts +0 -11
- package/src/mcp/jsonrpc.ts +0 -195
- package/src/mcp/types.ts +0 -199
- package/src/network-control-adapter.ts +0 -88
- package/src/network-runtime/address-types.ts +0 -218
- package/src/network-runtime/db-owner-fencing.ts +0 -91
- package/src/network-runtime/delivery-receipts.ts +0 -372
- package/src/network-runtime/direct-endpoint-authority.ts +0 -35
- package/src/network-runtime/index.ts +0 -316
- package/src/network-runtime/local-control-contract.ts +0 -784
- package/src/network-runtime/node-store-contract.ts +0 -46
- package/src/network-runtime/pair-route-contract.ts +0 -97
- package/src/network-runtime/peer-capabilities.ts +0 -48
- package/src/network-runtime/peer-principal-ref.ts +0 -20
- package/src/network-runtime/peer-state-machine.ts +0 -160
- package/src/network-runtime/protocol-schemas.ts +0 -265
- package/src/network-runtime/runtime-bootstrap-contract.ts +0 -83
- package/src/outlook/desktop-session.ts +0 -409
- package/src/policy.ts +0 -171
- package/src/providers/brave.ts +0 -80
- package/src/providers/duckduckgo.ts +0 -199
- package/src/providers/exa.ts +0 -85
- package/src/providers/firecrawl.ts +0 -77
- package/src/providers/index.ts +0 -8
- package/src/providers/jina.ts +0 -70
- package/src/providers/router.ts +0 -121
- package/src/providers/search-provider.ts +0 -74
- package/src/providers/tavily.ts +0 -74
- package/src/quip/desktop-session.ts +0 -435
- package/src/registry/index.ts +0 -1
- package/src/registry/registry.ts +0 -905
- package/src/runtime-socket-local-control-client.ts +0 -632
- package/src/security/dns-normalization.ts +0 -34
- package/src/security/dns-pinning.ts +0 -138
- package/src/security/external-content.ts +0 -129
- package/src/security/ssrf.ts +0 -207
- package/src/slack/desktop-session.ts +0 -493
- package/src/tool-factory.ts +0 -91
- package/src/types.ts +0 -1341
- package/src/utils/retry.ts +0 -163
- package/src/utils/safe-parse-json.ts +0 -176
- package/src/utils/url.ts +0 -20
- package/tests/benchmarks/registry.bench.ts +0 -57
- package/tests/cache/web-cache.test.ts +0 -147
- package/tests/critical-integration.test.ts +0 -1465
- package/tests/definitions/apply-patch.test.ts +0 -586
- package/tests/definitions/browser.test.ts +0 -495
- package/tests/definitions/delegation-pause-resume.test.ts +0 -758
- package/tests/definitions/execution.test.ts +0 -671
- package/tests/definitions/messaging-inbox-scope.test.ts +0 -229
- package/tests/definitions/messaging.test.ts +0 -1468
- package/tests/definitions/outlook.test.ts +0 -30
- package/tests/definitions/process.test.ts +0 -469
- package/tests/definitions/slack.test.ts +0 -28
- package/tests/definitions/tool-inventory.test.ts +0 -218
- package/tests/e2e/delegation-quest-orchestration.e2e.test.ts +0 -433
- package/tests/e2e/memory-tool-discovery-contract.e2e.test.ts +0 -81
- package/tests/executors/apply-patch.test.ts +0 -538
- package/tests/executors/arion.test.ts +0 -309
- package/tests/executors/conversation-primitives.test.ts +0 -250
- package/tests/executors/deploy.test.ts +0 -746
- package/tests/executors/filesystem-tools.test.ts +0 -357
- package/tests/executors/filesystem.test.ts +0 -959
- package/tests/executors/frg-freshness.test.ts +0 -136
- package/tests/executors/frg-merge.test.ts +0 -70
- package/tests/executors/frg-session-content.test.ts +0 -40
- package/tests/executors/frg.test.ts +0 -56
- package/tests/executors/memory-bugfixes.test.ts +0 -257
- package/tests/executors/memory-real-memoria.integration.test.ts +0 -316
- package/tests/executors/memory.test.ts +0 -853
- package/tests/executors/meta-tools.test.ts +0 -411
- package/tests/executors/meta.test.ts +0 -683
- package/tests/executors/path-containment.test.ts +0 -51
- package/tests/executors/process-registry.test.ts +0 -505
- package/tests/executors/pty.test.ts +0 -664
- package/tests/executors/quest-security.test.ts +0 -249
- package/tests/executors/read-file-media.test.ts +0 -230
- package/tests/executors/recall-knowledge-schema.test.ts +0 -209
- package/tests/executors/recall-tags.test.ts +0 -278
- package/tests/executors/remember-null-safety.contract.test.ts +0 -41
- package/tests/executors/restart.test.ts +0 -67
- package/tests/executors/search-unified.test.ts +0 -381
- package/tests/executors/session-history.test.ts +0 -340
- package/tests/executors/session-transcript.test.ts +0 -561
- package/tests/executors/shell-abort.test.ts +0 -416
- package/tests/executors/shell-env-blocklist.test.ts +0 -648
- package/tests/executors/shell-env-process.test.ts +0 -245
- package/tests/executors/shell-process-registry.test.ts +0 -334
- package/tests/executors/shell-tools.test.ts +0 -393
- package/tests/executors/shell.test.ts +0 -690
- package/tests/executors/web-abort-vs-timeout.test.ts +0 -213
- package/tests/executors/web-integration.test.ts +0 -633
- package/tests/executors/web-symlink.test.ts +0 -18
- package/tests/executors/web.test.ts +0 -1400
- package/tests/executors/write-stdin.test.ts +0 -145
- package/tests/extraction/content-extraction.test.ts +0 -153
- package/tests/guards/tools-default-test-lane.integration.test.ts +0 -21
- package/tests/guards/tools-package-test-commands.e2e.test.ts +0 -43
- package/tests/guards/tools-test-lane-manifest.contract.test.ts +0 -76
- package/tests/guards/tools-vitest-workspace-alias.contract.test.ts +0 -63
- package/tests/helpers/async-waits.ts +0 -53
- package/tests/integration/headless-control-contract.integration.test.ts +0 -153
- package/tests/integration/memory-tool-schema-parity.integration.test.ts +0 -67
- package/tests/integration/meta-tools-round-trip.integration.test.ts +0 -506
- package/tests/integration/quest-round-trip.test.ts +0 -303
- package/tests/integration/registry-executor-flow.test.ts +0 -85
- package/tests/integration.test.ts +0 -177
- package/tests/loading-tier.test.ts +0 -126
- package/tests/mcp/client-reconnect.test.ts +0 -267
- package/tests/mcp/connection.test.ts +0 -846
- package/tests/mcp/injectable-logger.test.ts +0 -83
- package/tests/mcp/jsonrpc.test.ts +0 -109
- package/tests/mcp/lifecycle.test.ts +0 -879
- package/tests/network-runtime/address-types.contract.test.ts +0 -143
- package/tests/network-runtime/continuity-bind-schema.contract.test.ts +0 -203
- package/tests/network-runtime/local-control-contract.test.ts +0 -869
- package/tests/network-runtime/local-control-invite-token.contract.test.ts +0 -146
- package/tests/network-runtime/node-store-contract.test.ts +0 -11
- package/tests/network-runtime/pair-protocol-nodeid.contract.test.ts +0 -15
- package/tests/network-runtime/peer-state-machine.contract.test.ts +0 -148
- package/tests/network-runtime/protocol-schemas.contract.test.ts +0 -512
- package/tests/network-runtime/relay-pending-nodeid.contract.test.ts +0 -62
- package/tests/network-runtime/runtime-bootstrap-contract.test.ts +0 -227
- package/tests/network-runtime/runtime-socket-local-control-client.test.ts +0 -621
- package/tests/network-runtime/wait-for-message-script.test.ts +0 -288
- package/tests/parallel.test.ts +0 -71
- package/tests/policy.test.ts +0 -184
- package/tests/print-default-test-lane.ts +0 -14
- package/tests/print-test-lane-manifest.ts +0 -22
- package/tests/providers/brave.test.ts +0 -159
- package/tests/providers/duckduckgo.test.ts +0 -207
- package/tests/providers/exa.test.ts +0 -175
- package/tests/providers/firecrawl.test.ts +0 -168
- package/tests/providers/jina.test.ts +0 -144
- package/tests/providers/router.test.ts +0 -328
- package/tests/providers/tavily.test.ts +0 -165
- package/tests/registry/discovery.test.ts +0 -154
- package/tests/registry/injectable-logger.test.ts +0 -230
- package/tests/registry/input-validation.test.ts +0 -361
- package/tests/registry/interface-completeness.test.ts +0 -85
- package/tests/registry/mcp-integration.test.ts +0 -103
- package/tests/registry/mcp-read-only-hint.test.ts +0 -60
- package/tests/registry/memoria-discovery.test.ts +0 -390
- package/tests/registry/nested-validation.test.ts +0 -283
- package/tests/registry/pseudo-tool-filtering.test.ts +0 -258
- package/tests/registry/registration-lifecycle.test.ts +0 -133
- package/tests/registry-validation.test.ts +0 -424
- package/tests/registry.test.ts +0 -460
- package/tests/security/dns-pinning.test.ts +0 -162
- package/tests/security/external-content.test.ts +0 -144
- package/tests/security/ssrf.test.ts +0 -118
- package/tests/shell-safety-integration.test.ts +0 -32
- package/tests/shell-safety.test.ts +0 -365
- package/tests/slack/desktop-session.test.ts +0 -50
- package/tests/test-lane-manifest.ts +0 -440
- package/tests/test-utils.ts +0 -27
- package/tests/tool-factory.test.ts +0 -188
- package/tests/utils/retry.test.ts +0 -231
- package/tests/utils/url.test.ts +0 -63
- package/tsconfig.cjs.json +0 -24
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -55
- package/vitest.e2e.config.ts +0 -24
- package/vitest.integration.config.ts +0 -24
- package/vitest.native.config.ts +0 -24
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
// Originally from OpenClaw (MIT License, Copyright 2025 Peter Steinberger)
|
|
2
|
-
// https://github.com/openclaw/openclaw
|
|
3
|
-
// Modified for ARIA — stripped OpenClaw runtime, inlined escapeRegExp
|
|
4
|
-
|
|
5
|
-
const ESC = "\x1b";
|
|
6
|
-
const CR = "\r";
|
|
7
|
-
const TAB = "\t";
|
|
8
|
-
const BACKSPACE = "\x7f";
|
|
9
|
-
|
|
10
|
-
export const BRACKETED_PASTE_START = `${ESC}[200~`;
|
|
11
|
-
export const BRACKETED_PASTE_END = `${ESC}[201~`;
|
|
12
|
-
|
|
13
|
-
type Modifiers = {
|
|
14
|
-
ctrl: boolean;
|
|
15
|
-
alt: boolean;
|
|
16
|
-
shift: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const namedKeyMap = new Map<string, string>([
|
|
20
|
-
["enter", CR],
|
|
21
|
-
["return", CR],
|
|
22
|
-
["tab", TAB],
|
|
23
|
-
["escape", ESC],
|
|
24
|
-
["esc", ESC],
|
|
25
|
-
["space", " "],
|
|
26
|
-
["bspace", BACKSPACE],
|
|
27
|
-
["backspace", BACKSPACE],
|
|
28
|
-
["up", `${ESC}[A`],
|
|
29
|
-
["down", `${ESC}[B`],
|
|
30
|
-
["right", `${ESC}[C`],
|
|
31
|
-
["left", `${ESC}[D`],
|
|
32
|
-
["home", `${ESC}[1~`],
|
|
33
|
-
["end", `${ESC}[4~`],
|
|
34
|
-
["pageup", `${ESC}[5~`],
|
|
35
|
-
["pgup", `${ESC}[5~`],
|
|
36
|
-
["ppage", `${ESC}[5~`],
|
|
37
|
-
["pagedown", `${ESC}[6~`],
|
|
38
|
-
["pgdn", `${ESC}[6~`],
|
|
39
|
-
["npage", `${ESC}[6~`],
|
|
40
|
-
["insert", `${ESC}[2~`],
|
|
41
|
-
["ic", `${ESC}[2~`],
|
|
42
|
-
["delete", `${ESC}[3~`],
|
|
43
|
-
["del", `${ESC}[3~`],
|
|
44
|
-
["dc", `${ESC}[3~`],
|
|
45
|
-
["btab", `${ESC}[Z`],
|
|
46
|
-
["f1", `${ESC}OP`],
|
|
47
|
-
["f2", `${ESC}OQ`],
|
|
48
|
-
["f3", `${ESC}OR`],
|
|
49
|
-
["f4", `${ESC}OS`],
|
|
50
|
-
["f5", `${ESC}[15~`],
|
|
51
|
-
["f6", `${ESC}[17~`],
|
|
52
|
-
["f7", `${ESC}[18~`],
|
|
53
|
-
["f8", `${ESC}[19~`],
|
|
54
|
-
["f9", `${ESC}[20~`],
|
|
55
|
-
["f10", `${ESC}[21~`],
|
|
56
|
-
["f11", `${ESC}[23~`],
|
|
57
|
-
["f12", `${ESC}[24~`],
|
|
58
|
-
["kp/", `${ESC}Oo`],
|
|
59
|
-
["kp*", `${ESC}Oj`],
|
|
60
|
-
["kp-", `${ESC}Om`],
|
|
61
|
-
["kp+", `${ESC}Ok`],
|
|
62
|
-
["kp7", `${ESC}Ow`],
|
|
63
|
-
["kp8", `${ESC}Ox`],
|
|
64
|
-
["kp9", `${ESC}Oy`],
|
|
65
|
-
["kp4", `${ESC}Ot`],
|
|
66
|
-
["kp5", `${ESC}Ou`],
|
|
67
|
-
["kp6", `${ESC}Ov`],
|
|
68
|
-
["kp1", `${ESC}Oq`],
|
|
69
|
-
["kp2", `${ESC}Or`],
|
|
70
|
-
["kp3", `${ESC}Os`],
|
|
71
|
-
["kp0", `${ESC}Op`],
|
|
72
|
-
["kp.", `${ESC}On`],
|
|
73
|
-
["kpenter", `${ESC}OM`],
|
|
74
|
-
]);
|
|
75
|
-
|
|
76
|
-
const modifiableNamedKeys = new Set([
|
|
77
|
-
"up",
|
|
78
|
-
"down",
|
|
79
|
-
"left",
|
|
80
|
-
"right",
|
|
81
|
-
"home",
|
|
82
|
-
"end",
|
|
83
|
-
"pageup",
|
|
84
|
-
"pgup",
|
|
85
|
-
"ppage",
|
|
86
|
-
"pagedown",
|
|
87
|
-
"pgdn",
|
|
88
|
-
"npage",
|
|
89
|
-
"insert",
|
|
90
|
-
"ic",
|
|
91
|
-
"delete",
|
|
92
|
-
"del",
|
|
93
|
-
"dc",
|
|
94
|
-
]);
|
|
95
|
-
|
|
96
|
-
export type KeyEncodingRequest = {
|
|
97
|
-
keys?: string[];
|
|
98
|
-
hex?: string[];
|
|
99
|
-
literal?: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type KeyEncodingResult = {
|
|
103
|
-
data: string;
|
|
104
|
-
warnings: string[];
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export function encodeKeySequence(request: KeyEncodingRequest): KeyEncodingResult {
|
|
108
|
-
const warnings: string[] = [];
|
|
109
|
-
let data = "";
|
|
110
|
-
|
|
111
|
-
if (request.literal) {
|
|
112
|
-
data += request.literal;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (request.hex?.length) {
|
|
116
|
-
for (const raw of request.hex) {
|
|
117
|
-
const byte = parseHexByte(raw);
|
|
118
|
-
if (byte === null) {
|
|
119
|
-
warnings.push(`Invalid hex byte: ${raw}`);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
data += String.fromCharCode(byte);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (request.keys?.length) {
|
|
127
|
-
for (const token of request.keys) {
|
|
128
|
-
data += encodeKeyToken(token, warnings);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return { data, warnings };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function encodePaste(text: string, bracketed = true): string {
|
|
136
|
-
if (!bracketed) {
|
|
137
|
-
return text;
|
|
138
|
-
}
|
|
139
|
-
return `${BRACKETED_PASTE_START}${text}${BRACKETED_PASTE_END}`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function encodeKeyToken(raw: string, warnings: string[]): string {
|
|
143
|
-
const token = raw.trim();
|
|
144
|
-
if (!token) {
|
|
145
|
-
return "";
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (token.length === 2 && token.startsWith("^")) {
|
|
149
|
-
const ctrl = toCtrlChar(token[1]!);
|
|
150
|
-
if (ctrl) {
|
|
151
|
-
return ctrl;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const parsed = parseModifiers(token);
|
|
156
|
-
const base = parsed.base;
|
|
157
|
-
const baseLower = base.toLowerCase();
|
|
158
|
-
|
|
159
|
-
if (baseLower === "tab" && parsed.mods.shift) {
|
|
160
|
-
return `${ESC}[Z`;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const baseSeq = namedKeyMap.get(baseLower);
|
|
164
|
-
if (baseSeq) {
|
|
165
|
-
let seq = baseSeq;
|
|
166
|
-
if (modifiableNamedKeys.has(baseLower) && hasAnyModifier(parsed.mods)) {
|
|
167
|
-
const mod = xtermModifier(parsed.mods);
|
|
168
|
-
if (mod > 1) {
|
|
169
|
-
const modified = applyXtermModifier(seq, mod);
|
|
170
|
-
if (modified) {
|
|
171
|
-
seq = modified;
|
|
172
|
-
return seq;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (parsed.mods.alt) {
|
|
177
|
-
return `${ESC}${seq}`;
|
|
178
|
-
}
|
|
179
|
-
return seq;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (base.length === 1) {
|
|
183
|
-
return applyCharModifiers(base, parsed.mods);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (parsed.hasModifiers) {
|
|
187
|
-
warnings.push(`Unknown key "${base}" for modifiers; sending literal.`);
|
|
188
|
-
}
|
|
189
|
-
return base;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function parseModifiers(token: string) {
|
|
193
|
-
const mods: Modifiers = { ctrl: false, alt: false, shift: false };
|
|
194
|
-
let rest = token;
|
|
195
|
-
let sawModifiers = false;
|
|
196
|
-
|
|
197
|
-
while (rest.length > 2 && rest[1] === "-") {
|
|
198
|
-
const mod = rest[0]!.toLowerCase();
|
|
199
|
-
if (mod === "c") {
|
|
200
|
-
mods.ctrl = true;
|
|
201
|
-
} else if (mod === "m") {
|
|
202
|
-
mods.alt = true;
|
|
203
|
-
} else if (mod === "s") {
|
|
204
|
-
mods.shift = true;
|
|
205
|
-
} else {
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
sawModifiers = true;
|
|
209
|
-
rest = rest.slice(2);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return { mods, base: rest, hasModifiers: sawModifiers };
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function applyCharModifiers(char: string, mods: Modifiers): string {
|
|
216
|
-
let value = char;
|
|
217
|
-
if (mods.shift && value.length === 1 && /[a-z]/.test(value)) {
|
|
218
|
-
value = value.toUpperCase();
|
|
219
|
-
}
|
|
220
|
-
if (mods.ctrl) {
|
|
221
|
-
const ctrl = toCtrlChar(value);
|
|
222
|
-
if (ctrl) {
|
|
223
|
-
value = ctrl;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (mods.alt) {
|
|
227
|
-
value = `${ESC}${value}`;
|
|
228
|
-
}
|
|
229
|
-
return value;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function toCtrlChar(char: string): string | null {
|
|
233
|
-
if (char.length !== 1) {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
if (char === "?") {
|
|
237
|
-
return "\x7f";
|
|
238
|
-
}
|
|
239
|
-
const code = char.toUpperCase().charCodeAt(0);
|
|
240
|
-
if (code >= 64 && code <= 95) {
|
|
241
|
-
return String.fromCharCode(code & 0x1f);
|
|
242
|
-
}
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function xtermModifier(mods: Modifiers): number {
|
|
247
|
-
let mod = 1;
|
|
248
|
-
if (mods.shift) {
|
|
249
|
-
mod += 1;
|
|
250
|
-
}
|
|
251
|
-
if (mods.alt) {
|
|
252
|
-
mod += 2;
|
|
253
|
-
}
|
|
254
|
-
if (mods.ctrl) {
|
|
255
|
-
mod += 4;
|
|
256
|
-
}
|
|
257
|
-
return mod;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/** Inlined from OpenClaw src/utils.ts — escapes special regex characters */
|
|
261
|
-
function escapeRegExp(value: string): string {
|
|
262
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function applyXtermModifier(sequence: string, modifier: number): string | null {
|
|
266
|
-
const escPattern = escapeRegExp(ESC);
|
|
267
|
-
const csiNumber = new RegExp(`^${escPattern}\\[(\\d+)([~A-Z])$`);
|
|
268
|
-
const csiArrow = new RegExp(`^${escPattern}\\[(A|B|C|D|H|F)$`);
|
|
269
|
-
|
|
270
|
-
const numberMatch = sequence.match(csiNumber);
|
|
271
|
-
if (numberMatch) {
|
|
272
|
-
return `${ESC}[${numberMatch[1]};${modifier}${numberMatch[2]}`;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const arrowMatch = sequence.match(csiArrow);
|
|
276
|
-
if (arrowMatch) {
|
|
277
|
-
return `${ESC}[1;${modifier}${arrowMatch[1]}`;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function hasAnyModifier(mods: Modifiers): boolean {
|
|
284
|
-
return mods.ctrl || mods.alt || mods.shift;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function parseHexByte(raw: string): number | null {
|
|
288
|
-
const trimmed = raw.trim().toLowerCase();
|
|
289
|
-
const normalized = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
|
|
290
|
-
if (!/^[0-9a-f]{1,2}$/.test(normalized)) {
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
const value = Number.parseInt(normalized, 16);
|
|
294
|
-
if (Number.isNaN(value) || value < 0 || value > 0xff) {
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
return value;
|
|
298
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// Originally from OpenClaw (MIT License, Copyright 2025 Peter Steinberger)
|
|
2
|
-
// https://github.com/openclaw/openclaw
|
|
3
|
-
// Modified for ARIA — stripped OpenClaw runtime, rewired to ARIA Tool interface
|
|
4
|
-
|
|
5
|
-
const SLUG_ADJECTIVES = [
|
|
6
|
-
"amber",
|
|
7
|
-
"briny",
|
|
8
|
-
"brisk",
|
|
9
|
-
"calm",
|
|
10
|
-
"clear",
|
|
11
|
-
"cool",
|
|
12
|
-
"crisp",
|
|
13
|
-
"dawn",
|
|
14
|
-
"delta",
|
|
15
|
-
"ember",
|
|
16
|
-
"faint",
|
|
17
|
-
"fast",
|
|
18
|
-
"fresh",
|
|
19
|
-
"gentle",
|
|
20
|
-
"glow",
|
|
21
|
-
"good",
|
|
22
|
-
"grand",
|
|
23
|
-
"keen",
|
|
24
|
-
"kind",
|
|
25
|
-
"lucky",
|
|
26
|
-
"marine",
|
|
27
|
-
"mellow",
|
|
28
|
-
"mild",
|
|
29
|
-
"neat",
|
|
30
|
-
"nimble",
|
|
31
|
-
"nova",
|
|
32
|
-
"oceanic",
|
|
33
|
-
"plaid",
|
|
34
|
-
"quick",
|
|
35
|
-
"quiet",
|
|
36
|
-
"rapid",
|
|
37
|
-
"salty",
|
|
38
|
-
"sharp",
|
|
39
|
-
"swift",
|
|
40
|
-
"tender",
|
|
41
|
-
"tidal",
|
|
42
|
-
"tidy",
|
|
43
|
-
"tide",
|
|
44
|
-
"vivid",
|
|
45
|
-
"warm",
|
|
46
|
-
"wild",
|
|
47
|
-
"young",
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
const SLUG_NOUNS = [
|
|
51
|
-
"atlas",
|
|
52
|
-
"basil",
|
|
53
|
-
"bison",
|
|
54
|
-
"bloom",
|
|
55
|
-
"breeze",
|
|
56
|
-
"canyon",
|
|
57
|
-
"cedar",
|
|
58
|
-
"claw",
|
|
59
|
-
"cloud",
|
|
60
|
-
"comet",
|
|
61
|
-
"coral",
|
|
62
|
-
"cove",
|
|
63
|
-
"crest",
|
|
64
|
-
"crustacean",
|
|
65
|
-
"daisy",
|
|
66
|
-
"dune",
|
|
67
|
-
"ember",
|
|
68
|
-
"falcon",
|
|
69
|
-
"fjord",
|
|
70
|
-
"forest",
|
|
71
|
-
"glade",
|
|
72
|
-
"gulf",
|
|
73
|
-
"harbor",
|
|
74
|
-
"haven",
|
|
75
|
-
"kelp",
|
|
76
|
-
"lagoon",
|
|
77
|
-
"lobster",
|
|
78
|
-
"meadow",
|
|
79
|
-
"mist",
|
|
80
|
-
"nudibranch",
|
|
81
|
-
"nexus",
|
|
82
|
-
"ocean",
|
|
83
|
-
"orbit",
|
|
84
|
-
"otter",
|
|
85
|
-
"pine",
|
|
86
|
-
"prairie",
|
|
87
|
-
"reef",
|
|
88
|
-
"ridge",
|
|
89
|
-
"river",
|
|
90
|
-
"rook",
|
|
91
|
-
"sable",
|
|
92
|
-
"sage",
|
|
93
|
-
"seaslug",
|
|
94
|
-
"shell",
|
|
95
|
-
"shoal",
|
|
96
|
-
"shore",
|
|
97
|
-
"slug",
|
|
98
|
-
"summit",
|
|
99
|
-
"tidepool",
|
|
100
|
-
"trail",
|
|
101
|
-
"valley",
|
|
102
|
-
"wharf",
|
|
103
|
-
"willow",
|
|
104
|
-
"zephyr",
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
function randomChoice(values: string[], fallback: string) {
|
|
108
|
-
return values[Math.floor(Math.random() * values.length)] ?? fallback;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function createSlugBase(words = 2) {
|
|
112
|
-
const parts = [randomChoice(SLUG_ADJECTIVES, "steady"), randomChoice(SLUG_NOUNS, "harbor")];
|
|
113
|
-
if (words > 2) {
|
|
114
|
-
parts.push(randomChoice(SLUG_NOUNS, "reef"));
|
|
115
|
-
}
|
|
116
|
-
return parts.join("-");
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function createSessionSlug(isTaken?: (id: string) => boolean): string {
|
|
120
|
-
const isIdTaken = isTaken ?? (() => false);
|
|
121
|
-
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
122
|
-
const base = createSlugBase(2);
|
|
123
|
-
if (!isIdTaken(base)) {
|
|
124
|
-
return base;
|
|
125
|
-
}
|
|
126
|
-
for (let i = 2; i <= 12; i += 1) {
|
|
127
|
-
const candidate = `${base}-${i}`;
|
|
128
|
-
if (!isIdTaken(candidate)) {
|
|
129
|
-
return candidate;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
134
|
-
const base = createSlugBase(3);
|
|
135
|
-
if (!isIdTaken(base)) {
|
|
136
|
-
return base;
|
|
137
|
-
}
|
|
138
|
-
for (let i = 2; i <= 12; i += 1) {
|
|
139
|
-
const candidate = `${base}-${i}`;
|
|
140
|
-
if (!isIdTaken(candidate)) {
|
|
141
|
-
return candidate;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const fallback = `${createSlugBase(3)}-${Math.random().toString(36).slice(2, 5)}`;
|
|
146
|
-
return isIdTaken(fallback) ? `${fallback}-${Date.now().toString(36)}` : fallback;
|
|
147
|
-
}
|
package/src/definitions/quip.ts
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from "json-schema";
|
|
2
|
-
import type { Tool } from "../types.js";
|
|
3
|
-
import { execFile } from "node:child_process";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
|
|
7
|
-
const QUIP_PY = join(homedir(), ".aria", "tools", "quip.py");
|
|
8
|
-
|
|
9
|
-
function runQuip(args: string[]): Promise<string> {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
execFile(QUIP_PY, args, { timeout: 30_000 }, (err, stdout, stderr) => {
|
|
12
|
-
if (err) {
|
|
13
|
-
reject(new Error(stderr?.trim() || err.message));
|
|
14
|
-
} else {
|
|
15
|
-
resolve(stdout);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type CheckQuipDocumentsInput = {
|
|
22
|
-
action?: string;
|
|
23
|
-
query?: string;
|
|
24
|
-
threadId?: string;
|
|
25
|
-
limit?: number;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type SendQuipCommentInput = {
|
|
29
|
-
threadId?: string;
|
|
30
|
-
content?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
type CreateQuipDocumentInput = {
|
|
34
|
-
title?: string;
|
|
35
|
-
content?: string;
|
|
36
|
-
format?: string;
|
|
37
|
-
folderId?: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const check_quip_documents: Tool = {
|
|
41
|
-
name: "check_quip_documents",
|
|
42
|
-
description:
|
|
43
|
-
"Read, search, or list Quip documents and comments using the local Quip session on this machine. " +
|
|
44
|
-
"Actions: 'recent' lists recent docs, 'search' finds docs by query, 'read' gets full document content, 'comments' lists comments on a document.",
|
|
45
|
-
category: "messaging",
|
|
46
|
-
parameters: {
|
|
47
|
-
type: "object",
|
|
48
|
-
properties: {
|
|
49
|
-
action: {
|
|
50
|
-
type: "string",
|
|
51
|
-
enum: ["recent", "search", "read", "comments"],
|
|
52
|
-
description:
|
|
53
|
-
"What to do: 'recent' (list recent docs), 'search' (find docs), 'read' (get document content), 'comments' (list comments).",
|
|
54
|
-
},
|
|
55
|
-
query: {
|
|
56
|
-
type: "string",
|
|
57
|
-
description: "Search query (required for 'search' action).",
|
|
58
|
-
},
|
|
59
|
-
threadId: {
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "Quip thread/document ID (required for 'read' and 'comments' actions).",
|
|
62
|
-
},
|
|
63
|
-
limit: {
|
|
64
|
-
type: "number",
|
|
65
|
-
description: "Maximum number of results to return (default 20, max 50).",
|
|
66
|
-
default: 20,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
required: ["action"],
|
|
70
|
-
} as JSONSchema7,
|
|
71
|
-
riskLevel: "safe",
|
|
72
|
-
isReadOnly: true,
|
|
73
|
-
loadingTier: "always",
|
|
74
|
-
execute: async (input: unknown) => {
|
|
75
|
-
const typedInput = input as CheckQuipDocumentsInput;
|
|
76
|
-
try {
|
|
77
|
-
const action = String(typedInput.action ?? "recent");
|
|
78
|
-
const limit = String(typeof typedInput.limit === "number" ? typedInput.limit : 20);
|
|
79
|
-
|
|
80
|
-
if (action === "recent") {
|
|
81
|
-
const raw = await runQuip(["recent", limit]);
|
|
82
|
-
return { success: true, message: `Recent Quip documents.`, data: { output: raw } };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (action === "search") {
|
|
86
|
-
const query = String(typedInput.query ?? "");
|
|
87
|
-
if (!query) return { success: false, message: "'search' requires a 'query' parameter." };
|
|
88
|
-
const raw = await runQuip(["search", query, "--limit", limit]);
|
|
89
|
-
return { success: true, message: `Search results for "${query}".`, data: { output: raw } };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (action === "read") {
|
|
93
|
-
const threadId = String(typedInput.threadId ?? "");
|
|
94
|
-
if (!threadId)
|
|
95
|
-
return { success: false, message: "'read' requires a 'threadId' parameter." };
|
|
96
|
-
const raw = await runQuip(["read", threadId]);
|
|
97
|
-
return { success: true, message: `Read document ${threadId}.`, data: { output: raw } };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (action === "comments") {
|
|
101
|
-
const threadId = String(typedInput.threadId ?? "");
|
|
102
|
-
if (!threadId)
|
|
103
|
-
return { success: false, message: "'comments' requires a 'threadId' parameter." };
|
|
104
|
-
const raw = await runQuip(["comments", threadId]);
|
|
105
|
-
return { success: true, message: `Comments on ${threadId}.`, data: { output: raw } };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
success: false,
|
|
110
|
-
message: `Unknown action: ${action}. Use recent, search, read, or comments.`,
|
|
111
|
-
};
|
|
112
|
-
} catch (error) {
|
|
113
|
-
return {
|
|
114
|
-
success: false,
|
|
115
|
-
message: error instanceof Error ? error.message : "Quip read failed.",
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const send_quip_comment: Tool = {
|
|
122
|
-
name: "send_quip_comment",
|
|
123
|
-
description:
|
|
124
|
-
"Add a comment to a Quip document using the local Quip session on this machine. " +
|
|
125
|
-
"Requires confirmation because it posts externally.",
|
|
126
|
-
category: "messaging",
|
|
127
|
-
parameters: {
|
|
128
|
-
type: "object",
|
|
129
|
-
properties: {
|
|
130
|
-
threadId: {
|
|
131
|
-
type: "string",
|
|
132
|
-
description: "Quip thread/document ID to comment on.",
|
|
133
|
-
},
|
|
134
|
-
content: {
|
|
135
|
-
type: "string",
|
|
136
|
-
description: "Comment text to post.",
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
required: ["threadId", "content"],
|
|
140
|
-
} as JSONSchema7,
|
|
141
|
-
riskLevel: "dangerous",
|
|
142
|
-
requiresConfirmation: true,
|
|
143
|
-
isReadOnly: false,
|
|
144
|
-
loadingTier: "always",
|
|
145
|
-
execute: async (input: unknown) => {
|
|
146
|
-
const typedInput = input as SendQuipCommentInput;
|
|
147
|
-
try {
|
|
148
|
-
const raw = await runQuip([
|
|
149
|
-
"comment",
|
|
150
|
-
String(typedInput.threadId ?? ""),
|
|
151
|
-
String(typedInput.content ?? ""),
|
|
152
|
-
]);
|
|
153
|
-
return { success: true, message: `Posted comment.`, data: { output: raw } };
|
|
154
|
-
} catch (error) {
|
|
155
|
-
return {
|
|
156
|
-
success: false,
|
|
157
|
-
message: error instanceof Error ? error.message : "Quip comment failed.",
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const create_quip_document: Tool = {
|
|
164
|
-
name: "create_quip_document",
|
|
165
|
-
description:
|
|
166
|
-
"Create a new Quip document using the local Quip session on this machine. " +
|
|
167
|
-
"Requires confirmation because it creates external content.",
|
|
168
|
-
category: "messaging",
|
|
169
|
-
parameters: {
|
|
170
|
-
type: "object",
|
|
171
|
-
properties: {
|
|
172
|
-
title: {
|
|
173
|
-
type: "string",
|
|
174
|
-
description: "Document title.",
|
|
175
|
-
},
|
|
176
|
-
content: {
|
|
177
|
-
type: "string",
|
|
178
|
-
description: "Document body content.",
|
|
179
|
-
},
|
|
180
|
-
format: {
|
|
181
|
-
type: "string",
|
|
182
|
-
enum: ["markdown", "html"],
|
|
183
|
-
description: "Content format (default 'markdown').",
|
|
184
|
-
default: "markdown",
|
|
185
|
-
},
|
|
186
|
-
folderId: {
|
|
187
|
-
type: "string",
|
|
188
|
-
description: "Optional folder ID to place the document in.",
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
required: ["title", "content"],
|
|
192
|
-
} as JSONSchema7,
|
|
193
|
-
riskLevel: "dangerous",
|
|
194
|
-
requiresConfirmation: true,
|
|
195
|
-
isReadOnly: false,
|
|
196
|
-
loadingTier: "always",
|
|
197
|
-
execute: async (input: unknown) => {
|
|
198
|
-
const typedInput = input as CreateQuipDocumentInput;
|
|
199
|
-
try {
|
|
200
|
-
const args = [
|
|
201
|
-
"create",
|
|
202
|
-
"--title",
|
|
203
|
-
String(typedInput.title ?? ""),
|
|
204
|
-
"--body",
|
|
205
|
-
String(typedInput.content ?? ""),
|
|
206
|
-
];
|
|
207
|
-
if (typedInput.format) args.push("--format", typedInput.format);
|
|
208
|
-
if (typedInput.folderId) args.push("--folder", typedInput.folderId);
|
|
209
|
-
|
|
210
|
-
const raw = await runQuip(args);
|
|
211
|
-
return { success: true, message: `Created document.`, data: { output: raw } };
|
|
212
|
-
} catch (error) {
|
|
213
|
-
return {
|
|
214
|
-
success: false,
|
|
215
|
-
message: error instanceof Error ? error.message : "Quip create failed.",
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export const QUIP_TOOL_DEFINITIONS = [
|
|
222
|
-
check_quip_documents,
|
|
223
|
-
send_quip_comment,
|
|
224
|
-
create_quip_document,
|
|
225
|
-
];
|