@thirdfy/agent-cli 0.1.0 → 0.1.2

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.
@@ -4,16 +4,15 @@ import { randomUUID } from 'crypto';
4
4
  import fs from 'fs';
5
5
  import path from 'path';
6
6
  import { createRequire } from 'module';
7
- import { pathToFileURL } from 'url';
8
7
 
9
8
  const require = createRequire(import.meta.url);
10
9
  const { normalizeIntentResponse } = require('../src/utils/cli/intentNormalization.cjs');
10
+ const { version: CLI_VERSION } = require('../package.json');
11
11
  const {
12
12
  normalizeDelegationStatus,
13
13
  normalizeCredentialStatus,
14
14
  } = require('../src/utils/cli/delegationNormalization.cjs');
15
15
 
16
- const CLI_VERSION = '0.1.0';
17
16
  const DEFAULT_API_BASE = 'https://api.thirdfy.com';
18
17
  const DEFAULT_TIMEOUT_MS = 30000;
19
18
  const DEFAULT_CATALOG_CACHE_TTL_MS = 60_000;
@@ -39,36 +38,25 @@ const context = {
39
38
  verbose,
40
39
  };
41
40
 
42
- const isEntrypoint = (() => {
43
- try {
44
- if (!process.argv[1]) return false;
45
- return import.meta.url === pathToFileURL(process.argv[1]).href;
46
- } catch {
47
- return false;
48
- }
49
- })();
50
-
51
- if (isEntrypoint) {
52
- main().catch((error) => {
53
- const statusCode = Number(error?.statusCode || 0) || undefined;
54
- const payload = error?.payload && typeof error.payload === 'object' ? error.payload : {};
55
- const blockedReason = String(payload.blockedReason || payload.error || '').trim() || undefined;
56
- const blockedStage = String(payload.blockedStage || '').trim() || undefined;
57
- printEnvelope({
58
- success: false,
59
- code: statusCode ? 'API_REQUEST_FAILED' : 'CLI_UNHANDLED_ERROR',
60
- message: error?.message || 'Unhandled CLI error',
61
- data: {
62
- statusCode,
63
- blockedReason,
64
- blockedStage,
65
- payload,
66
- },
67
- meta: { version: CLI_VERSION, apiBase: context.apiBase },
68
- });
69
- process.exit(1);
41
+ main().catch((error) => {
42
+ const statusCode = Number(error?.statusCode || 0) || undefined;
43
+ const payload = error?.payload && typeof error.payload === 'object' ? error.payload : {};
44
+ const blockedReason = String(payload.blockedReason || payload.error || '').trim() || undefined;
45
+ const blockedStage = String(payload.blockedStage || '').trim() || undefined;
46
+ printEnvelope({
47
+ success: false,
48
+ code: statusCode ? 'API_REQUEST_FAILED' : 'CLI_UNHANDLED_ERROR',
49
+ message: error?.message || 'Unhandled CLI error',
50
+ data: {
51
+ statusCode,
52
+ blockedReason,
53
+ blockedStage,
54
+ payload,
55
+ },
56
+ meta: { version: CLI_VERSION, apiBase: context.apiBase },
70
57
  });
71
- }
58
+ process.exit(1);
59
+ });
72
60
 
73
61
  async function main() {
74
62
  if (globalFlags.version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thirdfy/agent-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Thirdfy Agent CLI for onboarding, governance preflight, execute-intent, and status polling.",
5
5
  "type": "module",
6
6
  "bin": {