Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Support dot-delimited petname paths #2023

Open
17 of 25 tasks
rekmarks opened this issue Jan 31, 2024 · 1 comment
Open
17 of 25 tasks

cli: Support dot-delimited petname paths #2023

rekmarks opened this issue Jan 31, 2024 · 1 comment
Assignees
Labels
daemon Issues pertaining the the pet dæmon 🐈‍⬛ enhancement New feature or request

Comments

@rekmarks
Copy link
Contributor

rekmarks commented Jan 31, 2024

Following #2022, we should support dot-delimited petname paths in the CLI such that wherever a petname for an existing value is provided, a path can be provided instead. This path will then be passed to the mailbox lookup method, which will attempt to resolve the value.

For example, this should work:

$ endo eval '10' --name ten
10
$ endo eval 'foo' foo:INFO.ten.source
10

Note that the parsePetNamePath() utility should be used for dot-delimited path parsing in the CLI.

See also discussion in #1915.

TODO

N/A

  • clean
  • help
  • log
  • purge
  • restart
  • start
  • stop
  • ping
  • where
@rekmarks rekmarks added the enhancement New feature or request label Jan 31, 2024
@rekmarks rekmarks self-assigned this Jan 31, 2024
@kriskowal
Copy link
Member

kriskowal commented Feb 1, 2024

endo rename should be replaced with endo mv|move when we can support dot delimited paths, and we should support dot delimited paths for both the source and target. We should also guarantee that a move occurs in a single JavaScript event unless the dot-delimited path reaches outside the local dæmon. That will require the move operation to walk from formula to formula for both the source and target path before falling through to the lookup protocol. We will need a corresponding protocol for “depositing” a formula identifier to the target “directory” and allow that protocol to work remotely.

E(remoteDirectory).deposit(name, nonce, addresses). See ocapn/ocapn#105

The local behavior occurs if the nonce exists in the daemon and just writes the corresponding name and formula identifier to the local pet store (directory). Otherwise, the remote behavior is to create a “remote” formula that captures the nonce and addresses. So, if the remote restarts, it can reestablish a connection to the node that the nonce calls home.

rekmarks added a commit that referenced this issue Feb 8, 2024
…name paths for CLI `eval` command

Ref: #2023 

## Description

Adds support for dot-delimited petname paths to the CLI `eval` command. This required modifications to the `evaluate` method of the daemon's `host.js`, and the introduction of a new formula type, `lookup`.

The `lookup` formula type is necessary because the names in a lookup path may have neither petnames nor formula identifiers associated with them. Consider:

```text
> endo eval '10' --name ten
10
> endo eval 'foo' foo:INFO.ten.source
10
```

The only way retrieve the value for `source` is to call `E(HOST).lookup('INFO', 'ten', 'source')`, and since the `eval` formula expects its values to be mediated by formula identifiers, the lookup of `INFO.ten.source` must itself be stored as a formula.

The `lookup` formula is an `-id512` formula with the following interface:
```typescript
type LookupFormula = {
  type: 'lookup';

  /**
   * The formula identifier of the naming hub to call lookup on.
   * A "naming hub" is an object with a variadic `lookup()` method.
   */
  hub: string;

  /**
   * The pet name path.
   */
  path: Array<string>;
};
```

The `lookup` formula introduces the language of "naming hubs" into the daemon codebase. At present the only such objects are guests and hosts, which are also agents, but the category of naming hubs is expected to grow to include non-agent objects.
@rekmarks rekmarks changed the title @endo/cli: Support dot-delimited petname paths cli: Support dot-delimited petname paths Feb 17, 2024
@kriskowal kriskowal added the daemon Issues pertaining the the pet dæmon 🐈‍⬛ label Apr 17, 2024
FUDCo added a commit that referenced this issue May 24, 2024
Ref: #2023 

Adds support for dot-delimited petname paths in the `bundle`, `cat`,
`follow`, `open`, and `run` commands. Cleans up handling in the `list`
command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
daemon Issues pertaining the the pet dæmon 🐈‍⬛ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants