@volter/supercode-teams 0.2.20
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/README.md +119 -0
- package/attention.mjs +191 -0
- package/bin/fleet.mjs +151 -0
- package/bin/teams.mjs +291 -0
- package/bin/workspace/args.mjs +66 -0
- package/bin/workspace/files.mjs +110 -0
- package/bin/workspace/lifecycle.mjs +113 -0
- package/bin/workspace/volter-device.mjs +42 -0
- package/bin/workspace/volter-login.mjs +185 -0
- package/bin/workspace.mjs +726 -0
- package/browser-attach.mjs +90 -0
- package/client.mjs +212 -0
- package/connector/effects.mjs +95 -0
- package/connector/index.d.ts +69 -0
- package/connector/index.mjs +174 -0
- package/connector/native-continuation.d.ts +8 -0
- package/connector/native-continuation.mjs +50 -0
- package/connector/native-effects.mjs +164 -0
- package/context.mjs +34 -0
- package/contracts/adapter-map.json +16 -0
- package/contracts/index.d.ts +299 -0
- package/contracts/index.mjs +37 -0
- package/execution.mjs +206 -0
- package/fleet.mjs +78 -0
- package/index.mjs +12 -0
- package/machine-door.mjs +36 -0
- package/machine.mjs +1398 -0
- package/package.json +80 -0
- package/porthole-hook.cjs +137 -0
- package/remote/job-exec.py +146 -0
- package/remote/wire.py +23 -0
- package/server/arc2-transactions.mjs +125 -0
- package/server/attachment-relay.mjs +149 -0
- package/server/catalog.mjs +7 -0
- package/server/continuations.mjs +56 -0
- package/server/correlation.d.ts +4 -0
- package/server/correlation.mjs +17 -0
- package/server/effects-transactions.mjs +119 -0
- package/server/effects.mjs +97 -0
- package/server/event-routes.mjs +208 -0
- package/server/exports.mjs +46 -0
- package/server/harness-routes.mjs +248 -0
- package/server/index.d.ts +31 -0
- package/server/index.mjs +52 -0
- package/server/ingest.mjs +24 -0
- package/server/node-upgrade.mjs +39 -0
- package/server/otlp/collector-config.d.ts +2 -0
- package/server/otlp/collector-config.mjs +26 -0
- package/server/otlp/decoders/index.d.ts +63 -0
- package/server/otlp/decoders/index.mjs +311 -0
- package/server/otlp/index.d.ts +4 -0
- package/server/otlp/index.mjs +4 -0
- package/server/otlp/projection.d.ts +5 -0
- package/server/otlp/projection.mjs +17 -0
- package/server/otlp/receiver.d.ts +3 -0
- package/server/otlp/receiver.mjs +36 -0
- package/server/otlp/schema/google/protobuf/any.proto +162 -0
- package/server/otlp/schema/google/rpc/status.proto +48 -0
- package/server/otlp/schema/manifest.json +22 -0
- package/server/otlp/schema/opentelemetry/proto/collector/logs/v1/logs_service.proto +77 -0
- package/server/otlp/schema/opentelemetry/proto/collector/metrics/v1/metrics_service.proto +77 -0
- package/server/otlp/schema/opentelemetry/proto/collector/trace/v1/trace_service.proto +77 -0
- package/server/otlp/schema/opentelemetry/proto/common/v1/common.proto +154 -0
- package/server/otlp/schema/opentelemetry/proto/logs/v1/logs.proto +226 -0
- package/server/otlp/schema/opentelemetry/proto/metrics/v1/metrics.proto +735 -0
- package/server/otlp/schema/opentelemetry/proto/resource/v1/resource.proto +45 -0
- package/server/otlp/schema/opentelemetry/proto/trace/v1/trace.proto +359 -0
- package/server/otlp/transport.d.ts +10 -0
- package/server/otlp/transport.mjs +424 -0
- package/server/otlp/wire-codec.mjs +153 -0
- package/server/store-core.mjs +139 -0
- package/server/store-worker.mjs +23 -0
- package/worker/fetch-adapter.mjs +49 -0
- package/worker/index.mjs +127 -0
- package/worker/websocket-duplex.mjs +29 -0
- package/worker/wrangler.toml +38 -0
- package/workspace-client.d.ts +75 -0
- package/workspace-client.mjs +171 -0
- package/workspace-move.mjs +38 -0
package/machine-door.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Which door a machine verb goes through: without a machine name, this OS
|
|
2
|
+
// user's own daemon over its local socket; with one, the Teams server of the
|
|
3
|
+
// selected context, which forwards the channel to that enrolled machine.
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
import { openLocalMachine, openRemoteMachine } from './client.mjs';
|
|
6
|
+
import { WorkspaceContexts, fromContext } from './context.mjs';
|
|
7
|
+
import { teamsHome, paths } from '@volter/teams/home';
|
|
8
|
+
|
|
9
|
+
export async function openMachine({ machine = null, context = null, env = process.env, home = teamsHome(env) } = {}) {
|
|
10
|
+
if (!machine) return openLocalMachine(paths(home).socket);
|
|
11
|
+
const supercodeHome = env.SUPERCODE_HOME ?? resolve(home, '..');
|
|
12
|
+
const contexts = new WorkspaceContexts(supercodeHome);
|
|
13
|
+
const name = context ?? env.SUPERCODE_CONTEXT ?? contexts.read().current;
|
|
14
|
+
if (!name || name === 'local') throw Object.assign(new Error('a remote machine is reached through a Teams context: `supercode teams login …`, then `supercode context use NAME` or --context NAME'), { code: 'invalid_request' });
|
|
15
|
+
const { client, context: selected } = fromContext({ supercodeHome, name, fetch: globalThis.fetch });
|
|
16
|
+
const credential = contexts.credential(selected.credential_ref);
|
|
17
|
+
let machineId = machine;
|
|
18
|
+
if (!machine.startsWith('mach_')) {
|
|
19
|
+
const listed = (await client.team(selected.team_id).machines.list()).items;
|
|
20
|
+
let matches = listed.filter((item) => item.name === machine);
|
|
21
|
+
// A mail address names a machine by its short, lowercased host name
|
|
22
|
+
// (`yuerans-macbook-pro`), while enrollment defaults to the full one
|
|
23
|
+
// (`Yuerans-MacBook-Pro.local`): fall back to that normal form.
|
|
24
|
+
if (!matches.length) matches = listed.filter((item) => normalMachineName(item.name) === normalMachineName(machine));
|
|
25
|
+
if (matches.length !== 1) throw Object.assign(new Error(matches.length ? `machine name ${machine} is ambiguous; use its id` : `machine ${machine} is not accessible`), { code: matches.length ? 'ambiguous_reference' : 'not_found' });
|
|
26
|
+
machineId = matches[0].id;
|
|
27
|
+
}
|
|
28
|
+
const channel = await openRemoteMachine({ origin: selected.origin, teamId: selected.team_id, machineId, token: credential.token });
|
|
29
|
+
channel.machineName = machine;
|
|
30
|
+
return channel;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A machine name in the form mail addresses use: the short host name, lowercased, with anything outside [a-z0-9_-] as `-`. */
|
|
34
|
+
export function normalMachineName(name) {
|
|
35
|
+
return String(name).split('.')[0].toLowerCase().replace(/[^a-z0-9_-]/g, '-');
|
|
36
|
+
}
|