@getfrontline/cli 1.0.0
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 +319 -0
- package/dist/assets/logo3.png +0 -0
- package/dist/commands/agents/analytics.d.ts +3 -0
- package/dist/commands/agents/analytics.d.ts.map +1 -0
- package/dist/commands/agents/analytics.js +67 -0
- package/dist/commands/agents/analytics.js.map +1 -0
- package/dist/commands/agents/flows.d.ts +3 -0
- package/dist/commands/agents/flows.d.ts.map +1 -0
- package/dist/commands/agents/flows.js +47 -0
- package/dist/commands/agents/flows.js.map +1 -0
- package/dist/commands/agents/list.d.ts +3 -0
- package/dist/commands/agents/list.d.ts.map +1 -0
- package/dist/commands/agents/list.js +46 -0
- package/dist/commands/agents/list.js.map +1 -0
- package/dist/commands/api/raw.d.ts +3 -0
- package/dist/commands/api/raw.d.ts.map +1 -0
- package/dist/commands/api/raw.js +54 -0
- package/dist/commands/api/raw.js.map +1 -0
- package/dist/commands/auth/login.d.ts +3 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +39 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +3 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +16 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/profiles.d.ts +3 -0
- package/dist/commands/auth/profiles.d.ts.map +1 -0
- package/dist/commands/auth/profiles.js +72 -0
- package/dist/commands/auth/profiles.js.map +1 -0
- package/dist/commands/auth/whoami.d.ts +3 -0
- package/dist/commands/auth/whoami.d.ts.map +1 -0
- package/dist/commands/auth/whoami.js +46 -0
- package/dist/commands/auth/whoami.js.map +1 -0
- package/dist/commands/billing/get.d.ts +3 -0
- package/dist/commands/billing/get.d.ts.map +1 -0
- package/dist/commands/billing/get.js +42 -0
- package/dist/commands/billing/get.js.map +1 -0
- package/dist/commands/object/aggregation.d.ts +3 -0
- package/dist/commands/object/aggregation.d.ts.map +1 -0
- package/dist/commands/object/aggregation.js +78 -0
- package/dist/commands/object/aggregation.js.map +1 -0
- package/dist/commands/object/export.d.ts +3 -0
- package/dist/commands/object/export.d.ts.map +1 -0
- package/dist/commands/object/export.js +98 -0
- package/dist/commands/object/export.js.map +1 -0
- package/dist/commands/object/field.d.ts +3 -0
- package/dist/commands/object/field.d.ts.map +1 -0
- package/dist/commands/object/field.js +76 -0
- package/dist/commands/object/field.js.map +1 -0
- package/dist/commands/object/file.d.ts +3 -0
- package/dist/commands/object/file.d.ts.map +1 -0
- package/dist/commands/object/file.js +105 -0
- package/dist/commands/object/file.js.map +1 -0
- package/dist/commands/object/index.d.ts +3 -0
- package/dist/commands/object/index.d.ts.map +1 -0
- package/dist/commands/object/index.js +136 -0
- package/dist/commands/object/index.js.map +1 -0
- package/dist/commands/object/note.d.ts +3 -0
- package/dist/commands/object/note.d.ts.map +1 -0
- package/dist/commands/object/note.js +62 -0
- package/dist/commands/object/note.js.map +1 -0
- package/dist/commands/object/option.d.ts +3 -0
- package/dist/commands/object/option.d.ts.map +1 -0
- package/dist/commands/object/option.js +78 -0
- package/dist/commands/object/option.js.map +1 -0
- package/dist/commands/object/record-type.d.ts +3 -0
- package/dist/commands/object/record-type.d.ts.map +1 -0
- package/dist/commands/object/record-type.js +73 -0
- package/dist/commands/object/record-type.js.map +1 -0
- package/dist/commands/object/record.d.ts +3 -0
- package/dist/commands/object/record.d.ts.map +1 -0
- package/dist/commands/object/record.js +128 -0
- package/dist/commands/object/record.js.map +1 -0
- package/dist/commands/object/relation.d.ts +3 -0
- package/dist/commands/object/relation.d.ts.map +1 -0
- package/dist/commands/object/relation.js +73 -0
- package/dist/commands/object/relation.js.map +1 -0
- package/dist/commands/object/task.d.ts +3 -0
- package/dist/commands/object/task.d.ts.map +1 -0
- package/dist/commands/object/task.js +88 -0
- package/dist/commands/object/task.js.map +1 -0
- package/dist/commands/object/view.d.ts +3 -0
- package/dist/commands/object/view.d.ts.map +1 -0
- package/dist/commands/object/view.js +118 -0
- package/dist/commands/object/view.js.map +1 -0
- package/dist/commands/setup/claudeSkills.d.ts +3 -0
- package/dist/commands/setup/claudeSkills.d.ts.map +1 -0
- package/dist/commands/setup/claudeSkills.js +84 -0
- package/dist/commands/setup/claudeSkills.js.map +1 -0
- package/dist/commands/table/aggregation.d.ts +3 -0
- package/dist/commands/table/aggregation.d.ts.map +1 -0
- package/dist/commands/table/aggregation.js +78 -0
- package/dist/commands/table/aggregation.js.map +1 -0
- package/dist/commands/table/export.d.ts +3 -0
- package/dist/commands/table/export.d.ts.map +1 -0
- package/dist/commands/table/export.js +97 -0
- package/dist/commands/table/export.js.map +1 -0
- package/dist/commands/table/field.d.ts +3 -0
- package/dist/commands/table/field.d.ts.map +1 -0
- package/dist/commands/table/field.js +76 -0
- package/dist/commands/table/field.js.map +1 -0
- package/dist/commands/table/file.d.ts +3 -0
- package/dist/commands/table/file.d.ts.map +1 -0
- package/dist/commands/table/file.js +106 -0
- package/dist/commands/table/file.js.map +1 -0
- package/dist/commands/table/index.d.ts +3 -0
- package/dist/commands/table/index.d.ts.map +1 -0
- package/dist/commands/table/index.js +142 -0
- package/dist/commands/table/index.js.map +1 -0
- package/dist/commands/table/note.d.ts +3 -0
- package/dist/commands/table/note.d.ts.map +1 -0
- package/dist/commands/table/note.js +62 -0
- package/dist/commands/table/note.js.map +1 -0
- package/dist/commands/table/option.d.ts +3 -0
- package/dist/commands/table/option.d.ts.map +1 -0
- package/dist/commands/table/option.js +78 -0
- package/dist/commands/table/option.js.map +1 -0
- package/dist/commands/table/relation.d.ts +3 -0
- package/dist/commands/table/relation.d.ts.map +1 -0
- package/dist/commands/table/relation.js +74 -0
- package/dist/commands/table/relation.js.map +1 -0
- package/dist/commands/table/row.d.ts +3 -0
- package/dist/commands/table/row.d.ts.map +1 -0
- package/dist/commands/table/row.js +124 -0
- package/dist/commands/table/row.js.map +1 -0
- package/dist/commands/table/task.d.ts +3 -0
- package/dist/commands/table/task.d.ts.map +1 -0
- package/dist/commands/table/task.js +88 -0
- package/dist/commands/table/task.js.map +1 -0
- package/dist/commands/workflows/analytics.d.ts +3 -0
- package/dist/commands/workflows/analytics.d.ts.map +1 -0
- package/dist/commands/workflows/analytics.js +60 -0
- package/dist/commands/workflows/analytics.js.map +1 -0
- package/dist/commands/workflows/list.d.ts +3 -0
- package/dist/commands/workflows/list.d.ts.map +1 -0
- package/dist/commands/workflows/list.js +47 -0
- package/dist/commands/workflows/list.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/auth.d.ts +13 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +40 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/config.d.ts +28 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +77 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/errors.d.ts +13 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +31 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/globalOpts.d.ts +23 -0
- package/dist/lib/globalOpts.d.ts.map +1 -0
- package/dist/lib/globalOpts.js +40 -0
- package/dist/lib/globalOpts.js.map +1 -0
- package/dist/lib/helpEpilog.d.ts +18 -0
- package/dist/lib/helpEpilog.d.ts.map +1 -0
- package/dist/lib/helpEpilog.js +56 -0
- package/dist/lib/helpEpilog.js.map +1 -0
- package/dist/lib/httpClient.d.ts +50 -0
- package/dist/lib/httpClient.d.ts.map +1 -0
- package/dist/lib/httpClient.js +196 -0
- package/dist/lib/httpClient.js.map +1 -0
- package/dist/lib/output.d.ts +38 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +131 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/max/browserLogin.d.ts +15 -0
- package/dist/max/browserLogin.d.ts.map +1 -0
- package/dist/max/browserLogin.js +164 -0
- package/dist/max/browserLogin.js.map +1 -0
- package/dist/max/commands/auth/login.d.ts +3 -0
- package/dist/max/commands/auth/login.d.ts.map +1 -0
- package/dist/max/commands/auth/login.js +58 -0
- package/dist/max/commands/auth/login.js.map +1 -0
- package/dist/max/commands/auth/logout.d.ts +3 -0
- package/dist/max/commands/auth/logout.d.ts.map +1 -0
- package/dist/max/commands/auth/logout.js +23 -0
- package/dist/max/commands/auth/logout.js.map +1 -0
- package/dist/max/commands/auth/whoami.d.ts +3 -0
- package/dist/max/commands/auth/whoami.d.ts.map +1 -0
- package/dist/max/commands/auth/whoami.js +46 -0
- package/dist/max/commands/auth/whoami.js.map +1 -0
- package/dist/max/commands/chat/repl.d.ts +3 -0
- package/dist/max/commands/chat/repl.d.ts.map +1 -0
- package/dist/max/commands/chat/repl.js +104 -0
- package/dist/max/commands/chat/repl.js.map +1 -0
- package/dist/max/commands/chat/send.d.ts +25 -0
- package/dist/max/commands/chat/send.d.ts.map +1 -0
- package/dist/max/commands/chat/send.js +163 -0
- package/dist/max/commands/chat/send.js.map +1 -0
- package/dist/max/commands/conversations/abort.d.ts +3 -0
- package/dist/max/commands/conversations/abort.d.ts.map +1 -0
- package/dist/max/commands/conversations/abort.js +55 -0
- package/dist/max/commands/conversations/abort.js.map +1 -0
- package/dist/max/commands/conversations/get.d.ts +3 -0
- package/dist/max/commands/conversations/get.d.ts.map +1 -0
- package/dist/max/commands/conversations/get.js +42 -0
- package/dist/max/commands/conversations/get.js.map +1 -0
- package/dist/max/commands/conversations/index.d.ts +3 -0
- package/dist/max/commands/conversations/index.d.ts.map +1 -0
- package/dist/max/commands/conversations/index.js +16 -0
- package/dist/max/commands/conversations/index.js.map +1 -0
- package/dist/max/commands/conversations/list.d.ts +3 -0
- package/dist/max/commands/conversations/list.d.ts.map +1 -0
- package/dist/max/commands/conversations/list.js +35 -0
- package/dist/max/commands/conversations/list.js.map +1 -0
- package/dist/max/commands/conversations/update.d.ts +3 -0
- package/dist/max/commands/conversations/update.d.ts.map +1 -0
- package/dist/max/commands/conversations/update.js +53 -0
- package/dist/max/commands/conversations/update.js.map +1 -0
- package/dist/max/jwtDecode.d.ts +5 -0
- package/dist/max/jwtDecode.d.ts.map +1 -0
- package/dist/max/jwtDecode.js +19 -0
- package/dist/max/jwtDecode.js.map +1 -0
- package/dist/max/lib/auth.d.ts +20 -0
- package/dist/max/lib/auth.d.ts.map +1 -0
- package/dist/max/lib/auth.js +53 -0
- package/dist/max/lib/auth.js.map +1 -0
- package/dist/max/lib/httpClient.d.ts +25 -0
- package/dist/max/lib/httpClient.d.ts.map +1 -0
- package/dist/max/lib/httpClient.js +138 -0
- package/dist/max/lib/httpClient.js.map +1 -0
- package/dist/max/lib/maxResponse.d.ts +30 -0
- package/dist/max/lib/maxResponse.d.ts.map +1 -0
- package/dist/max/lib/maxResponse.js +132 -0
- package/dist/max/lib/maxResponse.js.map +1 -0
- package/dist/max/lib/publicApiPaths.d.ts +12 -0
- package/dist/max/lib/publicApiPaths.d.ts.map +1 -0
- package/dist/max/lib/publicApiPaths.js +15 -0
- package/dist/max/lib/publicApiPaths.js.map +1 -0
- package/dist/max/maxConfig.d.ts +31 -0
- package/dist/max/maxConfig.d.ts.map +1 -0
- package/dist/max/maxConfig.js +50 -0
- package/dist/max/maxConfig.js.map +1 -0
- package/dist/max/ui/banner.d.ts +3 -0
- package/dist/max/ui/banner.d.ts.map +1 -0
- package/dist/max/ui/banner.js +96 -0
- package/dist/max/ui/banner.js.map +1 -0
- package/dist/max.d.ts +3 -0
- package/dist/max.d.ts.map +1 -0
- package/dist/max.js +94 -0
- package/dist/max.js.map +1 -0
- package/dist/scripts/postinstall.d.ts +8 -0
- package/dist/scripts/postinstall.d.ts.map +1 -0
- package/dist/scripts/postinstall.js +149 -0
- package/dist/scripts/postinstall.js.map +1 -0
- package/dist/skills/aggregations/SKILL.md +122 -0
- package/dist/skills/auth-and-profiles/SKILL.md +102 -0
- package/dist/skills/crm-setup/SKILL.md +385 -0
- package/dist/skills/crud-operations/SKILL.md +287 -0
- package/dist/skills/export-and-delete/SKILL.md +96 -0
- package/dist/skills/files/SKILL.md +70 -0
- package/dist/skills/filter-and-query/SKILL.md +199 -0
- package/dist/skills/frontline-agents/SKILL.md +99 -0
- package/dist/skills/frontline-api/SKILL.md +59 -0
- package/dist/skills/frontline-billing/SKILL.md +42 -0
- package/dist/skills/frontline-workflows/SKILL.md +72 -0
- package/dist/skills/max-auth/SKILL.md +76 -0
- package/dist/skills/max-chat/SKILL.md +111 -0
- package/dist/skills/notes-and-tasks/SKILL.md +128 -0
- package/dist/skills/pipeline-setup/SKILL.md +233 -0
- package/dist/skills/record-type-management/SKILL.md +104 -0
- package/dist/skills/relations/SKILL.md +153 -0
- package/dist/skills/resource-creation/SKILL.md +86 -0
- package/dist/skills/schema-design/SKILL.md +263 -0
- package/package.json +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../../src/max/commands/auth/login.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,+CAKyB;AACzB,gDAK6B;AAC7B,gDAA8E;AAC9E,4CAAgD;AAChD,4CAAkD;AAClD,wDAAoF;AAmBvE,QAAA,eAAe,GAAG,IAAI,mBAAO,CAAC,OAAO,CAAC;KAC9C,WAAW,CACR,+LAA+L,CAClM;KACA,QAAQ,CAAC,WAAW,EAAE,sEAAsE,CAAC;KAC7F,MAAM,CAAC,kBAAkB,EAAE,+BAAkB,CAAC;KAC9C,MAAM,CACH,kBAAkB,EAClB,+DAA+D,IAAA,0BAA0B,GAAE,GAAG,CACjG;KACA,WAAW,CAAC,OAAO,EAAE,KAAK,kCAAqB,IAAI,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,OAAwB,EAAE,GAAY,EAAE,EAAE;IACrE,IAAI,CAAC;QACD,MAAM,IAAA,wBAAe,GAAE,CAAC;QAExB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC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AY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACpB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,eAAO,MAAM,gBAAgB,SAwBvB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxLogoutCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const maxConfig_1 = require("../../maxConfig");
|
|
6
|
+
const config_1 = require("../../../lib/config");
|
|
7
|
+
const output_1 = require("../../../lib/output");
|
|
8
|
+
exports.maxLogoutCommand = new commander_1.Command("logout")
|
|
9
|
+
.description("Remove stored Max credentials (API key) for a profile. Also clears the matching Frontline profile unless --keep-frontline is passed.")
|
|
10
|
+
.option("--profile <name>", "Profile to clear (default: current). Removes API key, any legacy tokens, and saved --api-base-url for that profile.")
|
|
11
|
+
.option("--keep-frontline", "Only clear the Max store; leave the matching Frontline CLI profile untouched.")
|
|
12
|
+
.action((options) => {
|
|
13
|
+
const name = options.profile ?? (0, maxConfig_1.getMaxCurrentProfile)();
|
|
14
|
+
(0, maxConfig_1.deleteMaxProfile)(name);
|
|
15
|
+
let alsoClearedFrontline = false;
|
|
16
|
+
if (!options.keepFrontline && (0, config_1.getProfile)(name)) {
|
|
17
|
+
(0, config_1.deleteProfile)(name);
|
|
18
|
+
alsoClearedFrontline = true;
|
|
19
|
+
}
|
|
20
|
+
const suffix = alsoClearedFrontline ? " (also cleared from Frontline CLI store)" : "";
|
|
21
|
+
(0, output_1.printSuccess)(`Credentials removed for profile "${name}"${suffix}.`);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../../src/max/commands/auth/logout.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,+CAAyE;AACzE,gDAG6B;AAC7B,gDAAmD;AAOtC,QAAA,gBAAgB,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAChD,WAAW,CACR,sIAAsI,CACzI;KACA,MAAM,CACH,kBAAkB,EAClB,qHAAqH,CACxH;KACA,MAAM,CACH,kBAAkB,EAClB,+EAA+E,CAClF;KACA,MAAM,CAAC,CAAC,OAAyB,EAAE,EAAE;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,IAAA,gCAAoB,GAAE,CAAC;IACvD,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC;IAEvB,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,IAAA,mBAAmB,EAAC,IAAI,CAAC,EAAE,CAAC;QACtD,IAAA,sBAAsB,EAAC,IAAI,CAAC,CAAC;QAC7B,oBAAoB,GAAG,IAAI,CAAC;IAChC,CAAC;IAED,MAAM,MAAM,GAAG,oBAAoB,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,IAAA,qBAAY,EAAC,oCAAoC,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,eAAO,MAAM,gBAAgB,SAwCvB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxWhoamiCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const maxConfig_1 = require("../../maxConfig");
|
|
6
|
+
const config_1 = require("../../../lib/config");
|
|
7
|
+
const auth_1 = require("../../../lib/auth");
|
|
8
|
+
const output_1 = require("../../../lib/output");
|
|
9
|
+
const helpEpilog_1 = require("../../../lib/helpEpilog");
|
|
10
|
+
exports.maxWhoamiCommand = new commander_1.Command("whoami")
|
|
11
|
+
.description("Show the profile used by the Max CLI: API key preview, resolved Public API base URL (…/public/v1), and config path.")
|
|
12
|
+
.option("--json", "Output as JSON")
|
|
13
|
+
.option("--profile <name>", helpEpilog_1.MAX_PROFILE_OPTION)
|
|
14
|
+
.action((options) => {
|
|
15
|
+
try {
|
|
16
|
+
const profileName = options.profile ?? (0, maxConfig_1.getMaxCurrentProfile)();
|
|
17
|
+
const maxProfile = (0, maxConfig_1.getMaxProfile)(profileName);
|
|
18
|
+
const frontlineProfile = (0, config_1.getProfile)(profileName);
|
|
19
|
+
const apiKey = maxProfile?.apiKey ?? frontlineProfile?.apiKey;
|
|
20
|
+
if (!apiKey) {
|
|
21
|
+
(0, output_1.printError)(`No API key saved for profile "${profileName}". Run "max auth login <api-key>" to store one.`);
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const resolvedPublicBase = (0, config_1.resolveBaseUrl)(undefined, profileName);
|
|
26
|
+
const out = {
|
|
27
|
+
profile: profileName,
|
|
28
|
+
keyPreview: (0, auth_1.redactToken)(apiKey),
|
|
29
|
+
source: maxProfile?.apiKey ? "max" : "frontline",
|
|
30
|
+
publicApiBaseUrl: resolvedPublicBase,
|
|
31
|
+
hasFrontlineProfile: Boolean(frontlineProfile?.apiKey),
|
|
32
|
+
configPath: (0, maxConfig_1.getMaxConfigPath)(),
|
|
33
|
+
};
|
|
34
|
+
if (options.json) {
|
|
35
|
+
(0, output_1.printJson)(out);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
(0, output_1.printKeyValue)(out);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
(0, output_1.printError)(err instanceof Error ? err.message : String(err));
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=whoami.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../src/max/commands/auth/whoami.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,+CAAwF;AACxF,gDAAwF;AACxF,4CAAgD;AAChD,gDAA2E;AAC3E,wDAA6D;AAOhD,QAAA,gBAAgB,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAChD,WAAW,CACR,qHAAqH,CACxH;KACA,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,kBAAkB,EAAE,+BAAkB,CAAC;KAC9C,MAAM,CAAC,CAAC,OAAyB,EAAE,EAAE;IAClC,IAAI,CAAC;QACD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,IAAA,gCAAoB,GAAE,CAAC;QAC9D,MAAM,UAAU,GAAG,IAAA,yBAAa,EAAC,WAAW,CAAC,CAAC;QAC9C,MAAM,gBAAgB,GAAG,IAAA,mBAAmB,EAAC,WAAW,CAAC,CAAC;QAE1D,MAAM,MAAM,GAAG,UAAU,EAAE,MAAM,IAAI,gBAAgB,EAAE,MAAM,CAAC;QAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,IAAA,mBAAU,EACN,iCAAiC,WAAW,iDAAiD,CAChG,CAAC;YACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QAED,MAAM,kBAAkB,GAAG,IAAA,uBAAc,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClE,MAAM,GAAG,GAAG;YACR,OAAO,EAAE,WAAW;YACpB,UAAU,EAAE,IAAA,kBAAW,EAAC,MAAM,CAAC;YAC/B,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW;YAChD,gBAAgB,EAAE,kBAAkB;YACpC,mBAAmB,EAAE,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC;YACtD,UAAU,EAAE,IAAA,4BAAgB,GAAE;SACjC,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACJ,IAAA,sBAAa,EAAC,GAAyC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACpB,IAAA,mBAAU,EAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/chat/repl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,eAAO,MAAM,kBAAkB,SAiGzB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.maxChatReplCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const readline_1 = require("readline");
|
|
10
|
+
const send_1 = require("./send");
|
|
11
|
+
const maxConfig_1 = require("../../maxConfig");
|
|
12
|
+
const output_1 = require("../../../lib/output");
|
|
13
|
+
const helpEpilog_1 = require("../../../lib/helpEpilog");
|
|
14
|
+
function printReplHelp() {
|
|
15
|
+
console.log(chalk_1.default.bold("\nCommands"));
|
|
16
|
+
console.log(" :help Show this help");
|
|
17
|
+
console.log(" :new Start a new conversation");
|
|
18
|
+
console.log(" :conv <id> Switch to a conversation id");
|
|
19
|
+
console.log(" :exit Exit");
|
|
20
|
+
console.log();
|
|
21
|
+
}
|
|
22
|
+
exports.maxChatReplCommand = new commander_1.Command("repl")
|
|
23
|
+
.description("Interactive readline session; each line is sent like `max chat send` (same API URL rules as `max --help`).")
|
|
24
|
+
.option("--profile <name>", helpEpilog_1.MAX_PROFILE_OPTION)
|
|
25
|
+
.option("--base-url <url>", helpEpilog_1.MAX_BASE_URL_OPTION)
|
|
26
|
+
.option("--api-base-url <url>", "Deprecated alias for --base-url (Public API root)")
|
|
27
|
+
.option("--api-key <key>", "Override per-user API key for this run")
|
|
28
|
+
.option("--debug", "Show debug information")
|
|
29
|
+
.option("--timeout <seconds>", "Polling timeout in seconds", "60")
|
|
30
|
+
.action(async (options) => {
|
|
31
|
+
const profileName = options.profile ?? (0, maxConfig_1.getMaxCurrentProfile)();
|
|
32
|
+
const profile = (0, maxConfig_1.getMaxProfile)(profileName);
|
|
33
|
+
const conv = profile?.lastConversationId;
|
|
34
|
+
console.log(chalk_1.default.bold("Max Chat"));
|
|
35
|
+
console.log(chalk_1.default.gray(`Profile: ${profileName}${typeof conv === "number" ? ` | Conversation: ${conv}` : ""}`));
|
|
36
|
+
console.log(chalk_1.default.gray('Type ":help" for commands. Press Ctrl+C to exit.\n'));
|
|
37
|
+
const rl = (0, readline_1.createInterface)({ input: process.stdin, output: process.stdout });
|
|
38
|
+
rl.setPrompt(chalk_1.default.cyan("> "));
|
|
39
|
+
rl.prompt();
|
|
40
|
+
let forceNew = false;
|
|
41
|
+
rl.on("line", async (line) => {
|
|
42
|
+
const text = line.trim();
|
|
43
|
+
if (!text) {
|
|
44
|
+
rl.prompt();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (text === ":exit" || text === ":quit") {
|
|
48
|
+
rl.close();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (text === ":help") {
|
|
52
|
+
printReplHelp();
|
|
53
|
+
rl.prompt();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (text === ":new") {
|
|
57
|
+
forceNew = true;
|
|
58
|
+
(0, maxConfig_1.updateMaxProfile)(profileName, { lastConversationId: undefined });
|
|
59
|
+
(0, output_1.printSuccess)("New conversation will be created on next message.");
|
|
60
|
+
rl.prompt();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (text.startsWith(":conv ")) {
|
|
64
|
+
const idStr = text.replace(/^:conv\s+/, "").trim();
|
|
65
|
+
const id = Number(idStr);
|
|
66
|
+
if (!idStr || Number.isNaN(id) || id <= 0) {
|
|
67
|
+
(0, output_1.printError)("Invalid conversation id.");
|
|
68
|
+
rl.prompt();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
forceNew = false;
|
|
72
|
+
(0, maxConfig_1.updateMaxProfile)(profileName, { lastConversationId: id });
|
|
73
|
+
(0, output_1.printSuccess)(`Switched to conversation ${id}.`);
|
|
74
|
+
rl.prompt();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Send message
|
|
78
|
+
try {
|
|
79
|
+
await (0, send_1.runMaxSend)([text], {
|
|
80
|
+
new: forceNew,
|
|
81
|
+
profile: options.profile,
|
|
82
|
+
baseUrl: options.baseUrl,
|
|
83
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
84
|
+
apiKey: options.apiKey,
|
|
85
|
+
debug: options.debug,
|
|
86
|
+
wait: true,
|
|
87
|
+
timeout: options.timeout,
|
|
88
|
+
chatMode: true,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
forceNew = false;
|
|
93
|
+
rl.prompt();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
rl.on("SIGINT", () => {
|
|
97
|
+
rl.close();
|
|
98
|
+
});
|
|
99
|
+
rl.on("close", () => {
|
|
100
|
+
console.log(chalk_1.default.gray("\nBye.\n"));
|
|
101
|
+
process.exitCode = 0;
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=repl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../../../src/max/commands/chat/repl.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,uCAA2C;AAC3C,iCAAoC;AACpC,+CAAwF;AACxF,gDAA+D;AAC/D,wDAAkF;AAWlF,SAAS,aAAa;IAClB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,EAAE,CAAC;AAClB,CAAC;AAEY,QAAA,kBAAkB,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KAChD,WAAW,CACR,4GAA4G,CAC/G;KACA,MAAM,CAAC,kBAAkB,EAAE,+BAAkB,CAAC;KAC9C,MAAM,CAAC,kBAAkB,EAAE,gCAAmB,CAAC;KAC/C,MAAM,CAAC,sBAAsB,EAAE,mDAAmD,CAAC;KACnF,MAAM,CAAC,i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BACrB,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,QAAQ,EAAE,IAAI;aACjB,CAAC,CAAC;QACP,CAAC;gBAAS,CAAC;YACP,QAAQ,GAAG,KAAK,CAAC;YACjB,EAAE,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACjB,EAAE,CAAC,KAAK,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAChB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export interface SendOptions {
|
|
3
|
+
new?: boolean;
|
|
4
|
+
conversation?: string;
|
|
5
|
+
profile?: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
/** @deprecated Use baseUrl (Public API root). */
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
/** Print only the POST response JSON and exit (no poll for assistant reply). */
|
|
11
|
+
json?: boolean;
|
|
12
|
+
/** Print assistant message text from `data` instead of raw JSON. */
|
|
13
|
+
pretty?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Interactive REPL only: stdout is assistant plain text from `data` when possible.
|
|
16
|
+
* Root `max "..."` and `max chat send` use `chatMode: false` (raw JSON unless `--pretty`).
|
|
17
|
+
*/
|
|
18
|
+
chatMode?: boolean;
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
wait?: boolean;
|
|
21
|
+
timeout?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const maxSendCommand: Command;
|
|
24
|
+
export declare function runMaxSend(messageParts: string[], options: SendOptions): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/chat/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAwDD,eAAO,MAAM,cAAc,SAqBrB,CAAC;AAEP,wBAAsB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAkG5F"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxSendCommand = void 0;
|
|
4
|
+
exports.runMaxSend = runMaxSend;
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const httpClient_1 = require("../../lib/httpClient");
|
|
7
|
+
const publicApiPaths_1 = require("../../lib/publicApiPaths");
|
|
8
|
+
const maxResponse_1 = require("../../lib/maxResponse");
|
|
9
|
+
const maxConfig_1 = require("../../maxConfig");
|
|
10
|
+
const output_1 = require("../../../lib/output");
|
|
11
|
+
const helpEpilog_1 = require("../../../lib/helpEpilog");
|
|
12
|
+
/** One-line JSON to stdout (same logical content as backend, stable key order not guaranteed). */
|
|
13
|
+
function writeStdoutJson(value) {
|
|
14
|
+
process.stdout.write(JSON.stringify(value) + "\n");
|
|
15
|
+
}
|
|
16
|
+
function normalizeMessage(messageParts) {
|
|
17
|
+
return messageParts.join(" ").trim();
|
|
18
|
+
}
|
|
19
|
+
function resolveSendBaseUrl(opts) {
|
|
20
|
+
return {
|
|
21
|
+
baseUrl: opts.baseUrl,
|
|
22
|
+
apiBaseUrl: opts.apiBaseUrl,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function assistantTextFromRaw(raw) {
|
|
26
|
+
const { data } = (0, maxResponse_1.assertMaxPublicSuccess)(raw);
|
|
27
|
+
return (0, maxResponse_1.extractMaxUserVisibleMessage)(data) ?? (0, maxResponse_1.extractLatestAssistantText)(data);
|
|
28
|
+
}
|
|
29
|
+
async function pollForAssistantReply(params) {
|
|
30
|
+
const start = Date.now();
|
|
31
|
+
let lastRaw;
|
|
32
|
+
while (Date.now() - start < params.timeoutMs) {
|
|
33
|
+
lastRaw = await (0, httpClient_1.maxApiGet)({
|
|
34
|
+
path: publicApiPaths_1.MAX_PUBLIC_API_PATHS.conversationById(params.conversationId),
|
|
35
|
+
profile: params.profile,
|
|
36
|
+
baseUrl: params.baseUrl,
|
|
37
|
+
apiBaseUrl: params.apiBaseUrl,
|
|
38
|
+
apiKey: params.apiKey,
|
|
39
|
+
debug: params.debug,
|
|
40
|
+
});
|
|
41
|
+
const assistantText = assistantTextFromRaw(lastRaw);
|
|
42
|
+
if (assistantText)
|
|
43
|
+
return { assistantText, lastRaw };
|
|
44
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
45
|
+
}
|
|
46
|
+
lastRaw = await (0, httpClient_1.maxApiGet)({
|
|
47
|
+
path: publicApiPaths_1.MAX_PUBLIC_API_PATHS.conversationById(params.conversationId),
|
|
48
|
+
profile: params.profile,
|
|
49
|
+
baseUrl: params.baseUrl,
|
|
50
|
+
apiBaseUrl: params.apiBaseUrl,
|
|
51
|
+
apiKey: params.apiKey,
|
|
52
|
+
debug: params.debug,
|
|
53
|
+
});
|
|
54
|
+
return { assistantText: assistantTextFromRaw(lastRaw), lastRaw };
|
|
55
|
+
}
|
|
56
|
+
exports.maxSendCommand = new commander_1.Command("send")
|
|
57
|
+
.description("POST /public/v1/max/conversations/message. Default stdout: one-line JSON body as returned by the API. `--pretty`: assistant text from `data`. `--json`: POST response only, no poll.")
|
|
58
|
+
.argument("<message...>", "Message text")
|
|
59
|
+
.option("--new", "Start a new conversation")
|
|
60
|
+
.option("--conversation <id>", "Conversation id to use")
|
|
61
|
+
.option("--profile <name>", helpEpilog_1.MAX_PROFILE_OPTION)
|
|
62
|
+
.option("--base-url <url>", helpEpilog_1.MAX_BASE_URL_OPTION)
|
|
63
|
+
.option("--api-base-url <url>", "Deprecated alias for --base-url (Public API root, …/public/v1)")
|
|
64
|
+
.option("--api-key <key>", "Override per-user API key for this run")
|
|
65
|
+
.option("--json", "Print only the POST response JSON (no polling)")
|
|
66
|
+
.option("--pretty", "Print assistant message text from `data`")
|
|
67
|
+
.option("--debug", "Show debug information")
|
|
68
|
+
.option("--no-wait", "Do not poll for assistant reply")
|
|
69
|
+
.option("--timeout <seconds>", "Polling timeout in seconds", "60")
|
|
70
|
+
.action(async (messageParts, options) => {
|
|
71
|
+
await runMaxSend(messageParts, { ...options, chatMode: false });
|
|
72
|
+
});
|
|
73
|
+
async function runMaxSend(messageParts, options) {
|
|
74
|
+
const chatMode = Boolean(options.chatMode);
|
|
75
|
+
try {
|
|
76
|
+
const profileName = options.profile ?? (0, maxConfig_1.getMaxCurrentProfile)();
|
|
77
|
+
const profile = (0, maxConfig_1.getMaxProfile)(profileName);
|
|
78
|
+
const message = normalizeMessage(messageParts);
|
|
79
|
+
if (!message) {
|
|
80
|
+
(0, output_1.printError)("Message cannot be empty.");
|
|
81
|
+
process.exitCode = 1;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const timeoutSec = Math.max(5, parseInt(options.timeout ?? "60", 10) || 60);
|
|
85
|
+
const timeoutMs = timeoutSec * 1000;
|
|
86
|
+
let conversationId;
|
|
87
|
+
if (options.new) {
|
|
88
|
+
conversationId = undefined;
|
|
89
|
+
}
|
|
90
|
+
else if (options.conversation) {
|
|
91
|
+
conversationId = Number(options.conversation);
|
|
92
|
+
}
|
|
93
|
+
else if (typeof profile?.lastConversationId === "number") {
|
|
94
|
+
conversationId = profile.lastConversationId;
|
|
95
|
+
}
|
|
96
|
+
if (options.conversation && (!conversationId || Number.isNaN(conversationId))) {
|
|
97
|
+
(0, output_1.printError)("Invalid --conversation id.");
|
|
98
|
+
process.exitCode = 1;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const urlOpts = resolveSendBaseUrl(options);
|
|
102
|
+
const postRaw = await (0, httpClient_1.maxApiPost)({
|
|
103
|
+
path: publicApiPaths_1.MAX_PUBLIC_API_PATHS.conversationMessage,
|
|
104
|
+
body: {
|
|
105
|
+
message,
|
|
106
|
+
conversationId,
|
|
107
|
+
},
|
|
108
|
+
profile: options.profile,
|
|
109
|
+
...urlOpts,
|
|
110
|
+
apiKey: options.apiKey,
|
|
111
|
+
debug: options.debug,
|
|
112
|
+
});
|
|
113
|
+
const postInner = (0, maxResponse_1.assertMaxPublicSuccess)(postRaw).data;
|
|
114
|
+
const newConversationId = (0, maxResponse_1.pickConversationIdFromPayload)(postInner);
|
|
115
|
+
if (newConversationId && !Number.isNaN(newConversationId)) {
|
|
116
|
+
(0, maxConfig_1.updateMaxProfile)(profileName, { lastConversationId: newConversationId });
|
|
117
|
+
}
|
|
118
|
+
if (options.json) {
|
|
119
|
+
writeStdoutJson(postRaw);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const textFromPost = assistantTextFromRaw(postRaw);
|
|
123
|
+
const canPoll = options.wait !== false &&
|
|
124
|
+
newConversationId !== undefined &&
|
|
125
|
+
!Number.isNaN(newConversationId);
|
|
126
|
+
let finalRaw = postRaw;
|
|
127
|
+
let finalText = textFromPost;
|
|
128
|
+
if (canPoll && !finalText) {
|
|
129
|
+
const polled = await pollForAssistantReply({
|
|
130
|
+
conversationId: newConversationId,
|
|
131
|
+
profile: options.profile,
|
|
132
|
+
...urlOpts,
|
|
133
|
+
apiKey: options.apiKey,
|
|
134
|
+
debug: options.debug,
|
|
135
|
+
timeoutMs,
|
|
136
|
+
});
|
|
137
|
+
finalRaw = polled.lastRaw;
|
|
138
|
+
finalText = polled.assistantText;
|
|
139
|
+
}
|
|
140
|
+
if (chatMode) {
|
|
141
|
+
if (finalText)
|
|
142
|
+
console.log(finalText);
|
|
143
|
+
else
|
|
144
|
+
writeStdoutJson(finalRaw);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (options.pretty) {
|
|
148
|
+
if (finalText)
|
|
149
|
+
console.log(finalText);
|
|
150
|
+
else
|
|
151
|
+
writeStdoutJson(finalRaw);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
writeStdoutJson(finalRaw);
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
158
|
+
const hint = err.hint;
|
|
159
|
+
(0, output_1.printError)(message, hint);
|
|
160
|
+
process.exitCode = 1;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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IACzB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/conversations/abort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBpC,eAAO,MAAM,4BAA4B,SA+CnC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxConversationsAbortCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const httpClient_1 = require("../../lib/httpClient");
|
|
6
|
+
const publicApiPaths_1 = require("../../lib/publicApiPaths");
|
|
7
|
+
const maxResponse_1 = require("../../lib/maxResponse");
|
|
8
|
+
const output_1 = require("../../../lib/output");
|
|
9
|
+
const helpEpilog_1 = require("../../../lib/helpEpilog");
|
|
10
|
+
exports.maxConversationsAbortCommand = new commander_1.Command("abort")
|
|
11
|
+
.description("POST /public/v1/max/conversations/:conversationId/abortMessage — abort the in-flight assistant message.")
|
|
12
|
+
.argument("<conversationId>", "Conversation id")
|
|
13
|
+
.option("--data <json>", "Optional JSON body (default {})")
|
|
14
|
+
.option("--profile <name>", helpEpilog_1.MAX_PROFILE_OPTION)
|
|
15
|
+
.option("--base-url <url>", helpEpilog_1.MAX_BASE_URL_OPTION)
|
|
16
|
+
.option("--api-base-url <url>", "Deprecated alias for --base-url")
|
|
17
|
+
.option("--api-key <key>", "Override per-user API key for this run")
|
|
18
|
+
.option("--pretty", "Print assistant-style text from `data` when detectable; otherwise full JSON")
|
|
19
|
+
.option("--debug", "Show debug information")
|
|
20
|
+
.action(async (conversationId, options) => {
|
|
21
|
+
try {
|
|
22
|
+
const id = conversationId.trim();
|
|
23
|
+
if (!id) {
|
|
24
|
+
(0, output_1.printError)("conversationId is required.");
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let body = {};
|
|
29
|
+
if (options.data?.trim()) {
|
|
30
|
+
try {
|
|
31
|
+
body = JSON.parse(options.data);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
(0, output_1.printError)("--data must be valid JSON when provided.");
|
|
35
|
+
process.exitCode = 1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const data = await (0, httpClient_1.maxApiPost)({
|
|
40
|
+
path: publicApiPaths_1.MAX_PUBLIC_API_PATHS.conversationAbortMessage(id),
|
|
41
|
+
body,
|
|
42
|
+
profile: options.profile,
|
|
43
|
+
baseUrl: options.baseUrl,
|
|
44
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
45
|
+
apiKey: options.apiKey,
|
|
46
|
+
debug: options.debug,
|
|
47
|
+
});
|
|
48
|
+
(0, maxResponse_1.printMaxRestOutput)(data, options.pretty);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
(0, output_1.printError)(err instanceof Error ? err.message : String(err));
|
|
52
|
+
process.exitCode = 1;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/max/commands/conversations/abort.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,qDAAkD;AAClD,6DAAgE;AAChE,uDAA2D;AAC3D,gDAAiD;AACjD,wDAAkF;AAYrE,QAAA,4BAA4B,GAAG,IAAI,mBAAO,CAAC,OAAO,CAAC;KAC3D,WAAW,CACR,yGAAyG,CAC5G;KACA,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;KAC/C,MAAM,CAAC,eAAe,EAAE,iCAAiC,CAAC;KAC1D,MAAM,CAAC,kBAAkB,EAAE,+BAAkB,CAAC;KAC9C,MAAM,CAAC,kBAAkB,EAAE,gCAAmB,CAAC;KAC/C,MAAM,CA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BAAU,EAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/conversations/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,eAAO,MAAM,0BAA0B,SAiCjC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxConversationsGetCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const httpClient_1 = require("../../lib/httpClient");
|
|
6
|
+
const publicApiPaths_1 = require("../../lib/publicApiPaths");
|
|
7
|
+
const maxResponse_1 = require("../../lib/maxResponse");
|
|
8
|
+
const output_1 = require("../../../lib/output");
|
|
9
|
+
const helpEpilog_1 = require("../../../lib/helpEpilog");
|
|
10
|
+
exports.maxConversationsGetCommand = new commander_1.Command("get")
|
|
11
|
+
.description("GET /public/v1/max/conversations/:conversationId — fetch a single conversation.")
|
|
12
|
+
.argument("<conversationId>", "Conversation id")
|
|
13
|
+
.option("--profile <name>", helpEpilog_1.MAX_PROFILE_OPTION)
|
|
14
|
+
.option("--base-url <url>", helpEpilog_1.MAX_BASE_URL_OPTION)
|
|
15
|
+
.option("--api-base-url <url>", "Deprecated alias for --base-url")
|
|
16
|
+
.option("--api-key <key>", "Override per-user API key for this run")
|
|
17
|
+
.option("--pretty", "Print assistant-style text from `data` when detectable; otherwise full JSON")
|
|
18
|
+
.option("--debug", "Show debug information")
|
|
19
|
+
.action(async (conversationId, options) => {
|
|
20
|
+
try {
|
|
21
|
+
const id = conversationId.trim();
|
|
22
|
+
if (!id) {
|
|
23
|
+
(0, output_1.printError)("conversationId is required.");
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const data = await (0, httpClient_1.maxApiGet)({
|
|
28
|
+
path: publicApiPaths_1.MAX_PUBLIC_API_PATHS.conversationById(id),
|
|
29
|
+
profile: options.profile,
|
|
30
|
+
baseUrl: options.baseUrl,
|
|
31
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
32
|
+
apiKey: options.apiKey,
|
|
33
|
+
debug: options.debug,
|
|
34
|
+
});
|
|
35
|
+
(0, maxResponse_1.printMaxRestOutput)(data, options.pretty);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
(0, output_1.printError)(err instanceof Error ? err.message : String(err));
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/max/commands/conversations/get.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,qDAAiD;AACjD,6DAAgE;AAChE,uDAA2D;AAC3D,gDAAiD;AACjD,wDAAkF;AAWrE,QAAA,0BAA0B,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;KACvD,WAAW,CAAC,iFAAiF,CAAC;KAC9F,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;KAC/C,MAAM,CAAC,kBAAkB,EAAE,+BAAkB,CAAC;KAC9C,MAAM,CAAC,kBAAkB,EAAE,gCAAmB,CAAC;KAC/C,MAAM,CAAC,sBAAsB,EAAE,iCAAiC,CAAC;KACjE,MAAM,CAAC,iBAAiB,EAAE,wCAAwC,CAAC;KACnE,MAAM,CACH,UAAU,EACV,6EAA6E,CAChF;KACA,MAAM,CAAC,SAAS,EAAE,wBAAwB,CAAC;KAC3C,MAAM,CAAC,KAAK,EAAE,cAAsB,EAAE,OAAmB,EAAE,EAAE;IAC1D,IAAI,CAAC;QACD,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,EAAE,EAAE,CAAC;YACN,IAAA,mBAAU,EAAC,6BAA6B,CAAC,CAAC;YAC1C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACX,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAS,EAAU;YAClC,IAAI,EAAE,qCAAoB,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC/C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;SACvB,CAAC,CAAC;QACH,IAAA,gCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACpB,IAAA,mBAAU,EAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/conversations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,uBAAuB,SAQS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maxConversationsCommand = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const list_1 = require("./list");
|
|
6
|
+
const get_1 = require("./get");
|
|
7
|
+
const update_1 = require("./update");
|
|
8
|
+
const abort_1 = require("./abort");
|
|
9
|
+
exports.maxConversationsCommand = new commander_1.Command("conversations")
|
|
10
|
+
.alias("conv")
|
|
11
|
+
.description("Max conversations on the Public API (/public/v1/max/conversations/...). Same auth as frontline (Bearer user API key).")
|
|
12
|
+
.addCommand(list_1.maxConversationsListCommand)
|
|
13
|
+
.addCommand(get_1.maxConversationsGetCommand)
|
|
14
|
+
.addCommand(update_1.maxConversationsUpdateCommand)
|
|
15
|
+
.addCommand(abort_1.maxConversationsAbortCommand);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/max/commands/conversations/index.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,iCAAqD;AACrD,+BAAmD;AACnD,qCAAyD;AACzD,mCAAuD;AAE1C,QAAA,uBAAuB,GAAG,IAAI,mBAAO,CAAC,eAAe,CAAC;KAC9D,KAAK,CAAC,MAAM,CAAC;KACb,WAAW,CACR,uHAAuH,CAC1H;KACA,UAAU,CAAC,kCAA2B,CAAC;KACvC,UAAU,CAAC,gCAA0B,CAAC;KACtC,UAAU,CAAC,sCAA6B,CAAC;KACzC,UAAU,CAAC,oCAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/max/commands/conversations/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,eAAO,MAAM,2BAA2B,SA0BlC,CAAC"}
|