@thirdfy/agent-cli 0.4.3 → 0.5.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/CHANGELOG.md +44 -1
- package/README.md +4 -4
- package/package.json +2 -2
- package/src/cli/help.mjs +1 -0
- package/src/cli/manifest.mjs +4 -4
- package/src/cli/options/index.mjs +2 -0
- package/src/cli/options/onboarding/credentials.mjs +1 -7
- package/src/cli/options/onboarding/oauthLogin.mjs +8 -0
- package/src/commands/account/credits.mjs +9 -7
- package/src/commands/discovery.mjs +6 -5
- package/src/commands/onboarding/bootstrap.mjs +35 -0
- package/src/commands/onboarding/credentials.mjs +0 -10
- package/src/commands/onboarding/oauthLogin.mjs +284 -0
- package/src/core/context.mjs +16 -6
- package/src/core/errorEnvelope.mjs +6 -0
- package/src/core/http.mjs +47 -2
- package/src/core/oauth/authServer.mjs +192 -0
- package/src/core/oauth/pkce.mjs +17 -0
- package/src/core/oauth/session.mjs +117 -0
- package/src/lib/creditsUsdSummary.mjs +128 -29
- package/src/runtime/execution/payloads.mjs +6 -0
- package/src/runtime/handlers.mjs +1 -0
|
@@ -3,6 +3,7 @@ import { wrapWriteIdempotencyKeyForHostedRuntime } from '../../core/execution/ho
|
|
|
3
3
|
import { resolveExecutionContextFromEnv } from '../../core/execution/executionContext.mjs';
|
|
4
4
|
import { requireFlag, parseJsonFlag } from '../../core/args.mjs';
|
|
5
5
|
import { findAgentApiKey, loadProfileConfig } from '../../core/context.mjs';
|
|
6
|
+
import { apiBaseFor, oauthSessionForApi, oauthSessionIsAgentCredential } from '../../core/oauth/session.mjs';
|
|
6
7
|
import { createCliError } from '../../core/envelope.mjs';
|
|
7
8
|
import { toLegacyVenueActionKey } from '../../core/venueBrand.mjs';
|
|
8
9
|
import { normalizeRunMode, normalizeManagedRunMode, normalizeHybridWalletMode } from '../../core/runMode.mjs';
|
|
@@ -62,6 +63,11 @@ function buildBuildTxPayload(flags, resolvedAction, apiAction) {
|
|
|
62
63
|
function resolveAgentKey(flags) {
|
|
63
64
|
const explicit = String(flags.agentKey || '').trim();
|
|
64
65
|
if (explicit) return explicit.toLowerCase();
|
|
66
|
+
// With an OAuth sign-in as the agent credential, the agent is the one the owner picked for it.
|
|
67
|
+
if (oauthSessionIsAgentCredential(flags)) {
|
|
68
|
+
const oauthAgent = String(oauthSessionForApi(apiBaseFor(flags))?.agentKey || '').trim();
|
|
69
|
+
if (oauthAgent) return oauthAgent.toLowerCase();
|
|
70
|
+
}
|
|
65
71
|
const envKey = String(process.env.THIRDFY_AGENT_KEY || process.env.AGENT_KEY || '').trim();
|
|
66
72
|
if (envKey) return envKey.toLowerCase();
|
|
67
73
|
const config = loadProfileConfig();
|