lmoci guide

Overview

lmoci is the Oracle Cloud Infrastructure host for LMScript. It implements the shared provider-neutral lmcloud schema on Go hostkit with official OCI draft-cavage RSA-SHA256 request signing (github.com/oracle/oci-go-sdk/v65), and also provides a 16-section OCI inventory, Object Storage, Queue, Streaming, IAM, and Vault/KMS CLI and scripting surface.

Architecture and endpoint resolution

The lmoci Go host resolves endpoints using a strict precedence chain:

1. cloud.set_endpoint(service | "all", url)
2. LMCLOUD_<SVC>_ENDPOINT
3. LMOCI_<SVC>_ENDPOINT
4. LMCLOUD_ENDPOINT
5. LMOCI_ENDPOINT
6. OCI_OBJECT_STORAGE_ENDPOINT / OCI_QUEUE_ENDPOINT
7. OCI_ENDPOINT

When no endpoint is configured, lmoci executes offline against hostkit/fakeadapter in memory. When pointed at a loopback endpoint such as http://127.0.0.1:4599 (ocisim), lmoci discovers the Object Storage namespace via GET /n/ (or uses LMOCI_SIM_NAMESPACE), resolves the compartment OCID from LMOCI_SIM_COMPARTMENT_ID or the tenancy segment of LMOCI_SIM_KEY_ID, and signs every HTTP request using the OCI draft-cavage signature format.

Working with ocisim in open and enforce modes

lmoci pairs directly with ocisim on 127.0.0.1:4599 for both open and IAM-enforced testing:

OCI service mapping and direct CLI subcommands

Under the shared lmcloud schema, portable calls map to OCI REST endpoints:

Standard lmcode_std_v3 REST and CLI interfaces

lmoci embeds lmcode-go with all 226 lmcode_std_v3 standard signatures and the 10 standard REST and CLI SAM interfaces (RestGet, RestPost, RestPut, RestDelete, RestPatch, RestHead, RestOptions, RestHandler, CliCommand, CliOption). You can combine OCI storage and queue calls with HTTP :param routes and CLI options in one script:

p = _lmcode_ cli="lmoci" install="github:lmctl-ai/lmoci@latest";
  @"/tenancy/buckets/:bucket/:key"
  fn handle_get(x: RestExchange) -> void implements RestGet {
    let val = cloud.object_get(x.param("bucket"), x.param("key"));
    x.json("{\"key\":\"" + x.param("key") + "\",\"value\":\"" + val + "\"}");
  }

  @"--compartment"
  fn opt_comp(x: RestExchange) -> void implements CliOption {
    x.set("compartment", x.query("compartment"));
  }

  @"provision"
  fn cmd_prov(x: RestExchange) -> void implements CliCommand {
    cloud.bucket_create("tenancy-bkt");
    cloud.object_put("tenancy-bkt", "compartment.txt", x.get("compartment"));
    x.send("provisioned");
  }

  rest_config("prefix", "/v1");
  let p_out = rest_cli(str_split("--compartment sandbox provision", " "));
  let g_out = rest_cli(str_split("/v1/tenancy/buckets/tenancy-bkt/compartment.txt", " "));
  print(p_out + " | " + g_out);
end _lmcode_