2020117-agent 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.
package/dist/agent.js CHANGED
@@ -60,6 +60,9 @@ for (const arg of process.argv.slice(2)) {
60
60
  case '--api-url':
61
61
  process.env.API_2020117_URL = val;
62
62
  break;
63
+ case '--models':
64
+ process.env.MODELS = val;
65
+ break;
63
66
  }
64
67
  }
65
68
  import { SwarmNode, topicFromKind } from './swarm.js';
@@ -81,6 +84,7 @@ const SUB_CHANNEL = process.env.SUB_CHANNEL || 'p2p';
81
84
  const SUB_PROVIDER = process.env.SUB_PROVIDER || undefined;
82
85
  const SUB_BID = Number(process.env.SUB_BID) || 100;
83
86
  const MAX_SATS_PER_CHUNK = Number(process.env.MAX_SATS_PER_CHUNK) || 5;
87
+ const MIN_BID_SATS = Number(process.env.MIN_BID_SATS) || SATS_PER_CHUNK * CHUNKS_PER_PAYMENT; // default = pricing per job
84
88
  const SUB_BATCH_SIZE = Number(process.env.SUB_BATCH_SIZE) || 500; // chars to accumulate before local processing
85
89
  const state = {
86
90
  agentName: loadAgentName(),
@@ -139,11 +143,13 @@ async function setupPlatform(label) {
139
143
  return;
140
144
  }
141
145
  console.log(`[${label}] Registering on platform...`);
146
+ const models = process.env.MODELS ? process.env.MODELS.split(',').map(s => s.trim()) : undefined;
142
147
  await registerService({
143
148
  kind: KIND,
144
149
  satsPerChunk: SATS_PER_CHUNK,
145
150
  chunksPerPayment: CHUNKS_PER_PAYMENT,
146
151
  model: state.processor?.name || 'unknown',
152
+ models,
147
153
  });
148
154
  state.stopHeartbeat = startHeartbeatLoop(() => getAvailableCapacity());
149
155
  }
@@ -167,6 +173,13 @@ function startInboxPoller(label) {
167
173
  break;
168
174
  if (!acquireSlot())
169
175
  break;
176
+ // Check bid meets minimum pricing
177
+ const bidSats = job.bid_sats ?? 0;
178
+ if (MIN_BID_SATS > 0 && bidSats < MIN_BID_SATS) {
179
+ console.log(`[${label}] Skipping job ${job.id}: bid ${bidSats} < min ${MIN_BID_SATS} sats`);
180
+ releaseSlot();
181
+ continue;
182
+ }
170
183
  // Process in background — don't await
171
184
  processAsyncJob(label, job.id, job.input).catch((err) => {
172
185
  console.error(`[${label}] Async job ${job.id} error: ${err.message}`);
package/dist/api.d.ts CHANGED
@@ -22,6 +22,7 @@ export declare function registerService(opts: {
22
22
  satsPerChunk: number;
23
23
  chunksPerPayment: number;
24
24
  model?: string;
25
+ models?: string[];
25
26
  }): Promise<unknown | null>;
26
27
  export declare function sendHeartbeat(capacity?: number): Promise<boolean>;
27
28
  export declare function getOnlineProviders(kind: number): Promise<OnlineAgent[]>;
package/dist/api.js CHANGED
@@ -136,6 +136,8 @@ export async function registerService(opts) {
136
136
  description: desc,
137
137
  pricing: { min_sats: satsPerPayment, max_sats: satsPerPayment },
138
138
  };
139
+ if (opts.models && opts.models.length > 0)
140
+ body.models = opts.models;
139
141
  const resp = await fetch(`${BASE_URL}/api/dvm/services`, {
140
142
  method: 'POST',
141
143
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "2020117-agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "2020117 agent runtime — API polling + Hyperswarm P2P + Cashu streaming payments",
5
5
  "type": "module",
6
6
  "bin": {