@pmate/cli 0.24.16 → 0.24.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -0
- package/dist/index.js +179 -18
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -167,6 +167,13 @@ type QuizCommandArgs = {
|
|
|
167
167
|
stepIds: string[];
|
|
168
168
|
apiBaseUrl?: string;
|
|
169
169
|
linkBaseUrl?: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: Command.Quiz;
|
|
172
|
+
action: "delete-step";
|
|
173
|
+
paperId: string;
|
|
174
|
+
stepId: string;
|
|
175
|
+
apiBaseUrl?: string;
|
|
176
|
+
linkBaseUrl?: string;
|
|
170
177
|
} | {
|
|
171
178
|
type: Command.Quiz;
|
|
172
179
|
action: "activate";
|
|
@@ -652,6 +659,7 @@ type AgentCommandArgs = {
|
|
|
652
659
|
baseUrl?: string;
|
|
653
660
|
hubBaseUrl?: string;
|
|
654
661
|
from?: string;
|
|
662
|
+
profileId?: string;
|
|
655
663
|
json: boolean;
|
|
656
664
|
} | {
|
|
657
665
|
type: Command.Agent;
|
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ function saveLoginSession(session, requestedApp = DEFAULT_APP_ID) {
|
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
const accountId = session.session.identity?.accountId?.trim();
|
|
110
|
+
const profileId = session.profileId?.trim();
|
|
110
111
|
const token = session.token?.trim();
|
|
111
112
|
const issuedAt = session.session.issuedAt?.trim();
|
|
112
113
|
const expiresAt = session.session.expiresAt?.trim();
|
|
@@ -116,6 +117,7 @@ function saveLoginSession(session, requestedApp = DEFAULT_APP_ID) {
|
|
|
116
117
|
const nextSession = {
|
|
117
118
|
token,
|
|
118
119
|
accountId,
|
|
120
|
+
...profileId ? { profileId } : {},
|
|
119
121
|
issuedAt,
|
|
120
122
|
expiresAt,
|
|
121
123
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -231,7 +233,7 @@ function isStoredSession(value) {
|
|
|
231
233
|
return false;
|
|
232
234
|
}
|
|
233
235
|
const session = value;
|
|
234
|
-
return typeof session.token === "string" && !!session.token.trim() && typeof session.accountId === "string" && !!session.accountId.trim() && typeof session.issuedAt === "string" && !!session.issuedAt.trim() && typeof session.expiresAt === "string" && !!session.expiresAt.trim() && typeof session.updatedAt === "string" && !!session.updatedAt.trim();
|
|
236
|
+
return typeof session.token === "string" && !!session.token.trim() && typeof session.accountId === "string" && !!session.accountId.trim() && (session.profileId === void 0 || typeof session.profileId === "string" && !!session.profileId.trim()) && typeof session.issuedAt === "string" && !!session.issuedAt.trim() && typeof session.expiresAt === "string" && !!session.expiresAt.trim() && typeof session.updatedAt === "string" && !!session.updatedAt.trim();
|
|
235
237
|
}
|
|
236
238
|
function resolveReadApp(store, options) {
|
|
237
239
|
const requestedApp = options?.app?.trim();
|
|
@@ -283,6 +285,46 @@ var init_sessionStore = __esm({
|
|
|
283
285
|
}
|
|
284
286
|
});
|
|
285
287
|
|
|
288
|
+
// src/profileClient.ts
|
|
289
|
+
async function fetchDefaultProfileId(options) {
|
|
290
|
+
const token = options.token.trim();
|
|
291
|
+
const app = options.app.trim();
|
|
292
|
+
const accountId = options.accountId.trim();
|
|
293
|
+
if (!token || !app || !accountId) {
|
|
294
|
+
throw new Error("Missing token, app, or accountId for profile lookup.");
|
|
295
|
+
}
|
|
296
|
+
const url = new URL(`${resolveAuthApiBaseUrl(options.authApiBaseUrl)}/profiles`);
|
|
297
|
+
url.searchParams.set("app", app);
|
|
298
|
+
url.searchParams.set("account", accountId);
|
|
299
|
+
const response = await fetch(url, {
|
|
300
|
+
headers: {
|
|
301
|
+
Authorization: `Bearer ${token}`
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
if (!response.ok) {
|
|
305
|
+
const detail = await response.text();
|
|
306
|
+
throw new Error(
|
|
307
|
+
`Failed to resolve default profile (${response.status}): ${detail || response.statusText}`
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
const envelope = await response.json();
|
|
311
|
+
const profileId = envelope.data?.[0]?.id?.trim();
|
|
312
|
+
if (!profileId) {
|
|
313
|
+
throw new Error(`No profile found for app ${app} and account ${accountId}.`);
|
|
314
|
+
}
|
|
315
|
+
return profileId;
|
|
316
|
+
}
|
|
317
|
+
function resolveAuthApiBaseUrl(value) {
|
|
318
|
+
return (value || process.env.PMATE_AUTH_API_BASE_URL || process.env.AUTH_API_BASE_URL || DEFAULT_AUTH_API_BASE_URL).replace(/\/+$/, "");
|
|
319
|
+
}
|
|
320
|
+
var DEFAULT_AUTH_API_BASE_URL;
|
|
321
|
+
var init_profileClient = __esm({
|
|
322
|
+
"src/profileClient.ts"() {
|
|
323
|
+
"use strict";
|
|
324
|
+
DEFAULT_AUTH_API_BASE_URL = "https://auth-api-v2.pmate.chat";
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
286
328
|
// node_modules/@pmate/meta/src/types/account.types.ts
|
|
287
329
|
var init_account_types = __esm({
|
|
288
330
|
"node_modules/@pmate/meta/src/types/account.types.ts"() {
|
|
@@ -8512,7 +8554,11 @@ var init_AgentClient = __esm({
|
|
|
8512
8554
|
const timeoutMs = options?.timeoutMs ?? this.timeoutMs;
|
|
8513
8555
|
await this.waitForConnection(timeoutMs);
|
|
8514
8556
|
const token = options?.token ?? "";
|
|
8515
|
-
|
|
8557
|
+
const profileId = options?.profileId;
|
|
8558
|
+
if (!profileId) {
|
|
8559
|
+
throw new Error("AgentClient user auth requires profileId");
|
|
8560
|
+
}
|
|
8561
|
+
await this.sendAuth(token, timeoutMs, profileId);
|
|
8516
8562
|
return true;
|
|
8517
8563
|
}
|
|
8518
8564
|
async prompt(request) {
|
|
@@ -8795,11 +8841,16 @@ var init_AgentClient = __esm({
|
|
|
8795
8841
|
});
|
|
8796
8842
|
});
|
|
8797
8843
|
}
|
|
8798
|
-
async sendAuth(token, timeoutMs) {
|
|
8844
|
+
async sendAuth(token, timeoutMs, profileId) {
|
|
8799
8845
|
if (!this.ws || !this.from) {
|
|
8800
8846
|
throw new Error("AgentClient not initialized");
|
|
8801
8847
|
}
|
|
8802
|
-
const
|
|
8848
|
+
const body = {
|
|
8849
|
+
token,
|
|
8850
|
+
as: "user",
|
|
8851
|
+
profileId
|
|
8852
|
+
};
|
|
8853
|
+
const msg = Msg.create(this.from, "@hub", 4 /* AUTH */, body);
|
|
8803
8854
|
const waiter = this.waitForAuthAck(timeoutMs);
|
|
8804
8855
|
await this.ws.sendMsg(msg);
|
|
8805
8856
|
const success = await waiter;
|
|
@@ -8995,11 +9046,6 @@ function resolveAgentApiBaseUrl(value) {
|
|
|
8995
9046
|
function resolveHubBaseUrl(value) {
|
|
8996
9047
|
return (value || process.env.PMATE_AGENT_HUB_BASE_URL || DEFAULT_AGENT_HUB_BASE_URL).replace(/\/+$/, "");
|
|
8997
9048
|
}
|
|
8998
|
-
function readSessionToken() {
|
|
8999
|
-
return readRequiredSession({
|
|
9000
|
-
preferredApp: DEFAULT_APP_ID
|
|
9001
|
-
}).token;
|
|
9002
|
-
}
|
|
9003
9049
|
function unwrapAgentResult(agentId, value) {
|
|
9004
9050
|
if (!value || typeof value !== "object") {
|
|
9005
9051
|
if (value == null) {
|
|
@@ -9045,6 +9091,7 @@ var init_AgentLlmClient = __esm({
|
|
|
9045
9091
|
import_node_path11 = __toESM(require("path"));
|
|
9046
9092
|
init_dist2();
|
|
9047
9093
|
init_sessionStore();
|
|
9094
|
+
init_profileClient();
|
|
9048
9095
|
DEFAULT_AGENT_API_BASE_URL = "https://agent-api.pmate.chat";
|
|
9049
9096
|
DEFAULT_AGENT_HUB_BASE_URL = "https://hub.pmate.chat";
|
|
9050
9097
|
DEFAULT_NAMESPACE = "pmate-cli";
|
|
@@ -9052,8 +9099,13 @@ var init_AgentLlmClient = __esm({
|
|
|
9052
9099
|
DEFAULT_AGENT_PROMPT_TIMEOUT_MS = 12e4;
|
|
9053
9100
|
AgentLlmClient = class {
|
|
9054
9101
|
constructor(options) {
|
|
9055
|
-
this.
|
|
9102
|
+
this.session = readRequiredSession({
|
|
9103
|
+
preferredApp: DEFAULT_APP_ID
|
|
9104
|
+
});
|
|
9105
|
+
this.token = options?.token ?? this.session.token;
|
|
9106
|
+
this.profileId = options?.profileId?.trim() || process.env.PMATE_PROFILE_ID || this.session.profileId;
|
|
9056
9107
|
this.agentApiBaseUrl = resolveAgentApiBaseUrl(options?.agentApiBaseUrl);
|
|
9108
|
+
this.authApiBaseUrl = resolveAuthApiBaseUrl(options?.authApiBaseUrl);
|
|
9057
9109
|
this.hubBaseUrl = resolveHubBaseUrl(options?.hubBaseUrl);
|
|
9058
9110
|
this.from = options?.from ?? DEFAULT_FROM;
|
|
9059
9111
|
this.agentService = new AgentService({
|
|
@@ -9072,8 +9124,10 @@ var init_AgentLlmClient = __esm({
|
|
|
9072
9124
|
timeoutMs: DEFAULT_AGENT_PROMPT_TIMEOUT_MS
|
|
9073
9125
|
});
|
|
9074
9126
|
try {
|
|
9127
|
+
const profileId = await this.resolveProfileId();
|
|
9075
9128
|
await client.login(options?.from ?? this.from, {
|
|
9076
|
-
token: this.token
|
|
9129
|
+
token: this.token,
|
|
9130
|
+
profileId
|
|
9077
9131
|
});
|
|
9078
9132
|
const result = await client.prompt({
|
|
9079
9133
|
agentId,
|
|
@@ -9093,8 +9147,10 @@ var init_AgentLlmClient = __esm({
|
|
|
9093
9147
|
minChunkSizeBytes: 0
|
|
9094
9148
|
});
|
|
9095
9149
|
try {
|
|
9150
|
+
const profileId = await this.resolveProfileId();
|
|
9096
9151
|
await client.login(options?.from ?? this.from, {
|
|
9097
|
-
token: this.token
|
|
9152
|
+
token: this.token,
|
|
9153
|
+
profileId
|
|
9098
9154
|
});
|
|
9099
9155
|
const input = new AsyncStream();
|
|
9100
9156
|
const stream = client.stream({
|
|
@@ -9111,6 +9167,18 @@ var init_AgentLlmClient = __esm({
|
|
|
9111
9167
|
client.close();
|
|
9112
9168
|
}
|
|
9113
9169
|
}
|
|
9170
|
+
async resolveProfileId() {
|
|
9171
|
+
const profileId = this.profileId?.trim();
|
|
9172
|
+
if (profileId) {
|
|
9173
|
+
return profileId;
|
|
9174
|
+
}
|
|
9175
|
+
return fetchDefaultProfileId({
|
|
9176
|
+
token: this.token,
|
|
9177
|
+
app: DEFAULT_APP_ID,
|
|
9178
|
+
accountId: this.session.accountId,
|
|
9179
|
+
authApiBaseUrl: this.authApiBaseUrl
|
|
9180
|
+
});
|
|
9181
|
+
}
|
|
9114
9182
|
};
|
|
9115
9183
|
}
|
|
9116
9184
|
});
|
|
@@ -9556,8 +9624,9 @@ var ListCommandHandler = class {
|
|
|
9556
9624
|
var import_node_child_process = require("child_process");
|
|
9557
9625
|
var import_node_http = require("http");
|
|
9558
9626
|
init_sessionStore();
|
|
9627
|
+
init_profileClient();
|
|
9559
9628
|
var AUTH_UI_BASE_URL = "https://auth.pmate.chat";
|
|
9560
|
-
var AUTH_API_BASE_URL =
|
|
9629
|
+
var AUTH_API_BASE_URL = DEFAULT_AUTH_API_BASE_URL;
|
|
9561
9630
|
var CALLBACK_PATH = "/pmate-login-callback";
|
|
9562
9631
|
var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
9563
9632
|
function buildHostedLoginUrl(redirectUrl, appId = DEFAULT_APP_ID) {
|
|
@@ -9588,7 +9657,12 @@ var LoginCommandHandler = class {
|
|
|
9588
9657
|
try {
|
|
9589
9658
|
const token = await callback.waitForToken;
|
|
9590
9659
|
const loginResponse = await this.exchangeSession(token, appId);
|
|
9591
|
-
|
|
9660
|
+
const profileId = await fetchDefaultProfileId({
|
|
9661
|
+
token: loginResponse.token,
|
|
9662
|
+
app: appId,
|
|
9663
|
+
accountId: loginResponse.session.identity.accountId
|
|
9664
|
+
});
|
|
9665
|
+
savedSession = saveLoginSession({ ...loginResponse, profileId }, appId);
|
|
9592
9666
|
} finally {
|
|
9593
9667
|
await callback.close();
|
|
9594
9668
|
}
|
|
@@ -15270,6 +15344,35 @@ async function updateQuizPaperStep({
|
|
|
15270
15344
|
data
|
|
15271
15345
|
};
|
|
15272
15346
|
}
|
|
15347
|
+
async function deleteQuizPaperStep({
|
|
15348
|
+
fetchImpl = fetch,
|
|
15349
|
+
apiBaseUrl,
|
|
15350
|
+
linkBaseUrl,
|
|
15351
|
+
paperId,
|
|
15352
|
+
stepId,
|
|
15353
|
+
token
|
|
15354
|
+
}) {
|
|
15355
|
+
const trimmedApiBaseUrl = apiBaseUrl.replace(/\/+$/, "");
|
|
15356
|
+
const trimmedLinkBaseUrl = linkBaseUrl.replace(/\/+$/, "");
|
|
15357
|
+
const previewLink = `${trimmedLinkBaseUrl}/?paper=${encodeURIComponent(paperId)}`;
|
|
15358
|
+
const data = await requestJson(
|
|
15359
|
+
fetchImpl,
|
|
15360
|
+
`${trimmedApiBaseUrl}/api/quiz/papers/${encodeURIComponent(paperId)}/steps/${encodeURIComponent(stepId)}`,
|
|
15361
|
+
{
|
|
15362
|
+
method: "DELETE",
|
|
15363
|
+
headers: {
|
|
15364
|
+
Authorization: `Bearer ${token}`
|
|
15365
|
+
}
|
|
15366
|
+
},
|
|
15367
|
+
`\u5220\u9664\u9898\u76EE\uFF08${stepId}\uFF09`
|
|
15368
|
+
);
|
|
15369
|
+
return {
|
|
15370
|
+
apiBaseUrl: trimmedApiBaseUrl,
|
|
15371
|
+
paperId,
|
|
15372
|
+
previewLink,
|
|
15373
|
+
data
|
|
15374
|
+
};
|
|
15375
|
+
}
|
|
15273
15376
|
async function reorderQuizPaperSteps({
|
|
15274
15377
|
fetchImpl = fetch,
|
|
15275
15378
|
apiBaseUrl,
|
|
@@ -15440,6 +15543,18 @@ var QuizCommandHandler = class {
|
|
|
15440
15543
|
ui.info("\u6570\u91CF", String(args.stepIds.length));
|
|
15441
15544
|
return;
|
|
15442
15545
|
}
|
|
15546
|
+
if (args.action === "delete-step") {
|
|
15547
|
+
const result = await deleteQuizPaperStep({
|
|
15548
|
+
apiBaseUrl,
|
|
15549
|
+
linkBaseUrl,
|
|
15550
|
+
paperId: args.paperId,
|
|
15551
|
+
stepId: args.stepId,
|
|
15552
|
+
token: session.token
|
|
15553
|
+
});
|
|
15554
|
+
ui.success("Quiz \u9898\u76EE\u5DF2\u5220\u9664", result.previewLink);
|
|
15555
|
+
ui.info("stepId", args.stepId);
|
|
15556
|
+
return;
|
|
15557
|
+
}
|
|
15443
15558
|
if (args.action === "view") {
|
|
15444
15559
|
const result = await viewQuizPaper({
|
|
15445
15560
|
apiBaseUrl,
|
|
@@ -16561,7 +16676,8 @@ var AgentCommandHandler = class {
|
|
|
16561
16676
|
token,
|
|
16562
16677
|
agentApiBaseUrl: baseUrl,
|
|
16563
16678
|
hubBaseUrl: args.hubBaseUrl,
|
|
16564
|
-
from: args.from
|
|
16679
|
+
from: args.from,
|
|
16680
|
+
profileId: args.profileId
|
|
16565
16681
|
});
|
|
16566
16682
|
if (args.filePath) {
|
|
16567
16683
|
const filePayload = this.tryReadJsonObjectFile(args.filePath);
|
|
@@ -21044,7 +21160,7 @@ function parseAgentArgs(tokens) {
|
|
|
21044
21160
|
const ref = rest.shift();
|
|
21045
21161
|
if (!ref) {
|
|
21046
21162
|
throw new Error(
|
|
21047
|
-
"Usage: agent call <ns:objectId> [--payload <json>] [--file <path>] [--base-url <url>] [--hub-base-url <url>] [--from <id>] [--json]"
|
|
21163
|
+
"Usage: agent call <ns:objectId> [--payload <json>] [--file <path>] [--base-url <url>] [--hub-base-url <url>] [--from <id>] [--profile-id <id>] [--json]"
|
|
21048
21164
|
);
|
|
21049
21165
|
}
|
|
21050
21166
|
const parsed = parseNamespacedRef(ref, { entityLabel: "agent ref" });
|
|
@@ -21052,6 +21168,7 @@ function parseAgentArgs(tokens) {
|
|
|
21052
21168
|
let payload;
|
|
21053
21169
|
let hubBaseUrl;
|
|
21054
21170
|
let from;
|
|
21171
|
+
let profileId;
|
|
21055
21172
|
while (rest.length > 0) {
|
|
21056
21173
|
const token = rest.shift();
|
|
21057
21174
|
switch (token) {
|
|
@@ -21070,6 +21187,9 @@ function parseAgentArgs(tokens) {
|
|
|
21070
21187
|
case "--from":
|
|
21071
21188
|
from = requireValue(rest, token);
|
|
21072
21189
|
break;
|
|
21190
|
+
case "--profile-id":
|
|
21191
|
+
profileId = requireValue(rest, token);
|
|
21192
|
+
break;
|
|
21073
21193
|
case "--json":
|
|
21074
21194
|
json = true;
|
|
21075
21195
|
break;
|
|
@@ -21087,6 +21207,7 @@ function parseAgentArgs(tokens) {
|
|
|
21087
21207
|
baseUrl,
|
|
21088
21208
|
hubBaseUrl,
|
|
21089
21209
|
from,
|
|
21210
|
+
profileId,
|
|
21090
21211
|
json
|
|
21091
21212
|
};
|
|
21092
21213
|
}
|
|
@@ -23748,6 +23869,7 @@ var HELP_TEXT = [
|
|
|
23748
23869
|
` ${import_chalk4.default.gray(" update-meta --paper-id <id> --file <metadata.json>")}`,
|
|
23749
23870
|
` ${import_chalk4.default.gray(" append-step --paper-id <id> --file <step.json>")}`,
|
|
23750
23871
|
` ${import_chalk4.default.gray(" update-step --paper-id <id> --step-id <step-id> --file <step.json>")}`,
|
|
23872
|
+
` ${import_chalk4.default.gray(" delete-step --paper-id <id> --step-id <step-id>")}`,
|
|
23751
23873
|
` ${import_chalk4.default.gray(" reorder --paper-id <id> --step-ids <id1,id2,...>")}`,
|
|
23752
23874
|
` ${import_chalk4.default.gray(" activate --paper-id <id>")}`,
|
|
23753
23875
|
` ${import_chalk4.default.gray(" view --paper-id <id>")}`,
|
|
@@ -23800,7 +23922,7 @@ var HELP_TEXT = [
|
|
|
23800
23922
|
` ${import_chalk4.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
23801
23923
|
` ${import_chalk4.default.gray(" rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]")}`,
|
|
23802
23924
|
` ${import_chalk4.default.gray(" move --from <id> --ns <namespace> --to-ns <namespace> [--to <id>] [--base-url <url>] [--json]")}`,
|
|
23803
|
-
` ${import_chalk4.default.gray(" call <ns:objectId> [--payload <json>] [--file <path>] [--base-url <url>] [--hub-base-url <url>] [--from <id>] [--json]")}`,
|
|
23925
|
+
` ${import_chalk4.default.gray(" call <ns:objectId> [--payload <json>] [--file <path>] [--base-url <url>] [--hub-base-url <url>] [--from <id>] [--profile-id <id>] [--json]")}`,
|
|
23804
23926
|
` ${import_chalk4.default.gray(" --file reads JSON payload files, or streams binary files such as .wav to ASR agents; --payload becomes stream params for binary files")}`,
|
|
23805
23927
|
` ${import_chalk4.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
23806
23928
|
` ${import_chalk4.default.gray(" list defaults to all namespaces; create defaults to namespace: pmate; default base URL: https://agent-api.pmate.chat; call uses pmate:factory session and default hub: https://hub.pmate.chat")}`,
|
|
@@ -24408,7 +24530,7 @@ function parseQuizArgs(tokens) {
|
|
|
24408
24530
|
const rest = [...tokens];
|
|
24409
24531
|
const action = rest.shift();
|
|
24410
24532
|
if (!action) {
|
|
24411
|
-
throw new Error("Missing quiz action. Usage: quiz create-draft|update-meta|append-step|update-step|reorder|activate|view|edit-step");
|
|
24533
|
+
throw new Error("Missing quiz action. Usage: quiz create-draft|update-meta|append-step|update-step|delete-step|reorder|activate|view|edit-step");
|
|
24412
24534
|
}
|
|
24413
24535
|
if (action === "create-draft") {
|
|
24414
24536
|
let paperId;
|
|
@@ -24609,6 +24731,45 @@ function parseQuizArgs(tokens) {
|
|
|
24609
24731
|
linkBaseUrl
|
|
24610
24732
|
};
|
|
24611
24733
|
}
|
|
24734
|
+
if (action === "delete-step") {
|
|
24735
|
+
let paperId;
|
|
24736
|
+
let stepId;
|
|
24737
|
+
let apiBaseUrl;
|
|
24738
|
+
let linkBaseUrl;
|
|
24739
|
+
while (rest.length > 0) {
|
|
24740
|
+
const token = rest.shift();
|
|
24741
|
+
switch (token) {
|
|
24742
|
+
case "--paper-id":
|
|
24743
|
+
paperId = requireValue13(rest, token);
|
|
24744
|
+
break;
|
|
24745
|
+
case "--step-id":
|
|
24746
|
+
stepId = requireValue13(rest, token);
|
|
24747
|
+
break;
|
|
24748
|
+
case "--base-url":
|
|
24749
|
+
apiBaseUrl = requireValue13(rest, token);
|
|
24750
|
+
break;
|
|
24751
|
+
case "--link-base":
|
|
24752
|
+
linkBaseUrl = requireValue13(rest, token);
|
|
24753
|
+
break;
|
|
24754
|
+
default:
|
|
24755
|
+
throw new Error(`Unknown quiz delete-step option: ${token}`);
|
|
24756
|
+
}
|
|
24757
|
+
}
|
|
24758
|
+
if (!paperId) {
|
|
24759
|
+
throw new Error("Missing --paper-id. Usage: quiz delete-step --paper-id <id> --step-id <id>.");
|
|
24760
|
+
}
|
|
24761
|
+
if (!stepId) {
|
|
24762
|
+
throw new Error("Missing --step-id. Usage: quiz delete-step --paper-id <id> --step-id <id>.");
|
|
24763
|
+
}
|
|
24764
|
+
return {
|
|
24765
|
+
type: "quiz" /* Quiz */,
|
|
24766
|
+
action: "delete-step",
|
|
24767
|
+
paperId,
|
|
24768
|
+
stepId,
|
|
24769
|
+
apiBaseUrl,
|
|
24770
|
+
linkBaseUrl
|
|
24771
|
+
};
|
|
24772
|
+
}
|
|
24612
24773
|
if (action === "activate") {
|
|
24613
24774
|
let paperId;
|
|
24614
24775
|
let apiBaseUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pmate/cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.18",
|
|
4
4
|
"description": "CLI utilities for the pMate project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"yaml": "^2.8.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@pmate/agent-sdk": "^1.1.
|
|
59
|
+
"@pmate/agent-sdk": "^1.1.8",
|
|
60
60
|
"@pmate/meta": "^1.1.13",
|
|
61
61
|
"@pmate/utils": "^1.1.3",
|
|
62
62
|
"@types/node": "^25.0.3",
|