@letterstory/cli 0.177.151 → 0.177.153
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/lib/cli.mjs +9 -5
- package/lib/commands/shared.mjs +2 -0
- package/lib/commands/targets.mjs +2 -1
- package/lib/commands/visits.mjs +27 -41
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
import { fetchParkedSections, withoutParked } from "./parked.mjs";
|
|
94
94
|
|
|
95
95
|
// Matches cli/package.json; publish-cli.yml rewrites both to the published version.
|
|
96
|
-
export const VERSION = "0.177.
|
|
96
|
+
export const VERSION = "0.177.153";
|
|
97
97
|
|
|
98
98
|
/** The exit code for a gate refusal (CARD_REQUIRED, PAYMENT_FAILED, OUT_OF_TOKENS): 1 is a plain error. */
|
|
99
99
|
export const EXIT_PAYMENT_REQUIRED = 3;
|
|
@@ -102,6 +102,7 @@ export const EXIT_PAYMENT_REQUIRED = 3;
|
|
|
102
102
|
// can't accidentally swallow the id as --json's value. Every `type: "bool"` flag (and its
|
|
103
103
|
// `negate` spelling) in a command's ARGS map must be listed; boolean-flags.test.ts enforces it.
|
|
104
104
|
export const BOOLEAN_FLAGS = new Set([
|
|
105
|
+
"include-tests",
|
|
105
106
|
"as-test",
|
|
106
107
|
"discover",
|
|
107
108
|
// visits transact add folder|page|connection: leave it out of the set (a connection: switch it off).
|
|
@@ -170,6 +171,8 @@ export const BOOLEAN_FLAGS = new Set([
|
|
|
170
171
|
// replicate forms: read the site's forms key (admins) instead of its submissions.
|
|
171
172
|
"show-key",
|
|
172
173
|
"searched",
|
|
174
|
+
// targets suggest: buyer questions to track instead of phrases.
|
|
175
|
+
"prompts",
|
|
173
176
|
// sim create / resample / sample-key: keep the customer's sample key, or delete it now.
|
|
174
177
|
"keep-key",
|
|
175
178
|
"delete-key",
|
|
@@ -2131,14 +2134,15 @@ Visits (Visitors: AI agents reading your site, and AI answers sending people to
|
|
|
2131
2134
|
visits health --site <id> Staff: how far to trust a site's numbers, each check and its fix
|
|
2132
2135
|
visits connect vercel|cloudflare [--site <id>] Send the host's request logs (no code to deploy)
|
|
2133
2136
|
visits connectors | disconnect <id> The site's host connectors
|
|
2134
|
-
visits transact [on|off] [--site <id>|--host <h>] Transact:
|
|
2135
|
-
visits transact add folder <path>
|
|
2136
|
-
visits transact add
|
|
2137
|
-
|
|
2137
|
+
visits transact [on|off] [--site <id>|--host <h>] Transact: cited public corpus answers with website fallback
|
|
2138
|
+
visits transact add folder <path> | page <url> | site <url>
|
|
2139
|
+
visits transact add text --title "Question?" --text "Public answer" [--ask <id>]
|
|
2140
|
+
Publish a reviewed public answer
|
|
2138
2141
|
visits transact pr [--repo owner/name] [--base <branch>] [--site <id>|--host <h>]
|
|
2139
2142
|
One pull request: the line for agents, and answers to what they asked
|
|
2140
2143
|
visits transact source <source-id>|--folder <path> | remove <id> | tests | test "<question>" [--discover]
|
|
2141
2144
|
visits transact mark-ask <ask-id> --as-test|--as-test=false [--site <id>]
|
|
2145
|
+
visits requests [--site <id>] [--limit 50] [--before <cursor>] [--include-tests]
|
|
2142
2146
|
visits transact asks [--since 7d] [--limit <n>] What agents asked, answered, and asks per agent visit
|
|
2143
2147
|
|
|
2144
2148
|
Sim (Simulations: a free, simulated copy of your API for agents, and what they did with it):
|
package/lib/commands/shared.mjs
CHANGED
|
@@ -238,6 +238,8 @@ function readArgSource(key, source, flags, positionals, extra) {
|
|
|
238
238
|
if (v === undefined && source.required) {
|
|
239
239
|
throw new CliError(`Missing required <${source.label ?? key}>`);
|
|
240
240
|
}
|
|
241
|
+
if (v !== undefined && source.enum && !source.enum.includes(v))
|
|
242
|
+
throw new CliError(`${source.label ?? key} must be one of: ${source.enum.join(", ")}`);
|
|
241
243
|
return v;
|
|
242
244
|
}
|
|
243
245
|
const raw = flags[source.flag];
|
package/lib/commands/targets.mjs
CHANGED
|
@@ -102,6 +102,7 @@ export const ARGS = {
|
|
|
102
102
|
suggest_ranking_targets: {
|
|
103
103
|
offering_id: offering,
|
|
104
104
|
searched: { value: (flags) => (flags.searched === undefined ? undefined : flagBool(flags.searched)) },
|
|
105
|
+
prompts: { value: (flags) => (flags.prompts === undefined ? undefined : flagBool(flags.prompts)) },
|
|
105
106
|
},
|
|
106
107
|
list_question_candidates: { limit: { flag: "limit", type: "num" } },
|
|
107
108
|
list_ranking_subqueries: {
|
|
@@ -142,7 +143,7 @@ const USAGE = `Usage: targets <list|add|update|activate|deactivate|cap|suggest|c
|
|
|
142
143
|
targets activate <target-id>
|
|
143
144
|
targets deactivate <target-id>
|
|
144
145
|
targets cap <offering-id|company> <n|default>
|
|
145
|
-
targets suggest [--offering <offering-id|company>] [--searched]
|
|
146
|
+
targets suggest [--offering <offering-id|company>] [--searched] [--prompts]
|
|
146
147
|
targets candidates [--limit <n>] new questions the market asks, checked and deduped
|
|
147
148
|
targets subqueries [<target-id>] [--retired] the phrasings asked under each target
|
|
148
149
|
targets subquery add <target-id> <phrasing>
|
package/lib/commands/visits.mjs
CHANGED
|
@@ -22,17 +22,14 @@
|
|
|
22
22
|
// letterstory visits connectors | disconnect <id>
|
|
23
23
|
// letterstory visits shortcut [mod+e | default] your own key for Letter Edit's card (⌘L by default)
|
|
24
24
|
// letterstory visits transact [on|off] [--host acme.com] Transact: agents' questions answered from your sources, cited
|
|
25
|
-
// letterstory visits transact add folder /
|
|
26
|
-
// letterstory visits transact add
|
|
27
|
-
// letterstory visits transact add connection code|events|database [--uncheck] look into it when the pages don't answer
|
|
25
|
+
// letterstory visits transact add folder /answers | page <url> | site https://docs.acme.com/answers
|
|
26
|
+
// letterstory visits transact add text --title "Question?" --text "Reviewed public answer" [--ask <id>]
|
|
28
27
|
// letterstory visits transact pr [--repo owner/name] [--base branch] the line and the missed answers, as one pull request
|
|
29
28
|
// letterstory visits transact source <source-id> | --folder /docs
|
|
30
29
|
// letterstory visits transact remove <source-id>
|
|
31
30
|
// letterstory visits transact test "What does it cost?"
|
|
32
31
|
// letterstory visits transact asks [--since 7d] [--limit 50]
|
|
33
32
|
|
|
34
|
-
import { readFileSync } from "node:fs";
|
|
35
|
-
import { basename } from "node:path";
|
|
36
33
|
import { CliError } from "../client.mjs";
|
|
37
34
|
import { flagStr, printResult, argsFromFlags } from "./shared.mjs";
|
|
38
35
|
|
|
@@ -117,38 +114,32 @@ export const ARGS = {
|
|
|
117
114
|
site_id: "site",
|
|
118
115
|
kind: {
|
|
119
116
|
positional: 0,
|
|
120
|
-
label: "kind (folder | page | site |
|
|
117
|
+
label: "kind (folder | page | site | text)",
|
|
121
118
|
required: true,
|
|
122
|
-
enum: ["folder", "page", "site", "
|
|
123
|
-
},
|
|
124
|
-
connection: {
|
|
125
|
-
value: (flags, positionals) => (positionals[0] === "connection" ? positionals[1] : undefined),
|
|
119
|
+
enum: ["folder", "page", "site", "text"],
|
|
126
120
|
},
|
|
121
|
+
ask_id: "ask",
|
|
127
122
|
path: {
|
|
128
123
|
value: (flags, positionals) =>
|
|
129
|
-
|
|
124
|
+
["folder", "page"].includes(positionals[0]) && !/^https?:/i.test(positionals[1] ?? "")
|
|
130
125
|
? positionals[1]
|
|
131
126
|
: undefined,
|
|
132
127
|
},
|
|
133
128
|
url: {
|
|
134
129
|
value: (flags, positionals) =>
|
|
135
|
-
|
|
130
|
+
["page", "site", "folder"].includes(positionals[0]) && /^https?:/i.test(positionals[1] ?? "")
|
|
131
|
+
? positionals[1]
|
|
132
|
+
: undefined,
|
|
136
133
|
},
|
|
137
134
|
host: {
|
|
138
|
-
value: (flags, positionals) =>
|
|
135
|
+
value: (flags, positionals) =>
|
|
136
|
+
positionals[0] === "site" && !/^https?:/i.test(positionals[1] ?? "")
|
|
137
|
+
? positionals[1]
|
|
138
|
+
: flagStr(flags.host),
|
|
139
139
|
},
|
|
140
140
|
checked: { flag: "uncheck", type: "bool", invert: true },
|
|
141
141
|
title: "title",
|
|
142
142
|
text: "text",
|
|
143
|
-
file_name: {
|
|
144
|
-
value: (flags, positionals) => (positionals[0] === "file" ? basename(positionals[1] ?? "") : undefined),
|
|
145
|
-
},
|
|
146
|
-
content_base64: {
|
|
147
|
-
value: (flags, positionals) =>
|
|
148
|
-
positionals[0] === "file" && positionals[1]
|
|
149
|
-
? readFileSync(positionals[1]).toString("base64")
|
|
150
|
-
: undefined,
|
|
151
|
-
},
|
|
152
143
|
},
|
|
153
144
|
visitors_get_transact_source: {
|
|
154
145
|
site_id: "site",
|
|
@@ -161,6 +152,12 @@ export const ARGS = {
|
|
|
161
152
|
ask_id: { positional: 0, label: "ask id", required: true },
|
|
162
153
|
is_test: { flag: "as-test", type: "bool" },
|
|
163
154
|
},
|
|
155
|
+
visitors_list_agent_requests: {
|
|
156
|
+
site_id: "site",
|
|
157
|
+
limit: { flag: "limit", type: "num" },
|
|
158
|
+
before: "before",
|
|
159
|
+
include_tests: { flag: "include-tests", type: "bool" },
|
|
160
|
+
},
|
|
164
161
|
visitors_list_transact_tests: { site_id: "site" },
|
|
165
162
|
visitors_test_transact: {
|
|
166
163
|
discovery: { flag: "discover", type: "bool" },
|
|
@@ -208,6 +205,9 @@ export async function cmdVisits(ctx) {
|
|
|
208
205
|
case "list":
|
|
209
206
|
case "ls":
|
|
210
207
|
return visitsList(sub === undefined ? ctx : rest);
|
|
208
|
+
case "requests":
|
|
209
|
+
printResult(ctx.io, ctx.flags, await call(rest, "visitors_list_agent_requests"));
|
|
210
|
+
return 0;
|
|
211
211
|
case "citations":
|
|
212
212
|
return visitsCitations(rest);
|
|
213
213
|
case "people":
|
|
@@ -242,7 +242,7 @@ export async function cmdVisits(ctx) {
|
|
|
242
242
|
return visitsTransact(rest);
|
|
243
243
|
default:
|
|
244
244
|
throw new CliError(
|
|
245
|
-
"Usage: visits [list|citations|people|who|compare|export|sites|domain|pages|health|connect|connectors|disconnect|shortcut|transact]"
|
|
245
|
+
"Usage: visits [list|requests|citations|people|who|compare|export|sites|domain|pages|health|connect|connectors|disconnect|shortcut|transact]"
|
|
246
246
|
);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
@@ -335,24 +335,10 @@ function transactLines(t) {
|
|
|
335
335
|
const state = { off: "off", unproven: "on, served once the site is proven", on: "on" }[t.state] ?? t.state;
|
|
336
336
|
const lines = [`Transact: ${state}`];
|
|
337
337
|
if (t.url) lines.push(` ${t.url}`, ` MCP ${t.mcp_url}`);
|
|
338
|
-
lines.push("",
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
` [${f.checked ? "x" : " "}] ${f.path === "/" ? "/ (home)" : f.path} ${f.pages} ${f.pages === 1 ? "page" : "pages"} cited ${f.times_cited}${f.failed ? ` ${f.failed} failed` : ""}${f.by_default ? "" : " (yours)"}${f.id ? ` ${f.id}` : ""}`
|
|
343
|
-
);
|
|
344
|
-
if (t.sources.length) lines.push("", "Added:");
|
|
345
|
-
for (const s of t.sources) {
|
|
346
|
-
const what = s.snapshot ? `snapshot, ${s.chars} characters` : `${s.pages} ${s.pages === 1 ? "page" : "pages"}`;
|
|
347
|
-
lines.push(` ${s.id} ${s.kind} ${s.title} ${what} cited ${s.times_cited}`);
|
|
348
|
-
}
|
|
349
|
-
if (t.connections?.length) lines.push("", "Connections (looked into when the pages don't answer):");
|
|
350
|
-
for (const c of t.connections ?? [])
|
|
351
|
-
lines.push(
|
|
352
|
-
c.connected
|
|
353
|
-
? ` [${c.checked ? "x" : " "}] ${c.connection} ${c.title} cited ${c.times_cited}${c.source_id ? ` ${c.source_id}` : ""}`
|
|
354
|
-
: ` [-] ${c.connection} ${c.title} not connected`
|
|
355
|
-
);
|
|
338
|
+
lines.push("", `Public website fallback: ${t.website?.read ?? t.read} pages read`, "", "Answer corpus:");
|
|
339
|
+
for (const c of t.corpus ?? [])
|
|
340
|
+
lines.push(` ${c.id} ${c.url ?? c.title} ${c.entries} entries ${c.vector_ready} indexed`);
|
|
341
|
+
if (!t.corpus?.length) lines.push(" No public corpus indexed");
|
|
356
342
|
return lines;
|
|
357
343
|
}
|
|
358
344
|
|