@dvmkit/dvm-cli 0.8.1 → 0.8.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.
- package/dist/dvm.js +40 -22
- package/package.json +1 -1
package/dist/dvm.js
CHANGED
|
@@ -11470,10 +11470,49 @@ function findLastYield(messages2) {
|
|
|
11470
11470
|
return void 0;
|
|
11471
11471
|
}
|
|
11472
11472
|
|
|
11473
|
+
// src/lib/schema-defaults.ts
|
|
11474
|
+
function applyJsonSchemaDefaults(schema, data) {
|
|
11475
|
+
const applied = {};
|
|
11476
|
+
if (!schema || typeof schema !== "object") return { data: { ...data }, applied };
|
|
11477
|
+
const properties = schema.properties;
|
|
11478
|
+
if (!properties || typeof properties !== "object") return { data: { ...data }, applied };
|
|
11479
|
+
const merged = { ...data };
|
|
11480
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
11481
|
+
if (key in merged) continue;
|
|
11482
|
+
if (!propSchema || typeof propSchema !== "object") continue;
|
|
11483
|
+
if (!("default" in propSchema)) continue;
|
|
11484
|
+
const defaultValue = propSchema.default;
|
|
11485
|
+
merged[key] = defaultValue;
|
|
11486
|
+
applied[key] = defaultValue;
|
|
11487
|
+
}
|
|
11488
|
+
return { data: merged, applied };
|
|
11489
|
+
}
|
|
11490
|
+
function formatAppliedDefaults(applied) {
|
|
11491
|
+
return Object.entries(applied).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(", ");
|
|
11492
|
+
}
|
|
11493
|
+
|
|
11473
11494
|
// src/lib/discovery-lifecycle.ts
|
|
11474
11495
|
async function runDiscoveryLifecycle(options) {
|
|
11475
11496
|
const { transport, provider, capability, input, timeoutMs } = options;
|
|
11476
|
-
const
|
|
11497
|
+
const providerInfo = await transport.describe(provider);
|
|
11498
|
+
const schema = providerInfo.capabilities?.[capability]?.input_schema ?? providerInfo.inputSchema;
|
|
11499
|
+
const normalized = applyJsonSchemaDefaults(schema, JSON.parse(input)).data;
|
|
11500
|
+
let data;
|
|
11501
|
+
if (providerInfo.auth?.includes(SIGNED_REQUEST_AUTH_ID) || providerInfo.auth?.includes("secp256k1-schnorr")) {
|
|
11502
|
+
const signer = resolveSigningIdentity({ config: loadConfig() });
|
|
11503
|
+
data = signDvmRequestData(signer.privkey, normalized, signedRequestDomain({
|
|
11504
|
+
provider: providerInfo,
|
|
11505
|
+
endpoint: provider.endpoint,
|
|
11506
|
+
method: "POST",
|
|
11507
|
+
path: "v1/job",
|
|
11508
|
+
capability
|
|
11509
|
+
}));
|
|
11510
|
+
}
|
|
11511
|
+
const receipt = await transport.submit(provider, {
|
|
11512
|
+
capability,
|
|
11513
|
+
input: JSON.stringify(normalized),
|
|
11514
|
+
...data ? { data } : {}
|
|
11515
|
+
});
|
|
11477
11516
|
if (receipt.status === "completed" && receipt.summary) {
|
|
11478
11517
|
return { summary: receipt.summary, messages: [], nextAction: null };
|
|
11479
11518
|
}
|
|
@@ -22450,27 +22489,6 @@ function isPlainObject3(value) {
|
|
|
22450
22489
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22451
22490
|
}
|
|
22452
22491
|
|
|
22453
|
-
// src/lib/schema-defaults.ts
|
|
22454
|
-
function applyJsonSchemaDefaults(schema, data) {
|
|
22455
|
-
const applied = {};
|
|
22456
|
-
if (!schema || typeof schema !== "object") return { data: { ...data }, applied };
|
|
22457
|
-
const properties = schema.properties;
|
|
22458
|
-
if (!properties || typeof properties !== "object") return { data: { ...data }, applied };
|
|
22459
|
-
const merged = { ...data };
|
|
22460
|
-
for (const [key, propSchema] of Object.entries(properties)) {
|
|
22461
|
-
if (key in merged) continue;
|
|
22462
|
-
if (!propSchema || typeof propSchema !== "object") continue;
|
|
22463
|
-
if (!("default" in propSchema)) continue;
|
|
22464
|
-
const defaultValue = propSchema.default;
|
|
22465
|
-
merged[key] = defaultValue;
|
|
22466
|
-
applied[key] = defaultValue;
|
|
22467
|
-
}
|
|
22468
|
-
return { data: merged, applied };
|
|
22469
|
-
}
|
|
22470
|
-
function formatAppliedDefaults(applied) {
|
|
22471
|
-
return Object.entries(applied).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(", ");
|
|
22472
|
-
}
|
|
22473
|
-
|
|
22474
22492
|
// src/lib/warmup-provider.ts
|
|
22475
22493
|
var DEFAULT_BUDGET_MS = 3e4;
|
|
22476
22494
|
var DEFAULT_MAX_ATTEMPTS = 4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvmkit/dvm-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Command-line client and agent skill for Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key",
|
|
5
5
|
"author": "DVM Technologies Ltd",
|
|
6
6
|
"keywords": [
|