@wayai/cli 0.3.40 → 0.3.42
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/dist/index.js +16920 -310
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
- package/dist/commands/admin.d.ts +0 -1
- package/dist/commands/admin.js +0 -913
- package/dist/commands/admin.js.map +0 -1
- package/dist/commands/analytics.d.ts +0 -34
- package/dist/commands/analytics.js +0 -605
- package/dist/commands/analytics.js.map +0 -1
- package/dist/commands/conversations.d.ts +0 -14
- package/dist/commands/conversations.js +0 -292
- package/dist/commands/conversations.js.map +0 -1
- package/dist/commands/create-credential.d.ts +0 -20
- package/dist/commands/create-credential.js +0 -146
- package/dist/commands/create-credential.js.map +0 -1
- package/dist/commands/delete-history.d.ts +0 -15
- package/dist/commands/delete-history.js +0 -56
- package/dist/commands/delete-history.js.map +0 -1
- package/dist/commands/eval-capture.d.ts +0 -1
- package/dist/commands/eval-capture.js +0 -135
- package/dist/commands/eval-capture.js.map +0 -1
- package/dist/commands/eval-results.d.ts +0 -10
- package/dist/commands/eval-results.js +0 -168
- package/dist/commands/eval-results.js.map +0 -1
- package/dist/commands/eval.d.ts +0 -1
- package/dist/commands/eval.js +0 -49
- package/dist/commands/eval.js.map +0 -1
- package/dist/commands/evals.d.ts +0 -21
- package/dist/commands/evals.js +0 -120
- package/dist/commands/evals.js.map +0 -1
- package/dist/commands/init.d.ts +0 -16
- package/dist/commands/init.js +0 -191
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts +0 -13
- package/dist/commands/list.js +0 -70
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/login.d.ts +0 -8
- package/dist/commands/login.js +0 -145
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -19
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/migrate.d.ts +0 -12
- package/dist/commands/migrate.js +0 -106
- package/dist/commands/migrate.js.map +0 -1
- package/dist/commands/observability.d.ts +0 -14
- package/dist/commands/observability.js +0 -124
- package/dist/commands/observability.js.map +0 -1
- package/dist/commands/org.d.ts +0 -19
- package/dist/commands/org.js +0 -186
- package/dist/commands/org.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -31
- package/dist/commands/pull.js +0 -210
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -25
- package/dist/commands/push.js +0 -472
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/report-create.d.ts +0 -18
- package/dist/commands/report-create.js +0 -143
- package/dist/commands/report-create.js.map +0 -1
- package/dist/commands/report.d.ts +0 -16
- package/dist/commands/report.js +0 -252
- package/dist/commands/report.js.map +0 -1
- package/dist/commands/run-eval.d.ts +0 -15
- package/dist/commands/run-eval.js +0 -187
- package/dist/commands/run-eval.js.map +0 -1
- package/dist/commands/send-message.d.ts +0 -11
- package/dist/commands/send-message.js +0 -63
- package/dist/commands/send-message.js.map +0 -1
- package/dist/commands/status.d.ts +0 -17
- package/dist/commands/status.js +0 -205
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/sync-mcp.d.ts +0 -16
- package/dist/commands/sync-mcp.js +0 -51
- package/dist/commands/sync-mcp.js.map +0 -1
- package/dist/commands/sync-skills.d.ts +0 -10
- package/dist/commands/sync-skills.js +0 -49
- package/dist/commands/sync-skills.js.map +0 -1
- package/dist/commands/unlock.d.ts +0 -1
- package/dist/commands/unlock.js +0 -13
- package/dist/commands/unlock.js.map +0 -1
- package/dist/commands/update-credential.d.ts +0 -29
- package/dist/commands/update-credential.js +0 -156
- package/dist/commands/update-credential.js.map +0 -1
- package/dist/commands/update.d.ts +0 -6
- package/dist/commands/update.js +0 -36
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/use.d.ts +0 -1
- package/dist/commands/use.js +0 -56
- package/dist/commands/use.js.map +0 -1
- package/dist/commands/whoami.d.ts +0 -11
- package/dist/commands/whoami.js +0 -30
- package/dist/commands/whoami.js.map +0 -1
- package/dist/index.d.ts +0 -28
- package/dist/lib/analytics-constants.d.ts +0 -6
- package/dist/lib/analytics-constants.js +0 -14
- package/dist/lib/analytics-constants.js.map +0 -1
- package/dist/lib/api-client.d.ts +0 -568
- package/dist/lib/api-client.js +0 -445
- package/dist/lib/api-client.js.map +0 -1
- package/dist/lib/auth.d.ts +0 -50
- package/dist/lib/auth.js +0 -230
- package/dist/lib/auth.js.map +0 -1
- package/dist/lib/config.d.ts +0 -34
- package/dist/lib/config.js +0 -69
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/credential-utils.d.ts +0 -36
- package/dist/lib/credential-utils.js +0 -88
- package/dist/lib/credential-utils.js.map +0 -1
- package/dist/lib/diff-display.d.ts +0 -8
- package/dist/lib/diff-display.js +0 -37
- package/dist/lib/diff-display.js.map +0 -1
- package/dist/lib/eval-format.d.ts +0 -29
- package/dist/lib/eval-format.js +0 -44
- package/dist/lib/eval-format.js.map +0 -1
- package/dist/lib/hub-lock.d.ts +0 -7
- package/dist/lib/hub-lock.js +0 -116
- package/dist/lib/hub-lock.js.map +0 -1
- package/dist/lib/layout.d.ts +0 -79
- package/dist/lib/layout.js +0 -133
- package/dist/lib/layout.js.map +0 -1
- package/dist/lib/org-workspace.d.ts +0 -22
- package/dist/lib/org-workspace.js +0 -106
- package/dist/lib/org-workspace.js.map +0 -1
- package/dist/lib/parser.d.ts +0 -16
- package/dist/lib/parser.js +0 -306
- package/dist/lib/parser.js.map +0 -1
- package/dist/lib/repo-config.d.ts +0 -23
- package/dist/lib/repo-config.js +0 -91
- package/dist/lib/repo-config.js.map +0 -1
- package/dist/lib/report-edit-args.d.ts +0 -27
- package/dist/lib/report-edit-args.js +0 -56
- package/dist/lib/report-edit-args.js.map +0 -1
- package/dist/lib/report-inbox.d.ts +0 -19
- package/dist/lib/report-inbox.js +0 -73
- package/dist/lib/report-inbox.js.map +0 -1
- package/dist/lib/resource-files.d.ts +0 -29
- package/dist/lib/resource-files.js +0 -156
- package/dist/lib/resource-files.js.map +0 -1
- package/dist/lib/sentry.d.ts +0 -38
- package/dist/lib/sentry.js +0 -168
- package/dist/lib/sentry.js.map +0 -1
- package/dist/lib/skill-version.d.ts +0 -9
- package/dist/lib/skill-version.js +0 -53
- package/dist/lib/skill-version.js.map +0 -1
- package/dist/lib/sql-output.d.ts +0 -17
- package/dist/lib/sql-output.js +0 -48
- package/dist/lib/sql-output.js.map +0 -1
- package/dist/lib/token-store.d.ts +0 -37
- package/dist/lib/token-store.js +0 -354
- package/dist/lib/token-store.js.map +0 -1
- package/dist/lib/types.d.ts +0 -18
- package/dist/lib/types.js +0 -5
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -97
- package/dist/lib/utils.js +0 -288
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/version-cache.d.ts +0 -10
- package/dist/lib/version-cache.js +0 -34
- package/dist/lib/version-cache.js.map +0 -1
- package/dist/lib/workspace.d.ts +0 -112
- package/dist/lib/workspace.js +0 -387
- package/dist/lib/workspace.js.map +0 -1
- package/dist/lib/yaml-writer.d.ts +0 -18
- package/dist/lib/yaml-writer.js +0 -283
- package/dist/lib/yaml-writer.js.map +0 -1
package/dist/lib/parser.js
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse hub.yaml + agents/<slug>.yaml + agents/*.md into HubAsCodePayload.
|
|
3
|
-
* Falls back to wayai.yaml for backward compatibility.
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from 'node:fs';
|
|
6
|
-
import * as path from 'node:path';
|
|
7
|
-
import * as yaml from 'js-yaml';
|
|
8
|
-
import { slugify, resolveHubYamlPath } from './utils.js';
|
|
9
|
-
import { scanResourceFiles } from './resource-files.js';
|
|
10
|
-
/** Tag an Error as user-facing so the CLI prints just the message (no stack). */
|
|
11
|
-
function expected(message) {
|
|
12
|
-
const err = new Error(message);
|
|
13
|
-
err.isExpected = true;
|
|
14
|
-
return err;
|
|
15
|
-
}
|
|
16
|
-
export function parseHubFolder(hubFolder, opts) {
|
|
17
|
-
const yamlPath = resolveHubYamlPath(hubFolder);
|
|
18
|
-
if (!yamlPath) {
|
|
19
|
-
const err = new Error(`hub.yaml not found in ${hubFolder}`);
|
|
20
|
-
err.isExpected = true;
|
|
21
|
-
throw err;
|
|
22
|
-
}
|
|
23
|
-
const yamlContent = fs.readFileSync(yamlPath, 'utf-8');
|
|
24
|
-
let config;
|
|
25
|
-
try {
|
|
26
|
-
config = yaml.load(yamlContent);
|
|
27
|
-
}
|
|
28
|
-
catch (err) {
|
|
29
|
-
if (err instanceof yaml.YAMLException) {
|
|
30
|
-
const userError = new Error(`Invalid YAML in ${yamlPath}: ${err.message}`);
|
|
31
|
-
userError.isExpected = true;
|
|
32
|
-
throw userError;
|
|
33
|
-
}
|
|
34
|
-
throw err;
|
|
35
|
-
}
|
|
36
|
-
if (!config || typeof config !== 'object') {
|
|
37
|
-
const invalidError = new Error(`Invalid YAML in ${yamlPath}`);
|
|
38
|
-
invalidError.isExpected = true;
|
|
39
|
-
throw invalidError;
|
|
40
|
-
}
|
|
41
|
-
if (!opts?.allowNewHub) {
|
|
42
|
-
if (!config.hub_id) {
|
|
43
|
-
const err = new Error(`Missing hub_id in ${yamlPath}`);
|
|
44
|
-
err.isExpected = true;
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
if (!config.hub_environment) {
|
|
48
|
-
const err = new Error(`Missing hub_environment in ${yamlPath}`);
|
|
49
|
-
err.isExpected = true;
|
|
50
|
-
throw err;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// Resolve agents: try per-agent YAML files first, fall back to inline agents
|
|
54
|
-
const agentYamlFiles = scanAgentYamlFiles(hubFolder);
|
|
55
|
-
const rawAgents = agentYamlFiles.length > 0 ? agentYamlFiles : config.agents;
|
|
56
|
-
// Resolve agent instructions from .md files
|
|
57
|
-
const agents = rawAgents?.map((agent) => {
|
|
58
|
-
const resolved = { ...agent };
|
|
59
|
-
if (typeof resolved.instructions === 'string' && resolved.instructions.endsWith('.md')) {
|
|
60
|
-
// Explicit path: "agents/pilot.md" or "pilot.md" (legacy)
|
|
61
|
-
const instrValue = resolved.instructions;
|
|
62
|
-
const instructionsPath = instrValue.startsWith('agents/')
|
|
63
|
-
? path.join(hubFolder, instrValue)
|
|
64
|
-
: path.join(hubFolder, 'agents', instrValue);
|
|
65
|
-
if (fs.existsSync(instructionsPath)) {
|
|
66
|
-
resolved.instructions = fs.readFileSync(instructionsPath, 'utf-8');
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const err = new Error(`Agent instructions file not found: ${instructionsPath} (referenced by agent "${agent.name}")`);
|
|
70
|
-
err.isExpected = true;
|
|
71
|
-
throw err;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else if (resolved.instructions === undefined && typeof agent.name === 'string') {
|
|
75
|
-
// Convention-based: derive path from agent name slug
|
|
76
|
-
const conventionPath = path.join(hubFolder, 'agents', `${slugify(agent.name)}.md`);
|
|
77
|
-
if (fs.existsSync(conventionPath)) {
|
|
78
|
-
resolved.instructions = fs.readFileSync(conventionPath, 'utf-8');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return resolved;
|
|
82
|
-
});
|
|
83
|
-
// Resolve resource files from disk
|
|
84
|
-
const resources = parseResources(hubFolder, (config.resources || []));
|
|
85
|
-
const payload = {
|
|
86
|
-
version: config.version || 1,
|
|
87
|
-
hub_id: config.hub_id || '',
|
|
88
|
-
hub_environment: config.hub_environment || 'preview',
|
|
89
|
-
hub: config.hub,
|
|
90
|
-
};
|
|
91
|
-
// Read-only metadata from preview hubs
|
|
92
|
-
if (config.preview_label) {
|
|
93
|
-
payload.preview_label = config.preview_label;
|
|
94
|
-
}
|
|
95
|
-
if (agents && agents.length > 0) {
|
|
96
|
-
payload.agents = agents;
|
|
97
|
-
}
|
|
98
|
-
if (resources.length > 0) {
|
|
99
|
-
payload.resources = resources;
|
|
100
|
-
}
|
|
101
|
-
if (config.states && config.states.length > 0) {
|
|
102
|
-
payload.states = config.states;
|
|
103
|
-
}
|
|
104
|
-
if (config.teams && config.teams.length > 0) {
|
|
105
|
-
payload.teams = config.teams;
|
|
106
|
-
}
|
|
107
|
-
// Emit `connections` whenever it's an array — INCLUDING an empty `[]` — so a
|
|
108
|
-
// hub.yaml that removes its last connection block (present-but-empty) deletes
|
|
109
|
-
// it on push. Unlike other entities (which `|| []` on the diff side, treating
|
|
110
|
-
// absent == empty), the connection delete guard distinguishes an ABSENT key
|
|
111
|
-
// (no-op) from a present `[]` (delete all unreferenced); the parser must
|
|
112
|
-
// preserve that. A valueless `connections:` (js-yaml null) is intentionally
|
|
113
|
-
// omitted → treated as absent (safe no-op).
|
|
114
|
-
if (Array.isArray(config.connections)) {
|
|
115
|
-
payload.connections = config.connections;
|
|
116
|
-
}
|
|
117
|
-
if (config.outbound_contacts && config.outbound_contacts.length > 0) {
|
|
118
|
-
payload.outbound_contacts = config.outbound_contacts;
|
|
119
|
-
}
|
|
120
|
-
if (config.outbound_lists && config.outbound_lists.length > 0) {
|
|
121
|
-
payload.outbound_lists = config.outbound_lists;
|
|
122
|
-
}
|
|
123
|
-
if (config.outbound_schedules && config.outbound_schedules.length > 0) {
|
|
124
|
-
payload.outbound_schedules = config.outbound_schedules;
|
|
125
|
-
}
|
|
126
|
-
const evals = scanEvalYamlFiles(hubFolder);
|
|
127
|
-
if (evals.length > 0) {
|
|
128
|
-
payload.evals = evals;
|
|
129
|
-
}
|
|
130
|
-
return payload;
|
|
131
|
-
}
|
|
132
|
-
// Scan evals/<slug>.yaml (root, path=null) and evals/<set>/<slug>.yaml (one level deep only — flat-set model).
|
|
133
|
-
function scanEvalYamlFiles(hubFolder) {
|
|
134
|
-
const evalsDir = path.join(hubFolder, 'evals');
|
|
135
|
-
if (!fs.existsSync(evalsDir))
|
|
136
|
-
return [];
|
|
137
|
-
const evals = [];
|
|
138
|
-
const seen = new Set(); // composite key "<name>|<path>" — must be unique
|
|
139
|
-
const topEntries = fs.readdirSync(evalsDir, { withFileTypes: true })
|
|
140
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
141
|
-
for (const entry of topEntries) {
|
|
142
|
-
if (entry.isFile() && entry.name.endsWith('.yaml')) {
|
|
143
|
-
// Root-level scenario (no scenario set)
|
|
144
|
-
collectEval(evals, seen, path.join(evalsDir, entry.name), `evals/${entry.name}`, null);
|
|
145
|
-
}
|
|
146
|
-
else if (entry.isDirectory()) {
|
|
147
|
-
// Scenario-set subfolder (one level deep only)
|
|
148
|
-
const setName = entry.name;
|
|
149
|
-
const setDir = path.join(evalsDir, setName);
|
|
150
|
-
const setEntries = fs.readdirSync(setDir, { withFileTypes: true })
|
|
151
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
152
|
-
for (const sub of setEntries) {
|
|
153
|
-
if (sub.isDirectory()) {
|
|
154
|
-
throw expected(`Nested scenario sets are not supported: ${path.relative(hubFolder, path.join(setDir, sub.name))}. ` +
|
|
155
|
-
`Move scenarios up to evals/${setName}/.`);
|
|
156
|
-
}
|
|
157
|
-
if (sub.isFile() && sub.name.endsWith('.yaml')) {
|
|
158
|
-
collectEval(evals, seen, path.join(setDir, sub.name), `evals/${setName}/${sub.name}`, setName);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return evals;
|
|
164
|
-
}
|
|
165
|
-
function collectEval(evals, seen, filePath, relPath, setName) {
|
|
166
|
-
const evalEntry = parseEvalYaml(filePath, relPath, setName);
|
|
167
|
-
if (!evalEntry)
|
|
168
|
-
return;
|
|
169
|
-
const key = `${evalEntry.name}|${setName ?? ''}`;
|
|
170
|
-
if (seen.has(key)) {
|
|
171
|
-
const where = setName ? `scenario set "${setName}"` : 'root';
|
|
172
|
-
throw expected(`Duplicate eval at ${where}: "${evalEntry.name}" (in ${path.basename(filePath)}). ` +
|
|
173
|
-
`Each (name, scenario set) pair must be unique.`);
|
|
174
|
-
}
|
|
175
|
-
seen.add(key);
|
|
176
|
-
evals.push(evalEntry);
|
|
177
|
-
}
|
|
178
|
-
// Returns null on soft failures (empty/malformed file, warning logged); throws expected() on hard validation.
|
|
179
|
-
function parseEvalYaml(filePath, relPath, setName) {
|
|
180
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
181
|
-
let raw;
|
|
182
|
-
try {
|
|
183
|
-
raw = yaml.load(content);
|
|
184
|
-
}
|
|
185
|
-
catch (err) {
|
|
186
|
-
if (err instanceof yaml.YAMLException) {
|
|
187
|
-
throw expected(`Invalid YAML in ${relPath}: ${err.message}`);
|
|
188
|
-
}
|
|
189
|
-
throw err;
|
|
190
|
-
}
|
|
191
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
192
|
-
console.warn(` Warning: skipping ${relPath} (not a YAML object)`);
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
const data = raw;
|
|
196
|
-
const fileSlug = path.basename(filePath, '.yaml');
|
|
197
|
-
const evalName = typeof data.name === 'string' && data.name.trim().length > 0 ? data.name : fileSlug;
|
|
198
|
-
// Required fields: agent, input, expected
|
|
199
|
-
if (typeof data.agent !== 'string' || data.agent.trim().length === 0) {
|
|
200
|
-
throw expected(`Eval "${evalName}" in ${relPath}: missing required field "agent" (string).`);
|
|
201
|
-
}
|
|
202
|
-
if (!data.input || typeof data.input !== 'object' || Array.isArray(data.input)) {
|
|
203
|
-
throw expected(`Eval "${evalName}" in ${relPath}: missing required field "input" (object).`);
|
|
204
|
-
}
|
|
205
|
-
if (!data.expected || typeof data.expected !== 'object' || Array.isArray(data.expected)) {
|
|
206
|
-
throw expected(`Eval "${evalName}" in ${relPath}: missing required field "expected" (object).`);
|
|
207
|
-
}
|
|
208
|
-
const evalEntry = {
|
|
209
|
-
name: evalName,
|
|
210
|
-
agent: data.agent,
|
|
211
|
-
path: setName,
|
|
212
|
-
input: data.input,
|
|
213
|
-
expected: data.expected,
|
|
214
|
-
};
|
|
215
|
-
if (typeof data.id === 'string')
|
|
216
|
-
evalEntry.id = data.id;
|
|
217
|
-
if (typeof data.agent_id === 'string')
|
|
218
|
-
evalEntry.agent_id = data.agent_id;
|
|
219
|
-
if (typeof data.runs === 'number')
|
|
220
|
-
evalEntry.runs = data.runs;
|
|
221
|
-
if (data.enabled === false)
|
|
222
|
-
evalEntry.enabled = false;
|
|
223
|
-
if (Array.isArray(data.history)) {
|
|
224
|
-
evalEntry.history = data.history;
|
|
225
|
-
}
|
|
226
|
-
if (typeof data.evaluator_instructions === 'string') {
|
|
227
|
-
evalEntry.evaluator_instructions = data.evaluator_instructions;
|
|
228
|
-
}
|
|
229
|
-
return evalEntry;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Scan agents/ directory for per-agent YAML config files.
|
|
233
|
-
* Returns agent configs sorted alphabetically by filename.
|
|
234
|
-
* Resolves instructions from companion .md files.
|
|
235
|
-
*/
|
|
236
|
-
function scanAgentYamlFiles(hubFolder) {
|
|
237
|
-
const agentsDir = path.join(hubFolder, 'agents');
|
|
238
|
-
if (!fs.existsSync(agentsDir))
|
|
239
|
-
return [];
|
|
240
|
-
const yamlFiles = fs.readdirSync(agentsDir)
|
|
241
|
-
.filter((f) => f.endsWith('.yaml'))
|
|
242
|
-
.sort();
|
|
243
|
-
if (yamlFiles.length === 0)
|
|
244
|
-
return [];
|
|
245
|
-
const agents = [];
|
|
246
|
-
for (const file of yamlFiles) {
|
|
247
|
-
const filePath = path.join(agentsDir, file);
|
|
248
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
249
|
-
let agent;
|
|
250
|
-
try {
|
|
251
|
-
agent = yaml.load(content);
|
|
252
|
-
}
|
|
253
|
-
catch (err) {
|
|
254
|
-
if (err instanceof yaml.YAMLException) {
|
|
255
|
-
const userError = new Error(`Invalid YAML in agents/${file}: ${err.message}`);
|
|
256
|
-
userError.isExpected = true;
|
|
257
|
-
throw userError;
|
|
258
|
-
}
|
|
259
|
-
throw err;
|
|
260
|
-
}
|
|
261
|
-
if (!agent || typeof agent !== 'object')
|
|
262
|
-
continue;
|
|
263
|
-
if (!agent.name) {
|
|
264
|
-
console.warn(` Warning: skipping ${file} (missing 'name' field)`);
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
agents.push(agent);
|
|
268
|
-
}
|
|
269
|
-
return agents;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Scan resource directories and populate file entries with content and hashes.
|
|
273
|
-
*/
|
|
274
|
-
function parseResources(hubFolder, configResources) {
|
|
275
|
-
const resourcesDir = path.join(hubFolder, 'resources');
|
|
276
|
-
const results = [];
|
|
277
|
-
for (const res of configResources) {
|
|
278
|
-
const resource = {
|
|
279
|
-
name: res.name,
|
|
280
|
-
};
|
|
281
|
-
if (res.id)
|
|
282
|
-
resource.id = res.id;
|
|
283
|
-
if (res.type)
|
|
284
|
-
resource.type = res.type;
|
|
285
|
-
if (res.description)
|
|
286
|
-
resource.description = res.description;
|
|
287
|
-
if (res.enabled === false)
|
|
288
|
-
resource.enabled = false;
|
|
289
|
-
if (res.user_browsable)
|
|
290
|
-
resource.user_browsable = res.user_browsable;
|
|
291
|
-
if (res.skill_name)
|
|
292
|
-
resource.skill_name = res.skill_name;
|
|
293
|
-
// Scan filesystem for files
|
|
294
|
-
const resSlug = slugify(resource.name);
|
|
295
|
-
const resDir = path.join(resourcesDir, resSlug);
|
|
296
|
-
if (fs.existsSync(resDir)) {
|
|
297
|
-
const files = scanResourceFiles(resDir, '');
|
|
298
|
-
if (files.length > 0) {
|
|
299
|
-
resource.files = files;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
results.push(resource);
|
|
303
|
-
}
|
|
304
|
-
return results;
|
|
305
|
-
}
|
|
306
|
-
//# sourceMappingURL=parser.js.map
|
package/dist/lib/parser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/lib/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH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. Hubs self-identify via
|
|
4
|
-
* `hub_id` inside their own `hub.yaml`; the repo config carries only org info.
|
|
5
|
-
*/
|
|
6
|
-
export interface RepoConfig {
|
|
7
|
-
organization_id: string;
|
|
8
|
-
organization_name?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Read .wayai.yaml from the git root. Returns null if not found or invalid.
|
|
12
|
-
* Legacy fields (project_id, project_name, hub_id, hub_name) are tolerated and
|
|
13
|
-
* ignored, with a one-time deprecation notice printed to stderr.
|
|
14
|
-
*/
|
|
15
|
-
export declare function readRepoConfig(root?: string): RepoConfig | null;
|
|
16
|
-
/**
|
|
17
|
-
* Read .wayai.yaml from the git root. Exits with an error if not found or invalid.
|
|
18
|
-
*/
|
|
19
|
-
export declare function requireRepoConfig(root?: string): RepoConfig;
|
|
20
|
-
/**
|
|
21
|
-
* Write .wayai.yaml to the git root.
|
|
22
|
-
*/
|
|
23
|
-
export declare function writeRepoConfig(config: RepoConfig, root?: string): string;
|
package/dist/lib/repo-config.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repo-level configuration — .wayai.yaml at git root
|
|
3
|
-
* Scopes the workspace to a single organization. Hubs self-identify via
|
|
4
|
-
* `hub_id` inside their own `hub.yaml`; the repo config carries only org info.
|
|
5
|
-
*/
|
|
6
|
-
import * as fs from 'node:fs';
|
|
7
|
-
import * as path from 'node:path';
|
|
8
|
-
import * as yaml from 'js-yaml';
|
|
9
|
-
import { findGitRoot } from './workspace.js';
|
|
10
|
-
import { UUID_RE } from './utils.js';
|
|
11
|
-
const LEGACY_FIELDS = ['project_id', 'project_name', 'hub_id', 'hub_name'];
|
|
12
|
-
let legacyFieldsWarned = false;
|
|
13
|
-
function warnAboutLegacyFields(found) {
|
|
14
|
-
if (legacyFieldsWarned || found.length === 0)
|
|
15
|
-
return;
|
|
16
|
-
legacyFieldsWarned = true;
|
|
17
|
-
console.warn(`Note: .wayai.yaml contains deprecated field(s) ${found.join(', ')}. ` +
|
|
18
|
-
`These are ignored — only organization_id is used now. You can remove them.`);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Read .wayai.yaml from the git root. Returns null if not found or invalid.
|
|
22
|
-
* Legacy fields (project_id, project_name, hub_id, hub_name) are tolerated and
|
|
23
|
-
* ignored, with a one-time deprecation notice printed to stderr.
|
|
24
|
-
*/
|
|
25
|
-
export function readRepoConfig(root) {
|
|
26
|
-
const gitRoot = root ?? findGitRoot();
|
|
27
|
-
if (!gitRoot)
|
|
28
|
-
return null;
|
|
29
|
-
const configPath = path.join(gitRoot, '.wayai.yaml');
|
|
30
|
-
if (!fs.existsSync(configPath))
|
|
31
|
-
return null;
|
|
32
|
-
try {
|
|
33
|
-
const content = fs.readFileSync(configPath, 'utf-8');
|
|
34
|
-
const config = yaml.load(content);
|
|
35
|
-
if (!config?.organization_id || typeof config.organization_id !== 'string') {
|
|
36
|
-
// Detect old format: organization (name) instead of organization_id (UUID)
|
|
37
|
-
if (config?.organization && typeof config.organization === 'string') {
|
|
38
|
-
console.error('.wayai.yaml uses the old format (organization: name). ' +
|
|
39
|
-
'Replace it with organization_id: <uuid>.');
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
if (!UUID_RE.test(config.organization_id))
|
|
44
|
-
return null;
|
|
45
|
-
const presentLegacy = LEGACY_FIELDS.filter((f) => config[f] !== undefined);
|
|
46
|
-
warnAboutLegacyFields(presentLegacy);
|
|
47
|
-
const organizationName = typeof config.organization_name === 'string' && config.organization_name.trim()
|
|
48
|
-
? config.organization_name.trim()
|
|
49
|
-
: undefined;
|
|
50
|
-
return {
|
|
51
|
-
organization_id: config.organization_id,
|
|
52
|
-
organization_name: organizationName,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Read .wayai.yaml from the git root. Exits with an error if not found or invalid.
|
|
61
|
-
*/
|
|
62
|
-
export function requireRepoConfig(root) {
|
|
63
|
-
const config = readRepoConfig(root);
|
|
64
|
-
if (!config) {
|
|
65
|
-
console.error('Missing or invalid .wayai.yaml at the repository root.');
|
|
66
|
-
console.error('The file must contain organization_id:');
|
|
67
|
-
console.error('');
|
|
68
|
-
console.error(' organization_id: <your-org-uuid>');
|
|
69
|
-
console.error('');
|
|
70
|
-
console.error('Run `wayai init` to set up the workspace.');
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
return config;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Write .wayai.yaml to the git root.
|
|
77
|
-
*/
|
|
78
|
-
export function writeRepoConfig(config, root) {
|
|
79
|
-
const gitRoot = root ?? findGitRoot();
|
|
80
|
-
if (!gitRoot) {
|
|
81
|
-
throw new Error('Not inside a git repository. Run `git init` first.');
|
|
82
|
-
}
|
|
83
|
-
const configPath = path.join(gitRoot, '.wayai.yaml');
|
|
84
|
-
const doc = { organization_id: config.organization_id };
|
|
85
|
-
if (config.organization_name?.trim())
|
|
86
|
-
doc.organization_name = config.organization_name.trim();
|
|
87
|
-
const content = yaml.dump(doc, { quotingType: '"', forceQuotes: false });
|
|
88
|
-
fs.writeFileSync(configPath, content, 'utf-8');
|
|
89
|
-
return configPath;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=repo-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repo-config.js","sourceRoot":"","sources":["../../src/lib/repo-config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAOrC,MA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M,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACrD,MAAM,GAAG,GAA4B,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;IACjF,IAAI,MAAM,CAAC,iBAAiB,EAAE,IAAI,EAAE;QAAE,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAE9F,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACzE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAE/C,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared arg parser for the report content-edit commands — `wayai report edit`
|
|
3
|
-
* (reporter) and `wayai admin report update` (admin). Both amend the same five
|
|
4
|
-
* content fields of an EditReportBody, so the flag→key mapping and the
|
|
5
|
-
* missing-value handling live in one place.
|
|
6
|
-
*
|
|
7
|
-
* Critically, this distinguishes a flag given WITHOUT a value (an error) from a
|
|
8
|
-
* flag given an explicit empty string (a deliberate clear, e.g. `--error ""`).
|
|
9
|
-
* The generic `parseReportFlags` in admin.ts cannot — it collapses a value-less
|
|
10
|
-
* flag to the string `"true"`, which would silently persist `"true"` into a
|
|
11
|
-
* content field. Hence a dedicated parser for the value-bearing content flags.
|
|
12
|
-
*/
|
|
13
|
-
import type { EditReportBody } from '@wayai/shared/contracts';
|
|
14
|
-
export interface ParsedReportEdit {
|
|
15
|
-
/** First non-flag positional argument (the report id), if present. */
|
|
16
|
-
reportId?: string;
|
|
17
|
-
patch: EditReportBody;
|
|
18
|
-
/** Set when parsing failed (unknown flag / missing value). Callers print + exit. */
|
|
19
|
-
error?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Parse `[<id>] [--flag value ...]` into a report id + content patch. A content
|
|
23
|
-
* flag with no following token errors (`--<flag> requires a value`); an explicit
|
|
24
|
-
* empty string is kept (it clears the field server-side). An unknown `-`/`--`
|
|
25
|
-
* flag errors rather than being silently dropped.
|
|
26
|
-
*/
|
|
27
|
-
export declare function parseReportEditArgs(args: string[]): ParsedReportEdit;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared arg parser for the report content-edit commands — `wayai report edit`
|
|
3
|
-
* (reporter) and `wayai admin report update` (admin). Both amend the same five
|
|
4
|
-
* content fields of an EditReportBody, so the flag→key mapping and the
|
|
5
|
-
* missing-value handling live in one place.
|
|
6
|
-
*
|
|
7
|
-
* Critically, this distinguishes a flag given WITHOUT a value (an error) from a
|
|
8
|
-
* flag given an explicit empty string (a deliberate clear, e.g. `--error ""`).
|
|
9
|
-
* The generic `parseReportFlags` in admin.ts cannot — it collapses a value-less
|
|
10
|
-
* flag to the string `"true"`, which would silently persist `"true"` into a
|
|
11
|
-
* content field. Hence a dedicated parser for the value-bearing content flags.
|
|
12
|
-
*/
|
|
13
|
-
// Long + short flag aliases → EditReportBody key. `error`/`steps`/`context` map
|
|
14
|
-
// to the raw_payload field names (error_message/steps_to_reproduce/additional_context).
|
|
15
|
-
const FLAG_TO_KEY = {
|
|
16
|
-
'-t': 'title',
|
|
17
|
-
'--title': 'title',
|
|
18
|
-
'-d': 'description',
|
|
19
|
-
'--description': 'description',
|
|
20
|
-
'-e': 'error_message',
|
|
21
|
-
'--error': 'error_message',
|
|
22
|
-
'-s': 'steps_to_reproduce',
|
|
23
|
-
'--steps': 'steps_to_reproduce',
|
|
24
|
-
'--context': 'additional_context',
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Parse `[<id>] [--flag value ...]` into a report id + content patch. A content
|
|
28
|
-
* flag with no following token errors (`--<flag> requires a value`); an explicit
|
|
29
|
-
* empty string is kept (it clears the field server-side). An unknown `-`/`--`
|
|
30
|
-
* flag errors rather than being silently dropped.
|
|
31
|
-
*/
|
|
32
|
-
export function parseReportEditArgs(args) {
|
|
33
|
-
const patch = {};
|
|
34
|
-
let reportId;
|
|
35
|
-
for (let i = 0; i < args.length; i++) {
|
|
36
|
-
const arg = args[i];
|
|
37
|
-
const key = FLAG_TO_KEY[arg];
|
|
38
|
-
if (key) {
|
|
39
|
-
const value = args[i + 1];
|
|
40
|
-
if (value === undefined) {
|
|
41
|
-
return { reportId, patch, error: `${arg} requires a value` };
|
|
42
|
-
}
|
|
43
|
-
patch[key] = value;
|
|
44
|
-
i++; // consume the value (may be "" → clears the field)
|
|
45
|
-
}
|
|
46
|
-
else if (arg.startsWith('-')) {
|
|
47
|
-
return { reportId, patch, error: `Unknown flag: ${arg}` };
|
|
48
|
-
}
|
|
49
|
-
else if (reportId === undefined) {
|
|
50
|
-
reportId = arg;
|
|
51
|
-
}
|
|
52
|
-
// Extra positionals beyond the id are ignored.
|
|
53
|
-
}
|
|
54
|
-
return { reportId, patch };
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=report-edit-args.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-edit-args.js","sourceRoot":"","sources":["../../src/lib/report-edit-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,gFAAgF;AAChF,wFAAwF;AACxF,MAAM,WAAW,GAA+B;IAC9C,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,aAAa;IACnB,eAAe,EAAE,aAAa;IAC9B,IAAI,EAAE,eAAe;IACrB,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,SAAS,EAAE,oBAAoB;IAC/B,WAAW,EAAE,oBAAoB;CAClC,CAAC;AAUF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAc;IAChD,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,IAAI,QAA4B,CAAC;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,GAAG,mBAAmB,EAAE,CAAC;YAC/D,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACnB,CAAC,EAAE,CAAC,CAAC,mDAAmD;QAC1D,CAAC;aAAM,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,GAAG,EAAE,EAAE,CAAC;QAC5D,CAAC;aAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClC,QAAQ,GAAG,GAAG,CAAC;QACjB,CAAC;QACD,+CAA+C;IACjD,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report-action nudge — a once-per-report reminder that the caller has reports awaiting their
|
|
3
|
-
* verification. Surfaced only on `wayai login` and `wayai status` (both already authenticated and
|
|
4
|
-
* infrequent), so there is no per-command polling and thus no rate-limit pressure.
|
|
5
|
-
*
|
|
6
|
-
* Actionable states for a reporter:
|
|
7
|
-
* - `shipped` → accept or contest the fix
|
|
8
|
-
* - `dismissed` (not final, < cap) → contest the dismissal
|
|
9
|
-
* (`addressed` is terminal — nothing to do.)
|
|
10
|
-
*
|
|
11
|
-
* Dedup: each `<report_id>:<status>` is shown once, tracked in ~/.wayai/config.json. The shipped
|
|
12
|
-
* EMAIL is the primary, reliable channel; this is a best-effort secondary reminder for CLI users.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Print a one-time nudge for reports awaiting the caller's accept/contest, if any are new.
|
|
16
|
-
* Best-effort and interactive-only: never throws, never prints in non-TTY/CI/JSON contexts
|
|
17
|
-
* (the caller passes a TTY-resolved `accessToken`; this also self-guards on `process.stdout.isTTY`).
|
|
18
|
-
*/
|
|
19
|
-
export declare function nudgeReportActions(apiUrl: string, accessToken: string): Promise<void>;
|
package/dist/lib/report-inbox.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Report-action nudge — a once-per-report reminder that the caller has reports awaiting their
|
|
3
|
-
* verification. Surfaced only on `wayai login` and `wayai status` (both already authenticated and
|
|
4
|
-
* infrequent), so there is no per-command polling and thus no rate-limit pressure.
|
|
5
|
-
*
|
|
6
|
-
* Actionable states for a reporter:
|
|
7
|
-
* - `shipped` → accept or contest the fix
|
|
8
|
-
* - `dismissed` (not final, < cap) → contest the dismissal
|
|
9
|
-
* (`addressed` is terminal — nothing to do.)
|
|
10
|
-
*
|
|
11
|
-
* Dedup: each `<report_id>:<status>` is shown once, tracked in ~/.wayai/config.json. The shipped
|
|
12
|
-
* EMAIL is the primary, reliable channel; this is a best-effort secondary reminder for CLI users.
|
|
13
|
-
*/
|
|
14
|
-
import { ApiClient } from './api-client.js';
|
|
15
|
-
import { readConfig, writeConfig } from './config.js';
|
|
16
|
-
const MAX_TRACKED = 200;
|
|
17
|
-
/**
|
|
18
|
-
* Print a one-time nudge for reports awaiting the caller's accept/contest, if any are new.
|
|
19
|
-
* Best-effort and interactive-only: never throws, never prints in non-TTY/CI/JSON contexts
|
|
20
|
-
* (the caller passes a TTY-resolved `accessToken`; this also self-guards on `process.stdout.isTTY`).
|
|
21
|
-
*/
|
|
22
|
-
export async function nudgeReportActions(apiUrl, accessToken) {
|
|
23
|
-
if (!process.stdout.isTTY || process.env.CI)
|
|
24
|
-
return;
|
|
25
|
-
try {
|
|
26
|
-
const client = new ApiClient({ apiUrl, accessToken });
|
|
27
|
-
const [shipped, dismissed] = await Promise.all([
|
|
28
|
-
client.listMyReports('shipped'),
|
|
29
|
-
client.listMyReports('dismissed'),
|
|
30
|
-
]);
|
|
31
|
-
const actionable = [
|
|
32
|
-
// Shipped re-fires per shipment: a contested fix that's re-shipped is a NEW actionable event
|
|
33
|
-
// (the backend clears notified_at_shipped on `contested`, so the email re-fires too). Key on
|
|
34
|
-
// `contest_count` — it increments once per re-ship cycle (shipped → contested → re-ship) — so
|
|
35
|
-
// the CLI nudge tracks the email channel rather than going silent after the first shipment.
|
|
36
|
-
...shipped.data.map((r) => ({
|
|
37
|
-
id: r.report_id,
|
|
38
|
-
status: r.status,
|
|
39
|
-
key: `${r.report_id}:shipped:${r.contest_count}`,
|
|
40
|
-
verb: 'accept or contest',
|
|
41
|
-
})),
|
|
42
|
-
// A `final` dismissal can't be contested — don't nudge for it. (`dismissal_final` is the
|
|
43
|
-
// reporter-facing contestability gate; triage sets it precisely when further contest is
|
|
44
|
-
// refused, so we don't need the server-side contest cap here — keeping this file free of any
|
|
45
|
-
// runtime @wayai/shared import, per the CLI's standalone-publish boundary.) Keyed once-ever
|
|
46
|
-
// (no shipment discriminator) to match the dismissed email, whose slot is never re-armed.
|
|
47
|
-
...dismissed.data
|
|
48
|
-
.filter((r) => !r.dismissal_final)
|
|
49
|
-
.map((r) => ({ id: r.report_id, status: r.status, key: `${r.report_id}:dismissed`, verb: 'contest' })),
|
|
50
|
-
];
|
|
51
|
-
if (actionable.length === 0)
|
|
52
|
-
return;
|
|
53
|
-
const config = readConfig();
|
|
54
|
-
if (!config)
|
|
55
|
-
return;
|
|
56
|
-
const seen = new Set(config.nudged_report_ids ?? []);
|
|
57
|
-
const fresh = actionable.filter((a) => !seen.has(a.key));
|
|
58
|
-
if (fresh.length === 0)
|
|
59
|
-
return;
|
|
60
|
-
const n = fresh.length;
|
|
61
|
-
console.error(`\n📬 ${n} report${n > 1 ? 's' : ''} awaiting your review:`);
|
|
62
|
-
for (const a of fresh) {
|
|
63
|
-
console.error(` • ${a.id} (${a.status}) — ${a.verb}`);
|
|
64
|
-
}
|
|
65
|
-
console.error(' → `wayai report list --status shipped`, then `wayai report accept <id>` or `wayai report contest <id> --reason "..."`');
|
|
66
|
-
const updated = [...seen, ...fresh.map((a) => a.key)];
|
|
67
|
-
writeConfig({ ...config, nudged_report_ids: updated.slice(-MAX_TRACKED) });
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
/* best-effort: a nudge must never break login/status */
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=report-inbox.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-inbox.js","sourceRoot":"","sources":["../../src/lib/report-inbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,WAAmB;IAC1E,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YA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