Merge branch 'next/arvo' into jon/doccords

This commit is contained in:
drbeefsupreme 2023-01-04 10:22:17 -05:00
commit d5bf903f56
167 changed files with 19304 additions and 47737 deletions

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
cd "$GITHUB_WORKSPACE" || exit
echo "$2" | base64 -d > service-account
echo "$3" | base64 -d > id_ssh
echo "$4" | base64 -d > id_ssh.pub
chmod 600 service-account
chmod 600 id_ssh
chmod 600 id_ssh.pub
janeway release glob-all --dev --no-pill \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash
SHORTHASH=$(git rev-parse --short HEAD)
janeway release prepare-ota arvo-glob-"$SHORTHASH" "$1" \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash
janeway release perform-ota "$1" \
--credentials service-account \
--ssh-key id_ssh \
--ci \
| bash

View File

@ -1,4 +1,4 @@
FROM tloncorp/janeway:v0.15.4
FROM tloncorp/janeway:v0.17.0
COPY entrypoint.sh /entrypoint.sh
EXPOSE 22/tcp
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,18 +1,21 @@
name: 'glob'
description: 'Create a glob and deploy it to a moon'
name: 'ota'
description: 'perform an OTA update of arvo on a remote ship'
inputs:
ship:
description: "Ship to deploy to"
description: "target ship"
required: true
credentials:
description: "base64-encoded GCP Service Account credentials"
required: true
ssh-sec-key:
description: "A base64-encoded SSH secret key for the container to use"
description: "base64-encoded SSH secret key for the container to use"
required: true
ssh-pub-key:
description: "The corresponding base64-encoded SSH public key"
description: "base64-encoded corresponding SSH public key"
required: true
ref:
description: "git ref of arvo source to check out"
required: false
runs:
using: 'docker'
@ -22,4 +25,4 @@ runs:
- ${{ inputs.credentials }}
- ${{ inputs.ssh-sec-key }}
- ${{ inputs.ssh-pub-key }}
- ${{ inputs.ref }}

20
.github/actions/ota/entrypoint.sh vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
echo "$2" | base64 -d > /service-account
echo "$3" | base64 -d > /id_ssh
echo "$4" | base64 -d > /id_ssh.pub
chmod 600 /service-account
chmod 600 /id_ssh
chmod 600 /id_ssh.pub
janeway \
--ci \
--verbose \
--credentials /service-account \
--ssh-key /id_ssh \
release ota \
arvo \
"$1" \
${5:+"--ref"} ${5:+"$5"} \
| bash

View File

@ -34,7 +34,7 @@ jobs:
call-vere:
uses: ./.github/workflows/vere.yml
with:
pace: 'often'
pace: 'edge' # XX s/b once?
upload: >-
${{
(github.ref_name == 'next/vere' && github.ref_type == 'branch')

View File

@ -1,27 +0,0 @@
name: Chromatic Deployment
on:
pull_request:
paths:
- 'pkg/interface/**'
push:
paths:
- 'pkg/interface/**'
branches:
- 'release/next-userspace'
jobs:
chromatic-deployment:
runs-on: ubuntu-latest
name: "Deploy Chromatic"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm i && npm run bootstrap
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: pkg/interface

View File

@ -1,20 +0,0 @@
name: glob
on:
push:
branches:
- 'release/next-userspace'
jobs:
glob:
runs-on: ubuntu-latest
name: "Create and deploy a glob to ~hanruc-nalfus-nidsut-tomdun"
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: ./.github/actions/glob
with:
ship: 'hanruc-nalfus-nidsut-tomdun'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}

View File

@ -1,27 +0,0 @@
name: merge
on:
push:
branches:
- 'master'
jobs:
merge-to-next-js:
runs-on: ubuntu-latest
name: "Merge master to release/next-userspace"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: release/next-userspace
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}
merge-to-group-timer:
runs-on: ubuntu-latest
name: "Merge master to ops/group-timer"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: ops/group-timer
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

View File

@ -1,17 +0,0 @@
name: ops-merge
on:
push:
branches:
- 'release/*'
jobs:
merge-release-to-ops:
runs-on: ubuntu-latest
name: "Merge to ops-tlon"
steps:
- uses: actions/checkout@v2
- uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: ops-tlon
github_token: ${{ secrets.JANEWAY_BOT_TOKEN }}

19
.github/workflows/ota.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: ota
on:
workflow_dispatch:
push:
branches:
- 'next/arvo'
jobs:
deploy:
runs-on: ubuntu-latest
name: "make an OTA update to arvo on ~binnec-dozzod-marzod"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/ota
with:
ship: 'canary'
credentials: ${{ secrets.JANEWAY_SERVICE_KEY }}
ssh-sec-key: ${{ secrets.JANEWAY_SSH_SEC_KEY }}
ssh-pub-key: ${{ secrets.JANEWAY_SSH_PUB_KEY }}
ref: 'next/arvo'

View File

@ -12,11 +12,13 @@ on:
pace:
description: 'release pace'
type: string
default: 'often'
default: 'edge'
required: false
secrets:
CACHIX_AUTH_TOKEN:
required: false
GCP_CREDENTIALS:
required: false
GCS_SERVICE_ACCOUNT_KEY:
required: false
GCS_PROJECT:
@ -33,7 +35,7 @@ on:
description: 'release pace'
type: choice
options:
- often
- edge
- soon
- live
@ -48,8 +50,9 @@ jobs:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest }
- { os: macos-latest }
- { os: ubuntu-latest, type: linux }
- { os: macos-latest, type: macos }
- { os: buildjet-4vcpu-ubuntu-2204-arm, type: linux }
runs-on: ${{ matrix.os }}
@ -64,7 +67,7 @@ jobs:
with:
extra_nix_config: |
system-features = nixos-test benchmark big-parallel kvm
if: ${{ matrix.os == 'ubuntu-latest' }}
if: ${{ matrix.type == 'linux' }}
- uses: cachix/install-nix-action@v16
if: ${{ matrix.os != 'ubuntu-latest' }}
@ -73,6 +76,11 @@ jobs:
name: ares
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
# run unit tests early on linux (x-compilation will skip them)
- name: build dynamic binary (and run tests)
if: ${{ matrix.type == 'linux' }}
run: nix-build -A urbit
- name: build static binary
run: |
nix-build -A urbit \
@ -84,7 +92,7 @@ jobs:
cat ./urbit-derivation
- name: confirm binary is mostly static
if: matrix.os == 'macos-latest'
if: matrix.type == 'macos'
run: |
bin="${{ env.urbit_static }}/bin/urbit"
@ -117,19 +125,20 @@ jobs:
echo -n "$version" > ./version-string
- name: upload version string artifact
if: matrix.os == 'ubuntu-latest'
if: matrix.type == 'linux'
uses: actions/upload-artifact@v3
with:
name: version-string
path: version-string
- uses: google-github-actions/setup-gcloud@v0.2.0
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- uses: google-github-actions/setup-gcloud@v1
if: inputs.upload
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.GCS_PROJECT }}
export_default_credentials: true
- name: upload binary to bootstrap.urbit.org
if: inputs.upload
@ -174,6 +183,7 @@ jobs:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: mingw32-make build/urbit
- run: mingw32-make test
- run: >
build/urbit -l -d -B ../../bin/solid.pill -F bus &&
curl -f --data '{"source":{"dojo":"+hood/exit"},"sink":{"app":"hood"}}'

View File

@ -27,12 +27,12 @@ identity, use [Bridge][brid].
## Install
To install and run Urbit, please follow the instructions at
[urbit.org/using/install][start]. You'll be on the live network in a
[urbit.org/install][start]. You'll be on the live network in a
few minutes.
If you're interested in Urbit development, keep reading.
[start]: https://urbit.org/using/install/
[start]: https://urbit.org/install/
## Development

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f46209c31bc7be965b6ba32db92fb0746be15d9613b1c3c8d09ce7fa0e5e157
size 8280141
oid sha256:ea8626444e4f0213e39c21ded20607145ee85a947afc592f182f46e7f598ef30
size 7748671

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b604b45df0496baf94ac38145c3fc8d4fa9429ae02b49b33a7af4e32ad770db4
size 5896517
oid sha256:e46c7fb35826bcc3352eca8dbfeea3a8bdf1686cf46b3f873fad0c09bc25c5a7
size 5715362

View File

@ -57,7 +57,10 @@ let
if system == "x86_64-linux" && crossSystem == null && enableStatic then
"x86_64-unknown-linux-musl"
else
crossSystem;
if system == "aarch64-linux" && crossSystem == null && enableStatic then
"aarch64-unknown-linux-musl"
else
crossSystem;
};
# Use nixpkgs' top-level/static overlay if enableStatic = true.

70
doc/spec/nock/10.txt Normal file
View File

@ -0,0 +1,70 @@
Author: Mencius Moldbug [moldbug@gmail.com]
Date: 9/15/2008
Version: 10K
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Brackets enclose cells. [a b c] is [a [b c]].
5. Definition
5.1 Transformations
*[a [b c] d] => [*[a b c] *[a d]]
*[a 0 b] => /[b a]
*[a 1 b] => [b]
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
*[a 3 b] => **[a b]
*[a 4 b] => &*[a b]
*[a 5 b] => ^*[a b]
*[a 6 b] => =*[a b]
*[a] => *[a]
5.2 Operators
5.2.1 Goto [*]
*[a] -> nock[a]
5.2.2 Deep [&]
&[a b] -> 0
&[a] -> 1
5.2.4 Bump [^]
^[a b] -> ^[a b]
^[a] -> (a + 1)
5.2.5 Like [=]
=[a a] -> 0
=[a b] -> 1
=[a] -> =[a]
5.2.6 Snip [/]
/[1 a] -> a
/[2 a b] -> a
/[3 a b] -> b
/[(a + a) b] -> /[2 /[a b]]
/[(a + a + 1) b] -> /[3 /[a b]]
/[a] -> /[a]

74
doc/spec/nock/11.txt Normal file
View File

@ -0,0 +1,74 @@
Author: Mencius Moldbug (moldbug@gmail.com)
Date: 5/25/2008
Version: 11K
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Parentheses enclose cells. (a b c) is (a (b c)).
5. Definition
5.1 Transformations
*(a (b c) d) => (*(a b c) *(a d))
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
*(a 3 b) => **(a b)
*(a 4 b) => &*(a b)
*(a 5 b) => ^*(a b)
*(a 6 b) => =*(a b)
*(a 7 b c) => *(a 3 (((1 0) b) c) 1 0 3)
*(a 8 b c) => *(a c)
*(a) => *(a)
5.2 Operators
5.2.1 Goto (*)
*(a) -> nock(a)
5.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
5.2.4 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
5.2.5 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
5.2.6 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

75
doc/spec/nock/12.txt Normal file
View File

@ -0,0 +1,75 @@
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
Date: 3/28/2008
Version: 0.12
1. Introduction
This file defines one function, "nock."
nock is in the public domain.
2. Data
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Semantics
nock maps one noun to another. It doesn't always terminate.
4. Pseudocode
nock is defined in a pattern-matching pseudocode, below.
Parentheses enclose cells. (a b c) is (a (b c)).
5. Definition
5.1 Transformations
*(a (b c) d) => (*(a b c) *(a d))
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b c) => *(*(a b) c)
*(a 3 b) => **(a b)
*(a 4 b) => &*(a b)
*(a 5 b) => ^*(a b)
*(a 6 b) => =*(a b)
*(a 7 b c d) => *(a 3 (0 1) 3 (1 c d) (1 0) 3 (1 2 3) (1 0) 5 5 b)
*(a 8 b c) => *(a 2 (((1 0) b) c) 0 3)
*(a 9 b c) => *(a c)
*(a) => *(a)
5.2 Operators
5.2.1 Goto (*)
*(a) -> nock(a)
5.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
5.2.4 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
5.2.5 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
5.2.6 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

71
doc/spec/nock/13.txt Normal file
View File

@ -0,0 +1,71 @@
Author: Curtis Yarvin (curtis.yarvin@gmail.com)
Date: 3/8/2008
Version: 0.13
1. Manifest
This file defines one Turing-complete function, "nock."
nock is in the public domain. So far as I know, it is
neither patentable nor patented. Use it at your own risk.
2. Data
Both the domain and range of nock are "nouns."
A "noun" is either an "atom" or a "cell." An "atom" is an unsigned
integer of any size. A "cell" is an ordered pair of any two nouns,
the "head" and "tail."
3. Pseudocode
nock is defined in a pattern-matching pseudocode.
Match precedence is top-down. Operators are prefix. Parens
denote cells, and group right: (a b c) is (a (b c)).
4. Definition
4.1 Transformations
*(a 0 b c) => *(*(a b) c)
*(a 0 b) => /(b a)
*(a 1 b) => (b)
*(a 2 b) => **(a b)
*(a 3 b) => &*(a b)
*(a 4 b) => ^*(a b)
*(a 5 b) => =*(a b)
*(a 6 b c d) => *(a 2 (0 1) 2 (1 c d) (1 0) 2 (1 2 3) (1 0) 4 4 b)
*(a b c) => (*(a b) *(a c))
*(a) => *(a)
4.2 Operators
4.2.1 Goto (*)
*(a) -> nock(a)
4.2.2 Deep (&)
&(a b) -> 0
&(a) -> 1
4.2.3 Bump (^)
^(a b) -> ^(a b)
^(a) -> a + 1
4.2.4 Same (=)
=(a a) -> 0
=(a b) -> 1
=(a) -> =(a)
4.2.5 Snip (/)
/(1 a) -> a
/(2 a b) -> a
/(3 a b) -> b
/((a + a) b) -> /(2 /(a b))
/((a + a + 1) b) -> /(3 /(a b))
/(a) -> /(a)

42
doc/spec/nock/6.txt Normal file
View File

@ -0,0 +1,42 @@
1 Structures
A noun is an atom or a cell. An atom is any natural number.
A cell is an ordered pair of nouns.
2 Reductions
nock(a) *a
[a b c] [a [b c]]
?[a b] 0
?a 1
+a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] +*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[0 1] b] c]
*[a 9 b c] *[a 7 c 0 b]
*[a 10 b c] *[a c]
*[a 10 [b c] d] *[a 8 c 7 [0 2] d]
+[a b] +[a b]
=a =a
/a /a
*a *a

42
doc/spec/nock/7.txt Normal file
View File

@ -0,0 +1,42 @@
1 Structures
A noun is an atom or a cell. An atom is any natural number.
A cell is any ordered pair of nouns.
2 Pseudocode
[a b c] [a [b c]]
nock(a) *a
?[a b] 0
?a 1
^a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] ^*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
*[a 9 b c] *[a 7 c 0 b]
*[a 10 b c] *[a c]
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
^[a b] ^[a b]
=a =a
/a /a
*a *a

45
doc/spec/nock/8.txt Normal file
View File

@ -0,0 +1,45 @@
1 Structures
A noun is an atom or a cell. An atom is any unsigned integer.
A cell is an ordered pair of nouns.
2 Pseudocode
[a b c] is [a [b c]]; *a is nock(a). Reductions match top-down.
3 Reductions
?[a b] 0
?a 1
^a (a + 1)
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] ^*[a b]
*[a 5 b] =*[a b]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [7 b [0 1]] c]
*[a 9 b c] *[a 8 b 2 [[7 [0 3] d] [0 5]] 0 5]
*[a 10 b c] *[a 8 b 8 [7 [0 3] c] 0 2]
*[a 11 b c] *[a 8 b 7 [0 3] c]
*[a 12 b c] *[a [1 0] 1 c]
^[a b] ^[a b]
=a =a
/a /a
*a *a

43
doc/spec/nock/9.txt Normal file
View File

@ -0,0 +1,43 @@
1 Context
This spec defines one function, Nock.
2 Structures
A noun is an atom or a cell. An atom is any unsigned integer.
A cell is an ordered pair of any two nouns.
3 Pseudocode
Brackets enclose cells. [a b c] is [a [b c]].
*a is Nock(a). Reductions match top-down.
4 Reductions
?[a b] => 0
?a => 1
^[a b] => ^[a b]
^a => (a + 1)
=[a a] => 0
=[a b] => 1
=a => =a
/[1 a] => a
/[2 a b] => a
/[3 a b] => b
/[(a + a) b] => /[2 /[a b]]
/[(a + a + 1) b] => /[3 /[a b]]
/a => /a
*[a 0 b] => /[b a]
*[a 1 b] => b
*[a 2 b c d] => *[a 3 [0 1] 3 [1 c d] [1 0] 3 [1 2 3] [1 0] 5 5 b]
*[a 3 b] => **[a b]
*[a 4 b] => ?*[a b]
*[a 5 b] => ^*[a b]
*[a 6 b] => =*[a b]
*[a [b c] d] => [*[a b c] *[a d]]
*a => *a

View File

@ -25,6 +25,7 @@ let
(import ./overlays/native.nix)
# Specific overrides guarded by the host platform.
(import ./overlays/musl.nix)
(import ./overlays/arm.nix)
];
};

View File

@ -3,10 +3,11 @@ final: prev:
let
isAarch64 = prev.stdenv.hostPlatform.isAarch64;
isDarwin = prev.stdenv.isDarwin;
in prev.lib.optionalAttrs isAarch64 {
in prev.lib.optionalAttrs (isAarch64 && !isDarwin) {
libsigsegv = prev.libsigsegv.overrideAttrs (attrs: {
preConfigure = (old.preConfigure or "") + ''
preConfigure = (prev.preConfigure or "") + ''
sed -i 's/^CFG_FAULT=$/CFG_FAULT=fault-linux-arm.h/' configure
'';
});

View File

@ -281,7 +281,7 @@
:: restart %eth-watcher
::
~& >> %starting-eth-watcher
=/ rein=[desk rein] [%base %.y [%eth-watcher ~ ~] ~]
=/ rein=[desk rein] [%base [%eth-watcher %&] ~ ~]
:_ cards
[%pass /rein %agent [our.bowl %hood] %poke kiln-rein+!>(rein)]
=. cards

View File

@ -716,7 +716,7 @@
'rtt'^(numb (div rtt ~s1))
'rttvar'^(numb (div rttvar ~s1))
'ssthresh'^(numb ssthresh)
'num-live'^(numb num-live)
'num-live'^(numb ~(wyt by live))
'cwnd'^(numb cwnd)
'counter'^(numb counter)
==

File diff suppressed because one or more lines are too long

View File

@ -175,8 +175,10 @@
::
;~ pfix fas
;~ pose
(parse-variable (cold %sur hep) ;~(pfix gap parse-cables))
(parse-variable (cold %lib lus) ;~(pfix gap parse-cables))
(parse-variable (cold %sur hep) ;~(pfix gap (parse-cables %sur)))
(parse-variable (cold %lib lus) ;~(pfix gap (parse-cables %lib)))
;~(pfix tis gap (parse-variable sym ;~(pfix gap parse-path)))
;~(pfix cen gap (parse-variable sym ;~(pfix gap parse-mark)))
==
==
::
@ -207,22 +209,17 @@
==
::
++ parse-cables
%+ cook
|= cables=(list cable:clay)
:+ 0 %ex
^- hoon
::
:- %clsg
%+ turn cables
|= cable=cable:clay
^- hoon
::
:+ %clhp
?~ face.cable
[%rock %n ~]
[%clhp [%rock %n ~] [%sand %tas u.face.cable]]
[%sand %tas file-path.cable]
(most ;~(plug com gaw) parse-cable)
|= base-path=@ta
%- cook :_ (most ;~(plug com gaw) parse-cable)
|= cables=(list cable:clay)
:+ 0 %tu
::
%+ turn cables
|= cable=cable:clay
^- dojo-source
=+ add-face=?~(face.cable "|*(n=* n)" ;:(weld "|*(n=* ^=(" (trip u.face.cable) " n))"))
:^ 0 %do (scan add-face parse-hoon)
:+ 0 %dv [-.dir `path`[base-path file-path.cable ~]]
::
++ parse-cable
%+ cook |=(a=cable:clay a)
@ -231,6 +228,16 @@
(cook |=([face=term tis=@ file=term] [`face file]) ;~(plug sym tis sym))
(cook |=(a=term [`a a]) sym)
==
::
++ parse-mark
%- cook :_ ;~(pfix cen sym)
|= mark=@tas
[0 %dv -.dir `path`[~.mar mark ~]]
::
++ parse-path
%+ cook |=(=path [0 %dv -.dir path])
;~(pfix fas (more fas sym))
::
++ parse-source (stag 0 parse-build)
++ parse-build
%+ knee *dojo-build |. ~+
@ -550,8 +557,6 @@
=. var (~(del by var) p.mad)
=< dy-amok
?+ p.mad .
%lib .(lib ~)
%sur .(sur ~)
%dir .(dir [[our.hid %base ud+0] /])
==
=+ cay=(~(got by rez) p.q.mad)
@ -563,30 +568,19 @@
~| bad-set+[p.p.mad p.q.cay]
=< dy-amok
?+ p.p.mad .
%lib
%_ .
lib
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay)
==
::
%sur
%_ .
sur
((dy-cast (list cable:clay) !>(*(list cable:clay))) q.cay)
==
::
%dir =+ ^= bem ^- beam
%- need %- de-beam
=+ pax=((dy-cast path !>(*path)) q.cay)
?: ?=(~ pax) ~[(scot %p our.hid) %base '0']
?: ?=([@ ~] pax) ~[i.pax %base '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
?: =(~ .^((list path) %ct (en-beam he-beam(dir bem))))
+(..dy (he-diff %tan 'dojo: dir does not exist' ~))
=. dir bem
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
%dir
=/ bem=beam
%- need %- de-beam
=+ pax=((dy-cast path !>(*path)) q.cay)
?: ?=(~ pax) ~[(scot %p our.hid) %base '0']
?: ?=([@ ~] pax) ~[i.pax %base '0']
?: ?=([@ @ ~] pax) ~[i.pax i.t.pax '0']
pax
?: =(~ .^((list path) %ct (en-beam he-beam(dir bem))))
+(..dy (he-diff %tan 'dojo: dir does not exist' ~))
=. dir bem
=- +>(..dy (he-diff %tan - ~))
rose+[" " `~]^~[leaf+"=%" (smyt (en-beam he-beak s.dir))]
==
::
%poke

View File

@ -2,8 +2,8 @@
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|%
+$ state
$~ [%23 *state:drum *state:helm *state:kiln]
$>(%23 any-state)
$~ [%24 *state:drum *state:helm *state:kiln]
$>(%24 any-state)
::
+$ any-state
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
@ -24,6 +24,7 @@
[%21 drum=state-4:drum helm=state-1:helm kiln=state-8:kiln]
[%22 drum=state-4:drum helm=state-1:helm kiln=state-9:kiln]
[%23 drum=state-4:drum helm=state-2:helm kiln=state-9:kiln]
[%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln]
==
+$ any-state-tuple
$: drum=any-state:drum

View File

@ -166,10 +166,10 @@
(on-load on-save)
=^ cards state
?+ mark (on-poke:def mark vase)
%spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider vase))
%spider-stop (handle-stop-thread:sc !<([tid ?] vase))
::
%spider-input (on-poke-input:sc !<(input vase))
%spider-start (handle-start-thread:sc !<(start-args:spider vase))
%spider-inline (handle-inline-thread:sc !<(inline-args:spider vase))
%spider-stop (handle-stop-thread:sc !<([tid ?] vase))
%handle-http-request
(handle-http-request:sc !<([@ta =inbound-request:eyre] vase))
==
@ -303,12 +303,31 @@
++ handle-start-thread
~/ %handle-start-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak file=term =vase]
(prep-thread parent-tid use beak %| file vase)
::
++ handle-inline-thread
~/ %handle-inline-thread
|= [parent-tid=(unit tid) use=(unit tid) =beak =shed:khan]
(prep-thread parent-tid use beak %& shed)
::
++ prep-thread
|= $: parent-tid=(unit tid) use=(unit tid) =beak
source=(each shed:khan [file=term =vase])
==
^- (quip card ^state)
=/ parent-yarn=yarn
?~ parent-tid
/
(~(got by tid.state) u.parent-tid)
=/ new-tid (fall use (new-thread-id file))
=/ new-tid
?^ use
u.use
%- new-thread-id
?- -.source
%& (cat 3 'inline-' q.beak)
%| file.p.source
==
::
=/ =yarn (snoc parent-yarn new-tid)
::
?: (~(has of running.state) yarn)
@ -321,16 +340,19 @@
=? serving.state !(~(has by serving.state) new-tid)
(~(put by serving.state) new-tid [~ %noun q.beak])
::
=: starting.state (~(put by starting.state) yarn [%build vase])
tid.state (~(put by tid.state) new-tid yarn)
=. tid.state (~(put by tid.state) new-tid yarn)
?- -.source
%& (begin-shed yarn p.source)
%|
=. starting.state (~(put by starting.state) yarn [%build vase.p.source])
=/ pax=path
~| no-file-for-thread+file.p.source
(need (get-fit:clay beak %ted file.p.source))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
==
=/ pax=path
~| no-file-for-thread+file
(need (get-fit:clay beak %ted file))
:_ state
:_ ~
:+ %pass /build/[new-tid]
[%arvo %c %warp p.beak q.beak ~ %sing %a r.beak pax]
::
++ handle-build
~/ %handle-build
@ -349,23 +371,25 @@
=/ maybe-thread (mule |.(!<(thread !<(vase q.r.u.riot))))
?: ?=(%| -.maybe-thread)
(thread-fail-not-running tid %thread-not-thread ~)
(start-thread yarn p.maybe-thread)
(slam-thread yarn p.maybe-thread)
::
++ start-thread
~/ %start-thread
++ slam-thread
~/ %slam-thread
|= [=yarn =thread]
^- (quip card ^state)
=/ =vase vase:(~(got by starting.state) yarn)
?< (~(has of running.state) yarn)
=/ m (strand ,^vase)
=/ res (mule |.((thread vase)))
?: ?=(%| -.res)
(thread-fail-not-running (yarn-to-tid yarn) %false-start p.res)
=/ =eval-form:eval:m
(from-form:eval:m p.res)
=: starting.state (~(del by starting.state) yarn)
running.state (~(put of running.state) yarn eval-form)
==
=. starting.state (~(del by starting.state) yarn)
(begin-shed yarn p.res)
::
++ begin-shed
|= [=yarn =shed:khan]
?< (~(has of running.state) yarn)
=/ m (strand ,vase)
=/ =eval-form:eval:m (from-form:eval:m shed)
=. running.state (~(put of running.state) yarn eval-form)
(take-input yarn ~)
::
++ handle-stop-thread

View File

@ -1,14 +0,0 @@
:: Helm: Reload vane/s from /=base=
::
:::: /hoon/breload/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=(list term) ~]
==
:+ %helm-reload-desk %base
arg

View File

@ -1,7 +1,3 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
~
force=_|
except=(set desk)
==
[%kiln-bump except force]
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
[%kiln-bump ~]

View File

@ -8,11 +8,7 @@
==
:- %kiln-rein
:- desk
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
%+ roll arg
=/ =rein:hood
=< rein.arak
.^(vat:hood %gx /(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun)
|: [*[on=? =dude:gall] rein=rein(liv liv)]
?: on
rein(add (~(put in add.rein) dude))
rein(sub (~(put in sub.rein) dude))
|: [*[on=? =dude:gall] rein=ren:(~(got by cone) [p.bec desk])]
(~(put by rein) dude on)

View File

@ -15,4 +15,7 @@
?@ +.arg [q.bec -.arg]
?> ((sane %tas) +<.arg)
[-.arg +<.arg]
[%kiln-rein des & [dap ~ ~] ~]
=+ .^(=cone:clay %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ =foam:clay (~(gut by cone) [p.bec des] *foam:clay)
=+ ((slog ?:(=(%live liv.foam) ~ ['kiln: desk not live' ~])) ~)
[%kiln-rein des (~(put by ren.foam) dap &)]

View File

@ -13,8 +13,7 @@
=/ =lobe u.fil.arch
=+ .^(=rang %cx /(scot %p p.bec)//(scot %da now)/rang)
=+ .^(=cone %cx /(scot %p p.bec)//(scot %da now)/domes)
=/ domes=(list [[=ship =desk] =dome tom=(map tako norm) nor=norm])
~(tap by cone)
=/ domes=(list [[=ship =desk] foam]) ~(tap by cone)
=/ norms
|^
|- ^- (set [ship desk tako norm path])
@ -24,14 +23,14 @@
=/ =aeon 1
%- ~(uni in $(domes t.domes))
|- ^- (set [ship desk tako norm path])
?: (lth let.dome.i.domes aeon)
?: (lth let.i.domes aeon)
~
=/ =tako (~(got by hit.dome.i.domes) aeon)
=/ =tako (~(got by hit.i.domes) aeon)
=/ paths (draw-tako ship.i.domes desk.i.domes +.i.domes tako)
(~(uni in paths) $(aeon +(aeon)))
::
++ draw-tako
|= [=ship =desk [dome tom=(map tako norm) nor=norm] =tako]
|= [=ship =desk foam =tako]
^- (set [^ship ^desk ^tako norm path])
~+
=/ =yaki (~(got by hut.rang) tako)

View File

@ -1,14 +0,0 @@
:: Kiln: merge each version of remote desk? XX clarify
::
:::: /hoon/track/hood/gen
::
/? 310
::
::::
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[arg=[syd=@tas her=@p sud=@tas ~] ~]
==
:- %kiln-track
[syd her sud]:arg

View File

@ -8,7 +8,7 @@
%- flop ^- tang
%- zing
%+ turn ~(tap by cone)
|= [[=ship =desk] dome tom=(map tako norm) nor=norm]
|= [[=ship =desk] foam]
:- leaf+"{<ship>}/{<desk>}:"
%+ turn ~(tap of nor)
|= [=path keep=?]

View File

@ -77,10 +77,8 @@
~& %solid-double-loaded
=/ whole-formula
=< +
.* 0
:+ %7
compiler-formula
[%9 2 %10 [6 %1 %noun whole-src] [%0 1]]
.* [%noun whole-src]
[%8 compiler-formula [%9 2 %10 [6 %0 3] [%0 2]]]
~& %solid-double-compiled
whole-formula
::
@ -100,24 +98,19 @@
|= [ovo=ovum ken=*]
[~ (slum ken [now ovo])]
::
:: kernel-formula
:: boot-two: startup formula
::
:: We evaluate :arvo-formula (for jet registration),
:: then ignore the result and produce .installed
::
=/ kernel-formula
[%7 arvo-formula %1 installed]
::
:: boot-two: startup formula
::
=/ boot-two
=> [kernel-formula=** main-sequence=**]
!= [.*(0 kernel-formula) main-sequence]
=> *[arvo-formula=^ installed=^ tale=*]
!= =+(.*(0 arvo-formula) [installed tale])
::
:: boot-ova
::
=/ boot-ova=(list)
[aeon:eden:part boot-two kernel-formula ~]
[aeon:eden:part boot-two arvo-formula installed ~]
::
:: a pill is a 3-tuple of event-lists: [boot kernel userspace]
::

View File

@ -3,6 +3,8 @@
::::
::
/- *story
/$ story-to-txt %story %txt
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[~] =desk ~]
@ -15,9 +17,6 @@
tang+[leaf+"Error: desk {<desk>} does not exist." ~]
?: !.^(? %cu pax)
tang+['Error: No story file found. Please use |story-init to create one.' ~]
=/ story-to-txt
.^($-(story wain) %cf /(scot %p our)/[desk]/(scot cas)/story/txt)
::
=/ tale .^(story %cx pax)
=/ tale-text (story-to-txt tale)
tang+tale-text
=/ tale-text (flop (story-to-txt tale))
tang+tale-text

View File

@ -48,7 +48,7 @@
?- reverse-ancestors
~
:: stop here and return the current message
=/ msg=(list cord) (msg-from-commit this-commit tale)
=/ msg=wain (msg-from-commit this-commit tale)
[(weld msg result.state) mergebase=~]
::
[tako:clay ~]
@ -103,8 +103,7 @@
=/ mainline-commit
.^(yaki:clay %cs /(scot %p our)/[syd]/(scot cas)/yaki/(scot %uv mainline))
::
=/ msg=(list cord)
(msg-from-commit this-commit tale)
=/ msg=wain (msg-from-commit this-commit tale)
::
:: 1 - process current commit
:: 2 - recur and queue processing on all commits on the sideline
@ -141,14 +140,9 @@
::
++ msg-from-commit
|= [commit=yaki:clay tale=story]
^- (list cord)
=/ proses (~(get by tale) r.commit)
^- wain
=/ proses (~(get ju tale) r.commit)
?~ proses ~
%- flop :: fixes formatting reversal in dojo
%- to-wain:format
%- crip
;: welp
(tako-to-text:lib r.commit)
(proses-to-text:lib u.proses)
==
(chapter-to-text:lib r.commit proses)
--

View File

@ -3,8 +3,4 @@
|= $: [now=@da eny=@uvJ bec=beak]
[[=desk ~] ~]
==
?: =(desk %kids) [%tang ~[(report-kids p.bec now)]]
=+ .^ =vat %gx
/(scot %p p.bec)/hood/(scot %da now)/kiln/vat/[desk]/noun
==
[%tang ~[(report-vat p.bec now vat)]]
[%tang ~[(report-vat (report-prep p.bec now) p.bec now desk)]]

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,13 @@
|%
+$ bump [except=(set desk) force=_|]
--
|_ b=bump
|_ ~
++ grad %noun
++ grab
|%
++ noun bump
++ json
^- $-(^json bump)
=, dejs:format
%- ot
:~ except+(as so)
force+bo
==
++ noun ,~
++ json ul:dejs:format
--
++ grow
|%
++ noun b
++ noun ~
++ json ~
--
--
--

View File

@ -0,0 +1,24 @@
/- h=hood
|_ =pikes:h
++ grad %noun
++ grow
|%
++ noun pikes
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by pikes)
|= [=desk =pike:h]
:- desk
%- pairs
:~ sync/?~(sync.pike ~ =,(u.sync.pike (pairs ship/s/(scot %p ship) desk/s/desk ~)))
hash/s/(scot %uv hash.pike)
zest/s/zest.pike
wefts/a/(turn ~(tap in wic.pike) weft:enjs:h)
==
--
++ grab
|%
++ noun pikes:h
--
--

View File

@ -0,0 +1,29 @@
|%
+$ sync
[local=term =ship =desk]
--
|_ s=sync
++ grad %noun
++ grow
|%
++ noun s
++ json
%- pairs:enjs:format
:~ local+s+local.s
desk+s+desk.s
ship+s+(scot %p ship.s)
==
--
++ grab
|%
++ noun sync
++ json
^- $-(^json sync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -0,0 +1,29 @@
|%
+$ unsync
[local=term =ship =desk]
--
|_ usyc=unsync
++ grad %noun
++ grow
|%
++ noun usyc
++ json
%- pairs:enjs:format
:~ local+s+local.usyc
desk+s+desk.usyc
ship+s+(scot %p ship.usyc)
==
--
++ grab
|%
++ noun unsync
++ json
^- $-(^json unsync)
=, dejs:format
%- ot
:~ local+so
ship+(su ;~(pfix sig fed:ag))
desk+so
==
--
--

View File

@ -1,54 +0,0 @@
/- hood
|_ =diff:hood
++ grad %noun
++ grow
|%
++ noun diff
++ json
=, enjs:format
|^
%+ frond -.diff
?- -.diff
%block (block +.diff)
?(%merge-sunk %merge-fail) (desk-arak-err +.diff)
?(%reset %commit %suspend %revive) (desk-arak +.diff)
==
::
++ block
|= [=desk =arak:hood =weft:hood blockers=(set desk)]
%+ merge (desk-arak desk arak)
%- pairs
:~ weft+(weft:enjs:hood weft)
blockers+a+(turn ~(tap in blockers) (lead %s))
==
::
++ desk-arak
|= [=desk =arak:hood]
%- pairs
:~ desk+s+desk
arak+(arak:enjs:hood arak)
==
::
++ desk-arak-err
|= [=desk =arak:hood =tang]
%+ merge (desk-arak desk arak)
%+ frond %tang
a+(turn tang tank)
::
++ merge
|= [a=^json b=^json]
^- ^json
?> &(?=(%o -.a) ?=(%o -.b))
o+(~(uni by p.a) p.b)
--
--
++ grab
|%
++ noun diff:hood
--
--

View File

@ -1,20 +0,0 @@
/- hood
!:
|_ ark=(map desk arak:hood)
++ grad %noun
++ grow
|%
++ noun ark
++ json
=, enjs:format
%- pairs
%+ turn ~(tap by ark)
|= [=desk =arak:hood]
[desk (arak:enjs:hood arak)]
--
::
++ grab
|%
++ noun (map desk arak:hood)
--
--

View File

@ -1,21 +0,0 @@
/- *hood
|_ vats=(list vat)
++ grad %noun
++ grow
|%
++ noun vats
++ json (vats:enjs vats)
--
++ grab
|%
++ noun (list vat)
--
--

View File

@ -1 +1 @@
[%zuse 418]
[%zuse 417]

View File

@ -415,7 +415,7 @@
==
--
::
:: |de: axal engine
:: |of: axal engine
::
++ of
=| fat=(axal)
@ -738,7 +738,7 @@
?@ epic arvo
%= $
epic +.epic
arvo .*(arvo [%9 2 %10 [6 %1 -.epic] %0 1])
arvo .*([arvo -.epic] [%9 2 %10 [6 %0 3] %0 2])
==
::
:: +boot: event 2: bootstrap a kernel from source
@ -773,7 +773,7 @@
::
~> %slog.[0 leaf+"1-c (compiling compiler, wait a few minutes)"]
=/ compiler-tool
.*(compiler-gate [%9 2 %10 [6 %1 noun/hoon.log] %0 1])
.*([compiler-gate noun/hoon.log] [%9 2 %10 [6 %0 3] %0 2])
::
:: switch to the second-generation compiler. we want to be
:: able to generate matching reflection nouns even if the
@ -781,7 +781,7 @@
:: generate last-generation spans for `!>`, etc.
::
~> %slog.[0 leaf+"1-d"]
=. compiler-gate .*(0 +:compiler-tool)
=. compiler-gate .*(0 +.compiler-tool)
::
:: get the span (type) of the kernel core, which is the context
:: of the compiler gate. we just compiled the compiler,
@ -791,18 +791,18 @@
::
~> %slog.[0 leaf+"1-e"]
=/ kernel-span
-:.*(compiler-gate [%9 2 %10 [6 %1 [-.compiler-tool '+>']] %0 1])
-:.*([compiler-gate -.compiler-tool '+>'] [%9 2 %10 [6 %0 3] %0 2])
::
:: compile the arvo source against the kernel core.
::
~> %slog.[0 leaf+"1-f"]
=/ kernel-tool
.*(compiler-gate [%9 2 %10 [6 %1 [kernel-span arvo.log]] %0 1])
.*([compiler-gate kernel-span arvo.log] [%9 2 %10 [6 %0 3] %0 2])
::
:: create the arvo kernel, whose subject is the kernel core.
::
~> %slog.[0 leaf+"1-g"]
[.*(+>:compiler-gate +:kernel-tool) epic.log]
[.*(+>.compiler-gate +.kernel-tool) epic.log]
--
::
:: |adapt
@ -1570,7 +1570,7 @@
::
%crud =? lag.zen ?& ?=(%exit mote.goof.buz)
?=(^ tang.goof.buz)
?=(%leaf -.i.tang.goof.buz) :: XX ?@
?=([%leaf *] i.tang.goof.buz)
?=(%wyrd (crip p.i.tang.goof.buz))
==
~&(%lagging &)

View File

@ -6203,14 +6203,14 @@
++ mure
|= tap=(trap)
^- (unit)
=/ ton (mink [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
=/ ton (mink [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?.(?=(%0 -.ton) ~ `product.ton)
:: +mute: untyped virtual
::
++ mute
|= tap=(trap)
^- (each * (list tank))
=/ ton (mock [tap %9 2 %0 1] |=((pair) ``.*(~ [%12 1+p 1+q])))
=/ ton (mock [tap %9 2 %0 1] |=(a=^ ``.*(a [%12 [%0 2] %0 3])))
?- -.ton
%0 [%& p.ton]
::
@ -6223,9 +6223,8 @@
::
++ slum
~/ %slum
|= [gat=* sam=*]
^- *
.*(gat [%9 2 %10 [6 %1 sam] %0 1])
|= sub=[gat=* sam=*]
.*(sub [%9 2 %10 [6 %0 3] %0 2])
:: +soft: virtual clam
::
++ soft
@ -11380,13 +11379,12 @@
==
::
++ slew :: get axis in vase
|= [axe=@ vax=vase] ^- (unit vase)
?. |- ^- ?
?: =(1 axe) &
?. ?=(^ q.vax) |
$(axe (mas axe), q.vax .*(q.vax [0 (cap axe)]))
~
`[(~(peek ut p.vax) %free axe) .*(q.vax [0 axe])]
|= [axe=@ vax=vase]
=/ typ |. (~(peek ut p.vax) %free axe)
|- ^- (unit vase)
?: =(1 axe) `[$:typ q.vax]
?@ q.vax ~
$(axe (mas axe), q.vax ?-((cap axe) %2 -.q.vax, %3 +.q.vax))
::
++ slim :: identical to seer?
|= old=vise ^- vase

View File

@ -1,9 +1,9 @@
:: /sys/lull
:: %lull: arvo structures
::
!:
=> ..part
|%
++ lull %329
++ lull %328
:: :: ::
:::: :: :: (1) models
:: :: ::
@ -755,6 +755,7 @@
[%note p=@tD q=tank] :: debug message
[%ogre p=@tas] :: delete mount point
[%rule red=dict wit=dict] :: node r+w permissions
[%tire p=(each rock:tire wave:tire)] :: app state
[%writ p=riot] :: response
[%wris p=[%da p=@da] q=(set (pair care path))] :: many changes
== ::
@ -784,12 +785,16 @@
[%park des=desk yok=yoki ran=rang] :: synchronous commit
[%perm des=desk pax=path rit=rite] :: change permissions
[%pork ~] :: resume commit
[%rein des=desk ren=rein] :: extra apps
[%stir arg=*] :: debug
[%tire p=(unit ~)] :: app state subscribe
[%tomb =clue] :: tombstone specific
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
[%warp wer=ship rif=riff] :: internal file req
[%werp who=ship wer=ship rif=riff-any] :: external file req
[%wick ~] :: try upgrade
[%zest des=desk liv=zest] :: live
$>(%plea vane-task) :: ames request
== ::
:: ::
@ -822,9 +827,14 @@
[%worn =ship =desk =tako =norm] :: set commit norm
[%seek =ship =desk =cash] :: fetch source blobs
== ::
+$ cone :: domes
%+ map [ship desk] ::
[dome tom=(map tako norm) nor=norm] ::
+$ cone (map [ship desk] foam) :: domes
+$ foam ::
$: dome ::
tom=(map tako norm) ::
nor=norm ::
liv=zest ::
ren=(map dude:gall ?) ::
== ::
+$ crew (set ship) :: permissions group
+$ dict [src=path rul=real] :: effective permission
+$ dome :: project state
@ -894,6 +904,7 @@
who=(pair (set ship) (map @ta crew)) ::
== ::
+$ regs (map path rule) :: rules for paths
+$ rein (map dude:gall ?) :: extra apps
+$ riff [p=desk q=(unit rave)] :: request+desist
+$ riff-any ::
$% [%1 =riff] ::
@ -917,6 +928,9 @@
[%| p=(list a) q=(list a)] :: p -> q[chunk]
== ::
++ urge |*(a=mold (list (unce a))) :: list change
+$ waft :: kelvin range
$^ [[%1 ~] p=(set weft)] ::
weft ::
+$ whom (each ship @ta) :: ship or named crew
+$ yoki (each yuki yaki) :: commit
+$ yuki :: proto-commit
@ -929,11 +943,111 @@
r=tako :: self-reference
t=@da :: date
== ::
+$ zest $~(%dead ?(%dead %live %held)) :: how live
:: ::
++ tire :: app state
|% ::
+$ rock (map desk [=zest wic=(set weft)]) ::
+$ wave ::
$% [%wait =desk =weft] :: blocked
[%warp =desk =weft] :: unblocked
[%zest =desk =zest] :: running
== ::
::
++ wash :: patch
|= [=rock =wave]
^+ rock
?- -.wave
%wait
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(wic (~(put in wic.got) weft.wave)))
::
%warp
%- ~(run by rock)
|= [=zest wic=(set weft)]
[zest (~(del in wic) weft.wave)]
::
%zest
?: ?=(%dead zest.wave)
(~(del by rock) desk.wave)
=/ got=[=zest wic=(set weft)]
(~(gut by rock) desk.wave *zest ~)
(~(put by rock) desk.wave got(zest zest.wave))
==
::
++ walk :: diff
|= [a=rock b=rock]
^- (list wave)
=/ adds (~(dif by b) a)
=/ dels (~(dif by a) b)
=/ bots (~(int by a) b)
;: welp
^- (list wave)
%- zing
%+ turn ~(tap by adds)
|= [=desk =zest wic=(set weft)]
^- (list wave)
:- [%zest desk zest]
%+ turn ~(tap in wic)
|= =weft
[%wait desk weft]
::
^- (list wave)
%+ turn ~(tap by dels)
|= [=desk =zest wic=(set weft)]
^- wave
[%zest desk %dead]
::
^- (list wave)
%- zing
%+ turn ~(tap by bots)
|= [=desk * *]
^- (list wave)
=/ aa (~(got by a) desk)
=/ bb (~(got by b) desk)
=/ wadds (~(dif in wic.bb) wic.aa)
=/ wdels (~(dif in wic.aa) wic.bb)
;: welp
?: =(zest.aa zest.bb)
~
[%zest desk zest.bb]~
::
%+ turn ~(tap by wadds)
|= =weft
^- wave
[%wait desk weft]
::
%+ turn ~(tap by wdels)
|= =weft
^- wave
[%warp desk weft]
==
==
--
::
:: +page-to-lobe: hash a page to get a lobe.
::
++ page-to-lobe |=(page (shax (jam +<)))
::
++ cord-to-waft
|= =cord
^- waft
=/ wefts=(list weft)
%+ turn (rash cord (star (ifix [gay gay] tall:vast)))
|= =hoon
!<(weft (slap !>(~) hoon))
?: ?=([* ~] wefts)
i.wefts
[[%1 ~] (sy wefts)]
::
++ waft-to-wefts
|= kal=waft
^- (set weft)
?^ -.kal
p.kal
[kal ~ ~]
::
:: +make-yaki: make commit out of a list of parents, content, and date.
::
++ make-yaki
@ -1658,6 +1772,7 @@
[%sear =ship] :: clear pending queues
[%jolt =desk =dude] :: (re)start agent
[%idle =dude] :: suspend agent
[%load =load] :: load agent
[%nuke =dude] :: delete agent
[%doff dude=(unit dude) ship=(unit ship)] :: kill subscriptions
[%rake dude=(unit dude) all=?] :: reclaim old subs
@ -1686,6 +1801,7 @@
== == ::
+$ dude term :: server identity
+$ gill (pair ship term) :: general contact
+$ load (list [=dude =beak =agent]) :: loadout
+$ scar :: opaque duct
$: p=@ud :: bone sequence
q=(map duct bone) :: by duct
@ -2126,10 +2242,11 @@
$~ [%vega ~] ::
$% $>(%born vane-task) :: new unix process
[%done ~] :: socket closed
:: XX mark ignored
::
:: TODO mark ignored ::
:: ::
[%fard p=(fyrd cage)] :: in-arvo thread
[%fyrd p=(fyrd cast)] :: external thread
[%lard =bear =shed] :: inline thread
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
== ::
@ -2138,8 +2255,200 @@
+$ bear $@(desk beak) :: partial $beak
+$ cast (pair mark page) :: output mark + input
++ fyrd |$ [a] [=bear name=term args=a] :: thread run request
:: ::
+$ shed _*form:(strand:rand ,vase) :: compute vase
-- ::khan
::
++ rand :: computation
|%
+$ card card:agent:gall
+$ input
$% [%poke =cage]
[%sign =wire =sign-arvo]
[%agent =wire =sign:agent:gall]
[%watch =path]
==
+$ strand-input [=bowl in=(unit input)]
+$ tid @tatid
+$ bowl
$: our=ship
src=ship
tid=tid
mom=(unit tid)
wex=boat:gall
sup=bitt:gall
eny=@uvJ
now=@da
byk=beak
==
::
:: cards: cards to send immediately. These will go out even if a
:: later stage of the computation fails, so they shouldn't have
:: any semantic effect on the rest of the system.
:: Alternately, they may record an entry in contracts with
:: enough information to undo the effect if the computation
:: fails.
:: wait: don't move on, stay here. The next sign should come back
:: to this same callback.
:: skip: didn't expect this input; drop it down to be handled
:: elsewhere
:: cont: continue computation with new callback.
:: fail: abort computation; don't send effects
:: done: finish computation; send effects
::
++ strand-output-raw
|* a=mold
$~ [~ %done *a]
$: cards=(list card)
$= next
$% [%wait ~]
[%skip ~]
[%cont self=(strand-form-raw a)]
[%fail err=(pair term tang)]
[%done value=a]
==
==
::
++ strand-form-raw
|* a=mold
$-(strand-input (strand-output-raw a))
::
:: Abort strand computation with error message
::
++ strand-fail
|= err=(pair term tang)
|= strand-input
[~ %fail err]
::
:: Asynchronous transcaction monad.
::
:: Combo of four monads:
:: - Reader on input
:: - Writer on card
:: - Continuation
:: - Exception
::
++ strand
|* a=mold
|%
++ output (strand-output-raw a)
::
:: Type of an strand computation.
::
++ form (strand-form-raw a)
::
:: Monadic pure. Identity computation for bind.
::
++ pure
|= arg=a
^- form
|= strand-input
[~ %done arg]
::
:: Monadic bind. Combines two computations, associatively.
::
++ bind
|* b=mold
|= [m-b=(strand-form-raw b) fun=$-(b form)]
^- form
|= input=strand-input
=/ b-res=(strand-output-raw b)
(m-b input)
^- output
:- cards.b-res
?- -.next.b-res
%wait [%wait ~]
%skip [%skip ~]
%cont [%cont ..$(m-b self.next.b-res)]
%fail [%fail err.next.b-res]
%done [%cont (fun value.next.b-res)]
==
::
:: The strand monad must be evaluted in a particular way to maintain
:: its monadic character. +take:eval implements this.
::
++ eval
|%
:: Indelible state of a strand
::
+$ eval-form
$: =form
==
::
:: Convert initial form to eval-form
::
++ from-form
|= =form
^- eval-form
form
::
:: The cases of results of +take
::
+$ eval-result
$% [%next ~]
[%fail err=(pair term tang)]
[%done value=a]
==
::
++ validate-mark
|= [in=* =mark =bowl]
^- cage
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[mark]
==
=/ res (mule |.((vale.dais in)))
?: ?=(%| -.res)
~| %spider-mark-fail
(mean leaf+"spider: ames vale fail {<mark>}" p.res)
[mark p.res]
::
:: Take a new sign and run the strand against it
::
++ take
:: cards: accumulate throughout recursion the cards to be
:: produced now
=| cards=(list card)
|= [=eval-form =strand-input]
^- [[(list card) =eval-result] _eval-form]
=* take-loop $
=. in.strand-input
?~ in.strand-input ~
=/ in u.in.strand-input
?. ?=(%agent -.in) `in
?. ?=(%fact -.sign.in) `in
::
:- ~
:^ %agent wire.in %fact
(validate-mark q.q.cage.sign.in p.cage.sign.in bowl.strand-input)
:: run the strand callback
::
=/ =output (form.eval-form strand-input)
:: add cards to cards
::
=. cards
%+ welp
cards
:: XX add tag to wires?
cards.output
:: case-wise handle next steps
::
?- -.next.output
%wait [[cards %next ~] eval-form]
%skip [[cards %next ~] eval-form]
%fail [[cards %fail err.next.output] eval-form]
%done [[cards %done value.next.output] eval-form]
%cont
:: recurse to run continuation with initialization input
::
%_ take-loop
form.eval-form self.next.output
strand-input [bowl.strand-input ~]
==
==
--
--
-- ::strand
::
+$ gift-arvo :: out result <-$
$~ [%doze ~]
$% gift:ames

View File

@ -733,6 +733,7 @@
$% [%private-keys ~]
[%public-keys ships=(set ship)]
[%turf ~]
[%ruin ships=(set ship)]
== ==
$: @tas
$% [%plea =ship =plea]
@ -1247,7 +1248,7 @@
=(%$ syd)
==
?. for.veb.bug.ames-state ~
~> %slog.0^leaf/"ames: scry-fail {<[why=why lot=lot now=now syd=syd]>}"
~> %slog.0^leaf/"ames: scry-fail {<why=why lot=lot now=now syd=syd>}"
~
:: /ax/protocol/version @
:: /ax/peers (map ship ?(%alien %known))
@ -1280,9 +1281,11 @@
[%forward-lane ~]
::
:: this duplicates the routing hack from +send-blob:event-core
:: so long as neither the peer nor the peer's sponsoring galaxy is us:
:: so long as neither the peer nor the peer's sponsoring galaxy is us,
:: and the peer has been reached recently:
::
:: - no route to the peer: send to the peer's sponsoring galaxy
:: - no route to the peer, or peer has not been contacted recently:
:: send to the peer's sponsoring galaxy
:: - direct route to the peer: use that
:: - indirect route to the peer: send to both that route and the
:: the peer's sponsoring galaxy
@ -1294,6 +1297,8 @@
==
~
=; zar=(trap (list lane))
?: (lth last-contact.qos.u.peer (sub now ~h1))
$:zar
?~ route.u.peer $:zar
=* rot u.route.u.peer
?:(direct.rot [lane.rot ~] [lane.rot $:zar])
@ -1770,7 +1775,7 @@
|. ^- tape
=/ sndr [our our-life.channel]
=/ rcvr [ship her-life.channel]
"plea {<sndr^rcvr^bone=bone^vane.plea^path.plea>}"
"plea {<sndr rcvr bone=bone vane.plea path.plea>}"
abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea)
:: +on-cork: handle request to kill a flow
::
@ -1793,7 +1798,7 @@
|. ^- tape
=/ sndr [our our-life.channel]
=/ rcvr [ship her-life.channel]
"cork plea {<sndr^rcvr^bone=bone^vane.plea^path.plea>}"
"cork plea {<sndr rcvr bone=bone vane.plea path.plea>}"
abet:(on-memo:(make-peer-core peer-state channel) bone plea %plea)
:: +on-take-wake: receive wakeup or error notification from behn
::
@ -1921,14 +1926,14 @@
:: we shouldn't be hearing about ships we don't care about
::
?~ ship-state
~> %slog.0^leaf/"ames: breach unknown {<our^ship>}"
~> %slog.0^leaf/"ames: breach unknown {<our ship>}"
event-core
:: if an alien breached, this doesn't affect us
::
?: ?=([~ %alien *] ship-state)
~> %slog.0^leaf/"ames: breach alien {<our^ship>}"
~> %slog.0^leaf/"ames: breach alien {<our ship>}"
event-core
~> %slog.0^leaf/"ames: breach peer {<our^ship>}"
~> %slog.0^leaf/"ames: breach peer {<our ship>}"
:: a peer breached; drop messaging state
::
=/ =peer-state +.u.ship-state
@ -1999,14 +2004,15 @@
event-core
:: +on-publ-sponsor: handle new or lost sponsor for peer
::
:: TODO: handle sponsor loss
:: TODO: really handle sponsor loss
::
++ on-publ-sponsor
|= [=ship sponsor=(unit ship)]
^+ event-core
::
?~ sponsor
~| %ames-lost-sponsor^our^ship !!
%- (slog leaf+"ames: {(scow %p ship)} lost sponsor, ignoring" ~)
event-core
::
=/ state=(unit peer-state) (get-peer-state ship)
?~ state
@ -2140,10 +2146,27 @@
::
(emit unix-duct.ames-state %give %turf turfs)
:: +on-vega: handle kernel reload
:: +on-trim: handle request to free memory
::
++ on-vega event-core
++ on-trim event-core
:: +on-trim: handle request to free memory
::
:: %ruin comets not seen for six months
::
++ on-trim
^+ event-core
=; rui=(set @p)
(emit duct %pass /ruin %j %ruin rui)
=- (silt (turn - head))
%+ skim
~(tap by peers.ames-state)
|= [=ship s=ship-state]
?. &(?=(%known -.s) =(%pawn (clan:title ship))) %.n
?& (gth (sub now ~d180) last-contact.qos.s)
::
%- ~(any by snd.s)
|= m=message-pump-state
!=(~ unsent-fragments.m)
==
:: +enqueue-alien-todo: helper to enqueue a pending request
::
:: Also requests key and life from Jael on first request.
@ -2232,6 +2255,10 @@
?: for
event-core
(try-next-sponsor sponsor.peer-state)
:: if forwarding, route must not be stale
::
?: &(for (lth last-contact.qos.peer-state (sub now ~h1)))
(try-next-sponsor sponsor.peer-state)
::
?~ route=route.peer-state
%- (trace rot.veb final-ship |.("no route to: {<ship>}"))
@ -2585,12 +2612,12 @@
=(~ unsent-fragments.pum)
=(~ live.packet-pump-state.pum)
==
~> %slog.0^leaf/"ames: bad pump state {<[her.channel i.boz]>}"
~> %slog.0^leaf/"ames: bad pump state {<her.channel i.boz>}"
$(boz t.boz)
:: no outstanding messages, so send a new %cork
::
:: TODO use +trace
~> %slog.0^leaf/"ames: recork {<[her.channel i.boz]>}"
~> %slog.0^leaf/"ames: recork {<her.channel i.boz>}"
=/ =plea [%$ /flow [%cork ~]]
(on-memo i.boz plea %plea)
:: +got-duct: look up $duct by .bone, asserting already bound
@ -2763,11 +2790,18 @@
::
(emit [/ames]~ %pass wire %b %rest next-wake)
=/ nax-bone=^bone (mix 0b10 bone)
=? peer-core (~(has by snd.peer-state) nax-bone)
%. peer-core
%+ trace odd.veb
=/ dat [her.channel bone=nax-bone message-num=message-num -.task]
|.("remove naxplanation flow {<dat>}")
=. peer-state
=, peer-state
%_ peer-state
:: preemptively delete nax flows (e.g. nacks for initial %watches)
::
snd (~(del by (~(del by snd) bone)) nax-bone)
rcv (~(del by rcv) bone)
snd (~(del by snd) bone)
corked (~(put in corked) bone)
closing (~(del in closing) bone)
krocs (~(del in krocs) bone)
@ -3191,9 +3225,14 @@
++ packet-queue
%- (ordered-map live-packet-key live-packet-val)
lte-packets
:: +live-packets: number of sent packets awaiting ack
::
++ live-packets
^- @ud
~(wyt by live.state)
:: +gauge: inflate a |pump-gauge to track congestion control
::
++ gauge (make-pump-gauge now.channel metrics.state [her bug]:channel)
++ gauge (make-pump-gauge metrics.state live-packets [now her bug]:channel)
:: +work: handle $packet-pump-task request
::
++ work
@ -3248,7 +3287,7 @@
=? packet-pump ?=(^ static-fragment)
%- %+ trace snd.veb
=/ nums [message-num fragment-num]:u.static-fragment.res
|.("dead {<nums^show:gauge>}")
|.("dead {<nums show:gauge>}")
(give %send u.static-fragment.res)
packet-pump
::
@ -3307,7 +3346,6 @@
:: update .live and .metrics
::
=. live.state (gas:packet-queue live.state send-list)
=. metrics.state (on-sent:gauge (lent send-list))
:: TMI
::
=> .(sent `(list static-fragment)`sent)
@ -3369,7 +3407,7 @@
=(0 (mod counter.metrics.state 20))
==
same
(trace snd.veb |.("send: {<[fragment=fragment-num show:gauge]>}"))
(trace snd.veb |.("send: {<fragment=fragment-num show:gauge>}"))
:: .resends is backward, so fold backward and emit
::
=. packet-pump
@ -3393,7 +3431,7 @@
==
^- [new-val=(unit live-packet-val) stop=? _acc]
::
=/ gauge (make-pump-gauge now.channel metrics.acc [her bug]:channel)
=/ gauge (make-pump-gauge metrics.acc live-packets [now her bug]:channel)
:: is this the acked packet?
::
?: =(key [message-num fragment-num])
@ -3428,7 +3466,7 @@
=- =. metrics.state metrics.-
=. live.state live.-
::
%- (trace snd.veb |.("done {<message-num=message-num^show:gauge>}"))
%- (trace snd.veb |.("done {<message-num=message-num show:gauge>}"))
(fast-resend-after-ack message-num `fragment-num`0)
::
^+ [metrics=metrics.state live=live.state]
@ -3440,7 +3478,7 @@
==
^- [new-val=(unit live-packet-val) stop=? pump-metrics]
::
=/ gauge (make-pump-gauge now.channel metrics [her bug]:channel)
=/ gauge (make-pump-gauge metrics live-packets [now her bug]:channel)
:: if we get an out-of-order ack for a message, skip until it
::
?: (lth message-num.key message-num)
@ -3488,9 +3526,10 @@
:: +make-pump-gauge: construct |pump-gauge congestion control core
::
++ make-pump-gauge
|= [now=@da pump-metrics =ship =bug]
|= [pump-metrics live-packets=@ud now=@da =ship =bug]
:: TODO rename live-packets num-live
=* veb veb.bug
=* metrics +<+<
=* metrics +<-
|%
++ trace
|= [verb=? print=(trap tape)]
@ -3510,15 +3549,7 @@
::
++ num-slots
^- @ud
(sub-safe cwnd num-live)
:: +on-sent: adjust metrics based on sending .num-sent fresh packets
::
++ on-sent
|= num-sent=@ud
^- pump-metrics
::
=. num-live (add num-live num-sent)
metrics
(sub-safe cwnd live-packets)
:: +on-ack: adjust metrics based on a packet getting acknowledged
::
++ on-ack
@ -3526,7 +3557,6 @@
^- pump-metrics
::
=. counter +(counter)
=. num-live (dec num-live)
:: if below congestion threshold, add 1; else, add avg. 1 / cwnd
::
=. cwnd
@ -3566,7 +3596,7 @@
::
=? cwnd !in-recovery (max 2 (div cwnd 2))
%- %+ trace snd.veb
|.("skip {<[resend=resend in-recovery=in-recovery show]>}")
|.("skip {<resend=resend in-recovery=in-recovery show>}")
metrics
:: +on-timeout: (re)enter slow-start mode on packet loss
::
@ -3592,12 +3622,12 @@
(lth cwnd ssthresh)
:: +in-recovery: %.y iff we're recovering from a skipped packet
::
:: We finish recovering when .num-live finally dips back down to
:: We finish recovering when .live-packets finally dips back down to
:: .cwnd.
::
++ in-recovery
^- ?
(gth num-live cwnd)
(gth live-packets cwnd)
:: +sub-safe: subtract with underflow protection
::
++ sub-safe
@ -3614,7 +3644,7 @@
rttvar=(div rttvar ms)
ssthresh=ssthresh
cwnd=cwnd
num-live=num-live
num-live=live-packets
counter=counter
==
--
@ -3660,7 +3690,7 @@
::
?: (gte seq (add 10 last-acked.state))
%- %+ trace odd.veb
|.("future %hear {<seq=seq^last-acked=last-acked.state>}")
|.("future %hear {<seq=seq last-acked=last-acked.state>}")
message-sink
::
=/ is-last-fragment=? =(+(fragment-num) num-fragments)
@ -3671,7 +3701,7 @@
:: single packet ack
::
%- %+ trace rcv.veb
|.("send dupe ack {<seq=seq^fragment-num=fragment-num>}")
|.("send dupe ack {<seq=seq fragment-num>}")
(give %send seq %& fragment-num)
:: whole message (n)ack
::
@ -3691,8 +3721,8 @@
%- %+ trace rcv.veb
|. ^- tape
=/ data
:* her.channel seq=seq bone=bone
fragment-num=fragment-num num-fragments=num-fragments
:* her.channel seq=seq bone=bone.shut-packet
fragment-num num-fragments
la=last-acked.state lh=last-heard.state
==
"hear last in-progress {<data>}"
@ -3701,8 +3731,8 @@
::
%- %+ trace rcv.veb |.
=/ data
:* seq=seq fragment-num=fragment-num
num-fragments=num-fragments closing=closing
:* seq=seq fragment-num
num-fragments closing=closing
==
"send ack-1 {<data>}"
(give %send seq %& fragment-num)
@ -3732,7 +3762,7 @@
"hear last dupe {<data>}"
message-sink
%- %+ trace rcv.veb
|.("send dupe ack {<her.channel^seq=seq^fragment-num=fragment-num>}")
|.("send dupe ack {<her.channel seq=seq fragment-num>}")
(give %send seq %& fragment-num)
:: new fragment; store in state and check if message is done
::
@ -3749,7 +3779,7 @@
=? message-sink !is-last-fragment
%- %+ trace rcv.veb |.
=/ data
[seq=seq fragment-num=fragment-num num-fragments=num-fragments]
[seq=seq fragment-num num-fragments]
"send ack-2 {<data>}"
(give %send seq %& fragment-num)
:: enqueue all completed messages starting at +(last-heard.state)

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@
$> $? %merg :: merge desks
%perm :: change permissions
%warp :: wait for clay hack
%zest ::
== ::
task:clay ::
== ::
@ -52,10 +53,7 @@
task:dill ::
== ::
$: %g ::
$> $? %jolt ::
%deal ::
== ::
task:gall ::
$>(%deal task:gall) ::
== ::
$: %j ::
$> $? %dawn ::
@ -221,7 +219,7 @@
^+ .
=/ myt (flop (fall tem ~))
=. tem ~
=. ..mere (pass / %g %jolt %base ram)
=. ..mere (pass /zest %c %zest %base %live)
=. ..mere (show-desk %kids)
=. ..mere drum-watch
|- ^+ ..mere
@ -247,14 +245,6 @@
|= des=desk
(pass /show [%c %perm des / r+`[%black ~]])
::
++ kiln-install
|= [loc=desk =ship rem=desk]
(deal /install %poke %kiln-install !>([loc ship rem]))
::
++ kiln-sync
|= [loc=desk =ship rem=desk]
(deal /sync %poke %kiln-sync !>([loc ship rem]))
::
++ take :: receive
|= [tea=wire sih=sign]
^+ +>

View File

@ -551,6 +551,18 @@
(easy ~)
==
==
:: +host-sans-port: strip the :<port> from a host string
::
++ host-sans-port
;~ sfix
%+ cook crip
%- star
;~ less
;~(plug col (punt dem) ;~(less next (easy ~)))
next
==
(star next)
==
:: +per-server-event: per-event server core
::
++ per-server-event
@ -602,6 +614,31 @@
[action [authenticated secure address request] ~ 0]
=. connections.state
(~(put by connections.state) duct connection)
:: redirect to https if insecure, redirects enabled
:: and secure port live
::
?: ?& !secure
redirect.http-config.state
?=(^ secure.ports.state)
==
=/ location=@t
%+ rap 3
:~ 'https://'
(rash (fall host '') host-sans-port)
?: =(443 u.secure.ports.state)
''
(crip ":{(a-co:co u.secure.ports.state)}")
?: ?=([[~ ~] ~] (parse-request-line url.request))
'/'
url.request
==
%- handle-response
:* %start
:- status-code=301
headers=['location' location]~
data=~
complete=%.y
==
:: figure out whether this is a cors request,
:: whether the origin is approved or not,
:: and maybe add it to the "pending approval" set
@ -2272,6 +2309,10 @@
::
%live
=. ports.server-state.ax +.task
:: enable http redirects if https port live and cert set
::
=. redirect.http-config.server-state.ax
&(?=(^ secure.task) ?=(^ secure.http-config.server-state.ax))
[~ http-server-gate]
:: %rule: updates our http configuration
::
@ -2284,6 +2325,10 @@
?: =(secure.config cert.http-rule.task)
[~ http-server-gate]
=. secure.config cert.http-rule.task
=. redirect.config
?& ?=(^ secure.ports.server-state.ax)
?=(^ cert.http-rule.task)
==
:_ http-server-gate
=* out-duct outgoing-duct.server-state.ax
?~ out-duct ~
@ -2534,6 +2579,12 @@
++ load
|= old=axle
^+ ..^$
:: enable https redirects if certificate configured
::
=. redirect.http-config.server-state.old
?& ?=(^ secure.ports.server-state.old)
?=(^ secure.http-config.server-state.old)
==
..^$(ax old)
:: +stay: produce current state
::

View File

@ -42,9 +42,9 @@
:: $move: Arvo-level move
::
+$ move [=duct move=(wind note-arvo gift-arvo)]
:: $state-10: overall gall state, versioned
:: $state-11: overall gall state, versioned
::
+$ state-10 [%10 state]
+$ state-11 [%11 state]
:: $state: overall gall state
::
:: system-duct: TODO document
@ -73,11 +73,11 @@
:: control-duct: TODO document
:: run-nonce: unique for each rebuild
:: sub-nonce: app-wide global %watch nonce
:: live: is this agent running? TODO document boarer
:: stats: TODO document
:: bitt: incoming subscriptions
:: boat: outgoing subscriptions
:: boar: and their nonces
:: code: most recently loaded code
:: agent: agent core
:: beak: compilation source
:: marks: mark conversion requests
@ -86,11 +86,11 @@
$: control-duct=duct
run-nonce=@t
sub-nonce=_1
live=?
=stats
=bitt
=boat
=boar
code=*
agent=(each agent vase)
=beak
marks=(map duct mark)
@ -149,7 +149,7 @@
:: $spore: structures for update, produced by +stay
::
+$ spore
$: %10
$: %11
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
@ -163,223 +163,21 @@
$: control-duct=duct
run-nonce=@t
sub-nonce=@
live=?
=stats
=bitt
=boat
=boar
old-state=(each vase vase)
code=~
old-state=[%| vase]
=beak
marks=(map duct mark)
==
--
:: pupal gall core, on upgrade
::
=< =* adult-gate .
=| spore-tag=@ud
=| =spore
|= [now=@da eny=@uvJ rof=roof]
=* pupal-gate .
=* adult-core (adult-gate +<)
=< |%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
|%
++ molt
|= [=duct fec=(unit move)]
^- [(list move) _adult-gate]
~> %slog.[0 leaf+"gall: molting"]
~< %slog.[0 leaf+"gall: molted"]
:: +molt should never notify its client about agent changes
::
=- :_ ->
%+ welp
(skip -< |=(move ?=([* %give %onto *] +<)))
[^duct %pass /whiz/gall %$ %whiz ~]~
=/ adult adult-core
=. state.adult
[%10 system-duct outstanding contacts yokes=~ blocked bug]:spore
=/ mo-core (mo-abed:mo:adult system-duct.state.adult)
=/ apps=(list [dap=term =egg]) ~(tap by eggs.spore)
:: upgrade %base apps and suspend others
::
=. mo-core
|- ^+ mo-core
?~ apps mo-core
?. =(%base q.beak.egg.i.apps)
~> %slog.[0 leaf+"gall: suspending {<dap.i.apps>}"]
=. old-state.egg.i.apps
=/ old old-state.egg.i.apps
|/?-(-.old %| p.old, %& p.old)
=/ ap-core (ap-abut:ap:mo-core i.apps)
$(apps t.apps, mo-core ap-abet:ap-core)
~> %slog.[0 leaf+"gall: upgrading {<dap.i.apps>}"]
=/ ap-core (ap-abut:ap:mo-core i.apps)
=? ap-core ?=(%& -.old-state.egg.i.apps)
=^ tan ap-core (ap-install:ap-core `p.old-state.egg.i.apps)
?^ tan
(mean u.tan)
ap-core
$(apps t.apps, mo-core ap-abet:ap-core)
=. mo-core (mo-subscribe-to-agent-builds:mo-core now)
=^ moves adult-gate mo-abet:mo-core
=? moves ?=(^ fec) (weld moves [u.fec]~)
[moves adult-gate]
::
++ call
|= [=duct dud=(unit goof) wrapped-task=(hobo task)]
=* call-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
=. state.adult-gate spore(eggs *(map term yoke))
(call:adult-core call-args)
?^ dud
~> %slog.[0 leaf+"gall: pupa call dud"]
(mean >mote.u.dud< tang.u.dud)
=/ task ((harden task:gall) wrapped-task)
?: ?=(%vega -.task)
[~ pupal-gate]
(molt duct `[duct %slip %g task])
::
++ scry scry:adult-core
++ stay spore
++ take
|= [=wire =duct dud=(unit goof) sign=sign-arvo]
=* take-args +<
?: =(~ eggs.spore)
~> %slog.[0 leaf+"gall: direct morphogenesis"]
=. state.adult-gate spore(eggs *(map term yoke))
(take:adult-core take-args)
?^ dud
~> %slog.[0 leaf+"gall: pupa take dud"]
(mean >mote.u.dud< tang.u.dud)
?: =(/sys/lyv wire)
(molt duct ~)
(molt duct `[duct %pass wire %b %huck sign])
::
++ load
|^ |= old=spore-any
=. spore-tag `@ud`-.old
=? old ?=(%7 -.old) (spore-7-to-8 old)
=? old ?=(%8 -.old) (spore-8-to-9 old)
=? old ?=(%9 -.old) (spore-9-to-10 old)
?> ?=(%10 -.old)
=. spore old
?. =(~ eggs.spore)
pupal-gate
~> %slog.[0 leaf+"gall: direct morphogenesis"]
%_ adult-gate
state spore(eggs *(map term yoke))
==
::
+$ spore-any $%(^spore spore-9 spore-8 spore-7)
+$ spore-7
$: %7
wipe-eyre-subs=_| ::NOTE band-aid for #3196
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-7)
blocked=(map term (qeu blocked-move))
==
::
+$ spore-8
$: %8
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
::
+$ egg-7 egg-8
+$ egg-8
$: control-duct=duct
run-nonce=@t
live=?
=stats
watches=watches-8
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
::
+$ watches-8 [inbound=bitt outbound=boat-8]
+$ boat-8 (map [wire ship term] [acked=? =path])
::
+$ spore-9
$: %9
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg)
blocked=(map term (qeu blocked-move))
=bug
==
::
+$ remote-request-9
?(remote-request %cork)
::
++ spore-7-to-8
|= old=spore-7
^- spore-8
:- %8
=. eggs.old
%- ~(urn by eggs.old)
|= [a=term e=egg-7]
::NOTE kiln will kick off appropriate app revival
e(old-state [%| p.old-state.e])
+>.old
::
++ spore-8-to-9
|= old=spore-8
^- spore-9
=- old(- %9, eggs -, blocked [blocked.old *bug])
%- ~(run by eggs.old)
|= =egg-8
^- egg
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
:* control-duct.egg-8
run-nonce.egg-8
sub-nonce=1
live.egg-8
stats.egg-8
bitt boat boar
[old-state beak marks]:egg-8
==
::
++ watches-8-to-9
|= watches-8
^- [bitt boat boar]
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
::
++ spore-9-to-10
|= old=spore-9
=- old(- %10, outstanding -)
%- ~(run by outstanding.old)
|= q=(qeu remote-request-9)
%- ~(gas to *(qeu remote-request))
%+ murn ~(tap to q)
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
--
--
:: adult gall vane interface, for type compatibility with pupa
::
=| state=state-10
=| state=state-11
|= [now=@da eny=@uvJ rof=roof]
=* gall-payload .
=< ~% %gall-wrap ..mo ~
|%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
~% %gall-top ..part ~
|%
:: +mo: Arvo-level move handling
@ -413,27 +211,14 @@
mo-core
=. mo-core (mo-pass i.list)
$(list t.list)
:: +mo-jolt: (re)start agent if not already started on this desk
:: +mo-jolt: (re)start agent
::
++ mo-jolt
|= [dap=term =ship =desk]
^+ mo-core
=/ yak (~(get by yokes.state) dap)
?~ yak
(mo-boot dap ship desk)
?. -.agent.u.yak
(mo-boot dap ship desk)
?. =(desk q.beak.u.yak)
(mo-boot dap ship desk)
mo-core
:: +mo-boot: ask %ford to build us a core for the specified agent.
::
++ mo-boot
|= [dap=term =ship =desk]
^+ mo-core
=/ =case [%da now]
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]/(scot case)
(mo-pass wire %c %warp ship desk ~ %sing %a case /app/[dap]/hoon)
=/ =wire /sys/cor/[dap]/(scot %p ship)/[desk]
..mo-core
:: XX (mo-pass wire %c %jolt dap ship desk)
:: +mo-doff: kill all outgoing subscriptions
::
++ mo-doff
@ -476,17 +261,24 @@
^+ mo-core
::
=/ yak (~(get by yokes.state) dap)
=/ tex
?~ yak "installing"
?- -.agent.u.yak
%& "reloading"
%| "reviving"
=/ tex=(unit tape)
?~ yak `"installing"
?- -.agent.u.yak
%| `"reviving"
%&
?: =(code.u.yak agent)
~
`"reloading"
==
~> %slog.[0 leaf+"gall: {tex} {<dap>}"]
=+ ?~ tex ~
~> %slog.[0 leaf+"gall: {u.tex} {<dap>}"] ~
::
?^ yak
?: &(=(q.beak.u.yak q.bek) =(code.u.yak agent) =(-.agent.u.yak &))
mo-core
::
=. yokes.state
(~(put by yokes.state) dap u.yak(beak bek))
(~(put by yokes.state) dap u.yak(beak bek, code agent))
=/ ap-core (ap-abed:ap dap `our)
=. ap-core (ap-reinstall:ap-core agent)
=. mo-core ap-abet:ap-core
@ -497,6 +289,7 @@
%* . *yoke
control-duct hen
beak bek
code agent
agent &+agent
run-nonce (scot %uw (end 5 (shas %yoke-nonce eny)))
==
@ -516,60 +309,6 @@
=. mo-core (mo-clear-queue dap)
=/ =suss [dap %boot now]
(mo-give %onto [%.y suss])
:: +mo-subscribe-to-agent-builds: request agent update notices
::
:: Also subscribe to our own source path, in case we get reloaded
:: but none of the agents do. This way, Clay will still notify us,
:: and we'll be able to exit the chrysalis.
::
++ mo-subscribe-to-agent-builds
|= date=@da
^+ mo-core
=. mo-core (mo-abed system-duct.state)
::
=/ sources=(jug desk [care:clay path])
%+ ~(put by *(jug desk [care:clay path])) %base
%- sy
:~ [%z /sys/hoon/hoon]
[%z /sys/arvo/hoon]
[%z /sys/lull/hoon]
[%z /sys/zuse/hoon]
[%z /sys/vane/gall/hoon]
[%z /sys/kelvin]
==
::
=. sources
=/ apps=(list [dap=term =yoke]) ~(tap by yokes.state)
|- ^+ sources
?~ apps
sources
=? sources ?=(%& -.agent.yoke.i.apps)
(~(put ju sources) q.beak.yoke.i.apps %a /app/[dap.i.apps]/hoon)
$(apps t.apps)
::
%- mo-past
%- zing
%+ turn ~(tap by sources)
|= [=desk paths=(set [care:clay path])]
:~ [/sys/lyv %c %warp our desk ~]
[/sys/lyv %c %warp our desk ~ %mult da+date paths]
==
:: +mo-scry-agent-cage: read $agent core from clay
::
++ mo-scry-agent-cage
|= [dap=term =desk =case:clay]
^- (each agent tang)
=/ bek=beak [our desk case]
=/ sky (rof ~ %ca bek /app/[dap]/hoon)
?~ sky |+[leaf+"gall: {<dap>} scry blocked"]~
?~ u.sky |+[leaf+"gall: {<dap>} scry failed"]~
=/ =cage u.u.sky
?. =(%vase p.cage)
|+[leaf+"gall: bad mark {<p.cage>} for agent {<dap>}"]~
=/ res (mule |.(!<(agent !<(vase q.cage))))
?: ?=(%& -.res)
&+p.res
|+[[leaf+"gall: {<dap>} not valid agent"] p.res]
:: +mo-send-foreign-request: handle local request to .ship
::
++ mo-send-foreign-request
@ -676,9 +415,9 @@
^+ mo-core
::
?+ -.wire !!
%lyv (mo-handle-sys-lyv wire sign-arvo)
%lyv ..mo-core :: vestigial
%cor ..mo-core :: vestigial
%era (mo-handle-sys-era wire sign-arvo)
%cor (mo-handle-sys-cor wire sign-arvo)
%lag (mo-handle-sys-lag wire sign-arvo)
%req (mo-handle-sys-req wire sign-arvo)
%way (mo-handle-sys-way wire sign-arvo)
@ -693,60 +432,6 @@
?. ?=(%breach -.public-keys-result.sign-arvo)
mo-core
(mo-breach who.public-keys-result.sign-arvo)
:: +mo-handle-sys-cor: receive a built agent from %clay
::
++ mo-handle-sys-cor
|= [=wire =sign-arvo]
^+ mo-core
::
?> ?=([%cor @ @ @ @ ~] wire)
=/ [dap=term her=@ta desk=@ta dat=@ta ~] t.wire
=/ =beak [(slav %p her) desk da+now]
?> ?=([?(%behn %clay) %writ *] sign-arvo)
?~ p.sign-arvo
(mean leaf+"gall: failed to build agent {<dap>}" ~)
=/ cag=cage r.u.p.sign-arvo
?. =(%vase p.cag)
(mean leaf+"gall: bad %writ {<p.cag>} for {<dap>}" ~)
=/ res (mule |.(!<(agent !<(vase q.cag))))
?: ?=(%| -.res)
(mean leaf+["gall: bad agent {<dap>}"] p.res)
=. mo-core (mo-receive-core dap beak p.res)
(mo-subscribe-to-agent-builds now)
:: +mo-handle-sys-lyv: handle notice that agents have been rebuilt
::
++ mo-handle-sys-lyv
|= [=wire =sign-arvo]
^+ mo-core
?> ?=([%lyv ~] wire)
?> ?=([?(%behn %clay) %wris *] sign-arvo)
=/ nex=(list [=care:clay =path]) ~(tap in q.sign-arvo)
~> %slog.[0 leaf+"gall: reloading agents"]
~< %slog.[0 leaf+"gall: reloaded agents"]
=; cor (mo-subscribe-to-agent-builds:cor now)
%+ roll nex
|= [[=care:clay =path] cor=_mo-core]
^+ cor
:: We throw away %z results because we only have them to guarantee
:: molting. Clay will tell us if e.g. changing hoon.hoon affects
:: the result of a particular app (usually it will).
::
?. =(%a care)
cor
~| path=path
=/ dap dap:;;([%app dap=@tas %hoon ~] path)
=/ yok=(unit yoke) (~(get by yokes.state) dap)
?~ yok
~> %slog.[0 leaf+"gall: no agent to reload: {<dap>}"]
cor
?: ?=(%| -.agent.u.yok)
~> %slog.[0 leaf+"gall: dead agent reload: {<dap>}"]
cor
=/ bek=beak [our q.beak.u.yok da+now]
=/ rag (mo-scry-agent-cage dap q.bek da+now)
?: ?=(%| -.rag)
(mean p.rag)
(mo-receive-core:cor dap bek p.rag)
:: +mo-handle-sys-lag: handle an ames %clog notification
::
++ mo-handle-sys-lag
@ -838,6 +523,11 @@
?~ error=error.sign-arvo
~
`[[%leaf (trip tag.u.error)] tang.u.error]
:: send a %cork if we get a nack upon initial subscription
::
=? mo-core
&(?=(^ err) |(?=(%watch-as remote-request) ?=(%watch remote-request)))
(mo-pass [%sys wire] %a %cork ship)
::
?- remote-request
%watch-as (mo-give %unto %watch-ack err)
@ -900,14 +590,6 @@
?. =(run-nonce.u.yoke i.t.wire)
%- (slog leaf+"gall: got old {<+<.sign-arvo>} for {<dap>}" ~)
mo-core
:: if agent must be running, revive all needed agents then apply
::
?: ?& ?=(%| -.agent.u.yoke)
?=(?(%dojo %hood) dap)
==
=. mo-core (mo-pass /nowhere %g %jolt %base %hood)
=. mo-core (mo-pass /nowhere %g %jolt %base %dojo)
(mo-pass use+wire %b %huck sign-arvo)
::
?. ?=([?(%gall %behn) %unto *] sign-arvo)
?: ?=(%| -.agent.u.yoke)
@ -1004,15 +686,36 @@
~> %slog.0^leaf/"gall: nuking {<dap>}"
=. mo-core ap-abet:ap-nuke:(ap-abed:ap dap `our)
mo-core(yokes.state (~(del by yokes.state) dap))
:: +mo-load: install agents
::
++ mo-load
|= agents=(list [=dude =beak =agent])
=. mo-core
|- ^+ mo-core
?~ agents mo-core
=/ [=dude =desk] [dude q.beak]:i.agents
:: ~> %slog.0^leaf/"gall: starting {<dude>} on {<desk>}"
$(agents t.agents, mo-core (mo-receive-core i.agents))
::
=/ kil
=/ lol (skim ~(tap by yokes.state) |=([term yoke] -.agent))
=/ mol (~(gas by *(map term yoke)) lol)
=/ sol ~(key by mol)
=/ new (silt (turn agents head))
~(tap in (~(dif in sol) new))
|- ^+ mo-core
?~ kil mo-core
~> %slog.0^leaf/"gall: stopping {<i.kil>}"
$(kil t.kil, mo-core (mo-idle i.kil))
:: +mo-peek: call to +ap-peek (which is not accessible outside of +mo).
::
++ mo-peek
~/ %mo-peek
|= [dap=term =routes care=term =path]
|= [veb=? dap=term =routes care=term =path]
^- (unit (unit cage))
::
=/ app (ap-abed:ap dap routes)
(ap-peek:app care path)
(ap-peek:app veb care path)
::
++ mo-apply
|= [dap=term =routes =deal]
@ -1089,12 +792,6 @@
::
?. |(!is-running is-blocked)
(mo-apply agent routes deal)
:: if agent must be running, revive all needed agents then apply
::
?: ?=(?(%hood %dojo) agent)
=. mo-core (mo-pass /nowhere %g %jolt %base %hood)
=. mo-core (mo-pass /nowhere %g %jolt %base %dojo)
(mo-slip %g %deal [ship our] agent deal)
::
=/ blocked=(qeu blocked-move)
=/ waiting (~(get by blocked.state) agent)
@ -1186,19 +883,6 @@
|= [dap=term =routes]
^+ ap-core
(ap-yoke dap routes (~(got by yokes.state) dap))
:: +ap-hatch: initialize agent state from $egg, after upgrade
::
++ ap-abut
|= [dap=term =egg]
^+ ap-core
=/ yak=^yoke
?: ?=(%| -.old-state.egg)
egg
=/ res (mo-scry-agent-cage dap q.beak.egg da+now)
?: ?=(%| -.res)
(mean p.res)
egg(p.old-state `agent`p.res)
(ap-yoke dap `our yak)
:: +ap-yoke: initialize agent state, starting from a $yoke
::
++ ap-yoke
@ -1240,7 +924,7 @@
%+ turn ~(tap by bitt.yoke)
|= [=duct =ship =path]
path
=/ will=(list card:agent:gall)
=/ will=(list card:agent)
%+ welp
?: =(~ inbound-paths)
~
@ -1443,7 +1127,7 @@
::
++ ap-peek
~/ %ap-peek
|= [care=term tyl=path]
|= [veb=? care=term tyl=path]
^- (unit (unit cage))
:: take trailing mark off path for %x scrys
::
@ -1456,6 +1140,7 @@
=/ peek-result=(each (unit (unit cage)) tang)
(ap-mule-peek |.((on-peek:ap-agent-core [care tyl])))
?: ?=(%| -.peek-result)
?. veb [~ ~]
((slog leaf+"peek bad result" p.peek-result) [~ ~])
:: for non-%x scries, or failed %x scries, or %x results that already
:: have the requested mark, produce the result as-is
@ -2053,6 +1738,7 @@
%sear mo-abet:(mo-filter-queue:mo-core ship.task)
%jolt mo-abet:(mo-jolt:mo-core dude.task our desk.task)
%idle mo-abet:(mo-idle:mo-core dude.task)
%load mo-abet:(mo-load:mo-core +.task)
%nuke mo-abet:(mo-nuke:mo-core dude.task)
%doff mo-abet:(mo-doff:mo-core +.task)
%rake mo-abet:(mo-rake:mo-core +.task)
@ -2063,7 +1749,141 @@
==
:: +load: recreate vane; note, only valid if called from pupa
::
++ load !!
++ load
|^ |= old=spore-any
=? old ?=(%7 -.old) (spore-7-to-8 old)
=? old ?=(%8 -.old) (spore-8-to-9 old)
=? old ?=(%9 -.old) (spore-9-to-10 old)
=? old ?=(%10 -.old) (spore-10-to-11 old)
?> ?=(%11 -.old)
gall-payload(state old)
::
+$ spore-any $%(spore spore-7 spore-8 spore-9 spore-10)
+$ spore-10
$: %10
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
=bug
==
+$ egg-10
$: control-duct=duct
run-nonce=@t
sub-nonce=@
live=?
=stats
=bitt
=boat
=boar
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
+$ spore-9
$: %9
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-10)
blocked=(map term (qeu blocked-move))
=bug
==
::
+$ remote-request-9 ?(remote-request %cork)
::
+$ spore-8
$: %8
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
+$ egg-8
$: control-duct=duct
run-nonce=@t
live=?
=stats
watches=watches-8
old-state=(each vase vase)
=beak
marks=(map duct mark)
==
+$ watches-8 [inbound=bitt outbound=boat-8]
+$ boat-8 (map [wire ship term] [acked=? =path])
+$ spore-7
$: %7
wipe-eyre-subs=_| ::NOTE band-aid for #3196
system-duct=duct
outstanding=(map [wire duct] (qeu remote-request-9))
contacts=(set ship)
eggs=(map term egg-8)
blocked=(map term (qeu blocked-move))
==
::
++ spore-7-to-8
|= old=spore-7
^- spore-8
:- %8
=. eggs.old
%- ~(urn by eggs.old)
|= [a=term e=egg-8]
:: kiln will kick off appropriate app revival
::
e(old-state [%| p.old-state.e])
+>.old
::
++ spore-8-to-9
|= old=spore-8
^- spore-9
=- old(- %9, eggs -, blocked [blocked.old *bug])
%- ~(run by eggs.old)
|= =egg-8
^- egg-10
=/ [=bitt =boat =boar] (watches-8-to-9 watches.egg-8)
:* control-duct.egg-8
run-nonce.egg-8
sub-nonce=1
live.egg-8
stats.egg-8
bitt boat boar
[old-state beak marks]:egg-8
==
::
++ watches-8-to-9
|= watches-8
^- [bitt boat boar]
[inbound outbound (~(run by outbound) |=([acked=? =path] nonce=0))]
::
:: remove %cork
::
++ spore-9-to-10
|= old=spore-9
=- old(- %10, outstanding -)
%- ~(run by outstanding.old)
|= q=(qeu remote-request-9)
%- ~(gas to *(qeu remote-request))
%+ murn ~(tap to q)
|=(r=remote-request-9 ?:(?=(%cork r) ~ `r))
::
:: removed live
:: changed old-state from (each vase vase) to [%| vase]
:: added code
::
++ spore-10-to-11
|= old=spore-10
^- spore
%= old
- %11
eggs
%- ~(urn by eggs.old)
|= [a=term e=egg-10]
^- egg
e(|3 |4.e(|4 `|8.e(old-state [%| p.old-state.e])))
==
--
:: +scry: standard scry
::
++ scry
@ -2085,8 +1905,16 @@
(sort ~(tap by queued) aor)
::
=/ running
=/ active (~(run by yokes.state) |=(yoke [%.y +<]))
(sort ~(tap by active) aor)
%+ turn (sort ~(tap by yokes.state) aor)
|= [dap=term =yoke]
^- mass
=/ met=(list mass)
=/ dat (mo-peek:mo | dap [~ ship] %x /whey/mass)
?: ?=(?(~ [~ ~]) dat) ~
(fall ((soft (list mass)) q.q.u.u.dat) ~)
?~ met
dap^&+yoke
dap^|+(welp met dot+&+yoke ~)
::
=/ maz=(list mass)
:~ [%foreign %.y contacts.state]
@ -2160,7 +1988,7 @@
?. ?=(^ path)
~
=/ =routes [~ ship]
(mo-peek:mo dap routes care path)
(mo-peek:mo & dap routes care path)
:: +stay: save without cache; suspend non-%base agents
::
:: TODO: superfluous? see +molt
@ -2172,12 +2000,12 @@
|= =yoke
^- egg
%= yoke
code ~
agent
:- %|
?: ?=(%| -.agent.yoke)
[%| p.agent.yoke]
?: =(%base q.beak.yoke)
[%& on-save:p.agent.yoke]
[%| on-save:p.agent.yoke]
p.agent.yoke
on-save:p.agent.yoke
==
:: +take: response
::

View File

@ -462,12 +462,12 @@
:: [%vega ~]
::
%vega
+>.$::
+>.$
::
:: in response to memory pressure
:: [%trim p=@ud]
::
%trim
::TODO consider %ruin-ing long-offline comets
+>.$
::
:: watch private keys
@ -736,12 +736,10 @@
++ subscribers-on-ship
|= =ship
^- (set duct)
=/ specific-subs (~(get ju ney.zim) ship)
=/ general-subs=(set duct)
?: ?=(?(%czar %king %duke) (clan:title ship))
nel.zim
~
(~(uni in specific-subs) general-subs)
:: union of general and ship-specific subs
::
%- ~(uni in nel.zim)
(~(get ju ney.zim) ship)
::
++ feed
|_ :: hen: subscription source
@ -997,7 +995,7 @@
=| lex=state-2
|= $: :: now: current time
:: eny: unique entropy
:: ski: namespace resolver
:: rof: namespace resolver
::
now=@da
eny=@uvJ

View File

@ -102,15 +102,15 @@
=/ =beam (need (de-beam t.wire))
?>(?=([@ ~] s.beam) beam(s i.s.beam))
::
++ start-spider
|= =vase
^- note
[%g %deal [our our] %spider %poke %spider-start vase]
++ poke-spider
|= [hen=duct =cage]
^- move
[hen %pass //g %g %deal [our our] %spider %poke cage]
::
++ watch-spider
|= =path
^- note
[%g %deal [our our] %spider %watch path]
|= [hen=duct =path]
^- move
[hen %pass //g %g %deal [our our] %spider %watch path]
--
=| khan-state
=* state -
@ -134,22 +134,8 @@
%born
[~ khan-gate(hey hen, tic 0)]
::
%fard
=/ tid=@ta
%^ cat 3
'khan-fyrd--'
(scot %uv (sham (mix tic eny)))
=. tic +(tic)
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
=/ args [~ `tid beak name.fyd q.args.fyd]
:_ khan-gate
%+ turn
:~ (watch-spider /thread-result/[tid])
(start-spider !>(args))
==
|=(=note ^-(move [hen %pass //g note]))
::
%fard (bard hen 'khan-fyrd--' bear.p.task %| [name args]:p.task)
%lard (bard hen 'khan-lard--' bear.task %& shed.task)
%fyrd
=* fyd p.task
=/ =beak (get-beak bear.fyd now)
@ -160,6 +146,23 @@
=- [[hen %pass wire -]~ khan-gate]
[%k %fard bear.fyd name.fyd p.q.args.fyd vase]
==
::
++ bard
|= [hen=duct prefix=@ta =bear payload=(each shed [name=term args=cage])]
^- [(list move) _khan-gate]
=/ =tid:rand (cat 3 prefix (scot %uv (sham (mix tic eny))))
=/ =beak (get-beak bear now)
=/ =cage
?- -.payload
%& [%spider-inline !>([~ `tid beak p.payload])]
%| [%spider-start !>([~ `tid beak [name q.args]:p.payload])]
==
=. tic +(tic)
:_ khan-gate
:~ (watch-spider hen /thread-result/[tid])
(poke-spider hen cage)
==
::
:: +load: migrate an old state to a new khan version
::
++ load
@ -195,7 +198,7 @@
?+ p.cag ~&(bad-fact+p.cag !!)
%thread-fail
=/ =tang !<(tang q.cag)
%- (slog 'khan-fact' tang)
:: %- (slog 'khan-fact' tang)
[hen %give %arow %| p.cag tang]~
::
%thread-done

View File

@ -4,7 +4,7 @@
=> ..lull
~% %zuse ..part ~
|%
++ zuse %418
++ zuse %417
:: :: ::
:::: :: :: (2) engines
:: :: ::

View File

@ -33,10 +33,6 @@
naive,
naive-tx=naive-transactions,
*strandio
:: starting snapshot. this may not be the right starting point once we have
:: clay tombstoning and the snapshot may be updated
::
/* snap %azimuth-snapshot /app/azimuth/version-0/azimuth-snapshot
::
=, strand=strand:spider
=, jael
@ -103,7 +99,11 @@
;< =events bind:m (scry events /gx/azimuth/logs/noun)
=/ [naive-contract=address chain-id=@]
[naive chain-id]:(get-network:dice net)
=/ snap=snap-state:dice snap
;< =bowl:spider bind:m get-bowl
=/ snap=snap-state:dice
.^ snap-state:dice %gx
/(scot %p our.bowl)/azimuth/(scot %da now.bowl)/last-snap/noun
==
::
;< ~ bind:m
%- flog-text %+ weld "naive-csv: processing {<net>} ethereum logs "

View File

@ -44,10 +44,6 @@
%+ turn ~(tap by paths-to-tests)
|= [=path test-arms=(list test-arm)]
^- (list test)
:: strip off leading 'tests' from :path
::
?. ?=([%tests *] path) ~
=/ path t.path ::NOTE TMI
:: for each test, add the test's name to :path
::
%+ turn test-arms

View File

@ -739,19 +739,19 @@
++ gen-rut-jar
^~ ^- (jar @p event)
=/ filter ;: cork
(cury filter-owner %.y)
::(cury filter-owner %.y)
::(cury filter-proxy %spawn)
(cury filter-nonce %.y)
::(cury filter-nonce %.y)
::(cury filter-rank %galaxy)
::(cury filter-dominion %l1)
%- cury
:- filter-tx-type
:* ::%spawn
::%transfer-point
:* %spawn
%transfer-point
%configure-keys
::%set-management-proxy
::%set-spawn-proxy
::%set-transfer-proxy
%set-management-proxy
%set-spawn-proxy
%set-transfer-proxy
~
==
==

View File

@ -1,21 +1,33 @@
:: Test that these hints do not crash the runtime
:: there is no need to include the hints for dynamic %bout
:: there is no need to include a test for dynamic %bout
:: since all hoon tests exersize dynamic %bout
|%
:: these test that the hilt-trace hints
:: test that these trace hints
:: are safe to run or ignore
++ test-hela-hilt
++ test-hilt-hela
~> %hela
~
++ test-nara-hilt
++ test-hint-hela
~> %hela.[1 leaf+"test-hint-hela ~"]
~
++ test-hilt-nara
~> %nara
~
:: these test that the hint-trace hints
:: are safe to run or ignore
++ test-hela-hint
~> %hela.[1 leaf+"test-hela-trace-hint"]
++ test-hint-nara
~> %nara.[1 leaf+"test-hint-nara ~"]
~
++ test-nara-hint
~> %nara.[1 leaf+"test-nara-trace-hint"]
:: test that theses bytecode-report hints
:: are safe to run or ignore
++ test-hilt-xray
~> %xray
~
++ test-hint-xray
~> %xray.[1 leaf+"test-hint-xray ~"]
~
:: test that the hilt bout hint
:: is safe to run or ignore
++ test-hilt-bout
~> %bout
~
--

File diff suppressed because it is too large Load Diff

View File

@ -251,17 +251,19 @@
!> shut-packet
!> decoded
::
++ test-shut-packet-associated-data ^- tang
::
=/ =shut-packet:ames
:+ bone=17 message-num=18
[%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
::
=/ =packet:ames
(encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
::
%- expect-fail
|.((decode-shut-packet:ames packet nec-sym 3 17))
:: Crypto failures are now non-deterministic
::
:: ++ test-shut-packet-associated-data ^- tang
:: ::
:: =/ =shut-packet:ames
:: :+ bone=17 message-num=18
:: [%& num-fragments=1 fragment-num=1 fragment=`@`0xdead.beef]
:: ::
:: =/ =packet:ames
:: (encode-shut-packet:ames shut-packet nec-sym ~marnec ~marbud-marbud 3 1)
:: ::
:: %- expect-fail
:: |.((decode-shut-packet:ames packet nec-sym 3 17))
::
++ test-alien-encounter ^- tang
::

View File

@ -22,32 +22,6 @@
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
:: +test-jolt: test %jolt; TODO: test clay response
::
++ test-jolt
^- tang
::
=/ =duct ~[/init]
=/ time (add ~1111.1.1 ~s1)
=/ dap=term %my-agent
=/ ship ~nec
::
=/ call-args
=/ =task:gall [%jolt %base dap]
[duct task]
::
=/ =move:gall-gate
=/ =wire /sys/cor/[dap]/(scot %p ship)/base/(scot %da time)
=/ =note-arvo
[%c %warp ship %base ~ %sing %a da+time /app/[dap]/hoon]
[duct %pass wire note-arvo]
::
=/ expected-moves=(list move:gall-gate) ~[move]
::
=/ res
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
:: +gall-call: have %gall run a +task and assert it produces expected-moves
::
++ gall-call

View File

@ -85,6 +85,9 @@
?:(?=(%sing genre) [genre mood] [genre mood])
(warp-our q.byk.bowl `rave)
::
++ tire
(arvo %c %tire `~)
::
++ connect
|= [=binding:eyre app=term]
(arvo %e %connect binding app)

View File

@ -143,6 +143,7 @@
|= a=@
^- hexb
=/ l=@ (met 3 a)
?: =(l 0) 1^a
?: =(l 1) 1^a
?: =(l 2) (cat:byt ~[1^0xfd (flip:byt 2^a)])
?: (lte l 4) (cat:byt ~[1^0xfe (flip:byt 4^a)])
@ -162,7 +163,7 @@
%0xfe 2
%0xff 3
==
:_ (drop:byt (add 1 len) h)
:_ (drop:byt (add 1 (bex len)) h)
%- flip:byt
(take:byt (bex len) (drop:byt 1 h))
:: +dea: atom instead of hexb for parsed CompactSize

View File

@ -3,7 +3,8 @@
::
=/ debug |
|%
+* option [item]
++ option
|$ [item]
[term=cord detail=item]
::
:: Like +rose except also produces line number

View File

@ -38,41 +38,17 @@
::
:: Canonical textual representation
::
++ tako-to-text
|= [=tako:clay]
^- tape
"commit: {<`@uv`tako>}\0a"
::
++ proses-to-text
|= [=proses]
^- tape
=/ proses-list=(list prose) ~(tap in proses)
?: ?=(~ proses-list) ""
?: ?=([prose ~] proses-list)
(prose-to-text i.proses-list)
%- tail
%^ spin `(list prose)`t.proses-list
(prose-to-text i.proses-list)
|= [prz=prose state=tape]
^- [prose tape]
:- prz
;: welp
state
"|||"
"\0a"
(prose-to-text prz)
==
::
++ prose-to-text
|= prz=prose
=/ [title=@t body=@t] prz
^- tape
;: welp
"{(trip title)}"
"\0a\0a"
"{(trip body)}"
"\0a"
==
++ chapter-to-text
|= [=tako:clay =proses]
^- wain
:- (crip "commit: {<`@uv`tako>}")
%- zing
%+ join `wain`~['|||']
%+ turn ~(tap in proses)
|= prose
^- wain
%- to-wain:format
(rap 3 title '\0a\0a' body ~)
::
:: Parsers
::

View File

@ -1,188 +1 @@
|%
+$ card card:agent:gall
+$ input
$% [%poke =cage]
[%sign =wire =sign-arvo]
[%agent =wire =sign:agent:gall]
[%watch =path]
==
+$ strand-input [=bowl in=(unit input)]
+$ tid @tatid
+$ bowl
$: our=ship
src=ship
tid=tid
mom=(unit tid)
wex=boat:gall
sup=bitt:gall
eny=@uvJ
now=@da
byk=beak
==
::
:: cards: cards to send immediately. These will go out even if a
:: later stage of the computation fails, so they shouldn't have
:: any semantic effect on the rest of the system.
:: Alternately, they may record an entry in contracts with
:: enough information to undo the effect if the computation
:: fails.
:: wait: don't move on, stay here. The next sign should come back
:: to this same callback.
:: skip: didn't expect this input; drop it down to be handled
:: elsewhere
:: cont: continue computation with new callback.
:: fail: abort computation; don't send effects
:: done: finish computation; send effects
::
++ strand-output-raw
|* a=mold
$~ [~ %done *a]
$: cards=(list card)
$= next
$% [%wait ~]
[%skip ~]
[%cont self=(strand-form-raw a)]
[%fail err=(pair term tang)]
[%done value=a]
==
==
::
++ strand-form-raw
|* a=mold
$-(strand-input (strand-output-raw a))
::
:: Abort strand computation with error message
::
++ strand-fail
|= err=(pair term tang)
|= strand-input
[~ %fail err]
::
:: Asynchronous transcaction monad.
::
:: Combo of four monads:
:: - Reader on input
:: - Writer on card
:: - Continuation
:: - Exception
::
++ strand
|* a=mold
|%
++ output (strand-output-raw a)
::
:: Type of an strand computation.
::
++ form (strand-form-raw a)
::
:: Monadic pure. Identity computation for bind.
::
++ pure
|= arg=a
^- form
|= strand-input
[~ %done arg]
::
:: Monadic bind. Combines two computations, associatively.
::
++ bind
|* b=mold
|= [m-b=(strand-form-raw b) fun=$-(b form)]
^- form
|= input=strand-input
=/ b-res=(strand-output-raw b)
(m-b input)
^- output
:- cards.b-res
?- -.next.b-res
%wait [%wait ~]
%skip [%skip ~]
%cont [%cont ..$(m-b self.next.b-res)]
%fail [%fail err.next.b-res]
%done [%cont (fun value.next.b-res)]
==
::
:: The strand monad must be evaluted in a particular way to maintain
:: its monadic character. +take:eval implements this.
::
++ eval
|%
:: Indelible state of a strand
::
+$ eval-form
$: =form
==
::
:: Convert initial form to eval-form
::
++ from-form
|= =form
^- eval-form
form
::
:: The cases of results of +take
::
+$ eval-result
$% [%next ~]
[%fail err=(pair term tang)]
[%done value=a]
==
::
++ validate-mark
|= [in=* =mark =bowl]
^- cage
=+ .^ =dais:clay %cb
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[mark]
==
=/ res (mule |.((vale.dais in)))
?: ?=(%| -.res)
~|(%spider-mark-fail (mean leaf+"spider: ames vale fail {<mark>}" p.res))
[mark p.res]
::
:: Take a new sign and run the strand against it
::
++ take
:: cards: accumulate throughout recursion the cards to be
:: produced now
=| cards=(list card)
|= [=eval-form =strand-input]
^- [[(list card) =eval-result] _eval-form]
=* take-loop $
=. in.strand-input
?~ in.strand-input ~
=/ in u.in.strand-input
?. ?=(%agent -.in) `in
?. ?=(%fact -.sign.in) `in
::
:- ~
:+ %agent wire.in
[%fact (validate-mark q.q.cage.sign.in p.cage.sign.in bowl.strand-input)]
:: run the strand callback
::
=/ =output (form.eval-form strand-input)
:: add cards to cards
::
=. cards
%+ welp
cards
:: XX add tag to wires?
cards.output
:: case-wise handle next steps
::
?- -.next.output
%wait [[cards %next ~] eval-form]
%skip [[cards %next ~] eval-form]
%fail [[cards %fail err.next.output] eval-form]
%done [[cards %done value.next.output] eval-form]
%cont
:: recurse to run continuation with initialization input
::
%_ take-loop
form.eval-form self.next.output
strand-input [bowl.strand-input ~]
==
==
--
--
--
::
rand

View File

@ -50,9 +50,11 @@
%& ~
%| ['expected success - failed' p.b]
==
:: $test-chain: a sequence of tests to be run
:: $a-test-chain: a sequence of tests to be run
::
+$ test-chain
:: NB: arms shouldn't start with `test-` so that `-test % ~` runs
::
+$ a-test-chain
$_
|?
?: =(0 0)
@ -61,7 +63,7 @@
:: +run-chain: run a sequence of tests, stopping at first failure
::
++ run-chain
|= seq=test-chain
|= seq=a-test-chain
^- tang
=/ res $:seq
?- -.res

View File

@ -1,18 +1,28 @@
=/ weft ,[lal=@tas num=@ud] :: TODO remove after merge
|_ kel=weft
|_ kal=waft:clay
++ grow
|%
++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)]
++ noun kel
++ hoon (crip "{<[lal num]:kel>}\0a")
++ noun kal
++ hoon
%+ rap 3
%+ turn
%+ sort
~(tap in (waft-to-wefts:clay kal))
|= [a=weft b=weft]
?: =(lal.a lal.b)
(gte num.a num.b)
(gte lal.a lal.b)
|= =weft
(rap 3 '[%' (scot %tas lal.weft) ' ' (scot %ud num.weft) ']\0a' ~)
::
++ txt (to-wain:format hoon)
--
++ grab
|%
++ noun weft
++ noun waft:clay
++ mime
|= [=mite len=@ud tex=@]
!<(weft (slap !>(~) (ream tex)))
(cord-to-waft:clay tex)
--
++ grad %noun
--

View File

@ -46,18 +46,13 @@
[/text/x-urb-story (as-octs:mimes:html (of-wain:format txt))]
++ txt
^- wain
%- snoc :_ '' :: ensures terminating newline is present
%- zing
%+ join `wain`~['---']
%+ murn ~(tap by tale)
|= [[=tako:clay =proses]]
^- (unit cord)
|= [=tako:clay =proses]
^- (unit wain)
?~ proses ~
%- some
%- crip
;: welp
(tako-to-text tako)
(proses-to-text proses)
"---"
==
(some (chapter-to-text tako proses))
--
++ grab
|% :: convert from

View File

@ -1,147 +1,125 @@
=, clay
=* dude dude:gall
|%
:: $snap: kiln snapshot
::
+$ snap (map desk arak)
:: $diff: subscription update
::
+$ diff
$% [%block =desk =arak =weft blockers=(set desk)]
[%reset =desk =arak]
[%commit =desk =arak]
[%merge-sunk =desk =arak =tang]
[%merge-fail =desk =arak =tang]
[%suspend =desk =arak]
[%revive =desk =arak]
+$ pike
$: sync=(unit [=ship =desk])
hash=@uv
=zest
wic=(set weft)
==
:: $arak: foreign vat tracker
::
:: .rail: upstream tracking state, if any
:: .rein: configuration for agents
+$ pikes (map desk pike)
::
+$ arak
$: rail=(unit rail)
=rein
==
:: $rail: upstream tracking state
::
:: .publisher: Ship that originally published desk, if available
:: .paused: is tracking paused? or live
:: .ship: upstream ship (could be .our)
:: .desk: name of upstream desk
:: .aeon: next aeon to pull from upstream
:: .next: list of pending commits with future kelvins
::
+$ rail
$: publisher=(unit ship)
paused=?
=ship
=desk
=aeon
next=(list rung)
==
:: $rung: reference to upstream commit
::
+$ rung [=aeon =weft]
:: $rein: diff from desk manifest
::
:: .liv: suspended? if suspended, no agents should run
:: .add: agents not in manifest that should be running
:: .sub: agents in manifest that should not be running
+$ sync-state [nun=@ta kid=(unit desk) let=@ud]
+$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
:: +report-prep: get data required for reports
::
+$ rein
$: liv=_&
add=(set dude)
sub=(set dude)
++ report-prep
|= [our=@p now=@da]
=/ ego (scot %p our)
=/ wen (scot %da now)
:* .^(rock:tire %cx /(scot %p our)//(scot %da now)/tire)
.^(=cone %cx /(scot %p our)//(scot %da now)/domes)
.^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun)
.^ (map [desk ship desk] sync-state) %gx
/[ego]/hood/[wen]/kiln/syncs/noun
==
==
::
+$ vat [=desk hash=@uv =cass =arak]
:: +report-vats: report on all desk installations
::
++ report-vats
|= [our=@p now=@da]
^- tang
=+ .^ raz=(list vat)
%gx /(scot %p our)/hood/(scot %da now)/kiln/vats/noun
==
:- (report-kids our now)
(turn raz |=(v=vat (report-vat our now v)))
=/ desks .^((set desk) %cd /(scot %p our)/base/(scot %da now))
=/ prep (report-prep our now)
%+ turn ~(tap in desks)
|=(syd=desk (report-vat prep our now syd))
:: +report-vat: report on a single desk installation
::
++ report-vat
|= [our=ship now=@da vat]
|= $: $: tyr=rock:tire =cone sor=(map desk [ship desk])
zyn=(map [desk ship desk] sync-state)
==
our=ship now=@da syd=desk
==
^- tank
=/ ego (scot %p our)
=/ wen (scot %da now)
=+ .^(=cass %cw /[ego]/[syd]/[wen])
?: =(ud.cass 0)
leaf+"desk does not yet exist: {<desk>}"
leaf+"desk does not yet exist: {<syd>}"
?: =(%kids syd)
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
leaf+"%kids %cz hash: {<hash>}"
=/ kel-path
/(scot %p our)/[desk]/(scot %da now)/sys/kelvin
/[ego]/[syd]/[wen]/sys/kelvin
?. .^(? %cu kel-path)
leaf+"bad desk: {<desk>}"
=+ .^(=weft %cx kel-path)
:+ %rose ["" "{<desk>}" "::"]
leaf+"bad desk: {<syd>}"
=+ .^(=waft %cx kel-path)
:+ %rose ["" "{<syd>}" "::"]
^- tang
=/ meb (mergebase-hashes our desk now arak)
=/ poz
?~ rail.arak "local"
?:(paused.u.rail.arak "paused" "tracking")
=/ sat ?:(liv.rein.arak "running" "suspended")
=/ pen
?~ rail.arak "~"
<(turn next.u.rail.arak |=([@ lal=@tas num=@] [lal num]))>
:~ leaf/"/sys/kelvin: {<[lal num]:weft>}"
=/ hash .^(@uv %cz /[ego]/[syd]/[wen])
=/ =sink
?~ s=(~(get by sor) syd)
~
?~ z=(~(get by zyn) syd u.s)
~
`[-.u.s +.u.s +.u.z]
=/ meb=(list @uv)
?~ sink [hash]~
(mergebase-hashes our syd now her.u.sink sud.u.sink)
=/ dek (~(got by tyr) syd)
=/ =foam (~(got by cone) our syd)
=/ [on=(list [@tas ?]) of=(list [@tas ?])]
(skid ~(tap by ren.foam) |=([* ?] +<+))
=/ sat
?- zest.dek
%live "running"
%dead "suspended"
%held "suspended until next update"
==
=/ kul=tape
%+ roll
%+ sort
~(tap in (waft-to-wefts:clay waft))
|= [a=weft b=weft]
?: =(lal.a lal.b)
(lte num.a num.b)
(lte lal.a lal.b)
|= [=weft =tape]
(welp " {<[lal num]:weft>}" tape)
:~ leaf/"/sys/kelvin: {kul}"
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
leaf/"%cz hash: {<hash>}"
::
leaf/"app status: {sat}"
leaf/"force on: {?:(=(~ add.rein.arak) "~" <add.rein.arak>)}"
leaf/"force off: {?:(=(~ sub.rein.arak) "~" <sub.rein.arak>)}"
leaf/"force on: {?:(=(~ on) "~" <on>)}"
leaf/"force off: {?:(=(~ of) "~" <of>)}"
::
leaf/"publishing ship: {?~(rail.arak <~> <publisher.u.rail.arak>)}"
leaf/"updates: {poz}"
leaf/"source ship: {?~(rail.arak <~> <ship.u.rail.arak>)}"
leaf/"source desk: {?~(rail.arak <~> <desk.u.rail.arak>)}"
leaf/"source aeon: {?~(rail.arak <~> <aeon.u.rail.arak>)}"
leaf/"pending updates: {pen}"
leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}"
leaf/"updates: {?~(sink "local" "remote")}"
leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
leaf/"source aeon: {?~(sink <~> <let.u.sink>)}"
leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}"
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
==
:: +report-kids: non-vat cz hash report for kids desk
::
++ report-kids
|= [our=ship now=@da]
^- tank
=/ dek %kids
=/ syd %kids
=/ ego (scot %p our)
=/ wen (scot %da now)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) dek)
?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
leaf/"no %kids desk"
=+ .^(hash=@uv %cz /[ego]/[dek]/[wen])
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
leaf/"%kids %cz hash: {<hash>}"
:: +read-kelvin-foreign: read /sys/kelvin from a foreign desk
::
++ read-kelvin-foreign
|= [=ship =desk =aeon]
^- weft
~| read-foreign-kelvin/+<
=/ her (scot %p ship)
=/ syd (scot %tas desk)
=/ yon (scot %ud aeon)
::
=/ dom .^(dome cv/~[her syd yon])
=/ tak (scot %uv (~(got by hit.dom) let.dom))
=/ yak .^(yaki cs/~[her syd yon %yaki tak])
=/ lob (scot %uv (~(got by q.yak) /sys/kelvin))
=/ peg .^(page cs/~[her syd yon %blob lob])
;;(weft q.peg)
:: +read-kelvin-local: read /sys/kelvin from a local desk
::
++ read-kelvin-local
|= [our=ship =desk now=@da]
^- (unit weft)
~| read-kelvin-local+desk
=/ pax (en-beam [our desk da+now] /sys/kelvin)
?. .^(? cu/pax)
~
[~ .^(weft cx/pax)]
:: +read-bill-foreign: read /desk/bill from a foreign desk
::
++ read-bill-foreign
@ -169,21 +147,6 @@
?. .^(? cu/pax)
*(list dude)
.^((list dude) cx/pax)
:: +adjust-dudes: which agents should be started and stopped
::
:: Will ask Gall to start agents that it's already running
:: but that should be ok, and might be safer in case other
:: unprocessed moves would have turned them off.
::
++ adjust-dudes
|= $: local=[our=ship =desk now=@da]
=rein
==
^- [jolt=(list dude) idle=(list dude)]
=/ all=(list dude) (read-bill local)
=/ want (get-apps-want local all rein)
=/ have (get-apps-live local)
[want (skip have ~(has in (sy want)))]
::
++ get-remote-diff
|= [our=ship here=desk now=@da her=ship there=desk when=aeon]
@ -210,38 +173,18 @@
^- (list [=dude live=?])
%~ tap in
.^((set [=dude live=?]) ge+/(scot %p our)/[desk]/(scot %da now))
:: +get-apps-want: find which apps should be running on a desk
::
++ get-apps-want
|= [local=[our=ship =desk now=@da] duz=(list dude) =rein]
^- (list dude)
?. liv.rein ~
?. |(=(`zuse+zuse (read-kelvin-local local)) =(%base desk.local)) ~
=. duz (skip duz ~(has in sub.rein))
=. duz (weld duz (skip ~(tap in add.rein) ~(has in (sy duz))))
duz
::
++ mergebase-hashes
|= [our=@p =desk now=@da =arak]
?~ rail.arak
~
=/ her (scot %p ship.u.rail.arak)
|= [our=@p syd=desk now=@da her=ship sud=desk]
=/ her (scot %p her)
=/ ego (scot %p our)
=/ wen (scot %da now)
%+ turn .^((list tako) %cs ~[ego desk wen %base her desk.u.rail.arak])
|=(=tako .^(@uv %cs ~[ego desk wen %hash (scot %uv tako)]))
%+ turn .^((list tako) %cs ~[ego syd wen %base her sud])
|=(=tako .^(@uv %cs ~[ego syd wen %hash (scot %uv tako)]))
::
++ enjs
=, enjs:format
|%
++ vats
|= v=(list ^vat)
^- json
%- pairs
%+ turn v
|= va=^vat
[desk.va (vat va)]
::
++ tim
|= t=@
^- json
@ -254,15 +197,6 @@
da+(tim da.c)
==
::
++ vat
|= v=^vat
%- pairs
:~ desk+s+desk.v
hash+s+(scot %uv hash.v)
cass+(cass cass.v)
arak+(arak arak.v)
==
::
++ weft
|= w=^weft
%- pairs
@ -276,30 +210,5 @@
:~ aeon+(numb aeon.r)
weft+(weft weft.r)
==
::
++ rein
|= r=^rein
%- pairs
:~ add+a+(turn ~(tap in add.r) (lead %s))
sub+a+(turn ~(tap in sub.r) (lead %s))
==
::
++ arak
|= a=^arak
%- pairs
:~ rail+?~(rail.a ~ (rail u.rail.a))
rein+(rein rein.a)
==
::
++ rail
|= r=^rail
%- pairs
:~ ship+s+(scot %p ship.r)
publisher+?~(publisher.r ~ s+(scot %p u.publisher.r))
desk+s+desk.r
paused+b+paused.r
aeon+(numb aeon.r)
next+a+(turn next.r rung)
==
--
--

View File

@ -1,7 +1,7 @@
/+ libstrand=strand
=, strand=strand:libstrand
|%
+$ thread $-(vase _*form:(strand ,vase))
+$ thread $-(vase shed:khan)
+$ input [=tid =cage]
+$ tid tid:strand
+$ bowl bowl:strand
@ -18,4 +18,10 @@
file=term
=vase
==
+$ inline-args
$: parent=(unit tid)
use=(unit tid)
=beak
=shed:khan
==
--

View File

@ -1 +1 @@
[%zuse 418]
[%zuse 417]

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
|%
+$ card card:agent:gall
+$ app-state
$: %2
$: %3
:: local
charges=(map desk charge)
==
@ -42,7 +42,7 @@
++ on-init
^- (quip card _this)
:_ this
:~ (~(watch-our pass /kiln) %hood /kiln/vats)
:~ ~(tire pass /tire)
(~(connect pass /eyre) [~ /] %docket)
(~(wait pass /init) (add 1 now.bowl))
(~(connect pass /eyre) [~ /apps] %docket)
@ -54,20 +54,21 @@
|^
=+ !<(old=app-states vase)
=? old ?=(?(~ ^) -.old) [%1 old]
=^ cards old
=^ cards-1 old
?. ?=(%1 -.old) `old
=/ rein=cage kiln-rein+!>([%base %.y ~ ~])
=/ nuke=cage kiln-uninstall+!>(%hodl)
:_ old(- %2)
:~ [%pass /rein %agent [our.bowl %hood] %poke rein]
[%pass /nuke %agent [our.bowl %hood] %poke nuke]
==
?> ?=(%2 -.old)
`old(- %2)
=^ cards-2 old
?. ?=(%2 -.old) `old
:_ old(- %3) :_ ~
~(tire pass /tire)
?> ?=(%3 -.old)
=/ cards-tire [~(tire pass /tire) ~]
=. -.state old
:: inflate-cache needs to be called after the state is set
::
=. +.state inflate-cache
[cards this]
[:(weld cards-1 cards-2 cards-tire) this]
::
++ inflate-cache
^- cache
@ -81,9 +82,11 @@
$^ state-0-ket
$% state-0-sig
state-1
state-2
app-state
==
::
+$ state-2 [%2 (map desk charge)]
+$ state-1 [%1 (map desk charge)]
+$ state-0-sig
$: ~
@ -94,6 +97,7 @@
==
--
::
++ on-save !>(-.state)
++ on-poke
|= [=mark =vase]
@ -189,13 +193,21 @@
==
::
[%x %charges ~]
=/ tyr
.^(rock:tire:clay %cx /(scot %p our.bowl)//(scot %da now.bowl)/tire)
:- ~ :- ~
%- charge-update:cg
:- %initial
%- ~(gas by *(map desk charge))
%+ turn ~(tap by charges)
%+ murn ~(tap by charges)
|= [=desk =charge]
[desk (get-light-charge charge)]
?~ got=(~(get by tyr) desk)
~
?: ?& ?=(%dead zest.u.got)
?=(~ (get-apps-have:hood our.bowl desk now.bowl))
==
~
`u=[desk (get-light-charge charge)]
::
[%x %charges @ %version ~]
?~ charge=(~(get by charges) i.t.t.path)
@ -212,114 +224,11 @@
~ `state
[%rein ~] ~&(%reined `state)
[%nuke ~] ~&(%nuked `state)
[%kiln ~] take-kiln
[%kiln ~] `state
[%charge @ *] (take-charge i.t.wire t.t.wire)
==
[cards this]
::
++ take-kiln
^- (quip card _state)
?+ -.sign (on-agent:def:cc wire sign)
%kick [(~(watch-our pass /kiln) %hood /kiln/vats)^~ state]
%fact
|^ ^- (quip card _state)
?+ p.cage.sign ~|(take-kiln-mark/p.cage.sign !!)
%kiln-vats-snap-0 (on-snap !<(snap:hood q.cage.sign))
%kiln-vats-diff-0 (on-diff !<(diff:hood q.cage.sign))
==
::
++ on-snap
|= =snap:hood
^- (quip card _state)
=| fex=(list card)
=/ ark ~(tap by snap)
|- ^- (quip card _state)
?~ ark [(flop fex) state]
=^ caz state (on-commit i.ark)
$(ark t.ark, fex (weld (flop caz) fex))
::
++ on-diff
|= =diff:hood
=+ !<(=diff:hood q.cage.sign)
?- -.diff
%commit (on-commit [desk arak]:diff)
%suspend (on-suspend [desk arak]:diff)
%revive (on-revive [desk arak]:diff)
?(%block %reset %merge-sunk %merge-fail)
`state
==
::
++ on-commit
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. docket-exists:cha
~? ?& !=(%base desk)
!=(%kids desk)
==
[dap.bowl %no-docket-file-for desk]
`state
:: always update the docket in state to match clay's
::
=/ =docket docket:cha
=/ pre=(unit charge) (~(get by charges) desk)
=. charges (new-docket:cha docket)
:: if the new chad is a site, we're instantly done
::
?: ?=(%site -.href.docket)
=. charges (new-chad:cha %site ~)
:- ~[add-fact:cha]
state
::
=. by-base (~(put by by-base) base.href.docket desk)
:: if the glob specification is unchanged, keep it
::
?: &(?=(^ pre) =(href.docket.u.pre href.docket) ?=(%glob -.chad.u.pre))
[~[add-fact:cha] state]
:: if the glob spec changed, but we already host it, keep it
:: (this is the "just locally uploaded" case)
::
?: ?& ?=(^ pre)
?=(%glob -.chad.u.pre)
::
.= [(sham glob.chad.u.pre) %ames our.bowl]
glob-reference.href.docket
==
[~[add-fact:cha] state]
:: if the glob changed, forget the old and fetch the new
::
=. charges (new-chad:cha %install ~)
[[add-fact:cha fetch-glob:cha] state]
::
++ on-suspend
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. (~(has by charges) desk) `state
=/ glob=(unit glob)
=/ =chad
chad:(~(got by charges) desk)
?:(?=(%glob -.chad) `glob.chad ~)
=. charges (new-chad:cha %suspend glob)
:_(state ~[add-fact:cha])
::
++ on-revive
|= [=desk =arak:hood]
^- (quip card _state)
=* cha ~(. ch desk)
?. (~(has by charges) desk) `state
=/ =charge (~(got by charges) desk)
?. ?=(%glob -.href.docket.charge)
=. charges (new-chad:cha %site ~)
:_(state ~[add-fact:cha])
=. charges
%- new-chad:cha
?. ?=([%suspend ~ *] chad.charge)
[%install ~]
[%glob u.glob.chad.charge]
:_(state [add-fact fetch-glob]:cha)
--
==
++ take-charge
|= [=desk =^wire]
^- (quip card _state)
@ -398,6 +307,7 @@
::
++ on-arvo
|= [=wire sign=sign-arvo]
|^
=^ cards state
?+ wire (on-arvo:def wire sign)
[%init ~]
@ -410,8 +320,117 @@
?: accepted.sign `state
~& [dap.bowl %failed-to-bind path.binding.sign]
`state
::
[%tire ~]
?> ?=([%clay %tire *] sign)
?- -.p.sign
%& (on-rock p.p.sign)
%| (on-wave p.p.sign)
==
::
[%warp * ~]
?> ?=(%writ +<.sign)
(on-writ i.t.wire p.sign)
==
[cards this]
::
++ on-rock
|= tyr=rock:tire:clay
^- (quip card _state)
=| fex=(list card)
=/ ark ~(tap by tyr)
|- ^- (quip card _state)
?~ ark [(flop fex) state]
=^ caz state (on-zest [p zest.q]:i.ark)
$(ark t.ark, fex (weld (flop caz) fex))
::
++ on-wave
|= =wave:tire:clay
^- (quip card _state)
?- -.wave
%wait `state
%warp `state
%zest (on-zest +.wave)
==
::
++ on-zest
|= [=desk =zest:clay]
^- (quip card _state)
=* cha ~(. ch desk)
=/ card-1
(~(warp-our pass /warp/[desk]) desk ~ %sing %z da+now.bowl /desk/docket-0)
=^ cards-2 state
?. (~(has by charges) desk)
`state
=/ =charge (~(got by charges) desk)
?- zest
%live
?. ?=(%glob -.href.docket.charge)
=. charges (new-chad:cha %site ~)
:_(state ~[add-fact:cha])
:_(state ~[add-fact:cha])
::
?(%held %dead)
=/ glob=(unit glob)
?:(?=(%glob -.chad.charge) `glob.chad.charge ~)
=. charges (new-chad:cha %suspend glob)
:_(state ~[add-fact:cha])
==
[[card-1 cards-2] state]
::
++ on-writ
|= [=desk =riot:clay]
^- (quip card _state)
=/ card-1
(~(warp-our pass /warp/[desk]) desk ~ %next %z da+now.bowl /desk/docket-0)
=^ cards-2 state
=* cha ~(. ch desk)
=/ tyr
.^(rock:tire:clay %cx /(scot %p our.bowl)//(scot %da now.bowl)/tire)
?. =(%live zest:(~(got by tyr) desk))
`state
?. docket-exists:cha
:: ~? ?& !=(%base desk)
:: !=(%kids desk)
:: ==
:: [dap.bowl %no-docket-file-for desk]
?. (~(has by charges) desk)
`state
:- ~[del-fact:cha]
state(charges (~(del by charges) desk))
:: always update the docket in state to match clay's
::
=/ =docket docket:cha
=/ pre=(unit charge) (~(get by charges) desk)
=. charges (new-docket:cha docket)
:: if the new chad is a site, we're instantly done
::
?: ?=(%site -.href.docket)
=. charges (new-chad:cha %site ~)
:- ~[add-fact:cha]
state
::
=. by-base (~(put by by-base) base.href.docket desk)
:: if the glob specification is unchanged, keep it
::
?: &(?=(^ pre) =(href.docket.u.pre href.docket) ?=(%glob -.chad.u.pre))
[~[add-fact:cha] state]
:: if the glob spec changed, but we already host it, keep it
:: (this is the "just locally uploaded" case)
::
?: ?& ?=(^ pre)
?=(%glob -.chad.u.pre)
::
.= [(sham glob.chad.u.pre) %ames our.bowl]
glob-reference.href.docket
==
[~[add-fact:cha] state]
:: if the glob changed, forget the old and fetch the new
::
=. charges (new-chad:cha %install ~)
[[add-fact:cha fetch-glob:cha] state]
[[card-1 cards-2] state]
--
::
++ on-fail on-fail:def
++ on-leave on-leave:def
@ -728,4 +747,3 @@
++ docket .^(^docket %cx (scry:io desk docket-loc))
--
--

View File

@ -2,16 +2,16 @@
/+ verb, dbug, default-agent, agentio
|%
+$ card card:agent:gall
+$ state-0 [%0 lagging=_|]
+$ state-1 [%1 lagging=_|]
::
++ lag-interval ~m10
--
%+ verb |
%- agent:dbug
^- agent:gall
=| state-0
=| state-1
=* state -
=<
=<
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
@ -21,12 +21,23 @@
++ on-init
^- (quip card _this)
:_ this
[onboard watch:kiln check:lag ~]:cc
[onboard tire:cy check:lag ~]:cc
::
++ on-load
|= =vase
=+ !<(old=state-0 vase)
`this(state old)
^- (quip card _this)
|^
=+ !<(old=app-states vase)
=^ cards-1 old
?. ?=(%0 -.old) `old
[[tire:cy:cc]~ old(- %1)]
?> ?=(%1 -.old)
=/ cards-tire [tire:cy:cc ~]
[(weld cards-1 cards-tire) this(state old)]
::
+$ app-states $%(state-0 state-1)
+$ state-0 [%0 lagging=_|]
--
::
++ on-save !>(state)
++ on-poke on-poke:def
@ -34,45 +45,57 @@
++ on-watch on-watch:def
++ on-agent
|= [=wire =sign:agent:gall]
|^
^- (quip card _this)
?+ wire (on-agent:def wire sign)
[%kiln %vats ~] take-kiln-vats
[%kiln %vats ~] `this
==
++ take-kiln-vats
?- -.sign
?(%poke-ack %watch-ack) (on-agent:def wire sign)
%kick :_(this (drop safe-watch:kiln:cc))
::
%fact
?. ?=(%kiln-vats-diff-0 p.cage.sign) `this
=+ !<(=diff:hood q.cage.sign)
?+ -.diff `this
::
%commit
?. |(=(desk.diff %base) ~(has-docket de:cc desk.diff)) `this
=/ =action:hark ~(commit de:cc desk.diff)
::
++ on-arvo
|= [=wire sign=sign-arvo]
^- (quip card _this)
|^
?+ wire (on-arvo:def wire sign)
[%clay %tire ~] take-clay-tire
[%clay %warp * ~] (take-clay-warp i.t.t.wire)
[%check-lag ~] take-check-lag
==
::
++ take-check-lag
^- (quip card _this)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ take-clay-tire
^- (quip card _this)
?> ?=(%tire +<.sign)
?- -.p.sign
%& [(turn ~(tap in ~(key by p.p.sign)) warp:cy:cc) this]
%|
?- -.p.p.sign
%zest `this
%warp `this
%wait
=/ =action:hark (~(blocked de:cc desk.p.p.sign) weft.p.p.sign)
:_ this
~[(poke:ha:cc action)]
::
%block
=/ =action:hark (~(blocked de:cc desk.diff) blockers.diff)
:_ this
~[(poke:ha:cc action)]
==
==
::
++ take-clay-warp
|= =desk
^- (quip card _this)
?> ?=(%writ +<.sign)
=/ cards
?. |(=(desk %base) ~(has-docket de:cc desk)) ~
=/ =action:hark ~(commit de:cc desk)
~[(poke:ha:cc action)]
[[(warp:cy:cc desk) cards] this]
--
::
++ on-arvo
|= [=wire sign=sign-arvo]
^- (quip card _this)
?. ?=([%check-lag ~] wire) (on-arvo:def wire sign)
?> ?=([%behn %wake *] sign)
=+ .^(lag=? %$ (scry:io %$ /zen/lag))
?: =(lagging lag) :_(this ~[check:lag:cc])
:_ this(lagging lag)
:_ ~[check:lag:cc]
?:(lagging start:lag:cc stop:lag:cc)
::
++ on-fail on-fail:def
++ on-leave on-leave:def
--
@ -89,7 +112,7 @@
[~[text+'Welcome to urbit'] ~ now.bowl / /]
::
++ lag
|%
|%
++ check (~(wait pass /check-lag) (add now.bowl lag-interval))
++ place [q.byk.bowl /lag]
++ body `body:hark`[~[text/'Runtime lagging'] ~ now.bowl / /]
@ -102,24 +125,23 @@
++ poke
|=(=action:hark (poke-our:pass %hark-store hark-action+!>(action)))
--
++ kiln
::
++ cy
|%
++ path /kiln/vats
++ pass ~(. ^pass path)
++ watch (watch-our:pass %hood path)
++ watching (~(has by wex.bowl) [path our.bowl %hood])
++ safe-watch `(unit card)`?:(watching ~ `watch)
++ tire ~(tire pass /clay/tire)
++ warp
|= =desk
(~(warp-our pass /clay/warp/[desk]) desk ~ %next %z da+now.bowl /)
--
::
++ de
|_ =desk
++ scry-path (scry:io desk /desk/docket-0)
++ scry-path (scry:io desk /desk/docket-0)
++ has-docket .^(? %cu scry-path)
++ docket .^(docket:^docket %cx scry-path)
++ hash .^(@uv %cz (scry:io desk ~))
++ place `place:hark`[q.byk.bowl /desk/[desk]]
++ vat
.^(vat:hood %gx (scry:io %hood /kiln/vat/[desk]/noun))
++ docket .^(docket:^docket %cx scry-path)
++ hash .^(@uv %cz (scry:io desk ~))
++ place `place:hark`[q.byk.bowl /desk/[desk]]
++ version ud:.^(cass:clay %cw (scry:io desk /))
++ body
|= [=path title=cord content=(unit cord)]
^- body:hark
@ -131,7 +153,7 @@
%+ rap 3
?: =(desk %base)
['System software' cord ~]
?: has-docket
?: has-docket
['App: "' title:docket '"' cord ~]
['Desk: ' desk cord ~]
::
@ -142,7 +164,7 @@
::
++ commit
^- action:hark
?:(=(1 ud.cass:vat) created updated)
?:(=(1 version) created updated)
::
++ created
^- action:hark
@ -155,11 +177,11 @@
(body /desk/[desk] (title-prefix (rap 3 ' has been updated to ' get-version ~)) ~)
::
++ blocked
|= blockers=(set ^desk)
|= =weft
^- action:hark
:+ %add-note [/blocked place]
%^ body /blocked (title-prefix ' is blocked from upgrading')
`(rap 3 'Blocking desks: ' (join ', ' ~(tap in blockers)))
`(rap 3 'Blocked waiting for system version: ' (scot %ud num.weft) 'K' ~)
::
++ ver
|= =version:^docket
@ -172,7 +194,7 @@
--
++ note
|%
++ merge
++ merge
|= [=desk hash=@uv]
^- (list body:hark)
:_ ~

View File

@ -1,7 +1,7 @@
:~ title+'System'
info+'An app launcher for Urbit.'
color+0xee.5432
glob-http+['https://bootstrap.urbit.org/glob-0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk.glob' 0v5.kgrq2.gp725.bo5bk.dmr7d.h41qk]
glob-http+['https://bootstrap.urbit.org/glob-0vm65f9.defur.eqhgj.62ls6.9v9lf.glob' 0vm65f9.defur.eqhgj.62ls6.9v9lf]
::glob-ames+~zod^0v0
base+'grid'
version+[1 1 6]

View File

@ -28,6 +28,7 @@
%tas s+(scot %tas p.c)
%ud (numb p.c)
==
::
++ foreign-desk
|= [s=^ship =desk]
^- cord

View File

@ -1 +1 @@
[%zuse 418]
[%zuse 417]

View File

@ -0,0 +1,53 @@
/- spider
/+ *strandio
::
=, strand=strand:spider
::
:: send on /spider/garden/json/get-dudes/json
::
|%
++ buds :: get agents currently running
|= p=desk
=/ m (strand ,(list dude:gall))
^- form:m
?. =(%$ p)
;< q=(list dude:gall) bind:m (suds p)
(pure:m q)
;< q=(list desk) bind:m duds
=| r=(list (list dude:gall))
|- ^- form:m
=* s $
?~ q (pure:m (zing r))
;< t=(list dude:gall) bind:m (suds i.q)
s(q t.q, r [t r])
::
++ suds :: clean %ge scry
|= p=desk
=/ m (strand ,(list dude:gall))
^- form:m
;< q=(set [dude:gall ?]) bind:m
(scry (set ,[dude:gall ?]) /ge/(scot %tas p))
%- pure:m
(murn ~(tap in q) |=([dude:gall ?] ?.(+.+< ~ `-.+<)))
::
++ duds :: get desks
=/ m (strand ,(list desk))
^- form:m
;< p=(set desk) bind:m (scry (set ,desk) /cd/base)
(pure:m ~(tap in p))
--
::
^- thread:spider
|= jon=vase
=/ m (strand ,vase)
^- form:m
;< =bowl:spider bind:m get-bowl
=, bowl
?~ know=!<((unit json) jon)
(pure:m !>(`json`[%s 'invalid-request']))
?. ?=([%s @] u.know)
(pure:m !>(`json`[%s 'invalid-request']))
=, format
;< breh=(list @tas) bind:m (buds (so:dejs u.know))
%- pure:m
!>(`json`(frond:enjs 'buds' a+(turn breh |=(@tas s+[+<]))))

23744
pkg/grid/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
"@radix-ui/react-toggle": "^0.0.10",
"@tlon/sigil-js": "^1.4.4",
"@types/lodash": "^4.14.172",
"@urbit/api": "^2.1.1",
"@urbit/api": "^2.2.0",
"@urbit/http-api": "^2.1.0",
"big-integer": "^1.6.48",
"classnames": "^2.3.1",

View File

@ -86,9 +86,8 @@ const AppRoutes = () => {
fetchCharges();
fetchAllies();
const { fetchVats, fetchLag } = useKilnState.getState();
fetchVats();
fetchLag();
const { initializeKiln } = useKilnState.getState();
initializeKiln();
useContactState.getState().initialize(api);
useHarkStore.getState().initialize(api);

View File

@ -1,4 +1,4 @@
import { chadIsRunning, Treaty, Vat } from '@urbit/api';
import { chadIsRunning, Pike, Treaty } from '@urbit/api';
import clipboardCopy from 'clipboard-copy';
import React, { FC, useCallback, useState } from 'react';
import cn from 'classnames';
@ -6,7 +6,7 @@ import { Button, PillButton } from './Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from './Dialog';
import { DocketHeader } from './DocketHeader';
import { Spinner } from './Spinner';
import { VatMeta } from './VatMeta';
import { PikeMeta } from './PikeMeta';
import useDocketState, { ChargeWithDesk, useTreaty } from '../state/docket';
import { getAppHref, getAppName } from '../state/util';
import { addRecentApp } from '../nav/search/Home';
@ -17,7 +17,7 @@ type InstallStatus = 'uninstalled' | 'installing' | 'installed';
type App = ChargeWithDesk | Treaty;
interface AppInfoProps {
docket: App;
vat?: Vat;
pike?: Pike;
className?: string;
}
@ -34,10 +34,9 @@ function getInstallStatus(docket: App): InstallStatus {
return 'uninstalled';
}
function getRemoteDesk(docket: App, vat?: Vat) {
if (vat && vat.arak.rail) {
const { ship, desk } = vat.arak.rail;
return [ship, desk];
function getRemoteDesk(docket: App, pike?: Pike) {
if (pike && pike.sync) {
return [pike.sync.ship, pike.sync.desk];
}
if ('chad' in docket) {
return ['', docket.desk];
@ -46,10 +45,10 @@ function getRemoteDesk(docket: App, vat?: Vat) {
return [ship, desk];
}
export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => {
export const AppInfo: FC<AppInfoProps> = ({ docket, pike, className }) => {
const installStatus = getInstallStatus(docket);
const [ship, desk] = getRemoteDesk(docket, vat);
const publisher = vat?.arak?.rail?.publisher ?? ship;
const [ship, desk] = getRemoteDesk(docket, pike);
const publisher = pike?.sync?.ship ?? ship;
const [copied, setCopied] = useState(false);
const treaty = useTreaty(ship, desk);
@ -136,10 +135,10 @@ export const AppInfo: FC<AppInfoProps> = ({ docket, vat, className }) => {
</div>
</DocketHeader>
<div className="space-y-6">
{vat ? (
{pike ? (
<>
<hr className="-mx-5 sm:-mx-8 border-gray-50" />
<VatMeta vat={vat} />
<PikeMeta pike={pike} />
</>
) : null}
{!treaty ? null : (

View File

@ -0,0 +1,25 @@
import React from 'react';
import { Pike } from '@urbit/api';
import { Attribute } from './Attribute';
export function PikeMeta(props: { pike: Pike }) {
const { pike } = props;
const pluralUpdates = pike.wefts?.length !== 1;
return (
<div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8">
<Attribute title="Desk Hash" attr="hash">
{pike.hash}
</Attribute>
<Attribute title="Installed into" attr="local-desk">
%{pike.sync?.desk}
</Attribute>
{pike.wefts && pike.wefts.length > 0 ? (
<Attribute attr="next" title="Pending Updates">
{pike.wefts.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update
</Attribute>
) : null}
</div>
);
}

View File

@ -3,11 +3,12 @@ import React, { HTMLAttributes } from 'react';
type ShipNameProps = {
name: string;
truncate?: boolean;
} & HTMLAttributes<HTMLSpanElement>;
export const ShipName = ({ name, ...props }: ShipNameProps) => {
export const ShipName = ({ name, truncate = true, ...props }: ShipNameProps) => {
const separator = /([_^-])/;
const citedName = cite(name);
const citedName = truncate ? cite(name) : name;
if (!citedName) {
return null;

View File

@ -0,0 +1,103 @@
import React, { useCallback, useState } from 'react';
import { useAsyncCall } from '../logic/useAsyncCall';
import { Button } from './Button';
import { ShipName } from './ShipName';
import { Spinner } from './Spinner';
interface SourceSetterProps {
appName: string;
srcDesk: string;
srcShip?: string;
title: string;
toggleSrc: (desk: string, ship: string) => Promise<void>;
}
export default function SourceSetter({
appName,
srcDesk,
srcShip,
title,
toggleSrc
}: SourceSetterProps) {
const [newSyncShip, setNewSyncShip] = useState(srcShip ?? '');
const { status: requestStatus, call: handleSubmit } = useAsyncCall(toggleSrc);
const syncDirty = newSyncShip !== srcShip;
const onUnset = useCallback(() => {
if (!srcShip) {
return;
}
if (
// eslint-disable-next-line no-alert, no-restricted-globals
confirm(`Are you sure you want to unsync ${appName}? You will no longer receive updates.`)
) {
toggleSrc(srcDesk, srcShip);
}
}, [srcShip, srcDesk]);
const handleSourceChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
const { target } = e;
const value = target.value.trim();
setNewSyncShip(value.startsWith('~') ? value : `~${value}`);
}, []);
const onSubmit = useCallback(
async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
await handleSubmit(srcDesk, newSyncShip);
},
[srcDesk, newSyncShip]
);
return (
<>
<h2 className="h3 mb-7">{title}</h2>
<div className="space-y-3">
{srcShip ? (
<>
<h3 className="flex items-center h4 mb-2">Automatic Updates</h3>
<p>Automatically download and apply updates to keep {appName} up to date.</p>
<div className="flex-1 flex flex-col justify-center space-y-6">
<p>
OTA Source:{' '}
<ShipName name={srcShip} truncate={false} className="font-semibold font-mono" />
</p>
</div>
<div className="flex space-x-2">
<Button onClick={onUnset} variant="destructive">
Unsync Updates for {appName}...
</Button>
</div>
</>
) : (
<form className="inner-section relative" onSubmit={onSubmit}>
<label htmlFor="ota-source" className="h4 mb-3">
Set Update Source
</label>
<p className="mb-2">Enter a valid urbit name to receive updates for {appName}.</p>
<div className="relative">
<input
id="ota-source"
type="text"
value={newSyncShip}
onChange={handleSourceChange}
className="input font-semibold default-ring"
/>
{syncDirty && (
<Button type="submit" className="absolute top-1 right-1 py-1 px-3 text-sm">
{requestStatus !== 'loading' && 'Save'}
{requestStatus === 'loading' && (
<>
<span className="sr-only">Saving...</span>
<Spinner className="w-5 h-5" />
</>
)}
</Button>
)}
</div>
</form>
)}
</div>
</>
);
}

View File

@ -1,27 +0,0 @@
import React from 'react';
import { Vat } from '@urbit/api';
import { Attribute } from './Attribute';
export function VatMeta(props: { vat: Vat }) {
const { vat } = props;
const { desk, arak, cass, hash } = vat;
const { desk: foreignDesk, ship, next } = arak.rail || {};
const pluralUpdates = next?.length !== 1;
return (
<div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8">
<Attribute title="Desk Hash" attr="hash">
{hash}
</Attribute>
<Attribute title="Installed into" attr="local-desk">
%{desk}
</Attribute>
{next && next.length > 0 ? (
<Attribute attr="next" title="Pending Updates">
{next.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update
</Attribute>
) : null}
</div>
);
}

View File

@ -3,9 +3,9 @@ import classNames from 'classnames';
import clipboardCopy from 'clipboard-copy';
import React, { HTMLAttributes, useCallback, useState } from 'react';
import { Link, Route, useHistory } from 'react-router-dom';
import { Vat } from '@urbit/api';
import { Pike } from '@urbit/api';
import { Adjust } from '../components/icons/Adjust';
import { useVat } from '../state/kiln';
import { usePike } from '../state/kiln';
import { disableDefault, handleDropdownLink } from '../state/util';
import { useMedia } from '../logic/useMedia';
import { Cross } from '../components/icons/Cross';
@ -17,15 +17,15 @@ type SystemMenuProps = HTMLAttributes<HTMLButtonElement> & {
shouldDim: boolean;
};
function getHash(vat: Vat): string {
const parts = vat.hash.split('.');
function getHash(pike: Pike): string {
const parts = pike.hash.split('.');
return parts[parts.length - 1];
}
export const SystemMenu = ({ className, open, subMenuOpen, shouldDim }: SystemMenuProps) => {
const { push } = useHistory();
const [copied, setCopied] = useState(false);
const garden = useVat(window.desk);
const garden = usePike(window.desk);
const hash = garden ? getHash(garden) : null;
const isMobile = useMedia('(max-width: 639px)');
const select = useLeapStore((s) => s.select);

View File

@ -88,8 +88,8 @@ export const BasicNotification = ({ notification, lid }: BasicNotificationProps)
</header>
{contents.length > 0 ? (
<div className="leading-tight note-grid-body sm:leading-normal space-y-2">
{take(contents, MAX_CONTENTS).map((content) => (
<p className="">
{take(contents, MAX_CONTENTS).map((content, i) => (
<p className="" key={i}>
<NotificationText contents={content} />
</p>
))}

View File

@ -13,7 +13,7 @@ function renderNotification(notification: Notification, key: string, lid: HarkLi
return <RuntimeLagNotification key={key} />;
}
if (notification.bin.path === '/blocked' && notification.bin.place.path === '/desk/base') {
return <BaseBlockedNotification key={key} />;
return <BaseBlockedNotification key={key} bin={notification.bin} lid={lid} />;
}
if (notification.bin.place.path === '/onboard') {
return <OnboardingNotification key={key} lid={lid} />;

View File

@ -1,15 +1,15 @@
import React from 'react';
import cn from 'classnames';
import { Link } from 'react-router-dom';
import { HarkLid, Vats, getVatPublisher } from '@urbit/api';
import { HarkLid, Pikes, getPikePublisher } from '@urbit/api';
import { Button } from '../../components/Button';
import { useBrowserId, useCurrentTheme } from '../../state/local';
import { getDarkColor } from '../../state/util';
import useKilnState from '../../state/kiln';
import { usePikes } from '../../state/kiln';
import { useHarkStore } from '../../state/hark';
import { useProtocolHandling } from '../../state/settings';
const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
const getCards = (pikes: Pikes, protocol: boolean): OnboardingCardProps[] => {
const cards = [
{
title: 'Terminal',
@ -38,20 +38,6 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
ship: '~mister-dister-dozzod-dozzod',
desk: 'bitcoin'
}
// Commenting out until we have something real
// {
// title: 'Debug',
// body: "Install a debugger. You can inspect your ship's internals using this interface",
// button: 'Install',
// color: '#E5E5E5',
// href: '/leap/search/direct/apps/~zod/debug'
// }
// {
// title: 'Build an app',
// body: 'You can instantly get started building new things on Urbit. Just right click your Landscape and select “New App”',
// button: 'Learn more',
// color: '#82A6CA'
// }
];
if ('registerProtocolHandler' in window.navigator && !protocol) {
cards.push({
@ -66,8 +52,8 @@ const getCards = (vats: Vats, protocol: boolean): OnboardingCardProps[] => {
}
return cards.filter((card) => {
return !Object.values(vats).find(
(vat) => getVatPublisher(vat) == card.ship && vat?.arak?.rail?.desk === card.desk
return !Object.values(pikes).find(
(pike) => getPikePublisher(pike) === card.ship && pike.sync?.desk === card.desk
);
});
};
@ -107,10 +93,10 @@ interface OnboardingNotificationProps {
export const OnboardingNotification = ({ unread = false, lid }: OnboardingNotificationProps) => {
const theme = useCurrentTheme();
const vats = useKilnState((s) => s.vats);
const pikes = usePikes();
const browserId = useBrowserId();
const protocolHandling = useProtocolHandling(browserId);
const cards = getCards(vats, protocolHandling);
const cards = getCards(pikes, protocolHandling);
if (cards.length === 0 && !('time' in lid)) {
useHarkStore.getState().archiveNote(

View File

@ -1,18 +1,18 @@
import { pick, pickBy, partition } from 'lodash';
import { pick, partition } from 'lodash';
import React, { useCallback } from 'react';
import { kilnBump } from '@urbit/api';
import { HarkBin, HarkLid, kilnBump, Pike } from '@urbit/api';
import { useHistory } from 'react-router-dom';
import { AppList } from '../../components/AppList';
import { Button } from '../../components/Button';
import { Dialog, DialogClose, DialogContent, DialogTrigger } from '../../components/Dialog';
import { Elbow } from '../../components/icons/Elbow';
import api from '../../state/api';
import { useCharges } from '../../state/docket';
import useKilnState, { useVat } from '../../state/kiln';
import useKilnState, { usePike } from '../../state/kiln';
import { NotificationButton } from './NotificationButton';
import { disableDefault } from '../../state/util';
import { Vat } from '@urbit/api';
import {useHistory} from 'react-router-dom';
import { useHarkStore } from '../../state/hark';
export const RuntimeLagNotification = () => (
<section
@ -38,28 +38,33 @@ export const RuntimeLagNotification = () => (
</section>
);
function vatIsBlocked(newKelvin: number, vat: Vat) {
return !(vat.arak?.rail?.next || []).find(({ aeon, weft }) => weft.kelvin === newKelvin);
function pikeIsBlocked(newKelvin: number, pike: Pike) {
return pike.zest === 'live' && !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin);
}
export const BaseBlockedNotification = () => {
const base = useVat('base');
export const BaseBlockedNotification = ({ bin, lid }: { bin: HarkBin, lid: HarkLid }) => {
const basePike = usePike('base');
const { push } = useHistory();
// TODO: assert weft.name === 'zuse'??
const newKelvin = base?.arak?.rail?.next?.[0]?.weft?.kelvin || 420;
const newKelvin = basePike?.wefts[0]?.kelvin ?? 417;
const charges = useCharges();
const [blocked, unblocked] = useKilnState((s) => {
const [b, u] = partition(Object.entries(s.vats), ([desk, vat]) => vatIsBlocked(newKelvin, vat));
const [blocked] = useKilnState((s) => {
const [b, u] = partition(Object.entries(s.pikes), ([, pike]) => pikeIsBlocked(newKelvin, pike));
return [b.map(([d]) => d), u.map(([d]) => d)] as const;
});
const { toggleInstall } = useKilnState();
const blockedCharges = Object.values(pick(charges, blocked));
const count = blockedCharges.length;
const handlePauseOTAs = useCallback(() => {}, []);
const handlePauseOTAs = useCallback(async () => {
await useHarkStore.getState().archiveNote(bin, lid);
}, []);
const handleArchiveApps = useCallback(async () => {
api.poke(kilnBump(true));
await api.poke(kilnBump());
await useHarkStore.getState().archiveNote(bin, lid);
push('/leap/upgrading');
}, []);
@ -81,12 +86,12 @@ export const BaseBlockedNotification = () => {
<AppList apps={blockedCharges} labelledBy="blocked-apps" size="xs" className="font-medium" />
<div className="space-y-6">
<p>
In order to proceed with the System Update, youll need to temporarily archive these apps,
which will render them unusable, but with data intact.
In order to proceed with the System Update, youll need to temporarily suspend these apps.
This will render them unusable, but with data intact.
</p>
<p>
Archived apps will automatically un-archive and resume operation when their developer
provides an app update.
Suspended apps will automatically resume operation when their developer
provides an update.
</p>
</div>
<div className="space-x-2">
@ -97,30 +102,24 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight"
containerClass="w-full max-w-md"
>
<h2 className="h4">Skip System Update</h2>
<h2 className="h4">Delay System Update</h2>
<p>
Skipping the application fo an incoming System Update will grant you the ability to
continue using incompatible apps at the cost of an urbit that&apos;s not up to date.
</p>
<p>
You can choose to apply System Updates from System Preferences any time.{' '}
<a href="https://tlon.io" target="_blank" rel="noreferrer">
Learn More
</a>
Are you sure you want to remain on an old version of Urbit
until these apps have been updated?
</p>
<div className="flex space-x-6">
<DialogClose as={Button} variant="secondary">
Cancel
</DialogClose>
<DialogClose as={Button} variant="caution" onClick={handlePauseOTAs}>
Pause OTAs
Remain on Old Version
</DialogClose>
</div>
</DialogContent>
</Dialog>
<Dialog>
<DialogTrigger as={NotificationButton}>
Archive ({count}) apps and Apply System Update
Suspend ({count}) Apps and Apply Update
</DialogTrigger>
<DialogContent
showClose={false}
@ -128,10 +127,9 @@ export const BaseBlockedNotification = () => {
className="space-y-6 text-base tracking-tight"
containerClass="w-full max-w-md"
>
<h2 className="h4">Archive ({count}) Apps and Apply System Update</h2>
<h2 className="h4">Suspend ({count}) Apps and Apply System Update</h2>
<p>
The following apps will be archived until their developer provides a compatible update
to your system.
The following apps will be suspended until their developer provides an update.
</p>
<AppList
apps={blockedCharges}
@ -144,7 +142,7 @@ export const BaseBlockedNotification = () => {
Cancel
</DialogClose>
<DialogClose as={Button} variant="caution" onClick={handleArchiveApps}>
Archive Apps
Suspend Apps and Upgrade
</DialogClose>
</div>
</DialogContent>

Some files were not shown because too many files have changed in this diff Show More