office-core 0.1.0
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/.runtime-dist/scripts/bundle-host-package.js +46 -0
- package/.runtime-dist/scripts/demo-multi-agent.js +130 -0
- package/.runtime-dist/scripts/home-agent-host.js +1403 -0
- package/.runtime-dist/scripts/host-doctor.js +28 -0
- package/.runtime-dist/scripts/host-login.js +32 -0
- package/.runtime-dist/scripts/host-menu.js +227 -0
- package/.runtime-dist/scripts/host-open.js +20 -0
- package/.runtime-dist/scripts/install-host.js +108 -0
- package/.runtime-dist/scripts/lib/host-config.js +171 -0
- package/.runtime-dist/scripts/lib/local-runner.js +287 -0
- package/.runtime-dist/scripts/office-cli.js +698 -0
- package/.runtime-dist/scripts/run-local-project.js +277 -0
- package/.runtime-dist/src/auth/session-token.js +62 -0
- package/.runtime-dist/src/discord/outbox-ledger.js +56 -0
- package/.runtime-dist/src/do/AgentDO.js +205 -0
- package/.runtime-dist/src/do/GatewayShardDO.js +9 -0
- package/.runtime-dist/src/do/ProjectDO.js +829 -0
- package/.runtime-dist/src/do/TaskDO.js +356 -0
- package/.runtime-dist/src/index.js +123 -0
- package/.runtime-dist/src/project/office-view.js +405 -0
- package/.runtime-dist/src/project/read-model.js +79 -0
- package/.runtime-dist/src/routes/agents-bootstrap.js +9 -0
- package/.runtime-dist/src/routes/agents-descriptor.js +12 -0
- package/.runtime-dist/src/routes/agents-events.js +17 -0
- package/.runtime-dist/src/routes/agents-heartbeat.js +21 -0
- package/.runtime-dist/src/routes/agents-task-context.js +17 -0
- package/.runtime-dist/src/routes/bundles.js +198 -0
- package/.runtime-dist/src/routes/local-host.js +49 -0
- package/.runtime-dist/src/routes/projects.js +119 -0
- package/.runtime-dist/src/routes/tasks.js +67 -0
- package/.runtime-dist/src/task/reducer.js +464 -0
- package/.runtime-dist/src/types/project.js +1 -0
- package/.runtime-dist/src/types/protocol.js +3 -0
- package/.runtime-dist/src/types/runtime.js +1 -0
- package/README.md +148 -0
- package/bin/double-penetration-host.mjs +83 -0
- package/package.json +48 -0
- package/public/index.html +1581 -0
- package/public/install-host.ps1 +64 -0
- package/scripts/run-runtime-script.mjs +43 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
param(
|
|
2
|
+
[string]$BaseUrl = "https://office-core.reif-ianson94.workers.dev",
|
|
3
|
+
[string]$ProjectId = "prj_local",
|
|
4
|
+
[string]$Workdir = (Get-Location).Path,
|
|
5
|
+
[string]$EnrollmentSecret = "office-host-enroll-secret",
|
|
6
|
+
[switch]$StartHost,
|
|
7
|
+
[switch]$OpenUi
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
$ErrorActionPreference = "Stop"
|
|
11
|
+
|
|
12
|
+
function Require-Command($Name) {
|
|
13
|
+
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
|
|
14
|
+
throw "Required command not found: $Name"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$BaseUrl = $BaseUrl.TrimEnd("/")
|
|
19
|
+
Require-Command npm
|
|
20
|
+
|
|
21
|
+
$tempDir = Join-Path $env:TEMP ("office-core-install-" + [guid]::NewGuid().ToString("N"))
|
|
22
|
+
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
$packageUrl = "$BaseUrl/downloads/office-core.tgz"
|
|
26
|
+
$packagePath = Join-Path $tempDir "office-core.tgz"
|
|
27
|
+
|
|
28
|
+
Write-Host "Downloading Office Core package from $packageUrl" -ForegroundColor Cyan
|
|
29
|
+
Invoke-WebRequest -Uri $packageUrl -OutFile $packagePath
|
|
30
|
+
|
|
31
|
+
Write-Host "Installing Office Core CLI globally..." -ForegroundColor Cyan
|
|
32
|
+
npm install -g $packagePath
|
|
33
|
+
if ($LASTEXITCODE -ne 0) {
|
|
34
|
+
throw "npm install -g failed"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Write-Host "Registering this machine with $BaseUrl ..." -ForegroundColor Cyan
|
|
38
|
+
office-core install --baseUrl $BaseUrl --project $ProjectId --workdir $Workdir --enrollSecret $EnrollmentSecret
|
|
39
|
+
if ($LASTEXITCODE -ne 0) {
|
|
40
|
+
throw "office-core install failed"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ($StartHost) {
|
|
44
|
+
Write-Host "Starting configured office core host..." -ForegroundColor Cyan
|
|
45
|
+
Start-Process -FilePath "office-core" -ArgumentList "start"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ($OpenUi) {
|
|
49
|
+
Write-Host "Opening office in browser..." -ForegroundColor Cyan
|
|
50
|
+
Start-Process "$BaseUrl/?projectId=$ProjectId"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
Write-Host ""
|
|
54
|
+
Write-Host "Machine installed." -ForegroundColor Green
|
|
55
|
+
Write-Host "Next commands:" -ForegroundColor Green
|
|
56
|
+
Write-Host " office-core"
|
|
57
|
+
Write-Host " office-core doctor"
|
|
58
|
+
Write-Host " office-core start"
|
|
59
|
+
Write-Host ""
|
|
60
|
+
Write-Host "Aliases also work: office-host, dp-host" -ForegroundColor DarkGray
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
|
|
64
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import process from 'node:process';
|
|
6
|
+
import { spawnSync } from 'node:child_process';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
10
|
+
const [relativeScript, ...args] = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
if (!relativeScript) {
|
|
13
|
+
console.error('Usage: node scripts/run-runtime-script.mjs <relative-script.ts> [...args]');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const tscCli = path.join(rootDir, 'node_modules', 'typescript', 'bin', 'tsc');
|
|
18
|
+
const compiledScript = path.join(rootDir, '.runtime-dist', relativeScript).replace(/\.ts$/, '.js');
|
|
19
|
+
const sourceScript = path.join(rootDir, relativeScript);
|
|
20
|
+
|
|
21
|
+
if (existsSync(tscCli) && existsSync(sourceScript)) {
|
|
22
|
+
const compile = spawnSync(process.execPath, [tscCli, '-p', path.join(rootDir, 'tsconfig.runtime.build.json')], {
|
|
23
|
+
cwd: rootDir,
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
env: process.env,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if ((compile.status ?? 1) !== 0) {
|
|
29
|
+
process.exit(compile.status ?? 1);
|
|
30
|
+
}
|
|
31
|
+
} else if (!existsSync(compiledScript)) {
|
|
32
|
+
console.error(`Missing compiled runtime: ${compiledScript}`);
|
|
33
|
+
console.error('This install does not include a prebuilt runtime and TypeScript is not available to build one.');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const run = spawnSync(process.execPath, [compiledScript, ...args], {
|
|
38
|
+
cwd: rootDir,
|
|
39
|
+
stdio: 'inherit',
|
|
40
|
+
env: process.env,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
process.exit(run.status ?? 1);
|