@ziggs-ai/agent-sdk 0.1.6 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/agent-sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Agent framework SDK for building autonomous agents on the Ziggs platform",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -21,9 +21,18 @@
21
21
  "dotenv": "^17.2.3",
22
22
  "openai": "^4.0.0"
23
23
  },
24
- "keywords": ["ziggs", "agent", "sdk", "ai", "autonomous"],
24
+ "keywords": [
25
+ "ziggs",
26
+ "agent",
27
+ "sdk",
28
+ "ai",
29
+ "autonomous"
30
+ ],
25
31
  "license": "MIT",
26
- "files": ["src", "README.md"],
32
+ "files": [
33
+ "src",
34
+ "README.md"
35
+ ],
27
36
  "publishConfig": {
28
37
  "access": "public",
29
38
  "registry": "https://registry.npmjs.org/"
@@ -1,3 +1,5 @@
1
+ import { isBroadcastTarget } from '@ziggs-ai/api-client';
2
+
1
3
  export function getBatchEvents(rawEvent: unknown): unknown[] {
2
4
  if (!rawEvent) return [];
3
5
  const e = rawEvent as Record<string, unknown>;
@@ -12,6 +14,6 @@ export function isTaskResultRelevantToAgent(result: Record<string, unknown>, own
12
14
  result['creatorIsYou'] || result['providerIsYou'] || result['payerIsYou'] || result['proposedToIsYou'] ||
13
15
  parties['creator'] === ownAgentId || parties['provider'] === ownAgentId ||
14
16
  parties['payer'] === ownAgentId || parties['proposedTo'] === ownAgentId ||
15
- parties['proposedTo'] === 'everyone'
17
+ isBroadcastTarget(parties['proposedTo'] as string | undefined)
16
18
  );
17
19
  }
@@ -12,7 +12,7 @@ export const TIER_PRICE_CENTS: Record<FleetPricingTier, number> = {
12
12
  A: 200, // 2 ZIG / call
13
13
  B: 500, // 5 ZIG / call
14
14
  C: 1500, // 15 ZIG / job (orchestrator, charged once at top)
15
- D: 100, // 1 ZIG / call (simulated)
15
+ D: 100, // 1 ZIG / call (hand-written demo agents)
16
16
  };
17
17
 
18
18
  const ZIGGS_ORCHESTRATOR_IDS = new Set(['ziggs-agent']);
@@ -270,305 +270,6 @@ export const FLEET_TIER_BY_AGENT_ID: Record<string, FleetPricingTier> = {
270
270
  "feature-prioritizer": "C",
271
271
  "threat-model-committee": "C",
272
272
  "negotiation-simulator": "C",
273
- "pizza-ordering-agent": "D",
274
- "sushi-ordering-agent": "D",
275
- "burger-ordering-agent": "D",
276
- "salad-ordering-agent": "D",
277
- "coffee-ordering-agent": "D",
278
- "restaurant-finder": "D",
279
- "reservation-maker": "D",
280
- "menu-browser": "D",
281
- "dietary-filter": "D",
282
- "review-aggregator": "D",
283
- "meal-planner": "D",
284
- "recipe-finder": "D",
285
- "grocery-list-builder": "D",
286
- "calorie-counter": "D",
287
- "wine-pairer": "D",
288
- "food-delivery-tracker": "D",
289
- "tip-calculator": "D",
290
- "split-bill-calculator": "D",
291
- "allergen-checker": "D",
292
- "catering-coordinator": "D",
293
- "party-food-planner": "D",
294
- "food-truck-finder": "D",
295
- "brunch-recommender": "D",
296
- "dessert-advisor": "D",
297
- "happy-hour-finder": "D",
298
- "breakfast-planner": "D",
299
- "late-night-eats-finder": "D",
300
- "food-allergy-restaurant-finder": "D",
301
- "kids-menu-finder": "D",
302
- "flight-searcher": "D",
303
- "hotel-booker": "D",
304
- "car-rental": "D",
305
- "airport-transfer": "D",
306
- "visa-checker": "D",
307
- "trip-planner": "D",
308
- "itinerary-builder": "D",
309
- "packing-list-maker": "D",
310
- "currency-advisor": "D",
311
- "travel-insurance": "D",
312
- "train-booker": "D",
313
- "bus-route-finder": "D",
314
- "ferry-scheduler": "D",
315
- "road-trip-planner": "D",
316
- "toll-calculator": "D",
317
- "rideshare-booker": "D",
318
- "bike-share": "D",
319
- "scooter-rental": "D",
320
- "parking-finder": "D",
321
- "traffic-checker": "D",
322
- "travel-photo-finder": "D",
323
- "local-guide": "D",
324
- "phrase-book": "D",
325
- "embassy-locator": "D",
326
- "timezone-advisor": "D",
327
- "cruise-finder": "D",
328
- "camping-booker": "D",
329
- "hostel-searcher": "D",
330
- "vacation-rental": "D",
331
- "loyalty-tracker": "D",
332
- "electronics-shopper": "D",
333
- "fashion-advisor": "D",
334
- "book-recommender": "D",
335
- "gift-finder": "D",
336
- "price-comparator": "D",
337
- "grocery-shopper": "D",
338
- "furniture-browser": "D",
339
- "auto-parts-finder": "D",
340
- "pet-supplies": "D",
341
- "sports-gear": "D",
342
- "deal-hunter": "D",
343
- "coupon-finder": "D",
344
- "wishlist-manager": "D",
345
- "return-tracker": "D",
346
- "warranty-checker": "D",
347
- "subscription-manager": "D",
348
- "auction-bidder": "D",
349
- "local-store-finder": "D",
350
- "size-converter": "D",
351
- "product-reviewer": "D",
352
- "comparison-builder": "D",
353
- "inventory-checker": "D",
354
- "price-drop-monitor": "D",
355
- "flash-sale-alerter": "D",
356
- "barcode-scanner": "D",
357
- "doctor-appointment-booker": "D",
358
- "dentist-scheduler": "D",
359
- "optometrist-finder": "D",
360
- "symptom-checker": "D",
361
- "medication-reminder": "D",
362
- "prescription-tracker": "D",
363
- "pharmacy-finder": "D",
364
- "fitness-trainer": "D",
365
- "workout-planner": "D",
366
- "yoga-instructor": "D",
367
- "meditation-guide": "D",
368
- "step-counter": "D",
369
- "nutrition-advisor": "D",
370
- "diet-planner": "D",
371
- "water-tracker": "D",
372
- "sleep-tracker": "D",
373
- "mood-logger": "D",
374
- "mental-health-checkin": "D",
375
- "stress-advisor": "D",
376
- "breathing-guide": "D",
377
- "first-aid-advisor": "D",
378
- "vaccine-tracker": "D",
379
- "insurance-claim-helper": "D",
380
- "lab-result-explainer": "D",
381
- "pet-vet-booker": "D",
382
- "smart-light-controller": "D",
383
- "thermostat-manager": "D",
384
- "smart-lock-controller": "D",
385
- "camera-monitor": "D",
386
- "smart-speaker": "D",
387
- "plumber-finder": "D",
388
- "electrician-booker": "D",
389
- "cleaner-scheduler": "D",
390
- "gardener-finder": "D",
391
- "pest-control": "D",
392
- "interior-designer": "D",
393
- "paint-matcher": "D",
394
- "furniture-arranger": "D",
395
- "lighting-planner": "D",
396
- "utility-tracker": "D",
397
- "energy-monitor": "D",
398
- "water-advisor": "D",
399
- "moving-coordinator": "D",
400
- "storage-finder": "D",
401
- "furniture-assembly-helper": "D",
402
- "home-warranty-manager": "D",
403
- "renovation-planner": "D",
404
- "contractor-reviewer": "D",
405
- "package-tracker": "D",
406
- "handyman-finder": "D",
407
- "bank-account-viewer": "D",
408
- "transaction-categorizer": "D",
409
- "budget-planner": "D",
410
- "savings-tracker": "D",
411
- "credit-card-advisor": "D",
412
- "loan-calculator": "D",
413
- "mortgage-estimator": "D",
414
- "refinance-checker": "D",
415
- "portfolio-tracker": "D",
416
- "stock-trader-sim": "D",
417
- "crypto-trader-sim": "D",
418
- "robo-advisor": "D",
419
- "tax-estimator": "D",
420
- "deduction-finder": "D",
421
- "tax-filing-assistant": "D",
422
- "receipt-organizer": "D",
423
- "auto-insurance-quoter": "D",
424
- "home-insurance-quoter": "D",
425
- "life-insurance-quoter": "D",
426
- "health-insurance-quoter": "D",
427
- "claim-filer": "D",
428
- "bill-pay-scheduler": "D",
429
- "subscription-auditor": "D",
430
- "retirement-calculator": "D",
431
- "college-savings-planner": "D",
432
- "uber-sim": "D",
433
- "lyft-sim": "D",
434
- "taxi-booker": "D",
435
- "shuttle-service": "D",
436
- "limo-booker": "D",
437
- "subway-navigator": "D",
438
- "bus-tracker": "D",
439
- "commuter-rail": "D",
440
- "light-rail": "D",
441
- "ferry-booker": "D",
442
- "bike-rental": "D",
443
- "scooter-rental-sim": "D",
444
- "e-bike-finder": "D",
445
- "skateboard-rental": "D",
446
- "segway-tour": "D",
447
- "parking-meter": "D",
448
- "garage-finder": "D",
449
- "valet-service": "D",
450
- "airport-parking": "D",
451
- "street-parking": "D",
452
- "car-wash-finder": "D",
453
- "oil-change-scheduler": "D",
454
- "tire-shop": "D",
455
- "mechanic-finder": "D",
456
- "roadside-assistance": "D",
457
- "course-finder": "D",
458
- "university-searcher": "D",
459
- "scholarship-finder": "D",
460
- "admission-advisor": "D",
461
- "resume-reviewer": "D",
462
- "job-searcher": "D",
463
- "interview-prepper": "D",
464
- "salary-negotiator": "D",
465
- "career-coach": "D",
466
- "online-class-enrollor": "D",
467
- "certificate-tracker": "D",
468
- "skill-assessor": "D",
469
- "mentor-matcher": "D",
470
- "language-lesson-booker": "D",
471
- "music-lesson-scheduler": "D",
472
- "tutoring-booker": "D",
473
- "internship-finder": "D",
474
- "networking-advisor": "D",
475
- "linkedin-optimizer": "D",
476
- "conference-finder": "D",
477
- "workshop-registrar": "D",
478
- "webinar-scheduler": "D",
479
- "library-manager": "D",
480
- "study-group-coordinator": "D",
481
- "campus-navigator": "D",
482
- "concert-ticket-buyer": "D",
483
- "movie-ticket-booker": "D",
484
- "theater-booker": "D",
485
- "party-organizer": "D",
486
- "wedding-planner": "D",
487
- "birthday-coordinator": "D",
488
- "sports-ticket-buyer": "D",
489
- "gym-membership-manager": "D",
490
- "spa-booker": "D",
491
- "streaming-manager": "D",
492
- "playlist-curator": "D",
493
- "podcast-recommender": "D",
494
- "board-game-organizer": "D",
495
- "trivia-host": "D",
496
- "karaoke-picker": "D",
497
- "museum-ticket-buyer": "D",
498
- "zoo-pass-manager": "D",
499
- "amusement-park-planner": "D",
500
- "festival-finder": "D",
501
- "book-club-organizer": "D",
502
- "art-class-booker": "D",
503
- "cooking-class-finder": "D",
504
- "photography-booker": "D",
505
- "escape-room-booker": "D",
506
- "dmv-appointment": "D",
507
- "passport-renewal": "D",
508
- "visa-tracker": "D",
509
- "voter-registration": "D",
510
- "polling-finder": "D",
511
- "official-lookup": "D",
512
- "building-permit-tracker": "D",
513
- "zoning-info": "D",
514
- "noise-complaint-filer": "D",
515
- "jury-duty-manager": "D",
516
- "court-date-tracker": "D",
517
- "public-record-searcher": "D",
518
- "tax-authority-contact": "D",
519
- "benefits-checker": "D",
520
- "park-permit": "D",
521
- "recycling-guide": "D",
522
- "carbon-calculator": "D",
523
- "eco-product-finder": "D",
524
- "volunteer-finder": "D",
525
- "donation-tracker": "D",
526
- "charity-evaluator": "D",
527
- "community-board": "D",
528
- "neighborhood-alert": "D",
529
- "lost-and-found": "D",
530
- "carpool-matcher": "D",
531
- "bike-route-planner": "D",
532
- "transit-optimizer": "D",
533
- "solar-estimator": "D",
534
- "ev-charger-finder": "D",
535
- "green-energy-advisor": "D",
536
- "pet-adoption": "D",
537
- "breeder-finder": "D",
538
- "pet-sitter-booker": "D",
539
- "dog-walker": "D",
540
- "pet-groomer": "D",
541
- "pet-boarding": "D",
542
- "pet-food-delivery": "D",
543
- "pet-toy-recommender": "D",
544
- "pet-training-class": "D",
545
- "pet-insurance-comparer": "D",
546
- "dry-cleaner": "D",
547
- "tailor-finder": "D",
548
- "shoe-repair": "D",
549
- "watch-repair": "D",
550
- "phone-repair": "D",
551
- "car-detailer": "D",
552
- "car-wash-booker": "D",
553
- "auto-detailing": "D",
554
- "mechanic-scheduler": "D",
555
- "tire-rotator": "D",
556
- "photo-printer": "D",
557
- "custom-framer": "D",
558
- "engraver": "D",
559
- "embroiderer": "D",
560
- "storage-unit-finder": "D",
561
- "junk-removal": "D",
562
- "donation-pickup": "D",
563
- "hauler": "D",
564
- "painter-finder": "D",
565
- "roofer-finder": "D",
566
- "window-washer": "D",
567
- "chimney-sweep": "D",
568
- "snow-remover": "D",
569
- "lawn-care": "D",
570
- "tree-trimmer": "D",
571
- "power-washer": "D",
572
273
  "aristotle": "B",
573
274
  "plato": "B",
574
275
  "confucius": "B",
@@ -1019,4 +720,4 @@ export const FLEET_TIER_BY_AGENT_ID: Record<string, FleetPricingTier> = {
1019
720
  "death-studies-scholar": "B"
1020
721
  } as Record<string, FleetPricingTier>;
1021
722
 
1022
- export const FLEET_TIER_MAP_SIZE = 1012;
723
+ export const FLEET_TIER_MAP_SIZE = 713;
@@ -2,6 +2,7 @@ import type { Action, Ctx, PromptDef } from '../types.js';
2
2
  import { HistoryFormatter, AgreementFormatter } from '../formatters/index.js';
3
3
  import { validateContext } from '../cognition/validateContext.js';
4
4
  import type { RawEvent } from './buildOutcome.js';
5
+ import { isBroadcastTarget } from '@ziggs-ai/api-client';
5
6
 
6
7
  type AnyObj = Record<string, unknown>;
7
8
 
@@ -370,7 +371,7 @@ ${this._renderDecisionSchemaFromActions(actions, senderMeta, ctxObj, omitMessage
370
371
 
371
372
  const replyTo = (senderMeta.defaultReplyReceiverId as string) || '<receiverId>';
372
373
  const pendingProposals = (ctxObj.agreements || []).filter(
373
- (a) => (a.proposal as Record<string, unknown> | undefined)?.status === 'pending' && (a.proposedToIsYou || (a.parties as Record<string, unknown> | undefined)?.proposedTo === 'everyone'),
374
+ (a) => (a.proposal as Record<string, unknown> | undefined)?.status === 'pending' && (a.proposedToIsYou || isBroadcastTarget((a.parties as Record<string, unknown> | undefined)?.proposedTo as string | undefined)),
374
375
  );
375
376
 
376
377
  if (pendingProposals.length > 0) {
@@ -1,10 +1,9 @@
1
1
  import {
2
- proposeAgreement, delegateAgreement, respondToAgreement, counterAgreement,
2
+ proposeAgreement, proposeBroadcast as proposeBroadcastApi, delegateAgreement, respondToAgreement, counterAgreement,
3
3
  getAgreementStatus, listAgreements, getMyAgreements, getAgreement,
4
4
  publishOffer as publishOfferApi, createAgreement, revokeAgreement, getAgreementsByChat, linkAgreementToChat,
5
5
  getChatsForAgreement, joinAgreement, linkArtifactToAgreement, getArtifactsForAgreement,
6
6
  linkUserToAgreement, getUsersForAgreement, createContract,
7
- OPEN_AGREEMENT_TARGET,
8
7
  type Creds, type Agreement,
9
8
  type ProposeAgreementData, type ProposeDirectInput, type ProposeBroadcastInput,
10
9
  type PublishOfferPayload,
@@ -32,9 +31,13 @@ export class AgreementService {
32
31
  return proposeAgreement(payload, this.creds);
33
32
  }
34
33
 
35
- /** Open buyer-broadcast (`proposedTo: "everyone"`). Server defaults engagementKind to `service`. */
34
+ /**
35
+ * Open buyer-broadcast. `payload.audience` selects who may see/claim it:
36
+ * 'everyone' (default, fully public) or 'org' (members of your active org).
37
+ * Server defaults engagementKind to `service`.
38
+ */
36
39
  proposeBroadcast(payload: ProposeBroadcastInput): Promise<Agreement> {
37
- return proposeAgreement({ ...payload, proposedTo: OPEN_AGREEMENT_TARGET }, this.creds);
40
+ return proposeBroadcastApi(payload, this.creds);
38
41
  }
39
42
 
40
43
  /** @deprecated Alias for {@link proposeDirect}. */
@@ -42,7 +45,10 @@ export class AgreementService {
42
45
  return proposeAgreement(payload, this.creds);
43
46
  }
44
47
 
45
- /** Seller-broadcast marketplace offer (`parties.payer = everyone`). */
48
+ /**
49
+ * Seller-broadcast marketplace offer. `payload.audience` sets the `payer`
50
+ * sentinel: 'everyone' (default, public) or 'org' (your active org only).
51
+ */
46
52
  publishOffer(payload: PublishOfferPayload): Promise<Agreement> {
47
53
  return publishOfferApi(payload, this.creds);
48
54
  }
@@ -7,7 +7,8 @@
7
7
  * config (default 'all'), dispatched to in-process services (taskService /
8
8
  * agreementService) injected into tool context — NOT passed in the user `tools:`
9
9
  * array. Publishing open work is part of this grammar:
10
- * agreement_propose({ proposedTo: "everyone" }) there is no separate publish tool.
10
+ * agreement_propose({ proposedTo: "everyone" }) for a public broadcast, or
11
+ * proposedTo: "org" to scope it to your org — there is no separate publish tool.
11
12
  *
12
13
  * Tier 2 — capability bundles (tier2/). Opt-in, HTTP-backed tool bundles an agent
13
14
  * chooses to have. Off by default; an agent gains a bundle by spreading it into
@@ -33,7 +33,7 @@ export const agreementProposeTool: ToolDefinition = defineTool(
33
33
  'agreement_propose',
34
34
  { description: { type: 'string', required: true }, proposedTo: { type: 'string', required: true }, engagementKind: { type: 'string', enum: ['hire', 'service'], description: 'Contract type. Defaults to service when omitted.' }, parentAgreementId: 'string', parentTaskId: 'string', payerId: 'string', providerId: 'string', price: 'number', lifecycle: 'string', expiresAt: 'string', maxExecutions: 'number', agreementDescription: 'string', plan: { type: 'object' }, planReviewTiming: 'string', requireMidWorkPlanAck: 'boolean' },
35
35
  handlerFor('agreement-propose'),
36
- { description: 'Propose a contract to a user, agent, or everyone (proposedTo="everyone" for open broadcast). engagementKind defaults to service.', isAgreementCreation: true },
36
+ { description: 'Propose a contract to a user, agent, or as an open broadcast. For a broadcast set proposedTo="everyone" (fully public — any agent may claim) or proposedTo="org" (scoped to your org — only members of your org see and claim it). engagementKind defaults to service.', isAgreementCreation: true },
37
37
  );
38
38
 
39
39
  export const agreementSubcontractTool: ToolDefinition = defineTool(
@@ -4,7 +4,9 @@ import { pullFromLedger } from '@ziggs-ai/api-client';
4
4
  type Ctx = Record<string, unknown>;
5
5
 
6
6
  // Read-only marketplace access. Publishing an open quest is NOT here: it is the
7
- // tier-1 protocol verb agreement_propose({ proposedTo: "everyone" }).
7
+ // tier-1 protocol verb agreement_propose({ proposedTo: "everyone" | "org" }).
8
+ // This feed already returns only quests the caller may see — org-scoped quests
9
+ // appear here only for members of the quest's org (filtered server-side).
8
10
  export const marketplaceViewTool: ToolDefinition = defineTool('marketplace_view',
9
11
  { limit: 'number', since: 'string' },
10
12
  async (args, ctx) => {
@@ -19,7 +21,7 @@ export const marketplaceViewTool: ToolDefinition = defineTool('marketplace_view'
19
21
  const quests = await pullFromLedger(options, { operatorKey, agentId });
20
22
  return { quests, count: quests.length };
21
23
  },
22
- { description: 'Browse open quests on the marketplace — work that buyers have broadcast to any willing agent. Use to find available jobs. To claim a quest, use agreement_respond on the returned agreementId. To publish your own quest, use agreement_propose({ proposedTo: "everyone" }).' },
24
+ { description: 'Browse open quests on the marketplace — work buyers have broadcast to willing agents. Returns public quests plus any org-scoped quests in your org. To claim a quest, use agreement_respond on the returned agreementId. To publish your own, use agreement_propose({ proposedTo: "everyone" }) for a public quest or proposedTo: "org" to keep it inside your org.' },
23
25
  );
24
26
 
25
27
  export const MARKETPLACE_TOOLS: ToolDefinition[] = [marketplaceViewTool];