From 267f9efc72505bdd91ff2cd6bf8e5ec23a60ae58 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 5 Nov 2026 15:50:05 +0100 Subject: [PATCH] Pie in the Sky for agents: every Pie action classified and typed, its state and results documented --- src/agent/10-domains.js | 9 +++++++++ src/agent/20-commands.js | 24 ++++++++++++++++++++++++ src/agent/30-docs.js | 3 +++ src/agent/40-read.js | 2 +- tests/mcp-commands.test.js | 1 + 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/agent/10-domains.js b/src/agent/10-domains.js index a0005c9..f1b8a8f 100644 --- a/src/agent/10-domains.js +++ b/src/agent/10-domains.js @@ -75,6 +75,15 @@ const API_DOMAINS={ // Entity ids (uid()) cannot be validated against a table: shape only. A wrong id is the game's // to answer, honestly, with no_effect — never a refusal invented on this side of the wall. entityId:{kind:'string'}, + // Pie in the Sky (the rocket company, unlocked by a Tier 1 win in a new game or from day 0 in a sandbox). + rocketId:{table:'ROCKETS',kind:'key'}, + crustId:{table:'CRUSTS',kind:'key'}, + pieRdId:{table:'PIE_RD',kind:'key'}, + pieTab:{kind:'enum',values:()=>PIE_TABS.slice()}, + pieBidShare:{kind:'enum',values:()=>PIE_RDF_BIDS.slice()}, + pieSpatId:{table:'PIE_SPAT_DEF',kind:'key'}, + pieSpatChoice:{kind:'enum',values:[0,1]}, + countryCode:{kind:'enum',values:()=>[...new Set(CITIES.map(c=>c.cc))].sort()}, scnId:{table:'SCN',kind:'id'}, // A traceroute target in the modal's own terms. }; diff --git a/src/agent/20-commands.js b/src/agent/20-commands.js index 8742811..0a8cff3 100644 --- a/src/agent/20-commands.js +++ b/src/agent/20-commands.js @@ -9,6 +9,20 @@ (may end in a question); reads 'modal' (the window's text is the report); watch (extra fingerprint paths, #name filled from args); quote (the dry run, priced with the game's own helpers); doc. */ const API_CMD={ +/* ---------- Pie in the Sky: the rocket company (Tier 1 in a new game, or a sandbox) ---------- */ + pieFound:{args:[],watch:['pie'],quote:a=>({setup:piePrice(PIE_CO),monthly:PIE_CO_MO}),doc:'Found the rocket company. Needs Tier 1 (or a sandbox).'}, + pieFactory:{args:[],watch:['pie'],quote:a=>({setup:piePrice(PIE_FAC)}),doc:'Build the pie factory: it bakes the satellites ("pies") that rockets carry.'}, + piePad:{args:[['city','cityId']],watch:['pie'],doc:'Build a launch pad in a city. Pads near the equator lift more.'}, + pieRd:{args:[['k','pieRdId']],watch:['pie'],quote:a=>({setup:piePrice(PIE_RD[a.k].cost)}),doc:'Fund rocket R&D: reuse (reusable boosters, cheaper launches) or heavy (a bigger rocket, after test flights).'}, + pieLaunch:{args:[['rk','rocketId'],['cr','crustId']],watch:['pie'],doc:'Queue a launch of a rocket into a crust (an orbital shell). Insurance and lasers follow the Launch tab toggles (pieIns, pieLas).'}, + pieDish:{args:[['city','cityId']],watch:['pie'],doc:'Build a pie dish (ground station) at one of your POPs. Needs landing rights in its country.'}, + pieAnt:{args:[['id','entityId']],watch:['pie'],quote:a=>({setup:piePrice(PIE_ANT)}),doc:'Add an antenna to a pie dish (20 Gbps each, 16 at most).'}, + pieLic:{args:[['cc','countryCode']],watch:['pie'],doc:'Buy or renew landing rights in a country, for its dishes and orbit customers.'}, + pieSafe:{args:[],watch:['pie'],doc:'Toggle safe mode: pies ride out solar storms, carrying nothing meanwhile.'}, + pieName:{args:[],watch:['pie'],doc:'Rename the rocket company to the next name on the list.'}, + pieBid:{args:[['id','entityId'],['f','pieBidShare']],watch:['pie'],doc:'Bid in a Rural Digital Pie Fund auction, asking this share of the reserve. The lower ask wins.'}, + pieExim:{args:[],watch:['pie','loans'],doc:'Take the Export-Import Pie Bank loan, with its space covenants.'}, + pieSpatPick:{args:[['id','pieSpatId'],['c','pieSpatChoice']],watch:['pie'],doc:'Answer a geopolitical spat over orbit: choice 0 or 1, as its sheet offers.'}, downIx:{args:[['city','ixId']],watch:['ixp'],doc:'Step an exchange port down one size.'}, downT:{args:[['id','entityId']],watch:['transit.#id'],doc:'Step a transit port down one size (a LAG steps down together).'}, downP:{args:[['id','entityId']],watch:['pni.#id'],doc:'Step a PNI down one size. Not while an augment is on order.'}, @@ -429,6 +443,15 @@ const API_CMD={ }; const API_VIEW={ + pieOpen:{args:[],doc:'Open Pie Control, the rocket company\'s panel.'}, + pieGovOpen:{args:[],doc:'Open Pie Control on its Gov tab.'}, + pieTab:{args:[['t','pieTab']],doc:'Switch the Pie Control tab.'}, + pieCity:{args:[['v','cityId']],doc:'Pick the POP the Dishes tab works on.'}, + pieHi:{args:[['id','string']],doc:'Highlight one orbit flow on the Pie Control globe.'}, + pieIns:{args:[],doc:'Toggle launch insurance for the next launches.'}, + pieLas:{args:[],doc:'Toggle lasers (inter-satellite links) for the next launches.'}, + pieGlobeNight:{args:[],doc:'Flip the Pie Control globe between day and night.'}, + pieSpatOpen:{args:[['id','pieSpatId']],doc:'Open the sheet of a geopolitical spat over orbit.'}, traceMode:{args:[['m','string']],doc:'Redo the open traceroute in a routing mode: normal, fast or scenic.'}, chartToggle:{args:[['c','string'],['k','string']],doc:'Hide or show one series of a dashboard chart (a legend click); hiding every series shows them all again.'}, help:{args:[],doc:'Open the how-to-play modal.'}, @@ -507,6 +530,7 @@ const API_VIEW={ }; const API_BOUND={ + pieRename:{command:'pieName',note:'the typed company name'}, leaseSwap:{command:'orderDf',note:'presets the dark-fiber modal on a leased pair'}, teOpt:{command:'teDeploy',arg:'script',note:'the optimiser drafts a script'}, teSlop:{command:'teDeploy',arg:'script',note:'the AI drafts a script'}, diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index ccc5fe0..8da7fa2 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -52,6 +52,8 @@ const API_STATE_DOC={ scrubs:{type:'array',doc:'Scrubbing centres: city and tier.'}, scrubMode:{type:'string',doc:'always | ondemand.'}, cnLic:{type:'map',doc:'Mainland China licence: none | pending (with ready day) | ok.'}, + pieV:{type:'number',doc:'Pie in the Sky version stamp: 1 in games started since it shipped (only those unlock it, on a Tier 1 win).'}, + pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, founder posts, books, and government money (gov: auctions, awards, Ex-Im).'}, ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, @@ -93,6 +95,7 @@ const API_STATE_DOC={ }; const API_RESULTS_DOC={ + pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue, service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, nt:{type:'map',doc:'Traffic per network through transit, by net id.'}, tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'}, reachNT:{type:'number',doc:'Networks reachable without transit.'}, diff --git a/src/agent/40-read.js b/src/agent/40-read.js index 11aaf4d..e767e2d 100644 --- a/src/agent/40-read.js +++ b/src/agent/40-read.js @@ -26,7 +26,7 @@ function apiJson(v){ carries the keys confGo/confSponsor need, which exist in no field of S; TE_RECIPES renders each recipe's script, because the source is a function and some read the live network. The recipes' relevance score is not exposed: judging which one fits is the agent's job. */ -const API_TABLES={SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG}; +const API_TABLES={ROCKETS,CRUSTS,PIE_RD,PIE_SPAT_DEF,SALES,CITIES,NETS,CABLES,XIX,PORT,LT,NNI,VXC,RG,OPT,DF_SYS,FAB,SCRUB_TIERS,BIZ_T,LEVELS,GOALS,BROKER_GOALS,SCN,BANKS,REQS,NSH,MET,PREF,RT,PPOL,CONFS,LAG_MAX,RMAX,REGEN_MAX,START_CASH,CONF_COST,CONF_SP,CAP_COST,CAP_LV,CONF_DAYS,SUB_UPGRADES,SEA_DESIGNS,TE_COST,TE_MO,MYIX_COST,CN_LIC,SITE2_COST,MYIX_FAB,INTERNS,OPSK,CHARTERS,SEAT_N,CORE_LV,CORE_COST,CORE_REQ,CORE_LAB,INTERN_MO,PZ_TIERS,AR_TIERS,PZ_RG}; const API_MADE={ BADGES:()=>!S?[]:BADGES.map(b=>{const on=S.ach&&S.ach[b.id]!==undefined,ever=!!hof()[b.id]; return b.secret&&!on&&!ever?{id:b.id,i:'❔',t:'???',d:tr('badges.a_secret_badge'),r:b.r,secret:true}:{...b,ever};}), diff --git a/tests/mcp-commands.test.js b/tests/mcp-commands.test.js index f88e4ae..9101521 100644 --- a/tests/mcp-commands.test.js +++ b/tests/mcp-commands.test.js @@ -227,6 +227,7 @@ test('a dry run prices every command that has a price, and changes nothing', () fixInc: { id: 'none' }, confGo: { key: T('catalog', { name: 'conferences' })[0].key }, confSponsor: { key: T('catalog', { name: 'conferences' })[0].key }, opsHire: { id: ev('Object.keys(INTERNS)[0]') }, opsNewPop: { city: 'nyc' }, pniAll: { net: 'cog', tier: 1 }, seatBuy: { n: 2 }, layShip: { id: df }, seaRush: { id: df }, utilityKit: { city: 'fra' }, utilityCaches: { city: 'fra' }, teDeploy: { script: 'spill at 85%' }, upLinkX: {}, + pieRd: { k: 'reuse' }, pieAnt: { id: 'none' }, }; const missing = quoted.filter((n) => !sample[n] && T('schema', { section: 'commands' })[n].args.some((a) => a.required)); assert.deepEqual(missing, [], 'every priced command with arguments has a sample here');