aiden-runtime 4.1.5 → 4.5.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/README.md +250 -847
- package/dist/api/server.js +32 -5
- package/dist/cli/v4/aidenCLI.js +351 -53
- package/dist/cli/v4/callbacks.js +170 -0
- package/dist/cli/v4/chatSession.js +138 -3
- package/dist/cli/v4/commands/_runtimeToggleHelpers.js +92 -0
- package/dist/cli/v4/commands/browserDepth.js +45 -0
- package/dist/cli/v4/commands/cron.js +264 -0
- package/dist/cli/v4/commands/daemon.js +541 -0
- package/dist/cli/v4/commands/daemonStatus.js +253 -0
- package/dist/cli/v4/commands/help.js +7 -0
- package/dist/cli/v4/commands/index.js +20 -1
- package/dist/cli/v4/commands/runs.js +203 -0
- package/dist/cli/v4/commands/sandbox.js +48 -0
- package/dist/cli/v4/commands/suggestions.js +68 -0
- package/dist/cli/v4/commands/tce.js +41 -0
- package/dist/cli/v4/commands/trigger.js +378 -0
- package/dist/cli/v4/commands/update.js +95 -3
- package/dist/cli/v4/daemonAgentBuilder.js +142 -0
- package/dist/cli/v4/defaultSoul.js +1 -1
- package/dist/cli/v4/display/capabilityCard.js +26 -0
- package/dist/cli/v4/display.js +18 -8
- package/dist/cli/v4/replyRenderer.js +31 -23
- package/dist/cli/v4/updateBootPrompt.js +170 -0
- package/dist/core/playwrightBridge.js +129 -0
- package/dist/core/v4/aidenAgent.js +308 -4
- package/dist/core/v4/browserState.js +436 -0
- package/dist/core/v4/checkpoint.js +79 -0
- package/dist/core/v4/daemon/bootstrap.js +604 -0
- package/dist/core/v4/daemon/cleanShutdown.js +154 -0
- package/dist/core/v4/daemon/cron/cronBridge.js +126 -0
- package/dist/core/v4/daemon/cron/cronEmitter.js +173 -0
- package/dist/core/v4/daemon/cron/migration.js +199 -0
- package/dist/core/v4/daemon/cron/misfirePolicy.js +115 -0
- package/dist/core/v4/daemon/daemonConfig.js +90 -0
- package/dist/core/v4/daemon/db/connection.js +106 -0
- package/dist/core/v4/daemon/db/migrations.js +296 -0
- package/dist/core/v4/daemon/db/schema/v1.spec.js +18 -0
- package/dist/core/v4/daemon/dispatcher/agentRunner.js +98 -0
- package/dist/core/v4/daemon/dispatcher/budgetGate.js +127 -0
- package/dist/core/v4/daemon/dispatcher/daemonApproval.js +113 -0
- package/dist/core/v4/daemon/dispatcher/dailyBudgetTracker.js +120 -0
- package/dist/core/v4/daemon/dispatcher/dispatcher.js +389 -0
- package/dist/core/v4/daemon/dispatcher/fireRateLimiter.js +113 -0
- package/dist/core/v4/daemon/dispatcher/index.js +53 -0
- package/dist/core/v4/daemon/dispatcher/promptTemplate.js +95 -0
- package/dist/core/v4/daemon/dispatcher/realAgentRunner.js +356 -0
- package/dist/core/v4/daemon/dispatcher/resolveModel.js +93 -0
- package/dist/core/v4/daemon/dispatcher/sessionId.js +93 -0
- package/dist/core/v4/daemon/drain.js +156 -0
- package/dist/core/v4/daemon/eventLoopLag.js +73 -0
- package/dist/core/v4/daemon/health.js +159 -0
- package/dist/core/v4/daemon/idempotencyStore.js +204 -0
- package/dist/core/v4/daemon/index.js +179 -0
- package/dist/core/v4/daemon/instanceTracker.js +99 -0
- package/dist/core/v4/daemon/resourceRegistry.js +150 -0
- package/dist/core/v4/daemon/restartCode.js +32 -0
- package/dist/core/v4/daemon/restartFailureCounter.js +77 -0
- package/dist/core/v4/daemon/runStore.js +114 -0
- package/dist/core/v4/daemon/runtimeLock.js +167 -0
- package/dist/core/v4/daemon/signals.js +50 -0
- package/dist/core/v4/daemon/supervisor.js +272 -0
- package/dist/core/v4/daemon/triggerBus.js +279 -0
- package/dist/core/v4/daemon/triggers/email/allowlist.js +70 -0
- package/dist/core/v4/daemon/triggers/email/automatedSender.js +78 -0
- package/dist/core/v4/daemon/triggers/email/bodyExtractor.js +0 -0
- package/dist/core/v4/daemon/triggers/email/emailSeenStore.js +99 -0
- package/dist/core/v4/daemon/triggers/email/emailSpec.js +107 -0
- package/dist/core/v4/daemon/triggers/email/imapConnection.js +211 -0
- package/dist/core/v4/daemon/triggers/email/index.js +332 -0
- package/dist/core/v4/daemon/triggers/email/seenUids.js +60 -0
- package/dist/core/v4/daemon/triggers/fileObservationsStore.js +93 -0
- package/dist/core/v4/daemon/triggers/fileWatcher.js +253 -0
- package/dist/core/v4/daemon/triggers/fileWatcherSpec.js +88 -0
- package/dist/core/v4/daemon/triggers/fsIdentity.js +42 -0
- package/dist/core/v4/daemon/triggers/globMatcher.js +100 -0
- package/dist/core/v4/daemon/triggers/reconcile.js +206 -0
- package/dist/core/v4/daemon/triggers/settleStat.js +81 -0
- package/dist/core/v4/daemon/triggers/webhook.js +376 -0
- package/dist/core/v4/daemon/triggers/webhookDeliveriesStore.js +109 -0
- package/dist/core/v4/daemon/triggers/webhookIdempotency.js +72 -0
- package/dist/core/v4/daemon/triggers/webhookRateLimit.js +56 -0
- package/dist/core/v4/daemon/triggers/webhookSpec.js +76 -0
- package/dist/core/v4/daemon/triggers/webhookVerifier.js +128 -0
- package/dist/core/v4/daemon/types.js +15 -0
- package/dist/core/v4/dockerSession.js +461 -0
- package/dist/core/v4/dryRun.js +117 -0
- package/dist/core/v4/failureClassifier.js +779 -0
- package/dist/core/v4/recoveryReport.js +449 -0
- package/dist/core/v4/runtimeToggles.js +187 -0
- package/dist/core/v4/sandboxConfig.js +285 -0
- package/dist/core/v4/sandboxFs.js +316 -0
- package/dist/core/v4/suggestionCatalog.js +41 -0
- package/dist/core/v4/suggestionEngine.js +210 -0
- package/dist/core/v4/toolRegistry.js +18 -0
- package/dist/core/v4/turnState.js +587 -0
- package/dist/core/v4/update/checkUpdate.js +63 -3
- package/dist/core/v4/update/installMethodDetect.js +115 -0
- package/dist/core/v4/update/registryClient.js +121 -0
- package/dist/core/v4/update/skipState.js +75 -0
- package/dist/core/v4/verifier.js +448 -0
- package/dist/core/version.js +1 -1
- package/dist/tools/v4/browser/_observer.js +224 -0
- package/dist/tools/v4/browser/browserBlocker.js +396 -0
- package/dist/tools/v4/browser/browserClick.js +18 -1
- package/dist/tools/v4/browser/browserClose.js +18 -1
- package/dist/tools/v4/browser/browserExtract.js +5 -1
- package/dist/tools/v4/browser/browserFill.js +17 -1
- package/dist/tools/v4/browser/browserGetUrl.js +5 -1
- package/dist/tools/v4/browser/browserNavigate.js +16 -1
- package/dist/tools/v4/browser/browserScreenshot.js +5 -1
- package/dist/tools/v4/browser/browserScroll.js +18 -1
- package/dist/tools/v4/browser/browserType.js +17 -1
- package/dist/tools/v4/browser/captchaCheck.js +5 -1
- package/dist/tools/v4/executeCode.js +1 -0
- package/dist/tools/v4/files/fileCopy.js +56 -2
- package/dist/tools/v4/files/fileDelete.js +38 -1
- package/dist/tools/v4/files/fileList.js +12 -1
- package/dist/tools/v4/files/fileMove.js +59 -2
- package/dist/tools/v4/files/filePatch.js +43 -1
- package/dist/tools/v4/files/fileRead.js +12 -1
- package/dist/tools/v4/files/fileWrite.js +41 -1
- package/dist/tools/v4/index.js +71 -58
- package/dist/tools/v4/memory/memoryAdd.js +14 -0
- package/dist/tools/v4/memory/memoryRemove.js +14 -0
- package/dist/tools/v4/memory/memoryReplace.js +15 -0
- package/dist/tools/v4/memory/sessionSummary.js +12 -0
- package/dist/tools/v4/process/processKill.js +19 -0
- package/dist/tools/v4/process/processList.js +1 -0
- package/dist/tools/v4/process/processLogRead.js +1 -0
- package/dist/tools/v4/process/processSpawn.js +13 -0
- package/dist/tools/v4/process/processWait.js +1 -0
- package/dist/tools/v4/sessions/recallSession.js +1 -0
- package/dist/tools/v4/sessions/sessionList.js +1 -0
- package/dist/tools/v4/sessions/sessionSearch.js +1 -0
- package/dist/tools/v4/skills/lookupToolSchema.js +2 -0
- package/dist/tools/v4/skills/skillManage.js +13 -0
- package/dist/tools/v4/skills/skillView.js +1 -0
- package/dist/tools/v4/skills/skillsList.js +1 -0
- package/dist/tools/v4/subagent/subagentFanout.js +1 -0
- package/dist/tools/v4/system/aidenSelfUpdate.js +16 -0
- package/dist/tools/v4/system/appClose.js +13 -0
- package/dist/tools/v4/system/appInput.js +13 -0
- package/dist/tools/v4/system/appLaunch.js +13 -0
- package/dist/tools/v4/system/clipboardRead.js +1 -0
- package/dist/tools/v4/system/clipboardWrite.js +14 -0
- package/dist/tools/v4/system/mediaKey.js +12 -0
- package/dist/tools/v4/system/mediaSessions.js +1 -0
- package/dist/tools/v4/system/mediaTransport.js +13 -0
- package/dist/tools/v4/system/naturalEvents.js +1 -0
- package/dist/tools/v4/system/nowPlaying.js +1 -0
- package/dist/tools/v4/system/osProcessList.js +1 -0
- package/dist/tools/v4/system/screenshot.js +1 -0
- package/dist/tools/v4/system/systemInfo.js +1 -0
- package/dist/tools/v4/system/volumeSet.js +17 -0
- package/dist/tools/v4/terminal/shellExec.js +81 -9
- package/dist/tools/v4/web/deepResearch.js +1 -0
- package/dist/tools/v4/web/openUrl.js +1 -0
- package/dist/tools/v4/web/webFetch.js +1 -0
- package/dist/tools/v4/web/webPage.js +1 -0
- package/dist/tools/v4/web/webSearch.js +1 -0
- package/dist/tools/v4/web/youtubeSearch.js +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 Shiva Deore (Taracod).
|
|
4
|
+
* Licensed under AGPL-3.0. See LICENSE for details.
|
|
5
|
+
*
|
|
6
|
+
* Aiden — local-first agent.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* core/v4/dryRun.ts — v4.4 Phase 4: dry-run preview infrastructure.
|
|
10
|
+
*
|
|
11
|
+
* AIDEN_DRYRUN=1 makes every `mutates: true` tool emit a preview of
|
|
12
|
+
* what it would do instead of doing it. Read-only tools are
|
|
13
|
+
* unaffected — the HOC passes them through unchanged.
|
|
14
|
+
*
|
|
15
|
+
* Two consumers wire into this module:
|
|
16
|
+
* 1. tools/v4/index.ts — wraps every registered handler in
|
|
17
|
+
* withDryRun(...) so AIDEN_DRYRUN=1 short-circuits `execute`
|
|
18
|
+
* to a preview before any side-effect runs.
|
|
19
|
+
* 2. core/v4/toolRegistry.ts (executeOne) — for dangerous-tier
|
|
20
|
+
* tools, calls handler.buildPreview before forwarding to
|
|
21
|
+
* ApprovalEngine so the approval prompt can show the user
|
|
22
|
+
* exactly what they're being asked to allow.
|
|
23
|
+
*
|
|
24
|
+
* Design choices (v4.4 Phase 4 audit):
|
|
25
|
+
* - HOC pattern (Q-P4-1 (a)) — uniform envelope across 27 tools.
|
|
26
|
+
* - buildPreview is an OPTIONAL method on ToolHandler
|
|
27
|
+
* (Q-P4-2 (a)) — tools without one are passed through with a
|
|
28
|
+
* generic "would execute" envelope.
|
|
29
|
+
* - Browser/unpredictable tools surface intent only
|
|
30
|
+
* (Q-P4-3 (a)).
|
|
31
|
+
* - aiden_self_update returns a `refuse` side-effect
|
|
32
|
+
* (Q-P4-4 (a)).
|
|
33
|
+
* - Dangerous-tier auto-preview reaches the user via approval
|
|
34
|
+
* prompt only, never as a duplicate field on a successful
|
|
35
|
+
* execution result (Q-P4-5 (a)).
|
|
36
|
+
*
|
|
37
|
+
* Gated by `SandboxConfig.dryRun` (AIDEN_DRYRUN=1 strict). Phase 6
|
|
38
|
+
* does NOT flip this default — dry-run stays opt-in by design.
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.withDryRun = withDryRun;
|
|
42
|
+
exports.genericPreview = genericPreview;
|
|
43
|
+
exports.truncatePreview = truncatePreview;
|
|
44
|
+
exports.makeWouldExecute = makeWouldExecute;
|
|
45
|
+
const sandboxConfig_1 = require("./sandboxConfig");
|
|
46
|
+
// ── HOC ─────────────────────────────────────────────────────────────────────
|
|
47
|
+
/**
|
|
48
|
+
* Wrap a tool handler so its `execute` short-circuits to a preview
|
|
49
|
+
* when AIDEN_DRYRUN=1. Read-only tools (`mutates: false`) are
|
|
50
|
+
* returned unchanged — dry-run is meaningless for them.
|
|
51
|
+
*
|
|
52
|
+
* Tools without a `buildPreview` method get a generic preview that
|
|
53
|
+
* just echoes their args. We never block on missing previews; the
|
|
54
|
+
* coverage sentinel test catches the omission at gate time.
|
|
55
|
+
*/
|
|
56
|
+
function withDryRun(handler) {
|
|
57
|
+
if (!handler.mutates)
|
|
58
|
+
return handler;
|
|
59
|
+
const innerExecute = handler.execute.bind(handler);
|
|
60
|
+
const wrappedExecute = async (args, ctx) => {
|
|
61
|
+
const config = (0, sandboxConfig_1.getSandboxConfig)();
|
|
62
|
+
if (!config.dryRun) {
|
|
63
|
+
return innerExecute(args, ctx);
|
|
64
|
+
}
|
|
65
|
+
const would = handler.buildPreview
|
|
66
|
+
? await handler.buildPreview(args, ctx)
|
|
67
|
+
: genericPreview(handler, args);
|
|
68
|
+
const out = {
|
|
69
|
+
success: true,
|
|
70
|
+
dryRun: true,
|
|
71
|
+
wouldExecute: would,
|
|
72
|
+
};
|
|
73
|
+
return out;
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
...handler,
|
|
77
|
+
execute: wrappedExecute,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Fallback preview for a tool that doesn't define `buildPreview`.
|
|
82
|
+
* Surfaces the call shape so the user at least sees what would
|
|
83
|
+
* have run. The coverage sentinel ensures we don't ship any
|
|
84
|
+
* mutating tool without a real preview, but the safety net keeps
|
|
85
|
+
* runtime well-behaved even if a plugin tool slips through.
|
|
86
|
+
*/
|
|
87
|
+
function genericPreview(handler, args) {
|
|
88
|
+
return {
|
|
89
|
+
tool: handler.schema.name,
|
|
90
|
+
args,
|
|
91
|
+
riskTier: handler.riskTier ?? (handler.mutates ? 'caution' : 'safe'),
|
|
92
|
+
sideEffects: [],
|
|
93
|
+
detectedRisks: [],
|
|
94
|
+
summary: `${handler.schema.name} would execute (no detailed preview registered)`,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// ── Helpers for tool authors ────────────────────────────────────────────────
|
|
98
|
+
/** Truncate a string for inline preview display. */
|
|
99
|
+
function truncatePreview(s, max = 200) {
|
|
100
|
+
if (s.length <= max)
|
|
101
|
+
return s;
|
|
102
|
+
return s.slice(0, max) + `… (${s.length - max} more chars)`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Compose a `WouldExecute` for a tool that wants the boilerplate
|
|
106
|
+
* filled in. Tool's buildPreview can call this and add side-effects.
|
|
107
|
+
*/
|
|
108
|
+
function makeWouldExecute(opts) {
|
|
109
|
+
return {
|
|
110
|
+
tool: opts.handler.schema.name,
|
|
111
|
+
args: opts.args,
|
|
112
|
+
riskTier: opts.handler.riskTier ?? (opts.handler.mutates ? 'caution' : 'safe'),
|
|
113
|
+
sideEffects: opts.sideEffects,
|
|
114
|
+
detectedRisks: opts.detectedRisks ?? [],
|
|
115
|
+
summary: opts.summary,
|
|
116
|
+
};
|
|
117
|
+
}
|