@wave-ai-os/wave-cli 0.1.75 → 0.1.77
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 +7 -7
- package/dist/index.cjs +584 -747
- package/dist/index.js +581 -744
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { ZodError } from "zod";
|
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
|
|
10
10
|
// src/commands/tasks.ts
|
|
11
|
-
import { z as
|
|
11
|
+
import { z as z3 } from "zod";
|
|
12
12
|
|
|
13
13
|
// src/config.ts
|
|
14
14
|
import { z } from "zod";
|
|
@@ -2143,6 +2143,17 @@ async function authGraphqlRequest(params) {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
}
|
|
2145
2145
|
|
|
2146
|
+
// src/machineRuntimeContext.ts
|
|
2147
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
2148
|
+
var machineRuntimeAuthStorage = new AsyncLocalStorage();
|
|
2149
|
+
function currentMachineRuntimeAuth() {
|
|
2150
|
+
return machineRuntimeAuthStorage.getStore();
|
|
2151
|
+
}
|
|
2152
|
+
function withMachineRuntimeAuth(auth, callback) {
|
|
2153
|
+
if (!auth) return callback();
|
|
2154
|
+
return machineRuntimeAuthStorage.run(auth, callback);
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2146
2157
|
// src/commands/runtimeOptions.ts
|
|
2147
2158
|
var CLI_AUTH_STATUS_QUERY = "query WaveCliAuthenticatedOrganization { cliAuthStatus { authenticated baseAuthStatus organization { id slug } } }";
|
|
2148
2159
|
var stdinPromise = null;
|
|
@@ -2169,6 +2180,11 @@ function parseBool(raw) {
|
|
|
2169
2180
|
}
|
|
2170
2181
|
return void 0;
|
|
2171
2182
|
}
|
|
2183
|
+
function omitUndefined(values) {
|
|
2184
|
+
return Object.fromEntries(
|
|
2185
|
+
Object.entries(values).filter(([, value]) => value !== void 0)
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2172
2188
|
function parseAuthJson(raw) {
|
|
2173
2189
|
try {
|
|
2174
2190
|
const parsed = JSON.parse(raw);
|
|
@@ -2176,7 +2192,7 @@ function parseAuthJson(raw) {
|
|
|
2176
2192
|
throw new Error("Expected JSON object.");
|
|
2177
2193
|
}
|
|
2178
2194
|
const obj = parsed;
|
|
2179
|
-
return {
|
|
2195
|
+
return omitUndefined({
|
|
2180
2196
|
token: normalize3(obj.token),
|
|
2181
2197
|
baseUrl: normalize3(obj.baseUrl ?? obj.base_url),
|
|
2182
2198
|
timeoutMs: typeof obj.timeoutMs === "number" || typeof obj.timeoutMs === "string" ? obj.timeoutMs : typeof obj.timeout_ms === "number" || typeof obj.timeout_ms === "string" ? obj.timeout_ms : void 0,
|
|
@@ -2209,7 +2225,7 @@ function parseAuthJson(raw) {
|
|
|
2209
2225
|
openapiPath: normalize3(obj.openapiPath ?? obj.openapi_path),
|
|
2210
2226
|
openapiUrl: normalize3(obj.openapiUrl ?? obj.openapi_url),
|
|
2211
2227
|
openapiVersion: normalize3(obj.openapiVersion ?? obj.openapi_version)
|
|
2212
|
-
};
|
|
2228
|
+
});
|
|
2213
2229
|
} catch (error) {
|
|
2214
2230
|
throw new CliError({
|
|
2215
2231
|
message: error instanceof Error ? `Invalid --auth-json-stdin payload: ${error.message}` : "Invalid --auth-json-stdin payload.",
|
|
@@ -2257,13 +2273,14 @@ function firstDefined(...values) {
|
|
|
2257
2273
|
return values.find((value) => value !== void 0);
|
|
2258
2274
|
}
|
|
2259
2275
|
function resolveAuthToken(options, stdin, config, env) {
|
|
2276
|
+
const candidate = (source, token) => token ? { token, source } : { source };
|
|
2260
2277
|
const candidates = [
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2278
|
+
candidate("flag", normalize3(options.token)),
|
|
2279
|
+
candidate("stdin", normalize3(stdin.token)),
|
|
2280
|
+
candidate("env", normalize3(env.WAVE_API_TOKEN)),
|
|
2281
|
+
candidate("config", normalize3(config.token))
|
|
2265
2282
|
];
|
|
2266
|
-
return candidates.find((
|
|
2283
|
+
return candidates.find((candidate2) => candidate2.token) ?? { source: "none" };
|
|
2267
2284
|
}
|
|
2268
2285
|
function resolveFromSources(options, stdin, config, env) {
|
|
2269
2286
|
const baseUrl = firstDefined(
|
|
@@ -2362,10 +2379,9 @@ function resolveFromSources(options, stdin, config, env) {
|
|
|
2362
2379
|
normalize3(config.openapiVersion)
|
|
2363
2380
|
);
|
|
2364
2381
|
const resolvedAuth = resolveAuthToken(options, stdin, config, env);
|
|
2365
|
-
|
|
2366
|
-
organizationId,
|
|
2382
|
+
const resolved = {
|
|
2367
2383
|
organizationIdSource,
|
|
2368
|
-
runtimeOptions: {
|
|
2384
|
+
runtimeOptions: omitUndefined({
|
|
2369
2385
|
token: resolvedAuth.token,
|
|
2370
2386
|
tokenSource: resolvedAuth.token ? resolvedAuth.source : "none",
|
|
2371
2387
|
baseUrl,
|
|
@@ -2385,8 +2401,10 @@ function resolveFromSources(options, stdin, config, env) {
|
|
|
2385
2401
|
openapiPath,
|
|
2386
2402
|
openapiUrl,
|
|
2387
2403
|
openapiVersion
|
|
2388
|
-
}
|
|
2404
|
+
})
|
|
2389
2405
|
};
|
|
2406
|
+
if (organizationId) resolved.organizationId = organizationId;
|
|
2407
|
+
return resolved;
|
|
2390
2408
|
}
|
|
2391
2409
|
async function resolveWithStoredToken(context) {
|
|
2392
2410
|
if (context.runtimeOptions.token || !context.runtimeOptions.baseUrl) {
|
|
@@ -2410,11 +2428,11 @@ async function resolveWithAuthenticatedOrganization(context) {
|
|
|
2410
2428
|
const baseUrl = normalize3(context.runtimeOptions.baseUrl);
|
|
2411
2429
|
const token = normalize3(context.runtimeOptions.token);
|
|
2412
2430
|
if (!baseUrl || !token) {
|
|
2431
|
+
const runtimeOptions2 = { ...context.runtimeOptions };
|
|
2432
|
+
delete runtimeOptions2.organizationId;
|
|
2413
2433
|
return {
|
|
2414
|
-
...context,
|
|
2415
|
-
organizationId: void 0,
|
|
2416
2434
|
organizationIdSource: "none",
|
|
2417
|
-
runtimeOptions:
|
|
2435
|
+
runtimeOptions: runtimeOptions2
|
|
2418
2436
|
};
|
|
2419
2437
|
}
|
|
2420
2438
|
const response = await authGraphqlRequest({
|
|
@@ -2424,12 +2442,18 @@ async function resolveWithAuthenticatedOrganization(context) {
|
|
|
2424
2442
|
query: CLI_AUTH_STATUS_QUERY
|
|
2425
2443
|
});
|
|
2426
2444
|
const organizationId = response.ok ? organizationIdFromCliAuthStatus(response.result.data) : void 0;
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
organizationId
|
|
2445
|
+
const runtimeOptions = { ...context.runtimeOptions };
|
|
2446
|
+
if (organizationId) {
|
|
2447
|
+
runtimeOptions.organizationId = organizationId;
|
|
2448
|
+
} else {
|
|
2449
|
+
delete runtimeOptions.organizationId;
|
|
2450
|
+
}
|
|
2451
|
+
const resolved = {
|
|
2430
2452
|
organizationIdSource: organizationId ? "token" : "none",
|
|
2431
|
-
runtimeOptions
|
|
2453
|
+
runtimeOptions
|
|
2432
2454
|
};
|
|
2455
|
+
if (organizationId) resolved.organizationId = organizationId;
|
|
2456
|
+
return resolved;
|
|
2433
2457
|
}
|
|
2434
2458
|
function defaultConfigPath(env) {
|
|
2435
2459
|
const explicitEnv = normalize3(env.WAVE_CONFIG_PATH);
|
|
@@ -2496,7 +2520,22 @@ async function resolveStdinContext(options) {
|
|
|
2496
2520
|
async function resolveUnscopedCommandContext(options) {
|
|
2497
2521
|
const stdin = await resolveStdinContext(options);
|
|
2498
2522
|
const config = await resolveConfigFileContext(options, process.env);
|
|
2499
|
-
return resolveWithStoredToken(resolveFromSources(options, stdin, config, process.env));
|
|
2523
|
+
return resolveWithStoredToken(applyMachineRuntimeAuth(resolveFromSources(options, stdin, config, process.env)));
|
|
2524
|
+
}
|
|
2525
|
+
function applyMachineRuntimeAuth(resolved) {
|
|
2526
|
+
const machineAuth = currentMachineRuntimeAuth();
|
|
2527
|
+
if (!machineAuth) return resolved;
|
|
2528
|
+
return {
|
|
2529
|
+
organizationId: machineAuth.organizationId,
|
|
2530
|
+
organizationIdSource: "flag",
|
|
2531
|
+
runtimeOptions: {
|
|
2532
|
+
...resolved.runtimeOptions,
|
|
2533
|
+
token: machineAuth.token,
|
|
2534
|
+
tokenSource: "machine",
|
|
2535
|
+
baseUrl: machineAuth.baseUrl,
|
|
2536
|
+
organizationId: machineAuth.organizationId
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2500
2539
|
}
|
|
2501
2540
|
async function resolveCommandContext(options) {
|
|
2502
2541
|
return resolveWithAuthenticatedOrganization(await resolveUnscopedCommandContext(options));
|
|
@@ -2650,10 +2689,29 @@ function registerGraphqlSearchCommand(command, config) {
|
|
|
2650
2689
|
});
|
|
2651
2690
|
}
|
|
2652
2691
|
|
|
2692
|
+
// src/commands/taskPriority.ts
|
|
2693
|
+
import { z as z2 } from "zod";
|
|
2694
|
+
var taskPrioritySchema = z2.enum(["no_priority", "urgent", "high", "medium", "low"]);
|
|
2695
|
+
var taskPriorityValues = taskPrioritySchema.options.join(", ");
|
|
2696
|
+
var taskPriorityHelp = `Filter by priority: ${taskPriorityValues}.`;
|
|
2697
|
+
function parseTaskPriority(value) {
|
|
2698
|
+
if (value === void 0) return void 0;
|
|
2699
|
+
const parsed = taskPrioritySchema.safeParse(value);
|
|
2700
|
+
if (!parsed.success) {
|
|
2701
|
+
throw new CliError({
|
|
2702
|
+
message: `Invalid task priority. Use one of: ${taskPriorityValues}.`,
|
|
2703
|
+
kind: "invalid_args",
|
|
2704
|
+
status: 400,
|
|
2705
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
return parsed.data.toUpperCase();
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2653
2711
|
// src/commands/tasks.ts
|
|
2654
|
-
var projectIdSchema =
|
|
2655
|
-
var idSchema =
|
|
2656
|
-
var summarySchema =
|
|
2712
|
+
var projectIdSchema = z3.string().min(1);
|
|
2713
|
+
var idSchema = z3.string().min(1);
|
|
2714
|
+
var summarySchema = z3.string().min(1);
|
|
2657
2715
|
function parseTaskUpdateJson(raw) {
|
|
2658
2716
|
try {
|
|
2659
2717
|
const parsed = JSON.parse(raw);
|
|
@@ -2680,7 +2738,7 @@ function parseLabelIds(raw) {
|
|
|
2680
2738
|
}
|
|
2681
2739
|
function registerTaskCommands(program) {
|
|
2682
2740
|
const tasks = program.command("tasks").description("Task operations");
|
|
2683
|
-
tasks.command("list").option("--project-id <projectId>").option("--page <page>").option("--per <per>").option("--team-id <teamId>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--meeting-id <meetingId>").option("--field-name <fieldName>").option("--field-value <fieldValue>").option("--field-blank <fieldBlank>").option("--open <open>").option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").action(async (opts, cmd) => {
|
|
2741
|
+
tasks.command("list").option("--project-id <projectId>").option("--page <page>").option("--per <per>").option("--team-id <teamId>").option("--team-ids <teamIds>").option("--member-id <memberId>").option("--meeting-id <meetingId>").option("--field-name <fieldName>").option("--field-value <fieldValue>").option("--field-blank <fieldBlank>").option("--open <open>").option("--priority <priority>", taskPriorityHelp).option("--rank-direction <rankDirection>").option("--include-archived <includeArchived>").action(async (opts, cmd) => {
|
|
2684
2742
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
2685
2743
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
2686
2744
|
const projectId = opts.projectId ? projectIdSchema.parse(opts.projectId) : void 0;
|
|
@@ -2701,9 +2759,27 @@ function registerTaskCommands(program) {
|
|
|
2701
2759
|
field_value: opts.fieldValue,
|
|
2702
2760
|
field_blank: opts.fieldBlank,
|
|
2703
2761
|
open: opts.open,
|
|
2762
|
+
priority: parseTaskPriority(opts.priority),
|
|
2704
2763
|
rank_direction: opts.rankDirection,
|
|
2705
2764
|
include_archived: opts.includeArchived
|
|
2706
2765
|
}),
|
|
2766
|
+
variableTypes: {
|
|
2767
|
+
organization_id: "ID!",
|
|
2768
|
+
page: "Int",
|
|
2769
|
+
per: "Int",
|
|
2770
|
+
project_id: "ID",
|
|
2771
|
+
team_id: "ID",
|
|
2772
|
+
team_ids: "[ID!]",
|
|
2773
|
+
member_id: "ID",
|
|
2774
|
+
meeting_id: "ID",
|
|
2775
|
+
field_name: "String",
|
|
2776
|
+
field_value: "String",
|
|
2777
|
+
field_blank: "Boolean",
|
|
2778
|
+
open: "Boolean",
|
|
2779
|
+
priority: "TaskPriority",
|
|
2780
|
+
rank_direction: "String",
|
|
2781
|
+
include_archived: "Boolean"
|
|
2782
|
+
},
|
|
2707
2783
|
isList: true
|
|
2708
2784
|
});
|
|
2709
2785
|
});
|
|
@@ -2798,10 +2874,10 @@ function registerTaskCommands(program) {
|
|
|
2798
2874
|
}
|
|
2799
2875
|
|
|
2800
2876
|
// src/commands/projects.ts
|
|
2801
|
-
import { z as
|
|
2877
|
+
import { z as z5 } from "zod";
|
|
2802
2878
|
|
|
2803
2879
|
// src/commands/entityCrud.ts
|
|
2804
|
-
import { z as
|
|
2880
|
+
import { z as z4 } from "zod";
|
|
2805
2881
|
|
|
2806
2882
|
// src/commands/dtoHelpCatalog.ts
|
|
2807
2883
|
var dtoHelpCatalog = {
|
|
@@ -3382,7 +3458,7 @@ function buildDataJsonHelp(rootKey, mode) {
|
|
|
3382
3458
|
}
|
|
3383
3459
|
|
|
3384
3460
|
// src/commands/entityCrud.ts
|
|
3385
|
-
var idSchema2 =
|
|
3461
|
+
var idSchema2 = z4.string().min(1);
|
|
3386
3462
|
function toSingularResourceName(resourcePath) {
|
|
3387
3463
|
if (resourcePath === "organization_meta_profiles") {
|
|
3388
3464
|
return "organization_meta_profile";
|
|
@@ -3608,10 +3684,28 @@ var __testables = {
|
|
|
3608
3684
|
};
|
|
3609
3685
|
|
|
3610
3686
|
// src/commands/projects.ts
|
|
3611
|
-
var idSchema3 =
|
|
3687
|
+
var idSchema3 = z5.string().min(1);
|
|
3688
|
+
var projectStatusSchema = z5.enum([
|
|
3689
|
+
"backlog",
|
|
3690
|
+
"planned",
|
|
3691
|
+
"in_progress",
|
|
3692
|
+
"completed",
|
|
3693
|
+
"cancelled"
|
|
3694
|
+
]);
|
|
3695
|
+
var projectStatusValues = projectStatusSchema.options.join(", ");
|
|
3696
|
+
var projectPrioritySchema = z5.enum([
|
|
3697
|
+
"no_priority",
|
|
3698
|
+
"urgent",
|
|
3699
|
+
"high",
|
|
3700
|
+
"medium",
|
|
3701
|
+
"low"
|
|
3702
|
+
]);
|
|
3703
|
+
var projectPriorityValues = projectPrioritySchema.options.join(", ");
|
|
3612
3704
|
var projectCreateDataJsonHelp = buildDataJsonHelp("project", "create") ?? 'JSON object for project or {"project": {...}}';
|
|
3613
3705
|
var projectUpdateDataJsonHelp = buildDataJsonHelp("project", "update") ?? 'JSON object for project or {"project": {...}}';
|
|
3614
|
-
|
|
3706
|
+
function projectsIndexMinimalSelectionSet(includeProjectTypes = false) {
|
|
3707
|
+
return `{ count currentPage totalPages data { id type attributes { name slug status priority${includeProjectTypes ? " projectType" : ""} } } }`;
|
|
3708
|
+
}
|
|
3615
3709
|
var displayPreferenceAttributesSelectionSet = "attributes { id viewType favorite groupingField groupToggleState memberId focusMemberId focusTeamId displayableId displayableType preferenceType agendaItemId }";
|
|
3616
3710
|
var filterPreferenceAttributesSelectionSet = "attributes { id filterType filter memberId focusMemberId focusTeamId filterableId filterableType preferenceType agendaItemId }";
|
|
3617
3711
|
var healthUpdateSummarySelectionSet = "id type value memberId status createdAt updatedAt updatableType updatableId parentUpdateId emojis { id name memberId } resources { ...ResourceSummaryFull }";
|
|
@@ -3622,6 +3716,32 @@ function asRecord3(value) {
|
|
|
3622
3716
|
function toNonEmptyString(value) {
|
|
3623
3717
|
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
3624
3718
|
}
|
|
3719
|
+
function parseProjectStatus(value) {
|
|
3720
|
+
if (value === void 0) return void 0;
|
|
3721
|
+
const parsed = projectStatusSchema.safeParse(value);
|
|
3722
|
+
if (!parsed.success) {
|
|
3723
|
+
throw new CliError({
|
|
3724
|
+
message: `Invalid project status. Use one of: ${projectStatusValues}.`,
|
|
3725
|
+
kind: "invalid_args",
|
|
3726
|
+
status: 400,
|
|
3727
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
3728
|
+
});
|
|
3729
|
+
}
|
|
3730
|
+
return parsed.data.toUpperCase();
|
|
3731
|
+
}
|
|
3732
|
+
function parseProjectPriority(value) {
|
|
3733
|
+
if (value === void 0) return void 0;
|
|
3734
|
+
const parsed = projectPrioritySchema.safeParse(value);
|
|
3735
|
+
if (!parsed.success) {
|
|
3736
|
+
throw new CliError({
|
|
3737
|
+
message: `Invalid project priority. Use one of: ${projectPriorityValues}.`,
|
|
3738
|
+
kind: "invalid_args",
|
|
3739
|
+
status: 400,
|
|
3740
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
return parsed.data.toUpperCase();
|
|
3744
|
+
}
|
|
3625
3745
|
function normalizeProjectRowForDisplay(row) {
|
|
3626
3746
|
const record = asRecord3(row);
|
|
3627
3747
|
if (!record) return row;
|
|
@@ -3649,7 +3769,13 @@ function normalizeProjectsListForDisplay(payload) {
|
|
|
3649
3769
|
}
|
|
3650
3770
|
function registerProjectCommands(program) {
|
|
3651
3771
|
const projects = program.command("projects").description("Project operations");
|
|
3652
|
-
projects.command("list").option("--page <page>").option("--per <per>").option("--team-ids <teamIds>").option("--member-id <memberId>").
|
|
3772
|
+
projects.command("list").option("--page <page>").option("--per <per>").option("--team-ids <teamIds>").option("--member-id <memberId>").option(
|
|
3773
|
+
"--status <status>",
|
|
3774
|
+
"Filter by status: backlog, planned, in_progress, completed, cancelled."
|
|
3775
|
+
).option(
|
|
3776
|
+
"--priority <priority>",
|
|
3777
|
+
"Filter by priority: no_priority, urgent, high, medium, low."
|
|
3778
|
+
).option("--include-project-types", "Include projectType in the list response (opt-in).").action(async (opts, cmd) => {
|
|
3653
3779
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
3654
3780
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
3655
3781
|
await runGraphqlQueryCommand({
|
|
@@ -3662,17 +3788,21 @@ function registerProjectCommands(program) {
|
|
|
3662
3788
|
page: opts.page,
|
|
3663
3789
|
per: opts.per,
|
|
3664
3790
|
team_ids: opts.teamIds,
|
|
3665
|
-
member_id: opts.memberId
|
|
3791
|
+
member_id: opts.memberId,
|
|
3792
|
+
status: parseProjectStatus(opts.status),
|
|
3793
|
+
priority: parseProjectPriority(opts.priority)
|
|
3666
3794
|
}),
|
|
3667
3795
|
variableTypes: {
|
|
3668
3796
|
organization_id: "ID!",
|
|
3669
3797
|
page: "Int",
|
|
3670
3798
|
per: "Int",
|
|
3671
3799
|
team_ids: "[ID!]",
|
|
3672
|
-
member_id: "ID"
|
|
3800
|
+
member_id: "ID",
|
|
3801
|
+
status: "ProjectStatus",
|
|
3802
|
+
priority: "ProjectPriority"
|
|
3673
3803
|
},
|
|
3674
3804
|
isList: true,
|
|
3675
|
-
selectionSet: projectsIndexMinimalSelectionSet,
|
|
3805
|
+
selectionSet: projectsIndexMinimalSelectionSet(opts.includeProjectTypes === true),
|
|
3676
3806
|
transformData: normalizeProjectsListForDisplay
|
|
3677
3807
|
});
|
|
3678
3808
|
});
|
|
@@ -3680,7 +3810,7 @@ function registerProjectCommands(program) {
|
|
|
3680
3810
|
command: "projects",
|
|
3681
3811
|
operationName: "ProjectsSearch",
|
|
3682
3812
|
field: "projects",
|
|
3683
|
-
selectionSet: projectsIndexMinimalSelectionSet,
|
|
3813
|
+
selectionSet: projectsIndexMinimalSelectionSet(),
|
|
3684
3814
|
transformData: normalizeProjectsListForDisplay
|
|
3685
3815
|
});
|
|
3686
3816
|
projects.command("show").requiredOption("--id <id>").action(async (opts, cmd) => {
|
|
@@ -3739,10 +3869,10 @@ function registerProjectCommands(program) {
|
|
|
3739
3869
|
}
|
|
3740
3870
|
|
|
3741
3871
|
// src/commands/rocks.ts
|
|
3742
|
-
import { z as
|
|
3743
|
-
var idSchema4 =
|
|
3744
|
-
var rockCollectionIdSchema =
|
|
3745
|
-
var statusSchema =
|
|
3872
|
+
import { z as z6 } from "zod";
|
|
3873
|
+
var idSchema4 = z6.string().min(1);
|
|
3874
|
+
var rockCollectionIdSchema = z6.string().min(1);
|
|
3875
|
+
var statusSchema = z6.enum(["on_track", "at_risk", "off_track"]);
|
|
3746
3876
|
var createHelp = buildDataJsonHelp("rock", "create") ?? 'JSON object for rock or {"rock": {...}}';
|
|
3747
3877
|
var updateHelp = buildDataJsonHelp("rock", "update") ?? 'JSON object for rock or {"rock": {...}}';
|
|
3748
3878
|
function registerRockCommands(program) {
|
|
@@ -3840,9 +3970,9 @@ function registerRockCommands(program) {
|
|
|
3840
3970
|
}
|
|
3841
3971
|
|
|
3842
3972
|
// src/commands/meetings.ts
|
|
3843
|
-
import { z as
|
|
3844
|
-
var idSchema5 =
|
|
3845
|
-
var notesSchema =
|
|
3973
|
+
import { z as z7 } from "zod";
|
|
3974
|
+
var idSchema5 = z7.string().min(1);
|
|
3975
|
+
var notesSchema = z7.string().min(1);
|
|
3846
3976
|
var MEETING_TYPES = /* @__PURE__ */ new Set(["TeamMeeting", "OneOnOneMeeting"]);
|
|
3847
3977
|
var MEETING_STATUSES = /* @__PURE__ */ new Set(["upcoming", "active", "completed"]);
|
|
3848
3978
|
var MEETING_REPEATS = /* @__PURE__ */ new Set(["never", "weekly", "biweekly", "monthly", "quarterly"]);
|
|
@@ -4075,8 +4205,8 @@ function registerMeetingCommands(program) {
|
|
|
4075
4205
|
}
|
|
4076
4206
|
|
|
4077
4207
|
// src/commands/members.ts
|
|
4078
|
-
import { z as
|
|
4079
|
-
var idSchema6 =
|
|
4208
|
+
import { z as z8 } from "zod";
|
|
4209
|
+
var idSchema6 = z8.string().min(1);
|
|
4080
4210
|
var createHelp3 = buildDataJsonHelp("member", "create") ?? 'JSON object for member or {"member": {...}}';
|
|
4081
4211
|
var updateHelp3 = buildDataJsonHelp("member", "update") ?? 'JSON object for member or {"member": {...}}';
|
|
4082
4212
|
var MEMBER_META_PROFILE_SELECTION = "{ id type memberId summary profile attributes { id memberId summary profile } }";
|
|
@@ -4205,9 +4335,9 @@ function registerMemberCommands(program) {
|
|
|
4205
4335
|
}
|
|
4206
4336
|
|
|
4207
4337
|
// src/commands/skills.ts
|
|
4208
|
-
import { z as
|
|
4209
|
-
var idSchema7 =
|
|
4210
|
-
var limitSchema =
|
|
4338
|
+
import { z as z9 } from "zod";
|
|
4339
|
+
var idSchema7 = z9.string().min(1);
|
|
4340
|
+
var limitSchema = z9.coerce.number().int().positive();
|
|
4211
4341
|
var SKILL_SELECTION = `{
|
|
4212
4342
|
id
|
|
4213
4343
|
type
|
|
@@ -4283,11 +4413,11 @@ function registerSkillCommands(program) {
|
|
|
4283
4413
|
}
|
|
4284
4414
|
|
|
4285
4415
|
// src/commands/issues.ts
|
|
4286
|
-
import { z as
|
|
4287
|
-
var issueGroupIdSchema =
|
|
4288
|
-
var idSchema8 =
|
|
4289
|
-
var nameSchema =
|
|
4290
|
-
var issueTypeSchema =
|
|
4416
|
+
import { z as z10 } from "zod";
|
|
4417
|
+
var issueGroupIdSchema = z10.string().min(1);
|
|
4418
|
+
var idSchema8 = z10.string().min(1);
|
|
4419
|
+
var nameSchema = z10.string().min(1);
|
|
4420
|
+
var issueTypeSchema = z10.string().min(1).refine((value) => value === "short_term" || value === "long_term", {
|
|
4291
4421
|
message: "Invalid issue type. Use one of: short_term, long_term."
|
|
4292
4422
|
});
|
|
4293
4423
|
var updateHelp4 = buildDataJsonHelp("issue", "update") ?? 'JSON object for issue or {"issue": {...}}';
|
|
@@ -5334,8 +5464,8 @@ function registerSystemToolCommands(program) {
|
|
|
5334
5464
|
}
|
|
5335
5465
|
|
|
5336
5466
|
// src/commands/teams.ts
|
|
5337
|
-
import { z as
|
|
5338
|
-
var idSchema9 =
|
|
5467
|
+
import { z as z11 } from "zod";
|
|
5468
|
+
var idSchema9 = z11.string().min(1);
|
|
5339
5469
|
function registerTeamCommands(program) {
|
|
5340
5470
|
const teams = program.command("teams").description("Team operations");
|
|
5341
5471
|
teams.command("list").option("--page <page>").option("--per <per>").action(async (opts, cmd) => {
|
|
@@ -5401,8 +5531,8 @@ function registerTeamCommands(program) {
|
|
|
5401
5531
|
}
|
|
5402
5532
|
|
|
5403
5533
|
// src/commands/organizations.ts
|
|
5404
|
-
import { z as
|
|
5405
|
-
var idSchema10 =
|
|
5534
|
+
import { z as z12 } from "zod";
|
|
5535
|
+
var idSchema10 = z12.string().min(1);
|
|
5406
5536
|
function isRecord3(value) {
|
|
5407
5537
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5408
5538
|
}
|
|
@@ -5614,8 +5744,8 @@ function registerOrganizationCommands(program) {
|
|
|
5614
5744
|
}
|
|
5615
5745
|
|
|
5616
5746
|
// src/commands/foundation.ts
|
|
5617
|
-
import { z as
|
|
5618
|
-
var idSchema11 =
|
|
5747
|
+
import { z as z13 } from "zod";
|
|
5748
|
+
var idSchema11 = z13.string().min(1);
|
|
5619
5749
|
var STRATEGIC_PLAN_ALLOWED_UPDATE_KEYS = /* @__PURE__ */ new Set([
|
|
5620
5750
|
"published_at",
|
|
5621
5751
|
"profile",
|
|
@@ -5816,9 +5946,9 @@ function registerFoundationCommands(program) {
|
|
|
5816
5946
|
}
|
|
5817
5947
|
|
|
5818
5948
|
// src/commands/childEntities.ts
|
|
5819
|
-
import { z as
|
|
5820
|
-
var idSchema12 =
|
|
5821
|
-
var jsonObjectSchema =
|
|
5949
|
+
import { z as z14 } from "zod";
|
|
5950
|
+
var idSchema12 = z14.string().min(1);
|
|
5951
|
+
var jsonObjectSchema = z14.record(z14.string(), z14.unknown());
|
|
5822
5952
|
var NOTE_DETAIL_FIELDS = [
|
|
5823
5953
|
"notes",
|
|
5824
5954
|
"hasNotes",
|
|
@@ -5966,10 +6096,17 @@ function normalizeSubtaskCreateBody(body) {
|
|
|
5966
6096
|
}
|
|
5967
6097
|
function registerChildCommands(program, config) {
|
|
5968
6098
|
const command = program.command(config.command).description(config.description);
|
|
5969
|
-
command.command("list").requiredOption(`--${config.parentFlag} <${config.parentFlag}>`).option("--page <page>").option("--per <per>")
|
|
6099
|
+
const listCommand = command.command("list").requiredOption(`--${config.parentFlag} <${config.parentFlag}>`).option("--page <page>").option("--per <per>");
|
|
6100
|
+
if (config.priorityFilter) {
|
|
6101
|
+
listCommand.option("--priority <priority>", config.priorityFilter.help);
|
|
6102
|
+
}
|
|
6103
|
+
listCommand.action(async (opts, cmd) => {
|
|
5970
6104
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
5971
6105
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
5972
6106
|
const parentId = idSchema12.parse(opts[config.parentFlag.replace(/-([a-z])/g, (_, c) => c.toUpperCase())]);
|
|
6107
|
+
const priority = config.priorityFilter?.parse(opts.priority);
|
|
6108
|
+
const priorityVariables = priority === void 0 ? {} : { priority };
|
|
6109
|
+
const priorityVariableTypes = priority === void 0 || !config.priorityFilter ? {} : { priority: config.priorityFilter.variableType };
|
|
5973
6110
|
await runGraphqlQueryCommand({
|
|
5974
6111
|
command: `${config.command}.list`,
|
|
5975
6112
|
operationName: config.listOperationName,
|
|
@@ -5979,13 +6116,15 @@ function registerChildCommands(program, config) {
|
|
|
5979
6116
|
organization_id: organizationId,
|
|
5980
6117
|
[config.parentFlag.replace(/-/g, "_")]: parentId,
|
|
5981
6118
|
page: opts.page,
|
|
5982
|
-
per: opts.per
|
|
6119
|
+
per: opts.per,
|
|
6120
|
+
...priorityVariables
|
|
5983
6121
|
}),
|
|
5984
6122
|
variableTypes: {
|
|
5985
6123
|
organization_id: "ID!",
|
|
5986
6124
|
[config.parentFlag.replace(/-/g, "_")]: "ID!",
|
|
5987
6125
|
page: "Int",
|
|
5988
|
-
per: "Int"
|
|
6126
|
+
per: "Int",
|
|
6127
|
+
...priorityVariableTypes
|
|
5989
6128
|
},
|
|
5990
6129
|
isList: true,
|
|
5991
6130
|
selectionSet: config.listSelectionSet,
|
|
@@ -6105,6 +6244,11 @@ function registerChildEntityCommands(program) {
|
|
|
6105
6244
|
destroyOperationName: "SubtasksDestroy",
|
|
6106
6245
|
listSelectionSet: buildChildListSelectionSet("taskId"),
|
|
6107
6246
|
listParentTypedField: "taskId",
|
|
6247
|
+
priorityFilter: {
|
|
6248
|
+
variableType: "TaskPriority",
|
|
6249
|
+
help: taskPriorityHelp,
|
|
6250
|
+
parse: parseTaskPriority
|
|
6251
|
+
},
|
|
6108
6252
|
searchRequiredOptions: requiredParentSearchOption("task-id", "task"),
|
|
6109
6253
|
showField: "subtask",
|
|
6110
6254
|
showOperationName: "SubtasksShow",
|
|
@@ -6220,9 +6364,9 @@ function registerChildEntityCommands(program) {
|
|
|
6220
6364
|
}
|
|
6221
6365
|
|
|
6222
6366
|
// src/commands/content.ts
|
|
6223
|
-
import { z as
|
|
6224
|
-
var idSchema13 =
|
|
6225
|
-
var nonEmptyString =
|
|
6367
|
+
import { z as z15 } from "zod";
|
|
6368
|
+
var idSchema13 = z15.string().min(1);
|
|
6369
|
+
var nonEmptyString = z15.string().min(1);
|
|
6226
6370
|
var contentAttributesSelection = "attributes { id type name slug content firstChildSlug rootParentSlug status contentType lastEdited organizationId memberId focusMemberId focusTeamId teamId creatorId createdAt updatedAt childCount assignmentType contentableId contentableSlug contentableType votesTotal labelIds rootContentId parentContentId }";
|
|
6227
6371
|
function assertUpdateFields(params) {
|
|
6228
6372
|
if (!params.name && !params.content && !params.status) {
|
|
@@ -6410,9 +6554,9 @@ function registerContentCommands(program) {
|
|
|
6410
6554
|
}
|
|
6411
6555
|
|
|
6412
6556
|
// src/commands/markdownTree.ts
|
|
6413
|
-
import { z as
|
|
6414
|
-
var nonEmptyString2 =
|
|
6415
|
-
var nonNegativeInt =
|
|
6557
|
+
import { z as z16 } from "zod";
|
|
6558
|
+
var nonEmptyString2 = z16.string().min(1);
|
|
6559
|
+
var nonNegativeInt = z16.coerce.number().int().min(0);
|
|
6416
6560
|
function addScopeOptions(command) {
|
|
6417
6561
|
return command.requiredOption("--tool-key <toolKey>").requiredOption("--node-key <nodeKey>").option("--parent-id <parentId>").option("--record-id <recordId>").option("--member-id <memberId>").option("--team-id <teamId>").option("--content-type <contentType>").option("--tree-view");
|
|
6418
6562
|
}
|
|
@@ -6577,7 +6721,7 @@ function registerMarkdownTreeCommands(program) {
|
|
|
6577
6721
|
}
|
|
6578
6722
|
|
|
6579
6723
|
// src/commands/navigation.ts
|
|
6580
|
-
import { z as
|
|
6724
|
+
import { z as z17 } from "zod";
|
|
6581
6725
|
|
|
6582
6726
|
// src/internalOptions.ts
|
|
6583
6727
|
var INTERNAL_OPTIONS_KEY = "__waveInternalOptions";
|
|
@@ -6607,8 +6751,8 @@ function getInternalCliOptions(command) {
|
|
|
6607
6751
|
}
|
|
6608
6752
|
|
|
6609
6753
|
// src/commands/navigation.ts
|
|
6610
|
-
var nonEmpty =
|
|
6611
|
-
var nonNegativeInt2 =
|
|
6754
|
+
var nonEmpty = z17.string().min(1);
|
|
6755
|
+
var nonNegativeInt2 = z17.coerce.number().int().min(0);
|
|
6612
6756
|
var MIGRATED_BRANCHES = ["directory", "projects", "knowledge"];
|
|
6613
6757
|
function normalizeText(input) {
|
|
6614
6758
|
if (typeof input !== "string") return "";
|
|
@@ -7391,11 +7535,11 @@ function registerMutationCapabilityCommands(program) {
|
|
|
7391
7535
|
// src/commands/osmd.ts
|
|
7392
7536
|
import { readFile as readFile3 } from "fs/promises";
|
|
7393
7537
|
import { basename } from "path";
|
|
7394
|
-
import { z as
|
|
7395
|
-
var sourceSchema =
|
|
7396
|
-
var accessSchema =
|
|
7397
|
-
var ownerSchema =
|
|
7398
|
-
var suggestedActionSchema =
|
|
7538
|
+
import { z as z18 } from "zod";
|
|
7539
|
+
var sourceSchema = z18.enum(["canonical_osmd", "agent_overlay", "agent_wiki"]);
|
|
7540
|
+
var accessSchema = z18.enum(["read_only", "read_write", "append_only"]).catch("read_write");
|
|
7541
|
+
var ownerSchema = z18.enum(["system", "atlas"]);
|
|
7542
|
+
var suggestedActionSchema = z18.enum([
|
|
7399
7543
|
"read",
|
|
7400
7544
|
"create",
|
|
7401
7545
|
"init",
|
|
@@ -7404,7 +7548,7 @@ var suggestedActionSchema = z17.enum([
|
|
|
7404
7548
|
"forbidden",
|
|
7405
7549
|
"invalid_parent"
|
|
7406
7550
|
]).catch("update");
|
|
7407
|
-
var agentMarkdownErrorCodeSchema =
|
|
7551
|
+
var agentMarkdownErrorCodeSchema = z18.enum([
|
|
7408
7552
|
"canonical_osmd_read_only",
|
|
7409
7553
|
"agent_parent_not_found",
|
|
7410
7554
|
"agent_file_not_found",
|
|
@@ -7415,9 +7559,9 @@ var agentMarkdownErrorCodeSchema = z17.enum([
|
|
|
7415
7559
|
"invalid_agent_wiki_path"
|
|
7416
7560
|
]);
|
|
7417
7561
|
var agentMarkdownErrorCodeFieldSchema = agentMarkdownErrorCodeSchema.nullable().catch(null);
|
|
7418
|
-
var nonEmptyString3 =
|
|
7419
|
-
var nonNegativeInt3 =
|
|
7420
|
-
var positiveInt =
|
|
7562
|
+
var nonEmptyString3 = z18.string().min(1);
|
|
7563
|
+
var nonNegativeInt3 = z18.coerce.number().int().min(0);
|
|
7564
|
+
var positiveInt = z18.coerce.number().int().min(1);
|
|
7421
7565
|
var supportedAgentOverlaySystemFiles = ["notes.md", "summary.md"];
|
|
7422
7566
|
var supportedWikiIndexFile = "index.md";
|
|
7423
7567
|
var supportedWikiLogFile = "log.md";
|
|
@@ -7433,20 +7577,20 @@ var supportedWikiControlledPatterns = supportedWikiControlledFolders.map(
|
|
|
7433
7577
|
);
|
|
7434
7578
|
var controlledWikiSlugPattern = /^[a-z0-9][a-z0-9-]*$/;
|
|
7435
7579
|
var agentMarkdownSlugPattern = /^[a-z0-9][a-z0-9-]*$/;
|
|
7436
|
-
var osmdSearchScopeSchema =
|
|
7580
|
+
var osmdSearchScopeSchema = z18.enum([
|
|
7437
7581
|
"os-only",
|
|
7438
7582
|
"agent-overlay-only",
|
|
7439
7583
|
"agent-wiki-only",
|
|
7440
7584
|
"combined"
|
|
7441
7585
|
]);
|
|
7442
|
-
var osmdLintScopeSchema =
|
|
7586
|
+
var osmdLintScopeSchema = z18.enum([
|
|
7443
7587
|
"combined",
|
|
7444
7588
|
"agent-overlay-only",
|
|
7445
7589
|
"agent-wiki-only"
|
|
7446
7590
|
]);
|
|
7447
|
-
var osmdMemoryQualityScopeSchema =
|
|
7448
|
-
var osmdIngestKindSchema =
|
|
7449
|
-
var osmdRawSourceTypeSchema =
|
|
7591
|
+
var osmdMemoryQualityScopeSchema = z18.enum(["agent-overlay-only"]);
|
|
7592
|
+
var osmdIngestKindSchema = z18.enum(["text", "file", "url", "transcript"]);
|
|
7593
|
+
var osmdRawSourceTypeSchema = z18.enum([
|
|
7450
7594
|
"pasted_text",
|
|
7451
7595
|
"uploaded_markdown",
|
|
7452
7596
|
"uploaded_text",
|
|
@@ -7455,31 +7599,30 @@ var osmdRawSourceTypeSchema = z17.enum([
|
|
|
7455
7599
|
"meeting_transcript",
|
|
7456
7600
|
"url"
|
|
7457
7601
|
]);
|
|
7458
|
-
var
|
|
7459
|
-
var agentMarkdownFileSchema = z17.preprocess(
|
|
7602
|
+
var agentMarkdownFileSchema = z18.preprocess(
|
|
7460
7603
|
normalizeAgentMarkdownJsonKeys,
|
|
7461
|
-
|
|
7462
|
-
path:
|
|
7604
|
+
z18.object({
|
|
7605
|
+
path: z18.string(),
|
|
7463
7606
|
source: sourceSchema,
|
|
7464
7607
|
access: accessSchema,
|
|
7465
7608
|
owner: ownerSchema,
|
|
7466
|
-
exists:
|
|
7467
|
-
canCreate:
|
|
7468
|
-
canUpdate:
|
|
7469
|
-
canAppend:
|
|
7470
|
-
wikiRole:
|
|
7471
|
-
formatVersion:
|
|
7472
|
-
createdAt:
|
|
7473
|
-
updatedAt:
|
|
7474
|
-
ingestedAt:
|
|
7475
|
-
lastSeenAt:
|
|
7476
|
-
canonicalParentUpdatedAt:
|
|
7477
|
-
parentRef:
|
|
7478
|
-
agentChildrenAllowed:
|
|
7609
|
+
exists: z18.boolean(),
|
|
7610
|
+
canCreate: z18.boolean(),
|
|
7611
|
+
canUpdate: z18.boolean(),
|
|
7612
|
+
canAppend: z18.boolean(),
|
|
7613
|
+
wikiRole: z18.string().nullable().optional(),
|
|
7614
|
+
formatVersion: z18.string().nullable().optional(),
|
|
7615
|
+
createdAt: z18.string().nullable().optional(),
|
|
7616
|
+
updatedAt: z18.string().nullable().optional(),
|
|
7617
|
+
ingestedAt: z18.string().nullable().optional(),
|
|
7618
|
+
lastSeenAt: z18.string().nullable().optional(),
|
|
7619
|
+
canonicalParentUpdatedAt: z18.string().nullable().optional(),
|
|
7620
|
+
parentRef: z18.string().nullable().optional(),
|
|
7621
|
+
agentChildrenAllowed: z18.boolean(),
|
|
7479
7622
|
suggestedAction: suggestedActionSchema,
|
|
7480
7623
|
errorCode: agentMarkdownErrorCodeFieldSchema.optional(),
|
|
7481
|
-
content:
|
|
7482
|
-
url:
|
|
7624
|
+
content: z18.string().nullable().optional(),
|
|
7625
|
+
url: z18.string().nullable().optional()
|
|
7483
7626
|
}).transform((value) => ({
|
|
7484
7627
|
...value,
|
|
7485
7628
|
wikiRole: value.wikiRole ?? null,
|
|
@@ -7495,31 +7638,31 @@ var agentMarkdownFileSchema = z17.preprocess(
|
|
|
7495
7638
|
url: value.url ?? null
|
|
7496
7639
|
}))
|
|
7497
7640
|
);
|
|
7498
|
-
var agentMarkdownFilesSchema =
|
|
7499
|
-
var agentMarkdownMutationDataSchema =
|
|
7641
|
+
var agentMarkdownFilesSchema = z18.array(agentMarkdownFileSchema);
|
|
7642
|
+
var agentMarkdownMutationDataSchema = z18.union([
|
|
7500
7643
|
agentMarkdownFileSchema,
|
|
7501
|
-
|
|
7644
|
+
z18.object({ files: agentMarkdownFilesSchema })
|
|
7502
7645
|
]);
|
|
7503
|
-
var osmdSearchCandidateSchema =
|
|
7646
|
+
var osmdSearchCandidateSchema = z18.preprocess(
|
|
7504
7647
|
normalizeAgentMarkdownJsonKeys,
|
|
7505
|
-
|
|
7506
|
-
path:
|
|
7648
|
+
z18.object({
|
|
7649
|
+
path: z18.string(),
|
|
7507
7650
|
source: sourceSchema,
|
|
7508
7651
|
access: accessSchema,
|
|
7509
7652
|
owner: ownerSchema,
|
|
7510
|
-
wikiRole:
|
|
7511
|
-
formatVersion:
|
|
7512
|
-
parentRef:
|
|
7513
|
-
exists:
|
|
7514
|
-
agentChildrenAllowed:
|
|
7515
|
-
title:
|
|
7516
|
-
label:
|
|
7517
|
-
snippet:
|
|
7518
|
-
rank:
|
|
7519
|
-
matchReason:
|
|
7520
|
-
toolKey:
|
|
7521
|
-
nodeKey:
|
|
7522
|
-
nodeKind:
|
|
7653
|
+
wikiRole: z18.string().nullable().optional(),
|
|
7654
|
+
formatVersion: z18.string().nullable().optional(),
|
|
7655
|
+
parentRef: z18.string().nullable().optional(),
|
|
7656
|
+
exists: z18.boolean(),
|
|
7657
|
+
agentChildrenAllowed: z18.boolean(),
|
|
7658
|
+
title: z18.string(),
|
|
7659
|
+
label: z18.string(),
|
|
7660
|
+
snippet: z18.string().nullable().optional(),
|
|
7661
|
+
rank: z18.number().int(),
|
|
7662
|
+
matchReason: z18.string().nullable().optional(),
|
|
7663
|
+
toolKey: z18.string().nullable().optional(),
|
|
7664
|
+
nodeKey: z18.string().nullable().optional(),
|
|
7665
|
+
nodeKind: z18.string().nullable().optional()
|
|
7523
7666
|
}).transform((value) => ({
|
|
7524
7667
|
...value,
|
|
7525
7668
|
wikiRole: value.wikiRole ?? null,
|
|
@@ -7532,26 +7675,26 @@ var osmdSearchCandidateSchema = z17.preprocess(
|
|
|
7532
7675
|
nodeKind: value.nodeKind ?? null
|
|
7533
7676
|
}))
|
|
7534
7677
|
);
|
|
7535
|
-
var osmdSearchResultSchema =
|
|
7678
|
+
var osmdSearchResultSchema = z18.preprocess(
|
|
7536
7679
|
normalizeAgentMarkdownJsonKeys,
|
|
7537
|
-
|
|
7538
|
-
query:
|
|
7539
|
-
scope:
|
|
7540
|
-
count:
|
|
7541
|
-
candidates:
|
|
7680
|
+
z18.object({
|
|
7681
|
+
query: z18.string(),
|
|
7682
|
+
scope: z18.string(),
|
|
7683
|
+
count: z18.number().int().min(0),
|
|
7684
|
+
candidates: z18.array(osmdSearchCandidateSchema)
|
|
7542
7685
|
})
|
|
7543
7686
|
);
|
|
7544
|
-
var osmdWikiLintIssueSchema =
|
|
7687
|
+
var osmdWikiLintIssueSchema = z18.preprocess(
|
|
7545
7688
|
normalizeAgentMarkdownJsonKeys,
|
|
7546
|
-
|
|
7547
|
-
code:
|
|
7548
|
-
severity:
|
|
7549
|
-
path:
|
|
7550
|
-
source:
|
|
7551
|
-
parentRef:
|
|
7552
|
-
message:
|
|
7553
|
-
suggestedAction:
|
|
7554
|
-
canAutoFix:
|
|
7689
|
+
z18.object({
|
|
7690
|
+
code: z18.string(),
|
|
7691
|
+
severity: z18.string(),
|
|
7692
|
+
path: z18.string(),
|
|
7693
|
+
source: z18.string().nullable().optional(),
|
|
7694
|
+
parentRef: z18.string().nullable().optional(),
|
|
7695
|
+
message: z18.string(),
|
|
7696
|
+
suggestedAction: z18.string().nullable().optional(),
|
|
7697
|
+
canAutoFix: z18.boolean()
|
|
7555
7698
|
}).transform((value) => ({
|
|
7556
7699
|
...value,
|
|
7557
7700
|
source: value.source ?? null,
|
|
@@ -7559,37 +7702,37 @@ var osmdWikiLintIssueSchema = z17.preprocess(
|
|
|
7559
7702
|
suggestedAction: value.suggestedAction ?? null
|
|
7560
7703
|
}))
|
|
7561
7704
|
);
|
|
7562
|
-
var osmdWikiLintResultSchema =
|
|
7705
|
+
var osmdWikiLintResultSchema = z18.preprocess(
|
|
7563
7706
|
normalizeAgentMarkdownJsonKeys,
|
|
7564
|
-
|
|
7565
|
-
status:
|
|
7566
|
-
summary:
|
|
7567
|
-
totalIssues:
|
|
7568
|
-
errors:
|
|
7569
|
-
warnings:
|
|
7570
|
-
suggestions:
|
|
7707
|
+
z18.object({
|
|
7708
|
+
status: z18.string(),
|
|
7709
|
+
summary: z18.object({
|
|
7710
|
+
totalIssues: z18.number().int().min(0),
|
|
7711
|
+
errors: z18.number().int().min(0),
|
|
7712
|
+
warnings: z18.number().int().min(0),
|
|
7713
|
+
suggestions: z18.number().int().min(0)
|
|
7571
7714
|
}),
|
|
7572
|
-
issues:
|
|
7715
|
+
issues: z18.array(osmdWikiLintIssueSchema)
|
|
7573
7716
|
})
|
|
7574
7717
|
);
|
|
7575
|
-
var nullableCountSchema =
|
|
7718
|
+
var nullableCountSchema = z18.preprocess(
|
|
7576
7719
|
(value) => value === void 0 || value === null || value === "" ? null : value,
|
|
7577
|
-
|
|
7720
|
+
z18.coerce.number().int().min(0).nullable()
|
|
7578
7721
|
).catch(null);
|
|
7579
|
-
var osmdMemoryQualityIssueSchema =
|
|
7722
|
+
var osmdMemoryQualityIssueSchema = z18.preprocess(
|
|
7580
7723
|
normalizeAgentMarkdownJsonKeys,
|
|
7581
|
-
|
|
7582
|
-
code:
|
|
7583
|
-
issueCode:
|
|
7584
|
-
path:
|
|
7585
|
-
parentRef:
|
|
7586
|
-
dimension:
|
|
7587
|
-
evidence:
|
|
7588
|
-
evidenceSnippet:
|
|
7589
|
-
message:
|
|
7590
|
-
severity:
|
|
7591
|
-
suggestedAction:
|
|
7592
|
-
canAutoFix:
|
|
7724
|
+
z18.object({
|
|
7725
|
+
code: z18.string().nullable().optional(),
|
|
7726
|
+
issueCode: z18.string().nullable().optional(),
|
|
7727
|
+
path: z18.string().nullable().optional(),
|
|
7728
|
+
parentRef: z18.string().nullable().optional(),
|
|
7729
|
+
dimension: z18.string().nullable().optional(),
|
|
7730
|
+
evidence: z18.string().nullable().optional(),
|
|
7731
|
+
evidenceSnippet: z18.string().nullable().optional(),
|
|
7732
|
+
message: z18.string().nullable().optional(),
|
|
7733
|
+
severity: z18.string().nullable().optional(),
|
|
7734
|
+
suggestedAction: z18.string().nullable().optional(),
|
|
7735
|
+
canAutoFix: z18.boolean().nullable().optional()
|
|
7593
7736
|
}).passthrough().transform((value) => ({
|
|
7594
7737
|
...value,
|
|
7595
7738
|
code: value.code ?? value.issueCode ?? "unknown_issue",
|
|
@@ -7604,16 +7747,16 @@ var osmdMemoryQualityIssueSchema = z17.preprocess(
|
|
|
7604
7747
|
canAutoFix: value.canAutoFix === true ? true : false
|
|
7605
7748
|
}))
|
|
7606
7749
|
);
|
|
7607
|
-
var osmdMemoryQualityOverlaySchema =
|
|
7750
|
+
var osmdMemoryQualityOverlaySchema = z18.preprocess(
|
|
7608
7751
|
normalizeAgentMarkdownJsonKeys,
|
|
7609
|
-
|
|
7610
|
-
path:
|
|
7611
|
-
parentRef:
|
|
7612
|
-
status:
|
|
7613
|
-
score:
|
|
7614
|
-
overallScore:
|
|
7615
|
-
dimensions:
|
|
7616
|
-
issues:
|
|
7752
|
+
z18.object({
|
|
7753
|
+
path: z18.string().nullable().optional(),
|
|
7754
|
+
parentRef: z18.string().nullable().optional(),
|
|
7755
|
+
status: z18.string().nullable().optional(),
|
|
7756
|
+
score: z18.union([z18.number(), z18.string()]).nullable().optional(),
|
|
7757
|
+
overallScore: z18.union([z18.number(), z18.string()]).nullable().optional(),
|
|
7758
|
+
dimensions: z18.unknown().nullable().optional(),
|
|
7759
|
+
issues: z18.array(osmdMemoryQualityIssueSchema).optional()
|
|
7617
7760
|
}).passthrough().transform((value) => ({
|
|
7618
7761
|
...value,
|
|
7619
7762
|
path: value.path ?? null,
|
|
@@ -7625,9 +7768,9 @@ var osmdMemoryQualityOverlaySchema = z17.preprocess(
|
|
|
7625
7768
|
issues: value.issues ?? []
|
|
7626
7769
|
}))
|
|
7627
7770
|
);
|
|
7628
|
-
var osmdMemoryQualitySummarySchema =
|
|
7771
|
+
var osmdMemoryQualitySummarySchema = z18.preprocess(
|
|
7629
7772
|
normalizeAgentMarkdownJsonKeys,
|
|
7630
|
-
|
|
7773
|
+
z18.object({
|
|
7631
7774
|
evaluatedCount: nullableCountSchema.optional(),
|
|
7632
7775
|
passCount: nullableCountSchema.optional(),
|
|
7633
7776
|
warnCount: nullableCountSchema.optional(),
|
|
@@ -7645,19 +7788,19 @@ var osmdMemoryQualitySummarySchema = z17.preprocess(
|
|
|
7645
7788
|
failCount: value.failCount ?? value.failures ?? null
|
|
7646
7789
|
}))
|
|
7647
7790
|
);
|
|
7648
|
-
var osmdMemoryQualityResultSchema =
|
|
7791
|
+
var osmdMemoryQualityResultSchema = z18.preprocess(
|
|
7649
7792
|
normalizeAgentMarkdownJsonKeys,
|
|
7650
|
-
|
|
7651
|
-
status:
|
|
7652
|
-
scope:
|
|
7793
|
+
z18.object({
|
|
7794
|
+
status: z18.string(),
|
|
7795
|
+
scope: z18.string().nullable().optional(),
|
|
7653
7796
|
evaluatedCount: nullableCountSchema.optional(),
|
|
7654
7797
|
passCount: nullableCountSchema.optional(),
|
|
7655
7798
|
warnCount: nullableCountSchema.optional(),
|
|
7656
7799
|
failCount: nullableCountSchema.optional(),
|
|
7657
7800
|
summary: osmdMemoryQualitySummarySchema.optional(),
|
|
7658
|
-
weakestOverlays:
|
|
7659
|
-
issues:
|
|
7660
|
-
scores:
|
|
7801
|
+
weakestOverlays: z18.array(osmdMemoryQualityOverlaySchema).optional(),
|
|
7802
|
+
issues: z18.array(osmdMemoryQualityIssueSchema).optional(),
|
|
7803
|
+
scores: z18.array(osmdMemoryQualityOverlaySchema).optional()
|
|
7661
7804
|
}).passthrough().transform((value) => {
|
|
7662
7805
|
const summary = isRecord5(value.summary) ? value.summary : null;
|
|
7663
7806
|
return {
|
|
@@ -7681,24 +7824,24 @@ function normalizeOsmdIngestFileRecordInput(value) {
|
|
|
7681
7824
|
}
|
|
7682
7825
|
return normalized;
|
|
7683
7826
|
}
|
|
7684
|
-
var osmdIngestFileRecordSchema =
|
|
7827
|
+
var osmdIngestFileRecordSchema = z18.preprocess(
|
|
7685
7828
|
normalizeOsmdIngestFileRecordInput,
|
|
7686
|
-
|
|
7687
|
-
path:
|
|
7688
|
-
source:
|
|
7689
|
-
access:
|
|
7690
|
-
owner:
|
|
7691
|
-
parentRef:
|
|
7692
|
-
exists:
|
|
7693
|
-
canCreate:
|
|
7694
|
-
canUpdate:
|
|
7695
|
-
canAppend:
|
|
7696
|
-
wikiRole:
|
|
7697
|
-
formatVersion:
|
|
7698
|
-
createdAt:
|
|
7699
|
-
updatedAt:
|
|
7700
|
-
suggestedAction:
|
|
7701
|
-
errorCode:
|
|
7829
|
+
z18.object({
|
|
7830
|
+
path: z18.string(),
|
|
7831
|
+
source: z18.string().nullable().optional(),
|
|
7832
|
+
access: z18.string().nullable().optional(),
|
|
7833
|
+
owner: z18.string().nullable().optional(),
|
|
7834
|
+
parentRef: z18.string().nullable().optional(),
|
|
7835
|
+
exists: z18.boolean().nullable().optional(),
|
|
7836
|
+
canCreate: z18.boolean().nullable().optional(),
|
|
7837
|
+
canUpdate: z18.boolean().nullable().optional(),
|
|
7838
|
+
canAppend: z18.boolean().nullable().optional(),
|
|
7839
|
+
wikiRole: z18.string().nullable().optional(),
|
|
7840
|
+
formatVersion: z18.string().nullable().optional(),
|
|
7841
|
+
createdAt: z18.string().nullable().optional(),
|
|
7842
|
+
updatedAt: z18.string().nullable().optional(),
|
|
7843
|
+
suggestedAction: z18.string().nullable().optional(),
|
|
7844
|
+
errorCode: z18.string().nullable().optional()
|
|
7702
7845
|
}).passthrough().transform((value) => ({
|
|
7703
7846
|
...value,
|
|
7704
7847
|
source: value.source ?? null,
|
|
@@ -7717,17 +7860,17 @@ var osmdIngestFileRecordSchema = z17.preprocess(
|
|
|
7717
7860
|
errorCode: value.errorCode ?? null
|
|
7718
7861
|
}))
|
|
7719
7862
|
);
|
|
7720
|
-
var osmdIngestResultSchema =
|
|
7863
|
+
var osmdIngestResultSchema = z18.preprocess(
|
|
7721
7864
|
normalizeAgentMarkdownJsonKeys,
|
|
7722
|
-
|
|
7723
|
-
rawSourceId:
|
|
7724
|
-
sourceSummaryPath:
|
|
7865
|
+
z18.object({
|
|
7866
|
+
rawSourceId: z18.union([z18.string(), z18.number()]).nullable().optional(),
|
|
7867
|
+
sourceSummaryPath: z18.string().nullable().optional(),
|
|
7725
7868
|
sourceSummaryFile: osmdIngestFileRecordSchema.nullable().optional(),
|
|
7726
|
-
slug:
|
|
7727
|
-
runLint:
|
|
7728
|
-
createdFiles:
|
|
7729
|
-
updatedFiles:
|
|
7730
|
-
skippedUpdates:
|
|
7869
|
+
slug: z18.string().nullable().optional(),
|
|
7870
|
+
runLint: z18.boolean().nullable().optional(),
|
|
7871
|
+
createdFiles: z18.array(osmdIngestFileRecordSchema).optional(),
|
|
7872
|
+
updatedFiles: z18.array(osmdIngestFileRecordSchema).optional(),
|
|
7873
|
+
skippedUpdates: z18.array(z18.unknown()).optional(),
|
|
7731
7874
|
lintResult: osmdWikiLintResultSchema.nullable().optional()
|
|
7732
7875
|
}).passthrough().transform((value) => ({
|
|
7733
7876
|
...value,
|
|
@@ -7742,127 +7885,37 @@ var osmdIngestResultSchema = z17.preprocess(
|
|
|
7742
7885
|
lintResult: value.lintResult ?? null
|
|
7743
7886
|
}))
|
|
7744
7887
|
);
|
|
7745
|
-
var
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
...value,
|
|
7752
|
-
id: value.id === void 0 || value.id === null ? null : String(value.id),
|
|
7753
|
-
status: value.status ?? null
|
|
7754
|
-
}))
|
|
7755
|
-
);
|
|
7756
|
-
var osmdPhantomResultSchema = z17.preprocess(
|
|
7757
|
-
normalizeOsmdPhantomResultKeys,
|
|
7758
|
-
z17.object({
|
|
7759
|
-
runId: z17.union([z17.string(), z17.number()]).nullable().optional(),
|
|
7760
|
-
organizationId: z17.union([z17.string(), z17.number()]).nullable().optional(),
|
|
7761
|
-
triggerType: z17.string().nullable().optional(),
|
|
7762
|
-
scope: z17.string().nullable().optional(),
|
|
7763
|
-
subtree: z17.string().nullable().optional(),
|
|
7764
|
-
status: z17.string().nullable().optional(),
|
|
7765
|
-
createdAt: z17.string().nullable().optional(),
|
|
7766
|
-
updatedAt: z17.string().nullable().optional(),
|
|
7767
|
-
startedAt: z17.string().nullable().optional(),
|
|
7768
|
-
completedAt: z17.string().nullable().optional(),
|
|
7769
|
-
countSemantics: z17.unknown().nullable().optional(),
|
|
7770
|
-
scannedFileCount: nullableCountSchema,
|
|
7771
|
-
changedFileCount: nullableCountSchema,
|
|
7772
|
-
unchangedFileCount: nullableCountSchema,
|
|
7773
|
-
updatedFileCount: nullableCountSchema,
|
|
7774
|
-
skippedFileCount: nullableCountSchema,
|
|
7775
|
-
lintStatus: z17.string().nullable().optional(),
|
|
7776
|
-
errorCount: nullableCountSchema,
|
|
7777
|
-
warningCount: nullableCountSchema,
|
|
7778
|
-
reportPath: z17.string().nullable().optional(),
|
|
7779
|
-
plannedReads: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7780
|
-
plannedReadFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7781
|
-
plannedWrites: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7782
|
-
plannedWriteFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7783
|
-
changedFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7784
|
-
unchangedFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7785
|
-
updatedFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7786
|
-
skippedFiles: z17.array(osmdIngestFileRecordSchema).optional(),
|
|
7787
|
-
lintPlan: z17.unknown().nullable().optional(),
|
|
7788
|
-
lintSummary: z17.unknown().nullable().optional(),
|
|
7789
|
-
lintResult: osmdWikiLintResultSchema.nullable().optional(),
|
|
7790
|
-
notification: osmdPhantomNotificationSchema.nullable().optional(),
|
|
7791
|
-
notificationId: z17.union([z17.string(), z17.number()]).nullable().optional(),
|
|
7792
|
-
notificationStatus: z17.string().nullable().optional()
|
|
7793
|
-
}).passthrough().transform((value) => {
|
|
7794
|
-
const lintResultSummary = isRecord5(value.lintResult?.summary) ? value.lintResult.summary : null;
|
|
7795
|
-
const lintSummary = isRecord5(value.lintSummary) ? value.lintSummary : null;
|
|
7796
|
-
const notification = value.notification ?? (value.notificationId !== void 0 || value.notificationStatus !== void 0 ? {
|
|
7797
|
-
id: value.notificationId === void 0 || value.notificationId === null ? null : String(value.notificationId),
|
|
7798
|
-
status: value.notificationStatus ?? null
|
|
7799
|
-
} : null);
|
|
7800
|
-
return {
|
|
7801
|
-
...value,
|
|
7802
|
-
runId: value.runId === void 0 || value.runId === null ? null : String(value.runId),
|
|
7803
|
-
organizationId: value.organizationId === void 0 || value.organizationId === null ? null : String(value.organizationId),
|
|
7804
|
-
triggerType: value.triggerType ?? null,
|
|
7805
|
-
scope: value.scope ?? null,
|
|
7806
|
-
subtree: value.subtree ?? null,
|
|
7807
|
-
status: value.status ?? null,
|
|
7808
|
-
createdAt: value.createdAt ?? null,
|
|
7809
|
-
updatedAt: value.updatedAt ?? null,
|
|
7810
|
-
startedAt: value.startedAt ?? null,
|
|
7811
|
-
completedAt: value.completedAt ?? null,
|
|
7812
|
-
countSemantics: value.countSemantics ?? null,
|
|
7813
|
-
scannedFileCount: value.scannedFileCount,
|
|
7814
|
-
changedFileCount: value.changedFileCount,
|
|
7815
|
-
unchangedFileCount: value.unchangedFileCount,
|
|
7816
|
-
updatedFileCount: value.updatedFileCount,
|
|
7817
|
-
skippedFileCount: value.skippedFileCount,
|
|
7818
|
-
lintStatus: value.lintStatus ?? (typeof value.lintResult?.status === "string" ? value.lintResult.status : null) ?? (typeof lintSummary?.status === "string" ? lintSummary.status : null),
|
|
7819
|
-
errorCount: value.errorCount ?? countFromRecord(lintResultSummary, "errors") ?? countFromRecord(lintSummary, "errors"),
|
|
7820
|
-
warningCount: value.warningCount ?? countFromRecord(lintResultSummary, "warnings") ?? countFromRecord(lintSummary, "warnings"),
|
|
7821
|
-
reportPath: value.reportPath ?? null,
|
|
7822
|
-
plannedReads: value.plannedReads ?? value.plannedReadFiles ?? [],
|
|
7823
|
-
plannedWrites: value.plannedWrites ?? value.plannedWriteFiles ?? [],
|
|
7824
|
-
changedFiles: value.changedFiles ?? [],
|
|
7825
|
-
unchangedFiles: dedupeOsmdFileRecords(value.unchangedFiles ?? []),
|
|
7826
|
-
updatedFiles: value.updatedFiles ?? [],
|
|
7827
|
-
skippedFiles: dedupeOsmdFileRecords(value.skippedFiles ?? []),
|
|
7828
|
-
lintPlan: value.lintPlan ?? null,
|
|
7829
|
-
lintSummary: value.lintSummary ?? null,
|
|
7830
|
-
lintResult: value.lintResult ?? null,
|
|
7831
|
-
notification
|
|
7832
|
-
};
|
|
7833
|
-
})
|
|
7834
|
-
);
|
|
7835
|
-
var mutationPayloadSchema = z17.object({
|
|
7836
|
-
ok: z17.boolean(),
|
|
7837
|
-
status: z17.number(),
|
|
7838
|
-
errorCode: z17.string().nullable().optional(),
|
|
7839
|
-
data: z17.unknown().nullable().optional(),
|
|
7840
|
-
errors: z17.unknown().nullable().optional()
|
|
7888
|
+
var mutationPayloadSchema = z18.object({
|
|
7889
|
+
ok: z18.boolean(),
|
|
7890
|
+
status: z18.number(),
|
|
7891
|
+
errorCode: z18.string().nullable().optional(),
|
|
7892
|
+
data: z18.unknown().nullable().optional(),
|
|
7893
|
+
errors: z18.unknown().nullable().optional()
|
|
7841
7894
|
});
|
|
7842
|
-
var markdownTreeNodeSchema =
|
|
7843
|
-
() =>
|
|
7844
|
-
toolKey:
|
|
7845
|
-
nodeKey:
|
|
7846
|
-
nodeKind:
|
|
7847
|
-
runtimeLabel:
|
|
7848
|
-
path:
|
|
7895
|
+
var markdownTreeNodeSchema = z18.lazy(
|
|
7896
|
+
() => z18.object({
|
|
7897
|
+
toolKey: z18.string(),
|
|
7898
|
+
nodeKey: z18.string(),
|
|
7899
|
+
nodeKind: z18.string(),
|
|
7900
|
+
runtimeLabel: z18.string(),
|
|
7901
|
+
path: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7849
7902
|
source: sourceSchema,
|
|
7850
7903
|
access: accessSchema,
|
|
7851
7904
|
owner: ownerSchema,
|
|
7852
|
-
parentRef:
|
|
7853
|
-
agentChildrenAllowed:
|
|
7854
|
-
exists:
|
|
7855
|
-
resolvedScope:
|
|
7856
|
-
parentId:
|
|
7857
|
-
recordId:
|
|
7858
|
-
memberId:
|
|
7859
|
-
teamId:
|
|
7860
|
-
contentType:
|
|
7905
|
+
parentRef: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7906
|
+
agentChildrenAllowed: z18.boolean(),
|
|
7907
|
+
exists: z18.boolean(),
|
|
7908
|
+
resolvedScope: z18.object({
|
|
7909
|
+
parentId: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7910
|
+
recordId: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7911
|
+
memberId: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7912
|
+
teamId: z18.string().nullable().optional().transform((value) => value ?? null),
|
|
7913
|
+
contentType: z18.string().nullable().optional().transform((value) => value ?? null)
|
|
7861
7914
|
}),
|
|
7862
|
-
isLeaf:
|
|
7863
|
-
treeView:
|
|
7864
|
-
details:
|
|
7865
|
-
children:
|
|
7915
|
+
isLeaf: z18.boolean(),
|
|
7916
|
+
treeView: z18.boolean(),
|
|
7917
|
+
details: z18.unknown().nullable(),
|
|
7918
|
+
children: z18.array(markdownTreeNodeSchema).optional().transform((value) => value ?? [])
|
|
7866
7919
|
})
|
|
7867
7920
|
);
|
|
7868
7921
|
var AGENT_MARKDOWN_FILE_SELECTION = `{
|
|
@@ -8123,86 +8176,6 @@ function normalizeAgentMarkdownJsonKeys(value) {
|
|
|
8123
8176
|
}
|
|
8124
8177
|
return normalized;
|
|
8125
8178
|
}
|
|
8126
|
-
function firstPresent(...values) {
|
|
8127
|
-
for (const value of values) {
|
|
8128
|
-
if (value !== void 0 && value !== null) {
|
|
8129
|
-
return value;
|
|
8130
|
-
}
|
|
8131
|
-
}
|
|
8132
|
-
return void 0;
|
|
8133
|
-
}
|
|
8134
|
-
function normalizeOsmdPhantomResultKeys(value) {
|
|
8135
|
-
const normalized = normalizeAgentMarkdownJsonKeys(value);
|
|
8136
|
-
if (!isRecord5(normalized)) {
|
|
8137
|
-
return normalized;
|
|
8138
|
-
}
|
|
8139
|
-
const run = isRecord5(normalized.run) ? normalizeAgentMarkdownJsonKeys(normalized.run) : null;
|
|
8140
|
-
const result = run ? { ...run, ...normalized } : { ...normalized };
|
|
8141
|
-
const runField = (key) => run ? run[key] : void 0;
|
|
8142
|
-
const assignFirstPresent = (target, ...values) => {
|
|
8143
|
-
const value2 = firstPresent(result[target], ...values);
|
|
8144
|
-
if (value2 !== void 0) {
|
|
8145
|
-
result[target] = value2;
|
|
8146
|
-
}
|
|
8147
|
-
};
|
|
8148
|
-
assignFirstPresent("runId", normalized.id, runField("runId"), runField("id"));
|
|
8149
|
-
assignFirstPresent("organizationId", runField("organizationId"));
|
|
8150
|
-
assignFirstPresent("triggerType", runField("triggerType"));
|
|
8151
|
-
assignFirstPresent("scope", runField("scope"));
|
|
8152
|
-
assignFirstPresent("status", runField("status"));
|
|
8153
|
-
assignFirstPresent("createdAt", runField("createdAt"));
|
|
8154
|
-
assignFirstPresent("updatedAt", runField("updatedAt"));
|
|
8155
|
-
assignFirstPresent("startedAt", runField("startedAt"));
|
|
8156
|
-
assignFirstPresent("completedAt", runField("completedAt"));
|
|
8157
|
-
assignFirstPresent("countSemantics", runField("countSemantics"));
|
|
8158
|
-
assignFirstPresent(
|
|
8159
|
-
"scannedFileCount",
|
|
8160
|
-
normalized.scanned,
|
|
8161
|
-
runField("scannedFileCount"),
|
|
8162
|
-
runField("scanned")
|
|
8163
|
-
);
|
|
8164
|
-
assignFirstPresent(
|
|
8165
|
-
"changedFileCount",
|
|
8166
|
-
normalized.changed,
|
|
8167
|
-
runField("changedFileCount"),
|
|
8168
|
-
runField("changed")
|
|
8169
|
-
);
|
|
8170
|
-
assignFirstPresent(
|
|
8171
|
-
"unchangedFileCount",
|
|
8172
|
-
normalized.unchanged,
|
|
8173
|
-
runField("unchangedFileCount"),
|
|
8174
|
-
runField("unchanged")
|
|
8175
|
-
);
|
|
8176
|
-
assignFirstPresent(
|
|
8177
|
-
"updatedFileCount",
|
|
8178
|
-
normalized.updated,
|
|
8179
|
-
runField("updatedFileCount"),
|
|
8180
|
-
runField("updated")
|
|
8181
|
-
);
|
|
8182
|
-
assignFirstPresent(
|
|
8183
|
-
"skippedFileCount",
|
|
8184
|
-
normalized.skipped,
|
|
8185
|
-
runField("skippedFileCount"),
|
|
8186
|
-
runField("skipped")
|
|
8187
|
-
);
|
|
8188
|
-
assignFirstPresent("lintStatus", runField("lintStatus"));
|
|
8189
|
-
assignFirstPresent("errorCount", runField("errorCount"));
|
|
8190
|
-
assignFirstPresent("warningCount", runField("warningCount"));
|
|
8191
|
-
assignFirstPresent("reportPath", runField("reportPath"));
|
|
8192
|
-
assignFirstPresent("plannedReads", runField("plannedReads"), runField("plannedReadFiles"));
|
|
8193
|
-
assignFirstPresent("plannedWrites", runField("plannedWrites"), runField("plannedWriteFiles"));
|
|
8194
|
-
assignFirstPresent("changedFiles", runField("changedFiles"));
|
|
8195
|
-
assignFirstPresent("unchangedFiles", runField("unchangedFiles"));
|
|
8196
|
-
assignFirstPresent("updatedFiles", runField("updatedFiles"));
|
|
8197
|
-
assignFirstPresent("skippedFiles", runField("skippedFiles"));
|
|
8198
|
-
assignFirstPresent("lintPlan", runField("lintPlan"));
|
|
8199
|
-
assignFirstPresent("lintSummary", runField("lintSummary"));
|
|
8200
|
-
assignFirstPresent("lintResult", runField("lintResult"));
|
|
8201
|
-
assignFirstPresent("notification", runField("notification"));
|
|
8202
|
-
assignFirstPresent("notificationId", runField("notificationId"));
|
|
8203
|
-
assignFirstPresent("notificationStatus", runField("notificationStatus"));
|
|
8204
|
-
return result;
|
|
8205
|
-
}
|
|
8206
8179
|
function buildSuccessEnvelope(params) {
|
|
8207
8180
|
return {
|
|
8208
8181
|
ok: true,
|
|
@@ -8622,51 +8595,6 @@ async function runOsmdIngestFlow(params) {
|
|
|
8622
8595
|
})
|
|
8623
8596
|
});
|
|
8624
8597
|
}
|
|
8625
|
-
async function runOsmdPhantomPhaseOne(params) {
|
|
8626
|
-
const runtimeOptions = {
|
|
8627
|
-
...params.runtimeOptions,
|
|
8628
|
-
timeoutMs: params.runtimeOptions.timeoutMs ?? defaultOsmdPhantomTimeoutMs
|
|
8629
|
-
};
|
|
8630
|
-
const result = await requestOsmdMutationPayload({
|
|
8631
|
-
command: params.command,
|
|
8632
|
-
operationName: "RunPhantomOsmdMaintenance",
|
|
8633
|
-
operationType: "mutation",
|
|
8634
|
-
runtimeOptions,
|
|
8635
|
-
field: "run_phantom_osmd_maintenance",
|
|
8636
|
-
variables: {
|
|
8637
|
-
organization_id: params.organizationId,
|
|
8638
|
-
dry_run: params.dryRun
|
|
8639
|
-
}
|
|
8640
|
-
});
|
|
8641
|
-
const parsedData = osmdPhantomResultSchema.safeParse(
|
|
8642
|
-
normalizeAgentMarkdownJsonKeys(result.payload.data)
|
|
8643
|
-
);
|
|
8644
|
-
if (!parsedData.success) {
|
|
8645
|
-
return printInvalidPayloadError({
|
|
8646
|
-
command: params.command,
|
|
8647
|
-
requestId: result.requestId,
|
|
8648
|
-
issues: parsedData.error.issues
|
|
8649
|
-
});
|
|
8650
|
-
}
|
|
8651
|
-
const data = {
|
|
8652
|
-
...parsedData.data,
|
|
8653
|
-
organizationId: parsedData.data.organizationId ?? params.organizationId,
|
|
8654
|
-
triggerType: parsedData.data.triggerType ?? "manual"
|
|
8655
|
-
};
|
|
8656
|
-
if (params.readable) {
|
|
8657
|
-
return printTextAndExit({
|
|
8658
|
-
text: formatOsmdPhantomHuman(data, params.dryRun)
|
|
8659
|
-
});
|
|
8660
|
-
}
|
|
8661
|
-
return printEnvelopeAndExit({
|
|
8662
|
-
envelope: buildSuccessEnvelope({
|
|
8663
|
-
command: params.command,
|
|
8664
|
-
status: result.payload.status,
|
|
8665
|
-
data,
|
|
8666
|
-
requestId: result.requestId
|
|
8667
|
-
})
|
|
8668
|
-
});
|
|
8669
|
-
}
|
|
8670
8598
|
function normalizeAgentFilePath(file) {
|
|
8671
8599
|
const trimmed = nonEmptyString3.parse(file).trim().replace(/^\/+|\/+$/g, "");
|
|
8672
8600
|
const fileName = trimmed.startsWith(".agent/") ? trimmed.slice(".agent/".length) : trimmed;
|
|
@@ -9077,62 +9005,6 @@ function formatIngestFileList(files) {
|
|
|
9077
9005
|
return `- ${path}${action}`;
|
|
9078
9006
|
});
|
|
9079
9007
|
}
|
|
9080
|
-
function fileRecordPath(file) {
|
|
9081
|
-
return typeof file.path === "string" && file.path.trim() !== "" ? file.path : null;
|
|
9082
|
-
}
|
|
9083
|
-
function isAgentNotesWrite(file) {
|
|
9084
|
-
const path = fileRecordPath(file);
|
|
9085
|
-
return path !== null && /(?:^|\/)\.agent\/notes\.md$/.test(path);
|
|
9086
|
-
}
|
|
9087
|
-
function formatNotesWriteSummary(files) {
|
|
9088
|
-
const notesWrites = files.filter(isAgentNotesWrite);
|
|
9089
|
-
if (notesWrites.length === 0) {
|
|
9090
|
-
return ["notes.md writes: none"];
|
|
9091
|
-
}
|
|
9092
|
-
return ["notes.md writes:", ...formatIngestFileList(notesWrites)];
|
|
9093
|
-
}
|
|
9094
|
-
function skippedReasonForFile(file) {
|
|
9095
|
-
for (const key of ["reason", "skipReason", "errorCode", "suggestedAction", "status"]) {
|
|
9096
|
-
const value = file[key];
|
|
9097
|
-
if (typeof value === "string" && value.trim() !== "") {
|
|
9098
|
-
return value;
|
|
9099
|
-
}
|
|
9100
|
-
}
|
|
9101
|
-
return "unspecified";
|
|
9102
|
-
}
|
|
9103
|
-
function formatSkippedFilesByReason(files) {
|
|
9104
|
-
if (files.length === 0) {
|
|
9105
|
-
return ["- none"];
|
|
9106
|
-
}
|
|
9107
|
-
const groups = /* @__PURE__ */ new Map();
|
|
9108
|
-
for (const file of files) {
|
|
9109
|
-
const reason = skippedReasonForFile(file);
|
|
9110
|
-
const existing = groups.get(reason) ?? [];
|
|
9111
|
-
existing.push(file);
|
|
9112
|
-
groups.set(reason, existing);
|
|
9113
|
-
}
|
|
9114
|
-
const lines = [];
|
|
9115
|
-
for (const [reason, records] of groups.entries()) {
|
|
9116
|
-
lines.push(`- ${reason}`);
|
|
9117
|
-
for (const record of records) {
|
|
9118
|
-
lines.push(` - ${fileRecordPath(record) ?? "-"}`);
|
|
9119
|
-
}
|
|
9120
|
-
}
|
|
9121
|
-
return lines;
|
|
9122
|
-
}
|
|
9123
|
-
function dedupeOsmdFileRecords(files) {
|
|
9124
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9125
|
-
const deduped = [];
|
|
9126
|
-
for (const file of files) {
|
|
9127
|
-
const key = file.path;
|
|
9128
|
-
if (typeof key !== "string" || key.trim() === "" || seen.has(key)) {
|
|
9129
|
-
continue;
|
|
9130
|
-
}
|
|
9131
|
-
seen.add(key);
|
|
9132
|
-
deduped.push(file);
|
|
9133
|
-
}
|
|
9134
|
-
return deduped;
|
|
9135
|
-
}
|
|
9136
9008
|
function formatSkippedUpdateList(skippedUpdates) {
|
|
9137
9009
|
if (skippedUpdates.length === 0) {
|
|
9138
9010
|
return ["- none"];
|
|
@@ -9171,72 +9043,6 @@ function formatOsmdIngestHuman(data) {
|
|
|
9171
9043
|
function formatNullableNumberHumanField(value) {
|
|
9172
9044
|
return typeof value === "number" ? String(value) : "-";
|
|
9173
9045
|
}
|
|
9174
|
-
function formatNotificationHuman(notification) {
|
|
9175
|
-
if (!notification) {
|
|
9176
|
-
return "-";
|
|
9177
|
-
}
|
|
9178
|
-
const id = formatNullableHumanField(notification.id);
|
|
9179
|
-
const status = formatNullableHumanField(notification.status);
|
|
9180
|
-
return `id=${id} status=${status}`;
|
|
9181
|
-
}
|
|
9182
|
-
function formatPhantomTimestampLines(data) {
|
|
9183
|
-
const lines = [];
|
|
9184
|
-
if (data.startedAt) {
|
|
9185
|
-
lines.push(`Started at: ${data.startedAt}`);
|
|
9186
|
-
}
|
|
9187
|
-
if (data.completedAt) {
|
|
9188
|
-
lines.push(`Completed at: ${data.completedAt}`);
|
|
9189
|
-
}
|
|
9190
|
-
if (data.createdAt) {
|
|
9191
|
-
lines.push(`Created at: ${data.createdAt}`);
|
|
9192
|
-
}
|
|
9193
|
-
if (data.updatedAt) {
|
|
9194
|
-
lines.push(`Updated at: ${data.updatedAt}`);
|
|
9195
|
-
}
|
|
9196
|
-
return lines;
|
|
9197
|
-
}
|
|
9198
|
-
function formatOsmdPhantomHuman(data, dryRun) {
|
|
9199
|
-
const lines = [
|
|
9200
|
-
dryRun ? "Phantom Phase 1 plan" : "Phantom Phase 1 run",
|
|
9201
|
-
`Run ID: ${formatNullableHumanField(data.runId)}`,
|
|
9202
|
-
`Status: ${formatNullableHumanField(data.status)}`,
|
|
9203
|
-
...formatPhantomTimestampLines(data),
|
|
9204
|
-
`Organization ID: ${formatNullableHumanField(data.organizationId)}`,
|
|
9205
|
-
`Trigger type: ${formatNullableHumanField(data.triggerType)}`,
|
|
9206
|
-
`Scope: ${formatNullableHumanField(data.scope ?? data.subtree)}`,
|
|
9207
|
-
...data.countSemantics === null || data.countSemantics === void 0 ? [] : [`Count semantics: ${formatUnknownHuman(data.countSemantics)}`],
|
|
9208
|
-
`Reviewed OSMD/agent markdown entries: ${formatNullableNumberHumanField(data.scannedFileCount)}`,
|
|
9209
|
-
`Changed entries: ${formatNullableNumberHumanField(data.changedFileCount)}`,
|
|
9210
|
-
`Unchanged entries: ${formatNullableNumberHumanField(data.unchangedFileCount)}`,
|
|
9211
|
-
`Updated files: ${formatNullableNumberHumanField(data.updatedFileCount)}`,
|
|
9212
|
-
`Skipped entries: ${formatNullableNumberHumanField(data.skippedFileCount)}`,
|
|
9213
|
-
`Lint status: ${formatNullableHumanField(data.lintStatus)}`,
|
|
9214
|
-
`Errors: ${formatNullableNumberHumanField(data.errorCount)}`,
|
|
9215
|
-
`Warnings: ${formatNullableNumberHumanField(data.warningCount)}`,
|
|
9216
|
-
`Report path: ${formatNullableHumanField(data.reportPath)}`,
|
|
9217
|
-
`Notification: ${formatNotificationHuman(data.notification)}`,
|
|
9218
|
-
"",
|
|
9219
|
-
"Planned reads:",
|
|
9220
|
-
...formatIngestFileList(data.plannedReads),
|
|
9221
|
-
"",
|
|
9222
|
-
"Planned semantic memory writes:",
|
|
9223
|
-
...formatIngestFileList(data.plannedWrites),
|
|
9224
|
-
...dryRun ? formatNotesWriteSummary(data.plannedWrites) : [],
|
|
9225
|
-
"",
|
|
9226
|
-
"Changed entries:",
|
|
9227
|
-
...formatIngestFileList(data.changedFiles),
|
|
9228
|
-
"",
|
|
9229
|
-
"Updated files:",
|
|
9230
|
-
...formatIngestFileList(data.updatedFiles),
|
|
9231
|
-
"",
|
|
9232
|
-
"Skipped nodes by reason:",
|
|
9233
|
-
...formatSkippedFilesByReason(data.skippedFiles),
|
|
9234
|
-
"",
|
|
9235
|
-
"Lint plan:",
|
|
9236
|
-
formatUnknownHuman(data.lintPlan)
|
|
9237
|
-
];
|
|
9238
|
-
return lines.join("\n");
|
|
9239
|
-
}
|
|
9240
9046
|
function parseSearchLimit(value) {
|
|
9241
9047
|
const raw = value === void 0 || value === null || value === "" ? "10" : value;
|
|
9242
9048
|
const parsed = positiveInt.safeParse(raw);
|
|
@@ -10004,18 +9810,6 @@ function registerOsmdCommands(program) {
|
|
|
10004
9810
|
throw error;
|
|
10005
9811
|
}
|
|
10006
9812
|
});
|
|
10007
|
-
const phantom = osmd.command("phantom").description("Backend-owned Phantom Phase 1 manual operations");
|
|
10008
|
-
phantom.command("run").description("Manually run or plan Phantom Phase 1 for OSMD/agent semantic memory").option("--dry-run", "Ask backend for the Phantom Phase 1 plan without mutating").option("--readable", "Print a human-readable Phantom summary instead of JSON").action(async (opts, cmd) => {
|
|
10009
|
-
const command = "osmd.phantom.run";
|
|
10010
|
-
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
10011
|
-
return runOsmdPhantomPhaseOne({
|
|
10012
|
-
command,
|
|
10013
|
-
runtimeOptions,
|
|
10014
|
-
organizationId,
|
|
10015
|
-
dryRun: opts.dryRun === true,
|
|
10016
|
-
readable: opts.readable === true
|
|
10017
|
-
});
|
|
10018
|
-
});
|
|
10019
9813
|
const agent = osmd.command("agent").description(".agent markdown attached to canonical OSMD parents");
|
|
10020
9814
|
agent.command("status <parent-ref> <file>").description("Show .agent file metadata without creating files").action(async (parentRef, file, _opts, cmd) => {
|
|
10021
9815
|
const { organizationId, runtimeOptions } = await resolveOsmdContext(cmd);
|
|
@@ -13011,14 +12805,14 @@ function registerMailCommands(program) {
|
|
|
13011
12805
|
}
|
|
13012
12806
|
|
|
13013
12807
|
// src/commands/phantom.ts
|
|
13014
|
-
import { z as
|
|
13015
|
-
var nonNegativeInt4 =
|
|
13016
|
-
var nullableString =
|
|
13017
|
-
var idString =
|
|
13018
|
-
var nullableIdString =
|
|
12808
|
+
import { z as z19 } from "zod";
|
|
12809
|
+
var nonNegativeInt4 = z19.coerce.number().int().min(0);
|
|
12810
|
+
var nullableString = z19.string().nullable().optional().transform((value) => value ?? null);
|
|
12811
|
+
var idString = z19.union([z19.string(), z19.number()]).transform((value) => String(value));
|
|
12812
|
+
var nullableIdString = z19.union([z19.string(), z19.number()]).nullable().optional().transform(
|
|
13019
12813
|
(value) => value === void 0 || value === null ? null : String(value)
|
|
13020
12814
|
);
|
|
13021
|
-
var jsonObject =
|
|
12815
|
+
var jsonObject = z19.record(z19.string(), z19.unknown());
|
|
13022
12816
|
var PHANTOM_LEDGER_INVENTORY_SELECTION = `{
|
|
13023
12817
|
schemaVersion
|
|
13024
12818
|
runsCount
|
|
@@ -13231,10 +13025,10 @@ var PHANTOM_LEDGER_KEY_ALIASES = {
|
|
|
13231
13025
|
content_hash: "contentHash",
|
|
13232
13026
|
observed_at: "observedAt"
|
|
13233
13027
|
};
|
|
13234
|
-
var phantomLedgerInventorySchema =
|
|
13028
|
+
var phantomLedgerInventorySchema = z19.preprocess(
|
|
13235
13029
|
normalizePhantomLedgerKeys,
|
|
13236
|
-
|
|
13237
|
-
schemaVersion:
|
|
13030
|
+
z19.object({
|
|
13031
|
+
schemaVersion: z19.string(),
|
|
13238
13032
|
runsCount: nonNegativeInt4,
|
|
13239
13033
|
observationsCount: nonNegativeInt4,
|
|
13240
13034
|
candidatesCount: nonNegativeInt4,
|
|
@@ -13244,16 +13038,16 @@ var phantomLedgerInventorySchema = z18.preprocess(
|
|
|
13244
13038
|
reportsCount: nonNegativeInt4
|
|
13245
13039
|
})
|
|
13246
13040
|
);
|
|
13247
|
-
var phantomRunSchema =
|
|
13041
|
+
var phantomRunSchema = z19.preprocess(
|
|
13248
13042
|
normalizePhantomLedgerKeys,
|
|
13249
|
-
|
|
13043
|
+
z19.object({
|
|
13250
13044
|
id: idString,
|
|
13251
13045
|
organizationId: idString,
|
|
13252
|
-
notificationId:
|
|
13046
|
+
notificationId: z19.union([z19.string(), z19.number()]).nullable().optional().transform(
|
|
13253
13047
|
(value) => value === void 0 || value === null ? null : String(value)
|
|
13254
13048
|
),
|
|
13255
|
-
status:
|
|
13256
|
-
triggerType:
|
|
13049
|
+
status: z19.string(),
|
|
13050
|
+
triggerType: z19.string(),
|
|
13257
13051
|
startedAt: nullableString,
|
|
13258
13052
|
completedAt: nullableString,
|
|
13259
13053
|
scannedFileCount: nonNegativeInt4,
|
|
@@ -13263,163 +13057,163 @@ var phantomRunSchema = z18.preprocess(
|
|
|
13263
13057
|
errorCount: nonNegativeInt4,
|
|
13264
13058
|
warningCount: nonNegativeInt4,
|
|
13265
13059
|
errorMessage: nullableString,
|
|
13266
|
-
dryRun:
|
|
13267
|
-
schemaVersion:
|
|
13060
|
+
dryRun: z19.boolean(),
|
|
13061
|
+
schemaVersion: z19.string(),
|
|
13268
13062
|
testRunId: nullableString,
|
|
13269
13063
|
idempotencyKey: nullableString,
|
|
13270
13064
|
ledgerMetadata: jsonObject.catch({}),
|
|
13271
|
-
createdAt:
|
|
13272
|
-
updatedAt:
|
|
13065
|
+
createdAt: z19.string(),
|
|
13066
|
+
updatedAt: z19.string()
|
|
13273
13067
|
})
|
|
13274
13068
|
);
|
|
13275
|
-
var phantomRunListItemSchema =
|
|
13069
|
+
var phantomRunListItemSchema = z19.preprocess(
|
|
13276
13070
|
normalizePhantomLedgerKeys,
|
|
13277
|
-
|
|
13071
|
+
z19.object({
|
|
13278
13072
|
id: idString,
|
|
13279
13073
|
organizationId: idString,
|
|
13280
|
-
status:
|
|
13281
|
-
triggerType:
|
|
13282
|
-
dryRun:
|
|
13283
|
-
schemaVersion:
|
|
13074
|
+
status: z19.string(),
|
|
13075
|
+
triggerType: z19.string(),
|
|
13076
|
+
dryRun: z19.boolean(),
|
|
13077
|
+
schemaVersion: z19.string(),
|
|
13284
13078
|
testRunId: nullableString,
|
|
13285
|
-
createdAt:
|
|
13286
|
-
updatedAt:
|
|
13079
|
+
createdAt: z19.string(),
|
|
13080
|
+
updatedAt: z19.string()
|
|
13287
13081
|
})
|
|
13288
13082
|
);
|
|
13289
|
-
var phantomReportSchema =
|
|
13083
|
+
var phantomReportSchema = z19.preprocess(
|
|
13290
13084
|
normalizePhantomLedgerKeys,
|
|
13291
|
-
|
|
13085
|
+
z19.object({
|
|
13292
13086
|
id: idString,
|
|
13293
13087
|
organizationId: idString,
|
|
13294
13088
|
phantomRunId: idString,
|
|
13295
|
-
status:
|
|
13296
|
-
reportType:
|
|
13297
|
-
schemaVersion:
|
|
13089
|
+
status: z19.string(),
|
|
13090
|
+
reportType: z19.string(),
|
|
13091
|
+
schemaVersion: z19.string(),
|
|
13298
13092
|
markdownPath: nullableString,
|
|
13299
13093
|
payload: jsonObject.catch({}),
|
|
13300
13094
|
testRunId: nullableString,
|
|
13301
|
-
idempotencyKey:
|
|
13302
|
-
createdAt:
|
|
13303
|
-
updatedAt:
|
|
13095
|
+
idempotencyKey: z19.string(),
|
|
13096
|
+
createdAt: z19.string(),
|
|
13097
|
+
updatedAt: z19.string()
|
|
13304
13098
|
})
|
|
13305
13099
|
);
|
|
13306
|
-
var phantomObservationSchema =
|
|
13100
|
+
var phantomObservationSchema = z19.preprocess(
|
|
13307
13101
|
normalizePhantomLedgerKeys,
|
|
13308
|
-
|
|
13102
|
+
z19.object({
|
|
13309
13103
|
id: idString,
|
|
13310
13104
|
organizationId: idString,
|
|
13311
13105
|
phantomRunId: idString,
|
|
13312
|
-
status:
|
|
13313
|
-
observationType:
|
|
13106
|
+
status: z19.string(),
|
|
13107
|
+
observationType: z19.string(),
|
|
13314
13108
|
targetType: nullableString,
|
|
13315
13109
|
targetId: nullableString,
|
|
13316
13110
|
sourceTable: nullableString,
|
|
13317
13111
|
sourceRecordId: nullableString,
|
|
13318
13112
|
sourceEventId: nullableString,
|
|
13319
13113
|
contentHash: nullableString,
|
|
13320
|
-
observedAt:
|
|
13321
|
-
confidence:
|
|
13114
|
+
observedAt: z19.string(),
|
|
13115
|
+
confidence: z19.coerce.number(),
|
|
13322
13116
|
payload: jsonObject.catch({}),
|
|
13323
|
-
schemaVersion:
|
|
13117
|
+
schemaVersion: z19.string(),
|
|
13324
13118
|
testRunId: nullableString,
|
|
13325
|
-
idempotencyKey:
|
|
13326
|
-
createdAt:
|
|
13327
|
-
updatedAt:
|
|
13119
|
+
idempotencyKey: z19.string(),
|
|
13120
|
+
createdAt: z19.string(),
|
|
13121
|
+
updatedAt: z19.string()
|
|
13328
13122
|
})
|
|
13329
13123
|
);
|
|
13330
|
-
var phantomCandidateSchema =
|
|
13124
|
+
var phantomCandidateSchema = z19.preprocess(
|
|
13331
13125
|
normalizePhantomLedgerKeys,
|
|
13332
|
-
|
|
13126
|
+
z19.object({
|
|
13333
13127
|
id: idString,
|
|
13334
13128
|
organizationId: idString,
|
|
13335
13129
|
phantomRunId: idString,
|
|
13336
13130
|
phantomObservationId: nullableString,
|
|
13337
|
-
status:
|
|
13338
|
-
candidateType:
|
|
13131
|
+
status: z19.string(),
|
|
13132
|
+
candidateType: z19.string(),
|
|
13339
13133
|
targetType: nullableString,
|
|
13340
13134
|
targetId: nullableString,
|
|
13341
13135
|
title: nullableString,
|
|
13342
|
-
dryRun:
|
|
13136
|
+
dryRun: z19.boolean(),
|
|
13343
13137
|
payload: jsonObject.catch({}),
|
|
13344
|
-
approvalStatus:
|
|
13138
|
+
approvalStatus: z19.string(),
|
|
13345
13139
|
approvedById: nullableIdString,
|
|
13346
13140
|
approvedAt: nullableString,
|
|
13347
13141
|
approvalSource: nullableString,
|
|
13348
13142
|
approvalReason: nullableString,
|
|
13349
13143
|
approvalMetadata: jsonObject.catch({}),
|
|
13350
|
-
schemaVersion:
|
|
13144
|
+
schemaVersion: z19.string(),
|
|
13351
13145
|
testRunId: nullableString,
|
|
13352
|
-
idempotencyKey:
|
|
13353
|
-
createdAt:
|
|
13354
|
-
updatedAt:
|
|
13146
|
+
idempotencyKey: z19.string(),
|
|
13147
|
+
createdAt: z19.string(),
|
|
13148
|
+
updatedAt: z19.string()
|
|
13355
13149
|
})
|
|
13356
13150
|
);
|
|
13357
|
-
var phantomCandidateEvidenceSchema =
|
|
13151
|
+
var phantomCandidateEvidenceSchema = z19.preprocess(
|
|
13358
13152
|
normalizePhantomLedgerKeys,
|
|
13359
|
-
|
|
13153
|
+
z19.object({
|
|
13360
13154
|
id: idString,
|
|
13361
13155
|
organizationId: idString,
|
|
13362
13156
|
phantomCandidateId: idString,
|
|
13363
13157
|
phantomObservationId: nullableString,
|
|
13364
|
-
evidenceType:
|
|
13158
|
+
evidenceType: z19.string(),
|
|
13365
13159
|
sourceType: nullableString,
|
|
13366
13160
|
sourceId: nullableString,
|
|
13367
13161
|
contentHash: nullableString,
|
|
13368
13162
|
payload: jsonObject.catch({}),
|
|
13369
|
-
schemaVersion:
|
|
13163
|
+
schemaVersion: z19.string(),
|
|
13370
13164
|
testRunId: nullableString,
|
|
13371
|
-
idempotencyKey:
|
|
13372
|
-
createdAt:
|
|
13373
|
-
updatedAt:
|
|
13165
|
+
idempotencyKey: z19.string(),
|
|
13166
|
+
createdAt: z19.string(),
|
|
13167
|
+
updatedAt: z19.string()
|
|
13374
13168
|
})
|
|
13375
13169
|
);
|
|
13376
|
-
var phantomValidationSchema =
|
|
13170
|
+
var phantomValidationSchema = z19.preprocess(
|
|
13377
13171
|
normalizePhantomLedgerKeys,
|
|
13378
|
-
|
|
13172
|
+
z19.object({
|
|
13379
13173
|
id: idString,
|
|
13380
13174
|
organizationId: idString,
|
|
13381
13175
|
phantomRunId: idString,
|
|
13382
13176
|
phantomCandidateId: idString,
|
|
13383
|
-
status:
|
|
13384
|
-
validationType:
|
|
13385
|
-
dryRun:
|
|
13177
|
+
status: z19.string(),
|
|
13178
|
+
validationType: z19.string(),
|
|
13179
|
+
dryRun: z19.boolean(),
|
|
13386
13180
|
payload: jsonObject.catch({}),
|
|
13387
13181
|
resultPayload: jsonObject.catch({}),
|
|
13388
|
-
schemaVersion:
|
|
13182
|
+
schemaVersion: z19.string(),
|
|
13389
13183
|
testRunId: nullableString,
|
|
13390
|
-
idempotencyKey:
|
|
13391
|
-
createdAt:
|
|
13392
|
-
updatedAt:
|
|
13184
|
+
idempotencyKey: z19.string(),
|
|
13185
|
+
createdAt: z19.string(),
|
|
13186
|
+
updatedAt: z19.string()
|
|
13393
13187
|
})
|
|
13394
13188
|
);
|
|
13395
|
-
var phantomApplyOperationSchema =
|
|
13189
|
+
var phantomApplyOperationSchema = z19.preprocess(
|
|
13396
13190
|
normalizePhantomLedgerKeys,
|
|
13397
|
-
|
|
13191
|
+
z19.object({
|
|
13398
13192
|
id: idString,
|
|
13399
13193
|
organizationId: idString,
|
|
13400
13194
|
phantomRunId: idString,
|
|
13401
13195
|
phantomCandidateId: idString,
|
|
13402
|
-
status:
|
|
13403
|
-
operationType:
|
|
13404
|
-
dryRun:
|
|
13196
|
+
status: z19.string(),
|
|
13197
|
+
operationType: z19.string(),
|
|
13198
|
+
dryRun: z19.boolean(),
|
|
13405
13199
|
targetType: nullableString,
|
|
13406
13200
|
targetId: nullableString,
|
|
13407
13201
|
payload: jsonObject.catch({}),
|
|
13408
13202
|
resultPayload: jsonObject.catch({}),
|
|
13409
|
-
schemaVersion:
|
|
13203
|
+
schemaVersion: z19.string(),
|
|
13410
13204
|
testRunId: nullableString,
|
|
13411
|
-
idempotencyKey:
|
|
13412
|
-
createdAt:
|
|
13413
|
-
updatedAt:
|
|
13205
|
+
idempotencyKey: z19.string(),
|
|
13206
|
+
createdAt: z19.string(),
|
|
13207
|
+
updatedAt: z19.string()
|
|
13414
13208
|
})
|
|
13415
13209
|
);
|
|
13416
|
-
var phantomRunsSchema =
|
|
13417
|
-
var phantomReportsSchema =
|
|
13418
|
-
var phantomObservationsSchema =
|
|
13419
|
-
var phantomCandidatesSchema =
|
|
13420
|
-
var phantomCandidateEvidencesSchema =
|
|
13421
|
-
var phantomValidationsSchema =
|
|
13422
|
-
var phantomApplyOperationsSchema =
|
|
13210
|
+
var phantomRunsSchema = z19.array(phantomRunListItemSchema);
|
|
13211
|
+
var phantomReportsSchema = z19.array(phantomReportSchema);
|
|
13212
|
+
var phantomObservationsSchema = z19.array(phantomObservationSchema);
|
|
13213
|
+
var phantomCandidatesSchema = z19.array(phantomCandidateSchema);
|
|
13214
|
+
var phantomCandidateEvidencesSchema = z19.array(phantomCandidateEvidenceSchema);
|
|
13215
|
+
var phantomValidationsSchema = z19.array(phantomValidationSchema);
|
|
13216
|
+
var phantomApplyOperationsSchema = z19.array(phantomApplyOperationSchema);
|
|
13423
13217
|
function isRecord6(value) {
|
|
13424
13218
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
13425
13219
|
}
|
|
@@ -14876,79 +14670,77 @@ function registerDatasheetsCommands(program) {
|
|
|
14876
14670
|
}
|
|
14877
14671
|
|
|
14878
14672
|
// src/commands/atlasAuthoring.ts
|
|
14879
|
-
import { z as
|
|
14880
|
-
var idSchema14 =
|
|
14881
|
-
var idempotencyKeySchema =
|
|
14882
|
-
var skillScopeSchema =
|
|
14883
|
-
var isoDateSchema =
|
|
14884
|
-
var nonEmptyStringSchema =
|
|
14673
|
+
import { z as z20 } from "zod";
|
|
14674
|
+
var idSchema14 = z20.string().trim().min(1);
|
|
14675
|
+
var idempotencyKeySchema = z20.string().min(1).refine((value) => value.trim() === value, "Idempotency key must not have leading or trailing whitespace.");
|
|
14676
|
+
var skillScopeSchema = z20.enum(["ADMIN_GLOBAL", "MEMBER_PERSONAL"]);
|
|
14677
|
+
var isoDateSchema = z20.iso.date();
|
|
14678
|
+
var nonEmptyStringSchema = z20.string().trim().min(1);
|
|
14885
14679
|
var AUTOMATION_RUN_HTTP_TIMEOUT_MS = 6e4;
|
|
14886
|
-
var agentToolAccessSchema =
|
|
14887
|
-
|
|
14680
|
+
var agentToolAccessSchema = z20.array(
|
|
14681
|
+
z20.object({
|
|
14888
14682
|
tool_key: nonEmptyStringSchema,
|
|
14889
14683
|
scope_value: nonEmptyStringSchema
|
|
14890
14684
|
}).strict()
|
|
14891
14685
|
).min(1);
|
|
14892
14686
|
var agentToolAccessUpdateSchema = agentToolAccessSchema.min(0);
|
|
14893
|
-
var agentPluginConnectionsSchema =
|
|
14894
|
-
|
|
14687
|
+
var agentPluginConnectionsSchema = z20.array(
|
|
14688
|
+
z20.object({
|
|
14895
14689
|
external_tool_connection_id: nonEmptyStringSchema,
|
|
14896
14690
|
tool_key: nonEmptyStringSchema,
|
|
14897
14691
|
scope_value: nonEmptyStringSchema.optional(),
|
|
14898
|
-
allowed_tools:
|
|
14899
|
-
allowed_scopes:
|
|
14900
|
-
requires_confirmation:
|
|
14901
|
-
enabled:
|
|
14692
|
+
allowed_tools: z20.array(nonEmptyStringSchema).optional(),
|
|
14693
|
+
allowed_scopes: z20.array(nonEmptyStringSchema).optional(),
|
|
14694
|
+
requires_confirmation: z20.boolean().optional(),
|
|
14695
|
+
enabled: z20.boolean().optional()
|
|
14902
14696
|
}).strict()
|
|
14903
14697
|
).min(1);
|
|
14904
|
-
var agentPluginConnectionUpdateSchema =
|
|
14905
|
-
|
|
14906
|
-
|
|
14698
|
+
var agentPluginConnectionUpdateSchema = z20.array(
|
|
14699
|
+
z20.union([
|
|
14700
|
+
z20.object({
|
|
14907
14701
|
id: nonEmptyStringSchema,
|
|
14908
|
-
_destroy:
|
|
14702
|
+
_destroy: z20.literal(true)
|
|
14909
14703
|
}).strict(),
|
|
14910
|
-
|
|
14704
|
+
z20.object({
|
|
14911
14705
|
id: nonEmptyStringSchema.optional(),
|
|
14912
14706
|
external_tool_connection_id: nonEmptyStringSchema.optional(),
|
|
14913
14707
|
tool_key: nonEmptyStringSchema.optional(),
|
|
14914
14708
|
scope_value: nonEmptyStringSchema.optional(),
|
|
14915
|
-
allowed_tools:
|
|
14916
|
-
allowed_scopes:
|
|
14917
|
-
requires_confirmation:
|
|
14918
|
-
enabled:
|
|
14709
|
+
allowed_tools: z20.array(nonEmptyStringSchema).optional(),
|
|
14710
|
+
allowed_scopes: z20.array(nonEmptyStringSchema).optional(),
|
|
14711
|
+
requires_confirmation: z20.boolean().optional(),
|
|
14712
|
+
enabled: z20.boolean().optional()
|
|
14919
14713
|
}).strict().superRefine((value, context) => {
|
|
14920
14714
|
if (value.id || value.external_tool_connection_id && value.tool_key) return;
|
|
14921
14715
|
context.addIssue({
|
|
14922
|
-
code:
|
|
14716
|
+
code: z20.ZodIssueCode.custom,
|
|
14923
14717
|
message: "Plugin updates require an id, or both external_tool_connection_id and tool_key for a new grant."
|
|
14924
14718
|
});
|
|
14925
14719
|
})
|
|
14926
14720
|
])
|
|
14927
14721
|
);
|
|
14928
|
-
var agentTriggerSchema =
|
|
14929
|
-
trigger_type:
|
|
14722
|
+
var agentTriggerSchema = z20.object({
|
|
14723
|
+
trigger_type: z20.literal("cron"),
|
|
14930
14724
|
cron_expression: nonEmptyStringSchema,
|
|
14931
14725
|
timezone: nonEmptyStringSchema,
|
|
14932
|
-
starts_at:
|
|
14933
|
-
ends_at:
|
|
14934
|
-
max_runs:
|
|
14935
|
-
enabled:
|
|
14726
|
+
starts_at: z20.iso.datetime({ offset: true }).nullable().optional(),
|
|
14727
|
+
ends_at: z20.iso.datetime({ offset: true }).nullable().optional(),
|
|
14728
|
+
max_runs: z20.number().int().positive().nullable().optional(),
|
|
14729
|
+
enabled: z20.boolean().optional()
|
|
14936
14730
|
}).strict();
|
|
14937
|
-
var agentTriggerUpdateSchema =
|
|
14731
|
+
var agentTriggerUpdateSchema = z20.union([
|
|
14938
14732
|
agentTriggerSchema.extend({ id: nonEmptyStringSchema.optional() }).strict(),
|
|
14939
|
-
|
|
14733
|
+
z20.object({
|
|
14940
14734
|
id: nonEmptyStringSchema,
|
|
14941
|
-
_destroy:
|
|
14735
|
+
_destroy: z20.literal(true)
|
|
14942
14736
|
}).strict()
|
|
14943
14737
|
]);
|
|
14944
|
-
var automationConfigSchema =
|
|
14738
|
+
var automationConfigSchema = z20.record(z20.string(), z20.unknown());
|
|
14945
14739
|
var AGENT_SELECTION = `{
|
|
14946
14740
|
id
|
|
14947
14741
|
type
|
|
14948
14742
|
name
|
|
14949
14743
|
slug
|
|
14950
|
-
description
|
|
14951
|
-
notes
|
|
14952
14744
|
status
|
|
14953
14745
|
visibility
|
|
14954
14746
|
model
|
|
@@ -15225,7 +15017,16 @@ function normalizeAutomationRunPayload(payload) {
|
|
|
15225
15017
|
};
|
|
15226
15018
|
}
|
|
15227
15019
|
function parseAutomationConfig(value) {
|
|
15228
|
-
|
|
15020
|
+
const config = automationConfigSchema.parse(parseJson(String(value), "--ai-task-config"));
|
|
15021
|
+
if (Object.hasOwn(config, "agent_id") || Object.hasOwn(config, "agentId")) {
|
|
15022
|
+
throw new CliError({
|
|
15023
|
+
message: "Automation executor agent_id must be supplied through --agent-id, not --ai-task-config.",
|
|
15024
|
+
kind: "invalid_args",
|
|
15025
|
+
status: 400,
|
|
15026
|
+
exitCode: EXIT_CODES.invalidArgs
|
|
15027
|
+
});
|
|
15028
|
+
}
|
|
15029
|
+
return config;
|
|
15229
15030
|
}
|
|
15230
15031
|
function parseExpectedUpdateVersion(value) {
|
|
15231
15032
|
return nonEmptyStringSchema.parse(String(value));
|
|
@@ -15434,7 +15235,7 @@ function registerAtlasAuthoringCommands(program) {
|
|
|
15434
15235
|
"--service <service>",
|
|
15435
15236
|
"Supported service: gmail, calendar, slack, or stripe"
|
|
15436
15237
|
).action(async (opts, cmd) => {
|
|
15437
|
-
const service =
|
|
15238
|
+
const service = z20.enum(["gmail", "calendar", "slack", "stripe"]).parse(opts.service);
|
|
15438
15239
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
15439
15240
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
15440
15241
|
await runGraphqlQueryCommand({
|
|
@@ -15448,7 +15249,7 @@ function registerAtlasAuthoringCommands(program) {
|
|
|
15448
15249
|
});
|
|
15449
15250
|
});
|
|
15450
15251
|
const automations = program.command("automations").description("Bounded Automation authoring operations");
|
|
15451
|
-
automations.command("create").description("Create a Backlog Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").
|
|
15252
|
+
automations.command("create").description("Create a Backlog Automation through the API-owned createAutomation contract").requiredOption("--summary <summary>").requiredOption("--ai-task-config <json>", "Valid JSON for the API-owned ai_task_config field").requiredOption("--idempotency-key <key>", "Required create idempotency key").option("--description <description>").option("--notes <notes>").option("--member-id <memberId>").requiredOption("--agent-id <agentId>", "Required executor Agent id").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").action(async (opts, cmd) => {
|
|
15452
15253
|
const idempotencyKey = idempotencyKeySchema.parse(opts.idempotencyKey);
|
|
15453
15254
|
const context = await resolveCommandContext(cmd.optsWithGlobals());
|
|
15454
15255
|
const organizationId = resolveOrganizationId(context.organizationId);
|
|
@@ -15466,7 +15267,7 @@ function registerAtlasAuthoringCommands(program) {
|
|
|
15466
15267
|
organization_id: organizationId,
|
|
15467
15268
|
input: {
|
|
15468
15269
|
summary: idSchema14.parse(opts.summary),
|
|
15469
|
-
ai_task_config:
|
|
15270
|
+
ai_task_config: parseAutomationConfig(opts.aiTaskConfig),
|
|
15470
15271
|
...opts.description !== void 0 ? { description: String(opts.description) } : {},
|
|
15471
15272
|
...opts.notes !== void 0 ? { notes: String(opts.notes) } : {},
|
|
15472
15273
|
...opts.memberId !== void 0 ? { member_id: idSchema14.parse(opts.memberId) } : {},
|
|
@@ -15537,20 +15338,17 @@ function registerAtlasAuthoringCommands(program) {
|
|
|
15537
15338
|
"Exact opaque updateVersion value from automations show; rejects stale writes"
|
|
15538
15339
|
).option("--summary <summary>").option("--description <description>").option("--notes <notes>").option("--priority <priority>").option("--due-date <date>", "ISO-8601 date (YYYY-MM-DD)").option("--ai-task-config <json>", "Complete replacement ai_task_config JSON object").option(
|
|
15539
15340
|
"--agent-id <agentId>",
|
|
15540
|
-
"
|
|
15341
|
+
"Rejected: executor ownership is immutable after Automation creation"
|
|
15541
15342
|
).action(async (opts, cmd) => {
|
|
15542
|
-
if (opts.agentId !== void 0
|
|
15343
|
+
if (opts.agentId !== void 0) {
|
|
15543
15344
|
throw new CliError({
|
|
15544
|
-
message: "automations update
|
|
15345
|
+
message: "automations update cannot change executor ownership; create a new Automation instead.",
|
|
15545
15346
|
kind: "invalid_args",
|
|
15546
15347
|
status: 400,
|
|
15547
15348
|
exitCode: EXIT_CODES.invalidArgs
|
|
15548
15349
|
});
|
|
15549
15350
|
}
|
|
15550
|
-
const aiTaskConfig = opts.aiTaskConfig === void 0 ? void 0 :
|
|
15551
|
-
...parseAutomationConfig(opts.aiTaskConfig),
|
|
15552
|
-
...opts.agentId !== void 0 ? { agent_id: idSchema14.parse(opts.agentId) } : {}
|
|
15553
|
-
};
|
|
15351
|
+
const aiTaskConfig = opts.aiTaskConfig === void 0 ? void 0 : parseAutomationConfig(opts.aiTaskConfig);
|
|
15554
15352
|
const patch = {
|
|
15555
15353
|
...opts.summary !== void 0 ? { summary: String(opts.summary) } : {},
|
|
15556
15354
|
...opts.description !== void 0 ? { description: String(opts.description) } : {},
|
|
@@ -15673,7 +15471,7 @@ import { join as join3 } from "path";
|
|
|
15673
15471
|
import { createHash } from "crypto";
|
|
15674
15472
|
|
|
15675
15473
|
// src/version.ts
|
|
15676
|
-
var CLI_VERSION = "0.1.
|
|
15474
|
+
var CLI_VERSION = "0.1.77";
|
|
15677
15475
|
|
|
15678
15476
|
// src/operationMetadata.ts
|
|
15679
15477
|
var DISCOVERY_OPERATION_IDS = [
|
|
@@ -16077,7 +15875,6 @@ var WRITE_OPERATION_IDS = [
|
|
|
16077
15875
|
"osmd.ingest.text",
|
|
16078
15876
|
"osmd.ingest.transcript",
|
|
16079
15877
|
"osmd.ingest.url",
|
|
16080
|
-
"osmd.phantom.run",
|
|
16081
15878
|
"osmd.wiki.append-log",
|
|
16082
15879
|
"osmd.wiki.create",
|
|
16083
15880
|
"osmd.wiki.index-upsert",
|
|
@@ -16396,22 +16193,21 @@ var NAMESPACE_DOCS = {
|
|
|
16396
16193
|
osmd: {
|
|
16397
16194
|
name: "osmd",
|
|
16398
16195
|
tier: "primary",
|
|
16399
|
-
description: "Canonical OSMD, .agent overlay, Agent Wiki, ingest,
|
|
16196
|
+
description: "Canonical OSMD, .agent overlay, Agent Wiki, ingest, and lint operations.",
|
|
16400
16197
|
examples: [
|
|
16401
16198
|
"wave osmd tree --depth 2",
|
|
16402
16199
|
"wave osmd lint --json",
|
|
16403
16200
|
'wave osmd ingest text "Notes" --slug notes --parent-ref "projects/Wave Tools" --summary "Source notes" --dry-run',
|
|
16404
|
-
'wave osmd agent update "projects/Wave Tools" notes.md --content "# Notes"'
|
|
16405
|
-
"wave osmd phantom run --dry-run"
|
|
16201
|
+
'wave osmd agent update "projects/Wave Tools" notes.md --content "# Notes"'
|
|
16406
16202
|
],
|
|
16407
16203
|
schema: {
|
|
16408
16204
|
output: "json-envelope-default",
|
|
16409
16205
|
safety: [
|
|
16410
16206
|
"Canonical OSMD writes are blocked before mutation.",
|
|
16411
16207
|
"Agent Wiki log is append-only.",
|
|
16412
|
-
"Ingest
|
|
16208
|
+
"Ingest supports dry-run paths."
|
|
16413
16209
|
],
|
|
16414
|
-
commands: ["tree", "status", "read", "children", "search", "lint", "memory-quality", "ingest", "
|
|
16210
|
+
commands: ["tree", "status", "read", "children", "search", "lint", "memory-quality", "ingest", "agent", "wiki"]
|
|
16415
16211
|
}
|
|
16416
16212
|
},
|
|
16417
16213
|
phantom: {
|
|
@@ -17217,7 +17013,7 @@ function registerDiscoveryCommands(program) {
|
|
|
17217
17013
|
const phantom = program.commands.find((command) => command.name() === "phantom");
|
|
17218
17014
|
phantom?.addHelpText(
|
|
17219
17015
|
"after",
|
|
17220
|
-
"\nExamples:\n wave phantom inventory --json\n wave phantom observations --run-id 123 --json\n wave phantom candidates --candidate-type organization_meta_profile_update_candidate --json\n wave phantom apply-operations --status succeeded --operation-type organization_meta_profile_patch --json\n wave phantom report latest --json\n
|
|
17016
|
+
"\nExamples:\n wave phantom inventory --json\n wave phantom observations --run-id 123 --json\n wave phantom candidates --candidate-type organization_meta_profile_update_candidate --json\n wave phantom apply-operations --status succeeded --operation-type organization_meta_profile_patch --json\n wave phantom report latest --json\n"
|
|
17221
17017
|
);
|
|
17222
17018
|
}
|
|
17223
17019
|
function attachNamespaceDiscovery(program) {
|
|
@@ -17283,12 +17079,11 @@ function attachDiscoveryHelp(program) {
|
|
|
17283
17079
|
" wave capabilities list",
|
|
17284
17080
|
" wave capabilities tools",
|
|
17285
17081
|
" wave osmd lint --json",
|
|
17286
|
-
" wave osmd phantom run --dry-run",
|
|
17287
17082
|
" wave doctor"
|
|
17288
17083
|
].join("\n")
|
|
17289
17084
|
);
|
|
17290
17085
|
const helpByName = /* @__PURE__ */ new Map([
|
|
17291
|
-
["osmd", '\nExamples:\n wave osmd tree --depth 2\n wave osmd lint --json\n wave osmd agent update "projects/Wave Tools" notes.md --content "# Notes"\n
|
|
17086
|
+
["osmd", '\nExamples:\n wave osmd tree --depth 2\n wave osmd lint --json\n wave osmd agent update "projects/Wave Tools" notes.md --content "# Notes"\n'],
|
|
17292
17087
|
["broadcast", "\nExamples:\n wave broadcast list\n wave broadcast workspace\n wave broadcast community\n wave broadcast open\n"],
|
|
17293
17088
|
["support", "\nExamples:\n wave support counts --status open\n wave support tickets --status open --page 1 --per 20\n wave support knowledge-articles --collection-id 123 --visibility public\n wave support settings\n wave support open\n"],
|
|
17294
17089
|
["markdown-tree", "\nExamples:\n wave markdown-tree root --tree-view\n wave markdown-tree resolve --tool-key projects --node-key tasks --parent-id 123\n"],
|
|
@@ -17387,19 +17182,30 @@ function buildCli(options) {
|
|
|
17387
17182
|
|
|
17388
17183
|
// src/machine.ts
|
|
17389
17184
|
import { createHash as createHash2 } from "crypto";
|
|
17185
|
+
import { readSync } from "fs";
|
|
17390
17186
|
var MACHINE_FLAGS = /* @__PURE__ */ new Set([
|
|
17391
17187
|
"--machine",
|
|
17392
17188
|
"--operation",
|
|
17393
17189
|
"--phase",
|
|
17394
|
-
"--input-json"
|
|
17190
|
+
"--input-json",
|
|
17191
|
+
"--machine-auth-fd",
|
|
17192
|
+
"--machine-approval-fd"
|
|
17395
17193
|
]);
|
|
17194
|
+
var MACHINE_AUTH_FD = 3;
|
|
17195
|
+
var MACHINE_APPROVAL_FD = 4;
|
|
17196
|
+
var MAX_MACHINE_SECRET_BYTES = 64 * 1024;
|
|
17197
|
+
var MAX_MACHINE_INPUT_BYTES = 128 * 1024;
|
|
17396
17198
|
function machineEnvelope(params) {
|
|
17397
17199
|
return {
|
|
17398
17200
|
ok: params.ok,
|
|
17399
17201
|
command: params.command,
|
|
17400
17202
|
status: params.status,
|
|
17401
17203
|
data: params.data ?? null,
|
|
17402
|
-
error: params.error
|
|
17204
|
+
error: params.error ? {
|
|
17205
|
+
code: params.error.code,
|
|
17206
|
+
message: params.error.message,
|
|
17207
|
+
details: params.error.details ?? {}
|
|
17208
|
+
} : null,
|
|
17403
17209
|
meta: { requestId: "machine" }
|
|
17404
17210
|
};
|
|
17405
17211
|
}
|
|
@@ -17421,7 +17227,7 @@ function commandId(command) {
|
|
|
17421
17227
|
function parseMachineArgs(argv) {
|
|
17422
17228
|
const values = {};
|
|
17423
17229
|
for (let index = 0; index < argv.length; index += 1) {
|
|
17424
|
-
const flag = argv[index];
|
|
17230
|
+
const flag = argv[index] ?? "";
|
|
17425
17231
|
if (!MACHINE_FLAGS.has(flag)) {
|
|
17426
17232
|
return { error: `Unsupported machine flag: ${flag}` };
|
|
17427
17233
|
}
|
|
@@ -17436,19 +17242,45 @@ function parseMachineArgs(argv) {
|
|
|
17436
17242
|
if (values["--machine"] !== "execute") {
|
|
17437
17243
|
return { error: '--machine must be "execute".' };
|
|
17438
17244
|
}
|
|
17245
|
+
const authFd = parseReservedMachineFd(values["--machine-auth-fd"], MACHINE_AUTH_FD);
|
|
17246
|
+
if (authFd instanceof Error) return { error: authFd.message };
|
|
17247
|
+
const approvalFd = parseReservedMachineFd(
|
|
17248
|
+
values["--machine-approval-fd"],
|
|
17249
|
+
MACHINE_APPROVAL_FD
|
|
17250
|
+
);
|
|
17251
|
+
if (approvalFd instanceof Error) return { error: approvalFd.message };
|
|
17439
17252
|
return {
|
|
17440
|
-
operation: values["--operation"],
|
|
17441
|
-
phase: values["--phase"],
|
|
17442
|
-
inputJson: values["--input-json"]
|
|
17253
|
+
...values["--operation"] ? { operation: values["--operation"] } : {},
|
|
17254
|
+
...values["--phase"] ? { phase: values["--phase"] } : {},
|
|
17255
|
+
...values["--input-json"] ? { inputJson: values["--input-json"] } : {},
|
|
17256
|
+
...authFd !== void 0 ? { authFd } : {},
|
|
17257
|
+
...approvalFd !== void 0 ? { approvalFd } : {}
|
|
17443
17258
|
};
|
|
17444
17259
|
}
|
|
17260
|
+
function parseReservedMachineFd(value, expected) {
|
|
17261
|
+
if (value === void 0) return void 0;
|
|
17262
|
+
if (!/^\d+$/.test(value) || Number(value) !== expected) {
|
|
17263
|
+
return new Error(`The machine secret descriptor must be fd ${expected}.`);
|
|
17264
|
+
}
|
|
17265
|
+
return expected;
|
|
17266
|
+
}
|
|
17445
17267
|
async function readMachineInput(location) {
|
|
17446
17268
|
if (location !== "-") {
|
|
17447
17269
|
throw new Error('Machine input must be supplied with "--input-json -".');
|
|
17448
17270
|
}
|
|
17449
17271
|
let raw = "";
|
|
17272
|
+
let bytes = 0;
|
|
17450
17273
|
process.stdin.setEncoding("utf8");
|
|
17451
|
-
for await (const chunk of process.stdin)
|
|
17274
|
+
for await (const chunk of process.stdin) {
|
|
17275
|
+
const text = String(chunk);
|
|
17276
|
+
bytes += Buffer.byteLength(text, "utf8");
|
|
17277
|
+
if (bytes > MAX_MACHINE_INPUT_BYTES) {
|
|
17278
|
+
throw new Error(
|
|
17279
|
+
`Machine input exceeds the maximum size of ${MAX_MACHINE_INPUT_BYTES} bytes.`
|
|
17280
|
+
);
|
|
17281
|
+
}
|
|
17282
|
+
raw += text;
|
|
17283
|
+
}
|
|
17452
17284
|
if (!raw.trim()) throw new Error("Machine input JSON is required.");
|
|
17453
17285
|
const parsed = JSON.parse(raw);
|
|
17454
17286
|
if (!isPlainObject(parsed)) throw new Error("Machine input must be a JSON object.");
|
|
@@ -17469,11 +17301,20 @@ function normalizeInput(input) {
|
|
|
17469
17301
|
Object.keys(input).sort().map((key) => [key, input[key]])
|
|
17470
17302
|
);
|
|
17471
17303
|
}
|
|
17472
|
-
function
|
|
17473
|
-
|
|
17474
|
-
if (!raw) return null;
|
|
17304
|
+
function parseTrustedJsonFromFd(fd, predicate) {
|
|
17305
|
+
if (fd === void 0) return null;
|
|
17475
17306
|
try {
|
|
17476
|
-
const
|
|
17307
|
+
const chunks = [];
|
|
17308
|
+
const buffer = Buffer.allocUnsafe(8 * 1024);
|
|
17309
|
+
let bytes = 0;
|
|
17310
|
+
while (true) {
|
|
17311
|
+
const read = readSync(fd, buffer, 0, buffer.length, null);
|
|
17312
|
+
if (read === 0) break;
|
|
17313
|
+
bytes += read;
|
|
17314
|
+
if (bytes > MAX_MACHINE_SECRET_BYTES) return null;
|
|
17315
|
+
chunks.push(Buffer.from(buffer.subarray(0, read)));
|
|
17316
|
+
}
|
|
17317
|
+
const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
17477
17318
|
return predicate(parsed) ? parsed : null;
|
|
17478
17319
|
} catch {
|
|
17479
17320
|
return null;
|
|
@@ -17548,13 +17389,9 @@ function withTrustedMachineAuth(auth, callback) {
|
|
|
17548
17389
|
for (const key of Object.keys(process.env)) {
|
|
17549
17390
|
if (key.startsWith("WAVE_")) delete process.env[key];
|
|
17550
17391
|
}
|
|
17551
|
-
if (auth) {
|
|
17552
|
-
process.env.WAVE_API_TOKEN = auth.token;
|
|
17553
|
-
process.env.WAVE_API_BASE_URL = auth.baseUrl;
|
|
17554
|
-
}
|
|
17555
17392
|
process.env.WAVE_CLI_AUTH_STORAGE = "disabled";
|
|
17556
17393
|
process.env.WAVE_CLI_HOME = "/dev/null";
|
|
17557
|
-
return callback
|
|
17394
|
+
return withMachineRuntimeAuth(auth, callback).finally(() => {
|
|
17558
17395
|
for (const key of Object.keys(process.env)) {
|
|
17559
17396
|
if (key.startsWith("WAVE_")) delete process.env[key];
|
|
17560
17397
|
}
|
|
@@ -17706,7 +17543,7 @@ async function maybeRunMachineExecute(argv, program) {
|
|
|
17706
17543
|
})
|
|
17707
17544
|
});
|
|
17708
17545
|
}
|
|
17709
|
-
const auth =
|
|
17546
|
+
const auth = parseTrustedJsonFromFd(parsed.authFd, isTrustedAuth);
|
|
17710
17547
|
if (needsTrustedAuth(resolved.operation) && !auth) {
|
|
17711
17548
|
return printEnvelopeAndExit({
|
|
17712
17549
|
envelope: machineEnvelope({
|
|
@@ -17722,7 +17559,7 @@ async function maybeRunMachineExecute(argv, program) {
|
|
|
17722
17559
|
});
|
|
17723
17560
|
}
|
|
17724
17561
|
if (resolved.operation.classification === "write") {
|
|
17725
|
-
const approval =
|
|
17562
|
+
const approval = parseTrustedJsonFromFd(parsed.approvalFd, isTrustedApproval);
|
|
17726
17563
|
if (!approval || approval.operation !== resolved.operation.id || approval.inputDigest !== digest || approval.cliVersion !== manifest.cli.version || approval.registryDigest !== manifest.registryDigest || approval.organizationId !== auth?.organizationId || approval.actorId !== auth?.actorId) {
|
|
17727
17564
|
return printEnvelopeAndExit({
|
|
17728
17565
|
envelope: machineEnvelope({
|