divyachakshu 0.1.1__tar.gz

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.
Files changed (93) hide show
  1. divyachakshu-0.1.1/.github/workflows/ci.yml +15 -0
  2. divyachakshu-0.1.1/.github/workflows/macos-smoke.yml +53 -0
  3. divyachakshu-0.1.1/.github/workflows/release.yml +43 -0
  4. divyachakshu-0.1.1/.gitignore +12 -0
  5. divyachakshu-0.1.1/AGENTS.md +127 -0
  6. divyachakshu-0.1.1/CONTRIBUTING.md +101 -0
  7. divyachakshu-0.1.1/Dockerfile +22 -0
  8. divyachakshu-0.1.1/LICENSE +21 -0
  9. divyachakshu-0.1.1/PKG-INFO +285 -0
  10. divyachakshu-0.1.1/README.md +268 -0
  11. divyachakshu-0.1.1/docker-compose.yml +10 -0
  12. divyachakshu-0.1.1/npm/LICENSE +21 -0
  13. divyachakshu-0.1.1/npm/README.md +35 -0
  14. divyachakshu-0.1.1/npm/bin/oi.js +204 -0
  15. divyachakshu-0.1.1/npm/package.json +31 -0
  16. divyachakshu-0.1.1/pyproject.toml +49 -0
  17. divyachakshu-0.1.1/scripts/check-release-versions.sh +30 -0
  18. divyachakshu-0.1.1/scripts/macos-smoke.sh +107 -0
  19. divyachakshu-0.1.1/scripts/npm-sandbox-smoke.sh +76 -0
  20. divyachakshu-0.1.1/scripts/test-without-opencode.sh +29 -0
  21. divyachakshu-0.1.1/src/oi_agent/__init__.py +9 -0
  22. divyachakshu-0.1.1/src/oi_agent/_tempowner.py +115 -0
  23. divyachakshu-0.1.1/src/oi_agent/agent/__init__.py +1 -0
  24. divyachakshu-0.1.1/src/oi_agent/agent/reply.py +28 -0
  25. divyachakshu-0.1.1/src/oi_agent/cli.py +1524 -0
  26. divyachakshu-0.1.1/src/oi_agent/config.py +572 -0
  27. divyachakshu-0.1.1/src/oi_agent/daemon.py +697 -0
  28. divyachakshu-0.1.1/src/oi_agent/dynamics.py +1533 -0
  29. divyachakshu-0.1.1/src/oi_agent/external/__init__.py +31 -0
  30. divyachakshu-0.1.1/src/oi_agent/external/_docparse.py +272 -0
  31. divyachakshu-0.1.1/src/oi_agent/external/_imageprep.py +95 -0
  32. divyachakshu-0.1.1/src/oi_agent/external/_status.py +25 -0
  33. divyachakshu-0.1.1/src/oi_agent/external/documents.py +244 -0
  34. divyachakshu-0.1.1/src/oi_agent/external/images.py +245 -0
  35. divyachakshu-0.1.1/src/oi_agent/external/intent.py +392 -0
  36. divyachakshu-0.1.1/src/oi_agent/external/prepare.py +470 -0
  37. divyachakshu-0.1.1/src/oi_agent/external/records.py +238 -0
  38. divyachakshu-0.1.1/src/oi_agent/external/research.py +515 -0
  39. divyachakshu-0.1.1/src/oi_agent/external/retrieval.py +606 -0
  40. divyachakshu-0.1.1/src/oi_agent/opencode/__init__.py +1 -0
  41. divyachakshu-0.1.1/src/oi_agent/opencode/bootstrap.py +403 -0
  42. divyachakshu-0.1.1/src/oi_agent/opencode/native.py +456 -0
  43. divyachakshu-0.1.1/src/oi_agent/opencode/paths.py +97 -0
  44. divyachakshu-0.1.1/src/oi_agent/opencode/policy.py +375 -0
  45. divyachakshu-0.1.1/src/oi_agent/opencode/prompt.py +508 -0
  46. divyachakshu-0.1.1/src/oi_agent/opencode/provenance.py +78 -0
  47. divyachakshu-0.1.1/src/oi_agent/opencode/review_snapshots.py +961 -0
  48. divyachakshu-0.1.1/src/oi_agent/opencode/review_target.py +522 -0
  49. divyachakshu-0.1.1/src/oi_agent/opencode/runner.py +1870 -0
  50. divyachakshu-0.1.1/src/oi_agent/poster.py +554 -0
  51. divyachakshu-0.1.1/src/oi_agent/reflection/__init__.py +5 -0
  52. divyachakshu-0.1.1/src/oi_agent/reflection/engine.py +785 -0
  53. divyachakshu-0.1.1/src/oi_agent/reminders.py +255 -0
  54. divyachakshu-0.1.1/src/oi_agent/store.py +2036 -0
  55. divyachakshu-0.1.1/src/oi_agent/watch/__init__.py +1 -0
  56. divyachakshu-0.1.1/src/oi_agent/watch/attachments.py +400 -0
  57. divyachakshu-0.1.1/src/oi_agent/watch/context_request.py +308 -0
  58. divyachakshu-0.1.1/src/oi_agent/watch/discord_client.py +2096 -0
  59. divyachakshu-0.1.1/src/oi_agent/watch/gate.py +175 -0
  60. divyachakshu-0.1.1/tests/conftest.py +68 -0
  61. divyachakshu-0.1.1/tests/test_cli.py +1736 -0
  62. divyachakshu-0.1.1/tests/test_config.py +349 -0
  63. divyachakshu-0.1.1/tests/test_context_request.py +403 -0
  64. divyachakshu-0.1.1/tests/test_daemon.py +462 -0
  65. divyachakshu-0.1.1/tests/test_docs_only_write.py +328 -0
  66. divyachakshu-0.1.1/tests/test_durable_delivery.py +1279 -0
  67. divyachakshu-0.1.1/tests/test_external_attachments.py +362 -0
  68. divyachakshu-0.1.1/tests/test_external_documents.py +206 -0
  69. divyachakshu-0.1.1/tests/test_external_intent.py +242 -0
  70. divyachakshu-0.1.1/tests/test_external_limitation.py +371 -0
  71. divyachakshu-0.1.1/tests/test_external_retrieval.py +472 -0
  72. divyachakshu-0.1.1/tests/test_gate.py +245 -0
  73. divyachakshu-0.1.1/tests/test_imports.py +19 -0
  74. divyachakshu-0.1.1/tests/test_message_path.py +628 -0
  75. divyachakshu-0.1.1/tests/test_multi_repo.py +732 -0
  76. divyachakshu-0.1.1/tests/test_native_env_mise.py +22 -0
  77. divyachakshu-0.1.1/tests/test_opencode_bootstrap.py +333 -0
  78. divyachakshu-0.1.1/tests/test_opencode_e2e.py +87 -0
  79. divyachakshu-0.1.1/tests/test_opencode_external_run.py +356 -0
  80. divyachakshu-0.1.1/tests/test_opencode_policy.py +153 -0
  81. divyachakshu-0.1.1/tests/test_opencode_runner.py +1486 -0
  82. divyachakshu-0.1.1/tests/test_personality.py +657 -0
  83. divyachakshu-0.1.1/tests/test_poster.py +688 -0
  84. divyachakshu-0.1.1/tests/test_prev_image_attachments.py +382 -0
  85. divyachakshu-0.1.1/tests/test_reflection.py +1422 -0
  86. divyachakshu-0.1.1/tests/test_reminders.py +312 -0
  87. divyachakshu-0.1.1/tests/test_reply_pdf_attachments.py +224 -0
  88. divyachakshu-0.1.1/tests/test_review_snapshots.py +781 -0
  89. divyachakshu-0.1.1/tests/test_review_target.py +510 -0
  90. divyachakshu-0.1.1/tests/test_runtime_binary.py +41 -0
  91. divyachakshu-0.1.1/tests/test_store.py +1479 -0
  92. divyachakshu-0.1.1/tests/test_web_research_split.py +1068 -0
  93. divyachakshu-0.1.1/uv.lock +1044 -0
@@ -0,0 +1,15 @@
1
+ # PR gate: the full test suite (runs without a real OpenCode — tests/conftest.py
2
+ # puts a fake `opencode` on PATH) plus the release version agreement.
3
+ name: ci
4
+ on:
5
+ pull_request:
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: astral-sh/setup-uv@v5
12
+ - name: full test suite
13
+ run: uv run pytest -q
14
+ - name: release versions agree
15
+ run: bash scripts/check-release-versions.sh
@@ -0,0 +1,53 @@
1
+ # Real-macOS smoke (plan P6): the npm wrapper must install OI into its
2
+ # private uv tool dirs and the launchd LaunchAgent must start the private
3
+ # Python oi, never the node shim. No secrets involved: the Discord token is
4
+ # a fake string written by scripts/macos-smoke.sh on the ephemeral runner.
5
+ name: macos-smoke
6
+
7
+ on:
8
+ workflow_dispatch:
9
+ pull_request:
10
+ push:
11
+ branches:
12
+ - feat/mac-npm
13
+
14
+ jobs:
15
+ smoke:
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ # macos-latest = macOS 26 (Apple Silicon); macos-15-intel is the
20
+ # newest Intel label GitHub still offers (runner-images docs).
21
+ os: [macos-latest, macos-15-intel]
22
+ runs-on: ${{ matrix.os }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: astral-sh/setup-uv@v5
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: 20
29
+ - name: Build wheel and npm tarball
30
+ run: |
31
+ uv build
32
+ (cd npm && npm pack --pack-destination "$GITHUB_WORKSPACE" >/dev/null)
33
+ - name: Install the npm package globally
34
+ run: npm install -g --no-fund --no-audit divyachakshu-*.tgz
35
+ - name: Install OpenCode (OI's required harness, same installer as `oi init`)
36
+ run: |
37
+ npm install -g --no-fund --no-audit opencode-ai
38
+ opencode --version
39
+ - name: Smoke the wrapper and the LaunchAgent
40
+ run: bash scripts/macos-smoke.sh
41
+ - name: Collect daemon logs on failure
42
+ if: failure()
43
+ run: |
44
+ mkdir -p smoke-logs/logs smoke-logs/launchagents
45
+ cp -R "$HOME/Library/Logs/oi/." smoke-logs/logs/ 2>/dev/null || true
46
+ cp -R "$HOME/Library/LaunchAgents/." smoke-logs/launchagents/ 2>/dev/null || true
47
+ - name: Upload failure artifacts
48
+ if: failure()
49
+ uses: actions/upload-artifact@v4
50
+ with:
51
+ name: macos-smoke-logs-${{ matrix.os }}
52
+ path: smoke-logs
53
+ if-no-files-found: ignore
@@ -0,0 +1,43 @@
1
+ # Publishes a v* tag: PyPI (divyachakshu) via trusted publishing, then the
2
+ # npm wrapper (divyachakshu) via npm provenance. Both are OIDC-authenticated —
3
+ # no PyPI token and no NPM_TOKEN exist or are used. Agents never publish;
4
+ # the one-time bootstrap is described in README "Releasing".
5
+ name: release
6
+ on:
7
+ push:
8
+ tags: ['v*']
9
+ permissions:
10
+ contents: read
11
+ jobs:
12
+ pypi:
13
+ name: PyPI (divyachakshu)
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ id-token: write
17
+ environment: pypi
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - uses: astral-sh/setup-uv@v5
21
+ - name: tag must equal pyproject and npm versions
22
+ run: bash scripts/check-release-versions.sh
23
+ - run: uv build
24
+ - uses: pypa/gh-action-pypi-publish@release/v1
25
+
26
+ npm:
27
+ name: npm (divyachakshu)
28
+ needs: pypi
29
+ runs-on: ubuntu-latest
30
+ permissions:
31
+ id-token: write
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 22
37
+ registry-url: 'https://registry.npmjs.org/'
38
+ # Trusted publishing (OIDC-authenticated PUT) requires npm >= 11.5.
39
+ - run: npm install -g npm@11.6.2
40
+ - name: tag must equal pyproject and npm versions
41
+ run: bash scripts/check-release-versions.sh
42
+ - run: npm publish --provenance --access public
43
+ working-directory: npm
@@ -0,0 +1,12 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ dist/
6
+ .sandbox/
7
+ build/
8
+ *.egg-info/
9
+ .oi/state.db
10
+ docs/memory/
11
+ docs/plans/
12
+ .env
@@ -0,0 +1,127 @@
1
+ # AGENTS.md
2
+
3
+ Instructions for AI agents working on this repo. Humans: see CONTRIBUTING.md.
4
+
5
+ ## What this is
6
+
7
+ A standalone Discord bot that read-only audits a local repo clone and answers
8
+ questions autonomously. Safety is structural, not a review queue.
9
+
10
+ ## Commands
11
+
12
+ ```bash
13
+ uv sync --dev
14
+ uv run pytest
15
+ ```
16
+
17
+ **After ANY code change, reinstall or `oi run` runs the OLD build:**
18
+
19
+ ```bash
20
+ uv pip install -e . --force-reinstall --no-deps
21
+ ```
22
+
23
+ ## Safety invariants — never break these
24
+
25
+ - OpenCode is the only model/tool/session harness. Do not add provider HTTP,
26
+ fallback engines, custom tool loops, manifests, or skills.
27
+ - Git remote creds are read-scoped only. Never add code that writes/pushes.
28
+ - OpenCode runs with `OPENCODE_DISABLE_PROJECT_CONFIG=1`, isolated HOME/XDG
29
+ roots, an inline native `agent.oi`, and no `--auto`.
30
+ - Native permissions are read-only by default (repository-scoped `read`, `glob`,
31
+ `list`, and `lsp`; edit/bash/web/MCP/skill/task/question/external access is
32
+ denied). `write_mode=docs-only` optionally grants `edit`/`write` for
33
+ `*.md`/`*.txt` only (secrets and code stay denied), further narrowable via
34
+ `write_dirs`. Reviews always run read-only.
35
+ - Only the final completed OpenCode assistant message is deliverable;
36
+ intermediate narration and reasoning never reach the outbox or Discord.
37
+ - MR/PR references resolve only against configured watched repositories.
38
+ Controller-side MR fetching is read-only and limited to configured
39
+ repositories (`ls-remote`/`fetch` plus bounded `ls-tree`/`cat-file`/`diff`)
40
+ using provider-owned refs and temporary snapshots that are never persisted.
41
+ Unsupported, ambiguous, or unresolved references fail honestly and never fall back to auditing the
42
+ current checkout. Review provenance carries exact full base/head SHAs, and
43
+ review sessions are never resumed or stored under a conversation key.
44
+ - Conversation sessions are scoped to `(conversation_id, repo_path)` and rotate
45
+ before reuse at the completed-delivery cap or idle TTL. `!fresh`/`!new` and
46
+ `oi session forget` clear mappings only; they never widen permissions, erase
47
+ behavioral memory, or enable review-session reuse. Bounded current Discord
48
+ context may still be included. Count each successful delivery batch once;
49
+ failed or duplicate completions must not advance turns. CLI `--all` is scoped
50
+ to the required conversation, never a global forget.
51
+ - Never log prompts, repository evidence, replies, model reasoning, credentials,
52
+ or raw JSONL events. Bounded metadata only.
53
+ - Posting is gated by the channel allowlist + per-channel hourly cap + kill
54
+ switch (`oi pause`). Poster is the only Discord sender.
55
+ - SQLite stores only pause/cap state, durable queue/outbox metadata, scope
56
+ cursors, conversation/repository OpenCode session IDs with completed-delivery
57
+ counts and update timestamps, and bounded, structured, versioned behavioral
58
+ memory signals (scoped member profiles, expiring transient
59
+ state, team pulse, and agent calibration). Never store prompts, repository evidence,
60
+ reasoning, source message bodies, thread excerpts, or free-form generated text.
61
+ - Bounded outbound reply chunks are stored in the SQLite outbox ONLY until
62
+ Discord delivery confirmation, after which body text is scrubbed (`body = NULL`).
63
+
64
+ ## Confidentiality
65
+
66
+ - Never include personal details, real names, internal URLs, deployment
67
+ specifics, credentials, or the substance of private discussions.
68
+ - Never paste repository contents, config values, or evidence into external
69
+ services. Assume anything sent out is cached and permanent.
70
+ - Web search queries (owner 2026-10-19): the tool-free classifier may read the
71
+ current message plus the last ≤50 channel messages to infer what to search;
72
+ only its own short query (≤200 chars, private-referential check applied)
73
+ goes to the isolated research run. Raw messages, names, and bot-posted URLs
74
+ never do. The query is never logged.
75
+
76
+ ## Team memory and reflection contract
77
+
78
+ - **Bounded structured signals only**: SQLite may store versioned, bounded,
79
+ structured behavioral signals. Every profile is strictly scoped by
80
+ `(platform, scope_id, member_id)` and team pulse/calibration by
81
+ `(platform, scope_id)`. One team can never access another team's memory.
82
+ - **Strictly forbidden storage**: Raw source messages, excerpts, agent replies,
83
+ prompts, reasoning, tool traces, or free-form prose critiques are NEVER stored.
84
+ - **Prohibited inference categories**: Protected traits, medical or psychological
85
+ diagnoses, performance evaluations, employee scoring, and cross-scope identity
86
+ linking are strictly prohibited.
87
+ - **Transient expiry & operator controls**: Transient state (energy, pulse, calibration)
88
+ must expire automatically. Operators have local inspection, reset, prune, and deletion
89
+ controls (`oi memory`).
90
+ - **Best-effort reflection**: Reflection runs asynchronously after confirmed delivery
91
+ without delaying posting. Raw inputs are never persisted for retries; crashes may
92
+ safely lose an observation.
93
+
94
+ ## Where things live
95
+
96
+ - `opencode/bootstrap.py` — dependency, auth, and model bootstrap.
97
+ - `opencode/policy.py` — native fail-closed permission map.
98
+ - `opencode/prompt.py` — embedded OI safety/evidence/response contract.
99
+ - `opencode/runner.py` — bounded async OpenCode subprocess runner.
100
+ - `watch/discord_client.py` — admission, debounce, sessions, and Poster seam.
101
+ - `store.py` — pause, cap, and OpenCode session state.
102
+ - `daemon.py` — dedicated user and hardened systemd lifecycle.
103
+ - `config.py` — strict OpenCode-only TOML validation and atomic writes.
104
+
105
+ ## Durable delivery & queue contract
106
+
107
+ - **At-least-once delivery**: Mention jobs are admitted into SQLite before OpenCode
108
+ execution and leased atomically. If the daemon restarts mid-execution or mid-post,
109
+ unconfirmed work is recovered and retried.
110
+ - **Startup reconciliation**: On connection/reconnect, OI queries channel and thread
111
+ history beyond stored `discord_scopes` cursors to backfill any missed mentions.
112
+ - **Outbox lifecycle & privacy**: Generated response chunks are recorded in
113
+ `outbound_chunks` with unique nonces and SHA-256 digests. Once Discord delivery is
114
+ confirmed, the batch is marked done and chunk bodies are scrubbed (`body = NULL`).
115
+ - **Queue operations**: Operators can inspect the queue with `oi queue status`,
116
+ retry dead-lettered jobs with `oi queue retry`, and prune completed records with
117
+ `oi queue purge`.
118
+ ## Config
119
+
120
+ Never hand-edit `~/.config/oi/config.toml`. Use `oi config set <key> <value>`
121
+ (validated, atomic). Legacy provider/base-URL/API-key/tool-loop/search keys are
122
+ rejected; provider credentials belong to OpenCode's isolated auth store.
123
+
124
+ ## Plan + memory
125
+
126
+ For non-tiny work, before coding write a plan in `docs/plans/immediate/` and a
127
+ 1:1 mapped memory file in `docs/memory/`; update phase status as you go.
@@ -0,0 +1,101 @@
1
+ # Contributing
2
+
3
+ A change is good when the tests pass, the safety invariants hold, and it has
4
+ been reviewed.
5
+
6
+ ## Getting started
7
+
8
+ ```bash
9
+ uv sync --dev
10
+ uv run pytest
11
+ ```
12
+
13
+ After a code change, reinstall so the installed `oi` command uses current code:
14
+
15
+ ```bash
16
+ uv pip install -e . --force-reinstall --no-deps
17
+ ```
18
+
19
+ ## Before opening a PR
20
+
21
+ - `uv run pytest` is green.
22
+ - New behavior has a behavioral test.
23
+ - OpenCode-only safety invariants still hold.
24
+ - The PR description says what changed and why.
25
+
26
+ ## Safety invariants
27
+
28
+ - **Read-only credentials.** Git remotes are read-scoped; never add write/push
29
+ paths.
30
+ - **Final-only output.** Only the final completed OpenCode assistant message is
31
+ deliverable. Intermediate narration, reasoning, and partial assistant steps
32
+ never reach the outbox or Discord, and reply truncation preserves the
33
+ provenance footer.
34
+ - **Read-only merge-request audits.** MR/PR references resolve only against
35
+ configured watched repositories. Controller-side MR fetching is read-only and
36
+ limited to configured repositories; temporary base/head snapshots are never
37
+ persisted. Model permissions remain read-only file inspection with no Git,
38
+ network, or shell access. Review provenance carries exact base/head SHAs,
39
+ and unsupported, ambiguous, or unresolved references fail honestly instead of
40
+ auditing the current checkout.
41
+ - **Native fail-closed agent.** OpenCode receives an inline native v2
42
+ `agents.oi` config. A broad deny-all rule comes first — it overrides the
43
+ native allow-by-default base policy and constrains hidden maintenance
44
+ agents — and only repository-scoped `read` and `glob` are re-granted
45
+ afterwards. `shell`, `subagent`, `skill`, `question`, `webfetch`,
46
+ `websearch`, `execute`, `edit`, and external directories stay denied;
47
+ `lsp` is not a v2 action and is never used. Only native v2 is supported:
48
+ v1 and unknown future major versions are rejected, never shimmed.
49
+ - **Untrusted external evidence.** Retrieval, downloads, and parsing are
50
+ controller-owned; the model receives a bounded, delimited untrusted-evidence
51
+ block and never web/network tools. External text or images can never
52
+ authorize a tool call, permission, write, or new request. Private-referential
53
+ asks fail honestly; queries and URLs come only from the current request.
54
+ External runs are read-only, session-free, use disposable native storage
55
+ (deleted afterwards, minimal copied credential rows only), and honor the
56
+ `external_inputs`/`image_inputs` capability switches plus every
57
+ attachment cap on actual bytes.
58
+ - **Project-config isolation.** Runtime sets
59
+ `OPENCODE_DISABLE_PROJECT_CONFIG=1` and isolated HOME/XDG roots. Never import
60
+ personal OpenCode auth, plugins, agents, MCP servers, or config.
61
+ - **No evidence leakage.** Never log prompts, file contents, grep matches,
62
+ replies, model reasoning, credentials, or raw OpenCode events.
63
+ - **Posting rails.** Channel allowlist, per-channel hourly cap, pause switch,
64
+ burst coalescing, and Poster-only Discord delivery stay intact.
65
+ - **Session privacy & bounded memory.** SQLite stores only an OpenCode session
66
+ ID, conversation ID, repository path, update timestamp, and bounded, structured,
67
+ versioned behavioral memory signals scoped strictly by platform/team/member.
68
+ Raw source messages, excerpts, prompts, reasoning, and replies are strictly
69
+ forbidden. Transient states require automatic expiry, and operators maintain
70
+ mandatory inspection and deletion controls (`oi memory`). Prohibited inference
71
+ categories (protected traits, diagnoses, personnel judgments, and cross-scope
72
+ identity linking) are strictly barred. Reflection is asynchronous, failure-isolated,
73
+ and best-effort without storing raw retry inputs.
74
+
75
+ ## Config and runtime
76
+
77
+ Use `oi config set <key> <value>` instead of hand-editing TOML. The supported
78
+ runtime fields are `opencode_binary`, exact `opencode_model` (`provider/model`),
79
+ `opencode_steps`, `opencode_timeout_seconds`, `environment_mode`
80
+ (`workstation | server`; legacy `auto` values are rejected with a repair hint
81
+ and are accepted only as the explicit repair target), `external_inputs`
82
+ (`disabled | read-only`), `image_inputs` (`off | on`),
83
+ `max_external_evidence_items`, `max_attachments`, `max_attachment_bytes`,
84
+ Discord settings, reply limits, personality, and watch targets. Provider API
85
+ keys and base URLs belong only to OpenCode's isolated credential store.
86
+
87
+ ## Where things live
88
+
89
+ - `opencode/bootstrap.py` — dependency, auth, and model bootstrap
90
+ - `opencode/policy.py` — fail-closed native v2 agent permissions
91
+ - `opencode/prompt.py` — inline OI evidence/safety/response contract
92
+ - `opencode/native.py` — disposable native roots, credential-row copying, and
93
+ authoritative completion proof from native database state
94
+ - `opencode/runner.py` — bounded async JSONL subprocess execution
95
+ - `external/` — controller-owned retrieval (news/web/URL), intent detection,
96
+ attachment caps, and document/image parsing
97
+ - `watch/attachments.py` — platform attachment gathering within authorized scope
98
+ - `watch/discord_client.py` — Gateway admission, scheduling, and Poster seam
99
+ - `store.py` — pause, cap, and session state
100
+ - `daemon.py` — systemd unit and service-user lifecycle
101
+ - `config.py` — validated OpenCode-only config
@@ -0,0 +1,22 @@
1
+ FROM python:3.12-slim
2
+ WORKDIR /app
3
+ # uv (pinned version) is the only install path: `uv sync --frozen` installs
4
+ # exactly the dependency set in uv.lock and FAILS THE BUILD if pyproject.toml
5
+ # and uv.lock disagree. pip install . would re-resolve open-ended ranges.
6
+ COPY --from=ghcr.io/astral-sh/uv:0.7.13 /uv /usr/local/bin/uv
7
+ # git is required at runtime: audits shell out to git for pull, SHA, and
8
+ # check-ignore.
9
+ RUN apt-get update && apt-get install -y --no-install-recommends git \
10
+ && rm -rf /var/lib/apt/lists/*
11
+ COPY pyproject.toml uv.lock README.md ./
12
+ COPY src ./src
13
+ RUN uv sync --frozen --no-dev --no-editable
14
+ # Run as non-root; no shell tools needed beyond what's installed.
15
+ RUN useradd -m oi && mkdir -p /data /home/oi/.config/oi \
16
+ && chown -R oi /app /data /home/oi/.config/oi
17
+ USER oi
18
+ ENV PYTHONUNBUFFERED=1 PATH="/app/.venv/bin:$PATH"
19
+ # Container paths: config at /home/oi/.config/oi/config.toml, secrets via
20
+ # env_file, state db on the /data volume (override with db_path in config).
21
+ ENTRYPOINT ["oi"]
22
+ CMD ["run"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UKD
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.