hoja-cli 0.21.4__py3-none-any.whl

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 (107) hide show
  1. VERSION +1 -0
  2. google_workspace/__init__.py +19 -0
  3. google_workspace/client.py +253 -0
  4. google_workspace/config.py +39 -0
  5. google_workspace/errors.py +19 -0
  6. google_workspace/mcp_server.py +100 -0
  7. google_workspace/oauth.py +131 -0
  8. google_workspace/principal.py +83 -0
  9. google_workspace/py.typed +0 -0
  10. google_workspace/tools.py +64 -0
  11. google_workspace/writes.py +44 -0
  12. hoja/__init__.py +29 -0
  13. hoja/__main__.py +6 -0
  14. hoja/auth.py +42 -0
  15. hoja/cli.py +161 -0
  16. hoja/cli_state.py +55 -0
  17. hoja/client.py +268 -0
  18. hoja/commands/__init__.py +4 -0
  19. hoja/commands/auth_cmd.py +271 -0
  20. hoja/commands/comment.py +149 -0
  21. hoja/commands/cycle.py +75 -0
  22. hoja/commands/init.py +108 -0
  23. hoja/commands/issue.py +398 -0
  24. hoja/commands/label.py +163 -0
  25. hoja/commands/memory.py +240 -0
  26. hoja/commands/project.py +56 -0
  27. hoja/commands/raw.py +50 -0
  28. hoja/commands/team.py +102 -0
  29. hoja/commands/update.py +162 -0
  30. hoja/config.py +362 -0
  31. hoja/errors.py +107 -0
  32. hoja/filters.py +150 -0
  33. hoja/graphql/__init__.py +5 -0
  34. hoja/graphql/fragments.py +138 -0
  35. hoja/graphql/mutations.py +160 -0
  36. hoja/graphql/queries.py +245 -0
  37. hoja/mcp/__init__.py +27 -0
  38. hoja/mcp/content.py +151 -0
  39. hoja/mcp/prompts.py +298 -0
  40. hoja/mcp/resources.py +213 -0
  41. hoja/mcp/server.py +189 -0
  42. hoja/memory_board.py +370 -0
  43. hoja/models/__init__.py +37 -0
  44. hoja/models/base.py +64 -0
  45. hoja/models/cycle.py +32 -0
  46. hoja/models/enums.py +62 -0
  47. hoja/models/issue.py +99 -0
  48. hoja/models/label.py +17 -0
  49. hoja/models/project.py +60 -0
  50. hoja/models/team.py +31 -0
  51. hoja/models/user.py +32 -0
  52. hoja/models/workflow.py +65 -0
  53. hoja/output.py +410 -0
  54. hoja/skill_content/commands.md +222 -0
  55. hoja/skill_content/examples.md +193 -0
  56. hoja/skill_content/filters.md +101 -0
  57. hoja/skill_content/output-formats.md +92 -0
  58. hoja/skill_content/overview.md +123 -0
  59. hoja/skill_content/workflows.md +174 -0
  60. hoja_cli-0.21.4.dist-info/METADATA +279 -0
  61. hoja_cli-0.21.4.dist-info/RECORD +107 -0
  62. hoja_cli-0.21.4.dist-info/WHEEL +4 -0
  63. hoja_cli-0.21.4.dist-info/entry_points.txt +4 -0
  64. hoja_cli-0.21.4.dist-info/licenses/LICENSE +21 -0
  65. hoja_server/README.md +135 -0
  66. hoja_server/__init__.py +11 -0
  67. hoja_server/abac.py +116 -0
  68. hoja_server/agent_chat.py +280 -0
  69. hoja_server/agent_conversations.py +91 -0
  70. hoja_server/agent_durable.py +332 -0
  71. hoja_server/agent_prompt.py +117 -0
  72. hoja_server/agent_threads.py +96 -0
  73. hoja_server/agent_uploads.py +60 -0
  74. hoja_server/app.py +2189 -0
  75. hoja_server/cadence.py +231 -0
  76. hoja_server/cli.py +191 -0
  77. hoja_server/cloudflare_realtime.py +110 -0
  78. hoja_server/comment_policy.py +70 -0
  79. hoja_server/connector_actions.py +119 -0
  80. hoja_server/connectors_api.py +375 -0
  81. hoja_server/db.py +1816 -0
  82. hoja_server/denials.py +18 -0
  83. hoja_server/deployment.py +28 -0
  84. hoja_server/email_adapter.py +94 -0
  85. hoja_server/google_login.py +217 -0
  86. hoja_server/google_oidc.py +342 -0
  87. hoja_server/identity_transfer.py +210 -0
  88. hoja_server/mcp_oauth.py +623 -0
  89. hoja_server/mcp_tools.py +579 -0
  90. hoja_server/meeting_policy.py +179 -0
  91. hoja_server/meetings.py +1332 -0
  92. hoja_server/meetings_api.py +909 -0
  93. hoja_server/model_providers.py +205 -0
  94. hoja_server/realtime.py +690 -0
  95. hoja_server/resolvers.py +1281 -0
  96. hoja_server/schema.graphql +477 -0
  97. hoja_server/schema_sdl.py +8 -0
  98. hoja_server/secrets_box.py +39 -0
  99. hoja_server/signup_config.py +292 -0
  100. hoja_server/signup_gate.py +393 -0
  101. hoja_server/signup_policy.py +97 -0
  102. hoja_server/signup_store.py +577 -0
  103. hoja_server/store.py +2179 -0
  104. hoja_server/sync.py +249 -0
  105. hoja_server/tenant_context.py +131 -0
  106. hoja_server/turnstile.py +81 -0
  107. hoja_server/writer.py +1262 -0
@@ -0,0 +1,179 @@
1
+ """ABAC policy for meetings (see ``abac`` for the evaluation model).
2
+
3
+ Attributes the service supplies:
4
+
5
+ subject
6
+ kind "member" (signed-in workspace user) or "guest" (public-link visitor)
7
+ same_org member belongs to the meeting's organization
8
+ admin member is a workspace admin
9
+ key_access "read" / "read_write" for API-key callers, None for browser sessions
10
+ is_host member is the meeting's host
11
+ invited member (or their email) is on the invitee list
12
+ invite_role "cohost" / "attendee" / None, from the invitee row
13
+ team_visible member can see the meeting's team (existing team-visibility rule)
14
+ bound the credential is already attached to a participant row of this meeting
15
+ role participant role: host / cohost / attendee, else None
16
+ state participant state: waiting / admitted / left / denied / removed, else None
17
+ was_admitted participant was admitted earlier in this meeting (a rejoin)
18
+ companion this join adds a second device for a person who is already admitted
19
+ passcode_ok the supplied passcode matches
20
+ forced_mute host muted the participant and the meeting disallows self-unmute
21
+ resource
22
+ status, access ("invited" | "team" | "org"), locked, link_enabled, waiting_room,
23
+ join_before_host, passcode_required, full, host_present, screen_share ("all" | "host"),
24
+ chat_enabled, recording ("off" | "allowed" | "recording"), target_role, target_self
25
+ """
26
+ from __future__ import annotations
27
+
28
+ from hoja_server.abac import Context, Decision, Policy, deny, permit
29
+
30
+ # --- actions ---------------------------------------------------------------
31
+ VIEW = "meeting.view"
32
+ PREVIEW = "meeting.preview"
33
+ LIST = "meeting.list"
34
+ CREATE = "meeting.create"
35
+ MANAGE = "meeting.manage"
36
+ SETTINGS = "meeting.settings"
37
+ END = "meeting.end"
38
+ INVITE = "meeting.invite"
39
+ LINK = "link.manage"
40
+ JOIN = "meeting.join"
41
+ ENTER = "meeting.enter" # skip the waiting room
42
+ ADMIT = "participant.admit"
43
+ DENY_ENTRY = "participant.deny"
44
+ MUTE = "participant.mute"
45
+ MUTE_ALL = "meeting.mute_all"
46
+ REMOVE = "participant.remove"
47
+ LOWER_HAND = "participant.lower_hand"
48
+ PROMOTE = "participant.promote"
49
+ TRANSFER_HOST = "participant.transfer_host"
50
+ AUDIO = "media.publish_audio"
51
+ VIDEO = "media.publish_video"
52
+ SCREEN = "media.publish_screen"
53
+ SUBSCRIBE = "media.subscribe"
54
+ CHAT = "chat.send"
55
+ HAND = "hand.raise"
56
+ REACT = "react.send"
57
+ RECORD = "record.control"
58
+ RSVP = "meeting.rsvp"
59
+ USAGE = "meeting.usage"
60
+ MEDIA_STATE = "media.state"
61
+
62
+ READ_ONLY = frozenset({VIEW, PREVIEW, LIST})
63
+ MODERATION = frozenset({ADMIT, DENY_ENTRY, MUTE, MUTE_ALL, REMOVE, LOWER_HAND, RECORD})
64
+ IN_MEETING = frozenset({AUDIO, VIDEO, SCREEN, SUBSCRIBE, CHAT, HAND, REACT, MEDIA_STATE})
65
+ ALL_ACTIONS = frozenset({
66
+ VIEW, PREVIEW, LIST, CREATE, MANAGE, SETTINGS, END, INVITE, LINK, JOIN, ENTER, PROMOTE, TRANSFER_HOST, RSVP, USAGE,
67
+ }) | MODERATION | IN_MEETING
68
+ MUTATING = ALL_ACTIONS - READ_ONLY
69
+
70
+
71
+ def _member(c: Context) -> bool:
72
+ return c.s.kind == "member" and bool(c.s.same_org)
73
+
74
+
75
+ def _live(c: Context) -> bool:
76
+ return c.r.status in ("scheduled", "live")
77
+
78
+
79
+ def _moderator(c: Context) -> bool:
80
+ return c.s.state == "admitted" and c.s.role in ("host", "cohost")
81
+
82
+
83
+ def _in_meeting(c: Context) -> bool:
84
+ return c.s.state == "admitted"
85
+
86
+
87
+ def _host_role(c: Context) -> bool:
88
+ return c.s.role == "host" or bool(c.s.is_host)
89
+
90
+
91
+ RULES = [
92
+ # ---- deny rules (win over every permit) ----
93
+ deny("d-read-only-key", MUTATING, lambda c: c.s.key_access == "read",
94
+ "This API key is read-only."),
95
+ deny("d-cross-org", ALL_ACTIONS - {PREVIEW}, lambda c: c.s.kind == "member" and not c.s.same_org,
96
+ "Meeting belongs to another workspace."),
97
+ deny("d-over", ALL_ACTIONS - {VIEW, PREVIEW, LIST, CREATE, USAGE}, lambda c: not _live(c),
98
+ "This meeting has ended or was cancelled."),
99
+ deny("d-excluded", ALL_ACTIONS - {VIEW, PREVIEW, LIST, CREATE, USAGE}, lambda c: c.s.state in ("removed", "denied"),
100
+ "You were removed from this meeting."),
101
+ deny("d-locked", JOIN, lambda c: bool(c.r.locked) and not c.s.is_host and not c.s.was_admitted,
102
+ "The host locked this meeting."),
103
+ deny("d-full", JOIN, lambda c: bool(c.r.full) and not c.s.is_host and c.s.state != "admitted",
104
+ "This meeting is full."),
105
+ deny("d-passcode", JOIN,
106
+ lambda c: bool(c.r.passcode_required) and not c.s.passcode_ok and not c.s.is_host and not c.s.bound
107
+ and c.s.kind != "member", # members are authorized by the access rules; the passcode guards the public link
108
+ "A valid passcode is required."),
109
+ deny("d-guest-link-off", JOIN, lambda c: c.s.kind == "guest" and not c.r.link_enabled,
110
+ "Guest links are disabled for this meeting."),
111
+ deny("d-wait-for-host", ENTER,
112
+ lambda c: not c.r.host_present and not c.r.join_before_host and not c.s.is_host
113
+ and c.s.role not in ("host", "cohost") and not c.s.companion,
114
+ "Waiting for the host to start the meeting."),
115
+ deny("d-screen-host-only", SCREEN, lambda c: c.r.screen_share == "host" and c.s.role not in ("host", "cohost"),
116
+ "Only hosts can share their screen."),
117
+ deny("d-chat-off", CHAT, lambda c: not c.r.chat_enabled and c.s.role not in ("host", "cohost"),
118
+ "Chat is disabled."),
119
+ deny("d-forced-mute", AUDIO, lambda c: bool(c.s.forced_mute),
120
+ "The host muted you and disabled unmuting."),
121
+ deny("d-target-host", {REMOVE, MUTE, DENY_ENTRY, PROMOTE}, lambda c: c.r.target_role == "host",
122
+ "The host cannot be targeted."),
123
+ deny("d-cohost-vs-cohost", {REMOVE, MUTE}, lambda c: c.s.role == "cohost" and c.r.target_role == "cohost",
124
+ "Co-hosts cannot act on other co-hosts."),
125
+ deny("d-self-remove", REMOVE, lambda c: bool(c.r.target_self), "Use leave to exit a meeting."),
126
+ deny("d-recording-off", RECORD, lambda c: c.r.recording == "off", "Recording is not enabled for this meeting."),
127
+
128
+ # ---- read ----
129
+ permit("p-preview", PREVIEW, lambda c: bool(c.r.link_enabled), "Public link preview (also tells visitors it ended)."),
130
+ permit("p-list", LIST, lambda c: c.s.kind == "member" and bool(c.s.same_org), "Members list their meetings."),
131
+ permit("p-view-involved", VIEW, lambda c: _member(c) and (c.s.is_host or c.s.admin or c.s.invited
132
+ or c.s.role is not None),
133
+ "Host, admin, invitee or participant."),
134
+ permit("p-view-org", VIEW, lambda c: _member(c) and c.r.access == "org", "Workspace-wide meeting."),
135
+ permit("p-view-team", VIEW, lambda c: _member(c) and c.r.access == "team" and bool(c.s.team_visible),
136
+ "Team meeting visible to this member."),
137
+ permit("p-view-guest", VIEW,
138
+ lambda c: c.s.kind == "guest" and bool(c.s.bound) and c.s.state in ("waiting", "admitted", "left"),
139
+ "Guest bound to this meeting."),
140
+
141
+ # ---- create / manage ----
142
+ permit("p-create", CREATE, lambda c: _member(c), "Members can create meetings."),
143
+ permit("p-manage", {MANAGE, LINK, END}, lambda c: _member(c) and (c.s.is_host or c.s.admin),
144
+ "Host or workspace admin."),
145
+ permit("p-invite", INVITE, lambda c: _member(c) and (c.s.is_host or c.s.admin or _moderator(c)),
146
+ "Host, admin or co-host invites people."),
147
+ permit("p-usage", USAGE, lambda c: bool(c.s.bound), "Participants report what they streamed, even as the call ends."),
148
+ permit("p-rsvp", RSVP, lambda c: _member(c) and bool(c.s.invited), "Invitees answer."),
149
+ permit("p-settings", SETTINGS, lambda c: _member(c) and (c.s.is_host or c.s.admin or _moderator(c)),
150
+ "Host, admin or co-host adjusts settings."),
151
+
152
+ # ---- join ----
153
+ permit("p-join-host", JOIN, lambda c: _member(c) and bool(c.s.is_host), "Host joins."),
154
+ permit("p-join-invited", JOIN, lambda c: _member(c) and bool(c.s.invited), "Invitee joins."),
155
+ permit("p-join-org", JOIN, lambda c: _member(c) and c.r.access == "org", "Workspace-wide meeting."),
156
+ permit("p-join-team", JOIN, lambda c: _member(c) and c.r.access == "team" and bool(c.s.team_visible),
157
+ "Team member joins."),
158
+ permit("p-join-guest", JOIN, lambda c: c.s.kind == "guest" and bool(c.r.link_enabled), "Guest joins by link."),
159
+ permit("p-join-bound", JOIN, lambda c: bool(c.s.bound) and c.s.role is not None, "Rejoin."),
160
+ permit("p-enter-moderator", ENTER, lambda c: bool(c.s.is_host) or c.s.invite_role == "cohost"
161
+ or c.s.role in ("host", "cohost"), "Hosts skip the waiting room."),
162
+ permit("p-enter-companion", ENTER, lambda c: bool(c.s.companion), "Another device of someone already in."),
163
+ permit("p-enter-open", ENTER, lambda c: not c.r.waiting_room, "No waiting room."),
164
+ permit("p-enter-rejoin", ENTER, lambda c: bool(c.s.was_admitted), "Previously admitted."),
165
+
166
+ # ---- moderation ----
167
+ permit("p-moderate", MODERATION, _moderator, "Hosts and co-hosts moderate."),
168
+ permit("p-host-only", {PROMOTE, TRANSFER_HOST}, lambda c: c.s.state == "admitted" and c.s.role == "host",
169
+ "Only the host."),
170
+
171
+ # ---- in-meeting ----
172
+ permit("p-in-meeting", IN_MEETING, _in_meeting, "Admitted participants."),
173
+ ]
174
+
175
+ POLICY = Policy(RULES)
176
+
177
+
178
+ def decide(action: str, subject: dict, resource: dict, environment: dict | None = None) -> Decision:
179
+ return POLICY.decide(action, subject, resource, environment)