dynamoi 0.2.6 → 0.2.8
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 +10 -9
- package/dist/dynamoi.js +7 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
[](./LICENSE)
|
|
7
7
|
|
|
8
8
|
The `dynamoi` command line runs [Dynamoi](https://dynamoi.com) music promotion
|
|
9
|
-
from a terminal, a script or any agent that can run shell commands.
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
from a terminal, a script or any agent that can run shell commands. Promote a
|
|
10
|
+
song on Spotify or promote a video on YouTube: check campaign results, make a
|
|
11
|
+
free smart link for music or a free link in bio for musicians, and launch
|
|
12
|
+
Spotify and YouTube ad campaigns, with the same account, tools and consent
|
|
13
|
+
rules as the Dynamoi apps.
|
|
12
14
|
It works with any distributor.
|
|
13
15
|
|
|
14
16
|
<p align="center">
|
|
@@ -78,17 +80,16 @@ computer, it gets the full tool set.
|
|
|
78
80
|
|
|
79
81
|
## Paid actions need your yes
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
Some tools require explicit confirmation arguments (`confirm...`,
|
|
84
|
+
`authorize...`, `accepted...`). The CLI never fills required confirmations
|
|
85
|
+
without your approval.
|
|
84
86
|
|
|
85
87
|
- In a terminal, it shows the tool's summary and asks `[y/N]` first.
|
|
86
88
|
- In a script or an agent, you pass the flag yourself, for example
|
|
87
89
|
`--confirm-application-submission`.
|
|
88
|
-
- Budget consent versions and hashes are always passed explicitly. Find them
|
|
89
|
-
with `dynamoi help <tool>`.
|
|
90
90
|
|
|
91
|
-
Without
|
|
91
|
+
Without required confirmations, the server refuses that action.
|
|
92
|
+
Legacy campaign funding fields are optional and ignored.
|
|
92
93
|
|
|
93
94
|
## Links
|
|
94
95
|
|
package/dist/dynamoi.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var package_default = {
|
|
4
4
|
$schema: "https://www.schemastore.org/package",
|
|
5
5
|
name: "dynamoi",
|
|
6
|
-
version: "0.2.
|
|
6
|
+
version: "0.2.8",
|
|
7
7
|
type: "module",
|
|
8
8
|
license: "MIT",
|
|
9
9
|
description: "Music promotion and distribution, built for AI agents: the Dynamoi command line.",
|
|
@@ -433,6 +433,7 @@ async function clearCredentials() {
|
|
|
433
433
|
// src/oauth.ts
|
|
434
434
|
var BASE_URL = "https://dynamoi.com";
|
|
435
435
|
var MCP_URL = `${BASE_URL}/mcp`;
|
|
436
|
+
var CLIENT_ID = "https://dynamoi.com/api/oauth/clients/dynamoi-cli";
|
|
436
437
|
var b64url = (bytes) => bytes.toString("base64url");
|
|
437
438
|
async function jsonBody(response) {
|
|
438
439
|
try {
|
|
@@ -461,11 +462,12 @@ async function postForm(url, body) {
|
|
|
461
462
|
return json;
|
|
462
463
|
}
|
|
463
464
|
function toCredentials(token, clientId, previous) {
|
|
465
|
+
const refreshToken = token.refresh_token ?? previous?.refreshToken;
|
|
464
466
|
return {
|
|
465
467
|
accessToken: token.access_token,
|
|
466
468
|
clientId,
|
|
467
469
|
expiresAt: Date.now() + (token.expires_in ?? 3600) * 1000,
|
|
468
|
-
refreshToken:
|
|
470
|
+
...refreshToken === undefined ? {} : { refreshToken },
|
|
469
471
|
scope: token.scope ?? previous?.scope ?? ""
|
|
470
472
|
};
|
|
471
473
|
}
|
|
@@ -516,26 +518,10 @@ async function login(print, open = openBrowser) {
|
|
|
516
518
|
const { port, result } = await listenForRedirect(state);
|
|
517
519
|
const redirectUri = `http://127.0.0.1:${port}/callback`;
|
|
518
520
|
const scope = (meta.scopes_supported ?? []).join(" ");
|
|
519
|
-
const registration = await fetch(meta.registration_endpoint, {
|
|
520
|
-
body: JSON.stringify({
|
|
521
|
-
client_name: "Dynamoi CLI",
|
|
522
|
-
grant_types: ["authorization_code", "refresh_token"],
|
|
523
|
-
redirect_uris: [redirectUri],
|
|
524
|
-
response_types: ["code"],
|
|
525
|
-
scope,
|
|
526
|
-
token_endpoint_auth_method: "none"
|
|
527
|
-
}),
|
|
528
|
-
headers: { "content-type": "application/json" },
|
|
529
|
-
method: "POST"
|
|
530
|
-
});
|
|
531
|
-
const client = await jsonBody(registration);
|
|
532
|
-
if (!(registration.ok && client.client_id)) {
|
|
533
|
-
throw new Error(`Could not register the CLI (HTTP ${registration.status}).`);
|
|
534
|
-
}
|
|
535
521
|
const verifier = b64url(randomBytes(32));
|
|
536
522
|
const authorize = new URL(meta.authorization_endpoint);
|
|
537
523
|
authorize.search = new URLSearchParams({
|
|
538
|
-
client_id:
|
|
524
|
+
client_id: CLIENT_ID,
|
|
539
525
|
code_challenge: b64url(createHash("sha256").update(verifier).digest()),
|
|
540
526
|
code_challenge_method: "S256",
|
|
541
527
|
redirect_uri: redirectUri,
|
|
@@ -558,14 +544,14 @@ ${authorize}`);
|
|
|
558
544
|
throw new Error("Sign-in response came from an unexpected issuer.");
|
|
559
545
|
}
|
|
560
546
|
const token = await postForm(meta.token_endpoint, {
|
|
561
|
-
client_id:
|
|
547
|
+
client_id: CLIENT_ID,
|
|
562
548
|
code,
|
|
563
549
|
code_verifier: verifier,
|
|
564
550
|
grant_type: "authorization_code",
|
|
565
551
|
redirect_uri: redirectUri,
|
|
566
552
|
resource: MCP_URL
|
|
567
553
|
});
|
|
568
|
-
const credentials = toCredentials(token,
|
|
554
|
+
const credentials = toCredentials(token, CLIENT_ID);
|
|
569
555
|
await saveCredentials(credentials);
|
|
570
556
|
return credentials;
|
|
571
557
|
}
|
package/package.json
CHANGED