@dench.com/cli 2.2.2 → 2.2.3
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/ads.ts +2207 -0
- package/dench.ts +49 -0
- package/package.json +2 -1
package/dench.ts
CHANGED
|
@@ -511,6 +511,17 @@ Cloud browser (Browserbase, runs entirely in Dench Cloud):
|
|
|
511
511
|
dench browser stop
|
|
512
512
|
Help: dench browser help
|
|
513
513
|
|
|
514
|
+
Monetize the AI "thinking…" line (supported hooks only — no file patching):
|
|
515
|
+
dench ads Print the sponsored ad in a rainbow box
|
|
516
|
+
dench ads install [--target claude|shell|agentmd|all] [--apply]
|
|
517
|
+
dench ads refresh (rotate the cached ad; flush impressions)
|
|
518
|
+
dench ads earnings Show real USD ad earnings
|
|
519
|
+
dench ads payout setup Connect Stripe for real USD cash payouts
|
|
520
|
+
dench ads withdraw --amount all
|
|
521
|
+
dench ads status [--json]
|
|
522
|
+
dench ads uninstall [--target claude|shell|agentmd|all]
|
|
523
|
+
Aliases: dench ad, dench adline. Help: dench ads help
|
|
524
|
+
|
|
514
525
|
Managed email campaigns (Dench Emailing Service):
|
|
515
526
|
dench email identity verify --from founder@example.com [--json]
|
|
516
527
|
dench email template create --name "Intro" --subject "Hi {{firstName}}" --html-file body.html [--json]
|
|
@@ -4052,6 +4063,44 @@ async function main() {
|
|
|
4052
4063
|
return;
|
|
4053
4064
|
}
|
|
4054
4065
|
|
|
4066
|
+
// `dench ads` is canonical; `dench ad` and `dench adline` are aliases for
|
|
4067
|
+
// the same command (one code path in ./ads).
|
|
4068
|
+
if (command === "ads" || command === "ad" || command === "adline") {
|
|
4069
|
+
const subArgs = args.slice(args.indexOf(command) + 1);
|
|
4070
|
+
const { runAdsCommand } = await import("./ads");
|
|
4071
|
+
// Earning is opt-in: resolve the agent session token best-effort so a
|
|
4072
|
+
// signed-in developer gets credited on flush, but never require login —
|
|
4073
|
+
// the ad must still render for everyone. getRuntime throws when there's
|
|
4074
|
+
// no session; swallow that and run anonymously.
|
|
4075
|
+
//
|
|
4076
|
+
// We deliberately attribute earnings ONLY for an interactive, stored
|
|
4077
|
+
// `session` token, NOT for `apiKey` mode or the sandbox agent-session
|
|
4078
|
+
// fallback. Those mean a sandbox / unattended automation context (cron,
|
|
4079
|
+
// CI, the chat-turn harness) — there's no human looking at the terminal,
|
|
4080
|
+
// so counting those impressions would be the exact spam vector we're
|
|
4081
|
+
// trying to close. Headless runs show the ad but earn nothing by design.
|
|
4082
|
+
let authToken: string | undefined;
|
|
4083
|
+
let convexUrl: string | undefined;
|
|
4084
|
+
let host: string | undefined;
|
|
4085
|
+
try {
|
|
4086
|
+
const runtime = await getRuntime();
|
|
4087
|
+
if (runtime.mode === "session") {
|
|
4088
|
+
const sandboxAgentToken = process.env.DENCH_AGENT_SESSION_TOKEN?.trim();
|
|
4089
|
+
const isSandboxAgentSession =
|
|
4090
|
+
sandboxAgentToken && runtime.sessionToken === sandboxAgentToken;
|
|
4091
|
+
if (!isSandboxAgentSession) {
|
|
4092
|
+
authToken = runtime.sessionToken;
|
|
4093
|
+
convexUrl = runtime.convexUrl;
|
|
4094
|
+
host = runtime.host;
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
} catch {
|
|
4098
|
+
// not signed in — show the ad without attributing earnings
|
|
4099
|
+
}
|
|
4100
|
+
await runAdsCommand({ args: subArgs, authToken, convexUrl, host });
|
|
4101
|
+
return;
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4055
4104
|
if (command === "chat") {
|
|
4056
4105
|
const subArgs = args.slice(args.indexOf("chat") + 1);
|
|
4057
4106
|
const sub = subArgs[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dench.com/cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Dench agent workspace CLI. v2 unifies auth behind `dench signin`; the legacy `dench login` / `dench onboard` / `dench setup` / `dench what-can-i-do` / `dench register` commands now error with a redirect.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"members.ts",
|
|
29
29
|
"cron.ts",
|
|
30
30
|
"browser.ts",
|
|
31
|
+
"ads.ts",
|
|
31
32
|
"search.ts",
|
|
32
33
|
"image.ts",
|
|
33
34
|
"tools.ts",
|