NorskManager class

The entrypoint for all Norsk Manager applications

Signature:

export declare class NorskManager

Example

const norsk = await NorskManager.connect({ url: "localhost:6790" });

Properties

Property Type Description

version

VersionInfo

Norsk Runtime version information

Methods

Method Modifiers Description

abortMigration(jobId, sourceRole, targetRole, reason)

Phase E — abort an in-flight migration. Manager dispatches NodeControllerMigrationAbort to both the source and target workers; AutoManager updates its state machine.

appendAuditEntry(source, kind, payload)

Append a caller-supplied event to the durable audit log — for norsk-mgr-origin actions that don’t pass through another RPC. The daemon assigns the seq and chains it.

close()

Close down the Norsk connection

clusterMemberRegister(req)

Worker-facing call: the worker presents its registration token and tells Manager where to dial back. On success Manager raises Online on its provider bus and dials the worker; on Unauthenticated the token is unknown (or has been deregistered).

Most consumers won’t call this directly — norsk-ctl --mode=worker --token=… --manager-url=… does it on the worker side.

completeJob(jobId)

Stops a running job

connect(settings)

static

Connect to the Norsk Manager

createAwsNode(node)

Spawn a new EC2 instance running the worker image, and make it available for picking up jobs

createBundle(bundle)

Create a bundle (AutoManager v1). The bundle is passed in raw PB form — auto-manager (or any other consumer) is expected to convert its own typed Bundle to PB before calling. Returns the assigned bundleId so the caller can correlate later events.

createJob(job)

Create a new job

createMockNode(nodeId, tags)

Provision a node from the in-process mock provider’s URL pool (NORSK_MOCK_WORKER_URLS). Pops the next URL, raises Online with the supplied nodeId. Test-only — fails with ResourceExhausted if the pool is empty.

createOciNode(node)

Spawn a new OCI instance running the worker image, and make it available for picking up jobs

deleteBundle(bundleId)

Delete a bundle (AutoManager v1).

deleteJob(jobId)

Deletes a job

deregisterClusterNode(nodeId)

Remove a cluster slot. If a worker is currently connected on this slot, its gRPC stream is closed and any running jobs are stopped. The token is invalidated.

eventStream(settings)

Provides a stream of the activity that is happening on the server-side. Reacting to these events is essential for the creation of client-side management logic.

getAuditLog(limit)

The most recent audit-log entries (newest first), plus whether the daemon’s hash chain verified on its last boot.

jobById(id)

Search for jobs by id

jobSearch(settings)

Search for jobs by tag/date/etc. See JobSearchSettings

listClusterNodes()

List all registered cluster slots (active + inactive). Includes the tokens — visible to operators so they can re-copy on demand.

listNodes()

Return a list a all the nodes the manager knows about.

migrateJob(jobId, targetNodeId, migrationId)

Phase E — initiate migration of a running job from its current node to targetNodeId. Manager launches a second instance of the same Job with role="migrationTarget"; AutoManager drives the cutover handshake.

notifyMigrationCutoverApply(targetJobKey, lastOutputTimestampNs)

Phase E — tell the target worker "source stopped at T, resume output from there".

notifyMigrationCutoverReady(sourceJobKey)

Phase E — tell the source worker "target is ready, pick a timestamp and stop output". AutoManager calls this when it receives MigrationTargetReadyEvent from the target.

pruneAuditLog(beforeTimestampMs)

Operator-initiated retention prune of the audit log. Clears entries strictly older than beforeTimestampMs (0 = clear everything). The daemon front-prunes, records a checkpoint so the kept chain still verifies, and appends an audit-pruned marker. Returns how many entries were removed and the checkpoint boundary seq.

registerClusterNode(nodeName, pool)

Pre-register a cluster slot. Returns a nodeId and a one-shot token that must be handed to a worker — the worker calls clusterMemberRegister with the token + its listen address/port + hardware info. Until the worker calls in, the slot is registered-but-inactive.

setClusterNodePool(nodeId, pool)

Reassign a cluster slot to a different pool. Empty string = unassign. If the slot is currently active, Manager cycles Stopping/Terminated/ Online so the updated tags["pool"] propagates to AutoManager — containers on the worker survive (the worker preserves them across stream drops). Callers should ensure no jobs are currently assigned to the node; the brief reconnect window could otherwise interfere with in-flight placement.

startBundleJob(bundleId, replicaIndex, jobName)

Activate a dormant (start_mode = "manual") bundle job. Manager removes the dormant tag and re-emits jobUpdated; placement picks the job up via the normal flow. See §10.2 of the AutoManager design.

startJob(jobId, role, nodeId)

Start a job on a node

stopBundleJob(bundleId, replicaIndex, jobName)

Deactivate a bundle job by re-stamping the dormant tag.

v1 caveat: this is the tag-flip half only. Runtime termination of any currently-running workload and empty-node release with linger are tracked as Phase E.5 (pre-go-live). See §10.2.1.

stopJob(jobId, role, nodeId)

Stop a job running on a node

terminateNode(nodeId)

Forcibly stop a node

updateBundle(bundle)

Update a bundle (AutoManager v1). Same convention as createBundle — caller passes raw PB.

updateJob(job)

Update a job