@floless/app 0.138.2 → 0.139.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/autostart.mjs +6 -2
- package/desktop-access-production-manifest.mjs +7 -0
- package/dist/floless-server.cjs +157207 -70887
- package/dist/schemas/model.continuation.v1.schema.json +19 -0
- package/dist/schemas/model.continuation.v2.schema.json +19 -0
- package/dist/schemas/model.query-response.v1.schema.json +95 -0
- package/dist/schemas/model.query-response.v2.schema.json +80 -0
- package/dist/schemas/model.query.v1.schema.json +87 -0
- package/dist/schemas/model.query.v2.schema.json +87 -0
- package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
- package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
- package/dist/schemas/model.snap-query.v1.schema.json +24 -0
- package/dist/schemas/model.snap-result.v1.schema.json +33 -0
- package/dist/schemas/model.snapshot.v1.schema.json +136 -0
- package/dist/schemas/revit.model.v1.schema.json +24 -0
- package/dist/schemas/steel.model.v2.schema.json +45 -6
- package/dist/skills/floless-app-approval/SKILL.md +19 -5
- package/dist/skills/floless-app-bridge/SKILL.md +19 -6
- package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
- package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
- package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
- package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
- package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +142 -21
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
- package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
- package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
- package/dist/skills/floless-app-workflows/SKILL.md +30 -3
- package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
- package/dist/templates/floless-workspace-model-report.flo +77 -0
- package/dist/templates/revit-model.flo +111 -0
- package/dist/web/app.css +415 -177
- package/dist/web/app.js +302 -51
- package/dist/web/aware.js +1357 -1032
- package/dist/web/chat.css +692 -0
- package/dist/web/chat.js +2651 -0
- package/dist/web/commands-revit.js +42 -0
- package/dist/web/commands-shell.js +531 -70
- package/dist/web/commands-steel.js +344 -146
- package/dist/web/commands.js +1 -1
- package/dist/web/index.html +283 -77
- package/dist/web/instructor.js +217 -36
- package/dist/web/left-pane.js +636 -0
- package/dist/web/model-artifact-loader.js +75 -0
- package/dist/web/model-authoring-gestures.js +141 -0
- package/dist/web/model-cad-tools.js +20 -0
- package/dist/web/model-clip-gesture.js +148 -0
- package/dist/web/model-clip-list.js +156 -0
- package/dist/web/model-clip-session.js +274 -0
- package/dist/web/model-clip-three-overlay.js +295 -0
- package/dist/web/model-clip-three-preview.js +59 -0
- package/dist/web/model-editor-contract.js +519 -0
- package/dist/web/model-editor-revit-adapter.js +139 -0
- package/dist/web/model-editor-shell.js +271 -0
- package/dist/web/model-editor-state-recovery.js +44 -0
- package/dist/web/model-editor-steel-adapter.js +415 -0
- package/dist/web/model-editor.css +268 -0
- package/dist/web/model-frame.js +192 -0
- package/dist/web/model-inspector.js +128 -0
- package/dist/web/model-measure.js +390 -0
- package/dist/web/model-navigation-controls.js +246 -0
- package/dist/web/model-orientation-overlay.js +217 -0
- package/dist/web/model-panel-bridge.js +230 -0
- package/dist/web/model-pointer-dock.js +164 -0
- package/dist/web/model-revit-module.js +83 -0
- package/dist/web/model-selection-coordinator.js +151 -0
- package/dist/web/model-selection-tools.js +290 -0
- package/dist/web/model-snap-contract.js +267 -0
- package/dist/web/model-snapping.js +497 -0
- package/dist/web/model-spatial-panel.js +294 -0
- package/dist/web/model-spatial-tools.js +249 -0
- package/dist/web/model-tree.js +47 -0
- package/dist/web/model-viewport-lighting.js +166 -0
- package/dist/web/model-viewport-revit-adapter.js +1224 -0
- package/dist/web/model-viewport-state.js +505 -0
- package/dist/web/model-viewport-steel-adapter.js +150 -0
- package/dist/web/model-viewport-toolbar.js +516 -0
- package/dist/web/model-viewport.js +717 -0
- package/dist/web/panels.js +8 -15
- package/dist/web/renderers.js +3 -0
- package/dist/web/revit-editor.css +35 -0
- package/dist/web/revit-editor.html +74 -0
- package/dist/web/revit-editor.js +845 -0
- package/dist/web/steel-3d-core.js +16 -44
- package/dist/web/steel-3d-view.js +1384 -633
- package/dist/web/steel-canvas-guidance.js +3 -1
- package/dist/web/steel-editor.html +2145 -1255
- package/dist/web/steel-filter.html +5 -1
- package/dist/web/steel-model-v2-commands.js +80 -3
- package/dist/web/steel-split-view.js +5 -39
- package/dist/web/steel-view-generation.js +107 -17
- package/dist/web/vector-3d.html +12 -0
- package/dist/web/workspaces.js +2154 -283
- package/distribution-profile-active.mjs +2 -0
- package/distribution-profile-production.mjs +47 -0
- package/distribution-profile-shared.mjs +8 -0
- package/distribution-profile.mjs +18 -0
- package/distribution-resource-inventory.mjs +81 -0
- package/launch.mjs +18 -10
- package/log.mjs +2 -1
- package/managed-runtime-policy.mjs +104 -0
- package/model-reader-policy-active.mjs +7 -0
- package/network-policy-active.mjs +6 -0
- package/package.json +17 -2
- package/post-update-marker.mjs +3 -1
- package/rvt-production-uat-authority.mjs +60 -0
- package/teardown.mjs +4 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { deeplyFreeze } from './distribution-profile-shared.mjs';
|
|
2
|
+
|
|
3
|
+
export const PRODUCTION_SENTINEL = 'floless-production-v1';
|
|
4
|
+
|
|
5
|
+
export const productionDistributionProfile = deeplyFreeze({
|
|
6
|
+
name: 'production', sentinel: PRODUCTION_SENTINEL,
|
|
7
|
+
cloudEnvironment: 'production',
|
|
8
|
+
identity: {
|
|
9
|
+
distributionId: 'FlolessApp', executable: 'FlolessApp.exe',
|
|
10
|
+
providerExecutable: 'FlolessXeoRvtProvider.exe', displayName: 'FloLess',
|
|
11
|
+
shortcutName: 'FloLess', scheduledTaskName: 'FloLess',
|
|
12
|
+
appUserModelId: 'FloLess.FlolessApp', protocolScheme: 'floless', protocolUri: 'floless://',
|
|
13
|
+
loopbackPort: 4317, updateLane: 'win', lifecycleMutex: 'Local\\FloLess.Lifecycle',
|
|
14
|
+
lifecyclePipe: '\\\\.\\pipe\\FloLess.Lifecycle', logName: 'floless-server.log',
|
|
15
|
+
supervisorName: 'FloLess.Supervisor', postUpdateMarker: '.post-update',
|
|
16
|
+
runValueName: 'FloLess', processMarker: '--floless-production',
|
|
17
|
+
},
|
|
18
|
+
network: {
|
|
19
|
+
apiBase: 'https://api.floless.io/api', webBase: 'https://floless.io',
|
|
20
|
+
authIssuer: 'https://api.floless.io', authAudience: 'floless-app',
|
|
21
|
+
oauthIssuer: null, oauthAudience: null, oauthClientId: null,
|
|
22
|
+
oauthRedirectUri: 'http://127.0.0.1:4317/oauth/callback',
|
|
23
|
+
// The Revit conversion broker lives on its own DNS-only host: api.floless.io is behind Cloudflare,
|
|
24
|
+
// whose 100 MB request cap would refuse the 256 MiB models the reader accepts.
|
|
25
|
+
readerOrigin: null, bridgeOrigin: null, modelServiceOrigin: 'https://models.floless.io', telemetryOrigin: null,
|
|
26
|
+
updateOrigin: 'https://api.floless.io/api/updates/releases',
|
|
27
|
+
},
|
|
28
|
+
storage: {
|
|
29
|
+
rootToken: '%LOCALAPPDATA%\\FlolessApp', app: '%LOCALAPPDATA%\\FlolessApp\\current',
|
|
30
|
+
state: '%LOCALAPPDATA%\\FlolessApp-data', data: '%USERPROFILE%\\.floless', temp: '%TEMP%',
|
|
31
|
+
aware: '%USERPROFILE%\\.aware', cleanup: '%LOCALAPPDATA%\\FlolessApp',
|
|
32
|
+
},
|
|
33
|
+
features: {
|
|
34
|
+
sharedSkillSync: true, updater: true, legacyCredentialAdoption: true, autostart: true,
|
|
35
|
+
moduleAccess: true, providerDiscovery: true, trustEnrollment: true,
|
|
36
|
+
accountSelection: true, httpBootstrap: true, packagedAware: false,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Source/dev has no compiled globals and keeps the existing default. The ordinary
|
|
41
|
+
// product builder injects both and must never accidentally emit a staging identity.
|
|
42
|
+
if (typeof __FLOLESS_DISTRIBUTION_PROFILE__ === 'string'
|
|
43
|
+
&& (__FLOLESS_DISTRIBUTION_PROFILE__ !== productionDistributionProfile.name
|
|
44
|
+
|| typeof __FLOLESS_DISTRIBUTION_SENTINEL__ !== 'string'
|
|
45
|
+
|| __FLOLESS_DISTRIBUTION_SENTINEL__ !== productionDistributionProfile.sentinel)) {
|
|
46
|
+
throw new Error('compiled production distribution profile or sentinel mismatch');
|
|
47
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Aggregate catalogue for tests/build oracles. Product dispatchers import one profile directly. */
|
|
2
|
+
import { deeplyFreeze } from './distribution-profile-shared.mjs';
|
|
3
|
+
import { productionDistributionProfile, PRODUCTION_SENTINEL } from './distribution-profile-production.mjs';
|
|
4
|
+
export const DISTRIBUTION_PROFILES = deeplyFreeze({
|
|
5
|
+
production: productionDistributionProfile,
|
|
6
|
+
});
|
|
7
|
+
export const distributionSentinels = deeplyFreeze({ production: PRODUCTION_SENTINEL });
|
|
8
|
+
export function resolveDistributionProfile(name, sentinel) {
|
|
9
|
+
const profile = DISTRIBUTION_PROFILES[name];
|
|
10
|
+
if (!profile) throw new Error(`unknown compiled distribution profile: ${String(name)}`);
|
|
11
|
+
if (sentinel !== profile.sentinel) throw new Error(`compiled distribution sentinel mismatch for ${profile.name}`);
|
|
12
|
+
return profile;
|
|
13
|
+
}
|
|
14
|
+
const compiledName = typeof __FLOLESS_DISTRIBUTION_PROFILE__ === 'string'
|
|
15
|
+
? __FLOLESS_DISTRIBUTION_PROFILE__ : 'production';
|
|
16
|
+
const compiledSentinel = typeof __FLOLESS_DISTRIBUTION_SENTINEL__ === 'string'
|
|
17
|
+
? __FLOLESS_DISTRIBUTION_SENTINEL__ : PRODUCTION_SENTINEL;
|
|
18
|
+
export const distributionProfile = resolveDistributionProfile(compiledName, compiledSentinel);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DISTRIBUTION_PROFILES } from './distribution-profile.mjs';
|
|
2
|
+
|
|
3
|
+
const normalize = (value) => String(value).replace(/\//g, '\\').replace(/\\+$/g, '').toLowerCase();
|
|
4
|
+
const resource = (kind, name, claim, details = {}) => Object.freeze({ kind, name, claim, ...details });
|
|
5
|
+
|
|
6
|
+
/** Closed, version-controlled inventory used by builders and both future oracles. */
|
|
7
|
+
export function projectDistributionResources(profile) {
|
|
8
|
+
const id = profile.identity;
|
|
9
|
+
const root = profile.storage;
|
|
10
|
+
const protocolKey = `HKCU\\Software\\Classes\\${id.protocolScheme}`;
|
|
11
|
+
const runKey = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
|
|
12
|
+
const exe = `${root.app}\\${id.executable}`;
|
|
13
|
+
const provider = `${root.app}\\${id.providerExecutable}`;
|
|
14
|
+
const env = profile.features.packagedAware
|
|
15
|
+
? {
|
|
16
|
+
PORT: String(id.loopbackPort), FLOLESS_ENV: profile.cloudEnvironment,
|
|
17
|
+
FLOLESS_LICENSE_DIR: `${root.state}\\license`, FLOLESS_HOME: root.data,
|
|
18
|
+
AWARE_HOME: root.aware, AWARE_CLI_DIR: `${root.app}\\aware\\cli`,
|
|
19
|
+
AWARE_MODEL_REFERENCE_PROVIDER: provider, TEMP: root.temp, TMP: root.temp,
|
|
20
|
+
FLOLESS_ARTIFACT_TMP_DIR: root.temp, FLOLESS_LOG_DIR: `${root.state}\\logs`,
|
|
21
|
+
}
|
|
22
|
+
: {
|
|
23
|
+
PORT: String(id.loopbackPort), FLOLESS_ENV: profile.cloudEnvironment,
|
|
24
|
+
FLOLESS_LICENSE_DIR: root.state, FLOLESS_HOME: root.data, AWARE_HOME: root.aware,
|
|
25
|
+
TEMP: root.temp, TMP: root.temp,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const entries = [
|
|
29
|
+
...Object.entries(root).map(([name, claim]) => resource('filesystem-root', name, claim)),
|
|
30
|
+
resource('registry-value', 'autostart', `${runKey}|${id.runValueName}`, { type: 'REG_SZ', data: `"${exe}" --supervise` }),
|
|
31
|
+
resource('registry-key', 'protocol', protocolKey),
|
|
32
|
+
resource('protocol-command', id.protocolScheme, `"${exe}" "%1"`),
|
|
33
|
+
resource('scheduled-task', id.scheduledTaskName, id.scheduledTaskName, { xmlCommand: exe, xmlArguments: '--supervise' }),
|
|
34
|
+
resource('shortcut', id.shortcutName, id.shortcutName, { target: exe }),
|
|
35
|
+
resource('tcp-port', 'loopback', `127.0.0.1:${id.loopbackPort}`),
|
|
36
|
+
resource('process-command', 'server', `${exe} --serve`),
|
|
37
|
+
resource('process-command', 'supervisor', `${exe} --supervise`),
|
|
38
|
+
resource('process-command', 'provider', provider),
|
|
39
|
+
resource('mutex', 'lifecycle', id.lifecycleMutex),
|
|
40
|
+
resource('named-pipe', 'lifecycle', id.lifecyclePipe),
|
|
41
|
+
resource('distribution-id', 'app-id', id.distributionId),
|
|
42
|
+
resource('app-user-model-id', 'shell', id.appUserModelId),
|
|
43
|
+
resource('update-lane', 'update', id.updateLane),
|
|
44
|
+
...Object.entries(profile.network)
|
|
45
|
+
.filter(([, claim]) => typeof claim === 'string')
|
|
46
|
+
.map(([name, claim]) => resource(name === 'oauthRedirectUri' ? 'oauth-redirect' : 'network-origin', name, claim)),
|
|
47
|
+
resource('log', 'server', `${root.state}\\logs\\${id.logName}`),
|
|
48
|
+
resource('post-update-marker', 'marker', `${root.state}\\${id.postUpdateMarker}`),
|
|
49
|
+
resource('process-marker', 'distribution', id.processMarker),
|
|
50
|
+
resource('aware-store', 'home', root.aware),
|
|
51
|
+
resource('bridge-root', 'bridges', `${root.aware}\\bridges`),
|
|
52
|
+
resource('teardown-target', 'app', root.app),
|
|
53
|
+
resource('teardown-target', 'state', root.state),
|
|
54
|
+
resource('teardown-target', 'data', root.data),
|
|
55
|
+
resource('teardown-target', 'aware', root.aware),
|
|
56
|
+
resource('teardown-target', 'cleanup', root.cleanup),
|
|
57
|
+
resource('teardown-target', 'protocol', protocolKey),
|
|
58
|
+
resource('teardown-target', 'task', id.scheduledTaskName),
|
|
59
|
+
resource('teardown-target', 'run-value', `${runKey}|${id.runValueName}`),
|
|
60
|
+
...Object.entries(env).map(([name, claim]) => resource('child-environment', name, claim)),
|
|
61
|
+
];
|
|
62
|
+
return Object.freeze(entries);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const DISTRIBUTION_RESOURCE_INVENTORY = Object.freeze({
|
|
66
|
+
production: projectDistributionResources(DISTRIBUTION_PROFILES.production),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export function findDistributionResourceCollisions(left, right) {
|
|
70
|
+
// Cloud origins and child environment values are shared configuration, not owned OS resources.
|
|
71
|
+
// The collision oracle is for identities/paths/ports/keys/tasks/processes that cannot coexist.
|
|
72
|
+
const sharedKinds = new Set(['network-origin', 'child-environment']);
|
|
73
|
+
const seen = new Map(left
|
|
74
|
+
.filter((entry) => !sharedKinds.has(entry.kind))
|
|
75
|
+
.map((entry) => [`${entry.kind}|${normalize(entry.claim)}`, entry]));
|
|
76
|
+
return right.flatMap((entry) => {
|
|
77
|
+
if (sharedKinds.has(entry.kind)) return [];
|
|
78
|
+
const other = seen.get(`${entry.kind}|${normalize(entry.claim)}`);
|
|
79
|
+
return other ? [{ kind: entry.kind, claim: entry.claim, left: other.name, right: entry.name }] : [];
|
|
80
|
+
});
|
|
81
|
+
}
|
package/launch.mjs
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { spawn, execSync, execFileSync } from 'node:child_process';
|
|
12
12
|
import { dirname, join, basename } from 'node:path';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
14
15
|
import { existsSync } from 'node:fs';
|
|
15
16
|
import http from 'node:http';
|
|
16
17
|
import { createInterface } from 'node:readline';
|
|
@@ -24,6 +25,8 @@ const PORT = Number(process.env.PORT ?? 4317);
|
|
|
24
25
|
const HEALTH_URL = `http://127.0.0.1:${PORT}/api/health`;
|
|
25
26
|
const BROWSER_URL = `http://floless.localhost:${PORT}`;
|
|
26
27
|
const isWin = process.platform === 'win32';
|
|
28
|
+
const isPackagedDistributionExe = (path = process.execPath) => basename(path || '').toLocaleLowerCase('en-US')
|
|
29
|
+
=== distributionProfile.identity.executable.toLocaleLowerCase('en-US');
|
|
27
30
|
|
|
28
31
|
// Write a line, tolerating a dead stdout. The packaged exe is GUI-subsystem (the
|
|
29
32
|
// build flips CUI→GUI so no console window appears at logon — see build/make-sea.mjs);
|
|
@@ -124,16 +127,21 @@ async function waitHealthy(timeoutMs = 30000) {
|
|
|
124
127
|
|
|
125
128
|
// Resolve how to start the server from wherever this launcher is installed:
|
|
126
129
|
// 1. Packaged SEA exe → spawn SELF with --serve (the main.ts dispatcher serves).
|
|
127
|
-
// 2.
|
|
128
|
-
// 3.
|
|
129
|
-
//
|
|
130
|
+
// 2. Repo checkout → run TypeScript source, even when an old dist/ bundle exists.
|
|
131
|
+
// 3. npm install → run the prebuilt bundle (dist/floless-server.cjs --serve).
|
|
132
|
+
// A published install does not ship main.ts, so source availability distinguishes a
|
|
133
|
+
// checkout from an installed package without relying on the current directory.
|
|
130
134
|
// In every case the server is a detached daemon that outlives this launcher.
|
|
131
|
-
function resolveServerStart(
|
|
132
|
-
|
|
135
|
+
export function resolveServerStart({
|
|
136
|
+
packaged = isPackagedDistributionExe(),
|
|
137
|
+
sourceAvailable = existsSync(join(__dirname, 'main.ts')),
|
|
138
|
+
bundleAvailable = existsSync(join(__dirname, 'dist', 'floless-server.cjs')),
|
|
139
|
+
} = {}) {
|
|
133
140
|
if (packaged) return { cmd: process.execPath, args: ['--serve'], shell: false };
|
|
141
|
+
if (sourceAvailable) return { cmd: 'npm', args: ['run', 'start'], shell: isWin };
|
|
134
142
|
const bundle = join(__dirname, 'dist', 'floless-server.cjs');
|
|
135
|
-
if (
|
|
136
|
-
return { cmd: 'npm', args: ['run', 'start'], shell: isWin };
|
|
143
|
+
if (bundleAvailable) return { cmd: process.execPath, args: [bundle, '--serve'], shell: false };
|
|
144
|
+
return { cmd: 'npm', args: ['run', 'start'], shell: isWin };
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
function startServerDetached() {
|
|
@@ -260,7 +268,7 @@ export async function cmdSupervise() {
|
|
|
260
268
|
// `node --supervise` would fail with `bad option: --supervise`; autostart is also
|
|
261
269
|
// never wired in that channel, so a foreground loop with visible logs is the right
|
|
262
270
|
// dev behavior. Detect the SEA channel by the exe basename (`FlolessApp.exe`).
|
|
263
|
-
const isSeaChannel =
|
|
271
|
+
const isSeaChannel = isPackagedDistributionExe();
|
|
264
272
|
if (isSeaChannel && !process.env[SUPERVISE_RESPAWN_ENV]) {
|
|
265
273
|
// First entry on the packaged SEA: re-spawn ourselves detached, then exit, so the
|
|
266
274
|
// logon Scheduled Task that launched us COMPLETES immediately (returns to "Ready")
|
|
@@ -485,7 +493,7 @@ export async function cmdLogin() {
|
|
|
485
493
|
// the action is the host part: floless://restart → "restart"; floless:// → open.
|
|
486
494
|
export function parseAction(arg) {
|
|
487
495
|
let cmd = (arg || 'open').toLowerCase();
|
|
488
|
-
if (cmd.startsWith(
|
|
496
|
+
if (cmd.startsWith(`${distributionProfile.identity.protocolScheme.toLowerCase()}:`)) {
|
|
489
497
|
try { cmd = (new URL(arg).hostname || 'open').toLowerCase(); } catch { cmd = 'open'; }
|
|
490
498
|
}
|
|
491
499
|
return cmd;
|
|
@@ -548,7 +556,7 @@ export async function cmdUninstall(flags = {}) {
|
|
|
548
556
|
log('stopping the server and supervisor…');
|
|
549
557
|
await cmdTeardown();
|
|
550
558
|
|
|
551
|
-
log(
|
|
559
|
+
log(`removing the autostart entry and ${distributionProfile.identity.protocolUri} scheme…`);
|
|
552
560
|
removeRegistryFootprint();
|
|
553
561
|
|
|
554
562
|
let removeAware = decision.removeAware;
|
package/log.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { homedir } from 'node:os';
|
|
8
8
|
import { existsSync, mkdirSync, statSync, renameSync, openSync } from 'node:fs';
|
|
9
|
+
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
9
10
|
|
|
10
11
|
const MAX_BYTES = 2 * 1024 * 1024; // roll once to .1 past 2 MB
|
|
11
12
|
|
|
@@ -20,7 +21,7 @@ export function logDir() {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export function logFilePath() {
|
|
23
|
-
return join(logDir(),
|
|
24
|
+
return join(logDir(), distributionProfile.identity.logName);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export function ensureLogDir() {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Shared policy for FloLess-managed Claude Code and Codex installs.
|
|
2
|
+
// Imported by the server (managed-runtimes.ts) AND by build/inspect-runtime-pin.mjs, so the
|
|
3
|
+
// inspection that authors a pin and the install that verifies it can never drift apart.
|
|
4
|
+
// See docs/superpowers/specs/2026-09-17-managed-cli-runtimes-plan.md §1–§2.
|
|
5
|
+
import { execFile } from 'node:child_process';
|
|
6
|
+
import { createHash } from 'node:crypto';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The exact `npm` argument list for installing a pin. Every flag that affects what lands on disk is
|
|
10
|
+
* here: `--ignore-scripts` (no package code runs), `--no-bin-links` (no .bin shims or links; FloLess
|
|
11
|
+
* launches `entry` directly). Inspection runs the same list, so its manifest matches a real install.
|
|
12
|
+
*/
|
|
13
|
+
export const NPM_CI_ARGS = Object.freeze([
|
|
14
|
+
'ci', '--ignore-scripts', '--no-bin-links', '--no-audit', '--no-fund', '--prefer-offline', '--json',
|
|
15
|
+
// The pinned binaries are optional, platform-specific dependencies: never let user config omit them,
|
|
16
|
+
// and select them for Windows x64 whatever architecture npm itself runs on.
|
|
17
|
+
'--include=optional', '--os=win32', '--cpu=x64',
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
/** npm writes this bookkeeping file into every install; it is not package content. */
|
|
21
|
+
export const NPM_BOOKKEEPING_FILE = 'node_modules/.package-lock.json';
|
|
22
|
+
|
|
23
|
+
/** npm majors the install path is tested against. Older is refused; newer proceeds, flagged. */
|
|
24
|
+
export const NPM_MIN_MAJOR = 9;
|
|
25
|
+
export const NPM_TESTED_MAX_MAJOR = 11;
|
|
26
|
+
|
|
27
|
+
/** Expected Authenticode publisher (the certificate subject's O=) per runtime. */
|
|
28
|
+
export const PUBLISHERS = Object.freeze({ claude: 'Anthropic, PBC', codex: 'OpenAI OpCo, LLC' });
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Executables allowed WITHOUT a valid publisher signature, by exact path and sha256. Adding an entry
|
|
32
|
+
* is a reviewed code change; nothing else unsigned can enter a pin.
|
|
33
|
+
*/
|
|
34
|
+
export const UNSIGNED_ALLOWLIST = Object.freeze([
|
|
35
|
+
{
|
|
36
|
+
runtime: 'codex',
|
|
37
|
+
path: 'node_modules/@openai/codex-win32-x64/vendor/x86_64-pc-windows-msvc/codex-path/rg.exe',
|
|
38
|
+
sha256: '14231169855ec5205cf5a1b6f1db358ff4aed4247c86b69ce8aae647c77f6680',
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
const PIN_HASH_TAG = 'floless-runtime-pin/v1\n';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The pin's identity: sha256 over a versioned tag and length-prefixed records of the three pin files,
|
|
46
|
+
* in fixed order. Records carry each file's canonical JSON (JSON.stringify of the parsed value), which
|
|
47
|
+
* is identical under tsx, esbuild's JSON loader and the inspection script.
|
|
48
|
+
*
|
|
49
|
+
* @param {{ packageJson: unknown, lockfile: unknown, pin: unknown }} files
|
|
50
|
+
* @returns {string} lowercase hex sha256
|
|
51
|
+
*/
|
|
52
|
+
export function pinHash(files) {
|
|
53
|
+
const hash = createHash('sha256');
|
|
54
|
+
hash.update(PIN_HASH_TAG, 'utf8');
|
|
55
|
+
for (const [name, value] of [['package.json', files.packageJson], ['package-lock.json', files.lockfile], ['pin.json', files.pin]]) {
|
|
56
|
+
const body = Buffer.from(JSON.stringify(value), 'utf8');
|
|
57
|
+
hash.update(`${name}\0${body.length}\0`, 'utf8');
|
|
58
|
+
hash.update(body);
|
|
59
|
+
}
|
|
60
|
+
return hash.digest('hex');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The short id used in folder names: the first 16 hex characters of the pin hash. */
|
|
64
|
+
export function pinIdOf(hash) {
|
|
65
|
+
return hash.slice(0, 16);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Authenticode facts for each path, in order, read by Windows PowerShell. Reading a signature never runs
|
|
70
|
+
* the file. The list is assigned to a variable before piping: PowerShell 5.1's ConvertFrom-Json emits a
|
|
71
|
+
* JSON array as ONE object, and piping it directly would hand ForEach-Object the whole array at once.
|
|
72
|
+
*
|
|
73
|
+
* @param {string[]} paths absolute paths
|
|
74
|
+
* @returns {Promise<{ status: string, subject: string, leafSha256: string }[]>}
|
|
75
|
+
*/
|
|
76
|
+
export function readAuthenticodeSignatures(paths) {
|
|
77
|
+
// The signer decision must come from the built-in cmdlet: pin the module path to the two system roots
|
|
78
|
+
// (never the user-writable CurrentUser folder, which 5.1 would otherwise search first) and load the
|
|
79
|
+
// Security module from its absolute system path, as desktop-provider-capabilities does.
|
|
80
|
+
const script = `$ErrorActionPreference='Stop'
|
|
81
|
+
$env:PSModulePath = @((Join-Path $env:ProgramFiles 'WindowsPowerShell\\Modules'), (Join-Path $env:SystemRoot 'system32\\WindowsPowerShell\\v1.0\\Modules')) -join ';'
|
|
82
|
+
Import-Module (Join-Path $env:SystemRoot 'system32\\WindowsPowerShell\\v1.0\\Modules\\Microsoft.PowerShell.Security\\Microsoft.PowerShell.Security.psd1') -ErrorAction Stop
|
|
83
|
+
$paths = [Console]::In.ReadToEnd() | ConvertFrom-Json; @($paths | ForEach-Object {
|
|
84
|
+
$s = Microsoft.PowerShell.Security\\Get-AuthenticodeSignature -LiteralPath $_
|
|
85
|
+
$c = $s.SignerCertificate
|
|
86
|
+
[pscustomobject]@{ status = [string]$s.Status; subject = if ($c) { $c.Subject } else { '' };
|
|
87
|
+
leafSha256 = if ($c) { $c.GetCertHashString([System.Security.Cryptography.HashAlgorithmName]::SHA256).ToLowerInvariant() } else { '' } }
|
|
88
|
+
}) | ConvertTo-Json -Compress -Depth 3`;
|
|
89
|
+
// Windows PowerShell 5.1 builds its own module path when PSModulePath is absent. Inheriting one from a
|
|
90
|
+
// PowerShell 7 parent (a pwsh terminal, CI) points it at modules it cannot load, and
|
|
91
|
+
// Get-AuthenticodeSignature then fails with "the module could not be loaded".
|
|
92
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => name.toLowerCase() !== 'psmodulepath'));
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const child = execFile('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 120_000, env }, (err, stdout) => {
|
|
95
|
+
if (err) return reject(err);
|
|
96
|
+
let parsed;
|
|
97
|
+
try { parsed = JSON.parse(String(stdout)); } catch (parseError) { return reject(parseError); }
|
|
98
|
+
const rows = Array.isArray(parsed) ? parsed : [parsed];
|
|
99
|
+
if (rows.length !== paths.length) return reject(new Error(`expected ${paths.length} signatures, read ${rows.length}`));
|
|
100
|
+
resolve(rows);
|
|
101
|
+
});
|
|
102
|
+
child.stdin?.end(JSON.stringify(paths));
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
2
|
+
|
|
3
|
+
/** The reader destination is one production-profile fact shared by enrollment and verification. */
|
|
4
|
+
export const MODEL_READER_DESTINATION = distributionProfile.network.modelServiceOrigin;
|
|
5
|
+
if (typeof MODEL_READER_DESTINATION !== 'string') {
|
|
6
|
+
throw new Error('model reader destination is unavailable in this distribution');
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Source/production credential destinations, including the explicit developer staging channel. */
|
|
2
|
+
export const LICENSING_ENVIRONMENTS = Object.freeze({
|
|
3
|
+
production: Object.freeze({ apiBase: 'https://api.floless.io/api', webBase: 'https://floless.io' }),
|
|
4
|
+
staging: Object.freeze({ apiBase: 'https://api.stage.floless.io/api', webBase: 'https://stage.floless.io' }),
|
|
5
|
+
});
|
|
6
|
+
export const TRUSTED_API_ORIGINS = Object.freeze(['https://api.floless.io', 'https://api.stage.floless.io']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floless/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.139.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"test:project-import-pdf": "node build/run-required-tests.mjs projects-store.test.ts rfi-import.test.ts",
|
|
27
27
|
"test:platform": "node build/run-tests.mjs --platform-only",
|
|
28
28
|
"build": "node build/bundle.mjs",
|
|
29
|
-
"build:exe": "node build/
|
|
29
|
+
"build:exe": "node build/build-production.mjs",
|
|
30
|
+
"build:exe:app": "node build/bundle.mjs && node build/make-sea.mjs",
|
|
31
|
+
"build:xeorvt-provider": "node build/bundle-xeorvt-provider.mjs && node build/make-xeorvt-provider-sea.mjs",
|
|
30
32
|
"verify:skills": "node build/verify-shipped-skills.mjs",
|
|
31
33
|
"verify:skill-versions": "node build/verify-skill-versions.mjs",
|
|
32
34
|
"verify:package-version": "node build/verify-package-version.mjs",
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
"verify:flo-naming": "node build/verify-flo-naming.mjs",
|
|
37
39
|
"verify:forward-merge": "node build/verify-forward-merge.mjs",
|
|
38
40
|
"verify:no-title": "node build/verify-no-title.mjs",
|
|
41
|
+
"verify:runtime-pins": "node build/verify-runtime-pins.mjs",
|
|
39
42
|
"verify:native-steel": "node build/verify-native-steel.mjs",
|
|
40
43
|
"verify:no-native-select": "node build/verify-no-native-select.mjs",
|
|
41
44
|
"verify:scrollbars": "node build/verify-scrollbars.mjs",
|
|
@@ -50,11 +53,14 @@
|
|
|
50
53
|
"verify:change-reasons": "node build/verify-change-reasons.mjs",
|
|
51
54
|
"verify:contract-publication": "node build/verify-contract-publication.mjs",
|
|
52
55
|
"verify:no-agent-trailer": "node build/verify-no-agent-trailer.mjs",
|
|
56
|
+
"verify:release-commit": "node build/verify-release-commit.mjs",
|
|
53
57
|
"verify:no-license-bypass": "node build/verify-no-license-bypass.mjs",
|
|
54
58
|
"verify:app-publication": "node build/verify-app-publication-writers.mjs",
|
|
55
59
|
"verify:guards-wired": "node build/verify-guards-wired.mjs",
|
|
56
60
|
"verify:command-registry": "node build/verify-command-registry.mjs",
|
|
57
61
|
"verify:instructor-impact": "node build/verify-instructor-impact.mjs",
|
|
62
|
+
"verify:user-copy-impact": "node build/verify-user-copy-impact.mjs",
|
|
63
|
+
"verify:user-copy": "node build/verify-user-copy.mjs",
|
|
58
64
|
"verify:review-rounds": "node build/verify-review-rounds.mjs",
|
|
59
65
|
"verify:instructor-coverage": "node build/verify-instructor-coverage.mjs",
|
|
60
66
|
"verify:instructor-steps": "node build/verify-instructor-steps.mjs",
|
|
@@ -70,6 +76,7 @@
|
|
|
70
76
|
"verify:skill-scripts": "node build/verify-skill-scripts.mjs"
|
|
71
77
|
},
|
|
72
78
|
"devDependencies": {
|
|
79
|
+
"ajv": "8.17.1",
|
|
73
80
|
"@fastify/static": "^8.0.0",
|
|
74
81
|
"@types/node": "^22.0.0",
|
|
75
82
|
"chokidar": "^4.0.0",
|
|
@@ -84,5 +91,13 @@
|
|
|
84
91
|
"typescript": "^5.6.0",
|
|
85
92
|
"write-excel-file": "^4.1.1",
|
|
86
93
|
"yaml": "^2.9.0"
|
|
94
|
+
},
|
|
95
|
+
"dependencies": {
|
|
96
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.263",
|
|
97
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
98
|
+
"zod": "4.6.5"
|
|
99
|
+
},
|
|
100
|
+
"overrides": {
|
|
101
|
+
"fast-uri": "3.1.6"
|
|
87
102
|
}
|
|
88
103
|
}
|
package/post-update-marker.mjs
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import { existsSync, writeFileSync, rmSync, statSync } from 'node:fs';
|
|
25
25
|
import { homedir } from 'node:os';
|
|
26
26
|
import { dirname, join } from 'node:path';
|
|
27
|
+
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
27
28
|
|
|
28
29
|
const FRESH_MS = 120_000;
|
|
29
30
|
|
|
@@ -32,12 +33,13 @@ export function markerPath() {
|
|
|
32
33
|
const override = (process.env.FLOLESS_POST_UPDATE_MARKER ?? '').trim();
|
|
33
34
|
if (override) return override;
|
|
34
35
|
const root = process.env.FLOLESS_HOME ?? join(homedir(), '.floless');
|
|
35
|
-
return join(root,
|
|
36
|
+
return join(root, distributionProfile.identity.postUpdateMarker);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
/** Legacy location 0.12.1 wrote to (install root, execPath-derived). Read for back-compat. */
|
|
39
40
|
function legacyMarkerPath() {
|
|
40
41
|
if ((process.env.FLOLESS_POST_UPDATE_MARKER ?? '').trim()) return null; // tests pin a single path
|
|
42
|
+
if (distributionProfile.name !== 'production') return null;
|
|
41
43
|
try {
|
|
42
44
|
return join(dirname(dirname(process.execPath)), '.floless-post-update');
|
|
43
45
|
} catch {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const POLICY_PATH = join(fileURLToPath(new URL('.', import.meta.url)), 'rvt-production-uat-policy.json');
|
|
6
|
+
const METHODS = new Set(['DELETE', 'GET', 'PATCH', 'POST', 'PUT']);
|
|
7
|
+
|
|
8
|
+
export function parseRvtProductionUatPolicy(raw) {
|
|
9
|
+
let policy;
|
|
10
|
+
try { policy = JSON.parse(raw); } catch { throw new Error('RVT production UAT policy is not valid JSON'); }
|
|
11
|
+
if (!policy || typeof policy !== 'object' || Array.isArray(policy)
|
|
12
|
+
|| JSON.stringify(Object.keys(policy).sort()) !== JSON.stringify(['requests', 'schema', 'state', 'tenant'])) {
|
|
13
|
+
throw new Error('RVT production UAT policy has missing or extra fields');
|
|
14
|
+
}
|
|
15
|
+
if (policy.schema !== 'floless-rvt-production-uat-policy/v1') throw new Error('unsupported RVT production UAT policy');
|
|
16
|
+
if (policy.state === 'authority-unallocated') {
|
|
17
|
+
if (policy.tenant !== null || !Array.isArray(policy.requests) || policy.requests.length !== 0) {
|
|
18
|
+
throw new Error('unallocated RVT production UAT policy must authorize no tenant or requests');
|
|
19
|
+
}
|
|
20
|
+
return Object.freeze({ ...policy, requests: Object.freeze([]) });
|
|
21
|
+
}
|
|
22
|
+
if (policy.state !== 'allocated' || typeof policy.tenant !== 'string' || !policy.tenant.trim()) {
|
|
23
|
+
throw new Error('RVT production UAT tenant authority is invalid');
|
|
24
|
+
}
|
|
25
|
+
if (!Array.isArray(policy.requests) || policy.requests.length === 0) throw new Error('allocated RVT production UAT policy has no requests');
|
|
26
|
+
let previous = '';
|
|
27
|
+
for (const [index, request] of policy.requests.entries()) {
|
|
28
|
+
const keys = ['cleanup', 'id', 'method', 'origin', 'resourcePrefix', 'routePrefix', 'trafficClass'];
|
|
29
|
+
if (!request || typeof request !== 'object' || Array.isArray(request)
|
|
30
|
+
|| JSON.stringify(Object.keys(request).sort()) !== JSON.stringify(keys)) throw new Error(`requests[${index}] has missing or extra fields`);
|
|
31
|
+
if (typeof request.id !== 'string' || request.id <= previous) throw new Error('RVT production UAT request IDs must be unique and sorted');
|
|
32
|
+
previous = request.id;
|
|
33
|
+
if (!METHODS.has(request.method) || request.origin !== 'https://api.floless.io'
|
|
34
|
+
|| typeof request.routePrefix !== 'string' || !request.routePrefix.startsWith('/api/')
|
|
35
|
+
|| typeof request.resourcePrefix !== 'string' || !request.resourcePrefix
|
|
36
|
+
|| !['read', 'mutation'].includes(request.trafficClass)
|
|
37
|
+
|| typeof request.cleanup !== 'string' || !request.cleanup) throw new Error(`requests[${index}] is invalid`);
|
|
38
|
+
if (request.trafficClass === 'mutation' && request.cleanup === 'none') throw new Error(`requests[${index}] mutation has no cleanup action`);
|
|
39
|
+
const expectedClass = request.method === 'GET' ? 'read' : 'mutation';
|
|
40
|
+
if (request.trafficClass !== expectedClass) throw new Error(`requests[${index}] method/traffic class is inconsistent`);
|
|
41
|
+
if (!(request.resourcePrefix === policy.tenant || request.resourcePrefix.startsWith(`${policy.tenant}/`))) {
|
|
42
|
+
throw new Error(`requests[${index}] resource prefix is outside the allocated tenant`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Object.freeze({ ...policy, requests: Object.freeze(policy.requests.map((request) => Object.freeze({ ...request }))) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function readRvtProductionUatPolicy(path = POLICY_PATH) {
|
|
49
|
+
return parseRvtProductionUatPolicy(readFileSync(path, 'utf8'));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function authorizeRvtProductionUatRequest({ policy = readRvtProductionUatPolicy(), tenant, origin, method, route, resource }) {
|
|
53
|
+
if (policy.state !== 'allocated') throw new Error('dedicated RVT production test tenant/request authority is unavailable');
|
|
54
|
+
if (tenant !== policy.tenant) throw new Error('RVT production UAT tenant is outside the allocated authority');
|
|
55
|
+
const withinPrefix = (value, prefix) => value === prefix || value.startsWith(prefix.endsWith('/') ? prefix : `${prefix}/`);
|
|
56
|
+
const match = policy.requests.find((request) => request.origin === origin && request.method === method
|
|
57
|
+
&& withinPrefix(route, request.routePrefix) && withinPrefix(resource, request.resourcePrefix));
|
|
58
|
+
if (!match) throw new Error('RVT production UAT request is outside the closed allowlist');
|
|
59
|
+
return match;
|
|
60
|
+
}
|
package/teardown.mjs
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
// no I/O. The executors that perform real side effects live in launch.mjs / main.ts
|
|
8
8
|
// and are exercised by the human's real teardown test, never here.
|
|
9
9
|
//
|
|
10
|
-
// Shipped to npm (added to package.json `files`)
|
|
10
|
+
// Shipped to npm (added to package.json `files`); distribution-profile.mjs is shipped beside it.
|
|
11
|
+
import { distributionProfile } from './distribution-profile-active.mjs';
|
|
11
12
|
|
|
12
13
|
// --- registry-key constants (single source — must match autostart.ts/protocol.ts) ---
|
|
13
14
|
// autostart.ts: RUN_KEY + VALUE_NAME='FloLess'; protocol.ts: BASE.
|
|
14
15
|
export const RUN_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
|
|
15
|
-
export const RUN_VALUE =
|
|
16
|
-
export const PROTOCOL_KEY =
|
|
16
|
+
export const RUN_VALUE = distributionProfile.identity.runValueName;
|
|
17
|
+
export const PROTOCOL_KEY = `HKCU\\Software\\Classes\\${distributionProfile.identity.protocolScheme}`;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Decide what `floless-app uninstall` should do about the AWARE runtime.
|