turnzero 0.35.0-next.1 → 0.36.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/turnzero-cloud.mjs +14 -14
- package/package.json +1 -1
package/dist/turnzero-cloud.mjs
CHANGED
|
@@ -327,9 +327,9 @@ var TZMESH_SECRET_PREFIX = "turnzero_tzmesh_sec_";
|
|
|
327
327
|
var TZMESH_SECRET_FORM = new RegExp(`^${TZMESH_SECRET_PREFIX}[A-Za-z0-9_-]{16,256}$`);
|
|
328
328
|
var TZMESH_NAME_FORM = /^[A-Za-z0-9_-]{1,32}$/;
|
|
329
329
|
var TZMESH_REGISTER_PATH = "/v1/register";
|
|
330
|
-
var
|
|
331
|
-
var TZMESH_WEBHOOK_SET_PATH = "/v1/
|
|
332
|
-
var TZMESH_JOIN_PATH = "/v1/
|
|
330
|
+
var TZMESH_DELETE_AGENT_PATH = "/v1/delete_agent";
|
|
331
|
+
var TZMESH_WEBHOOK_SET_PATH = "/v1/set_webhook";
|
|
332
|
+
var TZMESH_JOIN_PATH = "/v1/join_channel";
|
|
333
333
|
var TZMESH_WEBHOOK_ROUTE = "/tzmesh/webhook";
|
|
334
334
|
var TZMESH_WEBHOOK_SECRET_PREFIX = "turnzero_tzmesh_whk_";
|
|
335
335
|
var TZMESH_WEBHOOK_SECRET_FORM = new RegExp(`^${TZMESH_WEBHOOK_SECRET_PREFIX}[A-Za-z0-9_-]{43}$`);
|
|
@@ -10659,9 +10659,9 @@ var PRINTED_NAME_FORM = /^[A-Za-z0-9_.:/@-]{1,160}$/;
|
|
|
10659
10659
|
var agentWords = (agent) => agent.handle !== null ? agent.handle : `with id ${agent.id}`;
|
|
10660
10660
|
var registeredLineOf = (agent, wire) => `${REGISTERED_LINE_HEAD}agent ${agent.handle ?? "with no handle"}, id ${agent.id}, at ${wire}, its secret printed nowhere`;
|
|
10661
10661
|
var WRITTEN_LINE = `${WRITTEN_LINE_HEAD}the agent's secret, alone on one line, into the file ${TZMESH_OPTION.toFile} names, readable by its owner alone`;
|
|
10662
|
-
var REGISTER_UNKNOWN = "Whether the agent was registered is unknown:
|
|
10663
|
-
var agentStandsSentence = (agent) => `The agent ${agentWords(agent)} stands with no secret kept:
|
|
10664
|
-
var storeUnknownSentence = (secretName, agent) => `Whether the secret was stored is unknown: list_secrets from your tool shows when ${secretName} was last written. Where it was not written,
|
|
10662
|
+
var REGISTER_UNKNOWN = "Whether the agent was registered is unknown: tzmesh_list_participants from your tool shows it, and delete_agent from your tool, naming its participant, deletes it.";
|
|
10663
|
+
var agentStandsSentence = (agent) => `The agent ${agentWords(agent)} stands with no secret kept: delete_agent from your tool, naming participant ${agent.id}, deletes it and frees its name.`;
|
|
10664
|
+
var storeUnknownSentence = (secretName, agent) => `Whether the secret was stored is unknown: list_secrets from your tool shows when ${secretName} was last written. Where it was not written, delete_agent from your tool, naming participant ${agent.id}, deletes the agent ${agentWords(agent)}.`;
|
|
10665
10665
|
var TOKEN_LEFT = `list_tokens from your tool shows the run's token by its label, ${TZMESH_COMMAND_LABEL}, and revoke_token ends it; it expires within a day either way.`;
|
|
10666
10666
|
var tokenStandsSentence = (id) => `The run's token, ${id}, was not revoked, so it works until it expires within a day: revoke_token from your tool with id ${id} ends it, and list_tokens shows whether it stands.`;
|
|
10667
10667
|
var revocationBearerRefused = (origin) => `This computer's token for ${origin} was refused as the bearer of the revocation.`;
|
|
@@ -10715,15 +10715,15 @@ var register = async (io2, wire, token2, userAgent, options) => {
|
|
|
10715
10715
|
return { agent, secret: secret2 };
|
|
10716
10716
|
};
|
|
10717
10717
|
var deleteAgent = async (io2, wire, token2, userAgent, agent) => {
|
|
10718
|
-
const answered = await postWire(io2, wire,
|
|
10718
|
+
const answered = await postWire(io2, wire, TZMESH_DELETE_AGENT_PATH, token2, userAgent, { participant: agent.id });
|
|
10719
10719
|
const deleted = answered !== null && !answered.redirected && answered.status >= 200 && answered.status <= 299 && planeObjectOf(answered.text) !== null;
|
|
10720
10720
|
if (deleted) return { deleted: true, lines: [`The agent ${agentWords(agent)} was deleted, and its name is free again.`], unknown: false };
|
|
10721
10721
|
const refusal = answered === null || answered.redirected || answered.status >= PLATFORM_FAILURE_STATUS ? null : planeRefusalOf(answered.text);
|
|
10722
10722
|
const why = answered === null ? [`The ${END_ACT} drew no answer.`] : answered.redirected ? [`The ${END_ACT} was answered ${answeredHow(answered.status)}, which the command never follows.`] : answered.status >= PLATFORM_FAILURE_STATUS ? failureLines(END_ACT, answered.status, planeRefusalOf(answered.text)) : refusal !== null ? refusalLines(END_ACT, answered.status, refusal) : [`The ${END_ACT} was answered HTTP ${answered.status}, not by the tzMesh service.`];
|
|
10723
10723
|
return { deleted: false, lines: why, unknown: refusal === null };
|
|
10724
10724
|
};
|
|
10725
|
-
var WEBHOOK_ACT = "
|
|
10726
|
-
var JOIN_ACT = "
|
|
10725
|
+
var WEBHOOK_ACT = "set_webhook";
|
|
10726
|
+
var JOIN_ACT = "join_channel";
|
|
10727
10727
|
var WEBHOOK_LINE_HEAD = "webhook: ";
|
|
10728
10728
|
var JOINED_LINE_HEAD = "joined: ";
|
|
10729
10729
|
var webhookLineOf = (url) => `${WEBHOOK_LINE_HEAD}set to ${url}, its signing secret printed nowhere`;
|
|
@@ -10767,8 +10767,8 @@ var setUpAgent = async (io2, wire, secret2, userAgent, options, ended) => {
|
|
|
10767
10767
|
return { signing };
|
|
10768
10768
|
};
|
|
10769
10769
|
var firstStoreStandsSentence = (secretName) => `${secretName} now holds the deleted agent's secret, which works nowhere, until the line runs again.`;
|
|
10770
|
-
var signingUnknownSentence = (signingName, agent) => `Whether the webhook's signing secret was stored is unknown: list_secrets from your tool shows when ${signingName} was last written. Where it was not written,
|
|
10771
|
-
var unfinishableSentence = (agent) => `The agent ${agentWords(agent)} cannot be finished, since its webhook's signing secret ended with the run:
|
|
10770
|
+
var signingUnknownSentence = (signingName, agent) => `Whether the webhook's signing secret was stored is unknown: list_secrets from your tool shows when ${signingName} was last written. Where it was not written, delete_agent from your tool, naming participant ${agent.id}, deletes the agent ${agentWords(agent)}, and the line runs again.`;
|
|
10771
|
+
var unfinishableSentence = (agent) => `The agent ${agentWords(agent)} cannot be finished, since its webhook's signing secret ended with the run: delete_agent from your tool, naming participant ${agent.id}, deletes it, and the line runs again.`;
|
|
10772
10772
|
var firstStoreUnknownSentence = (secretName) => `Whether ${secretName} was written is unknown: list_secrets from your tool shows when it was last written. Where it was, it holds the deleted agent's secret, which works nowhere, until the line runs again.`;
|
|
10773
10773
|
var unfinishedStandsSentence = (agent, kept2) => `${kept2.known ? `${kept2.name} holds the secret of the agent ${agentWords(agent)}.` : `Whether ${kept2.name} holds the secret of the agent ${agentWords(agent)} is unknown: list_secrets from your tool shows when it was last written.`} ${unfinishableSentence(agent)}`;
|
|
10774
10774
|
var revokeRunToken = async (io2, plane, bearer, id, userAgent) => {
|
|
@@ -10804,7 +10804,7 @@ var endedLineOf = (stage, plane, agent, options) => {
|
|
|
10804
10804
|
case "registered":
|
|
10805
10805
|
return agent === null ? `The run was ended after the register. ${REGISTER_UNKNOWN} ${TOKEN_LEFT}` : "secret" in route ? options.webhook !== null ? `The run was ended after the register, while its secret was being stored. ${unfinishableSentence(agent)} ${TOKEN_LEFT}` : `The run was ended after the register, while its secret was being stored. ${storeUnknownSentence(route.secret, agent)} ${TOKEN_LEFT}` : `The run was ended after the register, before its secret was written. ${agentStandsSentence(agent)} ${TOKEN_LEFT}`;
|
|
10806
10806
|
case "setting up":
|
|
10807
|
-
return agent === null ? `The run was ended after the register. ${REGISTER_UNKNOWN} ${TOKEN_LEFT}` : `The run was ended while the agent's webhook or channels were being set.
|
|
10807
|
+
return agent === null ? `The run was ended after the register. ${REGISTER_UNKNOWN} ${TOKEN_LEFT}` : `The run was ended while the agent's webhook or channels were being set. tzmesh_list_participants from your tool shows the agent and its webhook. ${agentStandsSentence(agent)} ${TOKEN_LEFT}`;
|
|
10808
10808
|
case "storing signing":
|
|
10809
10809
|
return agent === null || options.webhook === null ? `The run was ended after the register. ${REGISTER_UNKNOWN} ${TOKEN_LEFT}` : `The run was ended while the webhook's signing secret was being stored. ${signingUnknownSentence(options.webhook.secretName, agent)} ${TOKEN_LEFT}`;
|
|
10810
10810
|
case "stored":
|
|
@@ -11005,7 +11005,7 @@ async function tzmeshRegister(call, io2) {
|
|
|
11005
11005
|
return firstAct(io2, plane, "tzmesh", io2.print, null, completingOptionsOf(options));
|
|
11006
11006
|
}
|
|
11007
11007
|
var TZMESH_READS = `this computer's token for each address it sends to, and the verifier its first act keeps, from its credential file. It never reads a minted token from ${MINTED_TOKEN_VARIABLE}, and refuses the run where that variable is set`;
|
|
11008
|
-
var TZMESH_AFTER_OWN_ERROR = "whether the run's token was minted, the agent registered, or its secret kept is unknown. list_tokens from your tool shows the token by its label, turnzero command, and revoke_token ends it.
|
|
11008
|
+
var TZMESH_AFTER_OWN_ERROR = "whether the run's token was minted, the agent registered, or its secret kept is unknown. list_tokens from your tool shows the token by its label, turnzero command, and revoke_token ends it. tzmesh_list_participants shows the agent, and delete_agent deletes it";
|
|
11009
11009
|
var TZMESH_FIRST_ACT_AFTER_OWN_ERROR = "a request may now be pending in this computer's credential file, and nothing was sent";
|
|
11010
11010
|
var TZMESH_ROW = Object.freeze({
|
|
11011
11011
|
name: TZMESH_SUBCOMMAND,
|
|
@@ -11018,7 +11018,7 @@ var TZMESH_ROW = Object.freeze({
|
|
|
11018
11018
|
statuses: {
|
|
11019
11019
|
done: "the challenge printed, or the agent registered, its secret kept, and the run's token revoked",
|
|
11020
11020
|
failed: "a part failed: the agent was not registered, its secret was not kept, or the run's token was not revoked. The printed lines name what stands and the call that ends it",
|
|
11021
|
-
unknown: "an outcome is unknown: the printed lines name list_tokens,
|
|
11021
|
+
unknown: "an outcome is unknown: the printed lines name list_tokens, tzmesh_list_participants, or list_secrets",
|
|
11022
11022
|
nothing_started: `nothing was minted. An option, the credential file, the file ${TZMESH_OPTION.toFile} names, or this computer's token was refused. Or no request was pending, the platform was too old, or the exchange was refused`
|
|
11023
11023
|
},
|
|
11024
11024
|
variables: [[ORIGIN_VARIABLE, `the platform's address the secret is stored at where the line names no ${TZMESH_OPTION.origin}. It must be ${DEFAULT_COMMAND_ORIGIN} or ${DEVELOPMENT_COMMAND_ORIGIN}.`]],
|