From 4591dcfefa3ee84c89188e89ff224a370bd249c9 Mon Sep 17 00:00:00 2001 From: Patrick Bergeron Date: Wed, 9 Aug 2023 15:12:26 -0500 Subject: [PATCH 1/2] remove desks folder and add back as submodule --- desks/realm.md | 60 - desks/realm/app/api-store.hoon | 129 -- desks/realm/app/bazaar.hoon | 1638 --------------- desks/realm/app/bedrock.hoon | 529 ----- desks/realm/app/bulletin.hoon | 187 -- desks/realm/app/chat-db.hoon | 341 --- desks/realm/app/friends.hoon | 481 ----- desks/realm/app/notif-db.hoon | 280 --- desks/realm/app/os-trove.hoon | 703 ------- desks/realm/app/realm-beacon.hoon | 359 ---- desks/realm/app/realm-chat.hoon | 496 ----- desks/realm/app/realm-wallet.hoon | 409 ---- desks/realm/app/rooms-v2.hoon | 651 ------ desks/realm/app/spaces-chat.hoon | 198 -- desks/realm/app/spaces.hoon | 1022 --------- desks/realm/desk.bill | 15 - desks/realm/desk.docket-0 | 11 - desks/realm/desk.ship | 1 - desks/realm/lib/agentio.hoon | 1 - desks/realm/lib/azimuth.hoon | 1 - desks/realm/lib/azimuthio.hoon | 1 - desks/realm/lib/bazaar.hoon | 545 ----- desks/realm/lib/bip/b158.hoon | 1 - desks/realm/lib/bip/b173.hoon | 1 - desks/realm/lib/bip/b174.hoon | 1 - desks/realm/lib/bip32.hoon | 1 - desks/realm/lib/bip39.hoon | 1 - desks/realm/lib/bip39/english.hoon | 1 - desks/realm/lib/bitcoin-utils.hoon | 1 - desks/realm/lib/bulletin.hoon | 93 - desks/realm/lib/chat-db.hoon | 817 -------- desks/realm/lib/contact-store.hoon | 186 -- desks/realm/lib/cram.hoon | 1 - desks/realm/lib/db.hoon | 1865 ----------------- desks/realm/lib/dbug.hoon | 1 - desks/realm/lib/default-agent.hoon | 1 - desks/realm/lib/der.hoon | 1 - desks/realm/lib/dill.hoon | 1 - desks/realm/lib/docket.hoon | 223 -- desks/realm/lib/ethereum.hoon | 1 - desks/realm/lib/ethio.hoon | 1 - desks/realm/lib/friends.hoon | 274 --- desks/realm/lib/groups.hoon | 125 -- desks/realm/lib/jose.hoon | 1 - desks/realm/lib/keygen.hoon | 1 - desks/realm/lib/language-server/build.hoon | 1 - desks/realm/lib/language-server/complete.hoon | 1 - .../realm/lib/language-server/easy-print.hoon | 1 - desks/realm/lib/language-server/json.hoon | 1 - desks/realm/lib/language-server/parser.hoon | 1 - .../lib/language-server/rune-snippet.hoon | 1 - desks/realm/lib/membership.hoon | 79 - desks/realm/lib/mip.hoon | 1 - desks/realm/lib/notif-db.hoon | 474 ----- desks/realm/lib/ph/io.hoon | 1 - desks/realm/lib/ph/util.hoon | 1 - desks/realm/lib/pill.hoon | 1 - desks/realm/lib/pkcs.hoon | 1 - desks/realm/lib/primitive-rsa.hoon | 1 - desks/realm/lib/realm-beacon.hoon | 135 -- desks/realm/lib/realm-chat.hoon | 774 ------- desks/realm/lib/realm-wallet.hoon | 273 --- desks/realm/lib/realm.hoon | 83 - desks/realm/lib/resource.hoon | 57 - desks/realm/lib/ring.hoon | 1 - desks/realm/lib/rooms-v2.hoon | 275 --- desks/realm/lib/rooms.hoon | 253 --- desks/realm/lib/server.hoon | 1 - desks/realm/lib/shoe.hoon | 1 - desks/realm/lib/skeleton.hoon | 1 - desks/realm/lib/slip.hoon | 87 - desks/realm/lib/sole.hoon | 1 - desks/realm/lib/spaces-chat.hoon | 148 -- desks/realm/lib/spaces.hoon | 387 ---- desks/realm/lib/sss.hoon | 1 - desks/realm/lib/story.hoon | 1 - desks/realm/lib/strand.hoon | 1 - desks/realm/lib/strandio.hoon | 1 - desks/realm/lib/test.hoon | 1 - desks/realm/lib/trove-json.hoon | 321 --- desks/realm/lib/verb.hoon | 1 - desks/realm/lib/visas.hoon | 341 --- desks/realm/mar/api-store/action.hoon | 18 - desks/realm/mar/api-store/configuration.hoon | 26 - desks/realm/mar/api-store/credentials.hoon | 23 - desks/realm/mar/atom.hoon | 1 - desks/realm/mar/bazaar/action.hoon | 16 - desks/realm/mar/bazaar/interaction.hoon | 14 - desks/realm/mar/bazaar/reaction.hoon | 15 - desks/realm/mar/bazaar/view.hoon | 16 - desks/realm/mar/belt.hoon | 1 - desks/realm/mar/bill.hoon | 1 - desks/realm/mar/blit.hoon | 1 - desks/realm/mar/bulletin/action.hoon | 16 - desks/realm/mar/bulletin/reaction.hoon | 16 - desks/realm/mar/chat-vent.hoon | 16 - desks/realm/mar/chat/action.hoon | 16 - desks/realm/mar/chat/db-action.hoon | 16 - desks/realm/mar/chat/db-change.hoon | 16 - desks/realm/mar/chat/db-dump.hoon | 16 - desks/realm/mar/chat/db-message.hoon | 18 - desks/realm/mar/chat/del-log.hoon | 16 - desks/realm/mar/chat/messages-table.hoon | 16 - desks/realm/mar/chat/mutes.hoon | 16 - desks/realm/mar/chat/path-row.hoon | 16 - desks/realm/mar/chat/pins.hoon | 16 - desks/realm/mar/chat/settings.hoon | 16 - desks/realm/mar/contact-update-0.hoon | 17 - desks/realm/mar/contact/groups-add.hoon | 2 - desks/realm/mar/contact/groups-del.hoon | 2 - desks/realm/mar/contact/share.hoon | 15 - desks/realm/mar/contact/ship-add.hoon | 2 - desks/realm/mar/contact/ship-del.hoon | 2 - desks/realm/mar/contact/update-0.hoon | 17 - desks/realm/mar/contact/update.hoon | 17 - desks/realm/mar/css.hoon | 1 - desks/realm/mar/db/action.hoon | 18 - desks/realm/mar/db/changes.hoon | 16 - desks/realm/mar/db/path.hoon | 16 - desks/realm/mar/db/state.hoon | 16 - desks/realm/mar/db/table.hoon | 17 - desks/realm/mar/db/vent.hoon | 16 - desks/realm/mar/docket-0.hoon | 25 - desks/realm/mar/friends/action.hoon | 16 - desks/realm/mar/friends/reaction.hoon | 15 - desks/realm/mar/friends/view.hoon | 16 - desks/realm/mar/groups/view.hoon | 17 - desks/realm/mar/hoon.hoon | 1 - desks/realm/mar/htm.hoon | 1 - desks/realm/mar/html.hoon | 1 - desks/realm/mar/httr.hoon | 1 - desks/realm/mar/hymn.hoon | 1 - desks/realm/mar/js.hoon | 1 - desks/realm/mar/json.hoon | 1 - desks/realm/mar/json/rpc/response.hoon | 1 - desks/realm/mar/kelvin.hoon | 1 - desks/realm/mar/kiln/bump.hoon | 13 - desks/realm/mar/kiln/install.hoon | 29 - desks/realm/mar/kiln/pause.hoon | 13 - desks/realm/mar/kiln/pikes.hoon | 24 - desks/realm/mar/kiln/resume.hoon | 13 - desks/realm/mar/kiln/revive.hoon | 13 - desks/realm/mar/kiln/suspend.hoon | 13 - desks/realm/mar/kiln/sync.hoon | 29 - desks/realm/mar/kiln/uninstall.hoon | 13 - desks/realm/mar/kiln/unsync.hoon | 29 - .../mar/language-server/rpc/notification.hoon | 1 - .../mar/language-server/rpc/request.hoon | 1 - .../mar/language-server/rpc/response.hoon | 1 - desks/realm/mar/membership/view.hoon | 16 - desks/realm/mar/mime.hoon | 1 - desks/realm/mar/notif/db-change.hoon | 16 - desks/realm/mar/notif/db-poke.hoon | 16 - desks/realm/mar/notif/del-log.hoon | 16 - desks/realm/mar/notif/rows.hoon | 16 - desks/realm/mar/notify-view.hoon | 16 - desks/realm/mar/noun.hoon | 1 - desks/realm/mar/path.hoon | 1 - desks/realm/mar/png.hoon | 1 - desks/realm/mar/purl.hoon | 1 - desks/realm/mar/realm-beacon/action.hoon | 16 - desks/realm/mar/realm-beacon/interaction.hoon | 14 - desks/realm/mar/realm-beacon/reaction.hoon | 15 - desks/realm/mar/realm-beacon/view.hoon | 16 - desks/realm/mar/realm-wallet/action.hoon | 15 - desks/realm/mar/realm-wallet/update.hoon | 16 - desks/realm/mar/realm.hoon | 27 - desks/realm/mar/rooms-v2/provider-action.hoon | 16 - desks/realm/mar/rooms-v2/reaction.hoon | 16 - desks/realm/mar/rooms-v2/session-action.hoon | 16 - desks/realm/mar/rooms-v2/signal.hoon | 17 - desks/realm/mar/rooms-v2/view.hoon | 16 - desks/realm/mar/row-and-schema.hoon | 17 - desks/realm/mar/ship.hoon | 1 - desks/realm/mar/sole/action.hoon | 1 - desks/realm/mar/sole/effect.hoon | 1 - desks/realm/mar/spaces/action.hoon | 16 - desks/realm/mar/spaces/chat/action.hoon | 15 - desks/realm/mar/spaces/reaction.hoon | 15 - desks/realm/mar/spaces/view.hoon | 16 - desks/realm/mar/story-diff.hoon | 1 - desks/realm/mar/story.hoon | 1 - desks/realm/mar/svg.hoon | 1 - desks/realm/mar/tang.hoon | 1 - desks/realm/mar/tape.hoon | 1 - desks/realm/mar/thread-done.hoon | 1 - desks/realm/mar/thread-fail.hoon | 1 - desks/realm/mar/trove/action.hoon | 13 - desks/realm/mar/trove/reaction.hoon | 12 - desks/realm/mar/trove/update.hoon | 14 - desks/realm/mar/trove/view.hoon | 13 - desks/realm/mar/txt-diff.hoon | 1 - desks/realm/mar/txt.hoon | 1 - desks/realm/mar/ud.hoon | 13 - desks/realm/mar/udon.hoon | 1 - desks/realm/mar/umd.hoon | 1 - desks/realm/mar/urb.hoon | 1 - desks/realm/mar/urbit.hoon | 1 - desks/realm/mar/visa/action.hoon | 16 - desks/realm/mar/visa/reaction.hoon | 15 - desks/realm/mar/visa/view.hoon | 16 - desks/realm/mar/woff2.hoon | 1 - desks/realm/mar/xml.hoon | 1 - desks/realm/sur/api-store.hoon | 15 - desks/realm/sur/aquarium.hoon | 1 - desks/realm/sur/asn1.hoon | 1 - desks/realm/sur/bazaar/docket.hoon | 82 - desks/realm/sur/bazaar/store.hoon | 114 - desks/realm/sur/bazaar/treaty.hoon | 59 - desks/realm/sur/bitcoin.hoon | 1 - desks/realm/sur/bulletin.hoon | 28 - desks/realm/sur/chat-db.hoon | 233 -- desks/realm/sur/common.hoon | 111 - desks/realm/sur/contact-store.hoon | 40 - desks/realm/sur/db.hoon | 189 -- desks/realm/sur/docket.hoon | 82 - desks/realm/sur/epic.hoon | 15 - desks/realm/sur/friends.hoon | 73 - desks/realm/sur/group-store.hoon | 39 - desks/realm/sur/group.hoon | 109 - desks/realm/sur/groups.hoon | 114 - desks/realm/sur/hark-store.hoon | 159 -- desks/realm/sur/hark.hoon | 95 - desks/realm/sur/hood.hoon | 1 - desks/realm/sur/json/rpc.hoon | 1 - desks/realm/sur/keygen.hoon | 1 - desks/realm/sur/language-server.hoon | 1 - desks/realm/sur/membership.hoon | 22 - desks/realm/sur/meta.hoon | 21 - desks/realm/sur/metadata-store.hoon | 138 -- desks/realm/sur/new-groups.hoon | 362 ---- desks/realm/sur/notif-db.hoon | 80 - desks/realm/sur/notif-versioned-state.hoon | 13 - desks/realm/sur/realm-beacon.hoon | 36 - desks/realm/sur/realm-chat.hoon | 80 - desks/realm/sur/realm-wallet.hoon | 101 - desks/realm/sur/realm.hoon | 19 - desks/realm/sur/resource.hoon | 10 - desks/realm/sur/ring.hoon | 1 - desks/realm/sur/rooms-v2.hoon | 88 - desks/realm/sur/shell.hoon | 62 - desks/realm/sur/sole.hoon | 1 - desks/realm/sur/spaces/chat.hoon | 29 - desks/realm/sur/spaces/path.hoon | 5 - desks/realm/sur/spaces/store.hoon | 100 - desks/realm/sur/spider.hoon | 1 - desks/realm/sur/sss.hoon | 1 - desks/realm/sur/story.hoon | 1 - desks/realm/sur/treaty.hoon | 59 - desks/realm/sur/trove.hoon | 121 -- desks/realm/sur/verb.hoon | 1 - desks/realm/sur/versioned-state.hoon | 32 - desks/realm/sur/visas.hoon | 56 - desks/realm/sys.kelvin | 1 - desks/realm/ted/chat-venter.hoon | 55 - desks/realm/ted/venter.hoon | 66 - desks/usher/app/marshal.hoon | 150 -- desks/usher/desk.bill | 2 - desks/usher/desk.ship | 1 - desks/usher/lib/marshal.hoon | 26 - desks/usher/mar/json.hoon | 1 - desks/usher/mar/marshal/action.hoon | 16 - desks/usher/sur/marshal.hoon | 7 - desks/usher/sys.kelvin | 1 - desks/watch-desks.sh | 25 - 265 files changed, 20054 deletions(-) delete mode 100644 desks/realm.md delete mode 100644 desks/realm/app/api-store.hoon delete mode 100644 desks/realm/app/bazaar.hoon delete mode 100644 desks/realm/app/bedrock.hoon delete mode 100644 desks/realm/app/bulletin.hoon delete mode 100644 desks/realm/app/chat-db.hoon delete mode 100644 desks/realm/app/friends.hoon delete mode 100644 desks/realm/app/notif-db.hoon delete mode 100644 desks/realm/app/os-trove.hoon delete mode 100644 desks/realm/app/realm-beacon.hoon delete mode 100644 desks/realm/app/realm-chat.hoon delete mode 100644 desks/realm/app/realm-wallet.hoon delete mode 100644 desks/realm/app/rooms-v2.hoon delete mode 100644 desks/realm/app/spaces-chat.hoon delete mode 100644 desks/realm/app/spaces.hoon delete mode 100644 desks/realm/desk.bill delete mode 100644 desks/realm/desk.docket-0 delete mode 100644 desks/realm/desk.ship delete mode 120000 desks/realm/lib/agentio.hoon delete mode 120000 desks/realm/lib/azimuth.hoon delete mode 120000 desks/realm/lib/azimuthio.hoon delete mode 100644 desks/realm/lib/bazaar.hoon delete mode 120000 desks/realm/lib/bip/b158.hoon delete mode 120000 desks/realm/lib/bip/b173.hoon delete mode 120000 desks/realm/lib/bip/b174.hoon delete mode 120000 desks/realm/lib/bip32.hoon delete mode 120000 desks/realm/lib/bip39.hoon delete mode 120000 desks/realm/lib/bip39/english.hoon delete mode 120000 desks/realm/lib/bitcoin-utils.hoon delete mode 100644 desks/realm/lib/bulletin.hoon delete mode 100644 desks/realm/lib/chat-db.hoon delete mode 100644 desks/realm/lib/contact-store.hoon delete mode 120000 desks/realm/lib/cram.hoon delete mode 100644 desks/realm/lib/db.hoon delete mode 120000 desks/realm/lib/dbug.hoon delete mode 120000 desks/realm/lib/default-agent.hoon delete mode 120000 desks/realm/lib/der.hoon delete mode 120000 desks/realm/lib/dill.hoon delete mode 100644 desks/realm/lib/docket.hoon delete mode 120000 desks/realm/lib/ethereum.hoon delete mode 120000 desks/realm/lib/ethio.hoon delete mode 100644 desks/realm/lib/friends.hoon delete mode 100644 desks/realm/lib/groups.hoon delete mode 120000 desks/realm/lib/jose.hoon delete mode 120000 desks/realm/lib/keygen.hoon delete mode 120000 desks/realm/lib/language-server/build.hoon delete mode 120000 desks/realm/lib/language-server/complete.hoon delete mode 120000 desks/realm/lib/language-server/easy-print.hoon delete mode 120000 desks/realm/lib/language-server/json.hoon delete mode 120000 desks/realm/lib/language-server/parser.hoon delete mode 120000 desks/realm/lib/language-server/rune-snippet.hoon delete mode 100644 desks/realm/lib/membership.hoon delete mode 120000 desks/realm/lib/mip.hoon delete mode 100644 desks/realm/lib/notif-db.hoon delete mode 120000 desks/realm/lib/ph/io.hoon delete mode 120000 desks/realm/lib/ph/util.hoon delete mode 120000 desks/realm/lib/pill.hoon delete mode 120000 desks/realm/lib/pkcs.hoon delete mode 120000 desks/realm/lib/primitive-rsa.hoon delete mode 100644 desks/realm/lib/realm-beacon.hoon delete mode 100644 desks/realm/lib/realm-chat.hoon delete mode 100644 desks/realm/lib/realm-wallet.hoon delete mode 100644 desks/realm/lib/realm.hoon delete mode 100644 desks/realm/lib/resource.hoon delete mode 120000 desks/realm/lib/ring.hoon delete mode 100644 desks/realm/lib/rooms-v2.hoon delete mode 100644 desks/realm/lib/rooms.hoon delete mode 120000 desks/realm/lib/server.hoon delete mode 120000 desks/realm/lib/shoe.hoon delete mode 120000 desks/realm/lib/skeleton.hoon delete mode 100644 desks/realm/lib/slip.hoon delete mode 120000 desks/realm/lib/sole.hoon delete mode 100644 desks/realm/lib/spaces-chat.hoon delete mode 100644 desks/realm/lib/spaces.hoon delete mode 120000 desks/realm/lib/sss.hoon delete mode 120000 desks/realm/lib/story.hoon delete mode 120000 desks/realm/lib/strand.hoon delete mode 120000 desks/realm/lib/strandio.hoon delete mode 120000 desks/realm/lib/test.hoon delete mode 100644 desks/realm/lib/trove-json.hoon delete mode 120000 desks/realm/lib/verb.hoon delete mode 100644 desks/realm/lib/visas.hoon delete mode 100644 desks/realm/mar/api-store/action.hoon delete mode 100644 desks/realm/mar/api-store/configuration.hoon delete mode 100644 desks/realm/mar/api-store/credentials.hoon delete mode 120000 desks/realm/mar/atom.hoon delete mode 100644 desks/realm/mar/bazaar/action.hoon delete mode 100644 desks/realm/mar/bazaar/interaction.hoon delete mode 100644 desks/realm/mar/bazaar/reaction.hoon delete mode 100644 desks/realm/mar/bazaar/view.hoon delete mode 120000 desks/realm/mar/belt.hoon delete mode 120000 desks/realm/mar/bill.hoon delete mode 120000 desks/realm/mar/blit.hoon delete mode 100644 desks/realm/mar/bulletin/action.hoon delete mode 100644 desks/realm/mar/bulletin/reaction.hoon delete mode 100644 desks/realm/mar/chat-vent.hoon delete mode 100644 desks/realm/mar/chat/action.hoon delete mode 100644 desks/realm/mar/chat/db-action.hoon delete mode 100644 desks/realm/mar/chat/db-change.hoon delete mode 100644 desks/realm/mar/chat/db-dump.hoon delete mode 100644 desks/realm/mar/chat/db-message.hoon delete mode 100644 desks/realm/mar/chat/del-log.hoon delete mode 100644 desks/realm/mar/chat/messages-table.hoon delete mode 100644 desks/realm/mar/chat/mutes.hoon delete mode 100644 desks/realm/mar/chat/path-row.hoon delete mode 100644 desks/realm/mar/chat/pins.hoon delete mode 100644 desks/realm/mar/chat/settings.hoon delete mode 100644 desks/realm/mar/contact-update-0.hoon delete mode 100644 desks/realm/mar/contact/groups-add.hoon delete mode 100644 desks/realm/mar/contact/groups-del.hoon delete mode 100644 desks/realm/mar/contact/share.hoon delete mode 100644 desks/realm/mar/contact/ship-add.hoon delete mode 100644 desks/realm/mar/contact/ship-del.hoon delete mode 100644 desks/realm/mar/contact/update-0.hoon delete mode 100644 desks/realm/mar/contact/update.hoon delete mode 120000 desks/realm/mar/css.hoon delete mode 100644 desks/realm/mar/db/action.hoon delete mode 100644 desks/realm/mar/db/changes.hoon delete mode 100644 desks/realm/mar/db/path.hoon delete mode 100644 desks/realm/mar/db/state.hoon delete mode 100644 desks/realm/mar/db/table.hoon delete mode 100644 desks/realm/mar/db/vent.hoon delete mode 100644 desks/realm/mar/docket-0.hoon delete mode 100644 desks/realm/mar/friends/action.hoon delete mode 100644 desks/realm/mar/friends/reaction.hoon delete mode 100644 desks/realm/mar/friends/view.hoon delete mode 100644 desks/realm/mar/groups/view.hoon delete mode 120000 desks/realm/mar/hoon.hoon delete mode 120000 desks/realm/mar/htm.hoon delete mode 120000 desks/realm/mar/html.hoon delete mode 120000 desks/realm/mar/httr.hoon delete mode 120000 desks/realm/mar/hymn.hoon delete mode 120000 desks/realm/mar/js.hoon delete mode 120000 desks/realm/mar/json.hoon delete mode 120000 desks/realm/mar/json/rpc/response.hoon delete mode 120000 desks/realm/mar/kelvin.hoon delete mode 100644 desks/realm/mar/kiln/bump.hoon delete mode 100644 desks/realm/mar/kiln/install.hoon delete mode 100644 desks/realm/mar/kiln/pause.hoon delete mode 100644 desks/realm/mar/kiln/pikes.hoon delete mode 100644 desks/realm/mar/kiln/resume.hoon delete mode 100644 desks/realm/mar/kiln/revive.hoon delete mode 100644 desks/realm/mar/kiln/suspend.hoon delete mode 100644 desks/realm/mar/kiln/sync.hoon delete mode 100644 desks/realm/mar/kiln/uninstall.hoon delete mode 100644 desks/realm/mar/kiln/unsync.hoon delete mode 120000 desks/realm/mar/language-server/rpc/notification.hoon delete mode 120000 desks/realm/mar/language-server/rpc/request.hoon delete mode 120000 desks/realm/mar/language-server/rpc/response.hoon delete mode 100644 desks/realm/mar/membership/view.hoon delete mode 120000 desks/realm/mar/mime.hoon delete mode 100644 desks/realm/mar/notif/db-change.hoon delete mode 100644 desks/realm/mar/notif/db-poke.hoon delete mode 100644 desks/realm/mar/notif/del-log.hoon delete mode 100644 desks/realm/mar/notif/rows.hoon delete mode 100644 desks/realm/mar/notify-view.hoon delete mode 120000 desks/realm/mar/noun.hoon delete mode 120000 desks/realm/mar/path.hoon delete mode 120000 desks/realm/mar/png.hoon delete mode 120000 desks/realm/mar/purl.hoon delete mode 100644 desks/realm/mar/realm-beacon/action.hoon delete mode 100644 desks/realm/mar/realm-beacon/interaction.hoon delete mode 100644 desks/realm/mar/realm-beacon/reaction.hoon delete mode 100644 desks/realm/mar/realm-beacon/view.hoon delete mode 100644 desks/realm/mar/realm-wallet/action.hoon delete mode 100644 desks/realm/mar/realm-wallet/update.hoon delete mode 100644 desks/realm/mar/realm.hoon delete mode 100644 desks/realm/mar/rooms-v2/provider-action.hoon delete mode 100644 desks/realm/mar/rooms-v2/reaction.hoon delete mode 100644 desks/realm/mar/rooms-v2/session-action.hoon delete mode 100644 desks/realm/mar/rooms-v2/signal.hoon delete mode 100644 desks/realm/mar/rooms-v2/view.hoon delete mode 100644 desks/realm/mar/row-and-schema.hoon delete mode 120000 desks/realm/mar/ship.hoon delete mode 120000 desks/realm/mar/sole/action.hoon delete mode 120000 desks/realm/mar/sole/effect.hoon delete mode 100644 desks/realm/mar/spaces/action.hoon delete mode 100644 desks/realm/mar/spaces/chat/action.hoon delete mode 100644 desks/realm/mar/spaces/reaction.hoon delete mode 100644 desks/realm/mar/spaces/view.hoon delete mode 120000 desks/realm/mar/story-diff.hoon delete mode 120000 desks/realm/mar/story.hoon delete mode 120000 desks/realm/mar/svg.hoon delete mode 120000 desks/realm/mar/tang.hoon delete mode 120000 desks/realm/mar/tape.hoon delete mode 120000 desks/realm/mar/thread-done.hoon delete mode 120000 desks/realm/mar/thread-fail.hoon delete mode 100644 desks/realm/mar/trove/action.hoon delete mode 100644 desks/realm/mar/trove/reaction.hoon delete mode 100644 desks/realm/mar/trove/update.hoon delete mode 100644 desks/realm/mar/trove/view.hoon delete mode 120000 desks/realm/mar/txt-diff.hoon delete mode 120000 desks/realm/mar/txt.hoon delete mode 100644 desks/realm/mar/ud.hoon delete mode 120000 desks/realm/mar/udon.hoon delete mode 120000 desks/realm/mar/umd.hoon delete mode 120000 desks/realm/mar/urb.hoon delete mode 120000 desks/realm/mar/urbit.hoon delete mode 100644 desks/realm/mar/visa/action.hoon delete mode 100644 desks/realm/mar/visa/reaction.hoon delete mode 100644 desks/realm/mar/visa/view.hoon delete mode 120000 desks/realm/mar/woff2.hoon delete mode 120000 desks/realm/mar/xml.hoon delete mode 100644 desks/realm/sur/api-store.hoon delete mode 120000 desks/realm/sur/aquarium.hoon delete mode 120000 desks/realm/sur/asn1.hoon delete mode 100644 desks/realm/sur/bazaar/docket.hoon delete mode 100644 desks/realm/sur/bazaar/store.hoon delete mode 100644 desks/realm/sur/bazaar/treaty.hoon delete mode 120000 desks/realm/sur/bitcoin.hoon delete mode 100644 desks/realm/sur/bulletin.hoon delete mode 100644 desks/realm/sur/chat-db.hoon delete mode 100644 desks/realm/sur/common.hoon delete mode 100644 desks/realm/sur/contact-store.hoon delete mode 100644 desks/realm/sur/db.hoon delete mode 100644 desks/realm/sur/docket.hoon delete mode 100644 desks/realm/sur/epic.hoon delete mode 100644 desks/realm/sur/friends.hoon delete mode 100644 desks/realm/sur/group-store.hoon delete mode 100644 desks/realm/sur/group.hoon delete mode 100644 desks/realm/sur/groups.hoon delete mode 100644 desks/realm/sur/hark-store.hoon delete mode 100644 desks/realm/sur/hark.hoon delete mode 120000 desks/realm/sur/hood.hoon delete mode 120000 desks/realm/sur/json/rpc.hoon delete mode 120000 desks/realm/sur/keygen.hoon delete mode 120000 desks/realm/sur/language-server.hoon delete mode 100644 desks/realm/sur/membership.hoon delete mode 100644 desks/realm/sur/meta.hoon delete mode 100644 desks/realm/sur/metadata-store.hoon delete mode 100644 desks/realm/sur/new-groups.hoon delete mode 100644 desks/realm/sur/notif-db.hoon delete mode 100644 desks/realm/sur/notif-versioned-state.hoon delete mode 100644 desks/realm/sur/realm-beacon.hoon delete mode 100644 desks/realm/sur/realm-chat.hoon delete mode 100644 desks/realm/sur/realm-wallet.hoon delete mode 100644 desks/realm/sur/realm.hoon delete mode 100644 desks/realm/sur/resource.hoon delete mode 120000 desks/realm/sur/ring.hoon delete mode 100644 desks/realm/sur/rooms-v2.hoon delete mode 100644 desks/realm/sur/shell.hoon delete mode 120000 desks/realm/sur/sole.hoon delete mode 100644 desks/realm/sur/spaces/chat.hoon delete mode 100644 desks/realm/sur/spaces/path.hoon delete mode 100644 desks/realm/sur/spaces/store.hoon delete mode 120000 desks/realm/sur/spider.hoon delete mode 120000 desks/realm/sur/sss.hoon delete mode 120000 desks/realm/sur/story.hoon delete mode 100644 desks/realm/sur/treaty.hoon delete mode 100644 desks/realm/sur/trove.hoon delete mode 120000 desks/realm/sur/verb.hoon delete mode 100644 desks/realm/sur/versioned-state.hoon delete mode 100644 desks/realm/sur/visas.hoon delete mode 100644 desks/realm/sys.kelvin delete mode 100644 desks/realm/ted/chat-venter.hoon delete mode 100644 desks/realm/ted/venter.hoon delete mode 100644 desks/usher/app/marshal.hoon delete mode 100644 desks/usher/desk.bill delete mode 100644 desks/usher/desk.ship delete mode 100644 desks/usher/lib/marshal.hoon delete mode 120000 desks/usher/mar/json.hoon delete mode 100644 desks/usher/mar/marshal/action.hoon delete mode 100644 desks/usher/sur/marshal.hoon delete mode 100644 desks/usher/sys.kelvin delete mode 100755 desks/watch-desks.sh diff --git a/desks/realm.md b/desks/realm.md deleted file mode 100644 index 32221879e8..0000000000 --- a/desks/realm.md +++ /dev/null @@ -1,60 +0,0 @@ -## Troubleshooting app installations using %bazaar - -### No apps found on ship - -Installing apps from another ship is a multi-step process: - -- Form alliance with remote ship -- Draw-up treaties thru alliance -- Install docket (ship/desk) once treaties available - -#### Forming an alliance with a ship - -When a valid patp is entered into the bazaar our/space search bar, bazaar will make the remote ship an ally. During this step: - -- A temporary conduit is established -- UI issues an ally-update-0 poke (add) to the treaty agent and waits -- bazaar subscribes to treaty/treaties watch path to get treaty updates - -In step 2, once the ally record is added to treaty, the treaty agent will connect to the remote ship, form an alliance, and "download" treaties (apps available for download) from the remote ship's directory. Much of this happens "behind-the-scenes" on the backend. When treaties (app contracts) are added to the local ship, step 3 commences and the UI displays apps as they are added to the treaty store. - -If adding an ally and/or forming an alliance fails for whatever reason, and no treaties are retrieved from the remote ship within a set time period, the UI will show a message indicating no apps are available for installation. - -In testing, there are two common causes for this: 1) the remote ship is not online (either the ship is not running or it is running in a breached state) which makes it unavailable to form an alliance, or 2) apps have not been published to the treaty agent. - -1. Remote Ship Not Available - -**Not Running** -To test if a remote ship is online, simply run `|hi ` (be sure to include the `~` in front of the ship name). If the ship is running and available on the network, you should see a message similiar to the following: `; ~ is your neighbor`. If you do not get this message in the dojo, your ship is either not running or has been breached. - -**Breach** -If your ship has been breached, and cannot be located on the network, you will need to do a factory reset. If you are running moons, check out this documentation for more information: https://operators.urbit.org/manual/os/basics#restoring-moons. - -2. Apps Not Published - In order for apps to made available for download/installation, they must be published using the treaty agent. To publish an app using the treaty agent, run the following command: - -`:treaty|publish ` - -e.g. `:treaty|publish %hello` - -## Notes - -- If a remote ship is successfully added as an ally, but the alliance/treaties are not processed completely, you do not need to take further action. In this case, the treaty agent will watch the remote ship and, if the ship is brought back online and/or new treaties are published, the local treaty agent will pick up updates as they are generated. - -To ensure that an ally is added to the local ship, run the following command: `:treaty +dbug [%state %allies]` and look for the remote ship in the treaties store that is printed in the dojo. - -Here is a sample output from the command: - -``` -{ [p=~misbud-windus-lodlev-migdev q={[ship=~misbud-windus-lodlev-migdev desk=%hello]}] - [ p=~dister-dozzod-dozzod - q - { [ship=~lander-dister-dozzod-dozzod desk=%landscape] - [ship=~mister-dister-dozzod-dozzod desk=%webterm] - [ship=~mister-dister-dozzod-dozzod desk=%bitcoin] - } - ] -} -``` - -Looking at this, we can see that `~misbud-windus-lodlev-migdev` and `~dister-dozzod-dozzod` are allies with our local ship. diff --git a/desks/realm/app/api-store.hoon b/desks/realm/app/api-store.hoon deleted file mode 100644 index e9e0df90b7..0000000000 --- a/desks/realm/app/api-store.hoon +++ /dev/null @@ -1,129 +0,0 @@ -:: app/api-store.hoon -/- *api-store, db -/+ dbug -=| state-0 -=* state - -=< - %- agent:dbug - |_ =bowl:gall - +* this . - core ~(. +> [bowl ~]) - :: - ++ on-init - ^- (quip card _this) - =/ default-state=state-0 *state-0 - =/ default-cards - :~ [%pass /selfpoke %agent [our.bowl dap.bowl] %poke %api-store-action !>([%sync-to-bedrock ~])] - == - [default-cards this(state default-state)] - ++ on-save !>(state) - ++ on-load - |= old-state=vase - ^- (quip card _this) - =/ old !<(versioned-state old-state) - =/ default-cards - :~ [%pass /selfpoke %agent [our.bowl dap.bowl] %poke %api-store-action !>([%sync-to-bedrock ~])] - == - [default-cards this(state old)] - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - ?> ?=(%api-store-action mark) - =/ act !<(action vase) - =^ cards state - ?- -.act :: each handler function here should return [(list card) state] - %sync-to-bedrock - (sync-to-bedrock:core state) - == - [cards this] - :: - ++ on-watch - |= =path - ^- (quip card _this) - `this - :: - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path !! - :: - [%x %configuration ~] - =/ fp=fullpath:db .^(fullpath:db %gx /(scot %p our.bowl)/bedrock/(scot %da now.bowl)/db/path/private/noun) - =/ ucreds=(unit table:db) (~(get by tables.fp) %creds) - ?~ ucreds - ``api-store-configuration+!>([%configuration ~ '' '']) - =/ creds=row:db (snag 0 (sort ~(val by u.ucreds) |=([a=row:db b=row:db] (gth t.id.a t.id.b)))) - ?+ -.data.creds !! - %creds - ``api-store-configuration+!>([%configuration buckets.data.creds current-bucket.data.creds current-bucket.data.creds]) - == - :: - [%x %credentials ~] - =/ fp=fullpath:db .^(fullpath:db %gx /(scot %p our.bowl)/bedrock/(scot %da now.bowl)/db/path/private/noun) - =/ ucreds=(unit table:db) (~(get by tables.fp) %creds) - ?~ ucreds - ``api-store-credentials+!>(['credentials' '' '' '']) - =/ creds=row:db (snag 0 (sort ~(val by u.ucreds) |=([a=row:db b=row:db] (gth t.id.a t.id.b)))) - ?+ -.data.creds !! - %creds - ``api-store-credentials+!>(['credentials' endpoint.data.creds access-key-id.data.creds secret-access-key.data.creds]) - == - == - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - `this - :: - ++ on-leave - |= =path - ^- (quip card _this) - ~& "Unsubscribe by: {} on: {}" - `this - :: - ++ on-arvo - |= [=wire =sign-arvo] - ^- (quip card _this) - `this - :: - ++ on-fail - |= [=term =tang] - %- (slog leaf+"error in {}" >term< tang) - `this - -- -|_ [=bowl:gall cards=(list card)] -:: -++ core . -++ sync-to-bedrock -::api-store &api-store-action [%sync-to-bedrock ~] - |= [state=state-0] - ^- (quip card state-0) - =/ s3-store=store-results - ?: .^(? %gu /(scot %p our.bowl)/s3-store/(scot %da now.bowl)/$) - ;;([@t @t @t @t] .^(* %gx /(scot %p our.bowl)/s3-store/(scot %da now.bowl)/credentials/noun)) - ['' '' '' ''] - =/ storage=store-results ;;([@t @t @t @t] .^(* %gx /(scot %p our.bowl)/storage/(scot %da now.bowl)/credentials/noun)) - =/ s3-conf=store-conf - ?: .^(? %gu /(scot %p our.bowl)/s3-store/(scot %da now.bowl)/$) - ;;(store-conf .^(* %gx /(scot %p our.bowl)/s3-store/(scot %da now.bowl)/configuration/noun)) - [%configuration ~ '' ''] - =/ stoconf=store-conf ;;(store-conf .^(* %gx /(scot %p our.bowl)/storage/(scot %da now.bowl)/configuration/noun)) - =/ merged=[%creds @t @t @t (set @t) @t @t] - [ - %creds - ?:(=('' endpoint.s3-store) endpoint.storage endpoint.s3-store) - ?:(=('' access-key-id.s3-store) access-key-id.storage access-key-id.s3-store) - ?:(=('' secret-access-key.s3-store) secret-access-key.storage secret-access-key.s3-store) - ?:(=(~ buckets.s3-conf) buckets.stoconf buckets.s3-conf) - ?:(=('' current-bucket.s3-conf) current-bucket.stoconf current-bucket.s3-conf) - ?:(=('' region.s3-conf) region.stoconf region.s3-conf) - ] - =/ private-path [%create-path /private %host ~ ~ ~ [our.bowl %host]~] - =/ creds [%create [our.bowl now.bowl] [/private %creds 0 merged ~]] - =/ cards=(list card) - :~ [%pass /dbpoke %agent [our.bowl %bedrock] %poke %db-action !>(private-path)] - [%pass /dbpoke %agent [our.bowl %bedrock] %poke %db-action !>(creds)] - == - [cards state] --- diff --git a/desks/realm/app/bazaar.hoon b/desks/realm/app/bazaar.hoon deleted file mode 100644 index e0d6012dee..0000000000 --- a/desks/realm/app/bazaar.hoon +++ /dev/null @@ -1,1638 +0,0 @@ -:: -:: %bazaar [realm]: -:: -:: A store for metadata on app dockets and installs. -:: -/- store=bazaar-store, docket, spaces-store, vstore=visas -/- membership-store=membership, hark=hark-store -/- treaty, hood -/+ dbug, default-agent -=> - |% - +$ card card:agent:gall - +$ versioned-state - $% state-0 - == - +$ state-0 - $: %0 - =catalog:store - =stalls:store - =docks:store - =grid-index:store - =recommendations:store - pending-installs=(map desk ship) - == - -- -=| state-0 -=* state - -=< - %- agent:dbug - |_ =bowl:gall - +* this . - def ~(. (default-agent this %|) bowl) - core ~(. +> [bowl ~]) - :: - ++ on-init - ^- (quip card _this) - :_ this - :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%initialize ~])] - == - :: - ++ on-save - ^- vase - !>(state) - :: - ++ on-load - :: |= old-state=vase - :: ^- (quip card _this) - :: =/ old !<(versioned-state old-state) - :: ?- -.old - :: %0 `this(state old) - :: == - |= =vase - ^- (quip card:agent:gall agent:gall) - =/ old=(unit state-0) - (mole |.(!<(state-0 vase))) - ?^ old :: `this(state u.old) - =| lexicon-app=native-app:store - =. title.lexicon-app 'Lexicon' - =. color.lexicon-app '#EEDFC9' - =. icon.lexicon-app 'AppIconLexicon' - =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] - =| trove-app=native-app:store - =. title.trove-app 'Trove' - =. color.trove-app '#DCDCDC' - =. icon.trove-app 'AppIconTrove' - =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] - =. catalog.u.old (~(del by catalog.u.old) %os-notes) - =. catalog.u.old (~(del by catalog.u.old) %lexicon) - =. catalog.u.old (~(del by catalog.u.old) %trove) - :_ this(state u.old) - :: add two new app entries for Realm's new "native" apps: %trove, and %lexicon - :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] - [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] - == - %- (slog leaf+"nuking old %bazaar state" ~) :: temporarily doing this for making development easier - =^ cards this on-init - :_ this - =- (welp - cards) - %+ turn ~(tap in ~(key by wex.bowl)) - |= [=wire =ship =term] - ^- card - [%pass wire %agent [ship term] %leave ~] - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - =^ cards state - ?+ mark (on-poke:def mark vase) - %bazaar-action (action:bazaar:core !<(action:store vase)) - %bazaar-interaction (interaction:bazaar:core !<(interaction:store vase)) - == - [cards this] - :: - ++ on-watch - |= =path - ^- (quip card _this) - =/ cards=(list card) - ?+ path (on-watch:def path) - [%updates ~] - ?> (is-host:core src.bowl) - [%give %fact [/updates ~] bazaar-reaction+!>([%initial catalog.state stalls.state docks.state recommendations.state grid-index.state])]~ - :: - [%bazaar @ @ ~] :: The space level watch subscription - =/ host `@p`(slav %p i.t.path) - =/ space-path `@t`i.t.t.path - :: https://developers.urbit.org/guides/core/app-school/8-subscriptions#incoming-subscriptions - :: recommends crash on permission check or other failure - =/ path [host space-path] - ?> (check-member:security:core path src.bowl) - %- (slog leaf+"{}: [on-watch]. {} subscribing to {<(spat /(scot %p host)/(scot %tas space-path))>}..." ~) - =/ space-data (filter-space-data:helpers:bazaar path) - [%give %fact ~ bazaar-reaction+!>([%joined-bazaar path catalog.space-data stall.space-data])]~ - :: - == - [cards this] - :: - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path (on-peek:def path) - :: - [%x %app-hash @ ~] :: ~/scry/bazaar/app-hash/app-name - =/ hash .^(@uv %cz [(scot %p our.bowl) i.t.t.path (scot %da now.bowl) ~]) - ``bazaar-view+!>([%app-hash hash]) - :: - [%x %catalog ~] :: ~/scry/bazaar/catalog - ``bazaar-view+!>([%catalog catalog.state]) - :: - [%x %installed ~] :: ~/scry/bazaar/installed - =/ apps (skim ~(tap by catalog.state) skim-installed:helpers:bazaar:core) - ``bazaar-view+!>([%installed `catalog:store`(malt apps)]) - :: - [%x %allies ~] :: ~/scry/bazaar/allies - =/ allies allies:scry:bazaar:core - ``bazaar-view+!>([%allies allies]) - :: - [%x %treaties ship=@ ~] :: ~/scry/bazaar/allies - =/ =ship (slav %p i.t.t.path) - =/ treaties (treaties:scry:bazaar:core ship %.y) - ~& > [treaties] - ``bazaar-view+!>([%treaties treaties]) - :: - :: - [%x %version ~] :: ~/scry/bazaar/version - :: can't search for %realm in our app catalog, since we skip our own desk - =/ dok (find-docket:helpers:bazaar:core %realm) - ?~ dok ``json+!>(~) - ``bazaar-view+!>([%version version.u.dok]) - :: - [%x %pikes ~] :: ~/scry/bazaar/pikes - =/ peaks get-pikes:core - ~& > [peaks] - ~ - :: ``bazaar-view+!>([%treaties treaties]) - == - :: - ++ on-agent - |= [=wire =sign:agent:gall] - ^- (quip card _this) - =/ wirepath `path`wire - ?+ wire (on-agent:def wire sign) - [%spaces ~] - ?+ -.sign (on-agent:def wire sign) - %watch-ack - ?~ p.sign %- (slog leaf+"{}: subscribed to spaces" ~) `this - ~& >>> "{}: spaces subscription failed" - `this - :: - %kick - ~& > "{}: spaces kicked us, resubscribing..." - :_ this - :~ [%pass /spaces %agent [our.bowl %spaces] %watch /updates] - == - :: - %fact - ?+ p.cage.sign (on-agent:def wire sign) - %spaces-reaction - =^ cards state - (reaction:spaces:core !<(=reaction:spaces-store q.cage.sign)) - [cards this] - :: - %visa-reaction - =^ cards state - (reaction:visas:core !<(=reaction:vstore q.cage.sign)) - [cards this] - == - == - - [%docket ~] - ?+ -.sign (on-agent:def wire sign) - %watch-ack - ?~ p.sign %- (slog leaf+"{}: subscribed to docket" ~) `this - ~& >>> "{}: docket/charges subscription failed" - `this - :: - %kick - ~& > "{}: docket/charges kicked us, resubscribing..." - :_ this - :~ [%pass /docket %agent [our.bowl %docket] %watch /charges] - == - :: - %fact - ?+ p.cage.sign (on-agent:def wire sign) - %charge-update - =^ cards state - (on:ch:core !<(=charge-update:docket q.cage.sign)) - [cards this] - == - == - - [%treaties ~] - ?+ -.sign (on-agent:def wire sign) - %watch-ack - ?~ p.sign %- (slog leaf+"{}: subscribed to /treaties" ~) `this - ~& >>> "{}: /treaties subscription failed" - `this - :: - %kick - ~& > "{}: /treaties kicked us, resubscribing..." - :_ this - :~ [%pass /treaties %agent [our.bowl %treaty] %watch /treaties] - == - :: - %fact - ?+ p.cage.sign (on-agent:def wire sign) - %treaty-update-0 - =^ cards state - (treaty-update:core !<(=update:treaty:treaty q.cage.sign)) - [cards this] - == - == - - [%allies ~] - ?+ -.sign (on-agent:def wire sign) - %watch-ack - ?~ p.sign %- (slog leaf+"{}: subscribed to /allies" ~) `this - ~& >>> "{}: /allies subscription failed" - `this - :: - %kick - ~& > "{}: /allies kicked us, resubscribing..." - :_ this - :~ [%pass /allies %agent [our.bowl %treaty] %watch /allies] - == - :: - %fact - ?+ p.cage.sign (on-agent:def wire sign) - %ally-update-0 - =^ cards state - (ally-update:core !<(=update:ally:treaty q.cage.sign)) - [cards this] - == - == - :: only space members will sub to this - [%bazaar @ @ ~] - ?+ -.sign (on-agent:def wire sign) - %watch-ack - ?~ p.sign `this - ~& >>> "{}: bazaar subscription failed" - `this - %kick - =/ =ship `@p`(slav %p i.t.wire) - =/ space-pth `@t`i.t.t.wire - ~& > "{}: bazaar kicked us, resubscribing... {} {}" - =/ watch-path [/bazaar/(scot %p ship)/(scot %tas space-pth)] - :_ this - :~ [%pass watch-path %agent [ship %bazaar] %watch watch-path] - == - %fact - ?+ p.cage.sign (on-agent:def wire sign) - %bazaar-reaction - =^ cards state - (reaction:bazaar:core !<(=reaction:store q.cage.sign)) - [cards this] - == - == - == - :: - :: on-arvo: - :: - :: [%tire ~]: - :: requires: `[%tire p=(unit ~)]` - :: > note: `~ turns on ~ turns off sub - :: - :: > note: likely a stub for future controls - :: e.g. `(unit desk)` to subscribe to - :: just one desk. - :: handles: tire information from clay - :: returns an (each rock wave) - :: - :: +$ rock (map desk [=zest wic=(set weft)]) - :: +$ wave - :: $% [wait =desk =weft] - :: [%warp =desk =weft] - :: [%zest =desk =zest] - :: == - :: +$ desk @tas - :: +$ zest $~(%dead ?(%dead %live %held)) - :: +$ weft [lal=@tas num=@ud] :: kelvin ver. - :: - ++ on-arvo - |= [wir=wire sig=sign-arvo] - ?> ?=([%tire ~] wir) - |^ ^- (quip card _this) - =^ cards state - ?> ?=([%clay %tire *] sig) - ?- -.p.sig - %& (on-rock p.p.sig) - %| (on-wave p.p.sig) - == - [cards this] - :: +on-rock: handles rock:tire from kiln, see XX - :: - ++ on-rock - |= =rock:tire:clay - ^- (quip card _state) - :: ~& >> "{}: [on-rock] rock={}" - =+ peaks=get-pikes:core - =; catalog-apps=catalog:store - `state(catalog (~(uni by catalog.state) catalog-apps)) - :: %- (slog leaf+"{}: [on-rock]" ~) - :: %- (slog leaf+" rock={}" ~) - :: %- (slog leaf+" peaks={}" ~) - %- ~(rep by rock) - |= [[=desk z=zest:clay wic=(set weft)] cat=catalog:store] - ?~ app=(~(get by catalog.state) desk) cat - ?> ?=(%urbit -.u.app) - :: XX: should we only act on some zests? - :: XX: should we only act if we have a peak? - ?~ pyk=(~(get by peaks) desk) cat - ?. =(%live z) - ?. =(%held z) cat - cat - =. host.u.app ?~(sync.u.pyk ~ `ship.u.sync.u.pyk) - :: ~& >> "{}: %rock [app-install-update] {<[host.u.app install-status.u.app]>}" - (~(put by cat) `app-id:store`desk u.app) - :: +on-wave: handles wave:tire from kiln, see XXs - :: - :: $%(wait+[=desk =weft] warp+[=desk =weft] zest+[=desk =weft] - :: - ++ on-wave - |= =wave:tire:clay - ^- (quip card _state) - :: ~& >> "{}: [on-wave] wave={}" - =+ peaks=get-pikes:core - :: ~& >> "{}: [on-wave] peaks={}" - :: %- (slog leaf+"{}: [on-wave]. " ~) - :: %- (slog leaf+" wave={}" ~) - :: %- (slog leaf+" peaks={}" ~) - ?- -.wave - %wait `state :: XX: blocked - take action? - %warp `state :: XX: unblocked - take action? - :: - %zest - ?~ app=(~(get by catalog.state) desk.wave) `state - ?> ?=(%urbit -.u.app) - ?- zest.wave - :: XX: is it right to no-op here? - %dead - ?~ pyk=(~(get by peaks) desk.wave) `state - :: ~& >> ["{}: %wave %dead" desk.wave install-status.u.app] - =. grid-index - :: if the status is %uninstalled and %dead, then we should remove - :: the app from the grid index - ?: =(%uninstalled install-status.u.app) - (rem-grid-index:helpers:bazaar:core desk.wave grid-index.state) - grid-index.state - :: ~& >> "{}: %dead [app-install-update] {<[host.u.app install-status.u.app]>}" - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update desk.wave +.u.app grid-index])] - == - :: - %live - ?~ pyk=(~(get by peaks) desk.wave) `state - :: ~& >> ["{}: %wave %live" desk.wave install-status.u.app] - =/ syncs=(map [syd=desk her=ship sud=desk] [nun=@ta kid=(unit desk) let=@ud]) get-syncs:core - =/ desks=(map desk ship) - %- ~(rep by syncs) - |= [[det=[syd=desk her=ship sud=desk] other=[nun=@ta kid=(unit desk) let=@ud]] acc=(map desk ship)] - (~(put by acc) sud.det her.det) - =. host.u.app (~(get by desks) desk.wave) - :: =. install-status.u.app %installed - :: get rid of the pending-install that may have been added - =/ pending-install (~(get by pending-installs.state) desk.wave) - =. pending-installs.state ?~(pending-install pending-installs.state (~(del by pending-installs) desk.wave)) - =. grid-index (set-grid-index:helpers:bazaar:core desk.wave grid-index.state) - =. catalog.state (~(put by catalog.state) desk.wave u.app) - :: ~& >> "{}: %live [app-install-update] {<[host.u.app install-status.u.app]>}" - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update desk.wave +.u.app grid-index])] - == - :: - %held - :: %held seems to be hit when the desk exists and there are no updates, so we should - :: set the install status to %suspended if it is %uninstalled. - ?~ pyk=(~(get by peaks) desk.wave) `state - :: if exists in catalog and not installed, set to suspend - :: ~& >> ["{}: %wave %held pre-status: " desk.wave u.pyk install-status.u.app] - =. install-status.u.app ?:(=(install-status.u.app %uninstalled) %suspended install-status.u.app) - :: ~& >> ["{}: %wave %held post-status: " install-status.u.app] - =. host.u.app ?~(sync.u.pyk ~ `ship.u.sync.u.pyk) - =. grid-index (set-grid-index:helpers:bazaar:core desk.wave grid-index.state) - :: ~& >> "{}: %held [app-install-update] {<[host.u.app install-status.u.app]>}" - :_ state(catalog (~(put by catalog.state) desk.wave u.app)) - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update desk.wave +.u.app grid-index])] - == - == - == - - -- - ++ on-leave |=(path `..on-init) - ++ on-fail :: |=([term tang] `..on-init) - |= [=term =tang] - ^- (quip card _this) - %- (slog leaf+"error in {}" >term< tang) - `this - :: |=([term tang] `..on-init) --- -|_ [=bowl:gall cards=(list card)] -:: -++ core . -++ bazaar - |% - ++ action - |= =action:store - ^- (quip card _state) - |^ - ?- -.action - %pin (add-pin +.action) - %unpin (rem-pin +.action) - %reorder-pins (reorder-pins +.action) - %recommend (recommend +.action) - %unrecommend (unrecommend +.action) - %suite-add (add-suite +.action) - %suite-remove (rem-suite +.action) - %install-app (install-app +.action) - %uninstall-app (uninstall-app +.action) - %reorder-app (reorder-app +.action) - :: sent during onboarding after realm desk is fully installed and ready - :: use this opportunity to refresh app-catalog - %initialize (initialize +.action) - %rebuild-catalog (rebuild-catalog +.action) - %rebuild-stall (rebuild-stall +.action) - %clear-stall (clear-stall +.action) - %set-host (set-host +.action) - :: testing helper. remove an app from the ship catalog w/o producing any effects - %delete-catalog-entry (delete-catalog-entry +.action) - %add-catalog-entry (add-catalog-entry +.action) - == :: +pre: prefix for scries to hood - :: - ++ pre /(scot %p our.bowl)/hood/(scot %da now.bowl) - :: +get-sources: (map desk [ship desk]) - :: - ++ get-sources - ^- (map desk [=ship =desk]) - .^((map @tas [@p @tas]) %gx (welp pre /kiln/sources/noun)) - :: - :: $set-host: - :: set the host of an app in the catalog - ++ set-host - |= [app-id=desk host=ship] - ^- (quip card _state) - =/ app (~(get by catalog.state) app-id) - ?~ app - ~& >>> "{}: [set-host] error. {} not found in app catalog" - `state - ?> ?=(%urbit -.u.app) - %- (slog leaf+"{} setting host for catalog app {} to {}" ~) - =. host.u.app (some host) - =. catalog.state (~(put by catalog.state) app-id u.app) - =. grid-index.state (set-grid-index:helpers:bazaar:core app-id grid-index.state) - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update app-id +.u.app grid-index.state])] - == - :: - ++ rebuild-catalog - |= [args=(map cord cord)] - ^- (quip card _state) - :: %- (slog leaf+"{}: [rebuild-catalog] => {}" ~) - :: you can only request this of yourself - ?. =(our.bowl src.bowl) - ~& >> "{}: [rebuild-catalog] denied. not self." - `state - =/ init (build-catalog:helpers ~) - :_ state(catalog catalog.init, grid-index grid-index.init, pending-installs ~) - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%rebuild-catalog catalog.init grid-index.init])] - == - :: - ++ rebuild-stall - |= [path=space-path:spaces-store args=(map cord cord)] - ^- (quip card _state) - :: %- (slog leaf+"{}: [rebuild-stall] => {<[path args]>}" ~) - :: if we are not the space host, poke space host so it can push updates - :: to members - ?: (we-host:helpers path) - ?. (check-member:security path src.bowl) - ~& >> "{}: [rebuild-stall] denied. host received request from non-member." - `state - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - =/ stal (~(get by stalls.state) path) - ?~ stal `state - =/ apps (get-stall-apps:helpers path args) - ?~ apps `state - :_ state - :~ [%give %fact paths bazaar-reaction+!>([%rebuild-stall path u.apps u.stal])] - == - :: - ?. (check-member:security path our.bowl) - ~& >> "{}: [rebuild-stall] denied. not owner, admin, or member of space" - `state - :: - :_ state - :~ [%pass / %agent [ship.path %bazaar] %poke bazaar-action+!>([%rebuild-stall path args])] - == - :: - ++ clear-stall - |= [path=space-path:spaces-store args=(map cord cord)] - ^- (quip card _state) - :: %- (slog leaf+"{}: [clear-stall] => {<[path args]>}" ~) - :: if we are not the space host, poke space host so it can push updates - :: to members - ?: (we-host:helpers path) - ?. (check-member:security path src.bowl) - ~& >> "{}: [clear-stall] denied. host received request from non-member." - `state - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - =/ stal (clear-stall:helpers path args) - ?~ stal `state - =. stalls.state (~(put by stalls.state) path u.stal) - :_ state - :~ [%give %fact paths bazaar-reaction+!>([%clear-stall path])] - == - :: - ?. (check-member:security path our.bowl) - ~& >> "{}: [clear-stall] denied. not owner, admin, or member of space" - `state - :: - :_ state - :~ [%pass / %agent [ship.path %bazaar] %poke bazaar-action+!>([%clear-stall path args])] - == - :: - ++ add-pin - |= [path=space-path:spaces-store =app-id:store index=(unit @ud)] - ?> =(our.bowl src.bowl) - =/ upd-docks=dock:store (~(gut by docks.state) path ~) - =/ index ?~(index (lent upd-docks) u.index) - =/ exists-at (find [app-id]~ upd-docks) - ?~ exists-at :: should only pin if it doesnt exist - =. upd-docks (into upd-docks index app-id) - =. docks.state (~(put by docks.state) [path upd-docks]) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%dock-update path upd-docks])]~ - `state - :: - ++ reorder-pins - |= [path=space-path:spaces-store =dock:store] - ?> =(our.bowl src.bowl) - =. docks.state (~(put by docks.state) [path dock]) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%dock-update path dock])]~ - :: - ++ rem-pin - |= [path=space-path:spaces-store =app-id:store] - ?> =(our.bowl src.bowl) - =/ upd-docks (~(got by docks.state) path) - =/ index (find [app-id]~ upd-docks) - ?~ index `state - =. upd-docks (oust [(need index) 1] upd-docks) - =. docks.state (~(put by docks.state) [path upd-docks]) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%dock-update path upd-docks])]~ - :: - ++ add-suite - |= [path=space-path:spaces-store =app-id:store index=@ud] - =/ app (~(got by catalog.state) app-id) - ?. (is-host:core ship.path) - (member-add-suite path app-id app index) - (host-add-suite path app-id app index) - :: - ++ member-add-suite - |= [path=space-path:spaces-store =app-id:store =app:store index=@ud] - ?> (check-admin:security path src.bowl) - :_ state - [%pass / %agent [ship.path %bazaar] %poke bazaar-interaction+!>([%suite-add path app-id app index])]~ - :: - ++ host-add-suite - |= [path=space-path:spaces-store =app-id:store =app:store index=@ud] - =/ stall=stall:store (~(gut by stalls.state) path [suite=~ recommended=~]) - =. suite.stall (~(put by suite.stall) [index app-id]) - =. stalls.state (~(put by stalls.state) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :_ state - [%give %fact paths bazaar-reaction+!>([%suite-added path app-id app index])]~ - :: - ++ rem-suite - |= [path=space-path:spaces-store index=@ud] - ?. (is-host:core ship.path) - (member-remove-suite path index) - (host-remove-suite path index) - :: - ++ member-remove-suite - |= [path=space-path:spaces-store index=@ud] - ?> (check-admin:security path src.bowl) - :_ state - [%pass / %agent [ship.path %bazaar] %poke bazaar-action+!>([%suite-remove path index])]~ - :: - ++ host-remove-suite - |= [path=space-path:spaces-store index=@ud] - =/ stall (~(got by stalls.state) path) - =. suite.stall (~(del by suite.stall) index) - =. stalls.state (~(put by stalls.state) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :_ state - [%give %fact paths bazaar-reaction+!>([%suite-removed path index])]~ - :: - ++ install-app - |= [=ship =desk] - ^- (quip card _state) - ?> =(our.bowl src.bowl) - :: is an installation already happening for this desk? - =/ pending-install (~(get by pending-installs.state) desk) - ?. =(~ pending-install) - ~& >> "{}: skipping {<[ship desk]>} install. pending installation running..." - `state - =/ app (~(get by catalog.state) desk) - ?~ app (docket-install ship desk ~) - ?> ?=(%urbit -.u.app) - =. grid-index (set-grid-index:helpers:bazaar:core desk grid-index.state) - :: ~& >> [%install-app app] - =. install-status.u.app - ?: =(%uninstalled install-status.u.app) %suspended - ?: =(%desktop install-status.u.app) - :: @trent - we can add a check to clay for the desk existing - :: and that would do the same skip of suspended that the fresh install does - =+ peaks=get-pikes:core - ?.((~(has by peaks) desk) %started install-status.u.app) - %started - =. host.u.app (some ship) - =. catalog.state (~(put by catalog.state) desk u.app) - (docket-install ship desk [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update desk +.u.app grid-index.state])]~) - :: - ++ reorder-app - |= [=app-id:store index=@ud] - ^- (quip card _state) - ?> =(our.bowl src.bowl) - =/ new-grid-index (mov-grid-index:helpers:bazaar:core app-id index grid-index.state) - =. grid-index new-grid-index - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%reorder-grid-index new-grid-index])]~ - :: - ++ docket-install - |= [=ship =desk cards=(list card)] - ^- (quip card _state) - =/ allies allies:scry:bazaar - ?. (~(has by allies) ship) - %- (slog leaf+"{} not an ally. adding {} as ally..." ~) - :: queue this installation request, so that once alliance is complete, - :: we can automatically kick off the install - =. pending-installs.state (~(put by pending-installs.state) desk ship) - :_ state - (snoc cards [%pass / %agent [our.bowl %treaty] %poke ally-update-0+!>([%add ship])]) - :_ state - (snoc cards [%pass / %agent [our.bowl %docket] %poke docket-install+!>([ship desk])]) - :: - ++ initialize - |= [args=(map cord cord)] - ^- (quip card _state) - %- (slog leaf+"{}: initializing bazaar..." ~) - =^ cards state initialize:helpers:bazaar:core - :_ state - =- (welp - cards) - %+ turn ~(tap in ~(key by wex.bowl)) - |= [=wire =ship =term] - ^- card - [%pass wire %agent [ship term] %leave ~] - :: - ++ uninstall-app - |= [=desk] - ^- (quip card _state) - ?> =(our.bowl src.bowl) - =/ app (~(got by catalog.state) desk) - ?> ?=(%urbit -.app) - =. install-status.app %uninstalled - =. catalog.state (~(put by catalog.state) desk app) - :: =. grid-index.state (rem-grid-index:helpers:bazaar:core desk grid-index.state) - :: ~& > ['uninstall-app' (rem-grid-index:helpers:bazaar:core desk grid-index.state)] - :_ state - :: :: if apps have come in from other ships (e.g. recommending) and do not exist in - :: :: our catalog, they will not exist in docket. only informat - :: ?. (is-app-installed:helpers:bazaar:core desk) ~ - [%pass / %agent [our.bowl %docket] %poke docket-uninstall+!>([desk])]~ - :: - ++ recommend - |= [=app-id:store] - ?> =(our.bowl src.bowl) - :: ~& > ['recommend' our.bowl src.bowl] - =. recommendations.state (~(put in recommendations.state) app-id) - =/ app (~(got by catalog.state) app-id) - =/ updated-stalls=[=stalls:store cards=(list card)] - %- ~(rep by stalls.state) - |= [[path=space-path:spaces-store =stall:store] result=[=stalls:store cards=(list card)]] - ?: =('our' space.path) result :: return result if our - ?: (we-host:helpers path) - :: ~& > ['we host, set recommended'] - =/ rec-members (~(gut by recommended.stall) app-id ~) - =. rec-members (~(put in rec-members) our.bowl) - =. recommended.stall (~(put by recommended.stall) [app-id rec-members]) - =. stalls.result (~(put by stalls.result) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - =. cards.result (snoc cards.result [%give %fact paths bazaar-reaction+!>([%stall-update path stall (some [app-id (some app)])])]) - result - :: we need to poke host - =. cards.result (snoc cards.result [%pass / %agent [ship.path %bazaar] %poke bazaar-interaction+!>([%member-recommend path app-id app])]) - result - =. stalls.state (~(uni by stalls.state) stalls.updated-stalls) - =. cards.updated-stalls (snoc cards.updated-stalls [%give %fact [/updates ~] bazaar-reaction+!>([%recommended app-id stalls.state])]) - :: ~& >> "{}" - :_ state - cards.updated-stalls - :: - ++ unrecommend - |= [=app-id:store] - ?> =(our.bowl src.bowl) - =. recommendations.state (~(del in recommendations.state) app-id) - =/ updated-stalls=[=stalls:store cards=(list card)] - %- ~(rep by stalls.state) - |= [[path=space-path:spaces-store =stall:store] result=[=stalls:store cards=(list card)]] - ?: =('our' space.path) result :: return result if our - ?: (we-host:helpers path) - =/ rec-members (~(gut by recommended.stall) app-id ~) - =. rec-members (~(del in rec-members) our.bowl) - =. recommended.stall - ?: =(~(wyt in rec-members) 0) - (~(del by recommended.stall) app-id) - (~(put by recommended.stall) [app-id rec-members]) - =. stalls.result (~(put by stalls.result) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - =. cards.result (snoc cards.result [%give %fact paths bazaar-reaction+!>([%stall-update path stall (some [app-id ~])])]) - result - =. cards.result (snoc cards.result [%pass / %agent [ship.path %bazaar] %poke bazaar-interaction+!>([%member-unrecommend path app-id])]) - result - =. stalls.state (~(uni by stalls.state) stalls.updated-stalls) - =. cards.updated-stalls (snoc cards.updated-stalls [%give %fact [/updates ~] bazaar-reaction+!>([%unrecommended app-id stalls.state])]) - :_ state - cards.updated-stalls - :: - :: - :: $delete-catalog-entry - :: remove an app entry from the ship's catalog and produce no effects - ++ delete-catalog-entry - |= [=app-id:store] - ^- (quip card _state) - ?: (~(has by catalog.state) app-id) - =. catalog.state (~(del by catalog.state) app-id) - `state - `state - :: - :: - :: $add-catalog-entry - :: add a new native-app to the catalog. does not currently support %urbit or %web apps. - ++ add-catalog-entry - |= [=app-id:store =native-app:store] - ^- (quip card _state) - :: %- (slog leaf+"{}: [add-catalog-entry] {}" ~) - =. catalog.state (~(put by catalog.state) app-id [%native native-app]) - =. grid-index.state (set-grid-index:helpers:bazaar:core app-id grid-index.state) - `state - -- - ++ reaction - |= [rct=reaction:store] - ^- (quip card _state) - |^ - ?+ -.rct `state - %recommended (on-rec +.rct) - %unrecommended (on-unrec +.rct) - %suite-added (on-suite-add +.rct) - %suite-removed (on-suite-rem +.rct) - %joined-bazaar (on-joined +.rct) - %stall-update - :: ~& >> "{<+.rct>}" - (on-stall-update +.rct) - %rebuild-catalog (on-rebuild-catalog +.rct) - %rebuild-stall (on-rebuild-stall +.rct) - %clear-stall (on-clear-stall +.rct) - == - :: - ++ on-rec - |= [app-id=@tas =stalls:store] - `state - :: - ++ on-unrec - |= [app-id=@tas =stalls:store] - `state - :: - ++ on-suite-add - |= [path=space-path:spaces-store app-id=@tas =app:store index=@ud] - ?: =(is-host:core ship.path) - `state - :: the host is informing us that it's added a new app to the space suite - =/ updates (add-to-desktop:helpers:bazaar:core app-id app) - =. catalog.state catalog.updates - =/ stall (~(got by stalls.state) path) - =. suite.stall (~(put by suite.stall) [index app-id]) - =. stalls.state (~(put by stalls.state) [path stall]) - :: ~& >> "{}" - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%suite-added path app-id app.updates index])]~ - :: - ++ on-suite-rem - |= [path=space-path:spaces-store index=@ud] - ?: =(is-host:core ship.path) - `state - =/ stall (~(got by stalls.state) path) - =. suite.stall (~(del by suite.stall) index) - =. stalls.state (~(put by stalls.state) [path stall]) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%suite-removed path index])]~ - :: - ++ on-joined - |= [path=space-path:spaces-store =catalog:store =stall:store] - =. stalls.state (~(put by stalls.state) [path stall]) - =. docks.state (~(put by docks.state) [path [~]]) - =/ new-catalog-apps=(list [=app-id:store =app:store]) - %- ~(rep by catalog) - |= [entry=[=app-id:store =app:store] result=(list [=app-id:store =app:store])] - ?: (~(has by catalog.state) app-id.entry) :: if we already have the app - =. app.entry (~(got by catalog.state) app-id.entry) - (snoc result entry) - =/ entry - ?+ -.app.entry entry - %urbit - =. install-status.app.entry %desktop - entry - == - (snoc result entry) - =/ new-catalog-apps (malt new-catalog-apps) - =. catalog.state (~(uni by catalog.state) new-catalog-apps) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%joined-bazaar path new-catalog-apps stall])]~ - - :: - ++ what - |= [det=(unit [=app-id:store app=(unit app:store)])] - ^- @tas - ?~ det %none - ?~ app.u.det %delete - %add - :: - ++ on-stall-update - |= [path=space-path:spaces-store =stall:store det=(unit [=app-id:store app=(unit app:store)])] - :: are we deleting the app, or adding it? - :: %- (slog leaf+"{}: [on-stall-update] {}" ~) - =/ wha (what det) - =/ updates=[det=(unit [=app-id:store app=(unit app:store)]) =catalog:store] - ?+ wha [det catalog.state] - %none [det catalog.state] - :: - %delete [det catalog.state] - :: - %add - =/ det (need det) - =/ app (need app.det) - =/ app - ?: (~(has by catalog.state) app-id.det) - :: if the app *is* in the catalog, leave it's status as is - (~(got by catalog.state) app-id.det) - :: if the app is not in our catalog, update it's installed - :: status relative to our ship . %desktop - ?> ?=(%urbit -.app) - :: place it on the desktop where it can then be installed by an end-user in UI - =. install-status.app %desktop - app - [(some [app-id.det (some app)]) (~(put by catalog.state) app-id.det app)] - == - :: - =. catalog.state catalog.updates - =. stalls.state (~(put by stalls.state) [path stall]) - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%stall-update path stall det.updates])] - == - :: - ++ on-rebuild-catalog - |= [=catalog:store =grid-index:store] - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%rebuild-catalog path catalog grid-index])] - == - :: - ++ on-rebuild-stall - |= [path=space-path:spaces-store =catalog:store =stall:store] - :: only process if received from space host or admin - ?. (~(has by stalls.state) path) `state - =. stalls.state (~(put by stalls.state) path stall) - =. catalog.state (~(gas by catalog) ~(tap by catalog.state)) - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%rebuild-stall path catalog stall])] - == - :: - ++ on-clear-stall - |= [path=space-path:spaces-store] - =/ stal (clear-stall:helpers path ~) - ?~ stal `state - =. stalls.state (~(put by stalls.state) path u.stal) - - :_ state - :~ [%give %fact [/updates ~] bazaar-reaction+!>([%clear-stall path])] - == - -- - ++ interaction - |= [itc=interaction:store] - ^- (quip card _state) - |^ - ?- -.itc - %member-recommend (member-recommend +.itc) - %member-unrecommend (member-unrecommend +.itc) - %suite-add (suite-add +.itc) - == - :: - ++ member-recommend - |= [path=space-path:spaces-store =app-id:store =app:store] - ?> (check-member:security path src.bowl) - :: ~& > ['recommending' path src.bowl app-id] - =/ stall (~(got by stalls.state) path) - =/ rec-members (~(gut by recommended.stall) app-id ~) - =. rec-members (~(put in rec-members) src.bowl) - =. recommended.stall (~(put by recommended.stall) [app-id rec-members]) - =. stalls.state (~(put by stalls.state) [path stall]) - :: per #319, ensure installed status is relative to our ship/catalog - =/ entry (~(get by catalog.state) app-id) - :: default to %desktop (will force download button in UI) - =/ local-install-status ?~(entry %desktop (get-install-status:helpers:bazaar:core u.entry)) - :: do not overwrite our current catalog entry with the recommend app; ensure - :: only overwriting the install-status - =/ our-app ?~(entry app u.entry) - =/ our-app - ?+ -.our-app our-app - %urbit - =. install-status.our-app local-install-status - our-app - == - =. catalog.state (~(put by catalog.state) [app-id our-app]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :_ state - :~ - [%give %fact paths bazaar-reaction+!>([%stall-update path stall (some [app-id (some our-app)])])] - == - :: - ++ member-unrecommend - |= [path=space-path:spaces-store =app-id:store] - ?> (check-member:security path src.bowl) - :: ~& > ['unrecommending' path src.bowl app-id] - =/ stall (~(got by stalls.state) path) - =/ rec-members=member-set:store - ?: (~(has by recommended.stall) app-id) - =/ members (~(got by recommended.stall) app-id) - =. members (~(del in members) src.bowl) - members - ~ - =. recommended.stall - ?: =(~(wyt in rec-members) 0) - (~(del by recommended.stall) app-id) - (~(put by recommended.stall) [app-id rec-members]) - =. stalls.state (~(put by stalls.state) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :_ state - [%give %fact paths bazaar-reaction+!>([%stall-update path stall (some [app-id ~])])]~ - :: - :: this should only ever come into the space host (see "lite" versions add-suite above) - ++ suite-add - |= [path=space-path:spaces-store =app-id:store =app:store index=@ud] - ?. (is-host:core ship.path) - %- (slog leaf+"{}: suite-add-full should only be used to inform the host. use suite-add if acting on behalf of a member ship" ~) - [~ state] - (host-suite-add path app-id app index) - :: - ++ host-suite-add - |= [path=space-path:spaces-store =app-id:store =app:store index=@ud] - =/ updates (add-to-desktop:helpers:bazaar:core app-id app) - =. catalog.state catalog.updates - =/ stall=stall:store (~(gut by stalls.state) path [suite=~ recommended=~]) - =. suite.stall (~(put by suite.stall) [index app-id]) - =. stalls.state (~(put by stalls.state) [path stall]) - =/ paths [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :_ state - [%give %fact paths bazaar-reaction+!>([%suite-added path app-id app.updates index])]~ - -- - ++ scry - |% - ++ allies - ^- allies:ally:treaty - =/ allies .^(update:ally:treaty %gx /(scot %p our.bowl)/treaty/(scot %da now.bowl)/allies/noun) - ?> ?=(%ini -.allies) - init.allies - :: - ++ treaties - |= [shp=ship filter=?] - =/ hidden `(set desk)`(silt ~['realm' 'realm-wallet' 'courier' 'garden']) - =/ treaties .^(update:treaty:treaty %gx /(scot %p our.bowl)/treaty/(scot %da now.bowl)/treaties/(scot %p shp)/noun) - :: ~& > [treaties] - ?> ?=(%ini -.treaties) - ?: =(filter %.n) init.treaties - %- malt - %+ skip ~(tap by init.treaties) - |= [[trty-ship=ship =desk] trty=treaty:treaty] - ?: ?& =(trty-ship shp) - (~(has in hidden) desk) - == %.y %.n - :: - ++ config - |= =desk - |^ - =/ config - ?: config-exists - .^(config:store %cx scry-path) - :* size=[10 10] - titlebar-border=%.y - show-titlebar=%.y - == - =? size.config - ?| (lth -.size.config 1) - (lth +.size.config 1) - (gth -.size.config 10) - (gth +.size.config 10) - == - [10 10] - config - ++ scry-path `path`/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/config/realm - ++ exists-scry-path `path`/(scot %p our.bowl)/[desk]/(scot %da now.bowl) - ++ config-exists - ?: =(0 ud:.^(cass:clay %cw exists-scry-path)) %.n - .^(? %cu scry-path) - -- - :: - -- - ++ helpers - |% - :: - ++ initialize - ^- (quip card _state) - =/ init (build-catalog ~) - =. grid-index.state grid-index.init - =/ spaces-scry .^(view:spaces-store %gx /(scot %p our.bowl)/spaces/(scot %da now.bowl)/all/noun) - ?> ?=(%spaces -.spaces-scry) - =/ spaces spaces.spaces-scry - =/ stalls - %+ turn ~(tap by spaces) - |= [path=space-path:spaces-store =space:spaces-store] - [path [suite=~ recommended=~]] - =/ docks - %+ turn ~(tap by spaces) - |= [path=space-path:spaces-store =space:spaces-store] - [path [~]] - =. stalls.state (~(gas by stalls.state) stalls) - =. docks.state (~(gas by docks.state) docks) - =. catalog.state catalog.init - :_ state - :~ [%pass /docket %agent [our.bowl %docket] %watch /charges] - [%pass /treaties %agent [our.bowl %treaty] %watch /treaties] - [%pass /allies %agent [our.bowl %treaty] %watch /allies] - [%pass /spaces %agent [our.bowl %spaces] %watch /updates] - [%pass /tire %arvo %c %tire `~] - == - :: - ++ build-catalog - |= [args=(map cord cord)] - =/ =charge-update:docket .^(charge-update:docket %gx /(scot %p our.bowl)/docket/(scot %da now.bowl)/charges/noun) - ?> ?=([%initial *] charge-update) - =/ our-space [our.bowl 'our'] - =/ init (init-catalog:helpers:bazaar:core initial.charge-update) - =| =native-app:store - =. title.native-app 'Relic Browser' - =. color.native-app '#92D4F9' - =. icon.native-app 'AppIconCompass' - =. config.native-app [size=[7 10] titlebar-border=%.y show-titlebar=%.n] - =. catalog.init (~(put by catalog.init) %os-browser [%native native-app]) - =. grid-index.init (set-grid-index:helpers:bazaar:core %os-browser grid-index.init) - =| =native-app:store - =. title.native-app 'Settings' - =. color.native-app '#ACBCCB' - =. icon.native-app 'AppIconSettings' - =. config.native-app [size=[5 6] titlebar-border=%.y show-titlebar=%.n] - =. catalog.init (~(put by catalog.init) %os-settings [%native native-app]) - =. grid-index.init (set-grid-index:helpers:bazaar:core %os-settings grid-index.init) - =| =native-app:store - =. title.native-app 'Lexicon' - =. color.native-app '#EEDFC9' - =. icon.native-app 'AppIconLexicon' - =. config.native-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] - =. catalog.init (~(put by catalog.init) %os-lexicon [%native native-app]) - =. grid-index.init (set-grid-index:helpers:bazaar:core %os-lexicon grid-index.init) - =| =native-app:store - =. title.native-app 'Trove' - =. color.native-app '#DCDCDC' - =. icon.native-app 'AppIconTrove' - =. config.native-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] - =. catalog.init (~(put by catalog.init) %os-trove [%native native-app]) - =. grid-index.init (set-grid-index:helpers:bazaar:core %os-trove grid-index.init) - init - :: - ++ get-stall-apps - |= [=space-path:spaces-store args=(map cord cord)] - ^- (unit catalog:store) - =/ stal (~(get by stalls.state) space-path) - ?~ stal - ~& >>> "{}: [get-stall-apps] error. space {} does not exist." - ~ - :: extract all app ids across both the suite and recommended lists - =/ app-ids - %+ weld - %+ turn ~(tap by recommended.u.stal) - |= [=app-id:store =member-set:store] - app-id - %+ turn ~(tap by suite.u.stal) - |= [idx=@ud =app-id:store] - app-id - :: build a catalog from the app ids - %- some - %- malt - %+ turn - %+ skim app-ids - |= [=app-id:store] - =/ app (~(get by catalog.state) app-id) - ?~ app - ~& >> "{}: [rebuild-stall] warn. app {} missing from catalog." - %.n - %.y - |= [=app-id:store] - [app-id (~(got by catalog.state) app-id)] - :: - ++ clear-stall - |= [=space-path:spaces-store args=(map cord cord)] - ^- (unit stall:store) - =/ stal (~(get by stalls.state) space-path) - ?~ stal - ~& >>> "{}: [rebuild-stall] error. space {} does not exist." - ~ - (some [suite=~ recommended=~]) - :: - ++ add-to-desktop - |= [=app-id:store =app:store] - :: return the updated app state and app catalog - ^- [=app:store =catalog:store] - =/ app-entry (~(get by catalog.state) app-id) - :: =/ app - ?~ app-entry :: app is not in the catalog. add it - ?+ -.app [app catalog.state] - %urbit - =. install-status.app %desktop - [app (~(put by catalog.state) app-id app)] - == - :: app is already in the catalog. leave as is - [u.app-entry catalog.state] - :: [app (~(put by catalog.state) app-id app)] - :: - ++ is-app-installed - |= [=app-id:store] - ^- ? - =/ =charge-update:docket .^(charge-update:docket %gx /(scot %p our.bowl)/docket/(scot %da now.bowl)/charges/noun) - ?> ?=([%initial *] charge-update) - (~(has by initial.charge-update) app-id) - :: - ++ get-install-status - |= [=app:store] - ^- install-status:store - ?> ?=(%urbit -.app) - install-status.app - :: - ++ determine-app-host - |= [host=ship =app:store] - ^- (unit ship) - ?> ?=(%urbit -.app) - :: if the app has a glob-reference of %ames, use the ship value as the - :: host/origin of the app; otherwise, use the treaty ship - ?+ -.href.docket.app (some host) - :: - %glob - :: - ?+ -.location.glob-reference.href.docket.app (some host) - :: - %ames (some ship.location.glob-reference.href.docket.app) - == - == - :: - ++ set-grid-index - |= [=app-id:store =grid-index:store] - ^- grid-index:store - =/ grid-list (sort-grid:helpers:bazaar:core grid-index) - =/ current-index (find [app-id]~ grid-list) - ?~ current-index - :: if the app is not in the grid, add it to the end - =/ new-index (lent grid-list) - (~(put by grid-index) [new-index app-id]) - grid-index - :: - ++ rem-grid-index - |= [=app-id:store =grid-index:store] - ^- grid-index:store - =/ grid-list (sort-grid:helpers:bazaar:core grid-index) - =/ current-index (find [app-id]~ grid-list) - ?~ current-index grid-index - =. grid-list (oust [u.current-index 1] grid-list) - =/ new-grid-index - %+ turn (gulf 0 (sub (lent grid-list) 1)) - |= idx=@ud - =/ app (snag idx grid-list) - [idx app] - `=grid-index:store`(malt new-grid-index) - :: - ++ mov-grid-index - |= [=app-id:store index=@ud =grid-index:store] - ^- grid-index:store - =/ grid-list (sort-grid:helpers:bazaar:core grid-index) - =/ current-index (find [app-id]~ grid-list) - ?~ current-index !! - :: it's already in the grid. remove it from its current position - :: then add it to the specified position (not optimal) - =. grid-list (oust [u.current-index 1] grid-list) - =. grid-list (into grid-list index app-id) - =/ new-grid-index - %+ turn (gulf 0 (sub (lent grid-list) 1)) - |= idx=@ud - =/ app (snag idx grid-list) - [idx app] - `=grid-index:store`(malt new-grid-index) - :: - ++ sort-grid - |= [=grid-index:store] - ^- (list @tas) - =/ sorted-grid - %+ sort ~(tap by grid-index) - |= [a=[idx=@ud app=@tas] b=[idx=@ud app=@tas]] - (lth idx.a idx.b) - %+ turn sorted-grid - |= [idx=@ud app=@tas] - app - :: - ++ update-paths - |= [path=space-path:spaces-store] - ?. =(space.path %our) - [/update ~] - [/updates /bazaar/(scot %p ship.path)/(scot %tas space.path) ~] - :: - ++ find-docket - |= [=desk] - :: ^- (unit docket) - - :: =/ =charge-update:docket .^(charge-update:docket %gx /(scot %p our.bowl)/docket/(scot %da now.bowl)/charges/noun) - :: ?> ?=([%initial *] charge-update) - :: =/ our-space [our.bowl 'our'] - :: =/ init (init-catalog:helpers:bazaar:core initial.charge-update) - :: |= [charges=(map desk charge:docket)] - - =/ =charge-update:docket .^(charge-update:docket %gx /(scot %p our.bowl)/docket/(scot %da now.bowl)/charges/noun) - ?> ?=([%initial *] charge-update) - =/ chg (~(get by initial.charge-update) desk) - ?~ chg ~ - (some docket.u.chg) - :: - ++ init-catalog - |= [charges=(map desk charge:docket)] - =/ hidden `(set desk)`(silt ~['realm' 'realm-wallet' 'courier' 'garden' 'landscape']) - =/ syncs=(map [syd=desk her=ship sud=desk] [nun=@ta kid=(unit desk) let=@ud]) get-syncs:core - =+ peaks=get-pikes:core - =/ desks=(map desk ship) - %- ~(rep by syncs) - |= [[det=[syd=desk her=ship sud=desk] other=[nun=@ta kid=(unit desk) let=@ud]] acc=(map desk ship)] - (~(put by acc) sud.det her.det) - :: %- (slog leaf+"{}" ~) - ^- [=catalog:store =grid-index:store] - %- ~(rep by charges) - |: [[=desk =charge:docket] acc=[catalog=`catalog:store`~ grid-index=`grid-index:store`~]] - ?: (~(has in hidden) desk) acc - =/ pyk (~(get by peaks) desk) - =/ install-status ?~ pyk %desktop - ?- zest.u.pyk - %live %installed - %held %suspended - %dead %uninstalled - == - =/ sync (~(get by desks) desk) - =/ host=(unit ship) sync - :: ~& >> [desk -.chad.charge install-status] - [(~(put by catalog.acc) desk [%urbit docket.charge host install-status (config:scry:bazaar:core desk)]) (set-grid-index desk grid-index.acc)] - :: - ++ skim-installed - |= [=app-id:store =app:store] - ?: =(%urbit -.app) - ?> ?=(%urbit -.app) - =(%installed install-status.app) - %.y :: if not urbit app, is installed - :: - ++ we-host - |= [path=space-path:spaces-store] - ?: =('our' space.path) - %.n - =(our.bowl ship.path) - :: - ++ filter-space-data - |= [path=space-path:spaces-store] - =/ stall=stall:store (~(got by stalls.state) path) - =/ suite-apps ~(val by suite.stall) - =/ recommended-apps ~(tap in ~(key by recommended.stall)) - =/ catalog-apps (weld suite-apps recommended-apps) - =/ catalog=(list [app-id:store =app:store]) - %+ turn catalog-apps - |= [=app-id:store] - [app-id (~(got by catalog.state) app-id)] - [catalog=(malt catalog) stall=stall] - :: - ++ is-system-app - |= [=app-id:store] - ^- ? - ?: ?| =(app-id %courier) - =(app-id %realm) - =(app-id %realm-wallet) - =(app-id %garden) - == - %.y %.n - -- - -- -:: -++ visas - |% - ++ reaction - |= [rct=reaction:vstore] - ^- (quip card _state) - |^ - ?+ -.rct `state - %kicked (on-member-kicked +.rct) - == - ++ on-member-kicked - |= [path=space-path:spaces-store =ship] - ^- (quip card _state) - =/ update-path /bazaar/(scot %p ship.path)/(scot %tas space.path) - ?. (is-host:core ship.path) - ?: =(our.bowl ship) :: we were kicked - =. stalls.state (~(del by stalls.state) path) - =. docks.state (~(del by docks.state) path) - :_ state - [%pass update-path %agent [ship.path %bazaar] %leave ~]~ - :: another member was kicked - `state - =/ stall (~(got by stalls.state) path) - =/ cleaned-recs=[=recommended:store] - %- ~(rep by recommended.stall) :: remove all recommendations from kicked - |= [app=[=app-id:store =member-set:store] result=[=recommended:store]] - =/ rec-members (~(del in member-set.app) ship) - =/ recommeded-map - ?: =(~(wyt in rec-members) 0) - (~(del by recommended.result) app-id.app) - (~(put by recommended.result) [app-id.app rec-members]) - =. recommended.result recommeded-map - result - :: - =. recommended.stall recommended.cleaned-recs - =. stalls.state (~(put by stalls.state) [path stall]) - :_ state - :~ - [%give %fact [update-path /updates ~] bazaar-reaction+!>([%stall-update path stall ~])] - [%give %kick ~[update-path] (some ship)] - == - -- - -- -:: -++ spaces - |% - ++ reaction - |= [rct=reaction:spaces-store] - ^- (quip card _state) - |^ - ?+ -.rct `state - %add (on-add +.rct) - %remove (on-remove +.rct) - %remote-space (on-remote-space +.rct) - == - :: - ++ on-add - |= [space=space:spaces-store members=members:membership-store] - ^- (quip card _state) - =/ recommended=recommended:store - %- ~(rep in recommendations.state) :: add all of our recs to the created stall - |= [=app-id:store result=[=recommended:store]] - =. result (~(put by recommended.result) [app-id (silt ~[our.bowl])]) - result - =/ stall=stall:store [suite=~ recommended=recommended] - =. stalls.state (~(put by stalls.state) [path.space stall]) - =. docks.state (~(put by docks.state) [path.space [~]]) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%stall-update path.space stall ~])]~ - :: - ++ on-remove - |= [path=space-path:spaces-store] - ^- (quip card _state) - =. stalls.state (~(del by stalls.state) path) - =. docks.state (~(del by docks.state) path) - =/ update-path /bazaar/(scot %p ship.path)/(scot %tas space.path) - :_ state - [%pass update-path %agent [ship.path %bazaar] %leave ~]~ - :: - ++ on-remote-space :: when we join a new space - |= [path=space-path:spaces-store =space:spaces-store =members:membership-store] - ^- (quip card _state) - ?: =(our.bowl ship.path) `state - =/ recs=(list card) - %+ turn ~(tap in recommendations.state) - |= [=app-id:store] - =/ app (~(got by catalog.state) app-id) - [%pass / %agent [ship.path %bazaar] %poke bazaar-interaction+!>([%member-recommend path app-id app])] - =/ watch-path [/bazaar/(scot %p ship.path)/(scot %tas space.path)] - :_ state - %+ weld recs - ^- (list card) - :: it is possible under very odd circumstances that we get kicked - :: by the host's bazaar. note that, according to the docs, getting kicked - :: can happen automatically by gall under "certain network conditions" - :: under this use-case, our %kicked hander (see on-agent) will automatically - :: rejoin the remote bazaar which will send out a %remote-space gift. - :: when this happened, this %watch below was causing an 'non-unique channel' - :: error because the auto %kicked re-%watch had already happened. - :: to prevent this, check the outgoing subscriptions on this ship (wex.boat) - :: to ensure we are already listening on the wire before attempting the %watch - ?: (~(has by wex.bowl) [watch-path ship.path %bazaar]) ~ - :~ - [%pass watch-path %agent [ship.path %bazaar] %watch watch-path] - == - :: - -- - -- -:: -++ treaty-update - |= [upd=update:treaty:treaty] - ^- (quip card _state) - |^ - ?+ -.upd `state - %ini (on-ini +.upd) - %add (on-add +.upd) - :: %del (on-del +.upd) - == - :: - :: @~lodlev-migdev - at this point, dockets have been loaded into the app catalog; - :: therefore use this as an opportunity to set the host value of each app in the catalog - ++ on-ini - |= [init=(map [=ship =desk] =treaty:treaty)] - ^- (quip card _state) - :: ~& >> "{}: treaty-update [on-ini] => init={}, treaty={}" - =/ updated-catalog=catalog:store - %- ~(rep by init) - |= [[[=ship =desk] =treaty:treaty] result=(map app-id:store app:store)] - :: ~& >> "{}: treaty-update [on-ini] => ship={}, desk={}, treaty" - =/ app (~(get by catalog.state) desk) - ?~ app result - - ?. =(%urbit -.u.app) (~(put by result) desk u.app) :: host only applies to urbit apps - ?> ?=(%urbit -.u.app) :: update app host - =. host.u.app (determine-app-host:helpers:bazaar:core ship u.app) - (~(put by result) desk u.app) - :: - =. catalog.state (~(uni by catalog.state) updated-catalog) - `state - :: - ++ on-add - |= [=treaty:treaty] - ^- (quip card _state) - :: ~& >> "{}: treaty-update [on-add] => {<[treaty]>}" - =| effects=(list card) - :: if a pending install, auto kick off the docket-install. %live from kiln will remove the - =/ pending-install (~(get by pending-installs.state) desk.treaty) - =. effects ?~ pending-install effects - %- (slog leaf+"{}: treaty added for pending-install {}. sending docket-install..." ~) - (snoc effects [%pass / %agent [our.bowl %docket] %poke docket-install+!>([ship.treaty desk.treaty])]) - :: if every desk in the alliance has been added to the treaties listing for the ship, - :: send the UI and update indicating its safe to scry the treaties - =/ allis allies:scry:bazaar:core - =/ treats (treaties:scry:bazaar:core ship.treaty %.n) - =/ alli (~(get by allis) ship.treaty) - =/ effects ?~ alli effects - ?: %- ~(all in u.alli) - |= [[=ship =desk]] - (~(has by treats) [ship desk]) - :: ~& >> "{}: sending treaties-loaded..." - (snoc effects [%give %fact [/updates ~] bazaar-reaction+!>([%treaties-loaded ship.treaty])]) - effects - [effects state] - -- -:: -++ ally-update - |= [upd=update:ally:treaty] - ^- (quip card _state) - |^ - ?+ -.upd `state - %new (on-new +.upd) - %add (on-add +.upd) - %del (on-del +.upd) - == - :: - ++ on-new - |= [=ship =alliance:treaty] - ^- (quip card _state) - :: ~& >> "{}: [on-new] => {<[ship alliance]>}" - :_ state - :~ - [%give %fact [/updates ~] bazaar-reaction+!>([%new-ally ship alliance])] - == - :: - ++ on-add - |= [=ship] - ^- (quip card _state) - :: =/ treaty .^(update:treaty:treaty %gx /(scot %p our.bowl)/treaty/(scot %da now.bowl)/treaties/(scot %p ship)/noun) - :: ~& >> "{}: ally-update [on-add] => {}" - `state - :: - ++ on-del - |= [=ship] - ^- (quip card _state) - :_ state - :~ - [%give %fact [/updates ~] bazaar-reaction+!>([%ally-deleted ship])] - == - -- -:: charge arms -++ ch - |% - ++ on - |= upd=charge-update:docket - ^- (quip card _state) - ?+ -.upd `state - %add-charge (add:ch:core +.upd) - %del-charge (rem:ch:core +.upd) - == - :: - ++ add - |= [=desk =charge:docket] - ^- (quip card _state) - ?- -.chad.charge - %install (update-catalog-app desk charge %started) - %hung (update-catalog-app desk charge %failed) - %suspend (update-catalog-app desk charge %suspended) - %glob (update-catalog-app desk charge %installed) - %site (update-catalog-app desk charge %installed) - == - :: - ++ update-catalog-app - |= [app-id=desk =charge:docket status=?(%started %failed %suspended %installed)] - =/ hide-desks `(set @tas)`(silt ~['realm' 'realm-wallet' 'courier' 'garden']) - ?: (~(has in hide-desks) app-id) - `state - =/ app (~(get by catalog.state) app-id) - =/ app ?~ app [%urbit docket.charge host=~ status (config:scry:bazaar:core app-id)] - ?> ?=(%urbit -.u.app) - :: ~& >> "{}: update-catalog-app => {}, {}, {}" - =. install-status.u.app - ?: ?&(=(%suspended install-status.u.app) =(%started status)) - install-status.u.app - ?: ?&(=(%started install-status.u.app) =(%suspended status)) - %started - ?: ?&(=(%desktop install-status.u.app) =(%started status)) - :: @trent - we can add a check to clay for the desk existing - :: and that would do the same skip of suspended that the fresh install does - =+ peaks=get-pikes:core - ?.((~(has by peaks) app-id) %started status) - status - :: - =. docket.u.app docket.charge - =. config.u.app (config:scry:bazaar:core app-id) - u.app - =. catalog.state (~(put by catalog.state) app-id app) - =. grid-index (set-grid-index:helpers:bazaar:core app-id grid-index.state) - :: %- (slog leaf+"{}: [update-app-catalog]" ~) - :: %- (slog leaf+" app-install-update => {<[%app-install-update app-id +.app grid-index.state]>}" ~) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update app-id +.app grid-index.state])]~ - :: - ++ rem - |= [=desk] - ^- (quip card _state) - =/ app (~(get by catalog.state) desk) - ?~ app `state - ?> ?=(%urbit -.u.app) - :: set to uninstalled, don't delete - =. install-status.u.app %uninstalled - =. catalog.state (~(put by catalog.state) [desk u.app]) - :: remove from grid index to "uninstall" - =. grid-index.state (rem-grid-index:helpers:bazaar:core desk grid-index.state) - :_ state - [%give %fact [/updates ~] bazaar-reaction+!>([%app-install-update desk +.u.app grid-index.state])]~ - -- -:: -:: $security. member/permission checks -:: -++ security - |% - ++ check-member - |= [path=space-path:spaces-store =ship] - ^- ? - =/ member .^(view:membership-store %gx /(scot %p our.bowl)/spaces/(scot %da now.bowl)/(scot %p ship.path)/(scot %tas space.path)/is-member/(scot %p ship)/noun) - ?> ?=(%is-member -.member) - is-member.member - :: - ++ check-admin - |= [path=space-path:spaces-store =ship] - ^- ? - =/ member .^(view:membership-store %gx /(scot %p our.bowl)/spaces/(scot %da now.bowl)/(scot %p ship.path)/(scot %tas space.path)/members/(scot %p ship)/noun) - ?> ?=(%member -.member) - (~(has in roles.member.member) %admin) - :: - -- -++ is-host - |= [=ship] - =(our.bowl ship) -:: +pre: prefix for scries to hood -:: -++ pre /(scot %p our.bowl)/hood/(scot %da now.bowl) -:: +get-sources: (map desk [ship desk]) -:: -++ get-sources - ^- (map desk [=ship =desk]) - .^((map @tas [@p @tas]) %gx (welp pre /kiln/sources/noun)) -:: -:: +get-pikes: (map desk [(unit [@p desk]) hash zest wic]) -++ get-pikes - ^- pikes:hood - :: ~& >> "{}: [get-pikes]" - .^(pikes:hood %gx (welp pre /kiln/pikes/kiln-pikes)) -:: -:: +get-syncs: -:: -:: (map kiln-sync sync-state) -:: where: -:: %+ map -:: (map [local=desk foreign=ship foreign=desk]) -:: [nun=@ta kid=(unit desk) let=@ud] -++ get-syncs - ^- (map [syd=desk her=ship sud=desk] [nun=@ta kid=(unit desk) let=@ud]) - .^ (map [@tas @p @tas] [@ta (unit @tas) @ud]) - %gx - (welp pre /kiln/syncs/noun) - == -:: --- diff --git a/desks/realm/app/bedrock.hoon b/desks/realm/app/bedrock.hoon deleted file mode 100644 index e5776201d9..0000000000 --- a/desks/realm/app/bedrock.hoon +++ /dev/null @@ -1,529 +0,0 @@ -:: app/bedrock.hoon -:: - all data is scoped by /path, with a corresponding peers list -:: - ship-to-ship replication of data uses one-at-a-time subscriptions -:: described here: https://developers.urbit.org/reference/arvo/concepts/subscriptions#one-at-a-time -:: - ship-to-frontend syncing of data uses chat-db model of /db -:: subscribe wire and /x/db/start-ms/[unix ms].json -:: - %db provides a data layer only. business logic and permissioning -:: must be checked by the %app that uses it (unless it can be fit -:: within the database permissions and constraints system) -:: - custom data types work by %apps specifying the schema for the type -:: -:: TO USE: -:: - create a path with a list of peers with %create-path -:: ex: :db &db-action [%create-path /example %host ~ ~ ~ ~[[~zod %host] [~bus %member]]] -:: - create a data-row of a custom or pre-defined type -:: you are required to provide a schema when you first create a row of a new custom-type -:: but if the schema is already there for that type/version combo, -:: you can just pass ~ in that spot -:: schemas are versionable -:: ex: :db &db-action [%create /example %foo 0 [%general ~[1 'a']] ~[['num' 'ud'] ['str' 't']]] -:: :db &db-action [%create /example %vote 0 [%vote [%.y our %foo [~zod now] /example]] ~] -:: :db &db-action [%create /example %foo 1 [%general ~[1 'd' (jam /hello/goodbye)]] ~[['num' 'ud'] ['str' 't'] ['mypath' 'path']]] -:: :~zod/db &db-action [%create /example %vote 0 [%vote %.y our %foo [~zod now] /example] ~] - -/- *db, sstore=spaces-store, vstore=visas -/+ dbug, db -=| state-0 -=* state - -=< - %- agent:dbug - |_ =bowl:gall - +* this . - core ~(. +> [bowl ~]) - :: - ++ on-init - ^- (quip card _this) - =/ default-state=state-0 *state-0 - :: make sure the relay table exists on-init - =. tables.default-state - (~(gas by *^tables) ~[[%relay *pathed-table] [%vote *pathed-table] [%react *pathed-table]]) - =/ default-cards - :~ [%pass /spaces %agent [our.bowl %spaces] %watch /updates] - [%pass /selfpoke %agent [our.bowl dap.bowl] %poke %db-action !>([%create-initial-spaces-paths ~])] - [%pass /timer %arvo %b %wait next-refresh-time:core] - == - [default-cards this(state default-state)] - ++ on-save !>(state) - ++ on-load - |= old-state=vase - ^- (quip card _this) - =/ old !<(versioned-state old-state) - :: REMOVE WHEN YOU WANT DATA TO ACTUALLY STICK AROUND - ::=/ default-state=state-0 *state-0 - :: make sure the relay table exists on-init - ::=. tables.default-state - ::(~(gas by *^tables) ~[[%relay *pathed-table] [%vote *pathed-table] [%react *pathed-table]]) - :: do a quick check to make sure we are subbed to /updates in %spaces - =/ cards - :- [%pass /timer %arvo %b %rest next-refresh-time:core] - :- [%pass /timer %arvo %b %wait next-refresh-time:core] - :: :- [%pass /selfpoke %agent [our.bowl dap.bowl] %poke %db-action !>([%create-initial-spaces-paths ~])] - :: :- [%pass /selfpoke %agent [our.bowl %api-store] %poke %api-store-action !>([%sync-to-bedrock ~])] :: ALSO REMOVE WHEN YOU STOP WIPING THE DATA EVERY TIME - ?: (~(has by wex.bowl) [/spaces our.bowl %spaces]) - ~ - [%pass /spaces %agent [our.bowl %spaces] %watch /updates]~ - [cards this(state old)] - :: - ++ on-poke - |= [=mark =vase] - ^- (quip card _this) - ?> ?=(%db-action mark) - =/ act !<(action vase) - =^ cards state - ?- -.act :: each handler function here should return [(list card) state] - %create-path - (create-path:db +.act state bowl) - %create-from-space - (create-from-space:db +.act state bowl) - %edit-path - (edit-path:db +.act state bowl) - %remove-path - (remove-path:db +.act state bowl) - %add-peer - (add-peer:db +.act state bowl) - %kick-peer - (kick-peer:db +.act state bowl) - - %get-path - (get-path:db +.act state bowl) - %delete-path - (delete-path:db +.act state bowl) - %refresh-path - (refresh-path:db +.act state bowl) - - %create - (create:db +.act state bowl) - %edit - (edit:db +.act state bowl) - %remove - (remove:db +.act state bowl) - %remove-many - (remove-many:db +.act state bowl) - - %relay - (relay:db +.act state bowl) - - %create-initial-spaces-paths - (create-initial-spaces-paths:db state bowl) - %toggle-hide-logs - (toggle-hide-logs:db +.act state bowl) - == - [cards this] - :: - :: endpoints for clients to keep in sync with our ship - :: /db - :: /path/[path] - :: endpoints for other ships to keep in sync with us - :: /next/@da/[path] - ++ on-watch - |= =path - ^- (quip card _this) - =/ cards=(list card) - :: each path should map to a list of cards - ?+ path !! - :: - [%db ~] :: the "everything" path - ?> =(our.bowl src.bowl) - ~ :: we are not "priming" this subscription with anything, since the client can just scry if they need. the sub is for receiving new updates - :: /path/the/actual/path/ - [%path *] :: the "path" path, subscribe by path explicitly - ?> =(our.bowl src.bowl) - =/ thepathrow (~(got by paths.state) t.path) - =/ peerslist (~(got by peers.state) t.path) - =/ thechange - :: TODO also dump all the rows here - db-changes+!>([[%add-path thepathrow] (turn peerslist |=(p=peer [%add-peer p]))]) - :~ [%give %fact ~ thechange] - == - :: /next/@da/the/actual/path/ - [%next @ *] :: the "next" path, for other ships to get the next update on a particular path - ?< =(our.bowl src.bowl) :: this path should only be used by NOT us - =/ t=@da (slav %da i.t.path) - =/ thepathrow (~(got by paths.state) t.t.path) - :: if the @da they passed was behind, %give them the current version, and %kick them - ?: (gth updated-at.thepathrow t) - ::~& >>> "{} tried to sub on old @da {}, %kicking them" - =/ thepeers (~(got by peers.state) t.t.path) - =/ tbls (tables-by-path:db tables.state t.t.path) - =/ dels=(list [@da db-del-change]) - (dels-by-path:db t.t.path state) - :~ [%give %fact ~ db-path+!>([thepathrow thepeers tbls schemas.state dels])] - [%give %kick [path ~] `src.bowl] - == - :: else, don't give them anything. we will give+kick when a new version happens - ::=/ thepathrow (~(get by paths-table.state) t.t.path) - :::~ [%give %fact ~ chat-path-row+!>(thepathrow)] - ::== - ::~& > "{(scow %p src.bowl)} subbed to {(spud path)}" - ~ - :: /vent/~zod/~2000.1.1 - [%vent @ @ ~] :: poke response comes on this path - =/ src=ship (slav %p i.t.path) - ?> =(src src.bowl) - ~ - == - [cards this] - :: - :: endpoints for clients syncing with their own ship - :: /x/db.json - :: /x/db/path/[path].json - :: /x/db/start-ms/[unix ms].json - ++ on-peek - |= =path - ^- (unit (unit cage)) - ?+ path !! - :: - [%x %db ~] - ``db-state+!>(state) - :: - :: full information about a given path - [%x %db %path *] - =/ thepath t.t.t.path - =/ thepathrow (~(got by paths.state) thepath) - =/ thepeers (~(got by peers.state) thepath) - =/ tbls (tables-by-path:db tables.state thepath) - =/ dels=(list [@da db-del-change]) - (dels-by-path:db thepath state) - ``db-path+!>([thepathrow thepeers tbls schemas.state dels]) - :: - :: all rows from a given table - :: /db/table/realm-note.json - [%x %db %table @ ~] - =/ tblname=@tas i.t.t.t.path - ``db-table+!>([tblname (~(got by tables.state) tblname) schemas.state]) - :: - :: host of a given path - [%x %host %path *] - =/ thepath t.t.t.path - =/ thepathrow (~(got by paths.state) thepath) - ``ship+!>(host.thepathrow) - :: - :: /x/db/start-ms/[unix ms].json - :: all tables, but only with received-at after