@nordsym/apiclaw 2.8.4 → 2.8.6
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 +74 -156
- package/dist/canon-stats.d.ts +10 -7
- package/dist/canon-stats.d.ts.map +1 -1
- package/dist/canon-stats.js +10 -7
- package/dist/canon-stats.js.map +1 -1
- package/dist/cli/commands/auth.d.ts +0 -4
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.js +0 -18
- package/dist/cli/commands/auth.js.map +1 -1
- package/dist/cli/commands/demo.js +2 -2
- package/dist/cli/commands/demo.js.map +1 -1
- package/dist/cli/commands/setup.js +2 -2
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/index.js +5 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -135
- package/dist/index.js.map +1 -1
- package/dist/metered.d.ts.map +1 -1
- package/dist/metered.js +6 -1
- package/dist/metered.js.map +1 -1
- package/dist/registration-guard.d.ts.map +1 -1
- package/dist/registration-guard.js +0 -2
- package/dist/registration-guard.js.map +1 -1
- package/dist/stripe.d.ts.map +1 -1
- package/dist/stripe.js +4 -3
- package/dist/stripe.js.map +1 -1
- package/dist/test.d.ts +0 -4
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +24 -107
- package/dist/test.js.map +1 -1
- package/package.json +3 -3
package/dist/test.js
CHANGED
|
@@ -1,111 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env npx tsx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { FREE_CALL_PATHS, ENFORCED_CALL_PATHS, requireVerifiedOwner, } from "./registration-guard.js";
|
|
4
|
+
function activeContext(overrides = {}) {
|
|
5
|
+
return {
|
|
6
|
+
sessionToken: "apiclaw_test_session",
|
|
7
|
+
workspaceId: "test_workspace",
|
|
8
|
+
email: "test@example.com",
|
|
9
|
+
tier: "free",
|
|
10
|
+
status: "active",
|
|
11
|
+
usageCount: 0,
|
|
12
|
+
usageRemaining: 25,
|
|
13
|
+
...overrides,
|
|
14
|
+
};
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
assert.equal(FREE_CALL_PATHS.has("purchase_access"), false);
|
|
17
|
+
assert.equal(FREE_CALL_PATHS.has("add_credits"), false);
|
|
18
|
+
assert.equal(ENFORCED_CALL_PATHS.has("call_api"), true);
|
|
19
|
+
assert.equal(ENFORCED_CALL_PATHS.has("capability"), true);
|
|
20
|
+
assert.equal(requireVerifiedOwner(null).ok, false);
|
|
21
|
+
assert.equal(requireVerifiedOwner(activeContext()).ok, true);
|
|
22
|
+
const quotaResult = requireVerifiedOwner(activeContext({ usageRemaining: 0 }));
|
|
23
|
+
assert.equal(quotaResult.ok, false);
|
|
24
|
+
if (!quotaResult.ok) {
|
|
25
|
+
assert.equal(quotaResult.reason, "quota_exceeded");
|
|
18
26
|
}
|
|
19
|
-
|
|
20
|
-
console.log('\n🧪 APIClaw Connected Infrastructure Test\n');
|
|
21
|
-
// Test 1: Check real credentials availability
|
|
22
|
-
log('TEST 1: Real Credentials Check');
|
|
23
|
-
const realCredProviders = getProvidersWithRealCredentials();
|
|
24
|
-
console.log('Providers with real credentials:', realCredProviders);
|
|
25
|
-
console.log('46elks real:', hasRealCredentials('46elks'));
|
|
26
|
-
console.log('Twilio real:', hasRealCredentials('twilio'));
|
|
27
|
-
// Test 2: Credit packages
|
|
28
|
-
log('TEST 2: Credit Packages');
|
|
29
|
-
logResult('Packages', CREDIT_PACKAGES);
|
|
30
|
-
// Test 3: Add credits to agent
|
|
31
|
-
log('TEST 3: Add Credits');
|
|
32
|
-
const initialCredits = getAgentCredits(TEST_AGENT_ID);
|
|
33
|
-
logResult('Initial balance', initialCredits);
|
|
34
|
-
const afterAdd = addCredits(TEST_AGENT_ID, 50);
|
|
35
|
-
logResult('After adding $50', afterAdd);
|
|
36
|
-
// Test 4: Check balance summary
|
|
37
|
-
log('TEST 4: Balance Summary');
|
|
38
|
-
const summary = getBalanceSummary(TEST_AGENT_ID);
|
|
39
|
-
logResult('Summary', summary);
|
|
40
|
-
// Test 5: Purchase 46elks access
|
|
41
|
-
log('TEST 5: Purchase 46elks Access');
|
|
42
|
-
const purchase46elks = purchaseAPIAccess(TEST_AGENT_ID, '46elks', 10);
|
|
43
|
-
logResult('46elks Purchase Result', purchase46elks);
|
|
44
|
-
if (purchase46elks.success && purchase46elks.purchase) {
|
|
45
|
-
console.log('\n🔑 CREDENTIALS RECEIVED:');
|
|
46
|
-
console.log(' Type:', purchase46elks.purchase.credentials?.type);
|
|
47
|
-
if (purchase46elks.purchase.credentials?.type === 'basic') {
|
|
48
|
-
console.log(' Username:', purchase46elks.purchase.credentials?.username);
|
|
49
|
-
console.log(' Password:', purchase46elks.purchase.credentials?.password?.slice(0, 8) + '...');
|
|
50
|
-
}
|
|
51
|
-
console.log(' Real credentials:', hasRealCredentials('46elks'));
|
|
52
|
-
}
|
|
53
|
-
// Test 6: Purchase Twilio access
|
|
54
|
-
log('TEST 6: Purchase Twilio Access');
|
|
55
|
-
const purchaseTwilio = purchaseAPIAccess(TEST_AGENT_ID, 'twilio', 10);
|
|
56
|
-
logResult('Twilio Purchase Result', purchaseTwilio);
|
|
57
|
-
if (purchaseTwilio.success && purchaseTwilio.purchase) {
|
|
58
|
-
console.log('\n🔑 CREDENTIALS RECEIVED:');
|
|
59
|
-
console.log(' Type:', purchaseTwilio.purchase.credentials?.type);
|
|
60
|
-
if (purchaseTwilio.purchase.credentials?.type === 'basic') {
|
|
61
|
-
console.log(' Account SID:', purchaseTwilio.purchase.credentials?.username);
|
|
62
|
-
console.log(' Auth Token:', purchaseTwilio.purchase.credentials?.password?.slice(0, 8) + '...');
|
|
63
|
-
}
|
|
64
|
-
console.log(' Real credentials:', hasRealCredentials('twilio'));
|
|
65
|
-
}
|
|
66
|
-
// Test 7: Final balance
|
|
67
|
-
log('TEST 7: Final Balance');
|
|
68
|
-
const finalSummary = getBalanceSummary(TEST_AGENT_ID);
|
|
69
|
-
logResult('Final Summary', {
|
|
70
|
-
balance: finalSummary.credits.balance_usd,
|
|
71
|
-
active_purchases: finalSummary.active_purchases.length,
|
|
72
|
-
total_spent: finalSummary.total_spent_usd,
|
|
73
|
-
real_credential_providers: finalSummary.real_credentials_available,
|
|
74
|
-
});
|
|
75
|
-
// Test 8: Stripe integration (if configured)
|
|
76
|
-
log('TEST 8: Stripe Integration');
|
|
77
|
-
if (process.env.STRIPE_SECRET_KEY) {
|
|
78
|
-
console.log('Stripe is configured!');
|
|
79
|
-
// Test creating a payment intent
|
|
80
|
-
const paymentIntent = await createPaymentIntent('test_agent_stripe', 'starter');
|
|
81
|
-
if ('error' in paymentIntent) {
|
|
82
|
-
console.log('Payment Intent Error:', paymentIntent.error);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
console.log('Payment Intent Created:');
|
|
86
|
-
console.log(' ID:', paymentIntent.paymentIntentId);
|
|
87
|
-
console.log(' Amount: $' + paymentIntent.amount);
|
|
88
|
-
console.log(' Client Secret:', paymentIntent.clientSecret.slice(0, 20) + '...');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
console.log('Stripe not configured - skipping');
|
|
93
|
-
}
|
|
94
|
-
// Test 9: Insufficient balance
|
|
95
|
-
log('TEST 9: Insufficient Balance Check');
|
|
96
|
-
const insufficientPurchase = purchaseAPIAccess(TEST_AGENT_ID, '46elks', 1000);
|
|
97
|
-
logResult('Should fail', insufficientPurchase);
|
|
98
|
-
// Summary
|
|
99
|
-
log('TEST SUMMARY');
|
|
100
|
-
console.log(`
|
|
101
|
-
✅ Real credentials available for: ${realCredProviders.join(', ') || 'none'}
|
|
102
|
-
✅ Agent can add credits
|
|
103
|
-
✅ Agent can purchase API access
|
|
104
|
-
✅ Real 46elks/Twilio credentials returned when available
|
|
105
|
-
✅ Insufficient balance check works
|
|
106
|
-
${process.env.STRIPE_SECRET_KEY ? '✅ Stripe integration working' : '⚠️ Stripe not configured'}
|
|
107
|
-
`);
|
|
108
|
-
}
|
|
109
|
-
// Run tests
|
|
110
|
-
runTests().catch(console.error);
|
|
27
|
+
console.log("APIClaw safe smoke tests passed");
|
|
111
28
|
//# sourceMappingURL=test.js.map
|
package/dist/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,yBAAyB,CAAC;AAEjC,SAAS,aAAa,CAAC,YAA2C,EAAE;IAClE,OAAO;QACL,YAAY,EAAE,sBAAsB;QACpC,WAAW,EAAE,gBAAgB;QAC7B,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,CAAC;QACb,cAAc,EAAE,EAAE;QAClB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC,CAAC;AAC5D,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC;AACxD,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;AACxD,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;AAE1D,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACnD,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;AAE7D,MAAM,WAAW,GAAG,oBAAoB,CAAC,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/E,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AACpC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC;IACpB,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AACrD,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordsym/apiclaw",
|
|
3
|
-
"version": "2.8.
|
|
4
|
-
"description": "The Control Plane for AI Agents. 26,
|
|
3
|
+
"version": "2.8.6",
|
|
4
|
+
"description": "The Control Plane for AI Agents. 26,701 discoverable APIs, 2,906 callable, 49 fully managed. Agent-native auth: `apiclaw auth login` opens your browser, one-tap sign-in, writes ~/.apiclaw.toml. Four doors: local MCP, CLI, HTTP gateway, Remote MCP. One auth, every door.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"homepage": "https://apiclaw.cloud",
|
|
@@ -94,4 +94,4 @@
|
|
|
94
94
|
"apiclaw": "./dist/bin.js",
|
|
95
95
|
"apiclaw-http": "./dist/bin-http.js"
|
|
96
96
|
}
|
|
97
|
-
}
|
|
97
|
+
}
|