@finalai/final-agent-provider 0.10.1 → 0.12.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/HOSTING.md +334 -245
- package/README.md +125 -46
- package/WORKSPACE-EGRESS.md +11 -11
- package/dist/modules/catalog.d.mts +9 -0
- package/dist/modules/catalog.mjs +21 -0
- package/dist/modules/catalog.mjs.map +7 -0
- package/dist/modules/harnesses/acp-agent.d.mts +4 -0
- package/dist/modules/harnesses/acp-agent.mjs +35 -0
- package/dist/modules/harnesses/acp-agent.mjs.map +7 -0
- package/dist/modules/harnesses/adapters.d.mts +7 -0
- package/dist/modules/harnesses/adapters.mjs +74 -0
- package/dist/modules/harnesses/adapters.mjs.map +7 -0
- package/dist/modules/harnesses/claude-code.d.mts +14 -0
- package/dist/modules/harnesses/claude-code.mjs +79 -0
- package/dist/modules/harnesses/claude-code.mjs.map +7 -0
- package/dist/modules/harnesses/codex.d.mts +12 -0
- package/dist/modules/harnesses/codex.mjs +90 -0
- package/dist/modules/harnesses/codex.mjs.map +7 -0
- package/dist/modules/harnesses/config-fields.d.mts +98 -57
- package/dist/modules/harnesses/config-fields.mjs +58 -35
- package/dist/modules/harnesses/config-fields.mjs.map +3 -3
- package/dist/modules/harnesses/definitions.d.mts +3 -0
- package/dist/modules/harnesses/definitions.mjs +21 -0
- package/dist/modules/harnesses/definitions.mjs.map +7 -0
- package/dist/modules/harnesses/fidelity.d.mts +1 -1
- package/dist/modules/harnesses/fidelity.mjs +17 -14
- package/dist/modules/harnesses/fidelity.mjs.map +2 -2
- package/dist/modules/harnesses/final.d.mts +12 -0
- package/dist/modules/harnesses/final.mjs +70 -0
- package/dist/modules/harnesses/final.mjs.map +7 -0
- package/dist/modules/harnesses/index.d.mts +13 -12
- package/dist/modules/harnesses/index.mjs +86 -45
- package/dist/modules/harnesses/index.mjs.map +3 -3
- package/dist/modules/harnesses/names.d.mts +43 -0
- package/dist/modules/harnesses/names.mjs +59 -0
- package/dist/modules/harnesses/names.mjs.map +7 -0
- package/dist/modules/harnesses/nanocode-claude.d.mts +18 -0
- package/dist/modules/harnesses/nanocode-claude.mjs +101 -0
- package/dist/modules/harnesses/nanocode-claude.mjs.map +7 -0
- package/dist/modules/harnesses/nanocode-codex.d.mts +13 -0
- package/dist/modules/harnesses/nanocode-codex.mjs +64 -0
- package/dist/modules/harnesses/nanocode-codex.mjs.map +7 -0
- package/dist/modules/harnesses/pi.d.mts +12 -0
- package/dist/modules/harnesses/pi.mjs +71 -0
- package/dist/modules/harnesses/pi.mjs.map +7 -0
- package/dist/modules/integrations.d.mts +9 -0
- package/dist/modules/integrations.mjs +29 -0
- package/dist/modules/integrations.mjs.map +7 -0
- package/dist/modules/provider/general.bundle.d.mts +1 -0
- package/dist/modules/provider/general.bundle.mjs +5 -0
- package/dist/modules/provider/general.bundle.mjs.map +7 -0
- package/dist/modules/provider/general.d.mts +11 -0
- package/dist/modules/provider/general.mjs +130 -0
- package/dist/modules/provider/general.mjs.map +7 -0
- package/dist/modules/provider/index.d.mts +3 -0
- package/dist/modules/provider/index.mjs +13 -0
- package/dist/modules/provider/index.mjs.map +7 -0
- package/dist/modules/sandboxes/access.d.mts +34 -0
- package/dist/modules/sandboxes/access.mjs +15 -0
- package/dist/modules/sandboxes/access.mjs.map +7 -0
- package/dist/modules/sandboxes/computer.d.mts +24 -51
- package/dist/modules/sandboxes/computer.mjs +523 -888
- package/dist/modules/sandboxes/computer.mjs.map +3 -3
- package/dist/modules/sandboxes/computers-api.d.mts +3 -2
- package/dist/modules/sandboxes/computers-api.mjs +2 -4
- package/dist/modules/sandboxes/computers-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device-api.d.mts +4 -3
- package/dist/modules/sandboxes/device-api.mjs +2 -4
- package/dist/modules/sandboxes/device-api.mjs.map +2 -2
- package/dist/modules/sandboxes/device.d.mts +6 -6
- package/dist/modules/sandboxes/device.mjs +126 -121
- package/dist/modules/sandboxes/device.mjs.map +3 -3
- package/dist/modules/sandboxes/egress.d.mts +10 -9
- package/dist/modules/sandboxes/egress.mjs +73 -56
- package/dist/modules/sandboxes/egress.mjs.map +2 -2
- package/dist/modules/sandboxes/environment.d.mts +35 -269
- package/dist/modules/sandboxes/environment.mjs +27 -104
- package/dist/modules/sandboxes/environment.mjs.map +3 -3
- package/dist/modules/sandboxes/index.d.mts +9 -69
- package/dist/modules/sandboxes/index.mjs +35 -95
- package/dist/modules/sandboxes/index.mjs.map +3 -3
- package/dist/modules/sandboxes/local.d.mts +29 -0
- package/dist/modules/sandboxes/local.mjs +555 -0
- package/dist/modules/sandboxes/local.mjs.map +7 -0
- package/dist/modules/sandboxes/session.d.mts +0 -3
- package/dist/modules/sandboxes/session.mjs +2 -22
- package/dist/modules/sandboxes/session.mjs.map +2 -2
- package/dist/modules/sandboxes/testing/fake-machine.mjs +0 -28
- package/dist/modules/sandboxes/testing/fake-machine.mjs.map +2 -2
- package/package.json +73 -137
- package/dist/modules/authoring-final-channel.d.mts +0 -3
- package/dist/modules/authoring-final-channel.mjs +0 -10
- package/dist/modules/authoring-final-channel.mjs.map +0 -7
- package/dist/modules/channel-factories.d.mts +0 -40
- package/dist/modules/channel-factories.mjs +0 -212
- package/dist/modules/channel-factories.mjs.map +0 -7
- package/dist/modules/channels/content.d.mts +0 -6
- package/dist/modules/channels/content.mjs +0 -31
- package/dist/modules/channels/content.mjs.map +0 -7
- package/dist/modules/channels/delivery.d.mts +0 -54
- package/dist/modules/channels/delivery.mjs +0 -243
- package/dist/modules/channels/delivery.mjs.map +0 -7
- package/dist/modules/channels/direct-messaging.d.mts +0 -5
- package/dist/modules/channels/direct-messaging.mjs +0 -8
- package/dist/modules/channels/direct-messaging.mjs.map +0 -7
- package/dist/modules/channels/fake-platform.d.mts +0 -36
- package/dist/modules/channels/fake-platform.mjs +0 -168
- package/dist/modules/channels/fake-platform.mjs.map +0 -7
- package/dist/modules/channels/group-messaging.d.mts +0 -5
- package/dist/modules/channels/group-messaging.mjs +0 -8
- package/dist/modules/channels/group-messaging.mjs.map +0 -7
- package/dist/modules/channels/inbound.d.mts +0 -52
- package/dist/modules/channels/inbound.mjs +0 -42
- package/dist/modules/channels/inbound.mjs.map +0 -7
- package/dist/modules/channels/index.d.mts +0 -9
- package/dist/modules/channels/index.mjs +0 -10
- package/dist/modules/channels/index.mjs.map +0 -7
- package/dist/modules/channels/messaging-channel.d.mts +0 -7
- package/dist/modules/channels/messaging-channel.mjs +0 -99
- package/dist/modules/channels/messaging-channel.mjs.map +0 -7
- package/dist/modules/channels/projection.d.mts +0 -36
- package/dist/modules/channels/projection.mjs +0 -233
- package/dist/modules/channels/projection.mjs.map +0 -7
- package/dist/modules/channels/prompt.d.mts +0 -72
- package/dist/modules/channels/prompt.mjs +0 -208
- package/dist/modules/channels/prompt.mjs.map +0 -7
- package/dist/modules/channels/routing.d.mts +0 -5
- package/dist/modules/channels/routing.mjs +0 -53
- package/dist/modules/channels/routing.mjs.map +0 -7
- package/dist/modules/connections.d.mts +0 -11
- package/dist/modules/connections.mjs +0 -16
- package/dist/modules/connections.mjs.map +0 -7
- package/dist/modules/harnesses/acp-describe.d.mts +0 -20
- package/dist/modules/harnesses/acp-describe.mjs +0 -110
- package/dist/modules/harnesses/acp-describe.mjs.map +0 -7
- package/dist/modules/harnesses/local-stdio.d.mts +0 -47
- package/dist/modules/harnesses/local-stdio.mjs +0 -41
- package/dist/modules/harnesses/local-stdio.mjs.map +0 -7
- package/dist/modules/harnesses/remote-acp.d.mts +0 -76
- package/dist/modules/harnesses/remote-acp.mjs +0 -83
- package/dist/modules/harnesses/remote-acp.mjs.map +0 -7
- package/dist/modules/harnesses/remote-claude-code.d.mts +0 -88
- package/dist/modules/harnesses/remote-claude-code.mjs +0 -113
- package/dist/modules/harnesses/remote-claude-code.mjs.map +0 -7
- package/dist/modules/harnesses/remote-client-tls.d.mts +0 -35
- package/dist/modules/harnesses/remote-client-tls.mjs +0 -37
- package/dist/modules/harnesses/remote-client-tls.mjs.map +0 -7
- package/dist/modules/harnesses/remote-codex.d.mts +0 -98
- package/dist/modules/harnesses/remote-codex.mjs +0 -128
- package/dist/modules/harnesses/remote-codex.mjs.map +0 -7
- package/dist/modules/harnesses/remote-pi.d.mts +0 -78
- package/dist/modules/harnesses/remote-pi.mjs +0 -104
- package/dist/modules/harnesses/remote-pi.mjs.map +0 -7
- package/dist/modules/harnesses/remote-url.d.mts +0 -5
- package/dist/modules/harnesses/remote-url.mjs +0 -19
- package/dist/modules/harnesses/remote-url.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-final.d.mts +0 -63
- package/dist/modules/harnesses/serverless-final.mjs +0 -88
- package/dist/modules/harnesses/serverless-final.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-nanocode-claude.d.mts +0 -64
- package/dist/modules/harnesses/serverless-nanocode-claude.mjs +0 -105
- package/dist/modules/harnesses/serverless-nanocode-claude.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-nanocode-codex.d.mts +0 -66
- package/dist/modules/harnesses/serverless-nanocode-codex.mjs +0 -113
- package/dist/modules/harnesses/serverless-nanocode-codex.mjs.map +0 -7
- package/dist/modules/harnesses/serverless-pi.d.mts +0 -64
- package/dist/modules/harnesses/serverless-pi.mjs +0 -98
- package/dist/modules/harnesses/serverless-pi.mjs.map +0 -7
- package/dist/modules/runtime/index.d.mts +0 -7
- package/dist/modules/runtime/index.mjs +0 -18
- package/dist/modules/runtime/index.mjs.map +0 -7
- package/dist/modules/runtime/local-stdio.d.mts +0 -10
- package/dist/modules/runtime/local-stdio.mjs +0 -106
- package/dist/modules/runtime/local-stdio.mjs.map +0 -7
- package/dist/modules/runtime/remote-acp.d.mts +0 -16
- package/dist/modules/runtime/remote-acp.mjs +0 -152
- package/dist/modules/runtime/remote-acp.mjs.map +0 -7
- package/dist/modules/runtime/remote-claude-code.d.mts +0 -5
- package/dist/modules/runtime/remote-claude-code.mjs +0 -47
- package/dist/modules/runtime/remote-claude-code.mjs.map +0 -7
- package/dist/modules/runtime/remote-codex.d.mts +0 -5
- package/dist/modules/runtime/remote-codex.mjs +0 -47
- package/dist/modules/runtime/remote-codex.mjs.map +0 -7
- package/dist/modules/runtime/remote-host.d.mts +0 -127
- package/dist/modules/runtime/remote-host.mjs +0 -387
- package/dist/modules/runtime/remote-host.mjs.map +0 -7
- package/dist/modules/runtime/remote-pi.d.mts +0 -5
- package/dist/modules/runtime/remote-pi.mjs +0 -44
- package/dist/modules/runtime/remote-pi.mjs.map +0 -7
- package/dist/modules/sandboxes/guide.d.mts +0 -35
- package/dist/modules/sandboxes/guide.mjs +0 -119
- package/dist/modules/sandboxes/guide.mjs.map +0 -7
- package/dist/modules/sandboxes/workspace-setup.d.mts +0 -42
- package/dist/modules/sandboxes/workspace-setup.mjs +0 -242
- package/dist/modules/sandboxes/workspace-setup.mjs.map +0 -7
- package/dist/modules/testing/harness.d.mts +0 -9
- package/dist/modules/testing/harness.mjs +0 -123
- package/dist/modules/testing/harness.mjs.map +0 -7
|
@@ -7,13 +7,17 @@ import {
|
|
|
7
7
|
WorkspaceNetworkPolicy,
|
|
8
8
|
workspaceNetworkPolicySchema
|
|
9
9
|
} from "@finalai/agent-protocol/device-egress";
|
|
10
|
-
import {
|
|
10
|
+
import { Capability, FilesAccess, ShellAccess } from "@finalai/agent-protocol";
|
|
11
11
|
import {
|
|
12
|
+
grantAllows,
|
|
12
13
|
SandboxCapability,
|
|
13
14
|
SandboxExecutionOperation,
|
|
14
15
|
withSandboxNetworking,
|
|
15
16
|
withSandboxOverrides
|
|
16
17
|
} from "@finalai/agent-provider/sandbox";
|
|
18
|
+
import {
|
|
19
|
+
deviceCredentialsFor
|
|
20
|
+
} from "./access.mjs";
|
|
17
21
|
import {
|
|
18
22
|
createDeviceApiClient,
|
|
19
23
|
deviceApiStatusOf,
|
|
@@ -1467,67 +1471,80 @@ const workspaceEgressController = (manager) => ({
|
|
|
1467
1471
|
return { expiresAtMs: status.expiresAtMs == null ? null : status.expiresAtMs - 9e4 };
|
|
1468
1472
|
}
|
|
1469
1473
|
});
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1474
|
+
const grantConfigures = (grant) => grantAllows(grant, Capability.Shell, ShellAccess.Execute) && grantAllows(grant, Capability.Files, FilesAccess.Write);
|
|
1475
|
+
const createWorkspaceDeviceNetworking = (options) => {
|
|
1476
|
+
const credentialsOf = (ctx) => deviceCredentialsFor(options.access, {
|
|
1477
|
+
organizationId: ctx.organizationId,
|
|
1478
|
+
projectId: ctx.projectId
|
|
1479
|
+
});
|
|
1480
|
+
return {
|
|
1481
|
+
capabilities: [SandboxCapability.Egress],
|
|
1482
|
+
fetch: options.mcpFetch,
|
|
1483
|
+
validateWorkspaceId: (workspaceId) => {
|
|
1484
|
+
deviceEgressWorkspaceIdSchema.parse(workspaceId);
|
|
1485
|
+
},
|
|
1486
|
+
enabled: ({ ctx, workspaceId, teardown }) => options.needed({
|
|
1482
1487
|
organizationId: ctx.organizationId,
|
|
1483
|
-
|
|
1488
|
+
projectId: ctx.projectId,
|
|
1484
1489
|
workspaceId,
|
|
1485
|
-
|
|
1486
|
-
})
|
|
1487
|
-
|
|
1488
|
-
const
|
|
1490
|
+
teardown
|
|
1491
|
+
}),
|
|
1492
|
+
prepare: async ({ ctx, workspaceId, policy }) => {
|
|
1493
|
+
const client = createDeviceApiClient({ api: options.api });
|
|
1494
|
+
const credentials = credentialsOf(ctx);
|
|
1495
|
+
await preserveWorkspaceNetworkPolicy({
|
|
1496
|
+
client,
|
|
1497
|
+
api: options.api,
|
|
1489
1498
|
organizationId: ctx.organizationId,
|
|
1490
|
-
credentials
|
|
1491
|
-
workspaceId
|
|
1499
|
+
credentials,
|
|
1500
|
+
workspaceId,
|
|
1501
|
+
policy
|
|
1492
1502
|
});
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
controller: (args) => workspaceEgressController(
|
|
1506
|
-
createWorkspaceEgressManager({
|
|
1507
|
-
sandbox: args.sandbox,
|
|
1508
|
-
workspaceId: args.workspaceId,
|
|
1509
|
-
organizationId: args.ctx.organizationId,
|
|
1510
|
-
credentials: args.ctx.credentials,
|
|
1511
|
-
actingUser: args.ctx.actingUser,
|
|
1503
|
+
try {
|
|
1504
|
+
const saved = await client.egress.networkState({
|
|
1505
|
+
organizationId: ctx.organizationId,
|
|
1506
|
+
credentials,
|
|
1507
|
+
workspaceId
|
|
1508
|
+
});
|
|
1509
|
+
return workspaceNetworkPolicySchema.parse(saved.networkPolicy);
|
|
1510
|
+
} catch {
|
|
1511
|
+
return { mode: WorkspaceNetworkPolicy.DenyAll, allow: [] };
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
suspend: ({ ctx, workspaceId }) => suspendWorkspaceEgress({
|
|
1512
1515
|
api: options.api,
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
allowOwnerChange: args.allowOwnerChange ?? args.access === SandboxAccess.Write,
|
|
1522
|
-
authorizeOwnerChange: (actingUserId) => options.authorizeOwnerChange?.({
|
|
1523
|
-
organizationId: args.ctx.organizationId,
|
|
1516
|
+
organizationId: ctx.organizationId,
|
|
1517
|
+
credentials: credentialsOf(ctx),
|
|
1518
|
+
workspaceId,
|
|
1519
|
+
actingUser: ctx.actingUser
|
|
1520
|
+
}),
|
|
1521
|
+
controller: (args) => workspaceEgressController(
|
|
1522
|
+
createWorkspaceEgressManager({
|
|
1523
|
+
sandbox: args.sandbox,
|
|
1524
1524
|
workspaceId: args.workspaceId,
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1525
|
+
organizationId: args.ctx.organizationId,
|
|
1526
|
+
credentials: credentialsOf(args.ctx),
|
|
1527
|
+
actingUser: args.ctx.actingUser,
|
|
1528
|
+
api: options.api,
|
|
1529
|
+
initialNetworkPolicy: args.initialNetworkPolicy,
|
|
1530
|
+
onNetworkPolicy: args.ctx.platformNetworkPolicy,
|
|
1531
|
+
privilegedRun: args.privilegedRun,
|
|
1532
|
+
afterGuard: args.afterGuard,
|
|
1533
|
+
afterBlock: args.afterBlock,
|
|
1534
|
+
namespaceExists: args.namespaceExists,
|
|
1535
|
+
onClose: args.onClose,
|
|
1536
|
+
allowConfiguration: grantConfigures(args.grant) && options.allowConfiguration !== false,
|
|
1537
|
+
allowOwnerChange: args.allowOwnerChange ?? grantConfigures(args.grant),
|
|
1538
|
+
authorizeOwnerChange: (actingUserId) => options.authorizeOwnerChange?.({
|
|
1539
|
+
organizationId: args.ctx.organizationId,
|
|
1540
|
+
workspaceId: args.workspaceId,
|
|
1541
|
+
actingUserId
|
|
1542
|
+
}) ?? Promise.resolve(),
|
|
1543
|
+
onFailure: (event) => args.log?.("workspace_egress.control_failure", { ...event })
|
|
1544
|
+
})
|
|
1545
|
+
)
|
|
1546
|
+
};
|
|
1547
|
+
};
|
|
1531
1548
|
const withWorkspaceEgress = (options) => withSandboxNetworking({
|
|
1532
1549
|
...options,
|
|
1533
1550
|
controller: workspaceEgressController(options.manager)
|